5 #include "linkablemapobj.h"
6 #include "texteditor.h"
14 void Export::setPath (const QString &p)
19 void Export::setMapCenter(MapCenterObj *mc)
24 void Export::exportMap()
26 QFile file (filepath);
27 if ( !file.open( IO_WriteOnly ) )
29 // FIXME experimental, testing
30 cout << "Export::exportMap couldn't open "<<filepath<<endl;
33 QTextStream ts( &file ); // use LANG decoding here...
35 // Main loop over all branches
37 QString actIndent("");
40 bo=mapCenter->first();
44 for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
47 // write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
48 if (bo->getDepth()==0)
50 ts << (bo->getHeading()+ "\n");
51 for (i=0;i<bo->getHeading().length();i++) ts<<"=";
53 } else if (bo->getDepth()==1)
54 ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
55 else if (bo->getDepth()==2)
56 ts << (actIndent + " o " + bo->getHeading()+ "\n");
58 ts << (actIndent + " - " + bo->getHeading()+ "\n");
60 // If necessary, write note
61 if (!bo->getNote().isEmpty())
63 s =textConvertToASCII(bo->getNote());
64 s=s.replace ("\n","\n"+actIndent);
74 QString Export::getSectionString(BranchObj *bostart)
77 BranchObj *bo=bostart;
78 int depth=bo->getDepth();
81 r=QString("%1").arg(1+bo->getNum(),0,10)+"." + r;
82 bo=(BranchObj*)(bo->getParObj());