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