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 children 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*);
35 virtual void setParObjTmp (LinkableMapObj*,QPointF,int);// Only for moving Obj around
36 virtual void unsetParObjTmp(); // reuse original ParObj
38 virtual void setVisibility(bool,int); // set visibility
39 virtual void setVisibility(bool); // set vis. for w
40 virtual void setLinkColor(); // set the color of link
41 virtual void setColorSubtree(QColor); // set the color of heading
43 virtual void positionContents();
44 virtual void move (double x,double y);
45 virtual void move (QPointF);
46 virtual void moveBy (double x,double y);
47 virtual void moveBy (QPointF);
48 virtual void positionBBox();
49 virtual void calcBBoxSize();
50 virtual void setDockPos();
51 virtual LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj
52 virtual LinkableMapObj* findID (QString sid); // find Obj by ID string
53 virtual void setHeading (QString);
55 virtual void setHideTmp (HideTmpMode);
56 virtual bool hasHiddenExportParent ();
58 virtual QString saveToDir (const QString&,const QString&, const QPointF&);// Save data recursivly to tempdir
60 virtual void addXLink (XLinkObj*);
61 virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
62 virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj
63 virtual void deleteXLinkAt (int); // remove references and delete XLinkObj
64 virtual XLinkObj* XLinkAt (int); // return reference of XLinkObj
65 virtual BranchObj* XLinkTargetAt (int);
67 void setIncludeImagesVer(bool);
68 bool getIncludeImagesVer();
69 void setIncludeImagesHor(bool);
70 bool getIncludeImagesHor();
71 QString getIncludeImageAttr();
73 virtual FloatImageObj* addFloatImage();
74 virtual FloatImageObj* addFloatImage(FloatImageObj*);
75 virtual void removeFloatImage(FloatImageObj*);
76 virtual FloatImageObj* getFirstFloatImage();
77 virtual FloatImageObj* getLastFloatImage();
78 virtual FloatImageObj* getFloatImageNum(const uint &);
80 virtual void savePosInAngle(); // write pos in angle for resorting
81 virtual void setDefAttr (BranchModification); // set default attributes (font, size, ...)
83 virtual BranchObj* addBranch();
84 virtual BranchObj* addBranch(BranchObj*); // makes deep copy of BranchObj
85 virtual BranchObj* addBranchPtr(BranchObj*); // just adds pointer
86 virtual BranchObj* insertBranch(int);
87 virtual BranchObj* insertBranch(BranchObj*,int);
88 virtual BranchObj* insertBranchPtr (BranchObj*,int);
89 virtual void removeBranchHere(BranchObj*);
90 virtual void removeChildren();
91 virtual void removeBranch(BranchObj*);
92 virtual void removeBranchPtr (BranchObj*);
94 virtual BranchObj* getFirstBranch();
95 virtual BranchObj* getLastBranch();
96 virtual BranchObj* getBranchNum(int);
98 virtual bool canMoveBranchUp();
99 virtual BranchObj* moveBranchUp(BranchObj*);
100 virtual bool canMoveBranchDown();
101 virtual BranchObj* moveBranchDown(BranchObj*);
103 virtual void sortChildren();
104 virtual BranchObj* linkTo (BranchObj*, int);
105 virtual void alignRelativeTo(const QPointF, bool alignSelf=false );
106 virtual void reposition();
107 virtual void unsetAllRepositionRequests();
109 virtual QPolygonF shape(); //!< Returns arbitrary bounding polygon
110 virtual QRectF getTotalBBox(); // return BBox including children
111 virtual QRectF getBBoxSizeWithChildren(); // return size of BBox including children
112 virtual void calcBBoxSizeWithChildren(); // calc size of BBox including children recursivly
114 virtual QString getSelectString();
115 virtual void setAnimation(const AnimPoint &ap);
116 virtual bool animate();
119 static BranchObj* itLast; // iterator for first(), next()
120 static BranchObj* itFirst; // first iterator for first(), next()
121 QList<BranchObj*> branch; // all child branches
122 QList<FloatImageObj*> floatimage;// child images
123 QList<XLinkObj*> xlink; // xlinks to other branches
128 float angle; // used in mainbranch to reorder mainbranches
130 // bool scrolled; // true if all children 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