branchobj.h
author insilmaril
Tue, 07 Mar 2006 11:32:02 +0000
changeset 233 c3943fbd0e74
parent 223 e03b393e4e51
child 239 bdeb503d2b7f
permissions -rw-r--r--
Added xsl for Taskjuggler Export by Matt
     1 #ifndef BRANCHOBJ_H
     2 #define BRANCHOBJ_H
     3 
     4 #include "floatimageobj.h"
     5 #include "linkablemapobj.h"
     6 #include "ornamentedobj.h"
     7 #include "xlinkobj.h"
     8 
     9 class BranchObjPtrList : public QPtrList<BranchObj>
    10 {
    11 	virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j);
    12 };
    13 
    14 enum BranchModification {NewBranch, MovedBranch};
    15 
    16 /////////////////////////////////////////////////////////////////////////////
    17 class BranchObj:public OrnamentedObj {
    18 public:
    19     BranchObj ();
    20     BranchObj (QCanvas*);
    21     BranchObj (QCanvas*, LinkableMapObj* parent);
    22     ~BranchObj ();
    23 	bool operator< ( const BranchObj & );
    24 	bool operator== ( const BranchObj & );
    25     virtual void init ();
    26     virtual void copy (BranchObj*);
    27     void clear();
    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
    36 
    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
    43 
    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
    49 
    50 
    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() 
    55 
    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 void setDockPos();
    63     virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
    64     virtual void setHeading (QString);
    65     virtual void setURL (QString);
    66     virtual QString getURL ();
    67     virtual void setVymLink (QString);
    68     virtual QString getVymLink ();
    69 	virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
    70 	virtual void addXLink (XLinkObj*);
    71 	virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
    72 	virtual void deleteXLink (XLinkObj*);	// remove references and delete XLinkObj 
    73 	virtual void deleteXLinkAt (int);		// remove references and delete XLinkObj 
    74 	virtual XLinkObj* XLinkAt (int);		// return reference of XLinkObj 
    75 	virtual int countXLink ();
    76 	virtual BranchObj* XLinkTargetAt (int);
    77 	void setIncludeImagesVer(bool);
    78 	bool getIncludeImagesVer();
    79 	void setIncludeImagesHor(bool);
    80 	bool getIncludeImagesHor();
    81 	QString getIncludeImageAttr();
    82 	virtual LinkableMapObj* addFloatImage();
    83 	virtual LinkableMapObj* addFloatImage(FloatImageObj*);
    84 	virtual void removeFloatImage(FloatImageObj*);
    85     virtual FloatImageObj* getFirstFloatImage();
    86     virtual FloatImageObj* getLastFloatImage();
    87 	virtual FloatImageObj* getFloatImageNum(const uint &);
    88 protected:	
    89 	virtual void savePosInAngle();					// write pos in angle for resorting			
    90 	virtual void setDefAttr (BranchModification);	// set default attributes (font, size, ...)
    91 public:	
    92     virtual BranchObj* addBranch();
    93     virtual BranchObj* addBranch(BranchObj*);		// makes deep copy of BranchObj
    94     virtual BranchObj* addBranchPtr(BranchObj*);	// just adds pointer
    95     virtual BranchObj* insertBranch(int);
    96     virtual BranchObj* insertBranch(BranchObj*,int);
    97     virtual BranchObj* insertBranchPtr (BranchObj*,int);
    98     virtual void removeBranchHere(BranchObj*);  
    99     virtual void removeChilds();  
   100     virtual void removeBranch(BranchObj*);  
   101     virtual void removeBranchPtr (BranchObj*);  
   102     virtual void setLastSelectedBranch(BranchObj*);
   103     virtual BranchObj* getLastSelectedBranch();
   104     virtual BranchObj* getFirstBranch();
   105     virtual BranchObj* getLastBranch();
   106 	virtual BranchObj* getBranchNum(const uint &);
   107     virtual BranchObj* moveBranchUp(BranchObj*);
   108     virtual BranchObj* moveBranchDown(BranchObj*);
   109     virtual BranchObj* moveBranchTo (BranchObj*, int);
   110     virtual void alignRelativeTo(const QPoint );
   111 	virtual void reposition();
   112 
   113 	virtual QRect getTotalBBox();			// return BBox including childs			
   114 	virtual QRect getBBoxSizeWithChilds();	// return size of BBox including childs  
   115 	virtual void calcBBoxSizeWithChilds();	// calc size of  BBox including childs recursivly
   116 
   117     virtual void select();
   118     virtual void unselect();
   119 	virtual QString getSelectString();
   120 
   121 protected:
   122 	static BranchObj* itLast;		// iterator for first(), next()
   123     BranchObjPtrList branch;		// all child branches
   124 	QPtrList<FloatImageObj> floatimage;	// child images
   125 	QPtrList<XLinkObj> xlink;		// xlinks to other branches
   126 public:	
   127 	float angle;					// used in mainbranch to reorder mainbranches
   128 protected:	
   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 	QString url;					// url to external doc
   133 	QString vymLink;				// path to another map
   134 	bool includeImagesVer;			// include floatimages in bbox vertically
   135 	bool includeImagesHor;			// include floatimages in bbox horizontally
   136 
   137 };
   138 
   139 
   140 #endif
   141