18 class TreeItem:public XMLObj
21 enum Type {Undefined,MapCenter,Branch,Image};
22 enum HideTmpMode {HideNone, HideExport};
24 TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
28 QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset);
31 // General housekeeping
32 void setModel (VymModel *m);
35 void appendChild (TreeItem *child);
36 void removeChild (int row);
38 TreeItem *child(int row);
39 int childCount() const;
40 int childNumber() const;
41 int columnCount() const;
42 int branchCount() const;
43 int imageCount() const;
44 int xlinkCount() const;
51 /*! Return number of item in parent by type,
52 e.g. first branch has number 0 */
53 virtual int childNum(); //! Return number of item in list of all children
54 virtual int num(); //! Return number of item by type
55 virtual int num (TreeItem *item); //! Return number of item by type
58 virtual QVariant data(int column) const;
63 virtual void setHeading (const QString s);
64 virtual QString getHeading() const;
65 virtual std::string getHeadingStd() const; //! convenience function used for debugging
66 virtual void setHeadingColor(QColor color); //! Set color of heading. In BranchItem overloaded to update QGraphicsView
67 virtual QColor getHeadingColor(); //! Returns color of heading
72 virtual void setNote(const QString s);
73 virtual QString getNote();
74 virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true);
75 virtual NoteObj getNoteObj();
76 virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII)
77 virtual QString getNoteASCII(); // returns note (ASCII)
78 virtual QString getNoteOpenDoc(); // returns note (OpenDoc)
84 virtual void setType (const Type t);
85 virtual Type getType ();
86 virtual bool isBranchLikeType() const;
87 virtual QString getTypeName ();
90 QString objID; //! id set during load/save currently used for xLinks
92 virtual void setID (const QString &s);
93 virtual QString getID ();
95 // Navigation and selection
96 virtual TreeItem* getChildNum(const int &n);
97 virtual BranchItem* getFirstBranch();
98 virtual BranchItem* getLastBranch();
99 virtual BranchItem* getBranchNum(const int &n);
100 virtual BranchObj* getBranchObjNum(const int &n);
101 virtual void setLastSelectedBranch(); //! Set myself as last selected in parent
102 virtual void setLastSelectedBranch(int i); //! Set last selected branch directly
103 virtual TreeItem* getLastSelectedBranch();
104 virtual TreeItem* findBySelectString (const QString &);
106 virtual void setHideTmp (HideTmpMode);
107 virtual bool hasHiddenExportParent ();
108 virtual void setHideInExport(bool); // set export of object (and children)
109 virtual bool hideInExport();
110 virtual bool isHidden ();
113 // Relation to map objects in graphicsscene // FIXME-4 should be obsolete
114 virtual LinkableMapObj* getLMO();
115 virtual void setLMO (LinkableMapObj*);
120 QList<TreeItem*> childItems;
121 QList<QVariant> itemData;
122 TreeItem *parentItem;
128 int lastSelectedBranchNum;
130 bool hideExport;//! Hide this item in export
131 bool hidden; //! Hidden in export if true