Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scribus134format_save.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "scribus134format.h"
00008 #include "scribus134formatimpl.h"
00009 
00010 #include "../../formatidlist.h"
00011 #include "commonstrings.h"
00012 #include "missing.h"
00013 #include "prefsmanager.h"
00014 #include "scconfig.h"
00015 #include "scribusdoc.h"
00016 #include "scribusview.h"
00017 
00018 #include "units.h"
00019 #include "util.h"
00020 #include "colorutil.h"
00021 #include "scgzfile.h"
00022 #include <qcursor.h>
00023 #include <qfileinfo.h>
00024 #include <qvaluelist.h>
00025 
00026 
00027 bool Scribus134Format::saveFile(const QString & fileName, const FileFormat & /* fmt */)
00028 {
00029        QString text, tf, tf2, tc, tc2;
00030        QDomDocument docu("scribus");
00031        QString st="<SCRIBUSUTF8NEW></SCRIBUSUTF8NEW>";
00032        docu.setContent(st);
00033        QDomElement elem=docu.documentElement();
00034        elem.setAttribute("Version", QString(VERSION));
00035        QDomElement dc=docu.createElement("DOCUMENT");
00036        dc.setAttribute("ANZPAGES",m_Doc->DocPages.count());
00037        dc.setAttribute("PAGEWIDTH",m_Doc->pageWidth);
00038        dc.setAttribute("PAGEHEIGHT",m_Doc->pageHeight);
00039        dc.setAttribute("BORDERLEFT",m_Doc->pageMargins.Left);
00040        dc.setAttribute("BORDERRIGHT",m_Doc->pageMargins.Right);
00041        dc.setAttribute("BORDERTOP",m_Doc->pageMargins.Top);
00042        dc.setAttribute("BORDERBOTTOM",m_Doc->pageMargins.Bottom);
00043        dc.setAttribute("BleedTop", m_Doc->bleeds.Top);
00044        dc.setAttribute("BleedLeft", m_Doc->bleeds.Left);
00045        dc.setAttribute("BleedRight", m_Doc->bleeds.Right);
00046        dc.setAttribute("BleedBottom", m_Doc->bleeds.Bottom);
00047        dc.setAttribute("ORIENTATION",m_Doc->PageOri);
00048        dc.setAttribute("PAGESIZE",m_Doc->m_pageSize);
00049        dc.setAttribute("FIRSTNUM",m_Doc->FirstPnum);
00050        dc.setAttribute("BOOK", m_Doc->currentPageLayout);
00051        if(m_Doc->usesAutomaticTextFrames())
00052               dc.setAttribute("AUTOTEXT",1);
00053        dc.setAttribute("AUTOSPALTEN",m_Doc->PageSp);
00054        dc.setAttribute("ABSTSPALTEN",m_Doc->PageSpa);
00055        dc.setAttribute("UNITS",m_Doc->unitIndex());
00056        dc.setAttribute("DFONT",m_Doc->toolSettings.defFont);
00057        dc.setAttribute("DSIZE",m_Doc->toolSettings.defSize / 10.0);
00058        dc.setAttribute("DCOL",m_Doc->toolSettings.dCols);
00059        dc.setAttribute("DGAP",m_Doc->toolSettings.dGap);
00060        dc.setAttribute("TabFill",m_Doc->toolSettings.tabFillChar);
00061        dc.setAttribute("TabWidth",m_Doc->toolSettings.dTabWidth);
00062        dc.setAttribute("AUTHOR",m_Doc->documentInfo.getAuthor());
00063        dc.setAttribute("COMMENTS",m_Doc->documentInfo.getComments());
00064        dc.setAttribute("KEYWORDS",m_Doc->documentInfo.getKeywords());
00065        dc.setAttribute("PUBLISHER",m_Doc->documentInfo.getPublisher());
00066        dc.setAttribute("DOCDATE",m_Doc->documentInfo.getDate());
00067        dc.setAttribute("DOCTYPE",m_Doc->documentInfo.getType());
00068        dc.setAttribute("DOCFORMAT",m_Doc->documentInfo.getFormat());
00069        dc.setAttribute("DOCIDENT",m_Doc->documentInfo.getIdent());
00070        dc.setAttribute("DOCSOURCE",m_Doc->documentInfo.getSource());
00071        dc.setAttribute("DOCLANGINFO",m_Doc->documentInfo.getLangInfo());
00072        dc.setAttribute("DOCRELATION",m_Doc->documentInfo.getRelation());
00073        dc.setAttribute("DOCCOVER",m_Doc->documentInfo.getCover());
00074        dc.setAttribute("DOCRIGHTS",m_Doc->documentInfo.getRights());
00075        dc.setAttribute("DOCCONTRIB",m_Doc->documentInfo.getContrib());
00076        dc.setAttribute("TITLE",m_Doc->documentInfo.getTitle());
00077        dc.setAttribute("VHOCH",m_Doc->typographicSettings.valueSuperScript);
00078        dc.setAttribute("VHOCHSC",m_Doc->typographicSettings.scalingSuperScript);
00079        dc.setAttribute("VTIEF",m_Doc->typographicSettings.valueSubScript);
00080        dc.setAttribute("VTIEFSC",m_Doc->typographicSettings.scalingSubScript);
00081        dc.setAttribute("VKAPIT",m_Doc->typographicSettings.valueSmallCaps);
00082        dc.setAttribute("BASEGRID",m_Doc->typographicSettings.valueBaseGrid);
00083        dc.setAttribute("BASEO", m_Doc->typographicSettings.offsetBaseGrid);
00084        dc.setAttribute("AUTOL", m_Doc->typographicSettings.autoLineSpacing);
00085        dc.setAttribute("UnderlinePos", m_Doc->typographicSettings.valueUnderlinePos);
00086        dc.setAttribute("UnderlineWidth", m_Doc->typographicSettings.valueUnderlineWidth);
00087        dc.setAttribute("StrikeThruPos", m_Doc->typographicSettings.valueStrikeThruPos);
00088        dc.setAttribute("StrikeThruWidth", m_Doc->typographicSettings.valueStrikeThruWidth);
00089        dc.setAttribute("GROUPC",m_Doc->GroupCounter);
00090        dc.setAttribute("HCMS", static_cast<int>(m_Doc->HasCMS));
00091        dc.setAttribute("DPSo", static_cast<int>(m_Doc->CMSSettings.SoftProofOn));
00092        dc.setAttribute("DPSFo", static_cast<int>(m_Doc->CMSSettings.SoftProofFullOn));
00093        dc.setAttribute("DPuse", static_cast<int>(m_Doc->CMSSettings.CMSinUse));
00094        dc.setAttribute("DPgam", static_cast<int>(m_Doc->CMSSettings.GamutCheck));
00095        dc.setAttribute("DPbla", static_cast<int>(m_Doc->CMSSettings.BlackPoint));
00096        dc.setAttribute("DPMo",m_Doc->CMSSettings.DefaultMonitorProfile);
00097        dc.setAttribute("DPPr",m_Doc->CMSSettings.DefaultPrinterProfile);
00098        dc.setAttribute("DPIn",m_Doc->CMSSettings.DefaultImageRGBProfile);
00099        dc.setAttribute("DPInCMYK",m_Doc->CMSSettings.DefaultImageCMYKProfile);
00100        dc.setAttribute("DPIn2",m_Doc->CMSSettings.DefaultSolidColorRGBProfile);
00101        dc.setAttribute("DPIn3",m_Doc->CMSSettings.DefaultSolidColorCMYKProfile);
00102        dc.setAttribute("DISc",m_Doc->CMSSettings.DefaultIntentColors);
00103        dc.setAttribute("DIIm",m_Doc->CMSSettings.DefaultIntentImages);
00104        dc.setAttribute("ALAYER", m_Doc->activeLayer());
00105        dc.setAttribute("LANGUAGE", m_Doc->Language);
00106        dc.setAttribute("MINWORDLEN", m_Doc->MinWordLen);
00107        dc.setAttribute("HYCOUNT", m_Doc->HyCount);
00108        dc.setAttribute("AUTOMATIC", static_cast<int>(m_Doc->Automatic));
00109        dc.setAttribute("AUTOCHECK", static_cast<int>(m_Doc->AutoCheck));
00110        dc.setAttribute("GUIDELOCK", static_cast<int>(m_Doc->GuideLock));
00111        dc.setAttribute("SnapToGuides", static_cast<int>(m_Doc->SnapGuides));
00112        dc.setAttribute("SnapToGrid", static_cast<int>(m_Doc->useRaster));
00113        dc.setAttribute("MINGRID", m_Doc->guidesSettings.minorGrid);
00114        dc.setAttribute("MAJGRID", m_Doc->guidesSettings.majorGrid);
00115        dc.setAttribute("SHOWGRID", static_cast<int>(m_Doc->guidesSettings.gridShown));
00116        dc.setAttribute("SHOWGUIDES", static_cast<int>(m_Doc->guidesSettings.guidesShown));
00117        dc.setAttribute("showcolborders", static_cast<int>(m_Doc->guidesSettings.colBordersShown));
00118        dc.setAttribute("SHOWFRAME", static_cast<int>(m_Doc->guidesSettings.framesShown));
00119        dc.setAttribute("SHOWLAYERM", static_cast<int>(m_Doc->guidesSettings.layerMarkersShown));
00120        dc.setAttribute("SHOWMARGIN", static_cast<int>(m_Doc->guidesSettings.marginsShown));
00121        dc.setAttribute("SHOWBASE", static_cast<int>(m_Doc->guidesSettings.baseShown));
00122        dc.setAttribute("SHOWPICT", static_cast<int>(m_Doc->guidesSettings.showPic));
00123        dc.setAttribute("SHOWControl", static_cast<int>(m_Doc->guidesSettings.showControls));
00124        dc.setAttribute("SHOWLINK", static_cast<int>(m_Doc->guidesSettings.linkShown));
00125        dc.setAttribute("rulerMode", static_cast<int>(m_Doc->guidesSettings.rulerMode));
00126        dc.setAttribute("showrulers", static_cast<int>(m_Doc->guidesSettings.rulersShown));
00127        dc.setAttribute("showBleed", static_cast<int>(m_Doc->guidesSettings.showBleed));
00128        dc.setAttribute("rulerXoffset", m_Doc->rulerXoffset);
00129        dc.setAttribute("rulerYoffset", m_Doc->rulerYoffset);
00130        dc.setAttribute("GuideRad", m_Doc->guidesSettings.guideRad);
00131        dc.setAttribute("GRAB",m_Doc->guidesSettings.grabRad);
00132        dc.setAttribute("POLYC", m_Doc->toolSettings.polyC);
00133        dc.setAttribute("POLYF", m_Doc->toolSettings.polyF);
00134        dc.setAttribute("POLYR", m_Doc->toolSettings.polyR);
00135        dc.setAttribute("POLYFD", m_Doc->toolSettings.polyFd);
00136        dc.setAttribute("POLYS", static_cast<int>(m_Doc->toolSettings.polyS));
00137        dc.setAttribute("AutoSave", static_cast<int>(m_Doc->AutoSave));
00138        dc.setAttribute("AutoSaveTime", m_Doc->AutoSaveTime);
00139        dc.setAttribute("ScratchBottom", m_Doc->scratch.Bottom);
00140        dc.setAttribute("ScratchLeft", m_Doc->scratch.Left);
00141        dc.setAttribute("ScratchRight", m_Doc->scratch.Right);
00142        dc.setAttribute("ScratchTop", m_Doc->scratch.Top);
00143        dc.setAttribute("StartArrow", m_Doc->toolSettings.dStartArrow);
00144        dc.setAttribute("EndArrow", m_Doc->toolSettings.dEndArrow);
00145        dc.setAttribute("PEN",m_Doc->toolSettings.dPen);
00146        dc.setAttribute("BRUSH",m_Doc->toolSettings.dBrush);
00147        dc.setAttribute("PENLINE",m_Doc->toolSettings.dPenLine);
00148        dc.setAttribute("PENTEXT",m_Doc->toolSettings.dPenText);
00149        dc.setAttribute("StrokeText",m_Doc->toolSettings.dStrokeText);
00150        dc.setAttribute("TextBackGround", m_Doc->toolSettings.dTextBackGround);
00151        dc.setAttribute("TextLineColor", m_Doc->toolSettings.dTextLineColor);
00152        dc.setAttribute("TextBackGroundShade", m_Doc->toolSettings.dTextBackGroundShade);
00153        dc.setAttribute("TextLineShade", m_Doc->toolSettings.dTextLineShade);
00154        dc.setAttribute("TextPenShade", m_Doc->toolSettings.dTextPenShade);
00155        dc.setAttribute("TextStrokeShade", m_Doc->toolSettings.dTextStrokeShade);
00156        dc.setAttribute("STIL",m_Doc->toolSettings.dLineArt);
00157        dc.setAttribute("STILLINE",m_Doc->toolSettings.dLstyleLine);
00158        dc.setAttribute("WIDTH",m_Doc->toolSettings.dWidth);
00159        dc.setAttribute("WIDTHLINE",m_Doc->toolSettings.dWidthLine);
00160        dc.setAttribute("PENSHADE",m_Doc->toolSettings.dShade2);
00161        dc.setAttribute("LINESHADE",m_Doc->toolSettings.dShadeLine);
00162        dc.setAttribute("BRUSHSHADE",m_Doc->toolSettings.dShade);
00163        dc.setAttribute("MAGMIN",m_Doc->toolSettings.magMin);
00164        dc.setAttribute("MAGMAX",m_Doc->toolSettings.magMax);
00165        dc.setAttribute("MAGSTEP",m_Doc->toolSettings.magStep);
00166        dc.setAttribute("CPICT",m_Doc->toolSettings.dBrushPict);
00167        dc.setAttribute("PICTSHADE",m_Doc->toolSettings.shadePict);
00168        dc.setAttribute("PICTSCX",m_Doc->toolSettings.scaleX);
00169        dc.setAttribute("PICTSCY",m_Doc->toolSettings.scaleY);
00170        dc.setAttribute("PSCALE", static_cast<int>(m_Doc->toolSettings.scaleType));
00171        dc.setAttribute("PASPECT", static_cast<int>(m_Doc->toolSettings.aspectRatio));
00172        dc.setAttribute("EmbeddedPath", static_cast<int>(m_Doc->toolSettings.useEmbeddedPath));
00173        dc.setAttribute("HalfRes", m_Doc->toolSettings.lowResType);
00174        dc.setAttribute("dispX", m_Doc->toolSettings.dispX);
00175        dc.setAttribute("dispY", m_Doc->toolSettings.dispY);
00176        dc.setAttribute("constrain", m_Doc->toolSettings.constrain);
00177        dc.setAttribute("MINORC",m_Doc->guidesSettings.minorColor.name());
00178        dc.setAttribute("MAJORC",m_Doc->guidesSettings.majorColor.name());
00179        dc.setAttribute("GuideC", m_Doc->guidesSettings.guideColor.name());
00180        dc.setAttribute("BaseC", m_Doc->guidesSettings.baseColor.name());
00181        dc.setAttribute("GuideZ", m_Doc->guidesSettings.guideRad);
00182        dc.setAttribute("BACKG", static_cast<int>(m_Doc->guidesSettings.before));
00183        dc.setAttribute("PAGEC",m_Doc->papColor.name());
00184        dc.setAttribute("MARGC",m_Doc->guidesSettings.margColor.name());
00185        dc.setAttribute("RANDF", static_cast<int>(m_Doc->marginColored));
00186        dc.setAttribute("currentProfile", m_Doc->curCheckProfile);
00187        elem.appendChild(dc);
00188        writeCheckerProfiles(docu);
00189        writeLinestyles(docu);
00190        writeJavascripts(docu);
00191        writeBookmarks(docu);
00192        writeColors(docu);
00193        writePStyles(docu);
00194        writeCStyles(docu);
00195        writeLayers(docu);
00196        writePrintOptions(docu);
00197        writePdfOptions(docu);
00198        writeDocItemAttributes(docu);
00199        writeTOC(docu);
00200        writePageSets(docu);
00201        writeSections(docu);
00202        writePatterns(docu);
00203        writeContent(docu);
00204        
00211        static const char* xmlpi = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
00212        QCString cs = docu.toCString(); // UTF-8 QCString
00213        if(fileName.right(2) == "gz")
00214        {
00215               // zipped saving
00216               // XXX: latin1() should probably be local8Bit()
00217               ScGzFile gzf(fileName, cs);
00218               if (!gzf.write(xmlpi))
00219                      return false;
00220        }
00221        else
00222        {
00223               QFile f(fileName);
00224               if(!f.open(IO_WriteOnly))
00225                      return false;
00226               QTextStream s(&f);
00227               s.writeRawBytes(xmlpi, strlen(xmlpi));
00228               s.writeRawBytes(cs, cs.length());
00229               f.close();
00230        }
00231        return true;
00232 }
00233 
00234 void Scribus134Format::writeCheckerProfiles(QDomDocument & docu) 
00235 {
00236        QDomElement dc=docu.documentElement().firstChild().toElement();
00237 
00238        CheckerPrefsList::Iterator itcp;
00239        CheckerPrefsList::Iterator itcpend=m_Doc->checkerProfiles.end();
00240        for (itcp = m_Doc->checkerProfiles.begin(); itcp != itcpend; ++itcp)
00241        {
00242               QDomElement dc79a=docu.createElement("CheckProfile");
00243               dc79a.setAttribute("Name",itcp.key());
00244               dc79a.setAttribute("ignoreErrors", static_cast<int>(itcp.data().ignoreErrors));
00245               dc79a.setAttribute("autoCheck", static_cast<int>(itcp.data().autoCheck));
00246               dc79a.setAttribute("checkGlyphs", static_cast<int>(itcp.data().checkGlyphs));
00247               dc79a.setAttribute("checkOrphans", static_cast<int>(itcp.data().checkOrphans));
00248               dc79a.setAttribute("checkOverflow", static_cast<int>(itcp.data().checkOverflow));
00249               dc79a.setAttribute("checkPictures", static_cast<int>(itcp.data().checkPictures));
00250               dc79a.setAttribute("checkResolution", static_cast<int>(itcp.data().checkResolution));
00251               dc79a.setAttribute("checkTransparency", static_cast<int>(itcp.data().checkTransparency));
00252               dc79a.setAttribute("minResolution",itcp.data().minResolution);
00253               dc79a.setAttribute("maxResolution",itcp.data().maxResolution);
00254               dc79a.setAttribute("checkAnnotations", static_cast<int>(itcp.data().checkAnnotations));
00255               dc79a.setAttribute("checkRasterPDF", static_cast<int>(itcp.data().checkRasterPDF));
00256               dc79a.setAttribute("checkForGIF", static_cast<int>(itcp.data().checkForGIF));
00257               dc79a.setAttribute("ignoreOffLayers", static_cast<int>(itcp.data().ignoreOffLayers));             
00258               dc.appendChild(dc79a);
00259        }
00260 }
00261 
00262 void Scribus134Format::writeLinestyles(QDomDocument & docu) 
00263 {
00264        QDomElement dc=docu.documentElement().firstChild().toElement();
00265 
00266        QMap<QString,multiLine>::Iterator itMU;
00267        for (itMU = m_Doc->MLineStyles.begin(); itMU != m_Doc->MLineStyles.end(); ++itMU)
00268        {
00269               QDomElement MuL=docu.createElement("MultiLine");
00270               MuL.setAttribute("Name",itMU.key());
00271               multiLine ml = itMU.data();
00272               multiLine::iterator itMU2;
00273               for (itMU2 = ml.begin(); itMU2 != ml.end(); ++itMU2)
00274               {
00275                      QDomElement SuL=docu.createElement("SubLine");
00276                      SuL.setAttribute("Color", (*itMU2).Color);
00277                      SuL.setAttribute("Shade", (*itMU2).Shade);
00278                      SuL.setAttribute("Dash", (*itMU2).Dash);
00279                      SuL.setAttribute("LineEnd", (*itMU2).LineEnd);
00280                      SuL.setAttribute("LineJoin", (*itMU2).LineJoin);
00281                      SuL.setAttribute("Width", (*itMU2).Width);
00282                      SuL.setAttribute("Shortcut", ml.shortcut);
00283                      MuL.appendChild(SuL);
00284               }
00285               dc.appendChild(MuL);
00286        }
00287        QValueList<ArrowDesc>::Iterator itar;
00288        for (itar = m_Doc->arrowStyles.begin(); itar != m_Doc->arrowStyles.end(); ++itar)
00289        {
00290               if ((*itar).userArrow)
00291               {
00292                      QDomElement ar=docu.createElement("Arrows");
00293                      ar.setAttribute("NumPoints", (*itar).points.size());
00294                      QString arp = "";
00295                      QString tmp, tmpy;
00296                      double xa, ya;
00297                      for (uint nxx = 0; nxx < (*itar).points.size(); ++nxx)
00298                      {
00299                             (*itar).points.point(nxx, &xa, &ya);
00300                             arp += tmp.setNum(xa) + " " + tmpy.setNum(ya) + " ";
00301                      }
00302                      ar.setAttribute("Points", arp);
00303                      ar.setAttribute("Name", (*itar).name);
00304                      dc.appendChild(ar);
00305               }
00306        }
00307 }
00308 
00309 
00310 void Scribus134Format::writeJavascripts(QDomDocument & docu) 
00311 {
00312        QDomElement dc=docu.documentElement().firstChild().toElement();
00313 
00314        QMap<QString,QString>::Iterator itja;
00315        for (itja = m_Doc->JavaScripts.begin(); itja != m_Doc->JavaScripts.end(); ++itja)
00316        {
00317               QDomElement jav=docu.createElement("JAVA");
00318               jav.setAttribute("NAME",itja.key());
00319               jav.setAttribute("SCRIPT",itja.data());
00320               dc.appendChild(jav);
00321        }
00322        
00323 }
00324 
00325 
00326 void Scribus134Format::writeBookmarks(QDomDocument & docu) 
00327 {      
00328        QDomElement dc=docu.documentElement().firstChild().toElement();
00329 
00330        QValueList<ScribusDoc::BookMa>::Iterator itbm;
00331        for (itbm = m_Doc->BookMarks.begin(); itbm != m_Doc->BookMarks.end(); ++itbm)
00332        {
00333               QDomElement fn=docu.createElement("Bookmark");
00334               fn.setAttribute("Title",(*itbm).Title);
00335               fn.setAttribute("Text",(*itbm).Text);
00336               fn.setAttribute("Aktion",(*itbm).Aktion);
00337               fn.setAttribute("ItemNr", (*itbm).ItemNr);
00338               fn.setAttribute("Element", (*itbm).PageObject->ItemNr);
00339               fn.setAttribute("First", (*itbm).First);
00340               fn.setAttribute("Last", (*itbm).Last);
00341               fn.setAttribute("Prev", (*itbm).Prev);
00342               fn.setAttribute("Next", (*itbm).Next);
00343               fn.setAttribute("Parent", (*itbm).Parent);
00344               dc.appendChild(fn);
00345        }
00346 }
00347 
00348 
00349 void Scribus134Format::writeColors(QDomDocument & docu) 
00350 {      
00351        QDomElement dc=docu.documentElement().firstChild().toElement();
00352 
00353        ColorList::Iterator itc;
00354        for (itc = m_Doc->PageColors.begin(); itc != m_Doc->PageColors.end(); ++itc)
00355        {
00356               QDomElement co=docu.createElement("COLOR");
00357               co.setAttribute("NAME",itc.key());
00358               if (m_Doc->PageColors[itc.key()].getColorModel() == colorModelRGB)
00359                      co.setAttribute("RGB",m_Doc->PageColors[itc.key()].nameRGB());
00360               else
00361                      co.setAttribute("CMYK",m_Doc->PageColors[itc.key()].nameCMYK());
00362               co.setAttribute("Spot",static_cast<int>(m_Doc->PageColors[itc.key()].isSpotColor()));
00363               co.setAttribute("Register",static_cast<int>(m_Doc->PageColors[itc.key()].isRegistrationColor()));
00364               dc.appendChild(co);
00365        }
00366        
00367 }
00368 
00369 void Scribus134Format::writePStyles(QDomDocument & docu) 
00370 {
00371        QDomElement dc=docu.documentElement().firstChild().toElement();
00372 
00373        //     if (m_Doc->docParagraphStyles.count() > 5)
00374        {
00375               for (uint ff = 0; ff < m_Doc->paragraphStyles().count(); ++ff)
00376               {
00377                      QDomElement fo=docu.createElement("STYLE");
00378                      putPStyle(docu, fo, m_Doc->paragraphStyles()[ff]);
00379                      dc.appendChild(fo);
00380               }
00381        }
00382 }
00383 
00384 void Scribus134Format::putPStyle(QDomDocument & docu, QDomElement & fo, const ParagraphStyle & style)
00385 {
00386        fo.setAttribute("NAME", style.name());
00387        if ( ! style.parent().isEmpty())
00388               fo.setAttribute("PARENT", style.parent());
00389        
00390        if ( ! style.isInhAlignment())
00391               fo.setAttribute("ALIGN", style.alignment());
00392        if ( ! style.isInhLineSpacingMode())
00393               fo.setAttribute("LINESPMode", style.lineSpacingMode());
00394        if ( ! style.isInhLineSpacing())
00395               fo.setAttribute("LINESP", style.lineSpacing());
00396        if ( ! style.isInhLeftMargin())
00397               fo.setAttribute("INDENT", style.leftMargin());
00398        if ( ! style.isInhRightMargin())
00399               fo.setAttribute("RMARGIN", style.rightMargin());
00400        if ( ! style.isInhFirstIndent())
00401               fo.setAttribute("FIRST", style.firstIndent());
00402        if ( ! style.isInhGapBefore())
00403               fo.setAttribute("VOR", style.gapBefore());
00404        if ( ! style.isInhGapAfter())
00405               fo.setAttribute("NACH", style.gapAfter());
00406        if ( ! style.isInhHasDropCap())
00407               fo.setAttribute("DROP", static_cast<int>(style.hasDropCap()));
00408        if ( ! style.isInhDropCapLines())
00409               fo.setAttribute("DROPLIN", style.dropCapLines());
00410        if ( ! style.isInhDropCapOffset())
00411               fo.setAttribute("DROPDIST", style.dropCapOffset());
00412        if ( ! style.isInhOpticalMargins())
00413               fo.setAttribute("OpticalMargins", style.opticalMargins());
00414        if ( ! style.isInhHyphenationMode())
00415               fo.setAttribute("HyphenationMode", style.hyphenationMode());
00416        if ( ! style.isInhMinWordTracking())
00417               fo.setAttribute("MinWordTrack", style.minWordTracking());
00418        if ( ! style.isInhMinGlyphExtension())
00419               fo.setAttribute("MinGlyphShrink", style.minGlyphExtension());
00420        if ( ! style.isInhMaxGlyphExtension())
00421               fo.setAttribute("MaxGlyphExtend", style.maxGlyphExtension());
00422 
00423        if ( ! style.isInhTabValues())
00424        {
00425               for (uint a = 0; a < style.tabValues().count(); ++a)
00426               {
00427                      QDomElement tabs = docu.createElement("Tabs");
00428                      tabs.setAttribute("Type", (*style.tabValues().at(a)).tabType);
00429                      tabs.setAttribute("Pos", (*style.tabValues().at(a)).tabPosition);
00430                      QString tabCh = "";
00431                      if (!(*style.tabValues().at(a)).tabFillChar.isNull())
00432                             tabCh = QString((*style.tabValues().at(a)).tabFillChar);
00433                      tabs.setAttribute("Fill", tabCh);
00434                      fo.appendChild(tabs);
00435               }
00436        }
00437        fo.setAttribute("PSHORTCUT", style.shortcut()); // shortcuts won't be inherited
00438        
00439        putCStyle(docu, fo, style.charStyle());
00440 
00441 }
00442 
00443 
00444 void Scribus134Format::writeCStyles(QDomDocument & docu) 
00445 {
00446        QDomElement dc=docu.documentElement().firstChild().toElement();
00447        
00448        for (uint ff = 0; ff < m_Doc->charStyles().count(); ++ff)
00449        {
00450               QDomElement fo=docu.createElement("CHARSTYLE");
00451               putCStyle(docu, fo, m_Doc->charStyles()[ff]);
00452               dc.appendChild(fo);
00453        }
00454 }
00455 
00456 void Scribus134Format::putCStyle(QDomDocument & docu, QDomElement & fo, const CharStyle & style)
00457 {
00458        fo.setAttribute("CNAME", style.name());
00459        if ( ! style.parent().isEmpty() )
00460               fo.setAttribute("CPARENT", style.parent());
00461        if ( ! style.isInhFont())   
00462               fo.setAttribute("FONT", style.font().scName());
00463        if ( ! style.isInhFontSize())
00464               fo.setAttribute("FONTSIZE", style.fontSize() / 10.0);
00465        if ( ! style.isInhFeatures())
00466               fo.setAttribute("FEATURES", style.features().join(" "));
00467        if ( ! style.isInhFillColor())
00468               fo.setAttribute("FCOLOR", style.fillColor());
00469        if ( ! style.isInhFillShade())
00470               fo.setAttribute("FSHADE", style.fillShade());
00471        if ( ! style.isInhStrokeColor())
00472               fo.setAttribute("SCOLOR", style.strokeColor());
00473        if ( ! style.isInhStrokeShade())
00474               fo.setAttribute("SSHADE", style.strokeShade());
00475        if ( ! style.isInhShadowXOffset())
00476               fo.setAttribute("TXTSHX", style.shadowXOffset() / 10.0);
00477        if ( ! style.isInhShadowYOffset())
00478               fo.setAttribute("TXTSHY", style.shadowYOffset() / 10.0);
00479        if ( ! style.isInhOutlineWidth())
00480               fo.setAttribute("TXTOUT", style.outlineWidth() / 10.0);
00481        if ( ! style.isInhUnderlineOffset())
00482               fo.setAttribute("TXTULP", style.underlineOffset() / 10.0);
00483        if ( ! style.isInhUnderlineWidth())
00484               fo.setAttribute("TXTULW", style.underlineWidth() / 10.0);
00485        if ( ! style.isInhStrikethruOffset())
00486               fo.setAttribute("TXTSTP", style.strikethruOffset() / 10.0);
00487        if ( ! style.isInhStrikethruWidth())
00488               fo.setAttribute("TXTSTW", style.strikethruWidth() / 10.0);
00489        if ( ! style.isInhScaleH())
00490               fo.setAttribute("SCALEH", style.scaleH() / 10.0);
00491        if ( ! style.isInhScaleV())
00492               fo.setAttribute("SCALEV", style.scaleV() / 10.0);
00493        if ( ! style.isInhBaselineOffset())
00494               fo.setAttribute("BASEO", style.baselineOffset() / 10.0);
00495        if ( ! style.isInhTracking())
00496               fo.setAttribute("KERN", style.tracking() / 10.0); 
00497        if ( ! style.isInhWordTracking())
00498               fo.setAttribute("wordTrack", style.wordTracking());
00499        fo.setAttribute("SHORTCUT", style.shortcut()); // shortcuts won't be inherited
00500 }
00501 
00502 void Scribus134Format::writeLayers(QDomDocument & docu) 
00503 {      
00504        QDomElement dc=docu.documentElement().firstChild().toElement();
00505 
00506        uint layerCount=m_Doc->layerCount();
00507        for (uint lay = 0; lay < layerCount; ++lay)
00508        {
00509               QDomElement la = docu.createElement("LAYERS");
00510               la.setAttribute("NUMMER",m_Doc->Layers[lay].LNr);
00511               la.setAttribute("LEVEL",m_Doc->Layers[lay].Level);
00512               la.setAttribute("NAME",m_Doc->Layers[lay].Name);
00513               la.setAttribute("SICHTBAR", static_cast<int>(m_Doc->Layers[lay].isViewable));
00514               la.setAttribute("DRUCKEN", static_cast<int>(m_Doc->Layers[lay].isPrintable));
00515               la.setAttribute("EDIT", static_cast<int>(m_Doc->Layers[lay].isEditable));
00516               la.setAttribute("FLOW", static_cast<int>(m_Doc->Layers[lay].flowControl));
00517               la.setAttribute("TRANS", m_Doc->Layers[lay].transparency);
00518               la.setAttribute("BLEND", m_Doc->Layers[lay].blendMode);
00519               la.setAttribute("OUTL", static_cast<int>(m_Doc->Layers[lay].outlineMode));
00520               la.setAttribute("LAYERC",m_Doc->Layers[lay].markerColor.name());
00521               dc.appendChild(la);
00522        }
00523 }
00524 
00525 void Scribus134Format::writePrintOptions(QDomDocument & docu) 
00526 {
00527        QDomElement dc=docu.documentElement().firstChild().toElement();
00528 
00529        QDomElement pri = docu.createElement("Printer");
00530        pri.setAttribute("firstUse", static_cast<int>(m_Doc->Print_Options.firstUse));
00531        pri.setAttribute("toFile", static_cast<int>(m_Doc->Print_Options.toFile));
00532        pri.setAttribute("useAltPrintCommand", static_cast<int>(m_Doc->Print_Options.useAltPrintCommand));
00533        pri.setAttribute("outputSeparations", static_cast<int>(m_Doc->Print_Options.outputSeparations));
00534        pri.setAttribute("useSpotColors", static_cast<int>(m_Doc->Print_Options.useSpotColors));
00535        pri.setAttribute("useColor", static_cast<int>(m_Doc->Print_Options.useColor));
00536        pri.setAttribute("mirrorH", static_cast<int>(m_Doc->Print_Options.mirrorH));
00537        pri.setAttribute("mirrorV", static_cast<int>(m_Doc->Print_Options.mirrorV));
00538        pri.setAttribute("useICC", static_cast<int>(m_Doc->Print_Options.useICC));
00539        pri.setAttribute("doGCR", static_cast<int>(m_Doc->Print_Options.doGCR));
00540        pri.setAttribute("doClip", static_cast<int>(m_Doc->Print_Options.doClip));
00541        pri.setAttribute("setDevParam", static_cast<int>(m_Doc->Print_Options.setDevParam));
00542        pri.setAttribute("doOverprint", static_cast<int>(m_Doc->Print_Options.doOverprint));
00543        pri.setAttribute("cropMarks", static_cast<int>(m_Doc->Print_Options.cropMarks));
00544        pri.setAttribute("bleedMarks", static_cast<int>(m_Doc->Print_Options.bleedMarks));
00545        pri.setAttribute("registrationMarks", static_cast<int>(m_Doc->Print_Options.registrationMarks));
00546        pri.setAttribute("colorMarks", static_cast<int>(m_Doc->Print_Options.colorMarks));
00547        pri.setAttribute("PSLevel", m_Doc->Print_Options.PSLevel);
00548        pri.setAttribute("markOffset", m_Doc->Print_Options.markOffset);
00549        pri.setAttribute("BleedTop", m_Doc->Print_Options.bleeds.Top);
00550        pri.setAttribute("BleedLeft", m_Doc->Print_Options.bleeds.Left);
00551        pri.setAttribute("BleedRight", m_Doc->Print_Options.bleeds.Right);
00552        pri.setAttribute("BleedBottom", m_Doc->Print_Options.bleeds.Bottom);
00553        pri.setAttribute("printer", m_Doc->Print_Options.printer);
00554        pri.setAttribute("filename", m_Doc->Print_Options.filename);
00555        pri.setAttribute("separationName", m_Doc->Print_Options.separationName);
00556        pri.setAttribute("printerCommand", m_Doc->Print_Options.printerCommand);
00557        for (uint p = 0; p < m_Doc->Print_Options.allSeparations.count(); ++p)
00558        {
00559               QDomElement pri2 = docu.createElement("Separation");
00560               pri2.setAttribute("Name", m_Doc->Print_Options.allSeparations[p]);
00561               pri.appendChild(pri2);
00562        }
00563        dc.appendChild(pri);
00564 }
00565 
00566 void Scribus134Format::writePdfOptions(QDomDocument & docu) 
00567 {
00568        QDomElement dc=docu.documentElement().firstChild().toElement();
00569 
00570        QDomElement pdf = docu.createElement("PDF");
00571        pdf.setAttribute("firstUse", static_cast<int>(m_Doc->PDF_Options.firstUse));
00572        pdf.setAttribute("Thumbnails", static_cast<int>(m_Doc->PDF_Options.Thumbnails));
00573        pdf.setAttribute("Articles", static_cast<int>(m_Doc->PDF_Options.Articles));
00574        pdf.setAttribute("Bookmarks", static_cast<int>(m_Doc->PDF_Options.Bookmarks));
00575        pdf.setAttribute("Compress", static_cast<int>(m_Doc->PDF_Options.Compress));
00576        pdf.setAttribute("CMethod", m_Doc->PDF_Options.CompressMethod);
00577        pdf.setAttribute("Quality", m_Doc->PDF_Options.Quality);
00578        pdf.setAttribute("MirrorH", static_cast<int>(m_Doc->PDF_Options.MirrorH));
00579        pdf.setAttribute("MirrorV", static_cast<int>(m_Doc->PDF_Options.MirrorV));
00580        pdf.setAttribute("Clip", static_cast<int>(m_Doc->PDF_Options.doClip));
00581        pdf.setAttribute("RotateDeg", static_cast<int>(m_Doc->PDF_Options.RotateDeg));
00582        pdf.setAttribute("PresentMode", static_cast<int>(m_Doc->PDF_Options.PresentMode));
00583        pdf.setAttribute("RecalcPic", static_cast<int>(m_Doc->PDF_Options.RecalcPic));
00584        pdf.setAttribute("Grayscale", static_cast<int>(m_Doc->PDF_Options.isGrayscale));
00585        pdf.setAttribute("RGBMode", static_cast<int>(m_Doc->PDF_Options.UseRGB));
00586        pdf.setAttribute("UseProfiles", static_cast<int>(m_Doc->PDF_Options.UseProfiles));
00587        pdf.setAttribute("UseProfiles2", static_cast<int>(m_Doc->PDF_Options.UseProfiles2));
00588        pdf.setAttribute("Binding", m_Doc->PDF_Options.Binding);
00589        pdf.setAttribute("PicRes", m_Doc->PDF_Options.PicRes);
00590        pdf.setAttribute("Resolution", m_Doc->PDF_Options.Resolution);
00591        pdf.setAttribute("Version", m_Doc->PDF_Options.Version);
00592        pdf.setAttribute("Intent", m_Doc->PDF_Options.Intent);
00593        pdf.setAttribute("Intent2", m_Doc->PDF_Options.Intent2);
00594        pdf.setAttribute("SolidP", m_Doc->PDF_Options.SolidProf);
00595        pdf.setAttribute("ImageP", m_Doc->PDF_Options.ImageProf);
00596        pdf.setAttribute("PrintP", m_Doc->PDF_Options.PrintProf);
00597        pdf.setAttribute("InfoString", m_Doc->PDF_Options.Info);
00598        pdf.setAttribute("BTop", m_Doc->PDF_Options.bleeds.Top);
00599        pdf.setAttribute("BLeft", m_Doc->PDF_Options.bleeds.Left);
00600        pdf.setAttribute("BRight", m_Doc->PDF_Options.bleeds.Right);
00601        pdf.setAttribute("BBottom", m_Doc->PDF_Options.bleeds.Bottom);
00602        pdf.setAttribute("useDocBleeds", static_cast<int>(m_Doc->PDF_Options.useDocBleeds));
00603        pdf.setAttribute("cropMarks", static_cast<int>(m_Doc->PDF_Options.cropMarks));
00604        pdf.setAttribute("bleedMarks", static_cast<int>(m_Doc->PDF_Options.bleedMarks));
00605        pdf.setAttribute("registrationMarks", static_cast<int>(m_Doc->PDF_Options.registrationMarks));
00606        pdf.setAttribute("colorMarks", static_cast<int>(m_Doc->PDF_Options.colorMarks));
00607        pdf.setAttribute("docInfoMarks", static_cast<int>(m_Doc->PDF_Options.docInfoMarks));
00608        pdf.setAttribute("markOffset", m_Doc->PDF_Options.markOffset);
00609        pdf.setAttribute("ImagePr", static_cast<int>(m_Doc->PDF_Options.EmbeddedI));
00610        pdf.setAttribute("PassOwner", m_Doc->PDF_Options.PassOwner);
00611        pdf.setAttribute("PassUser", m_Doc->PDF_Options.PassUser);
00612        pdf.setAttribute("Permissions", m_Doc->PDF_Options.Permissions);
00613        pdf.setAttribute("Encrypt", static_cast<int>(m_Doc->PDF_Options.Encrypt));
00614        pdf.setAttribute("UseLayers", static_cast<int>(m_Doc->PDF_Options.useLayers));
00615        pdf.setAttribute("UseLpi", static_cast<int>(m_Doc->PDF_Options.UseLPI));
00616        pdf.setAttribute("UseSpotColors", static_cast<int>(m_Doc->PDF_Options.UseSpotColors));
00617        pdf.setAttribute("doOverprint", static_cast<int>(m_Doc->PDF_Options.doOverprint));
00618        pdf.setAttribute("doMultiFile", static_cast<int>(m_Doc->PDF_Options.doMultiFile));
00619        pdf.setAttribute("displayBookmarks", static_cast<int>(m_Doc->PDF_Options.displayBookmarks));
00620        pdf.setAttribute("displayFullscreen", static_cast<int>(m_Doc->PDF_Options.displayFullscreen));
00621        pdf.setAttribute("displayLayers", static_cast<int>(m_Doc->PDF_Options.displayLayers));
00622        pdf.setAttribute("displayThumbs", static_cast<int>(m_Doc->PDF_Options.displayThumbs));
00623        pdf.setAttribute("hideMenuBar", static_cast<int>(m_Doc->PDF_Options.hideMenuBar));
00624        pdf.setAttribute("hideToolBar", static_cast<int>(m_Doc->PDF_Options.hideToolBar));
00625        pdf.setAttribute("fitWindow", static_cast<int>(m_Doc->PDF_Options.fitWindow));
00626        pdf.setAttribute("PageLayout", m_Doc->PDF_Options.PageLayout);
00627        pdf.setAttribute("openAction", m_Doc->PDF_Options.openAction);
00628        for (uint pdoF = 0; pdoF < m_Doc->PDF_Options.EmbedList.count(); ++pdoF)
00629        {
00630               QDomElement pdf2 = docu.createElement("Fonts");
00631               pdf2.setAttribute("Name", m_Doc->PDF_Options.EmbedList[pdoF]);
00632               pdf.appendChild(pdf2);
00633        }
00634        for (uint pdoS = 0; pdoS < m_Doc->PDF_Options.SubsetList.count(); ++pdoS)
00635        {
00636               QDomElement pdf4 = docu.createElement("Subset");
00637               pdf4.setAttribute("Name", m_Doc->PDF_Options.SubsetList[pdoS]);
00638               pdf.appendChild(pdf4);
00639        }
00640        for (uint pdoE = 0; pdoE < m_Doc->PDF_Options.PresentVals.count(); ++pdoE)
00641        {
00642               QDomElement pdf3 = docu.createElement("Effekte");
00643               pdf3.setAttribute("pageEffectDuration", m_Doc->PDF_Options.PresentVals[pdoE].pageEffectDuration);
00644               pdf3.setAttribute("pageViewDuration", m_Doc->PDF_Options.PresentVals[pdoE].pageViewDuration);
00645               pdf3.setAttribute("effectType", m_Doc->PDF_Options.PresentVals[pdoE].effectType);
00646               pdf3.setAttribute("Dm", m_Doc->PDF_Options.PresentVals[pdoE].Dm);
00647               pdf3.setAttribute("M", m_Doc->PDF_Options.PresentVals[pdoE].M);
00648               pdf3.setAttribute("Di", m_Doc->PDF_Options.PresentVals[pdoE].Di);
00649               pdf.appendChild(pdf3);
00650        }
00651        QMap<QString,LPIData>::Iterator itlp;
00652        for (itlp = m_Doc->PDF_Options.LPISettings.begin(); itlp != m_Doc->PDF_Options.LPISettings.end(); ++itlp)
00653        {
00654               QDomElement pdf4 = docu.createElement("LPI");
00655               pdf4.setAttribute("Color", itlp.key());
00656               pdf4.setAttribute("Frequency", itlp.data().Frequency);
00657               pdf4.setAttribute("Angle", itlp.data().Angle);
00658               pdf4.setAttribute("SpotFunction", itlp.data().SpotFunc);
00659               pdf.appendChild(pdf4);
00660        }
00661        dc.appendChild(pdf);
00662 }
00663 
00664 void Scribus134Format::writeDocItemAttributes(QDomDocument & docu) 
00665 {
00666        QDomElement dc=docu.documentElement().firstChild().toElement();
00667 
00668        QDomElement docItemAttrs = docu.createElement("DocItemAttributes");
00669        for(ObjAttrVector::Iterator objAttrIt = m_Doc->docItemAttributes.begin() ; objAttrIt != m_Doc->docItemAttributes.end(); ++objAttrIt )
00670        {
00671               QDomElement itemAttr = docu.createElement("ItemAttribute");
00672               itemAttr.setAttribute("Name", (*objAttrIt).name);
00673               itemAttr.setAttribute("Type", (*objAttrIt).type);
00674               itemAttr.setAttribute("Value", (*objAttrIt).value);
00675               itemAttr.setAttribute("Parameter", (*objAttrIt).parameter);
00676               itemAttr.setAttribute("Relationship", (*objAttrIt).relationship);
00677               itemAttr.setAttribute("RelationshipTo", (*objAttrIt).relationshipto);
00678               itemAttr.setAttribute("AutoAddTo", (*objAttrIt).autoaddto);
00679               docItemAttrs.appendChild(itemAttr);
00680        }
00681        dc.appendChild(docItemAttrs);
00682 }
00683 
00684 
00685 void Scribus134Format::writeTOC(QDomDocument & docu) 
00686 {
00687        QDomElement dc=docu.documentElement().firstChild().toElement();
00688 
00689        QDomElement tocElem = docu.createElement("TablesOfContents");
00690        for(ToCSetupVector::Iterator tocSetupIt = m_Doc->docToCSetups.begin() ; tocSetupIt != m_Doc->docToCSetups.end(); ++tocSetupIt )
00691        {
00692               QDomElement tocsetup = docu.createElement("TableOfContents");
00693               tocsetup.setAttribute("Name", (*tocSetupIt).name);
00694               tocsetup.setAttribute("ItemAttributeName", (*tocSetupIt).itemAttrName);
00695               tocsetup.setAttribute("FrameName", (*tocSetupIt).frameName);
00696               tocsetup.setAttribute("ListNonPrinting", (*tocSetupIt).listNonPrintingFrames);
00697               tocsetup.setAttribute("Style", (*tocSetupIt).textStyle);
00698               switch ((*tocSetupIt).pageLocation)
00699               {
00700                      case Beginning:
00701                             tocsetup.setAttribute("NumberPlacement", "Beginning");
00702                             break;
00703                      case End:
00704                             tocsetup.setAttribute("NumberPlacement", "End");
00705                             break;
00706                      case NotShown:
00707                             tocsetup.setAttribute("NumberPlacement", "NotShown");
00708                             break;
00709               }
00710               tocElem.appendChild(tocsetup);
00711        }
00712        dc.appendChild(tocElem);
00713 }
00714 
00715 
00716 void Scribus134Format::writeSections(QDomDocument & docu) 
00717 {
00718        QDomElement dc=docu.documentElement().firstChild().toElement();
00719 
00720        QDomElement sectionElem = docu.createElement("Sections");
00721        for(DocumentSectionMap::Iterator it = m_Doc->sections.begin() ; it != m_Doc->sections.end(); ++it )
00722        {
00723               QDomElement currsection = docu.createElement("Section");
00724               currsection.setAttribute("Number", (*it).number);
00725               currsection.setAttribute("Name", (*it).name);
00726               currsection.setAttribute("From", (*it).fromindex);
00727               currsection.setAttribute("To", (*it).toindex);
00728               switch ((*it).type)
00729               {
00730                      case Type_1_2_3:
00731                             currsection.setAttribute("Type", "Type_1_2_3");
00732                             break;
00733                      case Type_i_ii_iii:
00734                             currsection.setAttribute("Type", "Type_i_ii_iii");
00735                             break;
00736                      case Type_I_II_III:
00737                             currsection.setAttribute("Type", "Type_I_II_III");
00738                             break;
00739                      case Type_a_b_c:
00740                             currsection.setAttribute("Type", "Type_a_b_c");
00741                             break;
00742                      case Type_A_B_C:
00743                             currsection.setAttribute("Type", "Type_A_B_C");
00744                             break;
00745                      case Type_None:
00746                             currsection.setAttribute("Type", "Type_None");
00747                             break;
00748               }
00749               currsection.setAttribute("Start", (*it).sectionstartindex);
00750               currsection.setAttribute("Reversed", (*it).reversed);
00751               currsection.setAttribute("Active", (*it).active);
00752               sectionElem.appendChild(currsection);
00753        }
00754        dc.appendChild(sectionElem);
00755 }
00756 
00757 
00758 void Scribus134Format::writePageSets(QDomDocument & docu) 
00759 {      
00760        QDomElement dc=docu.documentElement().firstChild().toElement();
00761 
00762        QDomElement pageSetAttr = docu.createElement("PageSets");
00763        QValueList<PageSet>::Iterator itpgset;
00764        for(itpgset = m_Doc->pageSets.begin(); itpgset != m_Doc->pageSets.end(); ++itpgset )
00765        {
00766               QDomElement pgst = docu.createElement("Set");
00767               pgst.setAttribute("Name", (*itpgset).Name);
00768               pgst.setAttribute("FirstPage", (*itpgset).FirstPage);
00769               pgst.setAttribute("Rows", (*itpgset).Rows);
00770               pgst.setAttribute("Columns", (*itpgset).Columns);
00771               pgst.setAttribute("GapHorizontal", (*itpgset).GapHorizontal);
00772               pgst.setAttribute("GapVertical", (*itpgset).GapVertical);
00773               pgst.setAttribute("GapBelow", (*itpgset).GapBelow);
00774               QStringList pNames = (*itpgset).pageNames;
00775               QStringList::Iterator itpgsetN;
00776               for(itpgsetN = pNames.begin(); itpgsetN != pNames.end(); ++itpgsetN )
00777               {
00778                      QDomElement pgstN = docu.createElement("PageNames");
00779                      pgstN.setAttribute("Name", (*itpgsetN));
00780                      pgst.appendChild(pgstN);
00781               }
00782               pageSetAttr.appendChild(pgst);
00783        }
00784        dc.appendChild(pageSetAttr);
00785 }
00786 
00787 void Scribus134Format::writePatterns(QDomDocument & docu) 
00788 {
00789        QDomElement dc=docu.documentElement().firstChild().toElement();
00790        
00791        QMap<QString, ScPattern>::Iterator itPat;
00792        for (itPat = m_Doc->docPatterns.begin(); itPat != m_Doc->docPatterns.end(); ++itPat)
00793        {
00794               QDomElement pat = docu.createElement("Pattern");
00795               pat.setAttribute("Name",itPat.key());
00796               ScPattern pa = itPat.data();
00797               pat.setAttribute("width", pa.width);
00798               pat.setAttribute("height", pa.height);
00799               pat.setAttribute("scaleX", pa.scaleX);
00800               pat.setAttribute("scaleY", pa.scaleY);
00801               WriteObjects(m_Doc, &docu, &pat, 0, 0, 3, &pa.items);
00802               dc.appendChild(pat);
00803        }      
00804 }
00805 
00806 void Scribus134Format::writeContent(QDomDocument & docu) 
00807 {
00808        QDomElement dc=docu.documentElement().firstChild().toElement();
00809 
00810        if (m_mwProgressBar != 0)
00811        {
00812               m_mwProgressBar->setTotalSteps(m_Doc->DocPages.count()+m_Doc->MasterPages.count()+m_Doc->DocItems.count()+m_Doc->MasterItems.count()+m_Doc->FrameItems.count());
00813               m_mwProgressBar->setProgress(0);
00814        }
00815        WritePages(m_Doc, &docu, &dc, m_mwProgressBar, 0, true);
00816        WritePages(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count(), false);
00817        WriteObjects(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count()+m_Doc->DocPages.count(), 2);
00818        WriteObjects(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count()+m_Doc->DocPages.count()+m_Doc->FrameItems.count(), 0);
00819        WriteObjects(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count()+m_Doc->DocPages.count()+m_Doc->MasterItems.count()+m_Doc->FrameItems.count(), 1);
00820 }
00821 
00822 void Scribus134Format::WritePages(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, bool master)
00823 {
00824        uint ObCount = maxC;
00825        Page *page;
00826        uint pages;
00827        QDomElement pg;
00828        QString tmp;
00829        if (master)
00830               pages = doc->MasterPages.count();
00831        else
00832               pages = doc->DocPages.count();
00833        for(uint i = 0; i < pages; ++i)
00834        {
00835               ObCount++;
00836               if (dia2 != 0)
00837                      dia2->setProgress(ObCount);
00838               if (master)
00839               {
00840                      pg = docu->createElement("MASTERPAGE");
00841                      page = doc->MasterPages.at(i);
00842               }
00843               else
00844               {
00845                      pg = docu->createElement("PAGE");
00846                      page = doc->DocPages.at(i);
00847               }
00848               pg.setAttribute("PAGEXPOS",page->xOffset());
00849               pg.setAttribute("PAGEYPOS",page->yOffset());
00850               pg.setAttribute("PAGEWIDTH",page->width());
00851               pg.setAttribute("PAGEHEIGHT",page->height());
00852               pg.setAttribute("BORDERLEFT",page->initialMargins.Left);
00853               pg.setAttribute("BORDERRIGHT",page->initialMargins.Right);
00854               pg.setAttribute("BORDERTOP",page->initialMargins.Top);
00855               pg.setAttribute("BORDERBOTTOM",page->initialMargins.Bottom);
00856               pg.setAttribute("NUM",page->pageNr());
00857               pg.setAttribute("NAM",page->pageName());
00858               pg.setAttribute("MNAM",page->MPageNam);
00859               pg.setAttribute("Size", page->m_pageSize);
00860               pg.setAttribute("Orientation", page->PageOri);
00861               pg.setAttribute("LEFT", page->LeftPg);
00862               pg.setAttribute("VerticalGuides", GuideManagerIO::writeVerticalGuides(
00863                                                                                            page, GuideManagerCore::Standard));
00864               pg.setAttribute("HorizontalGuides", GuideManagerIO::writeHorizontalGuides(
00865                                                                                            page, GuideManagerCore::Standard));
00866               pg.setAttribute("AGhorizontalAutoGap", page->guides.horizontalAutoGap());
00867               pg.setAttribute("AGverticalAutoGap", page->guides.verticalAutoGap());
00868               pg.setAttribute("AGhorizontalAutoCount", page->guides.horizontalAutoCount());
00869               pg.setAttribute("AGverticalAutoCount", page->guides.verticalAutoCount());
00870               pg.setAttribute("AGhorizontalAutoRefer", page->guides.horizontalAutoRefer());
00871               pg.setAttribute("AGverticalAutoRefer", page->guides.verticalAutoRefer());
00872               pg.setAttribute("AGSelection", GuideManagerIO::writeSelection(page));
00873               dc->appendChild(pg);
00874        }
00875 }
00876 
00877 
00878 namespace { // anon
00879        QString textWithSmartHyphens(StoryText& itemText, int from, int to)
00880        {
00881               QString result("");
00882               int lastPos = from;
00883               for (int i = from; i < to; ++i)
00884               {
00885                      if (itemText.charStyle(i).effects() & ScStyle_HyphenationPossible 
00886                             // duplicate SHYPHEN if already present to indicate a user provided SHYPHEN:
00887                             || itemText.text(i) == SpecialChars::SHYPHEN)
00888                      {
00889                             result += itemText.text(lastPos, i + 1 - lastPos);
00890                             result += SpecialChars::SHYPHEN;
00891                             lastPos = i+1;
00892                      }
00893               }
00894               if (lastPos < to)
00895                      result += itemText.text(lastPos, to - lastPos);
00896               return result;
00897        }
00898 } // namespace anon
00899 
00900 
00901 void Scribus134Format::writeITEXTs(ScribusDoc *doc, QDomDocument *docu, QDomElement ob, PageItem* item)
00902 {
00903        CharStyle lastStyle;
00904        int lastPos = 0;
00905        QString tmpnum;
00906        for(int k = 0; k < item->itemText.length(); ++k)
00907        {
00908               const CharStyle& style1(item->itemText.charStyle(k));
00909               const QChar ch = item->itemText.text(k);
00910               
00911               if (ch == SpecialChars::OBJECT ||
00912                      ch == SpecialChars::TAB ||
00913                      ch == SpecialChars::PARSEP ||
00914                      ch == SpecialChars::LINEBREAK ||
00915                      ch == SpecialChars::COLBREAK ||
00916                      ch == SpecialChars::FRAMEBREAK ||
00917                      ch == SpecialChars::PAGENUMBER ||
00918                      ch.unicode() < 32 || 
00919                      (0xd800 <= ch.unicode() && ch.unicode() < 0xe000) ||
00920                      ch.unicode() == 0xfffe || ch.unicode() == 0xffff ||
00921                      style1 != lastStyle)
00922               {
00923                      // something new, write pending chars
00924                      if  (k - lastPos > 0)
00925                      {
00926                             QDomElement it=docu->createElement("ITEXT");
00927                             putCStyle(*docu, it, lastStyle);
00928                             it.setAttribute("CH", textWithSmartHyphens(item->itemText, lastPos, k));
00929                             ob.appendChild(it);
00930                      }
00931                      lastStyle = style1;
00932                      lastPos = k;
00933               }
00934 
00935               if (ch == SpecialChars::OBJECT && item->itemText.object(k) != NULL) 
00936               {
00937                      // each obj in its own ITEXT for now
00938                      QDomElement emb = docu->createElement("ITEXT");
00939                      putCStyle(*docu, emb, lastStyle);
00940                      emb.setAttribute("CH", QString(ch));
00941                      emb.setAttribute("COBJ", item->itemText.object(k)->ItemNr);
00942                      ob.appendChild(emb);               
00943               }
00944               else if (ch == SpecialChars::PARSEP)
00945               {
00946                      // stores also the paragraphstyle for preceding chars
00947                      QDomElement par = docu->createElement("para");
00948                      putPStyle(*docu, par, item->itemText.paragraphStyle(k));
00949                      ob.appendChild(par);
00950               }
00951               else if (ch == SpecialChars::TAB) 
00952               {
00953                      ob.appendChild(docu->createElement("tab"));
00954               }
00955               else if (ch == SpecialChars::LINEBREAK)
00956               {
00957                      ob.appendChild(docu->createElement("breakline"));
00958               }
00959               else if (ch == SpecialChars::COLBREAK)
00960               {
00961                      ob.appendChild(docu->createElement("breakcol"));
00962               }
00963               else if (ch == SpecialChars::FRAMEBREAK)
00964               {
00965                      ob.appendChild(docu->createElement("breakframe"));
00966               }
00967               else if (ch == SpecialChars::PAGENUMBER) 
00968               {
00969                      QDomElement it = docu->createElement("var");
00970                      it.setAttribute("name", "pgno");
00971                      ob.appendChild(it);
00972               }
00973               else if (ch.unicode() < 32 || 
00974                              (0xd800 <= ch.unicode() && ch.unicode() < 0xe000) ||
00975                              ch.unicode() == 0xfffe || ch.unicode() == 0xffff)
00976               {
00977                      QDomElement cod = docu->createElement("ITEXT");
00978                      putCStyle(*docu, cod, lastStyle);
00979                      tmpnum.setNum(ch.unicode());
00980                      cod.setAttribute("Unicode", tmpnum);
00981                      ob.appendChild(cod);               
00982                      
00983               }
00984               else
00985               {
00986                      continue;
00987               }
00988               // otherwise we just wrote something special and are done with position 'k'
00989               lastPos = k + 1;
00990        }
00991        // write pending chars
00992        if ( item->itemText.length() - lastPos > 0)
00993        {
00994               QDomElement it=docu->createElement("ITEXT");
00995               putCStyle(*docu, it, lastStyle);
00996               it.setAttribute("CH", textWithSmartHyphens(item->itemText, lastPos, item->itemText.length()));
00997               ob.appendChild(it);
00998        }
00999        // paragraphstyle for trailing chars
01000        if (item->itemText.length() == 0 || item->itemText.text(item->itemText.length()-1) != SpecialChars::PARSEP)
01001        {
01002               QDomElement par = docu->createElement("para");
01003               putPStyle(*docu, par, item->itemText.paragraphStyle(item->itemText.length()));
01004               ob.appendChild(par);
01005        }
01006 }
01007 
01008 void Scribus134Format::WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master, QPtrList<PageItem> *some_items)
01009 {
01010        uint ObCount = maxC;
01011        QPtrList<PageItem> * items = NULL;
01012        PageItem *item = NULL;
01013        QDomElement ob;
01014        uint objects = 0;
01015        switch (master)
01016        {
01017               case 0:
01018                      items = & doc->MasterItems;
01019                      break;
01020               case 1:
01021                      items = & doc->DocItems;
01022                      break;
01023               case 2:
01024                      items = & doc->FrameItems;
01025                      break;
01026               case 3:
01027                      items = some_items;
01028                      break;
01029        }
01030        objects = items->count();
01031        
01032        for(uint j = 0; j < objects;++j)
01033        {
01034               ObCount++;
01035               if (dia2 != 0)
01036                      dia2->setProgress(ObCount);
01037               item = items->at(j);
01038               switch (master)
01039               {
01040                      case 0:
01041 //                          item = doc->MasterItems.at(j);
01042                             ob = docu->createElement("MASTEROBJECT");
01043                             break;
01044                      case 1:
01045 //                          item = doc->DocItems.at(j);
01046                             ob = docu->createElement("PAGEOBJECT");
01047                             break;
01048                      case 2:
01049 //                          item = doc->FrameItems.at(j);
01050                             ob = docu->createElement("FRAMEOBJECT");
01051                             break;
01052                      case 3:
01053                             ob = docu->createElement("PatternItem");
01054                             break;
01055               }
01056               SetItemProps(&ob, item, true);
01057               ob.setAttribute("OnMasterPage", item->OnMasterPage);
01058               ob.setAttribute("ImageClip", item->pixm.imgInfo.usedPath);
01059               ob.setAttribute("ImageRes", item->pixm.imgInfo.lowResType);
01060               ob.setAttribute("isInline", static_cast<int>(item->isEmbedded));
01061               ob.setAttribute("fillRule", static_cast<int>(item->fillRule));
01062               ob.setAttribute("doOverprint", static_cast<int>(item->doOverprint));
01063               ob.setAttribute("gXpos", item->gXpos);
01064               ob.setAttribute("gYpos", item->gYpos);
01065               ob.setAttribute("gWidth", item->gWidth);
01066               ob.setAttribute("gHeight", item->gHeight);
01067               if (item->GrType != 0)
01068               {
01069                      if (item->GrType == 8)
01070                      {
01071                             ob.setAttribute("pattern", item->pattern());
01072                             double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation;
01073                             item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation);
01074                             ob.setAttribute("pScaleX", patternScaleX);
01075                             ob.setAttribute("pScaleY", patternScaleY);
01076                             ob.setAttribute("pOffsetX", patternOffsetX);
01077                             ob.setAttribute("pOffsetY", patternOffsetY);
01078                             ob.setAttribute("pRotation", patternRotation);
01079                      }
01080                      else
01081                      {
01082                             QPtrVector<VColorStop> cstops = item->fill_gradient.colorStops();
01083                             for (uint cst = 0; cst < item->fill_gradient.Stops(); ++cst)
01084                             {
01085                                    QDomElement itcl = docu->createElement("CSTOP");
01086                                    itcl.setAttribute("RAMP", cstops.at(cst)->rampPoint);
01087                                    itcl.setAttribute("NAME", cstops.at(cst)->name);
01088                                    itcl.setAttribute("SHADE", cstops.at(cst)->shade);
01089                                    itcl.setAttribute("TRANS", cstops.at(cst)->opacity);
01090                                    ob.appendChild(itcl);
01091                             }
01092                             ob.setAttribute("GRSTARTX", item->GrStartX);
01093                             ob.setAttribute("GRSTARTY", item->GrStartY);
01094                             ob.setAttribute("GRENDX", item->GrEndX);
01095                             ob.setAttribute("GRENDY", item->GrEndY);
01096                      }
01097               }
01098               if (item->effectsInUse.count() != 0)
01099               {
01100                      for (uint a = 0; a < item->effectsInUse.count(); ++a)
01101                      {
01102                             QDomElement imeff = docu->createElement("ImageEffect");
01103                             imeff.setAttribute("Code", (*item->effectsInUse.at(a)).effectCode);
01104                             imeff.setAttribute("Param", (*item->effectsInUse.at(a)).effectParameters);
01105                             ob.appendChild(imeff);
01106                      }
01107               }
01108 
01109               if (item->itemText.defaultStyle().tabValues().count() != 0)
01110               {
01111                      for (uint a = 0; a < item->itemText.defaultStyle().tabValues().count(); ++a)
01112                      {
01113                             QDomElement tabs = docu->createElement("Tabs");
01114                             tabs.setAttribute("Type", (*item->itemText.defaultStyle().tabValues().at(a)).tabType);
01115                             tabs.setAttribute("Pos", (*item->itemText.defaultStyle().tabValues().at(a)).tabPosition);
01116                             QString tabCh = "";
01117                             if (!(*item->itemText.defaultStyle().tabValues().at(a)).tabFillChar.isNull())
01118                                    tabCh = QString((*item->itemText.defaultStyle().tabValues().at(a)).tabFillChar);
01119                             tabs.setAttribute("Fill", tabCh);
01120                             ob.appendChild(tabs);
01121                      }
01122               }
01123               if (((item->asImageFrame()) || (item->asTextFrame())) && (!item->Pfile.isEmpty()) && (item->pixm.imgInfo.layerInfo.count() != 0) && (item->pixm.imgInfo.isRequest))
01124               {
01125                      QMap<int, ImageLoadRequest>::iterator it2;
01126                      for (it2 = item->pixm.imgInfo.RequestProps.begin(); it2 != item->pixm.imgInfo.RequestProps.end(); ++it2)
01127                      {
01128                             QDomElement psd = docu->createElement("PSDLayer");
01129                             psd.setAttribute("Layer",it2.key());
01130                             psd.setAttribute("Visible", static_cast<int>(it2.data().visible));
01131                             psd.setAttribute("useMask", static_cast<int>(it2.data().useMask));
01132                             psd.setAttribute("Opacity", it2.data().opacity);
01133                             psd.setAttribute("Blend", it2.data().blend);
01134                             ob.appendChild(psd);
01135                      }
01136               }
01137               if (item->itemText.defaultStyle().hasParent())
01138                      ob.setAttribute("PSTYLE", item->itemText.defaultStyle().parent());
01139               if (! item->itemText.defaultStyle().isInhAlignment())
01140                      ob.setAttribute("ALIGN", item->itemText.defaultStyle().alignment());
01141               
01142               ob.setAttribute("BOOKMARK", item->isBookmark ? 1 : 0);
01143 
01144               if (item->prevInChain() != 0 && items->contains(item->prevInChain()))
01145                      ob.setAttribute("BACKITEM", item->prevInChain()->ItemNr);
01146               else
01147               {      
01148                      writeITEXTs(doc, docu, ob, item); 
01149                      ob.setAttribute("BACKITEM", -1);
01150               }
01151               if (item->nextInChain() != 0)
01152                      ob.setAttribute("NEXTITEM", item->nextInChain()->ItemNr);
01153               else
01154                      ob.setAttribute("NEXTITEM", -1);
01155               ob.setAttribute("LAYER", item->LayerNr);
01156 
01157               //CB PageItemAttributes
01158               QDomElement docItemAttrs = docu->createElement("PageItemAttributes");
01159               ObjAttrVector *attributes=item->getObjectAttributes();
01160               for(ObjAttrVector::Iterator objAttrIt = attributes->begin() ; objAttrIt != attributes->end(); ++objAttrIt )
01161               {
01162                      QDomElement itemAttr = docu->createElement("ItemAttribute");
01163                      itemAttr.setAttribute("Name", (*objAttrIt).name);
01164                      itemAttr.setAttribute("Type", (*objAttrIt).type);
01165                      itemAttr.setAttribute("Value", (*objAttrIt).value);
01166                      itemAttr.setAttribute("Parameter", (*objAttrIt).parameter);
01167                      itemAttr.setAttribute("Relationship", (*objAttrIt).relationship);
01168                      itemAttr.setAttribute("RelationshipTo", (*objAttrIt).relationshipto);
01169                      itemAttr.setAttribute("AutoAddTo", (*objAttrIt).autoaddto);
01170                      docItemAttrs.appendChild(itemAttr);
01171               }
01172               ob.appendChild(docItemAttrs);
01173 
01174               dc->appendChild(ob);
01175        }
01176 }
01177 
01178 void Scribus134Format::SetItemProps(QDomElement *ob, PageItem* item, bool newFormat)
01179 {
01180        double xf, yf;
01181        QString tmp, tmpy;
01182        if (newFormat)
01183               ob->setAttribute("OwnPage", item->OwnPage);
01184        ob->setAttribute("PTYPE",item->itemType());
01185        ob->setAttribute("XPOS",item->xPos());
01186        ob->setAttribute("YPOS",item->yPos());
01187        ob->setAttribute("WIDTH",item->width());
01188        ob->setAttribute("HEIGHT",item->height());
01189        ob->setAttribute("RADRECT",item->cornerRadius());
01190        ob->setAttribute("FRTYPE", item->FrameType);
01191        ob->setAttribute("CLIPEDIT", item->ClipEdited ? 1 : 0);
01192        ob->setAttribute("PWIDTH",item->lineWidth());
01193        ob->setAttribute("PCOLOR",item->fillColor());
01194        ob->setAttribute("PCOLOR2",item->lineColor());
01195        if ( ! item->itemText.defaultStyle().charStyle().isInhFillColor())
01196               ob->setAttribute("TXTFILL",item->itemText.defaultStyle().charStyle().fillColor());
01197        if ( ! item->itemText.defaultStyle().charStyle().isInhStrokeColor())
01198               ob->setAttribute("TXTSTROKE",item->itemText.defaultStyle().charStyle().strokeColor());
01199        if ( ! item->itemText.defaultStyle().charStyle().isInhStrokeShade())
01200               ob->setAttribute("TXTSTRSH",item->itemText.defaultStyle().charStyle().strokeShade());
01201        if ( ! item->itemText.defaultStyle().charStyle().isInhFillShade())
01202               ob->setAttribute("TXTFILLSH",item->itemText.defaultStyle().charStyle().fillShade());
01203        if ( ! item->itemText.defaultStyle().charStyle().isInhScaleH())
01204               ob->setAttribute("TXTSCALE",item->itemText.defaultStyle().charStyle().scaleH() / 10.0);
01205        if ( ! item->itemText.defaultStyle().charStyle().isInhScaleV())
01206               ob->setAttribute("TXTSCALEV",item->itemText.defaultStyle().charStyle().scaleV() / 10.0);
01207        if ( ! item->itemText.defaultStyle().charStyle().isInhBaselineOffset())
01208               ob->setAttribute("TXTBASE",item->itemText.defaultStyle().charStyle().baselineOffset() / 10.0);
01209        if ( ! item->itemText.defaultStyle().charStyle().isInhShadowXOffset())
01210               ob->setAttribute("TXTSHX",item->itemText.defaultStyle().charStyle().shadowXOffset() / 10.0);
01211        if ( ! item->itemText.defaultStyle().charStyle().isInhShadowYOffset())
01212               ob->setAttribute("TXTSHY",item->itemText.defaultStyle().charStyle().shadowYOffset() / 10.0);
01213        if ( ! item->itemText.defaultStyle().charStyle().isInhOutlineWidth())
01214               ob->setAttribute("TXTOUT",item->itemText.defaultStyle().charStyle().outlineWidth() / 10.0);
01215        if ( ! item->itemText.defaultStyle().charStyle().isInhUnderlineOffset())
01216               ob->setAttribute("TXTULP",item->itemText.defaultStyle().charStyle().underlineOffset() / 10.0);
01217        if ( ! item->itemText.defaultStyle().charStyle().isInhUnderlineWidth())
01218               ob->setAttribute("TXTULW",item->itemText.defaultStyle().charStyle().underlineWidth() / 10.0);
01219        if ( ! item->itemText.defaultStyle().charStyle().isInhStrikethruOffset())
01220               ob->setAttribute("TXTSTP",item->itemText.defaultStyle().charStyle().strikethruOffset() / 10.0);
01221        if ( ! item->itemText.defaultStyle().charStyle().isInhStrikethruWidth())
01222               ob->setAttribute("TXTSTW",item->itemText.defaultStyle().charStyle().strikethruWidth() / 10.0);
01223        if ( ! item->itemText.defaultStyle().charStyle().isInhTracking())
01224               ob->setAttribute("TXTKERN",item->itemText.defaultStyle().charStyle().tracking() / 10.0);
01225        if ( ! item->itemText.defaultStyle().charStyle().isInhWordTracking())
01226               ob->setAttribute("wordTrack",item->itemText.defaultStyle().charStyle().wordTracking());
01227        if ( ! item->itemText.defaultStyle().isInhMinWordTracking())
01228               ob->setAttribute("MinWordTrack", item->itemText.defaultStyle().minWordTracking());
01229        if ( ! item->itemText.defaultStyle().isInhMinGlyphExtension())
01230               ob->setAttribute("MinGlyphShrink", item->itemText.defaultStyle().minGlyphExtension());
01231        if ( ! item->itemText.defaultStyle().isInhMaxGlyphExtension())
01232               ob->setAttribute("MaxGlyphExtend", item->itemText.defaultStyle().maxGlyphExtension());
01233        if ( ! item->itemText.defaultStyle().isInhOpticalMargins())
01234               ob->setAttribute("OpticalMargins", item->itemText.defaultStyle().opticalMargins());
01235        if ( ! item->itemText.defaultStyle().isInhHyphenationMode())
01236               ob->setAttribute("HyphenationMode", item->itemText.defaultStyle().hyphenationMode());
01237        ob->setAttribute("COLUMNS", item->columns());
01238        ob->setAttribute("COLGAP", item->columnGap());
01239        ob->setAttribute("NAMEDLST",item->NamedLStyle);
01240        ob->setAttribute("SHADE",item->fillShade());
01241        ob->setAttribute("SHADE2",item->lineShade());
01242        ob->setAttribute("GRTYP",item->GrType);
01243        ob->setAttribute("ROT",item->rotation());
01244        ob->setAttribute("PLINEART",item->PLineArt);
01245        ob->setAttribute("PLINEEND", item->PLineEnd);
01246        ob->setAttribute("PLINEJOIN", item->PLineJoin);
01247        if ( ! item->itemText.defaultStyle().isInhLineSpacing())
01248               ob->setAttribute("LINESP",item->itemText.defaultStyle().lineSpacing());
01249        if ( ! item->itemText.defaultStyle().isInhLineSpacingMode())
01250               ob->setAttribute("LINESPMode", item->itemText.defaultStyle().lineSpacingMode());
01251        ob->setAttribute("LOCALSCX",item->imageXScale());
01252        ob->setAttribute("LOCALSCY",item->imageYScale());
01253        ob->setAttribute("LOCALX",item->imageXOffset());
01254        ob->setAttribute("LOCALY",item->imageYOffset());
01255        ob->setAttribute("PICART", item->imageShown() ? 1 : 0);
01256        ob->setAttribute("PLTSHOW", item->PoShow ? 1 : 0);
01257        ob->setAttribute("BASEOF", item->BaseOffs);
01258        ob->setAttribute("textPathType", item->textPathType);
01259        ob->setAttribute("textPathFlipped", static_cast<int>(item->textPathFlipped));
01260        ob->setAttribute("FLIPPEDH", item->imageFlippedH());
01261        ob->setAttribute("FLIPPEDV", item->imageFlippedV());
01262 /*     ob->setAttribute("BBOXX",item->BBoxX);
01263        ob->setAttribute("BBOXH",item->BBoxH); */
01264        if ( ! item->itemText.defaultStyle().charStyle().isInhFont())
01265               ob->setAttribute("IFONT",item->itemText.defaultStyle().charStyle().font().scName());
01266        if ( ! item->itemText.defaultStyle().charStyle().isInhFontSize())
01267               ob->setAttribute("ISIZE",item->itemText.defaultStyle().charStyle().fontSize() / 10.0 );
01268        ob->setAttribute("SCALETYPE", item->ScaleType ? 1 : 0);
01269        ob->setAttribute("RATIO", item->AspectRatio ? 1 : 0);
01270        ob->setAttribute("PRINTABLE", item->printEnabled() ? 1 : 0);
01271        if(item->isAnnotation())
01272        {
01273               ob->setAttribute("ANNOTATION",1);
01274               ob->setAttribute("ANTYPE", item->annotation().Type());
01275               ob->setAttribute("ANACTION", item->annotation().Action());
01276               ob->setAttribute("ANEACT", item->annotation().E_act());
01277               ob->setAttribute("ANXACT", item->annotation().X_act());
01278               ob->setAttribute("ANDACT", item->annotation().D_act());
01279               ob->setAttribute("ANFOACT", item->annotation().Fo_act());
01280               ob->setAttribute("ANBLACT", item->annotation().Bl_act());
01281               ob->setAttribute("ANKACT", item->annotation().K_act());
01282               ob->setAttribute("ANFACT", item->annotation().F_act());
01283               ob->setAttribute("ANVACT", item->annotation().V_act());
01284               ob->setAttribute("ANCACT", item->annotation().C_act());
01285               if (item->annotation().ActionType() == 8)
01286                      ob->setAttribute("ANEXTERN", item->annotation().Extern());
01287               else
01288                      ob->setAttribute("ANEXTERN", Path2Relative(item->annotation().Extern()));
01289               ob->setAttribute("ANZIEL", item->annotation().Ziel());
01290               ob->setAttribute("ANACTYP", item->annotation().ActionType());
01291               ob->setAttribute("ANTOOLTIP", item->annotation().ToolTip());
01292               ob->setAttribute("ANBWID", item->annotation().Bwid());
01293               ob->setAttribute("ANBSTY", item->annotation().Bsty());
01294               ob->setAttribute("ANFEED", item->annotation().Feed());
01295               ob->setAttribute("ANFLAG", item->annotation().Flag());
01296               ob->setAttribute("ANFONT", item->annotation().Font());
01297               ob->setAttribute("ANFORMAT", item->annotation().Format());
01298               ob->setAttribute("ANROLL", item->annotation().RollOver());
01299               ob->setAttribute("ANDOWN", item->annotation().Down());
01300               ob->setAttribute("ANVIS", item->annotation().Vis());
01301               ob->setAttribute("ANMC", item->annotation().MaxChar());
01302               ob->setAttribute("ANCHK", item->annotation().IsChk());
01303               ob->setAttribute("ANAA", item->annotation().AAact());
01304               ob->setAttribute("ANCHKS", item->annotation().ChkStil());
01305               ob->setAttribute("ANBCOL", item->annotation().borderColor());
01306               ob->setAttribute("ANHTML", item->annotation().HTML());
01307               ob->setAttribute("ANICON", item->annotation().UseIcons());
01308               ob->setAttribute("ANPLACE", item->annotation().IPlace());
01309               ob->setAttribute("ANSCALE", item->annotation().ScaleW());
01310        }
01311        else
01312               ob->setAttribute("ANNOTATION",0);
01313        ob->setAttribute("ANNAME", !item->AutoName ? item->itemName() : QString(""));
01314        // "TEXTFLOWMODE" succeed to "TEXTFLOW" "TEXTFLOW2" and "TEXTFLOW3" attributes
01315        ob->setAttribute("TEXTFLOWMODE", (int) item->textFlowMode() );
01316        // Set "TEXTFLOW" "TEXTFLOW2" and "TEXTFLOW3" attributes for compatibility
01317        // with versions prior to 1.3.4
01318        ob->setAttribute("TEXTFLOW" , item->textFlowAroundObject() ? 1 : 0);
01319        ob->setAttribute("TEXTFLOW2", item->textFlowUsesBoundingBox() ? 1 : 0);
01320        ob->setAttribute("TEXTFLOW3", item->textFlowUsesContourLine() ? 1 : 0);
01321        ob->setAttribute("AUTOTEXT", item->isAutoText ? 1 : 0);
01322        ob->setAttribute("EXTRA",item->textToFrameDistLeft());
01323        ob->setAttribute("TEXTRA",item->textToFrameDistTop());
01324        ob->setAttribute("BEXTRA",item->textToFrameDistBottom());
01325        ob->setAttribute("REXTRA",item->textToFrameDistRight());
01326        if (((item->asImageFrame()) || (item->asTextFrame())) && (!item->Pfile.isEmpty()))
01327               ob->setAttribute("PFILE",Path2Relative(item->Pfile));
01328        else
01329               ob->setAttribute("PFILE","");
01330        if (!item->Pfile2.isEmpty())
01331               ob->setAttribute("PFILE2",Path2Relative(item->Pfile2));
01332        else
01333               ob->setAttribute("PFILE2","");
01334        if (!item->Pfile3.isEmpty())
01335               ob->setAttribute("PFILE3",Path2Relative(item->Pfile3));
01336        else
01337               ob->setAttribute("PFILE3","");
01338        ob->setAttribute("PRFILE",item->IProfile);
01339        ob->setAttribute("EPROF", item->EmProfile);
01340        ob->setAttribute("IRENDER",item->IRender);
01341        ob->setAttribute("EMBEDDED", item->UseEmbedded ? 1 : 0);
01342        ob->setAttribute("LOCK", item->locked() ? 1 : 0);
01343        ob->setAttribute("LOCKR", item->sizeLocked() ? 1 : 0);
01344        ob->setAttribute("REVERS", item->reversed() ? 1 : 0);
01345        ob->setAttribute("TransValue", item->fillTransparency());
01346        ob->setAttribute("TransValueS", item->lineTransparency());
01347        ob->setAttribute("TransBlend", item->fillBlendmode());
01348        ob->setAttribute("TransBlendS", item->lineBlendmode());
01349        ob->setAttribute("isTableItem", static_cast<int>(item->isTableItem));
01350        ob->setAttribute("TopLine", static_cast<int>(item->TopLine));
01351        ob->setAttribute("LeftLine", static_cast<int>(item->LeftLine));
01352        ob->setAttribute("RightLine", static_cast<int>(item->RightLine));
01353        ob->setAttribute("BottomLine", static_cast<int>(item->BottomLine));
01354        if (item->isTableItem)
01355        {
01356               if (item->TopLink != 0)
01357                      ob->setAttribute("TopLINK", item->TopLink->ItemNr);
01358               else
01359                      ob->setAttribute("TopLINK", -1);
01360               if (item->LeftLink != 0)
01361                      ob->setAttribute("LeftLINK", item->LeftLink->ItemNr);
01362               else
01363                      ob->setAttribute("LeftLINK", -1);
01364               if (item->RightLink != 0)
01365                      ob->setAttribute("RightLINK", item->RightLink->ItemNr);
01366               else
01367                      ob->setAttribute("RightLINK", -1);
01368               if (item->BottomLink != 0)
01369                      ob->setAttribute("BottomLINK", item->BottomLink->ItemNr);
01370               else
01371                      ob->setAttribute("BottomLINK", -1);
01372               ob->setAttribute("OwnLINK", item->ItemNr);
01373        }
01374        ob->setAttribute("isGroupControl", static_cast<int>(item->isGroupControl));
01375        if (item->isGroupControl)
01376        {
01377               if (item->groupsLastItem != 0)
01378                      ob->setAttribute("groupsLastItem", item->groupsLastItem->ItemNr - item->ItemNr);
01379        }
01380        ob->setAttribute("NUMDASH", static_cast<int>(item->DashValues.count()));
01381        QString dlp = "";
01382        QValueList<double>::Iterator dax;
01383        for (dax = item->DashValues.begin(); dax != item->DashValues.end(); ++dax)
01384               dlp += tmp.setNum((*dax)) + " ";
01385        ob->setAttribute("DASHS", dlp);
01386        ob->setAttribute("DASHOFF", item->DashOffset);
01387        ob->setAttribute("NUMPO",item->PoLine.size());
01388        QString polp = "";
01389        for (uint nxx=0; nxx<item->PoLine.size(); ++nxx)
01390        {
01391               item->PoLine.point(nxx, &xf, &yf);
01392               polp += tmp.setNum(xf) + " " + tmpy.setNum(yf) + " ";
01393        }
01394        ob->setAttribute("POCOOR", polp);
01395        ob->setAttribute("NUMCO",item->ContourLine.size());
01396        QString colp = "";
01397        for (uint nxx=0; nxx<item->ContourLine.size(); ++nxx)
01398        {
01399               item->ContourLine.point(nxx, &xf, &yf);
01400               colp += tmp.setNum(xf) + " " + tmpy.setNum(yf) + " ";
01401        }
01402        ob->setAttribute("COCOOR", colp);
01403        ob->setAttribute("NUMGROUP", static_cast<int>(item->Groups.count()));
01404        QString glp = "";
01405        QValueStack<int>::Iterator nx;
01406        for (nx = item->Groups.begin(); nx != item->Groups.end(); ++nx)
01407               glp += tmp.setNum((*nx)) + " ";
01408        ob->setAttribute("GROUPS", glp);
01409        if ( ! item->itemText.defaultStyle().charStyle().isInhLanguage())
01410               ob->setAttribute("LANGUAGE", item->itemText.defaultStyle().charStyle().language());
01411        ob->setAttribute("startArrowIndex", item->startArrowIndex());
01412        ob->setAttribute("endArrowIndex", item->endArrowIndex());
01413 }