00001
00002
00003
00004
00005
00006
00007 #include "scribus13format.h"
00008
00009 #include "scribus13formatimpl.h"
00010
00011 #include "../../formatidlist.h"
00012 #include "commonstrings.h"
00013 #include "missing.h"
00014 #include "prefsmanager.h"
00015 #include "scconfig.h"
00016 #include "scribusdoc.h"
00017 #include "scribusview.h"
00018 #include "sccolorengine.h"
00019
00020 #include "units.h"
00021 #include "util.h"
00022 #include "util_math.h"
00023 #include "util_color.h"
00024 #include "scgzfile.h"
00025 #include <QCursor>
00026 #include <QFileInfo>
00027
00028 #include <QByteArray>
00029 #include <QDataStream>
00030 #include <QTextStream>
00031 #include <QApplication>
00032
00033
00034
00035
00036
00037
00038
00039 Scribus13Format::Scribus13Format() :
00040 LoadSavePlugin()
00041 {
00042
00043
00044 languageChange();
00045 }
00046
00047 Scribus13Format::~Scribus13Format()
00048 {
00049 unregisterAll();
00050 };
00051
00052 void Scribus13Format::languageChange()
00053 {
00054
00055 unregisterAll();
00056 registerFormats();
00057 }
00058
00059 const QString Scribus13Format::fullTrName() const
00060 {
00061 return QObject::tr("Scribus 1.3.0->1.3.3.x Support");
00062 }
00063
00064 const ScActionPlugin::AboutData* Scribus13Format::getAboutData() const
00065 {
00066 AboutData* about = new AboutData;
00067 Q_CHECK_PTR(about);
00068 return about;
00069 }
00070
00071 void Scribus13Format::deleteAboutData(const AboutData* about) const
00072 {
00073 Q_ASSERT(about);
00074 delete about;
00075 }
00076
00077 void Scribus13Format::registerFormats()
00078 {
00079 FileFormat fmt(this);
00080 fmt.trName = tr("Scribus 1.3.0->1.3.3.7 Document");
00081 fmt.formatId = FORMATID_SLA13XIMPORT;
00082 fmt.load = true;
00083 fmt.save = false;
00084 fmt.filter = fmt.trName + " (*.sla *.SLA *.sla.gz *.SLA.GZ *.scd *.SCD *.scd.gz *.SCD.GZ)";
00085 fmt.nameMatch = QRegExp("\\.(sla|scd)(\\.gz)?", Qt::CaseInsensitive);
00086 fmt.mimeTypes = QStringList();
00087 fmt.mimeTypes.append("application/x-scribus");
00088 fmt.priority = 64;
00089 registerFormat(fmt);
00090 }
00091
00092 bool Scribus13Format::fileSupported(QIODevice* , const QString & fileName) const
00093 {
00094 QByteArray docBytes("");
00095 if(fileName.right(2) == "gz")
00096 {
00097 ScGzFile gzf(fileName);
00098 if (!gzf.read(4096))
00099 {
00100
00101 return false;
00102 }
00103 docBytes = gzf.data();
00104 }
00105 else
00106 {
00107
00108 loadRawText(fileName, docBytes);
00109 }
00110 if (docBytes.left(16) == "<SCRIBUSUTF8NEW " && !docBytes.left(35).contains("Version=\"1.3.4"))
00111 return true;
00112 return false;
00113 }
00114
00115 QString Scribus13Format::readSLA(const QString & fileName)
00116 {
00117 QByteArray docBytes("");
00118 if(fileName.right(2) == "gz")
00119 {
00120 ScGzFile gzf(fileName);
00121 if (!gzf.read())
00122 {
00123
00124 return false;
00125 }
00126 docBytes = gzf.data();
00127 }
00128 else
00129 {
00130
00131 loadRawText(fileName, docBytes);
00132 }
00133 QString docText("");
00134 if (docBytes.left(16) == "<SCRIBUSUTF8NEW " && !docBytes.left(35).contains("Version=\"1.3.4"))
00135 docText = QString::fromUtf8(docBytes);
00136 else
00137 return QString::null;
00138 if (docText.endsWith(QChar(10)) || docText.endsWith(QChar(13)))
00139 docText.truncate(docText.length()-1);
00140 return docText;
00141 }
00142
00143 void Scribus13Format::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QList<ScFace> &getDummyScFaces)
00144 {
00145 getNewReplacement=newReplacement;
00146 getReplacedFonts=ReplacedFonts;
00147
00148 }
00149
00150 bool Scribus13Format::loadFile(const QString & fileName, const FileFormat & , int , int )
00151 {
00152 if (m_Doc==0 || m_AvailableFonts==0)
00153 {
00154 Q_ASSERT(m_Doc==0 || m_AvailableFonts==0);
00155 return false;
00156 }
00157 ReplacedFonts.clear();
00158 newReplacement = false;
00159 ParagraphStyle vg;
00160 struct ScribusDoc::BookMa bok;
00161 int counter;
00162
00163 bool newVersion = false;
00164 QString tmp, tmpf, tmp2, tmp3, tmp4, PgNam, Defont, tmf;
00165 QFont fo;
00166 QMap<int,int> TableID;
00167 QList<PageItem*> TableItems;
00168 QMap<int,int> TableIDM;
00169 QList<PageItem*> TableItemsM;
00170 QMap<int,int> TableIDF;
00171 QList<PageItem*> TableItemsF;
00172 int a;
00173 PageItem *Neu;
00174 Page* Apage;
00175 itemRemap.clear();
00176 itemNext.clear();
00177 itemCount = 0;
00178 DoVorl.clear();
00179 DoVorl[0] = "";
00180 DoVorl[1] = "";
00181 DoVorl[2] = "";
00182 DoVorl[3] = "";
00183 DoVorl[4] = "";
00184 VorlC = 5;
00185 QDomDocument docu("scridoc");
00186 QString f(readSLA(fileName));
00187 if (f.isEmpty())
00188 return false;
00189 QString fileDir = QFileInfo(fileName).absolutePath();
00190
00191
00192 if (!docu.setContent(f))
00193 return false;
00194 m_Doc->PageColors.clear();
00195 m_Doc->Layers.clear();
00196 int layerToSetActive=0;
00197 ScColor lf = ScColor();
00198 QDomElement elem=docu.documentElement();
00199 if (elem.tagName() != "SCRIBUSUTF8NEW")
00200 return false;
00201 if (elem.hasAttribute("Version"))
00202 newVersion = true;
00203 QDomNode DOC=elem.firstChild();
00204 if (m_mwProgressBar!=0)
00205 {
00206 m_mwProgressBar->setMaximum(DOC.childNodes().count());
00207 m_mwProgressBar->setValue(0);
00208 }
00209 int ObCount = 0;
00210 TableItems.clear();
00211 TableID.clear();
00212 TableItemsM.clear();
00213 TableIDM.clear();
00214 TableItemsF.clear();
00215 TableIDF.clear();
00216 PrefsManager* prefsManager=PrefsManager::instance();
00217 while(!DOC.isNull())
00218 {
00219 QDomElement dc=DOC.toElement();
00220
00221
00222
00223
00224
00225 m_Doc->m_pageSize = dc.attribute("PAGESIZE");
00226 m_Doc->PageOri = dc.attribute("ORIENTATION", "0").toInt();
00227 m_Doc->FirstPnum = dc.attribute("FIRSTNUM", "1").toInt();
00228 m_Doc->currentPageLayout=dc.attribute("BOOK", "0").toInt();
00229 int fp;
00230 if (m_Doc->currentPageLayout == 0)
00231 fp = 0;
00232 else
00233 {
00234 if (dc.attribute("FIRSTLEFT", "0").toInt() == 1)
00235 fp = 0;
00236 else
00237 fp = 1;
00238 }
00239 if (DOC.namedItem("PageSets").isNull())
00240 {
00241 m_Doc->pageSets[m_Doc->currentPageLayout].FirstPage = fp;
00242
00243
00244
00245 }
00246 m_Doc->setUsesAutomaticTextFrames(dc.attribute("AUTOTEXT").toInt());
00247 m_Doc->PageSp=dc.attribute("AUTOSPALTEN").toInt();
00248 m_Doc->PageSpa=dc.attribute("ABSTSPALTEN").toDouble();
00249 m_Doc->setUnitIndex(dc.attribute("UNITS", "0").toInt());
00250 m_Doc->toolSettings.defSize=qRound(dc.attribute("DSIZE").toDouble() * 10);
00251 Defont=dc.attribute("DFONT");
00252
00253 m_Doc->toolSettings.defFont = prefsManager->appPrefs.toolSettings.defFont;
00254 m_AvailableFonts->findFont(Defont, m_Doc);
00255 m_Doc->toolSettings.defFont = Defont;
00256 m_Doc->toolSettings.dCols=dc.attribute("DCOL", "1").toInt();
00257 m_Doc->toolSettings.dGap=dc.attribute("DGAP", "0.0").toDouble();
00258 m_Doc->documentInfo.setAuthor(dc.attribute("AUTHOR"));
00259 m_Doc->documentInfo.setComments(dc.attribute("COMMENTS"));
00260 m_Doc->documentInfo.setKeywords(dc.attribute("KEYWORDS",""));
00261 m_Doc->documentInfo.setTitle(dc.attribute("TITLE"));
00262 m_Doc->documentInfo.setPublisher(dc.attribute("PUBLISHER", ""));
00263 m_Doc->documentInfo.setDate(dc.attribute("DOCDATE", ""));
00264 m_Doc->documentInfo.setType(dc.attribute("DOCTYPE", ""));
00265 m_Doc->documentInfo.setFormat(dc.attribute("DOCFORMAT", ""));
00266 m_Doc->documentInfo.setIdent(dc.attribute("DOCIDENT", ""));
00267 m_Doc->documentInfo.setSource(dc.attribute("DOCSOURCE", ""));
00268 m_Doc->documentInfo.setLangInfo(dc.attribute("DOCLANGINFO", ""));
00269 m_Doc->documentInfo.setRelation(dc.attribute("DOCRELATION", ""));
00270 m_Doc->documentInfo.setCover(dc.attribute("DOCCOVER", ""));
00271 m_Doc->documentInfo.setRights(dc.attribute("DOCRIGHTS", ""));
00272 m_Doc->documentInfo.setContrib(dc.attribute("DOCCONTRIB", ""));
00273 m_Doc->typographicSettings.valueSuperScript = dc.attribute("VHOCH").toInt();
00274 m_Doc->typographicSettings.scalingSuperScript = dc.attribute("VHOCHSC").toInt();
00275 m_Doc->typographicSettings.valueSubScript = dc.attribute("VTIEF").toInt();
00276 m_Doc->typographicSettings.scalingSubScript = dc.attribute("VTIEFSC").toInt();
00277 m_Doc->typographicSettings.valueSmallCaps = dc.attribute("VKAPIT").toInt();
00278 m_Doc->typographicSettings.valueBaseGrid = dc.attribute("BASEGRID", "12").toDouble();
00279 m_Doc->typographicSettings.offsetBaseGrid = dc.attribute("BASEO", "0").toDouble();
00280 m_Doc->typographicSettings.autoLineSpacing = dc.attribute("AUTOL", "20").toInt();
00281 m_Doc->typographicSettings.valueUnderlinePos = dc.attribute("UnderlinePos", "-1").toInt();
00282 m_Doc->typographicSettings.valueUnderlineWidth = dc.attribute("UnderlineWidth", "-1").toInt();
00283 m_Doc->typographicSettings.valueStrikeThruPos = dc.attribute("StrikeThruPos", "-1").toInt();
00284 m_Doc->typographicSettings.valueStrikeThruWidth = dc.attribute("StrikeThruWidth", "-1").toInt();
00285 m_Doc->GroupCounter=dc.attribute("GROUPC", "1").toInt();
00286
00287 m_Doc->CMSSettings.SoftProofOn = static_cast<bool>(dc.attribute("DPSo", "0").toInt());
00288 m_Doc->CMSSettings.SoftProofFullOn = static_cast<bool>(dc.attribute("DPSFo", "0").toInt());
00289 m_Doc->CMSSettings.CMSinUse = static_cast<bool>(dc.attribute("DPuse", "0").toInt());
00290 m_Doc->CMSSettings.GamutCheck = static_cast<bool>(dc.attribute("DPgam", "0").toInt());
00291 m_Doc->CMSSettings.BlackPoint = static_cast<bool>(dc.attribute("DPbla", "1").toInt());
00292 m_Doc->CMSSettings.DefaultMonitorProfile = dc.attribute("DPMo","");
00293 m_Doc->CMSSettings.DefaultPrinterProfile = dc.attribute("DPPr","");
00294 m_Doc->CMSSettings.DefaultImageRGBProfile = dc.attribute("DPIn","");
00295 m_Doc->CMSSettings.DefaultImageCMYKProfile = dc.attribute("DPInCMYK","");
00296 m_Doc->CMSSettings.DefaultSolidColorRGBProfile = dc.attribute("DPIn2","");
00297 if (dc.hasAttribute("DPIn3"))
00298 m_Doc->CMSSettings.DefaultSolidColorCMYKProfile = dc.attribute("DPIn3","");
00299 else
00300 m_Doc->CMSSettings.DefaultSolidColorCMYKProfile = dc.attribute("DPPr","");
00301
00302
00303 m_Doc->CMSSettings.DefaultIntentColors = dc.attribute("DISc", "1").toInt();
00304 m_Doc->CMSSettings.DefaultIntentImages = dc.attribute("DIIm", "0").toInt();
00305 layerToSetActive=dc.attribute("ALAYER", "0").toInt();
00306 m_Doc->Language = dc.attribute("LANGUAGE", "");
00307 m_Doc->MinWordLen = dc.attribute("MINWORDLEN", "3").toInt();
00308 m_Doc->HyCount = dc.attribute("HYCOUNT", "2").toInt();
00309 if (dc.hasAttribute("PAGEWIDTH"))
00310 m_Doc->pageWidth=dc.attribute("PAGEWIDTH").toDouble();
00311 else
00312 m_Doc->pageWidth=dc.attribute("PAGEWITH").toDouble();
00313 m_Doc->pageHeight=dc.attribute("PAGEHEIGHT").toDouble();
00314 m_Doc->pageMargins.Left=qMax(0.0, dc.attribute("BORDERLEFT").toDouble());
00315 m_Doc->pageMargins.Right=qMax(0.0, dc.attribute("BORDERRIGHT").toDouble());
00316 m_Doc->pageMargins.Top=qMax(0.0, dc.attribute("BORDERTOP").toDouble());
00317 m_Doc->pageMargins.Bottom=qMax(0.0, dc.attribute("BORDERBOTTOM").toDouble());
00318 m_Doc->Automatic = static_cast<bool>(dc.attribute("AUTOMATIC", "1").toInt());
00319 m_Doc->AutoCheck = static_cast<bool>(dc.attribute("AUTOCHECK", "0").toInt());
00320 m_Doc->GuideLock = static_cast<bool>(dc.attribute("GUIDELOCK", "0").toInt());
00321 m_Doc->guidesSettings.minorGrid = dc.attribute("MINGRID", tmp.setNum(prefsManager->appPrefs.guidesSettings.minorGrid)).toDouble();
00322 m_Doc->guidesSettings.majorGrid = dc.attribute("MAJGRID", tmp.setNum(prefsManager->appPrefs.guidesSettings.majorGrid)).toDouble();
00323 m_Doc->guidesSettings.gridShown = static_cast<bool>(dc.attribute("SHOWGRID", "0").toInt());
00324 m_Doc->guidesSettings.guidesShown = static_cast<bool>(dc.attribute("SHOWGUIDES", "1").toInt());
00325 m_Doc->guidesSettings.colBordersShown = static_cast<bool>(dc.attribute("showcolborders", "0").toInt());
00326 m_Doc->guidesSettings.framesShown = static_cast<bool>(dc.attribute("SHOWFRAME", "1").toInt());
00327 m_Doc->guidesSettings.layerMarkersShown = static_cast<bool>(dc.attribute("SHOWLAYERM", "0").toInt());
00328 m_Doc->guidesSettings.marginsShown = static_cast<bool>(dc.attribute("SHOWMARGIN", "1").toInt());
00329 m_Doc->guidesSettings.baseShown = static_cast<bool>(dc.attribute("SHOWBASE", "0").toInt());
00330 m_Doc->guidesSettings.showPic = static_cast<bool>(dc.attribute("SHOWPICT", "1").toInt());
00331 m_Doc->guidesSettings.linkShown = static_cast<bool>(dc.attribute("SHOWLINK", "0").toInt());
00332 m_Doc->guidesSettings.showControls = static_cast<bool>(dc.attribute("SHOWControl", "0").toInt());
00333 m_Doc->guidesSettings.rulerMode = static_cast<bool>(dc.attribute("rulerMode", "1").toInt());
00334 m_Doc->guidesSettings.rulersShown = static_cast<bool>(dc.attribute("showrulers", "1").toInt());
00335 m_Doc->rulerXoffset = dc.attribute("rulerXoffset", "0").toDouble();
00336 m_Doc->rulerYoffset =dc.attribute("rulerYoffset", "0").toDouble();
00337 m_Doc->SnapGuides = static_cast<bool>(dc.attribute("SnapToGuides", "0").toInt());
00338 m_Doc->useRaster = static_cast<bool>(dc.attribute("SnapToGrid", "0").toInt());
00339 m_Doc->toolSettings.polyC = dc.attribute("POLYC", "4").toInt();
00340 m_Doc->toolSettings.polyF = dc.attribute("POLYF", "0.5").toDouble();
00341 m_Doc->toolSettings.polyR = dc.attribute("POLYR", "0").toDouble();
00342 m_Doc->toolSettings.polyFd = dc.attribute("POLYFD", "0").toInt();
00343 m_Doc->toolSettings.polyS = static_cast<bool>(dc.attribute("POLYS", "0").toInt());
00344 m_Doc->AutoSave = static_cast<bool>(dc.attribute("AutoSave", "0").toInt());
00345 m_Doc->AutoSaveTime = dc.attribute("AutoSaveTime", "600000").toInt();
00346 m_Doc->scratch.Bottom = dc.attribute("ScratchBottom", "20").toDouble();
00347
00348
00349 if (dc.hasAttribute("ScatchLeft"))
00350 m_Doc->scratch.Left = dc.attribute("ScatchLeft", "100").toDouble();
00351 else
00352 m_Doc->scratch.Left = dc.attribute("ScratchLeft", "100").toDouble();
00353 m_Doc->scratch.Right = dc.attribute("ScratchRight", "100").toDouble();
00354 m_Doc->scratch.Top = dc.attribute("ScratchTop", "20").toDouble();
00355 m_Doc->toolSettings.dStartArrow = dc.attribute("StartArrow", "0").toInt();
00356 m_Doc->toolSettings.dEndArrow = dc.attribute("EndArrow", "0").toInt();
00357 m_Doc->toolSettings.scaleX = dc.attribute("PICTSCX", "1").toDouble();
00358 m_Doc->toolSettings.scaleY = dc.attribute("PICTSCY", "1").toDouble();
00359 m_Doc->toolSettings.scaleType = static_cast<bool>(dc.attribute("PSCALE", "1").toInt());
00360 m_Doc->toolSettings.aspectRatio = static_cast<bool>(dc.attribute("PASPECT", "0").toInt());
00361 m_Doc->toolSettings.lowResType = dc.attribute("HalfRes", "1").toInt();
00362 m_Doc->toolSettings.useEmbeddedPath = static_cast<bool>(dc.attribute("EmbeddedPath", "0").toInt());
00363 if (dc.hasAttribute("PEN"))
00364 m_Doc->toolSettings.dPen = dc.attribute("PEN");
00365 if (dc.hasAttribute("BRUSH"))
00366 m_Doc->toolSettings.dBrush = dc.attribute("BRUSH");
00367 if (dc.hasAttribute("PENLINE"))
00368 m_Doc->toolSettings.dPenLine = dc.attribute("PENLINE");
00369 if (dc.hasAttribute("PENTEXT"))
00370 m_Doc->toolSettings.dPenText = dc.attribute("PENTEXT");
00371 if (dc.hasAttribute("StrokeText"))
00372 m_Doc->toolSettings.dStrokeText = dc.attribute("StrokeText");
00373 m_Doc->toolSettings.dTextBackGround = dc.attribute("TextBackGround", CommonStrings::None);
00374 m_Doc->toolSettings.dTextLineColor = dc.attribute("TextLineColor", CommonStrings::None);
00375 m_Doc->toolSettings.dTextBackGroundShade = dc.attribute("TextBackGroundShade", "100").toInt();
00376 m_Doc->toolSettings.dTextLineShade = dc.attribute("TextLineShade", "100").toInt();
00377 m_Doc->toolSettings.dTextPenShade = dc.attribute("TextPenShade", "100").toInt();
00378 m_Doc->toolSettings.dTextStrokeShade = dc.attribute("TextStrokeShade", "100").toInt();
00379 m_Doc->toolSettings.dLineArt = static_cast<Qt::PenStyle>(dc.attribute("STIL").toInt());
00380 m_Doc->toolSettings.dLstyleLine = static_cast<Qt::PenStyle>(dc.attribute("STILLINE").toInt());
00381 m_Doc->toolSettings.dWidth = dc.attribute("WIDTH", "1").toDouble();
00382 m_Doc->toolSettings.dWidthLine = dc.attribute("WIDTHLINE", "1").toDouble();
00383 m_Doc->toolSettings.dShade2 = dc.attribute("PENSHADE", "100").toInt();
00384 m_Doc->toolSettings.dShadeLine = dc.attribute("LINESHADE", "100").toInt();
00385 m_Doc->toolSettings.dShade = dc.attribute("BRUSHSHADE", "100").toInt();
00386 m_Doc->toolSettings.magMin = dc.attribute("MAGMIN", "10").toInt();
00387 m_Doc->toolSettings.magMax = dc.attribute("MAGMAX", "3200").toInt();
00388 m_Doc->toolSettings.magStep = dc.attribute("MAGSTEP", "200").toInt();
00389
00390 if (m_Doc->toolSettings.magStep<100)
00391 m_Doc->toolSettings.magStep=200;
00392 m_Doc->toolSettings.tabFillChar = dc.attribute("TabFill","");
00393 m_Doc->toolSettings.dTabWidth=dc.attribute("TabWidth", "36.0").toDouble();
00394 if (dc.hasAttribute("CPICT"))
00395 m_Doc->toolSettings.dBrushPict = dc.attribute("CPICT");
00396 m_Doc->toolSettings.shadePict = dc.attribute("PICTSHADE", "100").toInt();
00397 if (dc.hasAttribute("PAGEC"))
00398 m_Doc->papColor = QColor(dc.attribute("PAGEC"));
00399 if (dc.hasAttribute("MARGC"))
00400 m_Doc->guidesSettings.margColor = QColor(dc.attribute("MARGC"));
00401 if (dc.hasAttribute("MINORC"))
00402 m_Doc->guidesSettings.minorColor = QColor(dc.attribute("MINORC"));
00403 if (dc.hasAttribute("MAJORC"))
00404 m_Doc->guidesSettings.majorColor = QColor(dc.attribute("MAJORC"));
00405 if (dc.hasAttribute("GuideC"))
00406 m_Doc->guidesSettings.guideColor = QColor(dc.attribute("GuideC"));
00407 if (dc.hasAttribute("BaseC"))
00408 m_Doc->guidesSettings.baseColor = QColor(dc.attribute("BaseC"));
00409 m_Doc->marginColored = static_cast<bool>(dc.attribute("RANDF", "0").toInt());
00410 m_Doc->guidesSettings.before = static_cast<bool>(dc.attribute("BACKG", "1").toInt());
00411 m_Doc->guidesSettings.guideRad = dc.attribute("GuideRad", "10").toDouble();
00412 m_Doc->guidesSettings.grabRad = dc.attribute("GRAB", "4").toInt();
00413 if (dc.hasAttribute("currentProfile"))
00414 {
00415 m_Doc->checkerProfiles.clear();
00416 m_Doc->curCheckProfile = dc.attribute("currentProfile");
00417 }
00418 m_Doc->LastAuto = 0;
00419 QDomNode PAGE=DOC.firstChild();
00420 counter = 0;
00421 while(!PAGE.isNull())
00422 {
00423 ObCount++;
00424 if (m_mwProgressBar!=0)
00425 m_mwProgressBar->setValue(ObCount);
00426 QDomElement pg=PAGE.toElement();
00427 if (pg.tagName()=="PageSets")
00428 {
00429 QDomNode PGS = PAGE.firstChild();
00430 m_Doc->pageSets.clear();
00431 while(!PGS.isNull())
00432 {
00433 QDomElement PgsAttr = PGS.toElement();
00434 if(PgsAttr.tagName() == "Set")
00435 {
00436 struct PageSet pageS;
00437 pageS.Name = CommonStrings::untranslatePageSetString(PgsAttr.attribute("Name"));
00438 pageS.FirstPage = PgsAttr.attribute("FirstPage", "0").toInt();
00439 pageS.Rows = PgsAttr.attribute("Rows", "1").toInt();
00440 pageS.Columns = PgsAttr.attribute("Columns", "1").toInt();
00441
00442
00443
00444 pageS.pageNames.clear();
00445 QDomNode PGSN = PGS.firstChild();
00446 while(!PGSN.isNull())
00447 {
00448 QDomElement PgsAttrN = PGSN.toElement();
00449 if(PgsAttrN.tagName() == "PageNames")
00450 pageS.pageNames.append(CommonStrings::untranslatePageSetLocString(PgsAttrN.attribute("Name")));
00451 PGSN = PGSN.nextSibling();
00452 }
00453 m_Doc->pageSets.append(pageS);
00454 if (m_Doc->pageSets.count()-1 == m_Doc->currentPageLayout)
00455 {
00456 m_Doc->GapHorizontal = PgsAttr.attribute("GapHorizontal", "0").toDouble();
00457 m_Doc->GapVertical = PgsAttr.attribute("GapBelow", "0").toDouble();
00458 }
00459 }
00460 PGS = PGS.nextSibling();
00461 }
00462 }
00463 if (pg.tagName()=="CheckProfile")
00464 {
00465 struct checkerPrefs checkerSettings;
00466 checkerSettings.ignoreErrors = static_cast<bool>(pg.attribute("ignoreErrors", "0").toInt());
00467 checkerSettings.autoCheck = static_cast<bool>(pg.attribute("autoCheck", "1").toInt());
00468 checkerSettings.checkGlyphs = static_cast<bool>(pg.attribute("checkGlyphs", "1").toInt());
00469 checkerSettings.checkOrphans = static_cast<bool>(pg.attribute("checkOrphans", "1").toInt());
00470 checkerSettings.checkOverflow = static_cast<bool>(pg.attribute("checkOverflow", "1").toInt());
00471 checkerSettings.checkPictures = static_cast<bool>(pg.attribute("checkPictures", "1").toInt());
00472 checkerSettings.checkResolution = static_cast<bool>(pg.attribute("checkResolution", "1").toInt());
00473 checkerSettings.checkTransparency = static_cast<bool>(pg.attribute("checkTransparency", "1").toInt());
00474 checkerSettings.minResolution = pg.attribute("minResolution", "72").toDouble();
00475 checkerSettings.maxResolution = pg.attribute("maxResolution", "4800").toDouble();
00476 checkerSettings.checkAnnotations = static_cast<bool>(pg.attribute("checkAnnotations", "0").toInt());
00477 checkerSettings.checkRasterPDF = static_cast<bool>(pg.attribute("checkRasterPDF", "1").toInt());
00478 checkerSettings.checkForGIF = static_cast<bool>(pg.attribute("checkForGIF", "1").toInt());
00479 checkerSettings.ignoreOffLayers = false;
00480 m_Doc->checkerProfiles[pg.attribute("Name")] = checkerSettings;
00481 }
00482
00483 if(pg.tagName()=="COLOR" && pg.attribute("NAME")!=CommonStrings::None)
00484 {
00485 if (pg.hasAttribute("CMYK"))
00486 lf.setNamedColor(pg.attribute("CMYK"));
00487 else
00488 lf.fromQColor(QColor(pg.attribute("RGB")));
00489 if (pg.hasAttribute("Spot"))
00490 lf.setSpotColor(static_cast<bool>(pg.attribute("Spot").toInt()));
00491 else
00492 lf.setSpotColor(false);
00493 if (pg.hasAttribute("Register"))
00494 lf.setRegistrationColor(static_cast<bool>(pg.attribute("Register").toInt()));
00495 else
00496 lf.setRegistrationColor(false);
00497 QString name = pg.attribute("NAME");
00498 m_Doc->PageColors.insert((name.isEmpty()) ? lf.name() : name, lf);
00499 }
00500 if(pg.tagName()=="STYLE")
00501 {
00502 readParagraphStyle(vg, pg, m_Doc);
00503 StyleSet<ParagraphStyle> temp;
00504 temp.create(vg);
00505 m_Doc->redefineStyles(temp, false);
00506 DoVorl[VorlC] = vg.name();
00507 ++VorlC;
00508 }
00509 if(pg.tagName()=="JAVA")
00510 m_Doc->JavaScripts[pg.attribute("NAME")] = pg.attribute("SCRIPT");
00511 if(pg.tagName()=="LAYERS")
00512 {
00513 int lnr = pg.attribute("NUMMER").toInt();
00514 int level = pg.attribute("LEVEL").toInt();
00515 ScLayer la( pg.attribute("NAME"), level, lnr);
00516 la.isViewable = pg.attribute("SICHTBAR").toInt();
00517 la.isPrintable = pg.attribute("DRUCKEN").toInt();
00518 la.isEditable = pg.attribute("EDIT", "1").toInt();
00519 la.flowControl = pg.attribute("FLOW", "1").toInt();
00520 la.transparency = pg.attribute("TRANS", "1").toDouble();
00521 la.blendMode = pg.attribute("BLEND", "0").toInt();
00522 la.outlineMode = pg.attribute("OUTL", "0").toInt();
00523 if (pg.hasAttribute("LAYERC"))
00524 la.markerColor = QColor(pg.attribute("LAYERC","#000000"));
00525 m_Doc->Layers.append(la);
00526 }
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542 if(pg.tagName()=="MultiLine")
00543 {
00544 multiLine ml;
00545 QDomNode MuLn = PAGE.firstChild();
00546 while(!MuLn.isNull())
00547 {
00548 QDomElement MuL = MuLn.toElement();
00549 struct SingleLine sl;
00550 sl.Color = MuL.attribute("Color");
00551 sl.Dash = MuL.attribute("Dash").toInt();
00552 sl.LineEnd = MuL.attribute("LineEnd").toInt();
00553 sl.LineJoin = MuL.attribute("LineJoin").toInt();
00554 sl.Shade = MuL.attribute("Shade").toInt();
00555 sl.Width = MuL.attribute("Width").toDouble();
00556 ml.push_back(sl);
00557 MuLn = MuLn.nextSibling();
00558 }
00559 m_Doc->MLineStyles.insert(pg.attribute("Name"), ml);
00560 }
00561 if(pg.tagName()=="Arrows")
00562 {
00563 struct ArrowDesc arrow;
00564 arrow.name = pg.attribute("Name");
00565 arrow.userArrow = true;
00566 double xa, ya;
00567 QString tmp = pg.attribute("Points");
00568 QTextStream fp(&tmp, QIODevice::ReadOnly);
00569 for (uint cx = 0; cx < pg.attribute("NumPoints").toUInt(); ++cx)
00570 {
00571 fp >> xa;
00572 fp >> ya;
00573 arrow.points.addPoint(xa, ya);
00574 }
00575 m_Doc->arrowStyles.append(arrow);
00576 }
00577 if(pg.tagName()=="PDF")
00578 {
00579 m_Doc->PDF_Options.Articles = static_cast<bool>(pg.attribute("Articles").toInt());
00580 m_Doc->PDF_Options.Thumbnails = static_cast<bool>(pg.attribute("Thumbnails").toInt());
00581 m_Doc->PDF_Options.Compress = static_cast<bool>(pg.attribute("Compress").toInt());
00582 m_Doc->PDF_Options.CompressMethod = (PDFOptions::PDFCompression) pg.attribute("CMethod", "0").toInt();
00583 m_Doc->PDF_Options.Quality = pg.attribute("Quality", "0").toInt();
00584 m_Doc->PDF_Options.RecalcPic = static_cast<bool>(pg.attribute("RecalcPic").toInt());
00585 m_Doc->PDF_Options.Bookmarks = static_cast<bool>(pg.attribute("Bookmarks").toInt());
00586 if (pg.hasAttribute("MirrorH"))
00587 m_Doc->PDF_Options.MirrorH = static_cast<bool>(pg.attribute("MirrorH").toInt());
00588 else
00589 m_Doc->PDF_Options.MirrorH = false;
00590 if (pg.hasAttribute("MirrorV"))
00591 m_Doc->PDF_Options.MirrorV = static_cast<bool>(pg.attribute("MirrorV").toInt());
00592 else
00593 m_Doc->PDF_Options.MirrorV = false;
00594 if (pg.hasAttribute("RotateDeg"))
00595 m_Doc->PDF_Options.RotateDeg = pg.attribute("RotateDeg", "0").toInt();
00596 else
00597 m_Doc->PDF_Options.RotateDeg = 0;
0