vymmodel.h
author insilmaril
Mon, 14 Jun 2010 13:59:17 +0000
changeset 848 e265f07f2173
parent 847 43268373032d
permissions -rw-r--r--
Fixed tmp relink, colored headings in TreeView
     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 	void resetHistory();				//!< Initialize history
   183 
   184 	/*! \brief Save the current changes in map 
   185 
   186 		Two commands and selections are saved:
   187 
   188 			- undocommand and undoselection to undo the change
   189 			- redocommand and redoselection to redo the action after an undo
   190 
   191 		Additionally a comment is logged. 
   192 
   193 	*/	
   194     void saveState(
   195 		const SaveMode& savemode, 
   196 		const QString &undoSelection, 
   197 		const QString &undoCommand, 
   198 		const QString &redoSelection, 
   199 		const QString &redoCommand, 
   200 		const QString &comment, 
   201 		TreeItem *saveSelection);
   202 	/*! Overloaded for convenience */
   203     void saveStateChangingPart(
   204 		TreeItem *undoSelection, 
   205 		TreeItem* redoSelection, 
   206 		const QString &redoCommand, 
   207 		const QString &comment);
   208 	/*! Overloaded for convenience */
   209     void saveStateRemovingPart(
   210 		TreeItem *redoSelection, 
   211 		const QString &comment);
   212 	/*! Overloaded for convenience */
   213     void saveState(
   214 		TreeItem *undoSelection, 
   215 		const QString &undoCommand, 
   216 		TreeItem *redoSelection, 
   217 		const QString &redoCommand, 
   218 		const QString &comment); 
   219 	/*! Overloaded for convenience */
   220     void saveState(
   221 		const QString &undoSelection, 
   222 		const QString &undoCommand, 
   223 		const QString &redoSelection, 
   224 		const QString &redoCommand, 
   225 		const QString &comment) ;
   226     void saveState(
   227 		const QString &undoCommand, 
   228 		const QString &redoCommand, 
   229 		const QString &comment) ;
   230 
   231 
   232 ////////////////////////////////////////////
   233 // unsorted so far
   234 ////////////////////////////////////////////
   235 private:
   236 	QGraphicsScene *mapScene;
   237 public:
   238 	void setScene(QGraphicsScene *s);
   239 	QGraphicsScene *getScene();
   240 
   241     TreeItem* findBySelectString (QString s);		
   242     TreeItem* findID (const uint &i);		// find MapObj by unique ID
   243 
   244 
   245 ////////////////////////////////////////////
   246 // Interface 
   247 ////////////////////////////////////////////
   248 public:
   249 	void setVersion(const  QString &);
   250 	QString getVersion();
   251 	void setAuthor  (const QString &);
   252 	QString getAuthor ();
   253 	void setComment (const QString &);
   254 	QString getComment ();
   255 	QString getDate();
   256 	int branchCount();
   257 
   258 	void setSortFilter (const QString &);
   259 	QString getSortFilter ();
   260 protected:	
   261 	QString sortFilter;
   262 signals:
   263 	void sortFilterChanged (QString );		//!< Notify editors of new filter
   264 
   265 public:
   266 	void setHeading(const QString &);		//!< Set heading of item	
   267 	QString getHeading ();					//!< Get heading of item
   268 	void setNote(const QString &s);			//!< Set note text
   269 	QString getNote();						//!< Get note text
   270 	void loadNote (const QString &fn);		//!< Load note from file
   271 	void saveNote (const QString &fn);		//!< Save note to file
   272 
   273 private:
   274 	BranchItem* findCurrent;				// next object in find process
   275 	BranchItem* findPrevious;				// next object in find process
   276 	bool EOFind;							// true, if search failed
   277 
   278 public:
   279 	void findDuplicateURLs();				// find duplicate URLs, testing only so far
   280     void findAll (FindResultModel*, QString s, Qt::CaseSensitivity cs);	// Search all objects at once, also notes
   281     BranchItem* findText(QString s,Qt::CaseSensitivity cs);	// Find object, also in note
   282     void findReset();						// Reset Search
   283 private:	
   284 	QString findString;
   285 
   286 public:
   287 	void setURL(const QString &url);
   288 	QString getURL();						// returns URL of selection or ""
   289 	QStringList getURLs(bool ignoreScrolled=true);	// returns URLs of subtree
   290 
   291 
   292 	void setFrameType(const FrameObj::FrameType &);
   293 	void setFrameType(const QString &);
   294 	void setFramePenColor (const QColor &);
   295 	void setFrameBrushColor (const QColor &);
   296 	void setFramePadding (const int &);
   297 	void setFrameBorderWidth (const int &);
   298 	void setIncludeImagesVer(bool);
   299 	void setIncludeImagesHor(bool);
   300 	void setHideLinkUnselected (bool);
   301 
   302 	/*! Should object be hidden in exports (clouded)? */
   303 	void setHideExport(bool);			
   304 
   305 	/*! Should object be hidden in exports (clouded)? */
   306 	void toggleHideExport();		
   307 
   308 	void addTimestamp();		
   309 
   310     void copy();						//!< Copy to clipboard
   311 private:	
   312     void pasteNoSave(const int &n);		//!< paste clipboard to branch
   313 public:	
   314     void paste();			//!< Paste clipboard to branch and backup
   315     void cut();				//!< Cut to clipboard (and copy)
   316 
   317     bool moveUp(BranchItem *bi);	//!< Move branch up without saving state
   318     void moveUp();					//!< Move branch up with saving state
   319     bool moveDown(BranchItem *bi);	//!< Move branch down without saving state
   320     void moveDown();		//!< Move branch down
   321 	void detach();					//!< Detach branch and use as new mapcenter
   322 	void sortChildren(bool inverse=false);	//!< Sort children lexically
   323 
   324 	// The create methods are used to quickly parse a XML file
   325 	BranchItem* createMapCenter();				//!< Create MapCenter 
   326 	BranchItem* createBranch(BranchItem *dst);	//!< Create Branch
   327 	ImageItem* createImage(BranchItem *dst);	//!< Create image
   328 
   329 public:	
   330 	bool createLink(Link *l, bool createMO=false);			//!< Create XLink 
   331 
   332 	AttributeItem* addAttribute();
   333 	AttributeItem* addAttribute(AttributeItem* );
   334 
   335 	/*! \brief Add new mapcenter
   336 
   337 	    Disclaimer: Still experimental, not fully supported yet.
   338 	*/	
   339 	BranchItem* addMapCenter(bool saveStateFlag=true);
   340 private:	
   341 	BranchItem* addMapCenter(QPointF absPos);
   342 
   343 	/*! \brief Add new branch
   344 
   345 		Depending on num the new branch is created
   346 
   347 		-3 above selection as child of selections parent
   348 		-2 as child of selection
   349 		-1 below selection as child of selections parent
   350 		0..n	insert at a specific position in selections parent
   351 		(needed for free relinking)
   352 	*/	
   353 
   354 private:	
   355     BranchItem* addNewBranchInt(BranchItem *dst, int pos);	// pos allows to add above/below selection
   356 public:	
   357 	/*! \Add new branch
   358 		
   359 		Depending on num the new branch is created
   360 		-1 above selection
   361 		 0 as child of selection
   362 		 1 below selection
   363 	*/
   364     BranchItem* addNewBranch(int pos=0);		
   365     BranchItem* addNewBranchBefore();		//!< Insert branch between selection and its parent
   366 	/*! \brief Relink a branch to a new destination dst 
   367 	    Relinks branch to dst at branch position pos. There is no saveState
   368 		here, as for example moveUp or moving in MapEditor have
   369 		different needs to call saveState
   370 		Returns true if relinking was successful.
   371 	*/	
   372 	bool relinkBranch (BranchItem* branch, BranchItem* dst, int pos =-1);	
   373 	bool relinkImage  (ImageItem* image, BranchItem* dst);	
   374 
   375 private:
   376 	bool cleaningUpLinks;				//!< True while cleaning up to avoid recursion
   377 public:	
   378 	void cleanupLinks();				//!< Delete orphaned XLinkItems
   379     void deleteSelection();				//!< Delete selection
   380 	void deleteKeepChildren(bool saveStateFlag=true);	//!< remove branch, but keep children
   381 public:	
   382 	void deleteChildren();				//!< keep branch, but remove children
   383 
   384 	TreeItem* deleteItem(TreeItem*);	//!< Delete item and return parent (if parent!= rootItem)
   385 	void deleteLink (Link*);			//!< Remove Link and related LinkItems in TreeModel
   386 	void clearItem (TreeItem* ti);		//!< Remove all children of TreeItem ti
   387 	bool scrollBranch(BranchItem *);
   388 	bool unscrollBranch(BranchItem *);
   389     void toggleScroll();
   390     void unscrollChildren();
   391 	void emitExpandAll();
   392 	void emitExpandOneLevel();
   393 	void emitCollapseOneLevel();
   394 signals:	
   395 	void expandAll();
   396 	void expandOneLevel();
   397 	void collapseOneLevel();
   398 
   399 public:	
   400 	void toggleStandardFlag (const QString &name, FlagRow *master=NULL);
   401     void addFloatImage(const QPixmap &img);
   402 
   403     void colorBranch(QColor);
   404     void colorSubtree(QColor);
   405 	QColor getCurrentHeadingColor();
   406 
   407 
   408 	void editURL();							// edit URL
   409 	void editLocalURL();					// edit URL to local file
   410 	void editHeading2URL();					// copy heading to URL
   411 	void editBugzilla2URL();				// create URL to Bugzilla
   412 	void getBugzillaData();					// get data from Novell Bugzilla
   413 	void editFATE2URL();					// create URL to FATE
   414 	void editVymLink();						// edit link to another map
   415 	void setVymLink (const QString &);	// Set vymLink for selection
   416 	void deleteVymLink();					// delete link to another map
   417 	QString getVymLink();					// return path to map
   418 	QStringList getVymLinks();				// return paths in subtree
   419 	void followXLink (int);
   420 	void editXLink (int i=0);
   421 
   422 
   423 
   424 
   425 ////////////////////////////////////////////
   426 // Scripting
   427 ////////////////////////////////////////////
   428 public:	
   429 
   430 	/* \brief Process one command and its parameters */
   431     QVariant parseAtom (const QString &atom, bool &noError, QString &errorMsg);	
   432 
   433 	/* \brief Runs the script */
   434 	QVariant runScript (const QString &script);
   435 
   436 private:
   437 	Parser parser;
   438 
   439 ////////////////////////////////////////////
   440 // Exports
   441 ////////////////////////////////////////////
   442 private:
   443 	TreeItem::HideTmpMode hidemode;	// true while exporting to hide some stuff
   444 
   445 public:
   446 	/*! Set or unset temporary hiding of objects during export  */
   447 	void setExportMode (bool);
   448 
   449 	/*! Save as image */
   450     void exportImage (QString fname="",bool askForName=true,QString format="PNG");
   451 
   452 
   453 	/*! Export as XTML to directory */
   454     void exportXML(QString dir="", bool askForName=true);
   455 
   456 	/*! Export as A&O report text to file */
   457 	void exportAO (QString fname="",bool askForName=true);  
   458 
   459 	/*! Export as ASCII text to file */
   460 	void exportASCII (QString fname="",bool askForName=true);  
   461 
   462 	/*! Export as HTML to directory */
   463     void exportHTML(const QString& dir="", bool useDialog=true);	
   464 
   465     /*! Export as OpenOfficeOrg presentation */
   466     void exportOOPresentation(const QString &,const QString &);	
   467 
   468 
   469 ////////////////////////////////////////////
   470 // View related
   471 ////////////////////////////////////////////
   472 public:
   473 	void registerEditor (QWidget *);
   474 	void unregisterEditor (QWidget *);
   475 
   476 	void setMapZoomFactor (const double &); 
   477 private: 
   478 	double zoomFactor;
   479 	QPointF contextPos;					//!< local position during context menu
   480 public:
   481 	void setContextPos (QPointF);		//!< local position during context menu
   482 	void unsetContextPos ();			//!< forget local position after context menu
   483 
   484 	void updateNoteFlag();				//!< Signal origination in TextEditor
   485 	void reposition();					//!< Call reposition for all MCOs
   486 	void setHideTmpMode (TreeItem::HideTmpMode mode);	
   487 
   488 	void emitNoteHasChanged (TreeItem *ti);
   489 	void emitDataHasChanged (TreeItem *ti);
   490 	void emitUpdateLayout ();
   491 
   492 signals:
   493 	void updateLayout();
   494 	void noteHasChanged (QModelIndex ix);
   495 	void newChildObject(QModelIndex ix);
   496 
   497 private:
   498 	MapEditor *mapEditor;
   499 
   500 	QColor defLinkColor;		// default color for links
   501 	QColor defXLinkColor;		// default color for xlinks
   502 	int defXLinkWidth;			// default width for xlinks
   503 	LinkableMapObj::ColorHint linkcolorhint;// use heading color or own color
   504 	LinkableMapObj::Style linkstyle;		// default style for links
   505 
   506 public:
   507 	void setMapLinkStyle (const QString &);	// Set style of link
   508 	LinkableMapObj::Style getMapLinkStyle ();	// requested in LMO
   509 	void setMapDefLinkColor(QColor);		// default color of links
   510 	void setMapLinkColorHintInt();			// color of links
   511 	void setMapLinkColorHint(LinkableMapObj::ColorHint);// color of links
   512 	void toggleMapLinkColorHint();			// after changing linkStyles
   513     void selectMapBackgroundImage();
   514     void setMapBackgroundImage(const QString &);
   515     void selectMapBackgroundColor();
   516     void setMapBackgroundColor(QColor);
   517     QColor getMapBackgroundColor();
   518 
   519 
   520 	LinkableMapObj::ColorHint getMapLinkColorHint();
   521 	QColor getMapDefLinkColor();
   522 	void setMapDefXLinkColor(QColor);
   523 	QColor getMapDefXLinkColor();
   524 	void setMapDefXLinkWidth (int);
   525 	int getMapDefXLinkWidth();
   526 
   527 	/*!  Move absolutly to (x,y).  */	
   528     void move    (const double &x, const double &y);
   529 
   530 	/*!  Move relativly to (x,y).  */	
   531     void moveRel (const double &x, const double &y);
   532 
   533 ////////////////////////////////////////////
   534 // Animation  **experimental**
   535 ////////////////////////////////////////////
   536 private:	
   537 	QTimer *animationTimer;
   538 	bool animationUse;
   539 	uint animationTicks;
   540 	uint animationInterval;
   541 	int timerId;				// animation timer
   542 	QList <MapObj*> animObjList;// list with animated objects //FIXME-2 should go to MapEditor
   543 
   544 private slots:
   545 	void animate();						//!< Called by timer to animate stuff
   546 public:
   547 	void startAnimation(BranchObj *bo, const QPointF &v);
   548 	void startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest);
   549 	void stopAnimation(MapObj *mo);
   550 	void stopAllAnimation();
   551 
   552 ////////////////////////////////////////////
   553 // Network related 
   554 ////////////////////////////////////////////
   555 public:
   556     /*! \brief Networking states
   557 		
   558 		In Network modus we want to switch of saveState, autosave, ...
   559 	*/
   560 	enum NetState {
   561 		Offline,			//!< Offline
   562 		Client,				//!< I am the client and connected to server
   563 		Server				//!< I am the server
   564 	};
   565 
   566 private:
   567 	// Network connections **Experimental**
   568 	NetState netstate;			// offline, client, server
   569 	QTcpServer *tcpServer;		// Act as server in conference mode (experimental)
   570 	QList <QTcpSocket*> clientList;		// List of connected clients
   571 	quint16 sendCounter;		// Increased with every sent command
   572 
   573 	QTcpSocket	*clientSocket;	// socket of this client
   574 	QString server;				// server address of this client
   575 	int port;					// server port of this client
   576 
   577 
   578 
   579 protected:
   580 	void sendSelection();
   581 
   582 public:
   583 	void newServer();
   584 	void connectToServer();
   585 
   586 private slots:	
   587 	void newClient();
   588 	void sendData(const QString &s);
   589 	void readData();
   590 	void displayNetworkError (QAbstractSocket::SocketError);
   591 
   592 ////////////////////////////////////////////
   593 // DBUS related 
   594 ////////////////////////////////////////////
   595 
   596 private:
   597 AdaptorModel *adaptorModel; //FIXME-3
   598 
   599 public slots:
   600 	void testslot();
   601 
   602 ////////////////////////////////////////////
   603 // Selection related 
   604 ////////////////////////////////////////////
   605 private:
   606 	TreeItem *latestAddedItem;				// latest added object, reset on setChanged()
   607 
   608 public:
   609 	void setSelectionModel(QItemSelectionModel *);		// Set common selectionModel
   610 	QItemSelectionModel* getSelectionModel();
   611 
   612 	void setSelectionBlocked(bool);
   613 	bool isSelectionBlocked();
   614 
   615 	bool select ();							//! select by using common QItemSelectionModel
   616 	bool select (const QString &);			//! Select by string
   617 	bool select (LinkableMapObj *lmo);		//! Select by pointer to LMO
   618 	bool select (TreeItem *ti );			//! Select by pointer to TreeItem
   619 	bool select (TreeItem *ti,int i );		//! Select by pointer to TreeItem and index in note
   620 	bool select (const QModelIndex &index);	//! Select by ModelIndex
   621 	void unselect();
   622 	bool reselect();
   623 
   624 	void emitShowSelection();				//!< Show selection in all views
   625 signals:
   626 	void showSelection();
   627 
   628 public:	
   629     bool selectFirstBranch();
   630     bool selectLastBranch();
   631 	bool selectLastSelectedBranch();
   632     bool selectLastImage();
   633 	bool selectParent();
   634 
   635 public:
   636 	TreeItem::Type selectionType();
   637 	LinkableMapObj* getSelectedLMO();
   638 	BranchObj* getSelectedBranchObj();	// FIXME-3 replace by item...
   639 	BranchItem* getSelectedBranch();
   640 	ImageItem* getSelectedImage();
   641 	AttributeItem* getSelectedAttribute();
   642 	TreeItem* getSelectedItem();
   643 	QModelIndex getSelectedIndex();
   644 	QString getSelectString ();
   645 	QString getSelectString (LinkableMapObj *lmo);
   646 	QString getSelectString (TreeItem *item);
   647 	QString getSelectString (BranchItem *item);
   648 	
   649 	
   650 signals:
   651 	void selectionChanged(const QItemSelection &newsel, const QItemSelection &oldsel);
   652 
   653 public:
   654 	void emitSelectionChanged(const QItemSelection &oldsel);
   655 	void emitSelectionChanged();
   656 	void selectMapLinkColor();
   657     void selectMapSelectionColor();
   658 private:	
   659     void setSelectionColorInt(QColor);
   660 	QItemSelectionModel *selModel;
   661 	QString lastSelectString;
   662 	bool selectionBlocked;		//! Used to block changes of selection while editing a heading
   663 
   664 public:	
   665     void setSelectionColor(QColor);
   666     QColor getSelectionColor();
   667 };
   668 
   669 #endif