//
#ifndef __NOTESYM_H
#define __NOTESYM_H
//
//  (C) Copyright 1993-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.
//

class AmdtCNoteImp;
class AmdtCNoteList;
class AmdtNote;
#include "NoteStd.h"

class AmdtCNote : public AcmCSubSymbol {
public:
  virtual AcDbMText& getNoteText(void) const = 0;
  virtual void setNoteText(const AcDbMText& parText) = 0;
  virtual void mirrorTextLocation(AcGeVector3d xDir, AcGeVector3d yDir) = 0;
  virtual int mirrorTextAttachment(AcGeVector3d xDir, AcGeVector3d yDir,
                                   bool bNeed = false) = 0;
  virtual void setCacheValue(LPCTSTR value) = 0;
  virtual CString cacheValue() const = 0;
  virtual void setAttachPoint(const AmdtNoteStd::attachPoint point) = 0;
  virtual AmdtNoteStd::attachPoint attachPoint() const = 0;
  virtual AcArray<Adesk::Int32> templateType() const = 0;
  virtual void setTemplateType(const AcArray<Adesk::Int32>& tempType) = 0;
  virtual void regenDimStyleIds() = 0;  
  virtual AcGePoint3dArray& textBoundingPoints() = 0;
  virtual void setTextBoundingPoints(const AcGePoint3dArray& points) = 0;  
  virtual AcmCLeader * leader(void) const = 0;  
  virtual void setTextAlign(const AmdtNoteStd::textAlignment align) = 0; 
  virtual AmdtNoteStd::textAlignment textAlign() const = 0;
  virtual AmdtNote* getOwner()const = 0;
};

class DllImpExp AmdtNote : public AcmSymbol {
  friend class AcmNoteTranslate;     
public:
  ACRX_DECLARE_MEMBERS(AmdtNote);
  AmdtNote();
  virtual ~AmdtNote();

  // AcDbEntity interface
  using AcmSymbol::transformBy;
  virtual Acad::ErrorStatus transformBy(const AcGeMatrix3d& xform,
                                        double symbolScale);

  virtual void mirrorCoordSys(const AcGeMatrix3d& xMirrorForm,
                              AcGeVector3d& XAxis,
                              AcGeVector3d& YAxis,
                              AcGeVector3d& normal) const;
  // AcDbObject Interface
  virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler*);
  virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;
  virtual Acad::ErrorStatus subErase(Adesk::Boolean erasing);

  // AcmSymbol interface
  virtual Acm::ErrorStatus setSymbolDefaults(AcDbDatabase *pDb = NULL);
  virtual void leaderTipPointChanged(const AcGeVector3d& offset,
                                     const AcmCLeader* leader);
  virtual void setScale(double scale);
  virtual Acm::ErrorStatus removeLeader(Adesk::UInt16 index);
  virtual void regen();
  virtual void setOrigin(const AcGePoint3d &origin);

  //attach - detach support
  virtual Acm::ErrorStatus detachGeomRef();
  virtual Acm::ErrorStatus attachGeomRef(const void* pGeomRef,
                                         const AcDbObjectId &viewId,
                                         const AcGePoint3d &arrowheadLocation);

  virtual Acm::ErrorStatus attachGeomRef(const void* pGeomRef,
                                         const AcGePoint3d &arrowheadLocation);

  AmdtCNote* subSymbol() const;
  void createNote(LPCTSTR productString);
  void createLanding(bool bNeeded = false);
  void setNewLanding(const AcGeVector3d & land);

  bool isLeftOriented();
  bool isLeftOriented(const AcGeVector3d& direction);
  void setLeftOriented(bool leftOriented);

  bool isVerticalLanding();  

  void setNoteText(const ACHAR* textStr);
  ACHAR* noteText(void) const;

  ACHAR* evaluatedNoteText(void) const;

  void setAttachPoint(const AmdtNoteStd::attachPoint point);
  AmdtNoteStd::attachPoint attachPoint() const;
  
  void setTextAlign(const AmdtNoteStd::textAlignment align); 
  AmdtNoteStd::textAlignment textAlign() const;

  bool set2dStructureView(const AcDbObjectId& viewId);
  void get2dStructureView(AcDbObjectId& viewId) const;

  void noteHighlight(Adesk::UInt16 num) const;
  void noteUnhighlight(Adesk::UInt16 num) const;
  void SetSubNoteIndex(Adesk::UInt16 i);
  Adesk::UInt16 GetSubNoteIndex();
  Adesk::Boolean insertSubNoteAt(Adesk::UInt16 index, AmdtCNote* pSubNote);
  Adesk::Boolean removeSubNote(Adesk::UInt16 index);
  Adesk::UInt16 numSubNotes() const;
  AmdtCNote* newSubNote();
  double getMaxWidth() const;
  bool getFlip() const;
  void setFlip(bool bFlip);

protected:
  virtual Adesk::Boolean    subWorldDraw(AcGiWorldDraw* wsg);
  
  virtual Acad::ErrorStatus subGetGeomExtents(AcDbExtents&) const;
  virtual Acad::ErrorStatus subExplode(AcDbVoidPtrArray& entitySet) const;
  virtual void              subList() const;

  virtual Acad::ErrorStatus subGetOsnapPoints(AcDb::OsnapMode, INT_PTR,
                                      const AcGePoint3d&, const AcGePoint3d&,
                                      const AcGeMatrix3d&, AcGePoint3dArray&,
                                      AcDbIntArray&) const;
  virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray&,
                                          AcDbIntArray&,
                                          AcDbIntArray&) 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 subGetClassID(CLSID* pClsid) const;
  
  Acad::ErrorStatus subGetSubentPathsAtGsMarker(AcDb::SubentType     type,
                                             INT_PTR              gsMark,
                                             const AcGePoint3d&   pickPoint,
                                             const AcGeMatrix3d&  viewXform,
                                             int&                 numPaths,
                                             AcDbFullSubentPath*& subentPaths,
                                             int                  numInserts,
                                             AcDbObjectId*        entAndInsertStack) const;

  Acad::ErrorStatus subGetGsMarkersAtSubentPath(const AcDbFullSubentPath& path,
                                             AcArray<INT_PTR>& gsMarkers) const;

private:
  AmdtCNoteList *mpSubSymbol;
  bool mbFlip;
};
DBREF_DECLARE(AmdtNote)


#endif //__NOTESYM_H
