# HG changeset patch # User insilmaril # Date 1142346424 0 # Node ID bdeb503d2b7f9ba8241855bfd16ba5c16acc1558 # Parent c15affaf86a8d4ed9ae940f49f0cfd55caf6fec1 hideLinkInExport for Branches (Floats still missing). Floats are now OrnamentedObj. diff -r c15affaf86a8 -r bdeb503d2b7f branchobj.cpp --- a/branchobj.cpp Wed Mar 08 12:59:08 2006 +0000 +++ b/branchobj.cpp Tue Mar 14 14:27:04 2006 +0000 @@ -104,9 +104,6 @@ includeImagesVer=false; includeImagesHor=false; - - url=""; - vymLink=""; } void BranchObj::copy (BranchObj* other) @@ -129,9 +126,6 @@ tmpUnscrolled=other->tmpUnscrolled; setVisibility (other->visible); - url=other->url; - vymLink=other->vymLink; - angle=other->angle; positionBBox(); @@ -400,21 +394,12 @@ LinkableMapObj::setLinkColor (); } -void BranchObj::setColor (QColor col, bool colorChilds) +void BranchObj::setColorChilds (QColor col) { - heading->setColor(col); - setLinkColor(); - if (colorChilds) - { - BranchObj *bo; - for (bo=branch.first(); bo; bo=branch.next() ) - bo->setColor(col,colorChilds); - } -} - -QColor BranchObj::getColor() -{ - return heading->getColor(); + OrnamentedObj::setColor (col); + BranchObj *bo; + for (bo=branch.first(); bo; bo=branch.next() ) + bo->setColorChilds(col); } BranchObj* BranchObj::first() @@ -711,58 +696,6 @@ requestReposition(); } -void BranchObj::setURL(QString s) -{ - url=s; - if (!url.isEmpty()) - systemFlags->activate("url"); - else - systemFlags->deactivate("url"); - calcBBoxSize(); // recalculate bbox - positionBBox(); // rearrange contents - forceReposition(); -} - -QString BranchObj::getURL() -{ - return url; -} - -void BranchObj::setVymLink(QString s) -{ - if (!s.isEmpty()) - { - // We need the relative (from loading) - // or absolute path (from User event) - // and build the absolute path. - // Note: If we have relative, use path of - // current map to build absolute path - QDir d(s); - if (!d.path().startsWith ("/")) - { - QString p=mapEditor->getDestPath(); - int i=p.findRev("/",-1); - d.setPath(p.left(i)+"/"+s); - d.convertToAbs(); - } - vymLink=d.path(); - systemFlags->activate("vymLink"); - } - else - { - systemFlags->deactivate("vymLink"); - vymLink=""; - } - calcBBoxSize(); // recalculate bbox - positionBBox(); // rearrange contents - forceReposition(); -} - -QString BranchObj::getVymLink() -{ - return vymLink; -} - QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset) { QString s,a; @@ -772,24 +705,6 @@ else scrolledAttr=""; - QString posAttr; - if (depth<2) posAttr= - attribut("absPosX",QString().setNum(absPos.x(),10)) + - attribut("absPosY",QString().setNum(absPos.y(),10)); - else - posAttr=""; - - QString linkAttr=getLinkAttr()+" "+getIncludeImageAttr(); - - - QString urlAttr; - if (!url.isEmpty()) - urlAttr=attribut ("url",url); - - QString vymLinkAttr; - if (!vymLink.isEmpty()) - vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) ); - QString frameAttr; if (frame->getFrameType()!=NoFrame) frameAttr=attribut ("frameType",frame->getFrameTypeName()); @@ -816,7 +731,13 @@ else idAttr=""; - s=beginElement ("branch" +scrolledAttr +posAttr +linkAttr +urlAttr +vymLinkAttr +frameAttr +areaAttr +idAttr); + s=beginElement ("branch" + +getOrnAttr() + +scrolledAttr + +frameAttr + +areaAttr + +idAttr + +getIncludeImageAttr() ); incIndent(); // save heading @@ -1019,7 +940,7 @@ heading->setFont(font ); if (mod==NewBranch) - setColor (((BranchObj*)(parObj))->getColor(),false); + setColor (((BranchObj*)(parObj))->getColor()); calcBBoxSize(); } diff -r c15affaf86a8 -r bdeb503d2b7f branchobj.h --- a/branchobj.h Wed Mar 08 12:59:08 2006 +0000 +++ b/branchobj.h Tue Mar 14 14:27:04 2006 +0000 @@ -44,9 +44,7 @@ virtual void setVisibility(bool,int); // set visibility virtual void setVisibility(bool); // set vis. for w virtual void setLinkColor(); // set the color of link - virtual void setColor(QColor,bool); // set the color of heading - virtual QColor getColor(); // get color of heading - + virtual void setColorChilds(QColor); // set the color of heading BranchObj* first (); // set Iterator to first LMO BranchObj* next (); // find next LMO after given one @@ -62,10 +60,6 @@ virtual void setDockPos(); virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*); // find MapObj virtual void setHeading (QString); - virtual void setURL (QString); - virtual QString getURL (); - virtual void setVymLink (QString); - virtual QString getVymLink (); virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir virtual void addXLink (XLinkObj*); virtual void removeXLinkRef (XLinkObj*);// Remove ref in list @@ -129,8 +123,6 @@ int lastSelectedBranch; // for going deeper into tree bool scrolled; // true if all childs are scrolled and thus invisible bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree - QString url; // url to external doc - QString vymLink; // path to another map bool includeImagesVer; // include floatimages in bbox vertically bool includeImagesHor; // include floatimages in bbox horizontally diff -r c15affaf86a8 -r bdeb503d2b7f exports.cpp --- a/exports.cpp Wed Mar 08 12:59:08 2006 +0000 +++ b/exports.cpp Tue Mar 14 14:27:04 2006 +0000 @@ -109,6 +109,8 @@ return r + " "; } + +//////////////////////////////////////////////////////////////////////// void ExportASCII::doExport() { QFile file (outputFile); @@ -129,35 +131,58 @@ bo=mapCenter->first(); while (bo) { - // Make indentstring - for (i=0;igetDepth();i++) actIndent+= indentPerDepth; + if (!bo->hideInExport()) + { + // Make indentstring + for (i=0;igetDepth();i++) actIndent+= indentPerDepth; - if (bo->getDepth()==0) - { - ts << (bo->getHeading()+ "\n"); - for (j=0;jgetHeading().length();j++) ts<<"="; - ts << "\n"; - } else if (bo->getDepth()==1) - ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n"); - else if (bo->getDepth()==2) - ts << (actIndent + " o " + bo->getHeading()+ "\n"); - else - ts << (actIndent + " - " + bo->getHeading()+ "\n"); - - // If necessary, write note - if (!bo->getNote().isEmpty()) - { - s =bo->getNoteASCII(); - s=s.replace ("\n","\n"+actIndent); - ts << (s+"\n\n"); + if (bo->getDepth()==0) + { + ts << (bo->getHeading()+ "\n"); + for (j=0;jgetHeading().length();j++) ts<<"="; + ts << "\n"; + } else if (bo->getDepth()==1) + ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n"); + else if (bo->getDepth()==2) + ts << (actIndent + " o " + bo->getHeading()+ "\n"); + else + ts << (actIndent + " - " + bo->getHeading()+ "\n"); + + // If necessary, write note + if (!bo->getNote().isEmpty()) + { + s =bo->getNoteASCII(); + s=s.replace ("\n","\n"+actIndent); + ts << (s+"\n\n"); + } } - bo=bo->next(); actIndent=""; } file.close(); } +//////////////////////////////////////////////////////////////////////// +void ExportKDEBookmarks::doExport() +{ + MapEditor *me=NULL; + if (mapCenter) me=mapCenter->getMapEditor(); + if (me) + { + me->exportXML(tmpDir.path()); + //FIXME testing + cout << "tmpDir="<getMapName()+".xml"); + p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml"); + p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl"); + p.process(); + } + +} + +//////////////////////////////////////////////////////////////////////// void ExportTaskjuggler::doExport() { MapEditor *me=NULL; @@ -177,6 +202,7 @@ } +//////////////////////////////////////////////////////////////////////// void ExportLaTeX::doExport() { // Exports a map to a LaTex file. @@ -200,38 +226,40 @@ BranchObj *bo; bo=mapCenter->first(); while (bo) { - if (bo->getDepth()==0); - else if (bo->getDepth()==1) { - ts << ("\\chapter{" + bo->getHeading()+ "}\n"); + if (!bo->hideInExport()) + { + 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 << (bo->getNoteASCII()); + ts << ("\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 << (bo->getNoteASCII()); - ts << ("\n"); - } - bo=bo->next(); } file.close(); } +//////////////////////////////////////////////////////////////////////// ExportOO::ExportOO() { useSections=false; - skipPageFlag="cross-red"; } ExportOO::~ExportOO() @@ -251,7 +279,7 @@ r+="\n"; while (bo) { - if (!bo->isActiveFlag (skipPageFlag)) + if (!bo->hideInExport()) { r+=""; r+=quotemeta(bo->getHeading()); @@ -309,7 +337,7 @@ while (pagesBO) { // Add page with list of items - if (!pagesBO->isActiveFlag (skipPageFlag)) + if (!pagesBO->hideInExport()) { onePage=pageTemplate; onePage.replace ("", quotemeta (pagesBO->getHeading() ) ); diff -r c15affaf86a8 -r bdeb503d2b7f exports.h --- a/exports.h Wed Mar 08 12:59:08 2006 +0000 +++ b/exports.h Tue Mar 14 14:27:04 2006 +0000 @@ -46,6 +46,13 @@ }; /////////////////////////////////////////////////////////////////////// +class ExportKDEBookmarks:public ExportXMLBase +{ +public: + virtual void doExport(); +}; + +/////////////////////////////////////////////////////////////////////// class ExportTaskjuggler:public ExportXMLBase { public: @@ -69,7 +76,6 @@ bool setConfigFile (const QString &); private: QString buildList (BranchObj*); - QString skipPageFlag; bool useSections; QString configFile; QString configDir; diff -r c15affaf86a8 -r bdeb503d2b7f exportxhtmldialog.ui.h --- a/exportxhtmldialog.ui.h Wed Mar 08 12:59:08 2006 +0000 +++ b/exportxhtmldialog.ui.h Tue Mar 14 14:27:04 2006 +0000 @@ -9,6 +9,8 @@ extern Settings settings; +extern QDir vymBaseDir; +extern Options options; void ExportXHTMLDialog::init() { @@ -23,7 +25,6 @@ dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir","./" ); lineEditDir->setText(dir); - if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes") useImage=true; else @@ -62,12 +63,19 @@ showOutput=false; outputButton->setChecked(showOutput); - xsl=settings.readLocalEntry - (filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl"); + // For testing better use local styles + if (options.isOn ("local")) + { + xsl=vymBaseDir.path()+"/styles/vym2xhtml.xsl"; + css=vymBaseDir.path()+"/styles/vym.css"; + } else + { + xsl=settings.readLocalEntry + (filepath,"/vym/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl"); + css=settings.readLocalEntry + (filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css"); + } lineEditXSL->setText(xsl); - - css=settings.readLocalEntry - (filepath,"/vym/export/xhtml/css","/usr/share/vym/styles/vym.css"); lineEditCSS->setText(css); prescript=settings.readLocalEntry @@ -241,7 +249,6 @@ // (but don't save at destructor, which // is called for "cancel", too) settings.setLocalEntry (filepath,"/vym/export/xhtml/exportDir",dir); - settings.setLocalEntry (filepath,"/vym/export/xhtml/prescript",prescript); settings.setLocalEntry (filepath,"/vym/export/xhtml/postscript",postscript); @@ -264,15 +271,22 @@ settings.writeEntry ("/vym/export/xhtml/showOutput","yes"); else settings.writeEntry ("/vym/export/xhtml/showOutput","no"); - - settings.setLocalEntry - (filepath,"/vym/export/xhtml/xsl",xsl); - settings.setLocalEntry - (filepath,"/vym/export/xhtml/css",css); + + QString ipath; + if (options.isOn ("local")) + { + ipath=vymBaseDir.path()+"/icons/flag-url-16x16.png"; + } else + { + ipath=vymBaseDir.path()+"/images/flag-url-16x16.png"; + settings.setLocalEntry + (filepath,"/vym/export/xhtml/xsl",xsl); + settings.setLocalEntry + (filepath,"/vym/export/xhtml/css",css); + } // Provide a smaller URL-icon to improve Layout QPixmap pm; - QString ipath="/usr/share/vym/images/flag-url-16x16.png"; if (!pm.load(ipath,"PNG") ) QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath)); diff -r c15affaf86a8 -r bdeb503d2b7f mapcenterobj.cpp --- a/mapcenterobj.cpp Wed Mar 08 12:59:08 2006 +0000 +++ b/mapcenterobj.cpp Tue Mar 14 14:27:04 2006 +0000 @@ -126,24 +126,12 @@ QString linkAttr=getLinkAttr(); - QString urlAttr; - if (!url.isEmpty()) - urlAttr=attribut ("url",url); - QString vymLinkAttr; - if (!vymLink.isEmpty()) - vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) ); - s=beginElement ("mapcenter" - +attribut("absPosX",QString().setNum(absPos.x(),10)) - +attribut("absPosY",QString().setNum(absPos.y(),10)) - +vymLinkAttr - +urlAttr - +linkAttr - +idAttr + +getOrnAttr() +attribut("frameType",frame->getFrameTypeName()) +areaAttr - ); - + +idAttr + +getIncludeImageAttr() ); incIndent(); if (heading->getColor()!=QColor("black")) a=attribut ("textColor",QColor(heading->getColor()).name() ); diff -r c15affaf86a8 -r bdeb503d2b7f xml.cpp --- a/xml.cpp Wed Mar 08 12:59:08 2006 +0000 +++ b/xml.cpp Tue Mar 14 14:27:04 2006 +0000 @@ -160,7 +160,7 @@ if (!atts.value( "textColor").isEmpty() ) { col.setNamedColor(atts.value("textColor")); - lastBranch->setColor(col ,false ); + lastBranch->setColor(col ); } } else if ( eName == "note" && state == StateMapCenter) { // only for backward compatibility (<1.4.6). Use htmlnote now. @@ -229,7 +229,7 @@ if (!atts.value( "textColor").isEmpty() ) { col.setNamedColor(atts.value("textColor")); - lastBranch->setColor(col ,false ); + lastBranch->setColor(col ); } } else if ( eName == "note" && state == StateBranch) { @@ -383,22 +383,26 @@ bool mapBuilderHandler::fatalError( const QXmlParseException& exception ) { - errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n") + errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n") .arg( exception.message() ) .arg( exception.lineNumber() ) .arg( exception.columnNumber() ); - /* FIXME Testing only - errorProt += exception.publicId ()+"\n"; - errorProt += exception.systemId()+"\n"; - // Try to read the bogus line - int i=0; QString s; - if (loadStringFromDisk (,s)) + if (loadStringFromDisk (inputFile,s)) { - errorProt += - } -*/ + QStringList sl=QStringList::split ("\n",s); + int i=1; + QStringList::Iterator it = sl.begin(); + while (i"); + errorProt+=s; + } return QXmlDefaultHandler::fatalError( exception ); } @@ -413,6 +417,11 @@ tmpDir=tp; } +void mapBuilderHandler::setInputFile (QString f) +{ + inputFile=f; +} + void mapBuilderHandler::setLoadMode (const LoadMode &lm) { loadMode=lm; @@ -450,12 +459,16 @@ return false; // Couldn't read relPos } } - if (!a.value( "scrolled").isEmpty() ) - lastBranch->toggleScroll(); if (!a.value( "url").isEmpty() ) lastBranch->setURL (a.value ("url")); if (!a.value( "vymLink").isEmpty() ) lastBranch->setVymLink (a.value ("vymLink")); + if (!a.value( "hideInExport").isEmpty() ) + if (a.value("hideInExport")=="true") + lastBranch->setHideInExport(true); + + if (!a.value( "scrolled").isEmpty() ) + lastBranch->toggleScroll(); if (!a.value( "frameType").isEmpty() ) lastBranch->setFrameType (a.value("frameType")); diff -r c15affaf86a8 -r bdeb503d2b7f xml.h --- a/xml.h Wed Mar 08 12:59:08 2006 +0000 +++ b/xml.h Tue Mar 14 14:27:04 2006 +0000 @@ -26,6 +26,7 @@ bool fatalError( const QXmlParseException&); void setMapEditor (MapEditor*); void setTmpDir (QString); + void setInputFile (QString); void setLoadMode (const LoadMode &); bool readBranchAttr (const QXmlAttributes&); bool readLinkAttr (const QXmlAttributes&); @@ -61,6 +62,8 @@ int branchDepth; NoteObj no; MapCenterObj* mc; - MapEditor* me; QString tmpDir; + MapEditor* me; + QString tmpDir; + QString inputFile; }; #endif