Rev 713 | Rev 734 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
506 | fschmid | 1 | #include "fileloader.h" |
2 | #include <qfile.h> |
||
3 | #include <qfileinfo.h> |
||
517 | fschmid | 4 | #include <qtl.h> |
5 | #include <qcursor.h> |
||
6 | #include <qregexp.h> |
||
7 | #include <qdir.h> |
||
8 | #include <qtextcodec.h> |
||
9 | #include <cstdlib> |
||
10 | #include <cmath> |
||
11 | #include <qtextstream.h> |
||
506 | fschmid | 12 | #include "scribus.h" |
13 | #include "scribusXml.h" |
||
517 | fschmid | 14 | #include "missing.h" |
617 | cbradney | 15 | #ifdef _MSC_VER |
16 | #if (_MSC_VER >= 1200) |
||
17 | #include "win-config.h" |
||
18 | #endif |
||
506 | fschmid | 19 | #else |
617 | cbradney | 20 | #include "config.h" |
506 | fschmid | 21 | #endif |
22 | #ifdef HAVE_LIBZ |
||
23 | #include <zlib.h> |
||
24 | #endif |
||
25 | extern bool loadText(QString nam, QString *Buffer); |
||
517 | fschmid | 26 | extern void GetItemProps(bool newVersion, QDomElement *obj, struct CLBuf *OB); |
27 | extern double QStodouble(QString in); |
||
28 | extern int QStoInt(QString in); |
||
690 | cbradney | 29 | extern QColor SetColor(ScribusDoc *currentDoc, QString color, int shad); |
506 | fschmid | 30 | |
31 | /*! |
||
32 | \fn FileLoader::FileLoader(QString fileName) |
||
33 | \author Franz Schmid |
||
34 | \date |
||
35 | \brief Constructor, sets the variable "FileName" to the input parameter fileName |
||
36 | \param QString fileName |
||
37 | \retval None |
||
38 | */ |
||
516 | fschmid | 39 | FileLoader::FileLoader(QString fileName, ScribusApp* app) |
506 | fschmid | 40 | { |
41 | FileName = fileName; |
||
42 | FileType = -1; |
||
516 | fschmid | 43 | havePS = app->DLLexists(6); |
44 | haveSVG = app->DLLexists(10); |
||
541 | fschmid | 45 | haveSXD = app->DLLexists(12); |
506 | fschmid | 46 | } |
47 | |||
48 | /*! |
||
49 | \fn int FileLoader::TestFile() |
||
50 | \author Franz Schmid |
||
51 | \date |
||
52 | \brief Tests if the file "FileName" exists and determines the type of the file. |
||
53 | \param None |
||
54 | \retval int -1 if the file doesn't exist or any other error has occured, 0 for the old Format, 1 for the new Format, 2 for EPS and PS files, 3 for SVG files and 4 for PDF files |
||
55 | */ |
||
56 | int FileLoader::TestFile() |
||
57 | { |
||
58 | QFileInfo fi = QFileInfo(FileName); |
||
59 | int ret = -1; |
||
60 | if (!fi.exists()) |
||
61 | ret = -1; |
||
62 | QString ext = fi.extension(true).lower(); |
||
550 | fschmid | 63 | if ((ext.endsWith("sla.gz")) || (ext.endsWith("sla")) || (ext.endsWith("scd.gz")) || (ext.endsWith("scd"))) |
506 | fschmid | 64 | ret = CheckScribus(); |
550 | fschmid | 65 | else if (((ext.endsWith("ps")) || (ext.endsWith("eps"))) && (havePS)) |
506 | fschmid | 66 | ret = 2; |
550 | fschmid | 67 | else if (((ext.endsWith("svg")) || (ext.endsWith("svgz"))) && (haveSVG)) |
506 | fschmid | 68 | ret = 3; |
550 | fschmid | 69 | else if ((ext.endsWith("sxd")) && (haveSXD)) |
541 | fschmid | 70 | ret = 5; |
506 | fschmid | 71 | /* if (ext == "pdf") |
72 | ret = 4; */ |
||
73 | FileType = ret; |
||
74 | return ret; |
||
75 | } |
||
76 | |||
77 | /*! |
||
78 | \fn int FileLoader::CheckScribus() |
||
79 | \author Franz Schmid |
||
80 | \date |
||
81 | \brief Checks which Scribus fileformat the File in FileName has. |
||
82 | \param None |
||
83 | \retval 0 for old Scribus files, 1 for Scribus files created by Scribus 1.3 and above |
||
84 | */ |
||
85 | int FileLoader::CheckScribus() |
||
86 | { |
||
87 | int ret = -1; |
||
88 | QString fText = ReadDatei(FileName); |
||
89 | if (fText == "") |
||
90 | return ret; |
||
517 | fschmid | 91 | if ((fText.startsWith("<SCRIBUSUTF8NEW")) && (fText.contains("<PAGE ", TRUE) != 0)) |
92 | return 1; |
||
506 | fschmid | 93 | if ((fText.startsWith("<SCRIBUS")) && (fText.contains("<PAGE ", TRUE) != 0)) |
94 | return 0; |
||
95 | return ret; |
||
96 | } |
||
97 | |||
98 | /*! |
||
99 | \fn QString FileLoader::ReadDatei(QString fileName) |
||
100 | \author Franz Schmid |
||
101 | \date |
||
102 | \brief Auxiliary function loads the file "fileName" into a QString and does conversion from UTF8 if required |
||
103 | \param QString fileName |
||
104 | \retval QString Contents of the file, converted from UTF8 |
||
105 | */ |
||
106 | QString FileLoader::ReadDatei(QString fileName) |
||
107 | { |
||
108 | /** |
||
109 | * added to support gz docs |
||
110 | * 2.7.2002 C.Toepp |
||
111 | * <c.toepp@gmx.de> |
||
112 | */ |
||
113 | QString f = ""; |
||
114 | #ifdef HAVE_LIBZ |
||
115 | if(fileName.right(2) == "gz") |
||
116 | { |
||
117 | gzFile gzDoc; |
||
118 | char buff[4097]; |
||
119 | int i; |
||
120 | gzDoc = gzopen(fileName.latin1(),"rb"); |
||
121 | if(gzDoc == NULL) |
||
122 | return ""; |
||
123 | while((i = gzread(gzDoc,&buff,4096)) > 0) |
||
124 | { |
||
125 | buff[i] = '\0'; |
||
126 | f.append(buff); |
||
127 | } |
||
128 | gzclose(gzDoc); |
||
129 | } |
||
130 | else |
||
131 | loadText(fileName, &f); |
||
132 | #else |
||
133 | loadText(fileName, &f); |
||
134 | #endif |
||
135 | QString ff = ""; |
||
136 | if (f.startsWith("<SCRIBUSUTF8")) |
||
137 | ff = QString::fromUtf8(f); |
||
138 | else if (f.startsWith("<SCRIBUS")) |
||
139 | ff = f; |
||
140 | return ff; |
||
141 | /** end changes */ |
||
142 | } |
||
143 | |||
144 | /*! |
||
145 | \fn bool FileLoader::LoadFile(ScribusApp* app) |
||
146 | \author Franz Schmid |
||
147 | \date |
||
148 | \brief Loads the file "FileName" as a Scribus document |
||
149 | \param ScribusApp* app, pointer to the main application class |
||
150 | \retval bool true when loading is succsessful, false otherwise |
||
151 | */ |
||
152 | bool FileLoader::LoadFile(ScribusApp* app) |
||
153 | { |
||
154 | bool ret = false; |
||
705 | fschmid | 155 | app->doc->MarginsShown = app->Prefs.MarginsShown; |
156 | app->doc->FramesShown = app->Prefs.FramesShown; |
||
157 | app->doc->GridShown = app->Prefs.GridShown; |
||
158 | app->doc->GuidesShown = app->Prefs.GuidesShown; |
||
159 | app->doc->BaseShown = app->Prefs.BaseShown; |
||
160 | app->doc->linkShown = app->Prefs.linkShown; |
||
731 | fschmid | 161 | app->doc->PolyC = app->Prefs.PolyC; |
162 | app->doc->PolyF = app->Prefs.PolyF; |
||
163 | app->doc->PolyR = app->Prefs.PolyR; |
||
164 | app->doc->PolyFd = app->Prefs.PolyFd; |
||
165 | app->doc->PolyS = app->Prefs.PolyS; |
||
506 | fschmid | 166 | switch (FileType) |
167 | { |
||
168 | case 0: |
||
169 | { |
||
170 | ScriXmlDoc *ss = new ScriXmlDoc(); |
||
171 | QObject::connect(ss, SIGNAL(NewPage(int)), app, SLOT(slotNewPage(int))); |
||
172 | ret = ss->ReadDoc(FileName, app->Prefs.AvailFonts, app->doc, app->view, app->FProg); |
||
173 | QObject::disconnect(ss, SIGNAL(NewPage(int)), app, SLOT(slotNewPage(int))); |
||
174 | delete ss; |
||
175 | } |
||
176 | break; |
||
517 | fschmid | 177 | case 1: |
178 | ret = ReadDoc(app, FileName, app->Prefs.AvailFonts, app->doc, app->view, app->FProg); |
||
179 | break; |
||
506 | fschmid | 180 | case 2: |
181 | app->DLLinput = FileName; |
||
512 | fschmid | 182 | app->CallDLL( 6 ); |
506 | fschmid | 183 | ret = true; |
184 | break; |
||
185 | case 3: |
||
186 | app->DLLinput = FileName; |
||
512 | fschmid | 187 | app->CallDLL( 10 ); |
506 | fschmid | 188 | ret = true; |
189 | break; |
||
541 | fschmid | 190 | case 5: |
191 | app->DLLinput = FileName; |
||
192 | app->CallDLL( 12 ); |
||
193 | ret = true; |
||
194 | break; |
||
506 | fschmid | 195 | default: |
196 | ret = false; |
||
197 | break; |
||
198 | } |
||
541 | fschmid | 199 | app->DLLinput = ""; |
506 | fschmid | 200 | return ret; |
201 | } |
||
517 | fschmid | 202 | |
203 | bool FileLoader::ReadDoc(ScribusApp* app, QString fileName, SCFonts &avail, ScribusDoc *doc, ScribusView *view, QProgressBar *dia2) |
||
204 | { |
||
205 | struct CLBuf OB; |
||
206 | struct StVorL vg; |
||
207 | struct Layer la; |
||
208 | struct ScribusDoc::BookMa bok; |
||
209 | int counter, Pgc; |
||
210 | bool AtFl; |
||
211 | bool newVersion = false; |
||
212 | QString tmp, tmpf, tmp2, tmp3, tmp4, PgNam, Defont, tmf; |
||
213 | QFont fo; |
||
214 | QMap<int,int> TableID; |
||
215 | QPtrList<PageItem> TableItems; |
||
216 | int x, a; |
||
217 | double xf; |
||
218 | PageItem *Neu; |
||
219 | Page* Apage; |
||
220 | LFrames.clear(); |
||
221 | QDomDocument docu("scridoc"); |
||
222 | QString f = ""; |
||
223 | f = ReadDatei(fileName); |
||
224 | /* 2004/10/02 - petr vanek - bug #1092 - missing <PAGE> crash Scribus. The check constraint moved into IsScribus() |
||
225 | FIXME: I've add test on containig tag PAGE but returning FALSE freezes S. in scribus.cpp need some hack too... */ |
||
226 | if (!docu.setContent(f)) |
||
227 | return false; |
||
228 | doc->PageColors.clear(); |
||
229 | doc->Layers.clear(); |
||
230 | CMYKColor lf = CMYKColor(); |
||
231 | QDomElement elem=docu.documentElement(); |
||
232 | if (elem.tagName() != "SCRIBUSUTF8NEW") |
||
233 | return false; |
||
234 | if (elem.hasAttribute("Version")) |
||
235 | newVersion = true; |
||
236 | QDomNode DOC=elem.firstChild(); |
||
237 | dia2->setTotalSteps(DOC.childNodes().count()); |
||
238 | dia2->setProgress(0); |
||
239 | int ObCount = 0; |
||
240 | TableItems.clear(); |
||
241 | TableID.clear(); |
||
242 | while(!DOC.isNull()) |
||
243 | { |
||
244 | QDomElement dc=DOC.toElement(); |
||
245 | /* |
||
246 | * Attribute von DOCUMENT auslesen |
||
247 | */ |
||
248 | doc->PageOri = QStoInt(dc.attribute("ORIENTATION","0")); |
||
249 | doc->FirstPnum = QStoInt(dc.attribute("FIRSTNUM","1")); |
||
250 | doc->PageFP=QStoInt(dc.attribute("BOOK", "0")); |
||
251 | doc->FirstPageLeft=QStoInt(dc.attribute("FIRSTLEFT","0")); |
||
252 | doc->PageAT=QStoInt(dc.attribute("AUTOTEXT")); |
||
253 | doc->PageSp=QStoInt(dc.attribute("AUTOSPALTEN")); |
||
254 | doc->PageSpa=QStodouble(dc.attribute("ABSTSPALTEN")); |
||
255 | doc->Einheit = QStoInt(dc.attribute("UNITS","0")); |
||
256 | DoFonts.clear(); |
||
257 | doc->Dsize=qRound(QStodouble(dc.attribute("DSIZE")) * 10); |
||
258 | Defont=dc.attribute("DFONT"); |
||
259 | if (!avail.find(Defont)) |
||
260 | { |
||
261 | QString dd = Defont; |
||
262 | if (view->Prefs->GFontSub.contains(Defont)) |
||
263 | Defont = view->Prefs->GFontSub[dd]; |
||
264 | else |
||
265 | Defont = view->Prefs->DefFont; |
||
266 | DoFonts[dd] = Defont; |
||
267 | } |
||
268 | else |
||
269 | DoFonts[Defont] = Defont; |
||
270 | fo = avail[Defont]->Font; |
||
271 | fo.setPointSize(qRound(doc->Dsize / 10.0)); |
||
272 | doc->AddFont(Defont, fo); |
||
273 | doc->Dfont = Defont; |
||
274 | doc->DCols=QStoInt(dc.attribute("DCOL", "1")); |
||
275 | doc->DGap=QStodouble(dc.attribute("DGAP", "0.0")); |
||
276 | doc->DocAutor=dc.attribute("AUTHOR"); |
||
277 | doc->DocComments=dc.attribute("COMMENTS"); |
||
278 | doc->DocKeyWords=dc.attribute("KEYWORDS",""); |
||
279 | doc->DocTitel=dc.attribute("TITLE"); |
||
280 | doc->DocPublisher = dc.attribute("PUBLISHER", ""); |
||
281 | doc->DocDate = dc.attribute("DOCDATE", ""); |
||
282 | doc->DocType = dc.attribute("DOCTYPE", ""); |
||
283 | doc->DocFormat = dc.attribute("DOCFORMAT", ""); |
||
284 | doc->DocIdent = dc.attribute("DOCIDENT", ""); |
||
285 | doc->DocSource = dc.attribute("DOCSOURCE", ""); |
||
286 | doc->DocLangInfo = dc.attribute("DOCLANGINFO", ""); |
||
287 | doc->DocRelation = dc.attribute("DOCRELATION", ""); |
||
288 | doc->DocCover = dc.attribute("DOCCOVER", ""); |
||
289 | doc->DocRights = dc.attribute("DOCRIGHTS", ""); |
||
290 | doc->DocContrib = dc.attribute("DOCCONTRIB", ""); |
||
291 | doc->VHoch=QStoInt(dc.attribute("VHOCH")); |
||
292 | doc->VHochSc=QStoInt(dc.attribute("VHOCHSC")); |
||
293 | doc->VTief=QStoInt(dc.attribute("VTIEF")); |
||
294 | doc->VTiefSc=QStoInt(dc.attribute("VTIEFSC")); |
||
295 | doc->VKapit=QStoInt(dc.attribute("VKAPIT")); |
||
296 | doc->GroupCounter=QStoInt(dc.attribute("GROUPC","1")); |
||
297 | doc->HasCMS = static_cast<bool>(QStoInt(dc.attribute("HCMS","0"))); |
||
298 | doc->CMSSettings.SoftProofOn = static_cast<bool>(QStoInt(dc.attribute("DPSo","0"))); |
||
299 | doc->CMSSettings.CMSinUse = static_cast<bool>(QStoInt(dc.attribute("DPuse","0"))); |
||
300 | doc->CMSSettings.GamutCheck = static_cast<bool>(QStoInt(dc.attribute("DPgam","0"))); |
||
301 | doc->CMSSettings.BlackPoint = static_cast<bool>(QStoInt(dc.attribute("DPbla","1"))); |
||
302 | doc->CMSSettings.DefaultMonitorProfile = dc.attribute("DPMo",""); |
||
303 | doc->CMSSettings.DefaultPrinterProfile = dc.attribute("DPPr",""); |
||
304 | doc->CMSSettings.DefaultInputProfile = dc.attribute("DPIn",""); |
||
305 | doc->CMSSettings.DefaultInputProfile2 = dc.attribute("DPIn2",""); |
||
306 | doc->CMSSettings.DefaultIntentPrinter = QStoInt(dc.attribute("DIPr","0")); |
||
307 | doc->CMSSettings.DefaultIntentMonitor = QStoInt(dc.attribute("DIMo","1")); |
||
308 | doc->CMSSettings.DefaultIntentMonitor2 = QStoInt(dc.attribute("DIMo2","1")); |
||
309 | doc->ActiveLayer = QStoInt(dc.attribute("ALAYER","0")); |
||
310 | doc->Language = dc.attribute("LANGUAGE", ""); |
||
311 | doc->MinWordLen = QStoInt(dc.attribute("MINWORDLEN", "3")); |
||
312 | doc->HyCount = QStoInt(dc.attribute("HYCOUNT", "2")); |
||
537 | fschmid | 313 | doc->PageB=QStodouble(dc.attribute("PAGEWITH")); |
314 | doc->PageH=QStodouble(dc.attribute("PAGEHEIGHT")); |
||
315 | doc->PageM.Left=QStodouble(dc.attribute("BORDERLEFT")); |
||
316 | doc->PageM.Right=QStodouble(dc.attribute("BORDERRIGHT")); |
||
317 | doc->PageM.Top=QStodouble(dc.attribute("BORDERTOP")); |
||
318 | doc->PageM.Bottom=QStodouble(dc.attribute("BORDERBOTTOM")); |
||
517 | fschmid | 319 | doc->Automatic = static_cast<bool>(QStoInt(dc.attribute("AUTOMATIC", "1"))); |
320 | doc->AutoCheck = static_cast<bool>(QStoInt(dc.attribute("AUTOCHECK", "0"))); |
||
321 | doc->GuideLock = static_cast<bool>(QStoInt(dc.attribute("GUIDELOCK", "0"))); |
||
322 | doc->BaseGrid = QStodouble(dc.attribute("BASEGRID", "12")); |
||
323 | doc->BaseOffs = QStodouble(dc.attribute("BASEO", "0")); |
||
324 | doc->minorGrid = QStodouble(dc.attribute("MINGRID", tmp.setNum(view->Prefs->DminGrid))); |
||
325 | doc->majorGrid = QStodouble(dc.attribute("MAJGRID", tmp.setNum(view->Prefs->DmajGrid))); |
||
693 | fschmid | 326 | doc->GridShown = static_cast<bool>(QStoInt(dc.attribute("SHOWGRID", "0"))); |
327 | doc->GuidesShown = static_cast<bool>(QStoInt(dc.attribute("SHOWGUIDES", "1"))); |
||
328 | doc->FramesShown = static_cast<bool>(QStoInt(dc.attribute("SHOWFRAME", "1"))); |
||
329 | doc->MarginsShown = static_cast<bool>(QStoInt(dc.attribute("SHOWMARGIN", "1"))); |
||
330 | doc->BaseShown = static_cast<bool>(QStoInt(dc.attribute("SHOWBASE", "0"))); |
||
331 | doc->ShowPic = static_cast<bool>(QStoInt(dc.attribute("SHOWPICT", "1"))); |
||
705 | fschmid | 332 | doc->linkShown = static_cast<bool>(QStoInt(dc.attribute("SHOWLINK", "0"))); |
731 | fschmid | 333 | doc->PolyC = QStoInt(dc.attribute("POLYC", "4")); |
334 | doc->PolyF = QStodouble(dc.attribute("POLYF", "0.5")); |
||
335 | doc->PolyR = QStodouble(dc.attribute("POLYR", "0")); |
||
336 | doc->PolyFd = QStoInt(dc.attribute("POLYFD", "0")); |
||
337 | doc->PolyS = static_cast<bool>(QStoInt(dc.attribute("POLYS", "0"))); |
||
517 | fschmid | 338 | QDomNode PAGE=DOC.firstChild(); |
339 | counter = 0; |
||
340 | while(!PAGE.isNull()) |
||
341 | { |
||
342 | ObCount++; |
||
343 | dia2->setProgress(ObCount); |
||
344 | QDomElement pg=PAGE.toElement(); |
||
345 | // 10/25/2004 pv - None is "reserved" color. cannot be defined in any file... |
||
346 | if(pg.tagName()=="COLOR" && pg.attribute("NAME")!="None") |
||
347 | { |
||
348 | if (pg.hasAttribute("CMYK")) |
||
349 | lf.setNamedColor(pg.attribute("CMYK")); |
||
350 | else |
||
351 | lf.fromQColor(QColor(pg.attribute("RGB"))); |
||
352 | doc->PageColors[pg.attribute("NAME")] = lf; |
||
353 | } |
||
354 | if(pg.tagName()=="STYLE") |
||
355 | { |
||
356 | vg.Vname = pg.attribute("NAME"); |
||
357 | vg.LineSpa = QStodouble(pg.attribute("LINESP")); |
||
358 | vg.Indent = QStodouble(pg.attribute("INDENT","0")); |
||
359 | vg.First = QStodouble(pg.attribute("FIRST","0")); |
||
360 | vg.Ausri = QStoInt(pg.attribute("ALIGN")); |
||
361 | vg.Avor = QStodouble(pg.attribute("VOR","0")); |
||
362 | vg.Anach = QStodouble(pg.attribute("NACH","0")); |
||
363 | tmpf = pg.attribute("FONT", doc->Dfont); |
||
364 | if (tmpf == "") |
||
365 | tmpf = doc->Dfont; |
||
366 | tmf = tmpf; |
||
367 | if (!DoFonts.contains(tmpf)) |
||
368 | tmpf = AskForFont(avail, tmpf, view->Prefs, doc); |
||
369 | else |
||
370 | tmpf = DoFonts[tmf]; |
||
371 | vg.Font = tmpf; |
||
372 | vg.FontSize = qRound(QStodouble(pg.attribute("FONTSIZE","12")) * 10.0); |
||
373 | vg.Drop = static_cast<bool>(QStoInt(pg.attribute("DROP","0"))); |
||
374 | vg.DropLin = QStoInt(pg.attribute("DROPLIN","2")); |
||
375 | vg.FontEffect = QStoInt(pg.attribute("EFFECT","0")); |
||
376 | vg.FColor = pg.attribute("FCOLOR", doc->Dbrush); |
||
377 | vg.FShade = QStoInt(pg.attribute("FSHADE","100")); |
||
378 | vg.SColor = pg.attribute("SCOLOR", doc->Dpen); |
||
379 | vg.SShade = QStoInt(pg.attribute("SSHADE","100")); |
||
380 | vg.BaseAdj = static_cast<bool>(QStoInt(pg.attribute("BASE","0"))); |
||
381 | if ((pg.hasAttribute("NUMTAB")) && (QStoInt(pg.attribute("NUMTAB","0")) != 0)) |
||
382 | { |
||
383 | tmp = pg.attribute("TABS"); |
||
384 | QTextStream tgv(&tmp, IO_ReadOnly); |
||
385 | vg.TabValues.clear(); |
||
386 | for (int cxv = 0; cxv < QStoInt(pg.attribute("NUMTAB","0")); ++cxv) |
||
387 | { |
||
388 | tgv >> xf; |
||
389 | vg.TabValues.append(xf); |
||
390 | } |
||
391 | tmp = ""; |
||
392 | } |
||
393 | else |
||
394 | vg.TabValues.clear(); |
||
395 | doc->Vorlagen.append(vg); |
||
396 | } |
||
397 | if(pg.tagName()=="JAVA") |
||
398 | doc->JavaScripts[pg.attribute("NAME")] = pg.attribute("SCRIPT"); |
||
399 | if(pg.tagName()=="LAYERS") |
||
400 | { |
||
401 | la.LNr = QStoInt(pg.attribute("NUMMER")); |
||
402 | la.Level = QStoInt(pg.attribute("LEVEL")); |
||
403 | la.Name = pg.attribute("NAME"); |
||
404 | la.Sichtbar = QStoInt(pg.attribute("SICHTBAR")); |
||
405 | la.Drucken = QStoInt(pg.attribute("DRUCKEN")); |
||
406 | doc->Layers.append(la); |
||
407 | } |
||
408 | if(pg.tagName()=="Bookmark") |
||
409 | { |
||
410 | bok.Title = pg.attribute("Title"); |
||
411 | bok.Text = pg.attribute("Text"); |
||
412 | bok.Aktion = pg.attribute("Aktion"); |
||
413 | bok.ItemNr = QStoInt(pg.attribute("ItemNr")); |
||
414 | bok.Seite = QStoInt(pg.attribute("Seite")); |
||
415 | bok.Element = QStoInt(pg.attribute("Element")); |
||
416 | bok.First = QStoInt(pg.attribute("First")); |
||
417 | bok.Last = QStoInt(pg.attribute("Last")); |
||
418 | bok.Prev = QStoInt(pg.attribute("Prev")); |
||
419 | bok.Next = QStoInt(pg.attribute("Next")); |
||
420 | bok.Parent = QStoInt(pg.attribute("Parent")); |
||
421 | doc->BookMarks.append(bok); |
||
422 | } |
||
423 | if(pg.tagName()=="MultiLine") |
||
424 | { |
||
425 | multiLine ml; |
||
426 | QDomNode MuLn = PAGE.firstChild(); |
||
427 | while(!MuLn.isNull()) |
||
428 | { |
||
429 | QDomElement MuL = MuLn.toElement(); |
||
430 | struct singleLine sl; |
||
431 | sl.Color = MuL.attribute("Color"); |
||
432 | sl.Dash = QStoInt(MuL.attribute("Dash")); |
||
433 | sl.LineEnd = QStoInt(MuL.attribute("LineEnd")); |
||
434 | sl.LineJoin = QStoInt(MuL.attribute("LineJoin")); |
||
435 | sl.Shade = QStoInt(MuL.attribute("Shade")); |
||
436 | sl.Width = QStodouble(MuL.attribute("Width")); |
||
437 | ml.push_back(sl); |
||
438 | MuLn = MuLn.nextSibling(); |
||
439 | } |
||
440 | doc->MLineStyles.insert(pg.attribute("Name"), ml); |
||
441 | } |
||
442 | if ((pg.tagName()=="PAGE") || (pg.tagName()=="MASTERPAGE")) |
||
443 | { |
||
444 | a = QStoInt(pg.attribute("NUM")); |
||
445 | PgNam = ""; |
||
446 | PgNam = pg.attribute("NAM", ""); |
||
447 | Pgc = doc->PageC; |
||
448 | AtFl = doc->PageAT; |
||
449 | if (PgNam == "") |
||
450 | { |
||
451 | doc->PageC = Pgc; |
||
452 | doc->Pages = doc->DocPages; |
||
453 | doc->PageAT = AtFl; |
||
454 | doc->MasterP = false; |
||
455 | } |
||
456 | else |
||
457 | { |
||
458 | doc->PageC = 0; |
||
459 | doc->PageAT = false; |
||
460 | doc->Pages = doc->MasterPages; |
||
461 | doc->MasterP = true; |
||
462 | } |
||
463 | app->slotNewPage(a); |
||
464 | Apage = doc->Pages.at(a); |
||
465 | if (PgNam == "") |
||
466 | doc->DocPages = doc->Pages; |
||
467 | else |
||
468 | { |
||
469 | Apage->PageNam = PgNam; |
||
470 | doc->MasterNames[PgNam] = a; |
||
471 | doc->MasterPages = doc->Pages; |
||
472 | } |
||
473 | doc->MasterP = false; |
||
474 | doc->PageC = Pgc+1; |
||
475 | doc->PageAT = AtFl; |
||
476 | Apage->LeftPg=QStoInt(pg.attribute("LEFT","0")); |
||
477 | QString Mus = ""; |
||
478 | Mus = pg.attribute("MNAM","Normal"); |
||
479 | if (!doc->MasterP) |
||
480 | Apage->MPageNam = Mus; |
||
481 | else |
||
482 | Apage->MPageNam = ""; |
||
537 | fschmid | 483 | Apage->Xoffset = QStodouble(pg.attribute("PAGEXPOS")); |
484 | Apage->Yoffset = QStodouble(pg.attribute("PAGEYPOS")); |
||
517 | fschmid | 485 | Apage->Width = QStodouble(pg.attribute("PAGEWITH")); |
486 | Apage->Height = QStodouble(pg.attribute("PAGEHEIGHT")); |
||
487 | Apage->Margins.Left = QStodouble(pg.attribute("BORDERLEFT")); |
||
488 | Apage->Margins.Right = QStodouble(pg.attribute("BORDERRIGHT")); |
||
489 | Apage->Margins.Top = QStodouble(pg.attribute("BORDERTOP")); |
||
490 | Apage->Margins.Bottom = QStodouble(pg.attribute("BORDERBOTTOM")); |
||
491 | doc->PageB = Apage->Width; |
||
492 | doc->PageH = Apage->Height; |
||
493 | doc->PageM.Left = Apage->Margins.Left; |
||
494 | doc->PageM.Right = Apage->Margins.Right; |
||
495 | doc->PageM.Top = Apage->Margins.Top; |
||
496 | doc->PageM.Bottom = Apage->Margins.Bottom; |
||
497 | if ((pg.hasAttribute("NumVGuides")) && (QStoInt(pg.attribute("NumVGuides","0")) != 0)) |
||
498 | { |
||
499 | tmp = pg.attribute("VerticalGuides"); |
||
500 | QTextStream fgv(&tmp, IO_ReadOnly); |
||
501 | Apage->YGuides.clear(); |
||
502 | for (int cxv = 0; cxv < QStoInt(pg.attribute("NumVGuides","0")); ++cxv) |
||
503 | { |
||
504 | fgv >> xf; |
||
505 | Apage->YGuides.append(xf); |
||
506 | } |
||
507 | qHeapSort(Apage->YGuides); |
||
508 | tmp = ""; |
||
509 | } |
||
510 | else |
||
511 | Apage->YGuides.clear(); |
||
512 | if ((pg.hasAttribute("NumHGuides")) && (QStoInt(pg.attribute("NumHGuides","0")) != 0)) |
||
513 | { |
||
514 | tmp = pg.attribute("HorizontalGuides"); |
||
515 | QTextStream fgh(&tmp, IO_ReadOnly); |
||
516 | Apage->XGuides.clear(); |
||
517 | for (int cxh = 0; cxh < QStoInt(pg.attribute("NumHGuides","0")); ++cxh) |
||
518 | { |
||
519 | fgh >> xf; |
||
520 | Apage->XGuides.append(xf); |
||
521 | } |
||
522 | qHeapSort(Apage->XGuides); |
||
523 | tmp = ""; |
||
524 | } |
||
525 | else |
||
526 | Apage->XGuides.clear(); |
||
527 | } |
||
528 | if ((pg.tagName()=="PAGEOBJECT") || (pg.tagName()=="MASTEROBJECT")) |
||
529 | { |
||
530 | if (pg.tagName()=="PAGEOBJECT") |
||
522 | fschmid | 531 | { |
517 | fschmid | 532 | doc->Items = doc->DocItems; |
522 | fschmid | 533 | doc->Pages = doc->DocPages; |
534 | doc->MasterP = false; |
||
535 | } |
||
517 | fschmid | 536 | else |
522 | fschmid | 537 | { |
517 | fschmid | 538 | doc->Items = doc->MasterItems; |
522 | fschmid | 539 | doc->Pages = doc->MasterPages; |
540 | doc->MasterP = true; |
||
541 | } |
||
537 | fschmid | 542 | if (pg.attribute("OnMasterPage") != "") |
543 | doc->ActPage = doc->MasterPages.at(doc->MasterNames[pg.attribute("OnMasterPage")]); |
||
517 | fschmid | 544 | if ((QStoInt(pg.attribute("NEXTITEM")) != -1) || (static_cast<bool>(QStoInt(pg.attribute("AUTOTEXT"))))) |
545 | { |
||
546 | if (QStoInt(pg.attribute("BACKITEM")) == -1) |
||
537 | fschmid | 547 | LFrames.append(doc->Items.count()); |
517 | fschmid | 548 | } |
549 | GetItemProps(newVersion, &pg, &OB); |
||
550 | OB.Xpos = QStodouble(pg.attribute("XPOS")); |
||
551 | OB.Ypos=QStodouble(pg.attribute("YPOS")); |
||
552 | OB.NamedLStyle = pg.attribute("NAMEDLST", ""); |
||
553 | OB.isBookmark=QStoInt(pg.attribute("BOOKMARK")); |
||
554 | if ((OB.isBookmark) && (doc->BookMarks.count() == 0)) |
||
555 | doc->OldBM = true; |
||
556 | OB.BMnr = QStoInt(pg.attribute("BookNr","0")); |
||
557 | OB.Ausrich = QStoInt(pg.attribute("ALIGN","0")); |
||
558 | tmpf = pg.attribute("IFONT", doc->Dfont); |
||
559 | if (tmpf == "") |
||
560 | tmpf = doc->Dfont; |
||
561 | tmf = tmpf; |
||
562 | if (!DoFonts.contains(tmpf)) |
||
563 | tmpf = AskForFont(avail, tmpf, view->Prefs, doc); |
||
564 | else |
||
565 | tmpf = DoFonts[tmf]; |
||
566 | OB.IFont = tmpf; |
||
567 | OB.LayerNr = QStoInt(pg.attribute("LAYER","0")); |
||
568 | OB.Language = pg.attribute("LANGUAGE", doc->Language); |
||
569 | tmp = ""; |
||
570 | if ((pg.hasAttribute("GROUPS")) && (QStoInt(pg.attribute("NUMGROUP","0")) != 0)) |
||
571 | { |
||
572 | tmp = pg.attribute("GROUPS"); |
||
573 | QTextStream fg(&tmp, IO_ReadOnly); |
||
574 | OB.Groups.clear(); |
||
575 | for (int cx = 0; cx < QStoInt(pg.attribute("NUMGROUP","0")); ++cx) |
||
576 | { |
||
577 | fg >> x; |
||
578 | OB.Groups.push(x); |
||
579 | } |
||
580 | tmp = ""; |
||
581 | } |
||
582 | else |
||
583 | OB.Groups.clear(); |
||
584 | QDomNode IT=pg.firstChild(); |
||
585 | while(!IT.isNull()) |
||
586 | { |
||
587 | QDomElement it=IT.toElement(); |
||
588 | if (it.tagName()=="CSTOP") |
||
589 | { |
||
590 | QString name = it.attribute("NAME"); |
||
591 | double ramp = QStodouble(it.attribute("RAMP","0.0")); |
||
592 | int shade = QStoInt(it.attribute("SHADE","100")); |
||
593 | double opa = QStodouble(it.attribute("TRANS","1")); |
||
690 | cbradney | 594 | OB.fill_gradient.addStop(SetColor(doc, name, shade), ramp, 0.5, opa, name, shade); |
517 | fschmid | 595 | } |
596 | if (it.tagName()=="ITEXT") |
||
597 | tmp += GetItemText(&it, doc, view->Prefs, false, false); |
||
598 | IT=IT.nextSibling(); |
||
599 | } |
||
600 | OB.Ptext = tmp; |
||
601 | int docGc = doc->GroupCounter; |
||
602 | doc->GroupCounter = 0; |
||
603 | if ((OB.PType == 5) && (OB.Height != 0)) |
||
604 | { |
||
605 | OB.Rot += atan2(OB.Height,OB.Width)*(180.0/3.1415927); |
||
606 | OB.Width = sqrt(pow(OB.Width,2)+pow(OB.Height,2)); |
||
607 | OB.Height = 0; |
||
608 | OB.Clip.setPoints(4, -1,-1, static_cast<int>(OB.Width+1),-1, static_cast<int>(OB.Width+1), |
||
609 | static_cast<int>(OB.Height+1), -1, static_cast<int>(OB.Height+1)); |
||
610 | } |
||
611 | uint last = doc->Items.count(); |
||
612 | view->PasteItem(&OB, true); |
||
613 | doc->GroupCounter = docGc; |
||
614 | Neu = doc->Items.at(last); |
||
615 | Neu->isAutoText=static_cast<bool>(QStoInt(pg.attribute("AUTOTEXT"))); |
||
616 | if (Neu->isAutoText) |
||
617 | doc->LastAuto = Neu; |
||
618 | Neu->NextIt = QStoInt(pg.attribute("NEXTITEM")); |
||
619 | if (Neu->isTableItem) |
||
620 | { |
||
621 | TableItems.append(Neu); |
||
622 | TableID.insert(QStoInt(pg.attribute("OwnLINK","0")), Neu->ItemNr); |
||
623 | } |
||
624 | if (pg.tagName()=="PAGEOBJECT") |
||
522 | fschmid | 625 | { |
517 | fschmid | 626 | doc->DocItems = doc->Items; |
522 | fschmid | 627 | doc->DocPages = doc->Pages; |
628 | } |
||
517 | fschmid | 629 | else |
522 | fschmid | 630 | { |
517 | fschmid | 631 | doc->MasterItems = doc->Items; |
522 | fschmid | 632 | doc->MasterPages = doc->Pages; |
633 | } |
||
634 | doc->MasterP = false; |
||
517 | fschmid | 635 | counter++; |
636 | } |
||
637 | PAGE=PAGE.nextSibling(); |
||
638 | } |
||
639 | PAGE=DOC.firstChild(); |
||
640 | while(!PAGE.isNull()) |
||
641 | { |
||
642 | QDomElement pg=PAGE.toElement(); |
||
643 | if(pg.tagName()=="PDF") |
||
644 | { |
||
645 | doc->PDF_Optionen.Articles = static_cast<bool>(QStoInt(pg.attribute("Articles"))); |
||
646 | doc->PDF_Optionen.Thumbnails = static_cast<bool>(QStoInt(pg.attribute("Thumbnails"))); |
||
647 | doc->PDF_Optionen.Compress = static_cast<bool>(QStoInt(pg.attribute("Compress"))); |
||
648 | doc->PDF_Optionen.CompressMethod = QStoInt(pg.attribute("CMethod","0")); |
||
649 | doc->PDF_Optionen.Quality = QStoInt(pg.attribute("Quality","0")); |
||
650 | doc->PDF_Optionen.RecalcPic = static_cast<bool>(QStoInt(pg.attribute("RecalcPic"))); |
||
651 | doc->PDF_Optionen.Bookmarks = static_cast<bool>(QStoInt(pg.attribute("Bookmarks"))); |
||
652 | if (pg.hasAttribute("MirrorH")) |
||
653 | doc->PDF_Optionen.MirrorH = static_cast<bool>(QStoInt(pg.attribute("MirrorH"))); |
||
654 | else |
||
655 | doc->PDF_Optionen.MirrorH = false; |
||
656 | if (pg.hasAttribute("MirrorV")) |
||
657 | doc->PDF_Optionen.MirrorV = static_cast<bool>(QStoInt(pg.attribute("MirrorV"))); |
||
658 | else |
||
659 | doc->PDF_Optionen.MirrorV = false; |
||
660 | if (pg.hasAttribute("RotateDeg")) |
||
661 | doc->PDF_Optionen.RotateDeg = QStoInt(pg.attribute("RotateDeg","0")); |
||
662 | else |
||
663 | doc->PDF_Optionen.RotateDeg = 0; |
||
664 | doc->PDF_Optionen.PresentMode = static_cast<bool>(QStoInt(pg.attribute("PresentMode"))); |
||
665 | doc->PDF_Optionen.PicRes = QStoInt(pg.attribute("PicRes")); |
||
666 | doc->PDF_Optionen.Version = QStoInt(pg.attribute("Version")); |
||
667 | doc->PDF_Optionen.Resolution = QStoInt(pg.attribute("Resolution")); |
||
668 | doc->PDF_Optionen.Binding = QStoInt(pg.attribute("Binding")); |
||
669 | doc->PDF_Optionen.Datei = ""; |
||
670 | doc->PDF_Optionen.UseRGB = static_cast<bool>(QStoInt(pg.attribute("RGBMode","0"))); |
||
671 | doc->PDF_Optionen.UseProfiles = static_cast<bool>(QStoInt(pg.attribute("UseProfiles","0"))); |
||
672 | doc->PDF_Optionen.UseProfiles2 = static_cast<bool>(QStoInt(pg.attribute("UseProfiles2","0"))); |
||
673 | doc->PDF_Optionen.Intent = QStoInt(pg.attribute("Intent","1")); |
||
674 | doc->PDF_Optionen.Intent2 = QStoInt(pg.attribute("Intent2","1")); |
||
675 | doc->PDF_Optionen.SolidProf = pg.attribute("SolidP", ""); |
||
676 | doc->PDF_Optionen.ImageProf = pg.attribute("ImageP", ""); |
||
677 | doc->PDF_Optionen.PrintProf = pg.attribute("PrintP", ""); |
||
678 | doc->PDF_Optionen.Info = pg.attribute("InfoString", ""); |
||
679 | doc->PDF_Optionen.BleedTop = QStodouble(pg.attribute("BTop","0")); |
||
680 | doc->PDF_Optionen.BleedLeft = QStodouble(pg.attribute("BLeft","0")); |
||
681 | doc->PDF_Optionen.BleedRight = QStodouble(pg.attribute("BRight","0")); |
||
682 | doc->PDF_Optionen.BleedBottom = QStodouble(pg.attribute("BBottom","0")); |
||
683 | doc->PDF_Optionen.EmbeddedI = static_cast<bool>(QStoInt(pg.attribute("ImagePr","0"))); |
||
684 | doc->PDF_Optionen.PassOwner = pg.attribute("PassOwner", ""); |
||
685 | doc->PDF_Optionen.PassUser = pg.attribute("PassUser", ""); |
||
686 | doc->PDF_Optionen.Permissions = QStoInt(pg.attribute("Permissions","-4")); |
||
687 | doc->PDF_Optionen.Encrypt = static_cast<bool>(QStoInt(pg.attribute("Encrypt","0"))); |
||
688 | doc->PDF_Optionen.UseLPI = static_cast<bool>(QStoInt(pg.attribute("UseLpi","0"))); |
||
689 | QDomNode PFO = PAGE.firstChild(); |
||
690 | while(!PFO.isNull()) |
||
691 | { |
||
692 | QDomElement pdfF = PFO.toElement(); |
||
693 | if(pdfF.tagName() == "LPI") |
||
694 | { |
||
695 | struct LPIset lpo; |
||
696 | lpo.Angle = QStoInt(pdfF.attribute("Angle")); |
||
697 | lpo.Frequency = QStoInt(pdfF.attribute("Frequency")); |
||
698 | lpo.SpotFunc = QStoInt(pdfF.attribute("SpotFunction")); |
||
699 | doc->PDF_Optionen.LPISettings[pdfF.attribute("Color")] = lpo; |
||
700 | } |
||
701 | if(pdfF.tagName() == "Fonts") |
||
702 | { |
||
703 | if (!doc->PDF_Optionen.EmbedList.contains(DoFonts[pdfF.attribute("Name")])) |
||
704 | doc->PDF_Optionen.EmbedList.append(DoFonts[pdfF.attribute("Name")]); |
||
705 | } |
||
706 | if(pdfF.tagName() == "Subset") |
||
707 | { |
||
708 | if (!doc->PDF_Optionen.SubsetList.contains(DoFonts[pdfF.attribute("Name")])) |
||
709 | doc->PDF_Optionen.SubsetList.append(DoFonts[pdfF.attribute("Name")]); |
||
710 | } |
||
711 | if(pdfF.tagName() == "Effekte") |
||
712 | { |
||
713 | struct PreSet ef; |
||
714 | ef.EffektLen = QStoInt(pdfF.attribute("EffektLen")); |
||
715 | ef.AnzeigeLen = QStoInt(pdfF.attribute("AnzeigeLen")); |
||
716 | ef.Effekt = QStoInt(pdfF.attribute("Effekt")); |
||
717 | ef.Dm = QStoInt(pdfF.attribute("Dm")); |
||
718 | ef.M = QStoInt(pdfF.attribute("M")); |
||
719 | ef.Di = QStoInt(pdfF.attribute("Di")); |
||
720 | doc->PDF_Optionen.PresentVals.append(ef); |
||
721 | } |
||
722 | PFO = PFO.nextSibling(); |
||
723 | } |
||
724 | } |
||
725 | PAGE=PAGE.nextSibling(); |
||
726 | } |
||
727 | DOC=DOC.nextSibling(); |
||
728 | } |
||
729 | if (TableItems.count() != 0) |
||
730 | { |
||
731 | for (uint ttc = 0; ttc < TableItems.count(); ++ttc) |
||
732 | { |
||
733 | PageItem* ta = TableItems.at(ttc); |
||
734 | if (ta->TopLinkID != -1) |
||
735 | ta->TopLink = doc->Items.at(TableID[ta->TopLinkID]); |
||
736 | else |
||
737 | ta->TopLink = 0; |
||
738 | if (ta->LeftLinkID != -1) |
||
739 | ta->LeftLink = doc->Items.at(TableID[ta->LeftLinkID]); |
||
740 | else |
||
741 | ta->LeftLink = 0; |
||
742 | if (ta->RightLinkID != -1) |
||
743 | ta->RightLink = doc->Items.at(TableID[ta->RightLinkID]); |
||
744 | else |
||
745 | ta->RightLink = 0; |
||
746 | if (ta->BottomLinkID != -1) |
||
747 | ta->BottomLink = doc->Items.at(TableID[ta->BottomLinkID]); |
||
748 | else |
||
749 | ta->BottomLink = 0; |
||
750 | } |
||
751 | } |
||
752 | doc->Pages = doc->DocPages; |
||
753 | doc->PageC = doc->Pages.count(); |
||
754 | doc->Items = doc->DocItems; |
||
755 | doc->MasterP = false; |
||
756 | view->reformPages(); |
||
757 | if (doc->Layers.count() == 0) |
||
758 | { |
||
759 | la.LNr = 0; |
||
760 | la.Level = 0; |
||
761 | la.Name = QObject::tr("Background"); |
||
762 | la.Sichtbar = true; |
||
763 | la.Drucken = true; |
||
764 | doc->Layers.append(la); |
||
765 | } |
||
766 | if (LFrames.count() != 0) |
||
767 | { |
||
768 | PageItem *Its; |
||
769 | PageItem *Itn; |
||
770 | PageItem *Itr; |
||
537 | fschmid | 771 | QValueList<int>::Iterator lc; |
517 | fschmid | 772 | for (lc = LFrames.begin(); lc != LFrames.end(); ++lc) |
773 | { |
||
537 | fschmid | 774 | Its = doc->Items.at((*lc)); |
517 | fschmid | 775 | Itr = Its; |
776 | Its->BackBox = 0; |
||
777 | if (Its->isAutoText) |
||
778 | doc->FirstAuto = Its; |
||
779 | while (Its->NextIt != -1) |
||
780 | { |
||
537 | fschmid | 781 | Itn = doc->Items.at(Its->NextIt); |
517 | fschmid | 782 | Its->NextBox = Itn; |
783 | Itn->BackBox = Its; |
||
784 | Its = Itn; |
||
785 | } |
||
786 | Its->NextBox = 0; |
||
787 | } |
||
788 | } |
||
537 | fschmid | 789 | switch (doc->Einheit) |
790 | { |
||
791 | case 0: |
||
792 | view->UN->setText( QObject::tr("pt")); |
||
793 | break; |
||
794 | case 1: |
||
795 | view->UN->setText( QObject::tr("mm")); |
||
796 | break; |
||
797 | case 2: |
||
798 | view->UN->setText( QObject::tr("in")); |
||
799 | break; |
||
800 | case 3: |
||
801 | view->UN->setText( QObject::tr("p")); |
||
802 | break; |
||
803 | } |
||
517 | fschmid | 804 | dia2->setProgress(DOC.childNodes().count()); |
805 | return true; |
||
806 | } |
||
807 | |||
808 | QString FileLoader::GetItemText(QDomElement *it, ScribusDoc *doc, preV *Prefs, bool VorLFound, bool impo) |
||
809 | { |
||
810 | QString tmp2, tmf, tmpf, tmp3, tmp; |
||
811 | tmp = ""; |
||
812 | tmp2 = it->attribute("CH"); |
||
813 | tmp2.replace(QRegExp("\r"), QChar(5)); |
||
814 | tmp2.replace(QRegExp("\n"), QChar(5)); |
||
815 | tmp2.replace(QRegExp("\t"), QChar(4)); |
||
816 | tmpf = it->attribute("CFONT", doc->Dfont); |
||
817 | if (tmpf == "") |
||
818 | tmpf = doc->Dfont; |
||
819 | tmf = tmpf; |
||
820 | if (!DoFonts.contains(tmpf)) |
||
821 | tmpf = AskForFont(Prefs->AvailFonts, tmpf, Prefs, doc); |
||
822 | else |
||
823 | tmpf = DoFonts[tmf]; |
||
824 | tmp3 = "\t" + tmpf + "\t"; |
||
825 | tmp3 += it->attribute("CSIZE") + "\t"; |
||
826 | tmp3 += it->attribute("CCOLOR") + "\t"; |
||
827 | tmp3 += it->attribute("CEXTRA") + "\t"; |
||
828 | tmp3 += it->attribute("CSHADE") + "\t"; |
||
829 | tmp3 += it->attribute("CSTYLE") + "\t"; |
||
830 | if (impo) |
||
831 | { |
||
832 | if (VorLFound) |
||
833 | tmp3 += DoVorl[it->attribute("CAB","0").toUInt()] + "\t"; |
||
834 | else |
||
835 | { |
||
836 | if (it->attribute("CAB","0").toUInt() < 5) |
||
837 | tmp3 += it->attribute("CAB","0")+"\t"; |
||
838 | else |
||
839 | tmp3 += "0\t"; |
||
840 | } |
||
841 | } |
||
842 | else |
||
843 | tmp3 += it->attribute("CAB","0") + "\t"; |
||
844 | tmp3 += it->attribute("CSTROKE","None") + "\t"; |
||
845 | tmp3 += it->attribute("CSHADE2","100") + "\t"; |
||
846 | tmp3 += it->attribute("CSCALE","100") + "\n"; |
||
847 | for (uint cxx=0; cxx<tmp2.length(); ++cxx) |
||
848 | tmp += tmp2.at(cxx)+tmp3; |
||
849 | return tmp; |
||
850 | } |
||
851 | |||
852 | QString FileLoader::AskForFont(SCFonts &avail, QString fStr, preV *Prefs, ScribusDoc *doc) |
||
853 | { |
||
854 | QFont fo; |
||
855 | QString tmpf = fStr; |
||
856 | if ((!avail.find(tmpf)) || (!avail[tmpf]->UseFont)) |
||
857 | { |
||
858 | if ((!Prefs->GFontSub.contains(tmpf)) || (!avail[Prefs->GFontSub[tmpf]]->UseFont)) |
||
859 | { |
||
860 | qApp->setOverrideCursor(QCursor(Qt::arrowCursor), true); |
||
713 | cbradney | 861 | MissingFont *dia = new MissingFont(0, tmpf, Prefs); |
517 | fschmid | 862 | dia->exec(); |
713 | cbradney | 863 | tmpf = dia->getReplacementFont(); |
517 | fschmid | 864 | delete dia; |
865 | qApp->setOverrideCursor(QCursor(Qt::waitCursor), true); |
||
866 | Prefs->GFontSub[fStr] = tmpf; |
||
867 | } |
||
868 | else |
||
869 | tmpf = Prefs->GFontSub[tmpf]; |
||
870 | } |
||
871 | fo = avail[tmpf]->Font; |
||
872 | fo.setPointSize(qRound(doc->Dsize / 10.0)); |
||
873 | doc->AddFont(tmpf, fo); |
||
874 | DoFonts[fStr] = tmpf; |
||
875 | return tmpf; |
||
876 | } |