branchobj.h
author insilmaril
Tue Mar 14 14:27:16 2006 +0000 (2006-03-14)
changeset 245 27b71695d690
parent 223 e03b393e4e51
child 254 d3080e02b13a
permissions -rw-r--r--
hideLinkInExport for Branches (Floats still missing). Floats are now OrnamentedObj.
     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 setColorChilds(QColor);			// set the color of heading
    48 
    49 	BranchObj* first ();				// set Iterator to first LMO
    50 	BranchObj* next ();					// find next LMO after given one
    51 	BranchObj* getLastIterator();		// to interrupt and resume next iteration
    52 	void setLastIterator (BranchObj*);	// needed by next() 
    53 
    54     virtual void move (double x,double y);
    55     virtual void move (QPoint);
    56     virtual void moveBy (double x,double y);
    57     virtual void moveBy (QPoint);
    58     virtual void positionBBox();
    59     virtual void calcBBoxSize();
    60 	virtual void setDockPos();
    61     virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
    62     virtual void setHeading (QString);
    63 	virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
    64 	virtual void addXLink (XLinkObj*);
    65 	virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
    66 	virtual void deleteXLink (XLinkObj*);	// remove references and delete XLinkObj 
    67 	virtual void deleteXLinkAt (int);		// remove references and delete XLinkObj 
    68 	virtual XLinkObj* XLinkAt (int);		// return reference of XLinkObj 
    69 	virtual int countXLink ();
    70 	virtual BranchObj* XLinkTargetAt (int);
    71 	void setIncludeImagesVer(bool);
    72 	bool getIncludeImagesVer();
    73 	void setIncludeImagesHor(bool);
    74 	bool getIncludeImagesHor();
    75 	QString getIncludeImageAttr();
    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 &);
    82 protected:	
    83 	virtual void savePosInAngle();					// write pos in angle for resorting			
    84 	virtual void setDefAttr (BranchModification);	// set default attributes (font, size, ...)
    85 public:	
    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();
   106 
   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
   110 
   111     virtual void select();
   112     virtual void unselect();
   113 	virtual QString getSelectString();
   114 
   115 protected:
   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
   120 public:	
   121 	float angle;					// used in mainbranch to reorder mainbranches
   122 protected:	
   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 	bool includeImagesVer;			// include floatimages in bbox vertically
   127 	bool includeImagesHor;			// include floatimages in bbox horizontally
   128 
   129 };
   130 
   131 
   132 #endif
   133