22 class TreeItem:public XMLObj
25 enum Type {Undefined,MapCenter,Branch,Image,Attribute,XLink};
26 enum HideTmpMode {HideNone, HideExport};
29 TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
33 // General housekeeping
34 virtual void setModel (VymModel *m);
35 virtual VymModel* getModel();
38 /*! Return number of item, as it would be after it would have been appended.
39 This is used to notify view about layout changes before model is modified. */
40 virtual int getRowNumAppend (TreeItem *child);
42 virtual void appendChild (TreeItem *child);
43 virtual void removeChild (int row);
45 virtual TreeItem *child(int row);
46 virtual int childCount() const;
47 virtual int childNumber() const;
48 virtual int columnCount() const;
49 virtual int branchCount() const;
50 virtual int imageCount() const;
51 virtual int xlinkCount() const;
52 virtual int attributeCount() const;
54 virtual int row() const;
56 virtual TreeItem *parent();
58 /*! Return number of item in parent by type,
59 e.g. first branch has number 0 */
60 virtual int childNum(); //! Return number of item in list of all children
61 virtual int num(); //! Return number of item by type
62 virtual int num (TreeItem *item); //! Return number of item by type
67 virtual void setType (const Type t);
68 virtual Type getType ();
69 virtual bool isBranchLikeType() const;
70 virtual QString getTypeName ();
73 virtual QVariant data(int column) const;
79 virtual void setHeading (const QString s);
80 virtual QString getHeading() const;
81 virtual std::string getHeadingStd() const; //! convenience function used for debugging
82 virtual void setHeadingColor(QColor color); //! Set color of heading. In BranchItem overloaded to update QGraphicsView
83 virtual QColor getHeadingColor(); //! Returns color of heading
89 void setURL (const QString &url); //! Set URL
90 QString getURL (); //! Get URL
96 void setVymLink (const QString &url); //! Set URL
97 QString getVymLink (); //! Get URL
103 virtual void setNote(const QString &s);
104 virtual void clearNote();
105 virtual QString getNote();
106 virtual bool hasEmptyNote();
107 virtual void setNoteObj(const NoteObj &); //FIXME-3 setNoteObj is called for every select or so???
109 virtual NoteObj getNoteObj();
110 virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII)
111 virtual QString getNoteASCII(); // returns note (ASCII)
112 virtual QString getNoteOpenDoc(); // returns note (OpenDoc)
116 FlagRow standardFlags;
119 virtual void activateStandardFlag(const QString &flag);
120 virtual void deactivateStandardFlag(const QString &flag);
121 virtual void deactivateAllStandardFlags();
123 /*! \brief Toggle a Flag
124 If master is not NULL,, only one Flag from FlagRow master may
125 be active simultanously, the others get deactivated.
127 virtual void toggleStandardFlag(const QString &flag, FlagRow *master=NULL);
128 virtual bool isActiveStandardFlag (const QString &flag);
129 virtual QStringList activeStandardFlagNames();
130 virtual FlagRow* getStandardFlagRow ();
132 virtual QStringList activeSystemFlagNames();
134 virtual bool canMoveDown();
135 virtual bool canMoveUp();
138 QString objID; //! id set during load/save currently used for xLinks
140 virtual void setID (const QString &s);
141 virtual QString getID ();
143 // Navigation and selection
144 virtual TreeItem* getChildNum(const int &n);
145 virtual BranchItem* getFirstBranch();
146 virtual BranchItem* getLastBranch();
148 /*! Get next branch after current branch. Return NULL if there is no
150 virtual BranchItem* getNextBranch(BranchItem* currentBranch);
152 virtual BranchItem* getBranchNum(const int &n);
153 virtual BranchObj* getBranchObjNum(const int &n);
155 virtual ImageItem* getImageNum(const int &n);
156 virtual FloatImageObj* getImageObjNum(const int &n);
158 virtual AttributeItem* getAttributeNum(const int &n);
160 virtual XLinkItem* getXLinkNum(const int &n);
161 virtual XLinkObj* getXLinkObjNum(const int &n);
164 bool hideExport; //! Hide this item in export
165 bool hidden; //! Hidden in export if true
167 virtual void setHideTmp (HideTmpMode);
168 virtual bool hasHiddenExportParent ();
169 virtual void setHideInExport(bool); // set export of object (and children)
170 virtual bool hideInExport();
171 virtual bool isHidden ();
172 virtual void updateVisibility(); //! Sets visibility in LinkableMapObj, if existing
174 virtual QString getGeneralAttr();
179 QList<TreeItem*> childItems;
180 QList<QVariant> itemData;
181 TreeItem *parentItem;
183 /*! Set rootItem (does not change, needed for quick check
184 if some branch is mapCenter */
193 int attributeCounter;