branchobj.h
author insilmaril
Wed Jan 25 12:34:55 2006 +0000 (2006-01-25)
changeset 197 d529766ed9db
parent 146 1b52ff19aad5
child 223 e03b393e4e51
permissions -rw-r--r--
Fixed outputFile in OO export
     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 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 	void setIncludeImagesVer(bool);
    77 	bool getIncludeImagesVer();
    78 	void setIncludeImagesHor(bool);
    79 	bool getIncludeImagesHor();
    80 	QString getIncludeImageAttr();
    81 	virtual LinkableMapObj* addFloatImage();
    82 	virtual LinkableMapObj* addFloatImage(FloatImageObj*);
    83 	virtual void removeFloatImage(FloatImageObj*);
    84     virtual FloatImageObj* getFirstFloatImage();
    85     virtual FloatImageObj* getLastFloatImage();
    86 	virtual FloatImageObj* getFloatImageNum(const uint &);
    87 protected:	
    88 	virtual void savePosInAngle();					// write pos in angle for resorting			
    89 	virtual void setDefAttr (BranchModification);	// set default attributes (font, size, ...)
    90 public:	
    91     virtual BranchObj* addBranch();
    92     virtual BranchObj* addBranch(BranchObj*);		// makes deep copy of BranchObj
    93     virtual BranchObj* addBranchPtr(BranchObj*);	// just adds pointer
    94     virtual BranchObj* insertBranch(int);
    95     virtual BranchObj* insertBranch(BranchObj*,int);
    96     virtual BranchObj* insertBranchPtr (BranchObj*,int);
    97     virtual void removeBranchHere(BranchObj*);  
    98     virtual void removeChilds();  
    99     virtual void removeBranch(BranchObj*);  
   100     virtual void removeBranchPtr (BranchObj*);  
   101     virtual void setLastSelectedBranch(BranchObj*);
   102     virtual BranchObj* getLastSelectedBranch();
   103     virtual BranchObj* getFirstBranch();
   104     virtual BranchObj* getLastBranch();
   105 	virtual BranchObj* getBranchNum(const uint &);
   106     virtual BranchObj* moveBranchUp(BranchObj*);
   107     virtual BranchObj* moveBranchDown(BranchObj*);
   108     virtual BranchObj* moveBranchTo (BranchObj*, int);
   109     virtual void alignRelativeTo(const QPoint );
   110 	virtual void reposition();
   111 
   112 	virtual QRect getTotalBBox();			// return BBox including childs			
   113 	virtual QRect getBBoxSizeWithChilds();	// return size of BBox including childs  
   114 	virtual void calcBBoxSizeWithChilds();	// calc size of  BBox including childs recursivly
   115 
   116     virtual void select();
   117     virtual void unselect();
   118 	virtual QString getSelectString();
   119 
   120 protected:
   121 	static BranchObj* itLast;		// iterator for first(), next()
   122     BranchObjPtrList branch;		// all child branches
   123 	QPtrList<FloatImageObj> floatimage;	// child images
   124 	QPtrList<XLinkObj> xlink;		// xlinks to other branches
   125 public:	
   126 	float angle;					// used in mainbranch to reorder mainbranches
   127 protected:	
   128     int lastSelectedBranch;			// for going deeper into tree
   129 	bool scrolled;					// true if all childs are scrolled and thus invisible
   130 	bool tmpUnscrolled;				// can only be true (temporary) for a scrolled subtree
   131 	QString url;					// url to external doc
   132 	QString vymLink;				// path to another map
   133 	bool includeImagesVer;			// include floatimages in bbox vertically
   134 	bool includeImagesHor;			// include floatimages in bbox horizontally
   135 
   136 };
   137 
   138 
   139 #endif
   140