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 positionContents();
56 virtual void move (double x,double y);
57 virtual void move (QPoint);
58 virtual void moveBy (double x,double y);
59 virtual void moveBy (QPoint);
60 virtual void positionBBox();
61 virtual void calcBBoxSize();
62 virtual void setDockPos();
63 virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj
64 virtual void setHeading (QString);
66 virtual void setHideTmp (HideTmpMode);
67 virtual bool hasHiddenExportParent (BranchObj*);
69 virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
70 virtual void addXLink (XLinkObj*);
71 virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
72 virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj
73 virtual void deleteXLinkAt (int); // remove references and delete XLinkObj
74 virtual XLinkObj* XLinkAt (int); // return reference of XLinkObj
75 virtual int countXLink ();
76 virtual BranchObj* XLinkTargetAt (int);
77 void setIncludeImagesVer(bool);
78 bool getIncludeImagesVer();
79 void setIncludeImagesHor(bool);
80 bool getIncludeImagesHor();
81 QString getIncludeImageAttr();
82 virtual LinkableMapObj* addFloatImage();
83 virtual LinkableMapObj* addFloatImage(FloatImageObj*);
84 virtual void removeFloatImage(FloatImageObj*);
85 virtual FloatImageObj* getFirstFloatImage();
86 virtual FloatImageObj* getLastFloatImage();
87 virtual FloatImageObj* getFloatImageNum(const uint &);
89 virtual void savePosInAngle(); // write pos in angle for resorting
90 virtual void setDefAttr (BranchModification); // set default attributes (font, size, ...)
92 virtual BranchObj* addBranch();
93 virtual BranchObj* addBranch(BranchObj*); // makes deep copy of BranchObj
94 virtual BranchObj* addBranchPtr(BranchObj*); // just adds pointer
95 virtual BranchObj* insertBranch(int);
96 virtual BranchObj* insertBranch(BranchObj*,int);
97 virtual BranchObj* insertBranchPtr (BranchObj*,int);
98 virtual void removeBranchHere(BranchObj*);
99 virtual void removeChilds();
100 virtual void removeBranch(BranchObj*);
101 virtual void removeBranchPtr (BranchObj*);
102 virtual void setLastSelectedBranch(BranchObj*);
103 virtual BranchObj* getLastSelectedBranch();
104 virtual BranchObj* getFirstBranch();
105 virtual BranchObj* getLastBranch();
106 virtual BranchObj* getBranchNum(const uint &);
107 virtual bool canMoveBranchUp();
108 virtual BranchObj* moveBranchUp(BranchObj*);
109 virtual bool canMoveBranchDown();
110 virtual BranchObj* moveBranchDown(BranchObj*);
111 virtual BranchObj* moveBranchTo (BranchObj*, int);
112 virtual void alignRelativeTo(const QPoint );
113 virtual void reposition();
115 virtual QRect getTotalBBox(); // return BBox including childs
116 virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
117 virtual void calcBBoxSizeWithChilds(); // calc size of BBox including childs recursivly
119 virtual void select();
120 virtual void unselect();
121 virtual QString getSelectString();
124 static BranchObj* itLast; // iterator for first(), next()
125 BranchObjPtrList branch; // all child branches
126 QPtrList<FloatImageObj> floatimage; // child images
127 QPtrList<XLinkObj> xlink; // xlinks to other branches
129 float angle; // used in mainbranch to reorder mainbranches
131 int lastSelectedBranch; // for going deeper into tree
132 bool scrolled; // true if all childs are scrolled and thus invisible
133 bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
134 bool includeImagesVer; // include floatimages in bbox vertically
135 bool includeImagesHor; // include floatimages in bbox horizontally