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("");
41 bo=mapCenter->first();
45 for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
48 // write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
49 if (bo->getDepth()==0)
51 ts << (bo->getHeading()+ "\n");
52 for (j=0;j<bo->getHeading().length();j++) ts<<"=";
54 } else if (bo->getDepth()==1)
55 ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
56 else if (bo->getDepth()==2)
57 ts << (actIndent + " o " + bo->getHeading()+ "\n");
59 ts << (actIndent + " - " + bo->getHeading()+ "\n");
61 // If necessary, write note
62 if (!bo->getNote().isEmpty())
64 s =textConvertToASCII(bo->getNote());
65 s=s.replace ("\n","\n"+actIndent);
75 QString Export::getSectionString(BranchObj *bostart)
78 BranchObj *bo=bostart;
79 int depth=bo->getDepth();
82 r=QString("%1").arg(1+bo->getNum(),0,10)+"." + r;
83 bo=(BranchObj*)(bo->getParObj());