vymmodel.h
author insilmaril
Wed, 09 Jun 2010 13:14:08 +0000
changeset 847 43268373032d
parent 845 b98c1793bb8b
child 848 e265f07f2173
permissions -rw-r--r--
1.13.4 Various fixes
     1 #ifndef VYMMODEL_H
     2 #define VYMMODEL_H
     3 
     4 #include <QGraphicsScene>
     5 #include <QtNetwork>
     6 
     7 #include <QtDBus/QDBusAbstractAdaptor>
     8 #include <QtDBus/QDBusVariant>
     9 
    10 #include <QTextCursor>
    11 
    12 #include "adaptormodel.h"
    13 #include "file.h"
    14 #include "imageitem.h"
    15 #include "mapeditor.h"
    16 #include "parser.h"
    17 #include "treeitem.h"
    18 #include "treemodel.h"
    19 
    20 class AttributeItem;
    21 class BranchItem;
    22 class FindResultModel;
    23 class MapEditor;
    24 class Link;
    25 class XLinkItem;
    26 
    27 class VymModel :  public TreeModel {		
    28 	Q_OBJECT
    29 	Q_CLASSINFO("D-Bus Interface", "org.insilmaril.vym.VymModel-h")
    30 
    31 ////////////////////////////////////////////
    32 // General housekeeping
    33 ////////////////////////////////////////////
    34 private:
    35 	QString version;	//!< version string saved in vym file
    36 	QString author;
    37 	QString comment;
    38 	QDate date;
    39 
    40 	static uint idLast;		//! the last used unique ID
    41 	uint mapID;
    42 
    43 public:
    44 	VymModel();
    45 	~VymModel ();
    46     void clear();
    47     void init();
    48 	void makeTmpDirectories();		//!< create temporary directories e.g. for history
    49 
    50 	MapEditor* getMapEditor();			
    51 	uint getID();						//! Return unique ID of model
    52 
    53 	bool isRepositionBlocked();		//!< While load or undo there is no need to update graphicsview
    54 
    55 	void updateActions();			//!< Update buttons in mainwindow
    56 
    57 
    58 ////////////////////////////////////////////
    59 // Load/save 
    60 ////////////////////////////////////////////
    61 private:
    62 
    63 	bool zipped;				// should map be zipped
    64 	static	int mapNum;			// unique number for model used in save/undo
    65 	FileType fileType;			// type of file, e.g. vym, freemind...
    66 	QString fileName;			// short name of file (for tab)
    67 	QString filePath;			// path to file which will be saved
    68 	QString fileDir;			// dir where file is saved
    69 	QString destPath;			// path to .vym file (needed for vymlinks)
    70 	QString mapName;			// fileName without ".vym"
    71 
    72 	QString tmpMapDir;			// tmp directory with undo history
    73 
    74 	QTimer *autosaveTimer;
    75 	QTimer *fileChangedTimer;
    76 	QDateTime fileChangedTime;
    77 
    78 public:
    79 	/*! This function saves all information of the map to disc.
    80 	    saveToDir also calls the functions for all BranchObj and other objects in the map.
    81 		The structure of the map itself is returned as QString and passed back to Main, 
    82 		where saveToDir is called initially
    83 	*/	
    84     QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, TreeItem *saveSel);
    85 
    86 	/*! Save all data in tree*/
    87 	QString saveTreeToDir (const QString&,const QString&,const QPointF&,QList <Link*> &tmpLinks);// Save data recursivly to tempdir
    88 
    89 
    90 	/*! \brief Sets filepath, filename and mapname
    91 
    92 	     If the filepath is "/home/tux/map.xml", then the filename will be set
    93 		 to map.xml. The destname is needed for vymLinks, pointing to another map. 
    94 		 The destname holds the real name of the file, after it has been compressed, e.g. "map.vym"
    95 	*/	 
    96 
    97 
    98 	/*! \brief Set File path
    99 
   100 	     The destname is needed to construct the references between maps
   101 	*/	 
   102 	void setFilePath (QString filepath,QString destname);	
   103 	void setFilePath (QString);	//!< Overloaded for convenience
   104 	QString getFilePath ();	//!< Full path e.g. "/home/tux/map.xml"
   105 	QString getFileName ();	//!< e.g. "map.xml"
   106 	QString getMapName ();	//!< e.g. "map"
   107 	QString getDestPath (); //!< e.g. "/home/tux/map.vym"
   108 
   109 	/*! \brief Load map
   110 
   111 		The data is read from file. Depending on LoadMode the current
   112 		selection gets replaced by data or the data is appended.
   113 	*/	
   114     ErrorCode loadMap  (
   115 		QString,						//!< Path
   116 		const LoadMode &lmode=NewMap,	//!< New map, replace or add to selection
   117 		bool saveStateFlag=true,		//!< If called internally for history, don't save
   118 		const FileType &ftype=VymMap,	//!< VymMap or FreeMind
   119 		int pos=-1						//!< Optionally tell position where to add data
   120 	);	
   121 
   122 public:
   123 	/*! \brief Save the map to file */
   124     ErrorCode save(const SaveMode &);	
   125 
   126 private:
   127 	ImageItem* loadFloatImageInt (BranchItem *dst,QString);
   128 	void saveFloatImageInt (ImageItem*, const QString &, const QString &);
   129 public:	
   130 	void loadFloatImage ();
   131 	void saveFloatImage ();
   132 
   133 private:	
   134     void importDirInt(BranchItem *,QDir);
   135     void importDirInt(const QString&);
   136 public:	
   137     void importDir();
   138 
   139 private slots:
   140 	void autosave ();
   141 	void fileChanged();
   142 
   143 ////////////////////////////////////////////
   144 // history (undo/redo)
   145 ////////////////////////////////////////////
   146 private:
   147     bool mapDefault;			//!< Flag if map is untouched
   148     bool mapChanged;			//!< Flag if undo is possible
   149 	bool mapUnsaved;			//!< Flag if map should be saved
   150 
   151 	QString histPath;			//!< Path to history file
   152 	SimpleSettings undoSet;		//!< undo/redo commands, saved in histPath
   153 	int stepsTotal;				//!< total number of steps (undos+redos) 
   154 	int curStep;				//!< Current step in history (ring buffer)
   155 	int curClipboard;			//!< number of history step, which is the current clipboard
   156 	int redosAvail;				//!< Available number of redo steps
   157 	int undosAvail;				//!< Available number of undo steps
   158 	bool blockReposition;		//!< block while load or undo
   159 	bool blockSaveState;		//!< block while load or undo
   160 public:
   161 	bool isDefault();			//!< true, if map is still the empty default map
   162 	void makeDefault();			//!< Reset changelog, declare this as default map
   163     bool hasChanged()	;		//!< true, if something has changed and is not saved yet
   164 	void setChanged();			//!< called from TextEditor via LinkableMapObj
   165 
   166 	/*! \brief Get name of object
   167 	  
   168 	  Returns heading of a branch or name of an object for use in comment
   169 	  of undo/redo history
   170 	*/ 
   171 	QString getObjectName(LinkableMapObj*);	
   172 	QString getObjectName(TreeItem*);	
   173 
   174     void redo();						//!< Redo last action
   175 	bool isRedoAvailable();				//!< True, if redo is available
   176     void undo();						//!< Undo last action
   177 	bool isUndoAvailable();				//!< True, if undo is available
   178 	void gotoHistoryStep (int);			//!< Goto a specifig step in history
   179 
   180 
   181 	QString getHistoryPath();			//!< Path to directory containing the history
   182 
   183 	/*! \brief Save the current changes in map 
   184 
   185 		Two commands and selections are saved:
   186 
   187 			- undocommand and undoselection to undo the change
   188 			- redocommand and redoselection to redo the action after an undo
   189 
   190 		Additionally a comment is logged. 
   191 
   192 	*/	
   193     void saveState(
   194 		const SaveMode& savemode, 
   195 		const QString &undoSelection, 
   196 		const QString &undoCommand, 
   197 		const QString &redoSelection, 
   198 		const QString &redoCommand, 
   199 		const QString &comment, 
   200 		TreeItem *saveSelection);
   201 	/*! Overloaded for convenience */
   202     void saveStateChangingPart(
   203 		TreeItem *undoSelection, 
   204 		TreeItem* redoSelection, 
   205 		const QString &redoCommand, 
   206 		const QString &comment);
   207 	/*! Overloaded for convenience */
   208     void saveStateRemovingPart(
   209 		TreeItem *redoSelection, 
   210 		const QString &comment);
   211 	/*! Overloaded for convenience */
   212     void saveState(
   213 		TreeItem *undoSelection, 
   214 		const QString &undoCommand, 
   215 		TreeItem *redoSelection, 
   216 		const QString &redoCommand, 
   217 		const QString &comment); 
   218 	/*! Overloaded for convenience */
   219     void saveState(
   220 		const QString &undoSelection, 
   221 		const QString &undoCommand, 
   222 		const QString &redoSelection, 
   223 		const QString &redoCommand, 
   224 		const QString &comment) ;
   225     void saveState(
   226 		const QString &undoCommand, 
   227 		const QString &redoCommand, 
   228 		const QString &comment) ;
   229 
   230 
   231 ////////////////////////////////////////////
   232 // unsorted so far
   233 ////////////////////////////////////////////
   234 private:
   235 	QGraphicsScene *mapScene;
   236 public:
   237 	void setScene(QGraphicsScene *s);
   238 	QGraphicsScene *getScene();
   239 
   240     TreeItem* findBySelectString (QString s);		
   241     TreeItem* findID (const uint &i);		// find MapObj by unique ID
   242 
   243 
   244 ////////////////////////////////////////////
   245 // Interface 
   246 ////////////////////////////////////////////
   247 public:
   248 	void setVersion(const  QString &);
   249 	QString getVersion();
   250 	void setAuthor  (const QString &);
   251 	QString getAuthor ();
   252 	void setComment (const QString &);
   253 	QString getComment ();
   254 	QString getDate();
   255 	int branchCount();
   256 
   257 	void setSortFilter (const QString &);
   258 	QString getSortFilter ();
   259 protected:	
   260 	QString sortFilter;
   261 signals:
   262 	void sortFilterChanged (QString );		//!< Notify editors of new filter
   263 
   264 public:
   265 	void setHeading(const QString &);		//!< Set heading of item	
   266 	QString getHeading ();					//!< Get heading of item
   267 	void setNote(const QString &s);			//!< Set note text
   268 	QString getNote();						//!< Get note text
   269 	void loadNote (const QString &fn);		//!< Load note from file
   270 	void saveNote (const QString &fn);		//!< Save note to file
   271 
   272 private:
   273 	BranchItem* findCurrent;				// next object in find process
   274 	BranchItem* findPrevious;				// next object in find process
   275 	bool EOFind;							// true, if search failed
   276 
   277 public:
   278 	void findDuplicateURLs();				// find duplicate URLs, testing only so far
   279     void findAll (FindResultModel*, QString s, Qt::CaseSensitivity cs);	// Search all objects at once, also notes
   280     BranchItem* findText(QString s,Qt::CaseSensitivity cs);	// Find object, also in note
   281     void findReset();						// Reset Search
   282 private:	
   283 	QString findString;
   284 
   285 public:
   286 	void setURL(const QString &url);
   287 	QString getURL();						// returns URL of selection or ""
   288 	QStringList getURLs(bool ignoreScrolled=true);	// returns URLs of subtree
   289 
   290 
   291 	void setFrameType(const FrameObj::FrameType &);
   292 	void setFrameType(const QString &);
   293 	void setFramePenColor (const QColor &);
   294 	void setFrameBrushColor (const QColor &);
   295 	void setFramePadding (const int &);
   296 	void setFrameBorderWidth (const int &);
   297 	void setIncludeImagesVer(bool);
   298 	void setIncludeImagesHor(bool);
   299 	void setHideLinkUnselected (bool);
   300 
   301 	/*! Should object be hidden in exports (clouded)? */
   302 	void setHideExport(bool);			
   303 
   304 	/*! Should object be hidden in exports (clouded)? */
   305 	void toggleHideExport();		
   306 
   307 	void addTimestamp();		
   308 
   309     void copy();						//!< Copy to clipboard
   310 private:	
   311     void pasteNoSave(const int &n);		//!< paste clipboard to branch
   312 public:	
   313     void paste();			//!< Paste clipboard to branch and backup
   314     void cut();				//!< Cut to clipboard (and copy)
   315 
   316     bool moveUp(BranchItem *bi);	//!< Move branch up without saving state
   317     void moveUp();					//!< Move branch up with saving state
   318     bool moveDown(BranchItem *bi);	//!< Move branch down without saving state
   319     void moveDown();		//!< Move branch down
   320 	void detach();					//!< Detach branch and use as new mapcenter
   321 	void sortChildren(bool inverse=false);	//!< Sort children lexically
   322 
   323 	// The create methods are used to quickly parse a XML file
   324 	BranchItem* createMapCenter();				//!< Create MapCenter 
   325 	BranchItem* createBranch(BranchItem *dst);	//!< Create Branch
   326 	ImageItem* createImage(BranchItem *dst);	//!< Create image
   327 
   328 public:	
   329 	bool createLink(Link *l, bool createMO=false);			//!< Create XLink 
   330 
   331 	AttributeItem* addAttribute();
   332 	AttributeItem* addAttribute(AttributeItem* );
   333 
   334 	/*! \brief Add new mapcenter
   335 
   336 	    Disclaimer: Still experimental, not fully supported yet.
   337 	*/	
   338 	BranchItem* addMapCenter();
   339 private:	
   340 	BranchItem* addMapCenter(QPointF absPos);
   341 
   342 	/*! \brief Add new branch
   343 
   344 		Depending on num the new branch is created
   345 
   346 		-3 above selection as child of selections parent
   347 		-2 as child of selection
   348 		-1 below selection as child of selections parent
   349 		0..n	insert at a specific position in selections parent
   350 		(needed for free relinking)
   351 	*/	
   352 
   353 private:	
   354     BranchItem* addNewBranchInt(BranchItem *dst, int pos);	// pos allows to add above/below selection
   355 public:	
   356 	/*! \Add new branch
   357 		
   358 		Depending on num the new branch is created
   359 		-1 above selection
   360 		 0 as child of selection
   361 		 1 below selection
   362 	*/
   363     BranchItem* addNewBranch(int pos=0);		
   364     BranchItem* addNewBranchBefore();		//!< Insert branch between selection and its parent
   365 	/*! \brief Relink a branch to a new destination dst 
   366 	    Relinks branch to dst at branch position pos. There is no saveState
   367 		here, as for example moveUp or moving in MapEditor have
   368 		different needs to call saveState
   369 		Returns true if relinking was successful.
   370 	*/	
   371 	bool relinkBranch (BranchItem* branch, BranchItem* dst, int pos =-1);	
   372 	bool relinkImage  (ImageItem* image, BranchItem* dst);	
   373 
   374 private:
   375 	bool cleaningUpLinks;				//!< True while cleaning up to avoid recursion
   376 public:	
   377 	void cleanupLinks();				//!< Delete orphaned XLinkItems
   378     void deleteSelection();				//!< Delete selection
   379 	void deleteKeepChildren(bool saveStateFlag=true);	//!< remove branch, but keep children
   380 public:	
   381 	void deleteChildren();				//!< keep branch, but remove children
   382 
   383 	TreeItem* deleteItem(TreeItem*);	//!< Delete item and return parent (if parent!= rootItem)
   384 	void deleteLink (Link*);			//!< Remove Link and related LinkItems in TreeModel
   385 	void clearItem (TreeItem* ti);		//!< Remove all children of TreeItem ti
   386 	bool scrollBranch(BranchItem *);
   387 	bool unscrollBranch(BranchItem *);
   388     void toggleScroll();
   389     void unscrollChildren();
   390 	void emitExpandAll();
   391 	void emitExpandOneLevel();
   392 	void emitCollapseOneLevel();
   393 signals:	
   394 	void expandAll();
   395 	void expandOneLevel();
   396 	void collapseOneLevel();
   397 
   398 public:	
   399 	void toggleStandardFlag (const QString &name, FlagRow *master=NULL);
   400     void addFloatImage(const QPixmap &img);
   401 
   402     void colorBranch(QColor);
   403     void colorSubtree(QColor);
   404 	QColor getCurrentHeadingColor();
   405 
   406 
   407 	void editURL();							// edit URL
   408 	void editLocalURL();					// edit URL to local file
   409 	void editHeading2URL();					// copy heading to URL
   410 	void editBugzilla2URL();				// create URL to Bugzilla
   411 	void getBugzillaData();					// get data from Novell Bugzilla
   412 	void editFATE2URL();					// create URL to FATE
   413 	void editVymLink();						// edit link to another map
   414 	void setVymLink (const QString &);	// Set vymLink for selection
   415 	void deleteVymLink();					// delete link to another map
   416 	QString getVymLink();					// return path to map
   417 	QStringList getVymLinks();				// return paths in subtree
   418 	void followXLink (int);
   419 	void editXLink (int i=0);
   420 
   421 
   422 
   423 
   424 ////////////////////////////////////////////
   425 // Scripting
   426 ////////////////////////////////////////////
   427 public:	
   428 
   429 	/* \brief Process one command and its parameters */
   430     QVariant parseAtom (const QString &atom, bool &noError, QString &errorMsg);	
   431 
   432 	/* \brief Runs the script */
   433 	QVariant runScript (const QString &script);
   434 
   435 private:
   436 	Parser parser;
   437 
   438 ////////////////////////////////////////////
   439 // Exports
   440 ////////////////////////////////////////////
   441 private:
   442 	TreeItem::HideTmpMode hidemode;	// true while exporting to hide some stuff
   443 
   444 public:
   445 	/*! Set or unset temporary hiding of objects during export  */
   446 	void setExportMode (bool);
   447 
   448 	/*! Save as image */
   449     void exportImage (QString fname="",bool askForName=true,QString format="PNG");
   450 
   451 
   452 	/*! Export as XTML to directory */
   453     void exportXML(QString dir="", bool askForName=true);
   454 
   455 	/*! Export as A&O report text to file */
   456 	void exportAO (QString fname="",bool askForName=true);  
   457 
   458 	/*! Export as ASCII text to file */
   459 	void exportASCII (QString fname="",bool askForName=true);  
   460 
   461 	/*! Export as HTML to directory */
   462     void exportHTML(const QString& dir="", bool useDialog=true);	
   463 
   464     /*! Export as OpenOfficeOrg presentation */
   465     void exportOOPresentation(const QString &,const QString &);	
   466 
   467 
   468 ////////////////////////////////////////////
   469 // View related
   470 ////////////////////////////////////////////
   471 public:
   472 	void registerEditor (QWidget *);
   473 	void unregisterEditor (QWidget *);
   474 
   475 	void setMapZoomFactor (const double &); 
   476 private: 
   477 	double zoomFactor;
   478 	QPointF contextPos;					//!< local position during context menu
   479 public:
   480 	void setContextPos (QPointF);		//!< local position during context menu
   481 	void unsetContextPos ();			//!< forget local position after context menu
   482 
   483 	void updateNoteFlag();				//!< Signal origination in TextEditor
   484 	void reposition();					//!< Call reposition for all MCOs
   485 	void setHideTmpMode (TreeItem::HideTmpMode mode);	
   486 
   487 	void emitNoteHasChanged (TreeItem *ti);
   488 	void emitDataHasChanged (TreeItem *ti);
   489 	void emitUpdateLayout ();
   490 
   491 signals:
   492 	void updateLayout();
   493 	void noteHasChanged (QModelIndex ix);
   494 	void newChildObject(QModelIndex ix);
   495 
   496 private:
   497 	MapEditor *mapEditor;
   498 
   499 	QColor defLinkColor;		// default color for links
   500 	QColor defXLinkColor;		// default color for xlinks
   501 	int defXLinkWidth;			// default width for xlinks
   502 	LinkableMapObj::ColorHint linkcolorhint;// use heading color or own color
   503 	LinkableMapObj::Style linkstyle;		// default style for links
   504 
   505 public:
   506 	void setMapLinkStyle (const QString &);	// Set style of link
   507 	LinkableMapObj::Style getMapLinkStyle ();	// requested in LMO
   508 	void setMapDefLinkColor(QColor);		// default color of links
   509 	void setMapLinkColorHintInt();			// color of links
   510 	void setMapLinkColorHint(LinkableMapObj::ColorHint);// color of links
   511 	void toggleMapLinkColorHint();			// after changing linkStyles
   512     void selectMapBackgroundImage();
   513     void setMapBackgroundImage(const QString &);
   514     void selectMapBackgroundColor();
   515     void setMapBackgroundColor(QColor);
   516     QColor getMapBackgroundColor();
   517 
   518 
   519 	LinkableMapObj::ColorHint getMapLinkColorHint();
   520 	QColor getMapDefLinkColor();
   521 	void setMapDefXLinkColor(QColor);
   522 	QColor getMapDefXLinkColor();
   523 	void setMapDefXLinkWidth (int);
   524 	int getMapDefXLinkWidth();
   525 
   526 	/*!  Move absolutly to (x,y).  */	
   527     void move    (const double &x, const double &y);
   528 
   529 	/*!  Move relativly to (x,y).  */	
   530     void moveRel (const double &x, const double &y);
   531 
   532 ////////////////////////////////////////////
   533 // Animation  **experimental**
   534 ////////////////////////////////////////////
   535 private:	
   536 	QTimer *animationTimer;
   537 	bool animationUse;
   538 	uint animationTicks;
   539 	uint animationInterval;
   540 	int timerId;				// animation timer
   541 	QList <MapObj*> animObjList;// list with animated objects //FIXME-2 should go to MapEditor
   542 
   543 private slots:
   544 	void animate();						//!< Called by timer to animate stuff
   545 public:
   546 	void startAnimation(BranchObj *bo, const QPointF &v);
   547 	void startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest);
   548 	void stopAnimation(MapObj *mo);
   549 	void stopAllAnimation();
   550 
   551 ////////////////////////////////////////////
   552 // Network related 
   553 ////////////////////////////////////////////
   554 public:
   555     /*! \brief Networking states
   556 		
   557 		In Network modus we want to switch of saveState, autosave, ...
   558 	*/
   559 	enum NetState {
   560 		Offline,			//!< Offline
   561 		Client,				//!< I am the client and connected to server
   562 		Server				//!< I am the server
   563 	};
   564 
   565 private:
   566 	// Network connections **Experimental**
   567 	NetState netstate;			// offline, client, server
   568 	QTcpServer *tcpServer;		// Act as server in conference mode (experimental)
   569 	QList <QTcpSocket*> clientList;		// List of connected clients
   570 	quint16 sendCounter;		// Increased with every sent command
   571 
   572 	QTcpSocket	*clientSocket;	// socket of this client
   573 	QString server;				// server address of this client
   574 	int port;					// server port of this client
   575 
   576 
   577 
   578 protected:
   579 	void sendSelection();
   580 
   581 public:
   582 	void newServer();
   583 	void connectToServer();
   584 
   585 private slots:	
   586 	void newClient();
   587 	void sendData(const QString &s);
   588 	void readData();
   589 	void displayNetworkError (QAbstractSocket::SocketError);
   590 
   591 ////////////////////////////////////////////
   592 // DBUS related 
   593 ////////////////////////////////////////////
   594 
   595 private:
   596 AdaptorModel *adaptorModel; //FIXME-3
   597 
   598 public slots:
   599 	void testslot();
   600 
   601 ////////////////////////////////////////////
   602 // Selection related 
   603 ////////////////////////////////////////////
   604 private:
   605 	TreeItem *latestAddedItem;				// latest added object, reset on setChanged()
   606 
   607 public:
   608 	void setSelectionModel(QItemSelectionModel *);		// Set common selectionModel
   609 	QItemSelectionModel* getSelectionModel();
   610 
   611 	void setSelectionBlocked(bool);
   612 	bool isSelectionBlocked();
   613 
   614 	bool select ();							//! select by using common QItemSelectionModel
   615 	bool select (const QString &);			//! Select by string
   616 	bool select (LinkableMapObj *lmo);		//! Select by pointer to LMO
   617 	bool select (TreeItem *ti );			//! Select by pointer to TreeItem
   618 	bool select (TreeItem *ti,int i );		//! Select by pointer to TreeItem and index in note
   619 	bool select (const QModelIndex &index);	//! Select by ModelIndex
   620 	void unselect();
   621 	bool reselect();
   622 
   623 	void emitShowSelection();				//!< Show selection in all views
   624 signals:
   625 	void showSelection();
   626 
   627 public:	
   628     bool selectFirstBranch();
   629     bool selectLastBranch();
   630 	bool selectLastSelectedBranch();
   631 	bool selectParent();
   632 
   633 public:
   634 	TreeItem::Type selectionType();
   635 	LinkableMapObj* getSelectedLMO();
   636 	BranchObj* getSelectedBranchObj();	// FIXME-3 replace by item...
   637 	BranchItem* getSelectedBranch();
   638 	ImageItem* getSelectedImage();
   639 	AttributeItem* getSelectedAttribute();
   640 	TreeItem* getSelectedItem();
   641 	QModelIndex getSelectedIndex();
   642 	QString getSelectString ();
   643 	QString getSelectString (LinkableMapObj *lmo);
   644 	QString getSelectString (TreeItem *item);
   645 	QString getSelectString (BranchItem *item);
   646 	
   647 	
   648 signals:
   649 	void selectionChanged(const QItemSelection &newsel, const QItemSelection &oldsel);
   650 
   651 public:
   652 	void emitSelectionChanged(const QItemSelection &oldsel);
   653 	void emitSelectionChanged();
   654 	void selectMapLinkColor();
   655     void selectMapSelectionColor();
   656 private:	
   657     void setSelectionColorInt(QColor);
   658 	QItemSelectionModel *selModel;
   659 	QString lastSelectString;
   660 	bool selectionBlocked;		//! Used to block changes of selection while editing a heading
   661 
   662 public:	
   663     void setSelectionColor(QColor);
   664     QColor getSelectionColor();
   665 };
   666 
   667 #endif