exports.cpp
changeset 199 202572375c98
parent 194 de97201180ea
child 201 eda811e31b2e
     1.1 --- a/exports.cpp	Wed Jan 25 12:34:55 2006 +0000
     1.2 +++ b/exports.cpp	Wed Jan 25 12:34:55 2006 +0000
     1.3 @@ -14,9 +14,14 @@
     1.4  	indentPerDepth="  ";
     1.5  }
     1.6  
     1.7 -void ExportBase::setPath (const QString &p)
     1.8 +void ExportBase::setDir(const QString &p)
     1.9  {
    1.10 -	filepath=p;
    1.11 +	outputDir=p;
    1.12 +}
    1.13 +
    1.14 +void ExportBase::setFile (const QString &p)
    1.15 +{
    1.16 +	outputFile=p;
    1.17  }
    1.18  
    1.19  void ExportBase::setMapCenter(MapCenterObj *mc)
    1.20 @@ -43,11 +48,11 @@
    1.21  
    1.22  void ExportBase::exportXML()
    1.23  {
    1.24 -	QFile file (filepath);
    1.25 +	QFile file (outputFile);
    1.26  	if ( !file.open( IO_WriteOnly ) )
    1.27  	{
    1.28  		// FIXME experimental, testing
    1.29 -		cout << "ExportBase::exportXML  couldn't open "<<filepath<<endl;
    1.30 +		cout << "ExportBase::exportXML  couldn't open "<<outputFile<<endl;
    1.31  		return;
    1.32  	}
    1.33  	QTextStream ts( &file );	// use LANG decoding here...
    1.34 @@ -99,10 +104,10 @@
    1.35  	// or inported into a LaTex document
    1.36  	// it will not add a preamble, or anything 
    1.37  	// that makes a full LaTex document.
    1.38 -  QFile file (filepath);
    1.39 +  QFile file (outputFile);
    1.40    if ( !file.open( IO_WriteOnly ) ) {
    1.41 -    // FIXME
    1.42 -    cout << "Export::exportMap  couldn't open "<<filepath<<endl;
    1.43 +    // FIXME 
    1.44 +    cout << "Export::exportMap  couldn't open "<<outputFile<<endl;
    1.45      return;
    1.46    }
    1.47    QTextStream ts( &file );	// use LANG decoding here...
    1.48 @@ -145,6 +150,7 @@
    1.49  
    1.50  ExportOO::ExportOO()
    1.51  {
    1.52 +	useSections=false;
    1.53  	// Create tmpdir
    1.54  	tmpDir.setPath (makeUniqueDir("/tmp/vym-XXXXXX"));
    1.55  }
    1.56 @@ -189,8 +195,6 @@
    1.57  {
    1.58  	QString allPages;
    1.59  
    1.60 -	bool useSections=true;
    1.61 -
    1.62  	// Insert new content
    1.63  	content.replace ("<!-- INSERT TITLE -->",quotemeta(mapCenter->getHeading()));
    1.64  	content.replace ("<!-- INSERT AUTHOR -->",quotemeta(mapCenter->getAuthor()));
    1.65 @@ -243,7 +247,7 @@
    1.66  	QFile f (contentFile);
    1.67      if ( !f.open( IO_WriteOnly ) ) 
    1.68  	{
    1.69 -		mainWindow->statusMessage(QString(QObject::tr("Could not write to %1")).arg(outputFile));
    1.70 +		mainWindow->statusMessage(QString(QObject::tr("Could not write to %1")).arg(contentFile));
    1.71  		return;
    1.72      }
    1.73  
    1.74 @@ -279,8 +283,9 @@
    1.75  	pageTemplateFile=templateDir+"page-template.xml";
    1.76  	sectionTemplateFile=templateDir+"section-template.xml";
    1.77  
    1.78 -	outputFile=tmpDir.currentDirPath()+"/vym-out.odp";
    1.79 -	
    1.80 +	if (set.readEntry("useSections").contains("yes"))
    1.81 +		useSections=true;
    1.82 +
    1.83  	// Copy template to tmpdir
    1.84  	system ("cp -r "+templateDir+"* "+tmpDir.path());
    1.85