//
#ifndef __ACMPARTLISTOBJECT_H
#define __ACMPARTLISTOBJECT_H
/////////////////////////////////////////////////////////////////////
// (C) Copyright 1993-2007 by Autodesk, Inc. 
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted, 
// provided that the above copyright notice appears in all copies and 
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting 
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC. 
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to 
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
// 
// PartList.h
//
// Description:
// Declaration of part list entity
//
//
/////////////////////////////////////////////////////////////////////

class AmdtItemFilter;
class AcmCPartListImp;
class AcmBom;

class DllImpExp AcmPartList : public AcmSymbol
{
public:
  ACRX_DECLARE_MEMBERS(AcmPartList);

  AcmPartList(bool bCreateImpl = true);
  AcmPartList(Adesk::Int32 minItem,Adesk::Int32 maxItem);
  AcmPartList(AcDbObjectIdArray items);
  AcmPartList(AcDbObjectId view);
  virtual ~AcmPartList();

  virtual Acm::ErrorStatus setSymbolDefaults(AcDbDatabase* pDb = NULL);

  AcDbObjectId bomId() const;
  void setBomId(const AcDbObjectId& bomId);
  AcmBom* tempBomObj() const;
  void setTempBomObj(AcmBom* pBom) const;

  bool isGripFrameEnabled() const;
  void setIsGripFrameEnabled(bool isUse);

  // Result bar
  bool isResultBarEnabled() const;
  void setIsResultBarEnabled(bool isUse);
  // Formula bar
  bool isFormulaBarEnabled() const;
  void setIsFormulaBarEnabled(bool isUse);

  bool isHeadingEnabled() const;
  void setIsHeadingEnabled(bool isUse);
  AcmCPartListStd::AttachmentPoint attachPoint() const;
  Acm::ErrorStatus setAttachPoint(AcmCPartListStd::AttachmentPoint aPoint);
  double width() const;
  void setWidth(double width);

  double columnWidth(int columnIndex);
  void setColumnWidth(int columnIndex, double width);

  double height() const;
  void setHeight(double height);

  AcGePoint3d origin() const; 
  void setOrigin(const AcGePoint3d& pt);
  
  int title() const;
  void setTitle(const int title);

  LPCTSTR titleText() const;
  void setTitleText(const LPCTSTR titleText);
  
  int overFlow(AcmCPartListStd::TextType enText = AcmCPartListStd::kData) const;
  void setOverFlow(const int overflow, AcmCPartListStd::TextType enText = AcmCPartListStd::kAll);

  int textInOneLine(AcmCPartListStd::TextType enText = AcmCPartListStd::kData) const;
  void setTextInOneLine(const int textiol, AcmCPartListStd::TextType enText = AcmCPartListStd::kAll);

  AcmCPartListStd::TextControl textControl(AcmCPartListStd::TextType enText) const;
  void setTextControl(AcmCPartListStd::TextControl enControl, AcmCPartListStd::TextType enText);

  void setTIOLfromStd();


  Acm::PartListMultipleRow multipleRow() const;
  void setMultipleRow(const Acm::PartListMultipleRow multiple);

  AcmCPartList *subSymbol() const;

  // different type of information about Part list.
  Adesk::Int32 minItem() const;
  Acm::ErrorStatus setMinItem(const Adesk::Int32 min);
  Adesk::Int32 maxItem() const;
  Acm::ErrorStatus setMaxItem(const Adesk::Int32 max);

  Acm::ErrorStatus getItemList(AcDbObjectIdArray& items) const;
  Acm::ErrorStatus setItemList(const AcDbObjectIdArray& items);

  Acm::ErrorStatus getViewId(AcDbObjectId& viewId) const;
  Acm::ErrorStatus setViewId(const AcDbObjectId& viewId);

  // associated comp view owner
  AcDbObjectId compViewId() const;
  void setCompViewId(const AcDbObjectId& compViewId);

  //AcmSymbol Interface
  virtual void           regen();

  using AcmSymbol::transformBy;
  virtual Acad::ErrorStatus transformBy(const AcGeMatrix3d& xform,
											 double symbolScale);
 
