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