4 #include "floatimageobj.h"
5 #include "linkablemapobj.h"
6 #include "ornamentedobj.h"
10 bool isAbove(BranchObj*,BranchObj*);
12 /*! \brief A branch visible in the map */
14 /*! If HideExport is used, this branch and its childs will be hidden in export */
15 enum HideTmpMode {HideNone, HideExport};
18 /////////////////////////////////////////////////////////////////////////////
19 class BranchObj:public OrnamentedObj {
21 /*! New branches will get use same color for heading as parent */
22 enum BranchModification {NewBranch, MovedBranch};
26 BranchObj (QGraphicsScene*);
27 BranchObj (QGraphicsScene*, LinkableMapObj* parent);
29 bool operator< ( const BranchObj & );
30 bool operator== ( const BranchObj & );
32 virtual void copy (BranchObj*);
34 virtual int getNum(); // return number of this in parent
35 virtual int getNum(BranchObj*); // return number of this in parent
36 virtual int getFloatImageNum(FloatImageObj*);
37 virtual int countBranches();
38 virtual int countFloatImages();
39 virtual int countXLinks();
40 virtual void setParObjTmp (LinkableMapObj*,QPointF,int);// Only for moving Obj around
41 virtual void unsetParObjTmp(); // reuse original ParObj
43 virtual void unScroll();
44 virtual void toggleScroll(); // scroll or unscroll
45 virtual bool isScrolled(); // returns scroll state
46 virtual bool hasScrolledParent(BranchObj*); // true, if any of the parents is scrolled
47 virtual void tmpUnscroll(); // unscroll scrolled parents temporary e.g. during "find" process
48 virtual void resetTmpUnscroll(); // scroll all tmp scrolled parents again e.g. when unselecting
50 virtual void setVisibility(bool,int); // set visibility
51 virtual void setVisibility(bool); // set vis. for w
52 virtual void setLinkColor(); // set the color of link
53 virtual void setColorSubtree(QColor); // set the color of heading
55 BranchObj* first (); // set Iterator to first LMO
56 BranchObj* next (); // find next LMO after given one
57 BranchObj* getLastIterator(); // to interrupt and resume next iteration
58 void setLastIterator (BranchObj*); // needed by next()
60 virtual void positionContents();
61 virtual void move (double x,double y);
62 virtual void move (QPointF);
63 virtual void moveBy (double x,double y);
64 virtual void moveBy (QPointF);
65 virtual void positionBBox();
66 virtual void calcBBoxSize();
67 virtual void setDockPos();
68 virtual LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj
69 virtual LinkableMapObj* findID (QString sid); // find Obj by ID string
70 virtual void setHeading (QString);
72 virtual void setHideTmp (HideTmpMode);
73 virtual bool hasHiddenExportParent ();
75 virtual QString saveToDir (const QString&,const QString&, const QPointF&);// Save data recursivly to tempdir
76 virtual void addXLink (XLinkObj*);
77 virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
78 virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj
79 virtual void deleteXLinkAt (int); // remove references and delete XLinkObj
80 virtual XLinkObj* XLinkAt (int); // return reference of XLinkObj
81 virtual int countXLink ();
82 virtual BranchObj* XLinkTargetAt (int);
83 void setIncludeImagesVer(bool);
84 bool getIncludeImagesVer();
85 void setIncludeImagesHor(bool);
86 bool getIncludeImagesHor();
87 QString getIncludeImageAttr();
88 virtual FloatImageObj* addFloatImage();
89 virtual FloatImageObj* addFloatImage(FloatImageObj*);
90 virtual void removeFloatImage(FloatImageObj*);
91 virtual FloatImageObj* getFirstFloatImage();
92 virtual FloatImageObj* getLastFloatImage();
93 virtual FloatImageObj* getFloatImageNum(const uint &);
95 virtual void savePosInAngle(); // write pos in angle for resorting
96 virtual void setDefAttr (BranchModification); // set default attributes (font, size, ...)
98 virtual BranchObj* addBranch();
99 virtual BranchObj* addBranch(BranchObj*); // makes deep copy of BranchObj
100 virtual BranchObj* addBranchPtr(BranchObj*); // just adds pointer
101 virtual BranchObj* insertBranch(int);
102 virtual BranchObj* insertBranch(BranchObj*,int);
103 virtual BranchObj* insertBranchPtr (BranchObj*,int);
104 virtual void removeBranchHere(BranchObj*);
105 virtual void removeChilds();
106 virtual void removeBranch(BranchObj*);
107 virtual void removeBranchPtr (BranchObj*);
108 virtual void setLastSelectedBranch(BranchObj*);
109 virtual BranchObj* getLastSelectedBranch();
110 virtual BranchObj* getFirstBranch();
111 virtual BranchObj* getLastBranch();
112 virtual BranchObj* getBranchNum(int);
113 virtual bool canMoveBranchUp();
114 virtual BranchObj* moveBranchUp(BranchObj*);
115 virtual bool canMoveBranchDown();
116 virtual BranchObj* moveBranchDown(BranchObj*);
117 virtual void sortChildren();
118 virtual BranchObj* linkTo (BranchObj*, int);
119 virtual void alignRelativeTo(const QPointF );
120 virtual void reposition();
121 virtual void unsetAllRepositionRequests();
123 virtual QRectF getTotalBBox(); // return BBox including childs
124 virtual QRectF getBBoxSizeWithChilds(); // return size of BBox including childs
125 virtual void calcBBoxSizeWithChilds(); // calc size of BBox including childs recursivly
127 virtual void select();
128 virtual void unselect();
129 virtual QString getSelectString();
130 virtual void animate();
133 static BranchObj* itLast; // iterator for first(), next()
134 static BranchObj* itFirst; // first iterator for first(), next()
135 QList<BranchObj*> branch; // all child branches
136 QList<FloatImageObj*> floatimage;// child images
137 QList<XLinkObj*> xlink; // xlinks to other branches
139 float angle; // used in mainbranch to reorder mainbranches
141 int lastSelectedBranch; // for going deeper into tree
142 bool scrolled; // true if all childs are scrolled and thus invisible
143 bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
144 bool includeImagesVer; // include floatimages in bbox vertically
145 bool includeImagesHor; // include floatimages in bbox horizontally