4 #include "floatimageobj.h"
5 #include "linkablemapobj.h"
6 #include "ornamentedobj.h"
9 class BranchObjPtrList : public QPtrList<BranchObj>
11 virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j);
14 enum BranchModification {NewBranch, MovedBranch};
15 enum HideTmpMode {HideNone, HideExport};
17 /////////////////////////////////////////////////////////////////////////////
18 class BranchObj:public OrnamentedObj {
22 BranchObj (QCanvas*, LinkableMapObj* parent);
24 bool operator< ( const BranchObj & );
25 bool operator== ( const BranchObj & );
27 virtual void copy (BranchObj*);
29 virtual int getNum(); // return number of this in parent
30 virtual int getNum(BranchObj*); // return number of this in parent
31 virtual int getFloatImageNum(FloatImageObj*);
32 virtual int countBranches();
33 virtual int countFloatImages();
34 virtual int countXLinks();
35 virtual void setParObjTmp (LinkableMapObj*,QPoint,int);// Only for moving Obj around
36 virtual void unsetParObjTmp(); // reuse original ParObj
38 virtual void unScroll();
39 virtual void toggleScroll(); // scroll or unscroll
40 virtual bool isScrolled(); // returns scroll state
41 virtual bool hasScrolledParent(BranchObj*); // true, if any of the parents is scrolled
42 virtual void tmpUnscroll(); // unscroll scrolled parents temporary e.g. during "find" process
43 virtual void resetTmpUnscroll(); // scroll all tmp scrolled parents again e.g. when unselecting
45 virtual void setVisibility(bool,int); // set visibility
46 virtual void setVisibility(bool); // set vis. for w
47 virtual void setLinkColor(); // set the color of link
48 virtual void setColorChilds(QColor); // set the color of heading
50 BranchObj* first (); // set Iterator to first LMO
51 BranchObj* next (); // find next LMO after given one
52 BranchObj* getLastIterator(); // to interrupt and resume next iteration
53 void setLastIterator (BranchObj*); // needed by next()
55 virtual void move (double x,double y);
56 virtual void move (QPoint);
57 virtual void moveBy (double x,double y);
58 virtual void moveBy (QPoint);
59 virtual void positionBBox();
60 virtual void calcBBoxSize();
61 virtual void setDockPos();
62 virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj
63 virtual void setHeading (QString);
65 virtual void setHideTmp (HideTmpMode);
66 virtual bool hasHiddenExportParent (BranchObj*);
68 virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
69 virtual void addXLink (XLinkObj*);
70 virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
71 virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj
72 virtual void deleteXLinkAt (int); // remove references and delete XLinkObj
73 virtual XLinkObj* XLinkAt (int); // return reference of XLinkObj
74 virtual int countXLink ();
75 virtual BranchObj* XLinkTargetAt (int);
76 void setIncludeImagesVer(bool);
77 bool getIncludeImagesVer();
78 void setIncludeImagesHor(bool);
79 bool getIncludeImagesHor();
80 QString getIncludeImageAttr();
81 virtual LinkableMapObj* addFloatImage();
82 virtual LinkableMapObj* addFloatImage(FloatImageObj*);
83 virtual void removeFloatImage(FloatImageObj*);
84 virtual FloatImageObj* getFirstFloatImage();
85 virtual FloatImageObj* getLastFloatImage();
86 virtual FloatImageObj* getFloatImageNum(const uint &);
88 virtual void savePosInAngle(); // write pos in angle for resorting
89 virtual void setDefAttr (BranchModification); // set default attributes (font, size, ...)
91 virtual BranchObj* addBranch();
92 virtual BranchObj* addBranch(BranchObj*); // makes deep copy of BranchObj
93 virtual BranchObj* addBranchPtr(BranchObj*); // just adds pointer
94 virtual BranchObj* insertBranch(int);
95 virtual BranchObj* insertBranch(BranchObj*,int);
96 virtual BranchObj* insertBranchPtr (BranchObj*,int);
97 virtual void removeBranchHere(BranchObj*);
98 virtual void removeChilds();
99 virtual void removeBranch(BranchObj*);
100 virtual void removeBranchPtr (BranchObj*);
101 virtual void setLastSelectedBranch(BranchObj*);
102 virtual BranchObj* getLastSelectedBranch();
103 virtual BranchObj* getFirstBranch();
104 virtual BranchObj* getLastBranch();
105 virtual BranchObj* getBranchNum(const uint &);
106 virtual BranchObj* moveBranchUp(BranchObj*);
107 virtual BranchObj* moveBranchDown(BranchObj*);
108 virtual BranchObj* moveBranchTo (BranchObj*, int);
109 virtual void alignRelativeTo(const QPoint );
110 virtual void reposition();
112 virtual QRect getTotalBBox(); // return BBox including childs
113 virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
114 virtual void calcBBoxSizeWithChilds(); // calc size of BBox including childs recursivly
116 virtual void select();
117 virtual void unselect();
118 virtual QString getSelectString();
121 static BranchObj* itLast; // iterator for first(), next()
122 BranchObjPtrList branch; // all child branches
123 QPtrList<FloatImageObj> floatimage; // child images
124 QPtrList<XLinkObj> xlink; // xlinks to other branches
126 float angle; // used in mainbranch to reorder mainbranches
128 int lastSelectedBranch; // for going deeper into tree
129 bool scrolled; // true if all childs are scrolled and thus invisible
130 bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
131 bool includeImagesVer; // include floatimages in bbox vertically
132 bool includeImagesHor; // include floatimages in bbox horizontally