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