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