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};
16 /////////////////////////////////////////////////////////////////////////////
17 class BranchObj:public OrnamentedObj {
21 BranchObj (QCanvas*, LinkableMapObj* parent);
23 bool operator< ( const BranchObj & );
24 bool operator== ( const BranchObj & );
26 virtual void copy (BranchObj*);
28 virtual int getNum(); // return number of this in parent
29 virtual int getNum(BranchObj*); // return number of this in parent
30 virtual int getFloatImageNum(FloatImageObj*);
31 virtual int countBranches();
32 virtual int countFloatImages();
33 virtual int countXLinks();
34 virtual void setParObjTmp (LinkableMapObj*,QPoint,int);// Only for moving Obj around
35 virtual void unsetParObjTmp(); // reuse original ParObj
37 virtual void unScroll();
38 virtual void toggleScroll(); // scroll or unscroll
39 virtual bool isScrolled(); // returns scroll state
40 virtual bool hasScrolledParent(BranchObj*); // true, if any of the parents is scrolled
41 virtual void tmpUnscroll(); // unscroll scrolled parents temporary e.g. during "find" process
42 virtual void resetTmpUnscroll(); // scroll all tmp scrolled parents again e.g. when unselecting
44 virtual void setVisibility(bool,int); // set visibility
45 virtual void setVisibility(bool); // set vis. for w
46 virtual void setLinkColor(); // set the color of link
47 virtual void setColor(QColor,bool); // set the color of heading
48 virtual QColor getColor(); // get color of heading
51 BranchObj* first (); // set Iterator to first LMO
52 BranchObj* next (); // find next LMO after given one
53 BranchObj* getLastIterator(); // to interrupt and resume next iteration
54 void setLastIterator (BranchObj*); // needed by next()
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 LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj
63 virtual void setHeading (QString);
64 virtual void setURL (QString);
65 virtual QString getURL ();
66 virtual void setVymLink (QString);
67 virtual QString getVymLink ();
68 virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
69 virtual void addXLink (XLinkObj*);
70 virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
71 virtual void deleteXLink (XLinkObj*); // remove references and delete XLinkObj
72 virtual void deleteXLinkAt (int); // remove references and delete XLinkObj
73 virtual XLinkObj* XLinkAt (int); // return reference of XLinkObj
74 virtual int countXLink ();
75 virtual BranchObj* XLinkTargetAt (int);
76 virtual LinkableMapObj* addFloatImage();
77 virtual LinkableMapObj* addFloatImage(FloatImageObj*);
78 virtual void removeFloatImage(FloatImageObj*);
79 virtual FloatImageObj* getFirstFloatImage();
80 virtual FloatImageObj* getLastFloatImage();
81 virtual FloatImageObj* getFloatImageNum(const uint &);
83 virtual void savePosInAngle(); // write pos in angle for resorting
84 virtual void setDefAttr (BranchModification); // set default attributes (font, size, ...)
86 virtual BranchObj* addBranch();
87 virtual BranchObj* addBranch(BranchObj*); // makes deep copy of BranchObj
88 virtual BranchObj* addBranchPtr(BranchObj*); // just adds pointer
89 virtual BranchObj* insertBranch(int);
90 virtual BranchObj* insertBranch(BranchObj*,int);
91 virtual BranchObj* insertBranchPtr (BranchObj*,int);
92 virtual void removeBranchHere(BranchObj*);
93 virtual void removeChilds();
94 virtual void removeBranch(BranchObj*);
95 virtual void removeBranchPtr (BranchObj*);
96 virtual void setLastSelectedBranch(BranchObj*);
97 virtual BranchObj* getLastSelectedBranch();
98 virtual BranchObj* getFirstBranch();
99 virtual BranchObj* getLastBranch();
100 virtual BranchObj* getBranchNum(const uint &);
101 virtual BranchObj* moveBranchUp(BranchObj*);
102 virtual BranchObj* moveBranchDown(BranchObj*);
103 virtual BranchObj* moveBranchTo (BranchObj*, int);
104 virtual void alignRelativeTo(const QPoint );
105 virtual void reposition();
107 virtual QRect getTotalBBox(); // return BBox including childs
108 virtual QRect getBBoxSizeWithChilds(); // return size of BBox including childs
109 virtual void calcBBoxSizeWithChilds(); // calc size of BBox including childs recursivly
111 virtual void select();
112 virtual void unselect();
113 virtual QString getSelectString();
116 static BranchObj* itLast; // iterator for first(), next()
117 BranchObjPtrList branch; // all child branches
118 QPtrList<FloatImageObj> floatimage; // child images
119 QPtrList<XLinkObj> xlink; // xlinks to other branches
121 float angle; // used in mainbranch to reorder mainbranches
123 int lastSelectedBranch; // for going deeper into tree
124 bool scrolled; // true if all childs are scrolled and thus invisible
125 bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
126 QString url; // url to external doc
127 QString vymLink; // path to another map