  // AcDbObject Interface
  virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler);
  virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
  virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler* pFiler);
  virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const;

  virtual Acad::ErrorStatus subClose();
  virtual Acad::ErrorStatus subErase(Adesk::Boolean erasing);

  //Custom Blocks Interface
  virtual bool getCustomBlockIds(AcDbObjectIdArray&) const;
  virtual bool setCustomBlock(LPCTSTR blName);
  virtual LPCTSTR customBlock() const;
  virtual void setFilterEmpty(bool useFilter);
  virtual bool filterEmpty() const;

  //Filter interface
  //If function  returned Acad::eOk, then filter object was added to the database and closed.
  //Its Id is returned in parameter. Filter owner is setted to the partlist Id.
  virtual Acad::ErrorStatus addFilter(AmdtItemFilter*, AcDbObjectId&);
  virtual Acad::ErrorStatus addFilter(Acm::FilterType enType, AcDbObjectId& oId);
  //Gets filters id for partlist
  virtual bool getFilterIds(AcDbObjectIdArray&) const ;
  //Remove and/or erase filter 
  virtual Acad::ErrorStatus removeFilter(const AcDbObjectId&, bool erase = true);

  bool isColumnSplitEnable() const;
  void setColumnSplitEnable(bool bEnable);

  AcmCPartListStd::ColumnSplitWrap  columnSplitWrap() const;
  void                              setColumnSplitWrap(AcmCPartListStd::ColumnSplitWrap enWrap);

  AcmCPartListStd::ColumnSplitStyle columnSplitStyle() const;
  void                              setColumnSplitStyle(AcmCPartListStd::ColumnSplitStyle enStyle);

  int  columnSplitRows() const;
  void setColumnSplitRows(int nRows);

  int  columnSplitSections() const;
  void setColumnSplitSections(int nSections);

  // column splitting is wrap around title block
  bool isColumnSplitWrapAroundTitle() const;
  void setColumnSplitWrapAroundTitle(bool bWrapTitle);

  // get(set) title id which is associated with partlist
  AcDbObjectId getTitleId() const;
  void setTitleId(const AcDbObjectId& titleId);

  // get(set) title height which is associated with partlist
  double getTitleHeight()const;
  void setTitleHeight(const double& dHeight);

  //set partlist attach point if it's split wrap around title
  virtual Acm::ErrorStatus setWrapPListAttachPoint();

protected:
  virtual Adesk::Boolean subWorldDraw(AcGiWorldDraw* pMode);
  
  virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);

  
  // AcDbEntity Interface
  virtual void subList() const;
  virtual Acad::ErrorStatus subExplode(AcDbVoidPtrArray& entitySet) const;
  virtual Acad::ErrorStatus subWblockClone(AcRxObject* pOwnerObject,
                                        AcDbObject*& pClonedObject,
                                        AcDbIdMapping& idMap,
                                        Adesk::Boolean isPrimary = Adesk::kTrue) const;
  virtual Acad::ErrorStatus subGetGeomExtents(AcDbExtents& extents) const;
  virtual Acad::ErrorStatus subGetOsnapPoints(AcDb::OsnapMode     osnapMode,
                                           INT_PTR             gsSelectionMark,
                                           const AcGePoint3d&  pickPoint,
                                           const AcGePoint3d&  lastPoint,
                                           const AcGeMatrix3d& viewXform,
                                           AcGePoint3dArray&   snapPoints,
                                           AcDbIntArray&       geomIds) const;
  virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray& gripPnts,
                                          AcDbIntArray& osnapMasks,
                                          AcDbIntArray& geomIds) const;

  virtual Acad::ErrorStatus   subGetGripPoints(AcDbGripDataPtrArray& grips,
														  const double curViewUnitSize, 
														  const int gripSize, 
														  const AcGeVector3d& curViewDir,
														  const int bitflags) const;

  virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,
                                             const AcGeVector3d& offset);
  virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity* ent,
	                            AcDb::Intersect intType, 
                              AcGePoint3dArray& points,
	                            INT_PTR thisGsMarker = 0, 
                              INT_PTR otherGsMarker = 0) const;
  virtual Acad::ErrorStatus subIntersectWith(const AcDbEntity* ent,
	                            AcDb::Intersect intType, 
                              const AcGePlane& projPlane,
	                            AcGePoint3dArray& points, 
                              INT_PTR thisGsMarker = 0,
	                            INT_PTR otherGsMarker = 0) const;

  virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;

  virtual AcmCPartListImp* getPListImp();
  AcmCPartListImp *mpPartList;
};

MAKE_ACDBOPENOBJECT_FUNCTION(AcmPartList);
DBREF_DECLARE(AcmPartList)

#endif
