diff -r 338ebdc9b947 -r 14f2b1b15242 exports.cpp --- a/exports.cpp Fri Oct 02 14:31:03 2009 +0000 +++ b/exports.cpp Fri Nov 13 08:32:03 2009 +0000 @@ -148,7 +148,7 @@ BranchItem *cur=NULL; BranchItem *prev=NULL; - cur=model->next (cur,prev); + cur=model->nextBranch (cur,prev); while (cur) { if (cur->getType()==TreeItem::Branch || cur->getType()==TreeItem::MapCenter) @@ -195,7 +195,7 @@ } } } - cur=model->next(cur,prev); + cur=model->nextBranch(cur,prev); } file.close(); } @@ -229,7 +229,7 @@ BranchObj *bo; //FIXME-3 still needed? BranchItem *cur=NULL; BranchItem *prev=NULL; - cur=model->next (cur,prev); + cur=model->nextBranch (cur,prev); while (cur) { bo=(BranchObj*)(cur->getLMO()); @@ -252,7 +252,7 @@ ts << curIndent << "\"" << cur->getHeading()<<"\""<next(cur,prev); + cur=model->nextBranch(cur,prev); curIndent=""; } file.close(); @@ -388,7 +388,7 @@ BranchObj *bo; BranchItem *cur=NULL; BranchItem *prev=NULL; - model->next(cur,prev); + model->nextBranch(cur,prev); while (cur) { bo=(BranchObj*)(cur->getLMO()); @@ -420,7 +420,7 @@ ts << ("\n"); } } - cur=model->next(cur,prev); + cur=model->nextBranch(cur,prev); } file.close(); } @@ -443,7 +443,7 @@ BranchItem *bi=current->getFirstBranch(); if (bi) { - if (true) //if (!bo->hasHiddenExportParent() ) // FIXME-2 use BranchItem... + if (!bi->hasHiddenExportParent() ) // FIXME-3 use BranchItem... { // Start list r+="\n"; @@ -471,51 +471,73 @@ { QString allPages; -/* FIXME-2 not adapted to multiple mapCenters yet, see patch already done in 1.12.2... + BranchItem *firstMCO=(BranchItem*)(model->getRootItem()->getFirstBranch()); + if (!firstMCO) + { + QMessageBox::critical (0,QObject::tr("Critical Export Error"),QObject::tr("No objects in map!")); + return; + } + // Insert new content - content.replace ("",quotemeta(mapCenter->getHeading())); - content.replace ("",quotemeta(mapCenter->getAuthor())); + // FIXME add extra title in mapinfo for vym 1.13.x + content.replace ("",quotemeta(firstMCO->getHeading())); + content.replace ("",quotemeta(model->getAuthor())); QString onePage; QString list; - BranchObj *sectionBO=mapCenter->getFirstBranch(); + BranchItem *sectionBI; int i=0; - BranchObj *pagesBO; + BranchItem *pagesBI; int j=0; + int mapcenters=model->getRootItem()->branchCount(); + + // useSections already has been set in setConfigFile + if (mapcenters>1) + sectionBI=firstMCO; + else + sectionBI=firstMCO->getFirstBranch(); + // Walk sections - while (sectionBO && !sectionBO->hasHiddenExportParent() ) + while (sectionBI && !sectionBI->hasHiddenExportParent() ) { if (useSections) { // Add page with section title onePage=sectionTemplate; - onePage.replace ("", quotemeta(sectionBO->getHeading() ) ); + onePage.replace ("", quotemeta(sectionBI->getHeading() ) ); allPages+=onePage; + pagesBI=sectionBI->getFirstBranch(); } else { - i=-2; // only use inner loop to + //i=-2; // only use inner loop to // turn mainbranches into pages - sectionBO=mapCenter; + //sectionBI=firstMCO; + pagesBI=sectionBI; } - // Walk mainpages - pagesBO=sectionBO->getFirstBranch(); j=0; - while (pagesBO && !pagesBO->hasHiddenExportParent() ) + while (pagesBI && !pagesBI->hasHiddenExportParent() ) { // Add page with list of items onePage=pageTemplate; - onePage.replace ("", quotemeta (pagesBO->getHeading() ) ); - list=buildList (pagesBO->getTreeItem() ); + onePage.replace ("", quotemeta (pagesBI->getHeading() ) ); + list=buildList (pagesBI); onePage.replace ("", list); allPages+=onePage; - j++; - pagesBO=sectionBO->getBranchNum(j); + if (pagesBI!=sectionBI) + { + j++; + pagesBI=((BranchItem*)pagesBI->parent())->getBranchNum(j); + } else + pagesBI=NULL; // We are already iterating over the sectionBIs } i++; - sectionBO=mapCenter->getBranchNum(i); + if (mapcenters>1 ) + sectionBI=model->getRootItem()->getBranchNum (i); + else + sectionBI=firstMCO->getBranchNum (i); } content.replace ("",allPages); @@ -535,7 +557,6 @@ // zip tmpdir to destination zipDir (tmpDir,outputFile); -*/ } bool ExportOO::setConfigFile (const QString &cf)