Introduced basic export to Open Document format
authorinsilmaril
Tue Jan 24 15:09:48 2006 +0000 (2006-01-24)
changeset 1856691000c3262
parent 184 138c2cdc02fd
child 186 2e9f9acde92a
Introduced basic export to Open Document format
headingobj.cpp
main.cpp
mainwindow.cpp
mapeditor.cpp
mapeditor.h
noteobj.cpp
     1.1 --- a/headingobj.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.2 +++ b/headingobj.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.3 @@ -1,4 +1,5 @@
     1.4  #include "headingobj.h"
     1.5 +#include <qregexp.h>
     1.6  
     1.7  /////////////////////////////////////////////////////////////////
     1.8  // HeadingObj
     1.9 @@ -117,15 +118,17 @@
    1.10      int j=0;	// index of last ws
    1.11  	int k=0;	// index of "<br>" or similar linebreak
    1.12  	int br=0;	// width of found break, e.g. for <br> it is 4
    1.13 +	QRegExp re("<br.*/>");
    1.14 +	re.setMinimal (true);
    1.15  
    1.16      // set the text and wrap lines
    1.17      while (s.length()>0)
    1.18      {
    1.19  		// ok, some people wanted manual linebreaks, here we go
    1.20 -		k=s.find ("<br>",i,false);
    1.21 +		k=re.search (s,i);
    1.22  		if (k>=0)
    1.23  		{
    1.24 -			br=4;
    1.25 +			br=re.cap(0).length();
    1.26  			i=k;
    1.27  		} else
    1.28  			i=s.find (" ",i,false);
     2.1 --- a/main.cpp	Tue Jan 24 15:09:48 2006 +0000
     2.2 +++ b/main.cpp	Tue Jan 24 15:09:48 2006 +0000
     2.3 @@ -167,9 +167,9 @@
     2.4  
     2.5  	if (options.isOn ("version"))
     2.6  	{
     2.7 -		cout << "vym version "<<__VYM_VERSION__
     2.8 +		cout << "vym version "<<__VYM_VERSION
     2.9  			<<"  (c) 2004 Uwe Drechsel - "
    2.10 -			<<__BUILD_DATE__<<endl;
    2.11 +			<<__BUILD_DATE<<endl;
    2.12  			
    2.13  		return 0;	
    2.14  	}		
     3.1 --- a/mainwindow.cpp	Tue Jan 24 15:09:48 2006 +0000
     3.2 +++ b/mainwindow.cpp	Tue Jan 24 15:09:48 2006 +0000
     3.3 @@ -23,6 +23,7 @@
     3.4  #include "misc.h"
     3.5  #include "version.h"
     3.6  #include "aboutdialog.h"
     3.7 +#include "exportoofiledialog.h"
     3.8  
     3.9  #include "icons/filenew.xpm"
    3.10  #include "icons/fileopen.xpm"
    3.11 @@ -289,8 +290,8 @@
    3.12  	settings.writeEntry( "/vym/mainwindow/geometry/posX", pos().x() );
    3.13  	settings.writeEntry( "/vym/mainwindow/geometry/posY", pos().y() );
    3.14  
    3.15 -	settings.writeEntry( "/vym/version/version", __VYM_VERSION__ );
    3.16 -	settings.writeEntry( "/vym/version/builddate", __BUILD_DATE__ );
    3.17 +	settings.writeEntry( "/vym/version/version", __VYM_VERSION );
    3.18 +	settings.writeEntry( "/vym/version/builddate", __BUILD_DATE );
    3.19  
    3.20  	settings.writeEntry( "/vym/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
    3.21  	settings.writeEntry( "/vym/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
    3.22 @@ -405,7 +406,7 @@
    3.23      connect( a, SIGNAL( activated() ), this, SLOT( fileCloseMap() ) );
    3.24      a->addTo( menu );
    3.25  
    3.26 -    a = new QAction( tr( "Exit VYM" ), QPixmap(), tr( "E&xit VYM" ), CTRL + Key_Q, this, "fileExitVYM" );
    3.27 +    a = new QAction( tr( "Exit")+" "+__VYM, QPixmap(), tr( "E&xit")+" "+__VYM, CTRL + Key_Q, this, "fileExitVYM" );
    3.28      connect( a, SIGNAL( activated() ), this, SLOT( fileExitVYM() ) );
    3.29      a->addTo( menu );
    3.30  }
    3.31 @@ -1057,7 +1058,7 @@
    3.32      connect( a, SIGNAL( activated() ), this, SLOT( helpDoc() ) );
    3.33      a->addTo( menu );
    3.34  
    3.35 -    a = new QAction( tr( "Information about VYM" ), QPixmap(), tr( "About VYM" ), 0, this, "about" );
    3.36 +    a = new QAction( tr( "Information about")+" "__VYM, QPixmap(), tr( "About VYM" ), 0, this, "about" );
    3.37      connect( a, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
    3.38      a->addTo( menu );
    3.39  
    3.40 @@ -1161,36 +1162,32 @@
    3.41  	floatimageContextMenu->insertSeparator();	
    3.42  	actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
    3.43  
    3.44 -	// Context menu for exports
    3.45 -	exportMenu->insertItem ( tr("Export map as image"),exportImageFormatMenu);
    3.46 +	a = new QAction( tr( "Export as Open Office 2.0 (Open Document) " ), QPixmap(), "Open Office"+QString("..."), 0, this, "exportOOPresentation" );
    3.47 +	connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
    3.48 +	a->addTo (exportMenu);
    3.49  
    3.50 -    a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" +QString("...")), 0, this, "exportASCII" );
    3.51 +	exportMenu->insertItem ( tr("Image"),exportImageFormatMenu);
    3.52 +
    3.53 +    a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), "ASCII...", 0, this, "exportASCII" );
    3.54      connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
    3.55  	a->addTo( exportMenu );
    3.56  
    3.57 -    a = new QAction( tr( "Export as LaTeX (still experimental)" ), QPixmap(), tr( "Export (LaTeX)" +QString("...")), 0, this, "exportLaTeX" );
    3.58 +    a = new QAction( tr( "Export as LaTeX (still experimental)" ), QPixmap(), "LaTeX...", 0, this, "exportLaTeX" );
    3.59      connect( a, SIGNAL( activated() ), this, SLOT( fileExportLaTeX() ) );
    3.60  	a->addTo( exportMenu );
    3.61  
    3.62 -    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
    3.63 -	{
    3.64 -		a = new QAction( tr( "Export as Open Office 1.3.x Presentation (still experimental)" ), QPixmap(), tr( "Export (OO Presentation)" +QString("...")), 0, this, "exportOOPresentation" );
    3.65 -		connect( a, SIGNAL( activated() ), this, SLOT( fileExportOOPresentation() ) );
    3.66 -		a->addTo( exportMenu );
    3.67 -	}
    3.68 -
    3.69 -	a = new QAction( tr( "Export (XML)" ), QPixmap(), tr( "Export (XML)" )+QString("..."),  0, this, "exportXML" );
    3.70 +	a = new QAction( tr( "Export (XML)" ), QPixmap(), "XML...",  0, this, "exportXML" );
    3.71      connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
    3.72      a->addTo( exportMenu );
    3.73  	
    3.74      if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
    3.75  	{
    3.76 -		a = new QAction( tr( "Export HTML" ), QPixmap(), tr( "Export (HTML)" )+QString("..."), 0, this, "exportHTML");
    3.77 +		a = new QAction( tr( "Export HTML" ), QPixmap(), "HTML...", 0, this, "exportHTML");
    3.78  		connect( a, SIGNAL( activated() ), this, SLOT( fileExportHTML() ) );
    3.79  		a->addTo( exportMenu );
    3.80  	}
    3.81  
    3.82 -	a = new QAction( tr( "Export XHTML" ), QPixmap(), tr( "Export XHTML" )+QString("..."), ALT + Key_X, this, "exportXHTML" );
    3.83 +	a = new QAction( tr( "Export XHTML" ), QPixmap(), "XHTML...", ALT + Key_X, this, "exportXHTML" );
    3.84      connect( a, SIGNAL( activated() ), this, SLOT( fileExportXHTML() ) );
    3.85      a->addTo( exportMenu );
    3.86  
    3.87 @@ -1265,7 +1262,7 @@
    3.88  	if (eList.first() =="..") eList.pop_front();	// remove "."
    3.89  	if (!eList.isEmpty())
    3.90  	{
    3.91 -		QMessageBox mb( "VYM",
    3.92 +		QMessageBox mb( __VYM,
    3.93  			tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?").arg(dir),
    3.94  		QMessageBox::Warning,
    3.95  		QMessageBox::Yes ,
    3.96 @@ -1291,7 +1288,7 @@
    3.97  {
    3.98  	QFileDialog fd(this,caption);
    3.99  	fd.setMode (QFileDialog::DirectoryOnly);
   3.100 -	fd.setCaption("VYM - "+caption);
   3.101 +	fd.setCaption(__VYM " - "+caption);
   3.102  	fd.show();
   3.103  	
   3.104  	if ( fd.exec() == QDialog::Accepted )
   3.105 @@ -1349,8 +1346,6 @@
   3.106  
   3.107  void Main::fileLoad(QString fn, const LoadMode &lmode)
   3.108  {
   3.109 -	// Error codes
   3.110 -	enum errorCode {success,aborted};
   3.111  	errorCode err=success;
   3.112  	
   3.113  	// fn is usually the archive, mapfile the file after uncompressing
   3.114 @@ -1371,7 +1366,7 @@
   3.115  			if (me->getFilePath() == fn)
   3.116  			{
   3.117  				// Already there, ask for confirmation
   3.118 -				QMessageBox mb( "VYM",
   3.119 +				QMessageBox mb( __VYM,
   3.120  					tr("The map %1\nis already opened."
   3.121  					"Opening the same map in multiple editors may lead \n"
   3.122  					"to confusion when finishing working with vym."
   3.123 @@ -1419,7 +1414,7 @@
   3.124  		// from command line
   3.125  		if (!QFile(fn).exists() )
   3.126  		{
   3.127 -			QMessageBox mb( "VYM",
   3.128 +			QMessageBox mb( __VYM,
   3.129  				tr("This map does not exist:\n  %1\nDo you want to create a new one?").arg(fn),
   3.130  				QMessageBox::Question,
   3.131  				QMessageBox::Yes ,
   3.132 @@ -1456,109 +1451,72 @@
   3.133  		QString tmpMapDir=mkdtemp(tmpdir1);
   3.134  
   3.135  		// Try to unzip file
   3.136 -		Process *zipProc=new Process ();
   3.137 -		zipProc->clearArguments();
   3.138 -		zipProc->setWorkingDirectory (QDir(tmpMapDir));
   3.139 -		zipProc->addArgument ("unzip");
   3.140 -		zipProc->addArgument (fn );
   3.141 -		zipProc->addArgument ("-d");
   3.142 -		zipProc->addArgument (tmpMapDir);
   3.143 -
   3.144 -		if (!zipProc->start() )
   3.145 +		err=unzipDir (tmpMapDir,fn);
   3.146 +		if (err==nozip)
   3.147  		{
   3.148 -			QMessageBox::critical( 0, tr( "Critical Load Error" ),
   3.149 -						   tr("Couldn't start unzip to decompress data."));
   3.150 -			err=aborted;
   3.151 -			
   3.152 +			mapfile=fn;
   3.153 +			me->setZipped(false);
   3.154  		} else
   3.155  		{
   3.156 -			zipProc->waitFinished();
   3.157 -			if (!zipProc->normalExit() )
   3.158 +			me->setZipped(true);
   3.159 +			
   3.160 +			// Look for mapname.xml
   3.161 +			mapfile= fn.left(fn.findRev(".",-1,true));
   3.162 +			mapfile=mapfile.section( '/', -1 );
   3.163 +			QFile file( tmpMapDir + "/" + mapfile + ".xml");
   3.164 +			if (!file.exists() )
   3.165  			{
   3.166 -				QMessageBox::critical( 0, tr( "Critical Load Error" ),
   3.167 -							   tr("unzip didn't exit normally") +
   3.168 -							   zipProc->getErrout() );
   3.169 -				err=aborted;
   3.170 -			} else
   3.171 -			{
   3.172 -				if (zipProc->exitStatus()>0)
   3.173 +				// mapname.xml does not exist, well, 
   3.174 +				// maybe some renamed the mapname.vym file...
   3.175 +				// Try to find any .xml in the toplevel 
   3.176 +				// directory of the .vym file
   3.177 +				QStringList flist=QDir (tmpMapDir).entryList("*.xml");
   3.178 +				if (flist.count()==1) 
   3.179  				{
   3.180 -					if (zipProc->exitStatus()==9)
   3.181 -					{
   3.182 -						// no zipped file, but maybe .xml or old version? Try again.
   3.183 -						mapfile=fn;
   3.184 -						me->setZipped(false);
   3.185 -					}	
   3.186 -					else	
   3.187 -					{
   3.188 -						QMessageBox::critical( 0, tr( "Critical Load Error" ),
   3.189 -									   QString("unzip exit code:  %1").arg(zipProc->exitStatus() ) +
   3.190 -									   zipProc->getErrout() );
   3.191 -						err=aborted;
   3.192 -					}
   3.193 +					// Only one entry, take this one
   3.194 +					mapfile=tmpMapDir + "/"+flist.first();
   3.195  				} else
   3.196 -				{	// Uncompressing was successfull,
   3.197 -					// load from uncompressed temporary directory
   3.198 -
   3.199 -					me->setZipped(true);
   3.200 -
   3.201 +				{
   3.202 +					for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
   3.203 +						*it=tmpMapDir + "/" + *it;
   3.204 +					// TODO Multiple entries, load all (but only the first one into this ME)
   3.205 +					//mainWindow->fileLoadFromTmp (flist);
   3.206 +					//returnCode=1;	// Silently forget this attempt to load
   3.207 +					qWarning ("MainWindow::load (fn)  multimap found...");
   3.208 +				}	
   3.209  					
   3.210 -					// Look for mapname.xml
   3.211 -					mapfile= fn.left(fn.findRev(".",-1,true));
   3.212 -					mapfile=mapfile.section( '/', -1 );
   3.213 -					QFile file( tmpMapDir + "/" + mapfile + ".xml");
   3.214 -					if (!file.exists() )
   3.215 -					{
   3.216 -						// mapname.xml does not exist, well, 
   3.217 -						// maybe some renamed the mapname.vym file...
   3.218 -						// Try to find any .xml in the toplevel 
   3.219 -						// directory of the .vym file
   3.220 -						QStringList flist=QDir (tmpMapDir).entryList("*.xml");
   3.221 -						if (flist.count()==1) 
   3.222 -						{
   3.223 -							// Only one entry, take this one
   3.224 -							mapfile=tmpMapDir + "/"+flist.first();
   3.225 -						} else
   3.226 -						{
   3.227 -							for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
   3.228 -								*it=tmpMapDir + "/" + *it;
   3.229 -							// TODO Multiple entries, load all (but only the first one into this ME)
   3.230 -							//mainWindow->fileLoadFromTmp (flist);
   3.231 -							//returnCode=1;	// Silently forget this attempt to load
   3.232 -							qWarning ("MainWindow::load (fn)  multimap found...");
   3.233 -						}	
   3.234 -							
   3.235 -						if (flist.isEmpty() )
   3.236 -						{
   3.237 -							QMessageBox::critical( 0, tr( "Critical Load Error" ),
   3.238 -									   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
   3.239 -							err=aborted;				   
   3.240 -						}	
   3.241 -					} //file doesn't exist	
   3.242 -					else
   3.243 -						mapfile=file.name();
   3.244 -				} // Uncompressing successfull
   3.245 -			}
   3.246 +				if (flist.isEmpty() )
   3.247 +				{
   3.248 +					QMessageBox::critical( 0, tr( "Critical Load Error" ),
   3.249 +							   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
   3.250 +					err=aborted;				   
   3.251 +				}	
   3.252 +			} //file doesn't exist	
   3.253 +			else
   3.254 +				mapfile=file.name();
   3.255  		}
   3.256  
   3.257 +		if (err!=aborted)
   3.258 +		{
   3.259 +			// Save existing filename in case  we import
   3.260 +			QString fn_org=me->getFilePath();
   3.261  
   3.262 -		// Save existing filename
   3.263 -		QString fn_org=me->getFilePath();
   3.264 +			// Finally load map into mapEditor
   3.265 +			me->setFilePath (mapfile,fn);
   3.266 +			if (me->load(mapfile,lmode))
   3.267 +				err=aborted;
   3.268  
   3.269 -		// Finally load map into mapEditor
   3.270 -		me->setFilePath (mapfile,fn);
   3.271 -		if (me->load(mapfile,lmode))
   3.272 -			err=aborted;
   3.273 +			// Restore old (maybe empty) filepath, if this is an import
   3.274 +			if (lmode!=NewMap)
   3.275 +				me->setFilePath (fn_org);
   3.276 +		}	
   3.277  
   3.278 -		// Restore old (maybe empty) filepath, if this is an import
   3.279 -		if (lmode!=NewMap)
   3.280 -			me->setFilePath (fn_org);
   3.281 -			
   3.282 -		// Delete tmpDir
   3.283 -		removeDir (QDir(tmpMapDir));
   3.284 -
   3.285 -		// Check for errors
   3.286 -		if (err==success) 
   3.287 +		// Finally check for errors and go home
   3.288 +		if (err==aborted) 
   3.289 +		{
   3.290 +			if (lmode==NewMap) fileCloseMap();
   3.291 +			statusBar()->message( "Could not load " + fn, statusbarTime );
   3.292 +		} else 
   3.293  		{
   3.294  			if (lmode==NewMap)
   3.295  			{
   3.296 @@ -1569,16 +1527,11 @@
   3.297  				actionFilePrint->setEnabled (true);
   3.298  			}	
   3.299  			statusBar()->message( "Loaded " + fn, statusbarTime );
   3.300 -			return;
   3.301 -		} else 
   3.302 -		{
   3.303 -			if (lmode==NewMap)
   3.304 -				fileCloseMap();
   3.305  		}	
   3.306  
   3.307 -
   3.308 +		// Delete tmpDir
   3.309 +		removeDir (QDir(tmpMapDir));
   3.310  	}
   3.311 -	statusBar()->message( "Could not load " + fn, statusbarTime );
   3.312  }
   3.313  
   3.314  
   3.315 @@ -1587,6 +1540,7 @@
   3.316  	QFileDialog *fd=new QFileDialog( this);
   3.317  	if (!lastFileDir.isEmpty()) 
   3.318  		fd->setDir (lastFileDir);
   3.319 +	fd->setMode (QFileDialog::ExistingFiles);
   3.320  	fd->addFilter ("XML (*.xml)");
   3.321  	fd->addFilter ("VYM map (*.vym *.vyp)");
   3.322  	switch (lmode)
   3.323 @@ -1607,9 +1561,16 @@
   3.324  	if ( fd->exec() == QDialog::Accepted )
   3.325  	{
   3.326  		lastFileDir=fd->dirPath();
   3.327 -        fn = fd->selectedFile();
   3.328 -		fileLoad(fn, lmode);				   
   3.329 +	    QStringList flist = fd->selectedFiles();
   3.330 +		QStringList::Iterator it = flist.begin();
   3.331 +		while( it != flist.end() ) 
   3.332 +		{
   3.333 +			fn = *it;
   3.334 +			fileLoad(*it, lmode);				   
   3.335 +			++it;
   3.336 +		}
   3.337  	}
   3.338 +	delete (fd);
   3.339  }
   3.340  
   3.341  void Main::fileLoad()
   3.342 @@ -1654,7 +1615,7 @@
   3.343  			// Look, if we should zip the data:
   3.344  			if (!saveZipped)
   3.345  			{
   3.346 -				QMessageBox mb( "VYM",
   3.347 +				QMessageBox mb( __VYM,
   3.348  					tr("The map %1\ndid not use the compressed "
   3.349  					"vym file format.\nWriting it uncompressed will also write images \n"
   3.350  					"and flags and thus may overwrite files in the "
   3.351 @@ -1755,7 +1716,7 @@
   3.352  			// Check for existing file
   3.353  			if (QFile (fn).exists())
   3.354  			{
   3.355 -				QMessageBox mb( "VYM",
   3.356 +				QMessageBox mb( __VYM,
   3.357  					tr("The file %1\nexists already. Do you want to").arg(fn),
   3.358  					QMessageBox::Warning,
   3.359  					QMessageBox::Yes | QMessageBox::Default,
   3.360 @@ -1904,8 +1865,23 @@
   3.361  
   3.362  void Main::fileExportOOPresentation()
   3.363  {
   3.364 -	if (currentMapEditor())
   3.365 -		currentMapEditor()->exportOOPresentation();	
   3.366 +	ExportOOFileDialog *fd=new ExportOOFileDialog( this,__VYM " - "+tr("Export to Open Office"));
   3.367 +	// FIXME add extra info in dialog
   3.368 +	//ImagePreview *p =new ImagePreview (fd);
   3.369 +	//fd->setContentsPreviewEnabled( TRUE );
   3.370 +	//fd->setContentsPreview( p, p );
   3.371 +	//fd->setPreviewMode( QFileDialog::Contents );
   3.372 +	fd->setCaption(__VYM " - " +tr("Export to Open Office"));
   3.373 +	//fd->setDir (lastImageDir);
   3.374 +	fd->show();
   3.375 +
   3.376 +	if ( fd->exec() == QDialog::Accepted )
   3.377 +	{
   3.378 +		QString fn=fd->selectedFile();
   3.379 +		//lastImageDir=fn.left(fn.findRev ("/"));
   3.380 +		if (currentMapEditor())
   3.381 +			currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
   3.382 +	}
   3.383  }
   3.384  
   3.385  void Main::fileCloseMap()
   3.386 @@ -1914,7 +1890,7 @@
   3.387  	{
   3.388  		if (currentMapEditor()->hasChanged())
   3.389  		{
   3.390 -			QMessageBox mb( "VYM",
   3.391 +			QMessageBox mb( __VYM,
   3.392  				tr("The map %1 has been modified but not saved yet. Do you want to").arg(currentMapEditor()->getFileName()),
   3.393  				QMessageBox::Warning,
   3.394  				QMessageBox::Yes | QMessageBox::Default,
   3.395 @@ -1963,7 +1939,7 @@
   3.396  		if (me->isUnsaved())
   3.397  		{
   3.398  			tabWidget->setCurrentPage(i);
   3.399 -			QMessageBox mb( "VYM",
   3.400 +			QMessageBox mb( __VYM,
   3.401  				tr("This map is not saved yet. Do you want to"),
   3.402  				QMessageBox::Warning,
   3.403  				QMessageBox::Yes | QMessageBox::Default,
   3.404 @@ -2525,8 +2501,8 @@
   3.405  
   3.406  void Main::testFunction()
   3.407  {
   3.408 -	//textEditor->stackUnder(this);
   3.409 -	currentMapEditor()->testFunction();
   3.410 +	fileExportOOPresentation();
   3.411 +//	currentMapEditor()->testFunction();
   3.412  }
   3.413  
   3.414  void Main::helpDoc()
     4.1 --- a/mapeditor.cpp	Tue Jan 24 15:09:48 2006 +0000
     4.2 +++ b/mapeditor.cpp	Tue Jan 24 15:09:48 2006 +0000
     4.3 @@ -373,7 +373,7 @@
     4.4  	if (linkcolorhint==HeadingColor) 
     4.5  		colhint=attribut("linkColorHint","HeadingColor");
     4.6  
     4.7 -	QString mapAttr=attribut("version",__VYM_VERSION__);
     4.8 +	QString mapAttr=attribut("version",__VYM_VERSION);
     4.9  	if (!saveSelection)
    4.10  		mapAttr+= attribut("author",mapCenter->getAuthor()) +
    4.11  				  attribut("comment",mapCenter->getComment()) +
    4.12 @@ -1065,9 +1065,9 @@
    4.13  	ExportBase ex;
    4.14  	ex.setMapCenter(mapCenter);
    4.15  
    4.16 -	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (ASCII)"));
    4.17 +	QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export (ASCII)"));
    4.18  	fd->addFilter ("TXT (*.txt)");
    4.19 -	fd->setCaption("VYM - Export (ASCII) (still experimental)");
    4.20 +	fd->setCaption(__VYM " -" +tr("Export (ASCII) (still experimental)"));
    4.21  	fd->setMode( QFileDialog::AnyFile );
    4.22  	fd->show();
    4.23  
    4.24 @@ -1075,7 +1075,7 @@
    4.25  	{
    4.26  		if (QFile (fd->selectedFile()).exists() )
    4.27  		{
    4.28 -			QMessageBox mb( "VYM",
    4.29 +			QMessageBox mb( __VYM,
    4.30  				tr("The file %1 exists already.\nDo you want to overwrite it?").arg(fd->selectedFile()), 
    4.31  			QMessageBox::Warning,
    4.32  			QMessageBox::Yes | QMessageBox::Default,
    4.33 @@ -1104,9 +1104,9 @@
    4.34  void MapEditor::exportLaTeX()
    4.35  {
    4.36  	// TODO still experimental
    4.37 -	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (LaTex)"));
    4.38 +	QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export (LaTex)"));
    4.39  	fd->addFilter ("TEX (*.tex)");
    4.40 -	fd->setCaption("VYM - Export (LaTex) (still experimental)");
    4.41 +	fd->setCaption(__VYM  " - " + tr("Export (LaTex) (still experimental)"));
    4.42  	fd->setMode( QFileDialog::AnyFile );
    4.43  	fd->show();
    4.44  
    4.45 @@ -1143,48 +1143,13 @@
    4.46  	}
    4.47  }
    4.48  
    4.49 -void MapEditor::exportOOPresentation()
    4.50 +void MapEditor::exportOOPresentation(const QString &fn, const QString &cf)
    4.51  {
    4.52 -	// TODO still experimental
    4.53 -	/*
    4.54 -	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (Open Office 1.3.x Presentation)"));
    4.55 -	fd->addFilter ("Open Office 1.3.x presentation (*.sxi)");
    4.56 -	fd->setCaption("VYM - Export (Open Office 1.3.x presentation) (still experimental)");
    4.57 -	fd->setMode( QFileDialog::AnyFile );
    4.58 -	fd->show();
    4.59 -
    4.60 -	if ( fd->exec() == QDialog::Accepted )
    4.61 -	{
    4.62 -		if (QFile (fd->selectedFile()).exists() )
    4.63 -		{
    4.64 -			QMessageBox mb( "VYM",
    4.65 -				tr("The file ") + fd->selectedFile() + 
    4.66 -				tr(" exists already. Do you want to overwrite it?"),
    4.67 -			QMessageBox::Warning,
    4.68 -			QMessageBox::Yes | QMessageBox::Default,
    4.69 -			QMessageBox::Cancel | QMessageBox::Escape,
    4.70 -			QMessageBox::NoButton );
    4.71 -
    4.72 -			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
    4.73 -			mb.setButtonText( QMessageBox::No, tr("Cancel"));
    4.74 -			Export ex;
    4.75 -			switch( mb.exec() ) 
    4.76 -			{
    4.77 -				case QMessageBox::Yes:
    4.78 -					// save 
    4.79 -					break;;
    4.80 -				case QMessageBox::Cancel:
    4.81 -					// do nothing
    4.82 -					return;
    4.83 -					break;
    4.84 -			}
    4.85 -		}
    4.86 -		*/
    4.87 -		ExportOO ex;
    4.88 -		//ex.setPath (fd->selectedFile() );
    4.89 -		ex.setMapCenter(mapCenter);
    4.90 -		ex.exportPresentation();
    4.91 -//	}
    4.92 +	ExportOO ex;
    4.93 +	ex.setPath (fn);
    4.94 +	ex.setConfigFile(cf);
    4.95 +	ex.setMapCenter(mapCenter);
    4.96 +	ex.exportPresentation();
    4.97  }
    4.98  
    4.99  
   4.100 @@ -2204,7 +2169,7 @@
   4.101  		if (typeid(*selection) == typeid(BranchObj) ||
   4.102  			typeid(*selection) == typeid(MapCenterObj))
   4.103  		{
   4.104 -			saveState(selection);
   4.105 +			saveState(selection);	//TODO undoCommand
   4.106  			BranchObj *bo=(BranchObj*)selection;
   4.107  			bo->setColor(actColor, true); // color links, color childs
   4.108  		}    
   4.109 @@ -2378,9 +2343,9 @@
   4.110  			typeid(*selection) == typeid(MapCenterObj)) )
   4.111  	{		
   4.112  		BranchObj *bo=(BranchObj*)selection;
   4.113 -		QFileDialog *fd=new QFileDialog( this,tr("VYM - Link to another map"));
   4.114 +		QFileDialog *fd=new QFileDialog( this,__VYM " - " +tr("Link to another map"));
   4.115  		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
   4.116 -		fd->setCaption(tr("VYM - Link to another map"));
   4.117 +		fd->setCaption(__VYM " - " +tr("Link to another map"));
   4.118  		if (! bo->getVymLink().isEmpty() )
   4.119  			fd->setSelection( bo->getVymLink() );
   4.120  		fd->show();
   4.121 @@ -2792,13 +2757,14 @@
   4.122  	{
   4.123  		BranchObj *bo=((BranchObj*)selection);
   4.124  
   4.125 -		QFileDialog *fd=new QFileDialog( this,tr("vym - load image"));
   4.126 +		QFileDialog *fd=new QFileDialog( this,QString ("vym - ")+tr("Load image"));
   4.127 +		fd->setMode (QFileDialog::ExistingFiles);
   4.128  		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
   4.129  		ImagePreview *p =new ImagePreview (fd);
   4.130  		fd->setContentsPreviewEnabled( TRUE );
   4.131  		fd->setContentsPreview( p, p );
   4.132  		fd->setPreviewMode( QFileDialog::Contents );
   4.133 -		fd->setCaption(tr("vym - Load image"));
   4.134 +		fd->setCaption(__VYM " - " +tr("Load image"));
   4.135  		fd->setDir (lastImageDir);
   4.136  		fd->show();
   4.137  
   4.138 @@ -2806,12 +2772,19 @@
   4.139  		if ( fd->exec() == QDialog::Accepted )
   4.140  		{
   4.141  			saveState(selection);
   4.142 -			QString fn=fd->selectedFile();
   4.143  			lastImageDir=fn.left(fn.findRev ("/"));
   4.144 -			bo->addFloatImage();
   4.145 -			// TODO check if load was successful
   4.146 -			bo->getLastFloatImage()->load(fn);
   4.147 -			bo->getLastFloatImage()->setOriginalFilename(fn);
   4.148 +			QStringList flist = fd->selectedFiles();
   4.149 +			QStringList::Iterator it = flist.begin();
   4.150 +			while( it != flist.end() ) 
   4.151 +			{
   4.152 +				fn = *it;
   4.153 +				bo->addFloatImage();
   4.154 +				// TODO check if load was successful
   4.155 +				bo->getLastFloatImage()->load(*it);
   4.156 +				bo->getLastFloatImage()->setOriginalFilename(fn);
   4.157 +				++it;
   4.158 +			}
   4.159 +
   4.160  			mapCenter->reposition();
   4.161  			adjustCanvasSize();
   4.162  			canvas()->update();
   4.163 @@ -2836,7 +2809,7 @@
   4.164  		fd->addFilter ("GIF (*.gif)");
   4.165  		fd->addFilter ("PNM (*.pnm)");
   4.166  		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
   4.167 -		fd->setCaption(tr("vym - Save image as %1").arg(fmt));
   4.168 +		fd->setCaption(__VYM " - " +tr("Save image as %1").arg(fmt));
   4.169  		fd->setMode( QFileDialog::AnyFile );
   4.170  		fd->setSelection (fio->getOriginalFilename());
   4.171  		fd->show();
   4.172 @@ -2846,7 +2819,7 @@
   4.173  		{
   4.174  			if (QFile (fd->selectedFile()).exists() )
   4.175  			{
   4.176 -				QMessageBox mb( "VYM",
   4.177 +				QMessageBox mb( __VYM,
   4.178  					tr("The file %1 exists already.\n"
   4.179  					"Do you want to overwrite it?").arg(fd->selectedFile()),
   4.180  				QMessageBox::Warning,
   4.181 @@ -2981,10 +2954,10 @@
   4.182  		(typeid(*selection) == typeid(BranchObj)) || 
   4.183  		(typeid(*selection) == typeid(MapCenterObj))  )
   4.184  	{
   4.185 -		QFileDialog *fd=new QFileDialog( this,tr("VYM - Choose directory structur to import"));
   4.186 +		QFileDialog *fd=new QFileDialog( this,__VYM " - " +tr("Choose directory structure to import"));
   4.187  		fd->setMode (QFileDialog::DirectoryOnly);
   4.188  		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
   4.189 -		fd->setCaption(tr("VYM - Choose directory structur to import"));
   4.190 +		fd->setCaption(__VYM " - " +tr("Choose directory structure to import"));
   4.191  		fd->show();
   4.192  
   4.193  		QString fn;
   4.194 @@ -3046,7 +3019,10 @@
   4.195  void MapEditor::testFunction()
   4.196  {
   4.197  	cout << "MapEditor::testFunction() called\n";
   4.198 -	mapCenter->move(mapCenter->x(),mapCenter->y());
   4.199 +	if (selection && (typeid(*selection) == typeid(BranchObj)))
   4.200 +	{
   4.201 +		cout << "Note:\n"<<((BranchObj*)selection)->getNoteOpenDoc()<<endl;
   4.202 +	}
   4.203  }
   4.204  
   4.205  void MapEditor::ensureSelectionVisible()
     5.1 --- a/mapeditor.h	Tue Jan 24 15:09:48 2006 +0000
     5.2 +++ b/mapeditor.h	Tue Jan 24 15:09:48 2006 +0000
     5.3 @@ -73,7 +73,7 @@
     5.4      void exportImage (QString fn, int);	// export in given format
     5.5      void exportASCII();
     5.6      void exportLaTeX();
     5.7 -    void exportOOPresentation();
     5.8 +    void exportOOPresentation(const QString &,const QString &);
     5.9      void exportXML(const QString&);		// export to directory
    5.10      void clear();		// clear map
    5.11      void copy();		// copy branch to clipboard
     6.1 --- a/noteobj.cpp	Tue Jan 24 15:09:48 2006 +0000
     6.2 +++ b/noteobj.cpp	Tue Jan 24 15:09:48 2006 +0000
     6.3 @@ -14,6 +14,12 @@
     6.4  	clear();
     6.5  }
     6.6  
     6.7 +NoteObj::NoteObj(const QString &s)
     6.8 +{
     6.9 +	clear();
    6.10 +	note=s;
    6.11 +}
    6.12 +
    6.13  void NoteObj::copy (NoteObj other)
    6.14  {
    6.15  	note=other.note;
    6.16 @@ -38,6 +44,78 @@
    6.17  	return note;
    6.18  }
    6.19  
    6.20 +QString NoteObj::getNoteASCII()
    6.21 +{
    6.22 +	QString r=note;
    6.23 +
    6.24 +	// convert all "<br*>" to "\n"
    6.25 +	QRegExp re("<br.*>");
    6.26 +	re.setMinimal(true);
    6.27 +	r.replace (re,"\n");
    6.28 +
    6.29 +	// convert all "</p>" to "\n"
    6.30 +	re.setPattern ("</p>");
    6.31 +	r.replace (re,"\n");
    6.32 +	
    6.33 +	// remove all remaining tags 
    6.34 +	re.setPattern ("<.*>");
    6.35 +	r.replace (re,"");
    6.36 +
    6.37 +	// If string starts with \n now, remove it.
    6.38 +	// It would be wrong in an OOo export for example
    6.39 +	while (r.at(0)=='\n') r.remove (0,1);
    6.40 +	
    6.41 +	// convert "&", "<" and ">"
    6.42 +	re.setPattern ("&gt;");
    6.43 +	r.replace (re,">");
    6.44 +	re.setPattern ("&lt;");
    6.45 +	r.replace (re,"<");
    6.46 +	re.setPattern ("&amp;");
    6.47 +	r.replace (re,"&");
    6.48 +	re.setPattern ("&quot;");
    6.49 +	r.replace (re,"\"");
    6.50 +
    6.51 +	return r;
    6.52 +}
    6.53 +
    6.54 +QString NoteObj::getNoteOpenDoc()
    6.55 +{
    6.56 +	// Evil hack to transform QT Richtext into
    6.57 +	// something which can be used in OpenDoc format
    6.58 +	// 
    6.59 +	// TODO create clean XML transformation which also
    6.60 +	// considers fonts, colors, ...
    6.61 +
    6.62 +	QString r=note;
    6.63 +
    6.64 +	// convert all "<br*>"
    6.65 +	QRegExp re("<br.*>");
    6.66 +	re.setMinimal(true);
    6.67 +	r.replace (re,"<text:line-break/>");
    6.68 +
    6.69 +	// convert all "<p>" 
    6.70 +	re.setPattern ("<p>");
    6.71 +	r.replace (re,"<text:line-break/>");
    6.72 +	
    6.73 +	// Remove all other tags, e.g. paragraphs will be added in 
    6.74 +	// templates used during export
    6.75 +	re.setPattern ("</?html.*>");
    6.76 +	r.replace (re,"");
    6.77 +	re.setPattern ("</?head.*>");
    6.78 +	r.replace (re,"");
    6.79 +	re.setPattern ("</?body.*>");
    6.80 +	r.replace (re,"");
    6.81 +	re.setPattern ("</?meta.*>");
    6.82 +	r.replace (re,"");
    6.83 +	re.setPattern ("</?span.*>");
    6.84 +	r.replace (re,"");
    6.85 +	re.setPattern ("</?p.*>");
    6.86 +	r.replace (re,"");
    6.87 +
    6.88 +	r="<text:span text:style-name=\"vym-notestyle\">"+r+"</text:span>";
    6.89 +	return r;
    6.90 +}
    6.91 +
    6.92  void NoteObj::setFontHint (const QString &s)
    6.93  {
    6.94  	// only for backward compatibility (pre 1.5 )