diff -r 72cc3873306a -r aa48c7b52549 exports.cpp --- a/exports.cpp Mon Sep 05 11:56:31 2005 +0000 +++ b/exports.cpp Tue Jan 03 09:44:41 2006 +0000 @@ -21,6 +21,23 @@ mapCenter=mc; } +QString Export::getSectionString(BranchObj *bostart) +{ + QString r; + BranchObj *bo=bostart; + int depth=bo->getDepth(); + while (depth>0) + { + r=QString("%1").arg(1+bo->getNum(),0,10)+"." + r; + bo=(BranchObj*)(bo->getParObj()); + depth=bo->getDepth(); + } + if (r.isEmpty()) + return r; + else + return r + " "; +} + void Export::exportMap() { QFile file (filepath); @@ -72,20 +89,129 @@ file.close(); } -QString Export::getSectionString(BranchObj *bostart) +// Exports a map to a LaTex file. This file needs to be included or inported into a LaTex document +// it will not add a preamble, or anything that makes a full LaTex document. +void Export::exportLaTeX() { - QString r; - BranchObj *bo=bostart; - int depth=bo->getDepth(); - while (depth>0) - { - r=QString("%1").arg(1+bo->getNum(),0,10)+"." + r; - bo=(BranchObj*)(bo->getParObj()); - depth=bo->getDepth(); - } - if (r.isEmpty()) - return r; - else - return r + " "; + QFile file (filepath); + if ( !file.open( IO_WriteOnly ) ) { + // FIXME + cout << "Export::exportMap couldn't open "<first(); + while (bo) { + if (bo->getDepth()==0); + else if (bo->getDepth()==1) { + ts << ("\\chapter{" + bo->getHeading()+ "}\n"); + } + else if (bo->getDepth()==2) { + ts << ("\\section{" + bo->getHeading()+ "}\n"); + } + else if (bo->getDepth()==3) { + ts << ("\\subsection{" + bo->getHeading()+ "}\n"); + } + else if (bo->getDepth()==4) { + ts << ("\\subsubsection{" + bo->getHeading()+ "}\n"); + } + else { + ts << ("\\paragraph*{" + bo->getHeading()+ "}\n"); + } + + // If necessary, write note + if (!bo->getNote().isEmpty()) { + ts << (textConvertToASCII(bo->getNote())); + ts << ("\n"); + } + + bo=bo->next(); + } + file.close(); } +#include "settings.h" + +void Export::exportOOPresentation() +{ + QString templateDir="oo-test/suse-template/"; + QString templateContent="content.xml"; + QString tmpDir="/tmp/vym-ootest/"; + QString header=""; + + + // Create tmpdir + // TODO + + // Copy template to tmpdir + // TODO + + + // Read content-template + // TODO + QString content; + if (!loadStringFromDisk (templateDir+templateContent,content)) + { + qWarning ("Export::exportOOPresentation() Couldn't load from "+templateDir+templateContent); + return; + } + + + // Walk through map + QString s; + QString actIndent(""); + uint j; + int i; + BranchObj *bo; + bo=mapCenter->first(); + while (bo) + { + // Make indentstring + for (i=0;igetDepth();i++) actIndent+= indentPerDepth; + + // Write heading + // write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n"); + if (bo->getDepth()==0) + { + s+= (bo->getHeading()+ "\n"); + for (j=0;jgetHeading().length();j++) s+="="; + s+= "\n"; + } else if (bo->getDepth()==1) + s+= ("\n"+getSectionString(bo) + bo->getHeading()+ "\n"); + else if (bo->getDepth()==2) + s+= (actIndent + " o " + bo->getHeading()+ "\n"); + else + s+ (actIndent + " - " + bo->getHeading()+ "\n"); + + /* + // If necessary, write note + if (!bo->getNote().isEmpty()) + { + s =textConvertToASCII(bo->getNote()); + s=s.replace ("\n","\n"+actIndent); + ts << (s+"\n\n"); + } + */ + bo=bo->next(); + actIndent=""; + } + + + // Insert new content + // TODO + cout <<"\n\ns="<",s); + cout << "ExportOO: content=\n"<