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