# HG changeset patch
# User insilmaril
# Date 1138115388 0
# Node ID 6691000c32625e78f7f3b829be1bbb0265f34b99
# Parent  138c2cdc02fd400935a536c546d3c5a0b0d3b79c
Introduced basic export to Open Document format
diff -r 138c2cdc02fd -r 6691000c3262 headingobj.cpp
--- a/headingobj.cpp	Tue Jan 24 15:09:48 2006 +0000
+++ b/headingobj.cpp	Tue Jan 24 15:09:48 2006 +0000
@@ -1,4 +1,5 @@
 #include "headingobj.h"
+#include 
 
 /////////////////////////////////////////////////////////////////
 // HeadingObj
@@ -117,15 +118,17 @@
     int j=0;	// index of last ws
 	int k=0;	// index of "
" or similar linebreak
 	int br=0;	// width of found break, e.g. for 
 it is 4
+	QRegExp re("");
+	re.setMinimal (true);
 
     // set the text and wrap lines
     while (s.length()>0)
     {
 		// ok, some people wanted manual linebreaks, here we go
-		k=s.find ("
",i,false);
+		k=re.search (s,i);
 		if (k>=0)
 		{
-			br=4;
+			br=re.cap(0).length();
 			i=k;
 		} else
 			i=s.find (" ",i,false);
diff -r 138c2cdc02fd -r 6691000c3262 main.cpp
--- a/main.cpp	Tue Jan 24 15:09:48 2006 +0000
+++ b/main.cpp	Tue Jan 24 15:09:48 2006 +0000
@@ -167,9 +167,9 @@
 
 	if (options.isOn ("version"))
 	{
-		cout << "vym version "<<__VYM_VERSION__
+		cout << "vym version "<<__VYM_VERSION
 			<<"  (c) 2004 Uwe Drechsel - "
-			<<__BUILD_DATE__<isOn() );
 	settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
@@ -405,7 +406,7 @@
     connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
     a->addTo( menu );
 
-    a = new QAction( tr( "Exit VYM" ), QPixmap(), tr( "E&xit VYM" ), CTRL + Key_Q, this, "fileExitVYM" );
+    a = new QAction( tr( "Exit")+" "+__VYM, QPixmap(), tr( "E&xit")+" "+__VYM, CTRL + Key_Q, this, "fileExitVYM" );
     connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
     a->addTo( menu );
 }
@@ -1057,7 +1058,7 @@
     connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
     a->addTo( menu );
 
-    a = new QAction( tr( "Information about VYM" ), QPixmap(), tr( "About VYM" ), 0, this, "about" );
+    a = new QAction( tr( "Information about")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" );
     connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
     a->addTo( menu );
 
@@ -1161,36 +1162,32 @@
 	floatimageContextMenu->insertSeparator();	
 	actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
 
-	// Context menu for exports
-	exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
+	a = new QAction( tr( "Export as Open Office 2.0 (Open Document) " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" );
+	connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
+	a->addTo (exportMenu);
 
-    a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" +QString("...")), 0, this, "exportASCII" );
+	exportMenu->insertItem ( tr("Image"),exportImageFormatMenu);
+
+    a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), "ASCII...", 0, this, "exportASCII" );
     connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
 	a->addTo( exportMenu );
 
-    a = new QAction( tr( "Export as LaTeX (still experimental)" ), QPixmap(), tr( "Export (LaTeX)" +QString("...")), 0, this, "exportLaTeX" );
+    a = new QAction( tr( "Export as LaTeX (still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" );
     connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
 	a->addTo( exportMenu );
 
-    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
-	{
-		a = new QAction( tr( "Export as Open Office 1.3.x Presentation (still experimental)" ), QPixmap(), tr( "Export (OO Presentation)" +QString("...")), 0, this, "exportOOPresentation" );
-		connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
-		a->addTo( exportMenu );
-	}
-
-	a = new QAction( tr( "Export (XML)" ), QPixmap(), tr( "Export (XML)" )+QString("..."),  0, this, "exportXML" );
+	a = new QAction( tr( "Export (XML)" ), QPixmap(), "XML...",  0, this, "exportXML" );
     connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
     a->addTo( exportMenu );
 	
     if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
 	{
-		a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export (HTML)" )+QString("..."), 0, this, "exportHTML");
+		a = new QAction( tr( "Export HTML" ), QPixmap(), "HTML...", 0, this, "exportHTML");
 		connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
 		a->addTo( exportMenu );
 	}
 
-	a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" )+QString("..."), ALT + Key_X, this, "exportXHTML" );
+	a = new QAction( tr( "Export XHTML" ), QPixmap(), "XHTML...", ALT + Key_X, this, "exportXHTML" );
     connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
     a->addTo( exportMenu );
 
@@ -1265,7 +1262,7 @@
 	if (eList.first() =="..") eList.pop_front();	// remove "."
 	if (!eList.isEmpty())
 	{
-		QMessageBox mb( "VYM",
+		QMessageBox mb( __VYM,
 			tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir),
 		QMessageBox::Warning,
 		QMessageBox::Yes ,
@@ -1291,7 +1288,7 @@
 {
 	QFileDialog fd(this,caption);
 	fd.setMode (QFileDialog::DirectoryOnly);
-	fd.setCaption("VYM - "+caption);
+	fd.setCaption(__VYM " - "+caption);
 	fd.show();
 	
 	if ( fd.exec() == QDialog::Accepted )
@@ -1349,8 +1346,6 @@
 
 void Main::fileLoad(QString fn, const LoadMode &lmode)
 {
-	// Error codes
-	enum errorCode {success,aborted};
 	errorCode err=success;
 	
 	// fn is usually the archive, mapfile the file after uncompressing
@@ -1371,7 +1366,7 @@
 			if (me->getFilePath() == fn)
 			{
 				// Already there, ask for confirmation
-				QMessageBox mb( "VYM",
+				QMessageBox mb( __VYM,
 					tr("The map %1\nis already opened."
 					"Opening the same map in multiple editors may lead \n"
 					"to confusion when finishing working with vym."
@@ -1419,7 +1414,7 @@
 		// from command line
 		if (!QFile(fn).exists() )
 		{
-			QMessageBox mb( "VYM",
+			QMessageBox mb( __VYM,
 				tr("This map does not exist:\n  %1\nDo you want to create a new one?").arg(fn),
 				QMessageBox::Question,
 				QMessageBox::Yes ,
@@ -1456,109 +1451,72 @@
 		QString tmpMapDir=mkdtemp(tmpdir1);
 
 		// Try to unzip file
-		Process *zipProc=new Process ();
-		zipProc->clearArguments();
-		zipProc->setWorkingDirectory (QDir(tmpMapDir));
-		zipProc->addArgument ("unzip");
-		zipProc->addArgument (fn );
-		zipProc->addArgument ("-d");
-		zipProc->addArgument (tmpMapDir);
-
-		if (!zipProc->start() )
+		err=unzipDir (tmpMapDir,fn);
+		if (err==nozip)
 		{
-			QMessageBox::critical( 0, tr( "Critical Load Error" ),
-						   tr("Couldn't start unzip to decompress data."));
-			err=aborted;
-			
+			mapfile=fn;
+			me->setZipped(false);
 		} else
 		{
-			zipProc->waitFinished();
-			if (!zipProc->normalExit() )
+			me->setZipped(true);
+			
+			// Look for mapname.xml
+			mapfile= fn.left(fn.findRev(".",-1,true));
+			mapfile=mapfile.section( '/', -1 );
+			QFile file( tmpMapDir + "/" + mapfile + ".xml");
+			if (!file.exists() )
 			{
-				QMessageBox::critical( 0, tr( "Critical Load Error" ),
-							   tr("unzip didn't exit normally") +
-							   zipProc->getErrout() );
-				err=aborted;
-			} else
-			{
-				if (zipProc->exitStatus()>0)
+				// mapname.xml does not exist, well, 
+				// maybe some renamed the mapname.vym file...
+				// Try to find any .xml in the toplevel 
+				// directory of the .vym file
+				QStringList flist=QDir (tmpMapDir).entryList("*.xml");
+				if (flist.count()==1) 
 				{
-					if (zipProc->exitStatus()==9)
-					{
-						// no zipped file, but maybe .xml or old version? Try again.
-						mapfile=fn;
-						me->setZipped(false);
-					}	
-					else	
-					{
-						QMessageBox::critical( 0, tr( "Critical Load Error" ),
-									   QString("unzip exit code:  %1").arg(zipProc->exitStatus() ) +
-									   zipProc->getErrout() );
-						err=aborted;
-					}
+					// Only one entry, take this one
+					mapfile=tmpMapDir + "/"+flist.first();
 				} else
-				{	// Uncompressing was successfull,
-					// load from uncompressed temporary directory
-
-					me->setZipped(true);
-
+				{
+					for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
+						*it=tmpMapDir + "/" + *it;
+					// TODO Multiple entries, load all (but only the first one into this ME)
+					//mainWindow->fileLoadFromTmp (flist);
+					//returnCode=1;	// Silently forget this attempt to load
+					qWarning ("MainWindow::load (fn)  multimap found...");
+				}	
 					
-					// Look for mapname.xml
-					mapfile= fn.left(fn.findRev(".",-1,true));
-					mapfile=mapfile.section( '/', -1 );
-					QFile file( tmpMapDir + "/" + mapfile + ".xml");
-					if (!file.exists() )
-					{
-						// mapname.xml does not exist, well, 
-						// maybe some renamed the mapname.vym file...
-						// Try to find any .xml in the toplevel 
-						// directory of the .vym file
-						QStringList flist=QDir (tmpMapDir).entryList("*.xml");
-						if (flist.count()==1) 
-						{
-							// Only one entry, take this one
-							mapfile=tmpMapDir + "/"+flist.first();
-						} else
-						{
-							for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
-								*it=tmpMapDir + "/" + *it;
-							// TODO Multiple entries, load all (but only the first one into this ME)
-							//mainWindow->fileLoadFromTmp (flist);
-							//returnCode=1;	// Silently forget this attempt to load
-							qWarning ("MainWindow::load (fn)  multimap found...");
-						}	
-							
-						if (flist.isEmpty() )
-						{
-							QMessageBox::critical( 0, tr( "Critical Load Error" ),
-									   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
-							err=aborted;				   
-						}	
-					} //file doesn't exist	
-					else
-						mapfile=file.name();
-				} // Uncompressing successfull
-			}
+				if (flist.isEmpty() )
+				{
+					QMessageBox::critical( 0, tr( "Critical Load Error" ),
+							   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
+					err=aborted;				   
+				}	
+			} //file doesn't exist	
+			else
+				mapfile=file.name();
 		}
 
+		if (err!=aborted)
+		{
+			// Save existing filename in case  we import
+			QString fn_org=me->getFilePath();
 
-		// Save existing filename
-		QString fn_org=me->getFilePath();
+			// Finally load map into mapEditor
+			me->setFilePath (mapfile,fn);
+			if (me->load(mapfile,lmode))
+				err=aborted;
 
-		// Finally load map into mapEditor
-		me->setFilePath (mapfile,fn);
-		if (me->load(mapfile,lmode))
-			err=aborted;
+			// Restore old (maybe empty) filepath, if this is an import
+			if (lmode!=NewMap)
+				me->setFilePath (fn_org);
+		}	
 
-		// Restore old (maybe empty) filepath, if this is an import
-		if (lmode!=NewMap)
-			me->setFilePath (fn_org);
-			
-		// Delete tmpDir
-		removeDir (QDir(tmpMapDir));
-
-		// Check for errors
-		if (err==success) 
+		// Finally check for errors and go home
+		if (err==aborted) 
+		{
+			if (lmode==NewMap) fileCloseMap();
+			statusBar()->message( "Could not load " + fn, statusbarTime );
+		} else 
 		{
 			if (lmode==NewMap)
 			{
@@ -1569,16 +1527,11 @@
 				actionFilePrint->setEnabled (true);
 			}	
 			statusBar()->message( "Loaded " + fn, statusbarTime );
-			return;
-		} else 
-		{
-			if (lmode==NewMap)
-				fileCloseMap();
 		}	
 
-
+		// Delete tmpDir
+		removeDir (QDir(tmpMapDir));
 	}
-	statusBar()->message( "Could not load " + fn, statusbarTime );
 }
 
 
@@ -1587,6 +1540,7 @@
 	QFileDialog *fd=new QFileDialog( this);
 	if (!lastFileDir.isEmpty()) 
 		fd->setDir (lastFileDir);
+	fd->setMode (QFileDialog::ExistingFiles);
 	fd->addFilter ("XML (*.xml)");
 	fd->addFilter ("VYM map (*.vym *.vyp)");
 	switch (lmode)
@@ -1607,9 +1561,16 @@
 	if ( fd->exec() == QDialog::Accepted )
 	{
 		lastFileDir=fd->dirPath();
-        fn = fd->selectedFile();
-		fileLoad(fn, lmode);				   
+	    QStringList flist = fd->selectedFiles();
+		QStringList::Iterator it = flist.begin();
+		while( it != flist.end() ) 
+		{
+			fn = *it;
+			fileLoad(*it, lmode);				   
+			++it;
+		}
 	}
+	delete (fd);
 }
 
 void Main::fileLoad()
@@ -1654,7 +1615,7 @@
 			// Look, if we should zip the data:
 			if (!saveZipped)
 			{
-				QMessageBox mb( "VYM",
+				QMessageBox mb( __VYM,
 					tr("The map %1\ndid not use the compressed "
 					"vym file format.\nWriting it uncompressed will also write images \n"
 					"and flags and thus may overwrite files in the "
@@ -1755,7 +1716,7 @@
 			// Check for existing file
 			if (QFile (fn).exists())
 			{
-				QMessageBox mb( "VYM",
+				QMessageBox mb( __VYM,
 					tr("The file %1\nexists already. Do you want to").arg(fn),
 					QMessageBox::Warning,
 					QMessageBox::Yes | QMessageBox::Default,
@@ -1904,8 +1865,23 @@
 
 void Main::fileExportOOPresentation()
 {
-	if (currentMapEditor())
-		currentMapEditor()->exportOOPresentation();	
+	ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to Open Office"));
+	// FIXME add extra info in dialog
+	//ImagePreview *p =new ImagePreview (fd);
+	//fd->setContentsPreviewEnabled( TRUE );
+	//fd->setContentsPreview( p, p );
+	//fd->setPreviewMode( QFileDialog::Contents );
+	fd->setCaption(__VYM " - " +tr("Export to Open Office"));
+	//fd->setDir (lastImageDir);
+	fd->show();
+
+	if ( fd->exec() == QDialog::Accepted )
+	{
+		QString fn=fd->selectedFile();
+		//lastImageDir=fn.left(fn.findRev ("/"));
+		if (currentMapEditor())
+			currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
+	}
 }
 
 void Main::fileCloseMap()
@@ -1914,7 +1890,7 @@
 	{
 		if (currentMapEditor()->hasChanged())
 		{
-			QMessageBox mb( "VYM",
+			QMessageBox mb( __VYM,
 				tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
 				QMessageBox::Warning,
 				QMessageBox::Yes | QMessageBox::Default,
@@ -1963,7 +1939,7 @@
 		if (me->isUnsaved())
 		{
 			tabWidget->setCurrentPage(i);
-			QMessageBox mb( "VYM",
+			QMessageBox mb( __VYM,
 				tr("This map is not saved yet. Do you want to"),
 				QMessageBox::Warning,
 				QMessageBox::Yes | QMessageBox::Default,
@@ -2525,8 +2501,8 @@
 
 void Main::testFunction()
 {
-	//textEditor->stackUnder(this);
-	currentMapEditor()->testFunction();
+	fileExportOOPresentation();
+//	currentMapEditor()->testFunction();
 }
 
 void Main::helpDoc()
diff -r 138c2cdc02fd -r 6691000c3262 mapeditor.cpp
--- a/mapeditor.cpp	Tue Jan 24 15:09:48 2006 +0000
+++ b/mapeditor.cpp	Tue Jan 24 15:09:48 2006 +0000
@@ -373,7 +373,7 @@
 	if (linkcolorhint==HeadingColor) 
 		colhint=attribut("linkColorHint","HeadingColor");
 
-	QString mapAttr=attribut("version",__VYM_VERSION__);
+	QString mapAttr=attribut("version",__VYM_VERSION);
 	if (!saveSelection)
 		mapAttr+= attribut("author",mapCenter->getAuthor()) +
 				  attribut("comment",mapCenter->getComment()) +
@@ -1065,9 +1065,9 @@
 	ExportBase ex;
 	ex.setMapCenter(mapCenter);
 
-	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (ASCII)"));
+	QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export (ASCII)"));
 	fd->addFilter ("TXT (*.txt)");
-	fd->setCaption("VYM - Export (ASCII) (still experimental)");
+	fd->setCaption(__VYM " -" +tr("Export (ASCII) (still experimental)"));
 	fd->setMode( QFileDialog::AnyFile );
 	fd->show();
 
@@ -1075,7 +1075,7 @@
 	{
 		if (QFile (fd->selectedFile()).exists() )
 		{
-			QMessageBox mb( "VYM",
+			QMessageBox mb( __VYM,
 				tr("The file %1 exists already.\nDo you want to overwrite it?").arg(fd->selectedFile()), 
 			QMessageBox::Warning,
 			QMessageBox::Yes | QMessageBox::Default,
@@ -1104,9 +1104,9 @@
 void MapEditor::exportLaTeX()
 {
 	// TODO still experimental
-	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (LaTex)"));
+	QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export (LaTex)"));
 	fd->addFilter ("TEX (*.tex)");
-	fd->setCaption("VYM - Export (LaTex) (still experimental)");
+	fd->setCaption(__VYM  " - " + tr("Export (LaTex) (still experimental)"));
 	fd->setMode( QFileDialog::AnyFile );
 	fd->show();
 
@@ -1143,48 +1143,13 @@
 	}
 }
 
-void MapEditor::exportOOPresentation()
+void MapEditor::exportOOPresentation(const QString &fn, const QString &cf)
 {
-	// TODO still experimental
-	/*
-	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (Open Office 1.3.x Presentation)"));
-	fd->addFilter ("Open Office 1.3.x presentation (*.sxi)");
-	fd->setCaption("VYM - Export (Open Office 1.3.x presentation) (still experimental)");
-	fd->setMode( QFileDialog::AnyFile );
-	fd->show();
-
-	if ( fd->exec() == QDialog::Accepted )
-	{
-		if (QFile (fd->selectedFile()).exists() )
-		{
-			QMessageBox mb( "VYM",
-				tr("The file ") + fd->selectedFile() + 
-				tr(" exists already. Do you want to overwrite it?"),
-			QMessageBox::Warning,
-			QMessageBox::Yes | QMessageBox::Default,
-			QMessageBox::Cancel | QMessageBox::Escape,
-			QMessageBox::NoButton );
-
-			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
-			mb.setButtonText( QMessageBox::No, tr("Cancel"));
-			Export ex;
-			switch( mb.exec() ) 
-			{
-				case QMessageBox::Yes:
-					// save 
-					break;;
-				case QMessageBox::Cancel:
-					// do nothing
-					return;
-					break;
-			}
-		}
-		*/
-		ExportOO ex;
-		//ex.setPath (fd->selectedFile() );
-		ex.setMapCenter(mapCenter);
-		ex.exportPresentation();
-//	}
+	ExportOO ex;
+	ex.setPath (fn);
+	ex.setConfigFile(cf);
+	ex.setMapCenter(mapCenter);
+	ex.exportPresentation();
 }
 
 
@@ -2204,7 +2169,7 @@
 		if (typeid(*selection) == typeid(BranchObj) ||
 			typeid(*selection) == typeid(MapCenterObj))
 		{
-			saveState(selection);
+			saveState(selection);	//TODO undoCommand
 			BranchObj *bo=(BranchObj*)selection;
 			bo->setColor(actColor, true); // color links, color childs
 		}    
@@ -2378,9 +2343,9 @@
 			typeid(*selection) == typeid(MapCenterObj)) )
 	{		
 		BranchObj *bo=(BranchObj*)selection;
-		QFileDialog *fd=new QFileDialog( this,tr("VYM - Link to another map"));
+		QFileDialog *fd=new QFileDialog( this,__VYM " - " +tr("Link to another map"));
 		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
-		fd->setCaption(tr("VYM - Link to another map"));
+		fd->setCaption(__VYM " - " +tr("Link to another map"));
 		if (! bo->getVymLink().isEmpty() )
 			fd->setSelection( bo->getVymLink() );
 		fd->show();
@@ -2792,13 +2757,14 @@
 	{
 		BranchObj *bo=((BranchObj*)selection);
 
-		QFileDialog *fd=new QFileDialog( this,tr("vym - load image"));
+		QFileDialog *fd=new QFileDialog( this,QString ("vym - ")+tr("Load image"));
+		fd->setMode (QFileDialog::ExistingFiles);
 		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
 		ImagePreview *p =new ImagePreview (fd);
 		fd->setContentsPreviewEnabled( TRUE );
 		fd->setContentsPreview( p, p );
 		fd->setPreviewMode( QFileDialog::Contents );
-		fd->setCaption(tr("vym - Load image"));
+		fd->setCaption(__VYM " - " +tr("Load image"));
 		fd->setDir (lastImageDir);
 		fd->show();
 
@@ -2806,12 +2772,19 @@
 		if ( fd->exec() == QDialog::Accepted )
 		{
 			saveState(selection);
-			QString fn=fd->selectedFile();
 			lastImageDir=fn.left(fn.findRev ("/"));
-			bo->addFloatImage();
-			// TODO check if load was successful
-			bo->getLastFloatImage()->load(fn);
-			bo->getLastFloatImage()->setOriginalFilename(fn);
+			QStringList flist = fd->selectedFiles();
+			QStringList::Iterator it = flist.begin();
+			while( it != flist.end() ) 
+			{
+				fn = *it;
+				bo->addFloatImage();
+				// TODO check if load was successful
+				bo->getLastFloatImage()->load(*it);
+				bo->getLastFloatImage()->setOriginalFilename(fn);
+				++it;
+			}
+
 			mapCenter->reposition();
 			adjustCanvasSize();
 			canvas()->update();
@@ -2836,7 +2809,7 @@
 		fd->addFilter ("GIF (*.gif)");
 		fd->addFilter ("PNM (*.pnm)");
 		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
-		fd->setCaption(tr("vym - Save image as %1").arg(fmt));
+		fd->setCaption(__VYM " - " +tr("Save image as %1").arg(fmt));
 		fd->setMode( QFileDialog::AnyFile );
 		fd->setSelection (fio->getOriginalFilename());
 		fd->show();
@@ -2846,7 +2819,7 @@
 		{
 			if (QFile (fd->selectedFile()).exists() )
 			{
-				QMessageBox mb( "VYM",
+				QMessageBox mb( __VYM,
 					tr("The file %1 exists already.\n"
 					"Do you want to overwrite it?").arg(fd->selectedFile()),
 				QMessageBox::Warning,
@@ -2981,10 +2954,10 @@
 		(typeid(*selection) == typeid(BranchObj)) || 
 		(typeid(*selection) == typeid(MapCenterObj))  )
 	{
-		QFileDialog *fd=new QFileDialog( this,tr("VYM - Choose directory structur to import"));
+		QFileDialog *fd=new QFileDialog( this,__VYM " - " +tr("Choose directory structure to import"));
 		fd->setMode (QFileDialog::DirectoryOnly);
 		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
-		fd->setCaption(tr("VYM - Choose directory structur to import"));
+		fd->setCaption(__VYM " - " +tr("Choose directory structure to import"));
 		fd->show();
 
 		QString fn;
@@ -3046,7 +3019,10 @@
 void MapEditor::testFunction()
 {
 	cout << "MapEditor::testFunction() called\n";
-	mapCenter->move(mapCenter->x(),mapCenter->y());
+	if (selection && (typeid(*selection) == typeid(BranchObj)))
+	{
+		cout << "Note:\n"<<((BranchObj*)selection)->getNoteOpenDoc()<" to "\n"
+	QRegExp re("");
+	re.setMinimal(true);
+	r.replace (re,"\n");
+
+	// convert all "
" to "\n"
+	re.setPattern ("");
+	r.replace (re,"\n");
+	
+	// remove all remaining tags 
+	re.setPattern ("<.*>");
+	r.replace (re,"");
+
+	// If string starts with \n now, remove it.
+	// It would be wrong in an OOo export for example
+	while (r.at(0)=='\n') r.remove (0,1);
+	
+	// convert "&", "<" and ">"
+	re.setPattern (">");
+	r.replace (re,">");
+	re.setPattern ("<");
+	r.replace (re,"<");
+	re.setPattern ("&");
+	r.replace (re,"&");
+	re.setPattern (""");
+	r.replace (re,"\"");
+
+	return r;
+}
+
+QString NoteObj::getNoteOpenDoc()
+{
+	// Evil hack to transform QT Richtext into
+	// something which can be used in OpenDoc format
+	// 
+	// TODO create clean XML transformation which also
+	// considers fonts, colors, ...
+
+	QString r=note;
+
+	// convert all "
"
+	QRegExp re("");
+	re.setMinimal(true);
+	r.replace (re,"");
+
+	// convert all "" 
+	re.setPattern ("
");
+	r.replace (re,"");
+	
+	// Remove all other tags, e.g. paragraphs will be added in 
+	// templates used during export
+	re.setPattern ("?html.*>");
+	r.replace (re,"");
+	re.setPattern ("?head.*>");
+	r.replace (re,"");
+	re.setPattern ("?body.*>");
+	r.replace (re,"");
+	re.setPattern ("?meta.*>");
+	r.replace (re,"");
+	re.setPattern ("?span.*>");
+	r.replace (re,"");
+	re.setPattern ("?p.*>");
+	r.replace (re,"");
+
+	r=""+r+"";
+	return r;
+}
+
 void NoteObj::setFontHint (const QString &s)
 {
 	// only for backward compatibility (pre 1.5 )