exports.cpp
changeset 239 bdeb503d2b7f
parent 234 5115a9d93e86
child 254 d3080e02b13a
     1.1 --- a/exports.cpp	Wed Mar 08 12:59:08 2006 +0000
     1.2 +++ b/exports.cpp	Tue Mar 14 14:27:04 2006 +0000
     1.3 @@ -109,6 +109,8 @@
     1.4  		return r + " ";
     1.5  }
     1.6  
     1.7 +
     1.8 +////////////////////////////////////////////////////////////////////////
     1.9  void ExportASCII::doExport()
    1.10  {
    1.11  	QFile file (outputFile);
    1.12 @@ -129,35 +131,58 @@
    1.13  	bo=mapCenter->first();
    1.14  	while (bo) 
    1.15  	{
    1.16 -		// Make indentstring
    1.17 -		for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
    1.18 +		if (!bo->hideInExport())
    1.19 +		{
    1.20 +			// Make indentstring
    1.21 +			for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
    1.22  
    1.23 -		if (bo->getDepth()==0)
    1.24 -		{
    1.25 -			ts << (bo->getHeading()+ "\n");
    1.26 -			for (j=0;j<bo->getHeading().length();j++) ts<<"=";
    1.27 -			ts << "\n";
    1.28 -		} else 	if (bo->getDepth()==1)
    1.29 -			ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
    1.30 -		else	if (bo->getDepth()==2)
    1.31 -			ts << (actIndent + " o " + bo->getHeading()+ "\n");
    1.32 -		else	
    1.33 -			ts << (actIndent + " - " + bo->getHeading()+ "\n");
    1.34 -		
    1.35 -		// If necessary, write note
    1.36 -		if (!bo->getNote().isEmpty())
    1.37 -		{
    1.38 -			s =bo->getNoteASCII();
    1.39 -			s=s.replace ("\n","\n"+actIndent);
    1.40 -			ts << (s+"\n\n");
    1.41 +			if (bo->getDepth()==0)
    1.42 +			{
    1.43 +				ts << (bo->getHeading()+ "\n");
    1.44 +				for (j=0;j<bo->getHeading().length();j++) ts<<"=";
    1.45 +				ts << "\n";
    1.46 +			} else 	if (bo->getDepth()==1)
    1.47 +				ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
    1.48 +			else	if (bo->getDepth()==2)
    1.49 +				ts << (actIndent + " o " + bo->getHeading()+ "\n");
    1.50 +			else	
    1.51 +				ts << (actIndent + " - " + bo->getHeading()+ "\n");
    1.52 +			
    1.53 +			// If necessary, write note
    1.54 +			if (!bo->getNote().isEmpty())
    1.55 +			{
    1.56 +				s =bo->getNoteASCII();
    1.57 +				s=s.replace ("\n","\n"+actIndent);
    1.58 +				ts << (s+"\n\n");
    1.59 +			}
    1.60  		}
    1.61 -		
    1.62  		bo=bo->next();
    1.63  		actIndent="";
    1.64  	}
    1.65  	file.close();
    1.66  }
    1.67  
    1.68 +////////////////////////////////////////////////////////////////////////
    1.69 +void ExportKDEBookmarks::doExport() 
    1.70 +{
    1.71 +	MapEditor *me=NULL;
    1.72 +	if (mapCenter) me=mapCenter->getMapEditor();
    1.73 +	if (me)
    1.74 +	{
    1.75 +		me->exportXML(tmpDir.path());
    1.76 +		//FIXME testing
    1.77 +		cout << "tmpDir="<<tmpDir.path()<<endl;
    1.78 +
    1.79 +		XSLTProc p;
    1.80 +		p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
    1.81 +		p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
    1.82 +		p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
    1.83 +		p.process();
    1.84 +	}
    1.85 +
    1.86 +}
    1.87 +
    1.88 +////////////////////////////////////////////////////////////////////////
    1.89  void ExportTaskjuggler::doExport() 
    1.90  {
    1.91  	MapEditor *me=NULL;
    1.92 @@ -177,6 +202,7 @@
    1.93  
    1.94  }
    1.95  
    1.96 +////////////////////////////////////////////////////////////////////////
    1.97  void ExportLaTeX::doExport() 
    1.98  {
    1.99  	// Exports a map to a LaTex file.  
   1.100 @@ -200,38 +226,40 @@
   1.101    BranchObj *bo;
   1.102    bo=mapCenter->first();
   1.103    while (bo) {
   1.104 -    if (bo->getDepth()==0);
   1.105 -    else if (bo->getDepth()==1) {
   1.106 -      ts << ("\\chapter{" + bo->getHeading()+ "}\n");
   1.107 +	if (!bo->hideInExport())
   1.108 +	{
   1.109 +		if (bo->getDepth()==0);
   1.110 +		else if (bo->getDepth()==1) {
   1.111 +		  ts << ("\\chapter{" + bo->getHeading()+ "}\n");
   1.112 +		}
   1.113 +		else if (bo->getDepth()==2) {
   1.114 +		  ts << ("\\section{" + bo->getHeading()+ "}\n");
   1.115 +		}
   1.116 +		else if (bo->getDepth()==3) {
   1.117 +		  ts << ("\\subsection{" + bo->getHeading()+ "}\n");
   1.118 +		}
   1.119 +		else if (bo->getDepth()==4) {
   1.120 +		  ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
   1.121 +		}
   1.122 +		else {
   1.123 +		  ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
   1.124 +		}
   1.125 +		
   1.126 +		// If necessary, write note
   1.127 +		if (!bo->getNote().isEmpty()) {
   1.128 +		  ts << (bo->getNoteASCII());
   1.129 +		  ts << ("\n");
   1.130 +		}
   1.131      }
   1.132 -    else if (bo->getDepth()==2) {
   1.133 -      ts << ("\\section{" + bo->getHeading()+ "}\n");
   1.134 -    }
   1.135 -    else if (bo->getDepth()==3) {
   1.136 -      ts << ("\\subsection{" + bo->getHeading()+ "}\n");
   1.137 -    }
   1.138 -    else if (bo->getDepth()==4) {
   1.139 -      ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
   1.140 -    }
   1.141 -    else {
   1.142 -      ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
   1.143 -    }
   1.144 -    
   1.145 -    // If necessary, write note
   1.146 -    if (!bo->getNote().isEmpty()) {
   1.147 -      ts << (bo->getNoteASCII());
   1.148 -      ts << ("\n");
   1.149 -    }
   1.150 -    
   1.151      bo=bo->next();
   1.152     }
   1.153    file.close();
   1.154  }
   1.155  
   1.156 +////////////////////////////////////////////////////////////////////////
   1.157  ExportOO::ExportOO()
   1.158  {
   1.159  	useSections=false;
   1.160 -	skipPageFlag="cross-red";
   1.161  }
   1.162  
   1.163  ExportOO::~ExportOO()
   1.164 @@ -251,7 +279,7 @@
   1.165          r+="<text:list text:style-name=\"vym-list\">\n";
   1.166          while (bo)
   1.167          {
   1.168 -			if (!bo->isActiveFlag (skipPageFlag))
   1.169 +			if (!bo->hideInExport())
   1.170  			{
   1.171  				r+="<text:list-item><text:p >";
   1.172  				r+=quotemeta(bo->getHeading());
   1.173 @@ -309,7 +337,7 @@
   1.174  		while (pagesBO)
   1.175  		{
   1.176  			// Add page with list of items
   1.177 -			if (!pagesBO->isActiveFlag (skipPageFlag))
   1.178 +			if (!pagesBO->hideInExport())
   1.179  			{
   1.180  				onePage=pageTemplate;
   1.181  				onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBO->getHeading() ) );