branchobj.h
author insilmaril
Wed Apr 25 16:02:54 2007 +0000 (2007-04-25)
changeset 468 82bd254b58da
parent 421 5522d1da7e37
child 529 ce2abdbd0b65
permissions -rw-r--r--
started doxygen documentation
     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 
    10 bool isAbove(BranchObj*,BranchObj*);
    11 
    12 /*! \brief A branch visible in the map */
    13 
    14 /////////////////////////////////////////////////////////////////////////////
    15 class BranchObj:public OrnamentedObj {
    16 public:
    17 	/*! New branches will get use same color for heading as parent */
    18 	enum BranchModification {NewBranch, MovedBranch};
    19 
    20 	/*! If HideExport is used, this branch and its childs will be hidden in export */
    21 	enum HideTmpMode {HideNone, HideExport};
    22 
    23     BranchObj ();
    24     BranchObj (QGraphicsScene*);
    25     BranchObj (QGraphicsScene*, LinkableMapObj* parent);
    26     ~BranchObj ();
    27 	bool operator< ( const BranchObj & );
    28 	bool operator== ( const BranchObj & );
    29     virtual void init ();
    30     virtual void copy (BranchObj*);
    31     void clear();
    32 	virtual int getNum();				// return number of this in parent
    33 	virtual int getNum(BranchObj*);		// return number of this in parent
    34 	virtual int getFloatImageNum(FloatImageObj*);		
    35 	virtual int countBranches();		
    36 	virtual int countFloatImages();		
    37 	virtual int countXLinks();		
    38     virtual void setParObjTmp (LinkableMapObj*,QPointF,int);// Only for moving Obj around
    39 	virtual void unsetParObjTmp();			// reuse original ParObj
    40 
    41 	virtual void unScroll();				
    42 	virtual void toggleScroll();			// scroll or unscroll
    43 	virtual bool isScrolled();				// returns scroll state
    44 	virtual bool hasScrolledParent(BranchObj*);	// true, if any of the parents is scrolled
    45 	virtual void tmpUnscroll();				// unscroll scrolled parents temporary e.g. during "find" process
    46 	virtual void resetTmpUnscroll();		// scroll all tmp scrolled parents again e.g. when unselecting
    47 
    48 	virtual void setVisibility(bool,int);	// set visibility
    49     virtual void setVisibility(bool);	    // set vis. for w
    50 	virtual void setLinkColor();			// set the color of link
    51 	virtual void setColorSubtree(QColor);	// set the color of heading
    52 
    53 	BranchObj* first ();				// set Iterator to first LMO
    54 	BranchObj* next ();					// find next LMO after given one
    55 	BranchObj* getLastIterator();		// to interrupt and resume next iteration
    56 	void setLastIterator (BranchObj*);	// needed by next() 
    57 
    58 	virtual void positionContents();
    59     virtual void move (double x,double y);
    60     virtual void move (QPointF);
    61     virtual void moveBy (double x,double y);
    62     virtual void moveBy (QPointF);
    63     virtual void positionBBox();
    64     virtual void calcBBoxSize();
    65 	virtual void setDockPos();
    66     virtual LinkableMapObj* findMapObj(QPointF,LinkableMapObj*);	// find MapObj 
    67     virtual void setHeading (QString);
    68 
    69 	virtual void setHideTmp (HideTmpMode);
    70 	virtual bool hasHiddenExportParent (BranchObj*);
    71 
    72 	virtual QString saveToDir (const QString&,const QString&, const QPointF&);// Save data recursivly to tempdir
    73 	virtual void addXLink (XLinkObj*);
    74 	virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
    75 	virtual void deleteXLink (XLinkObj*);	// remove references and delete XLinkObj 
    76 	virtual void deleteXLinkAt (int);		// remove references and delete XLinkObj 
    77 	virtual XLinkObj* XLinkAt (int);		// return reference of XLinkObj 
    78 	virtual int countXLink ();
    79 	virtual BranchObj* XLinkTargetAt (int);
    80 	void setIncludeImagesVer(bool);
    81 	bool getIncludeImagesVer();
    82 	void setIncludeImagesHor(bool);
    83 	bool getIncludeImagesHor();
    84 	QString getIncludeImageAttr();
    85 	virtual FloatImageObj* addFloatImage();
    86 	virtual FloatImageObj* addFloatImage(FloatImageObj*);
    87 	virtual void removeFloatImage(FloatImageObj*);
    88     virtual FloatImageObj* getFirstFloatImage();
    89     virtual FloatImageObj* getLastFloatImage();
    90 	virtual FloatImageObj* getFloatImageNum(const uint &);
    91 protected:	
    92 	virtual void savePosInAngle();					// write pos in angle for resorting			
    93 	virtual void setDefAttr (BranchModification);	// set default attributes (font, size, ...)
    94 public:	
    95     virtual BranchObj* addBranch();
    96     virtual BranchObj* addBranch(BranchObj*);		// makes deep copy of BranchObj
    97     virtual BranchObj* addBranchPtr(BranchObj*);	// just adds pointer
    98     virtual BranchObj* insertBranch(int);
    99     virtual BranchObj* insertBranch(BranchObj*,int);
   100     virtual BranchObj* insertBranchPtr (BranchObj*,int);
   101     virtual void removeBranchHere(BranchObj*);  
   102     virtual void removeChilds();  
   103     virtual void removeBranch(BranchObj*);  
   104     virtual void removeBranchPtr (BranchObj*);  
   105     virtual void setLastSelectedBranch(BranchObj*);
   106     virtual BranchObj* getLastSelectedBranch();
   107     virtual BranchObj* getFirstBranch();
   108     virtual BranchObj* getLastBranch();
   109 	virtual BranchObj* getBranchNum(int);
   110     virtual bool canMoveBranchUp();
   111     virtual BranchObj* moveBranchUp(BranchObj*);
   112     virtual bool canMoveBranchDown();
   113     virtual BranchObj* moveBranchDown(BranchObj*);
   114     virtual BranchObj* linkTo (BranchObj*, int);
   115     virtual void alignRelativeTo(const QPointF );
   116 	virtual void reposition();
   117 	virtual void unsetAllRepositionRequests();
   118 
   119 	virtual QRectF getTotalBBox();			// return BBox including childs			
   120 	virtual QRectF getBBoxSizeWithChilds();	// return size of BBox including childs  
   121 	virtual void calcBBoxSizeWithChilds();	// calc size of  BBox including childs recursivly
   122 
   123     virtual void select();
   124     virtual void unselect();
   125 	virtual QString getSelectString();
   126 	virtual void animate();
   127 
   128 protected:
   129 	static BranchObj* itLast;		// iterator for first(), next()
   130 	static BranchObj* itFirst;		// first iterator for first(), next()
   131     QList<BranchObj*> branch;		// all child branches
   132 	QList<FloatImageObj*> floatimage;// child images
   133 	QList<XLinkObj*> xlink;			// xlinks to other branches
   134 public:	
   135 	float angle;					// used in mainbranch to reorder mainbranches
   136 protected:	
   137     int lastSelectedBranch;			// for going deeper into tree
   138 	bool scrolled;					// true if all childs are scrolled and thus invisible
   139 	bool tmpUnscrolled;				// can only be true (temporary) for a scrolled subtree
   140 	bool includeImagesVer;			// include floatimages in bbox vertically
   141 	bool includeImagesHor;			// include floatimages in bbox horizontally
   142 
   143 };
   144 
   145 
   146 #endif
   147