#ifndef __PARTREF_H
#define __PARTREF_H

//////////////////////////////////////////////////////////////////////
//  (C) Copyright 1994-2008 by Autodesk, Inc.  All rights reserved.
//
// 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.
//
// HEADER FILE : PartRef.h
//
// DESCRIPTION :
// For this class we'll (maybe) support to change from one standard to 
// another standard. Standard controls just how it is drawn. All data 
// doesn't have any influence to its visibility.             
//
class AcmPartRefImp;
enum Acm::BomOverrideType;

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

    AcmPartRef();             
    AcmPartRef(const AcDbObjectId& dataId);             
    AcmPartRef(const AcGePoint3d& origin);             
    virtual ~AcmPartRef();             

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

    AcDbObjectId dataEntryId() const;             
    void setDataEntryId(const AcDbObjectId& id);  
    
    Adesk::UInt32 numItem() const;
    Acad::ErrorStatus setNumItem(Adesk::UInt32 num);

    AcDbObjectId attachedExternalBom() const;             
    Acad::ErrorStatus setAttachedExternalBom(const AcDbObjectId& id);
    Acad::ErrorStatus setAttachedExternalBom(const ACHAR *xrefPath, const ACHAR *bomName);  
    AcDbObjectId attachedExternalBomXrefBlock() const;
    Acad::ErrorStatus detachExternalBom(bool detachXref = true);

    virtual void setOrigin(const AcGePoint3d &origin);

    Adesk::Boolean clonePartRef(AcDbObjectId& newPartRefId);

    Acad::ErrorStatus convertDataEntryData(AcDbObjectId& dataEntryBlkId, AcDbObjectId& refObjId) const;

    // AcDbObject interface
    virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* filer);             
    virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* filer) const;             
    virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler* filer);             
    virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* filer) const;             
    virtual Acad::ErrorStatus subClose();

    Acad::ErrorStatus getBomOverride(
      const ACHAR *attribute,
      ACHAR *& originalValue,
      ACHAR *& originalData,
      ACHAR *& value,
      ACHAR *& data,
      Acm::BomOverrideType &overrideType,
      bool &editable
    ) const;

    Acad::ErrorStatus removeAttribute(const ACHAR *attribute);

protected:
  virtual Adesk::Boolean    subWorldDraw(AcGiWorldDraw*mode); 

  // AcDbEntity interface
  virtual Acad::ErrorStatus subGetGripPoints( AcGePoint3dArray&  gripPoints,AcDbIntArray&  osnapModes,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 subGetOsnapPoints( AcDb::OsnapMode osnapMode,
											   INT_PTR gsSelectionMark,
											   const AcGePoint3d&  pickPoint,
											   const AcGePoint3d&  lastPoint,
											   const AcGeMatrix3d& viewXform,
											   AcGePoint3dArray&   snapPoints,
											   AcDbIntArray&   geomIds) const; 

  virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,const AcGeVector3d& offset); 
  virtual Acad::ErrorStatus subExplode(AcDbVoidPtrArray& entitySet) const;             
  virtual Acad::ErrorStatus subGetGeomExtents(AcDbExtents& extents) const;             
  virtual void              subList() const;      
  
  virtual Acad::ErrorStatus	subGetClassID(CLSID* pClsid) const;

private:
  AcmPartRefImp *mpImp;
};                      

MAKE_ACDBOPENOBJECT_FUNCTION(AcmPartRef);
DBREF_DECLARE(AcmPartRef)

#endif












