Rev 6369 |
Rev 6381 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include "scribus134format.h"
#include "scribus134format.moc"
#include "scribus134formatimpl.h"
#include "../../formatidlist.h"
#include "commonstrings.h"
#include "missing.h"
#include "prefsmanager.h"
#include "scconfig.h"
#include "scribusdoc.h"
#include "scribusview.h"
#include "units.h"
#include "util.h"
#include "colorutil.h"
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
#include <qcursor.h>
#include <qfileinfo.h>
#include <qvaluelist.h>
// See scplugin.h and pluginmanager.{cpp,h} for detail on what these methods
// do. That documentatation is not duplicated here.
// Please don't implement the functionality of your plugin here; do that
// in scribus134formatimpl.h and scribus134formatimpl.cpp .
Scribus134Format::Scribus134Format() :
LoadSavePlugin()
{
// Set action info in languageChange, so we only have to do
// it in one place. This includes registering file formats.
languageChange();
}
Scribus134Format::~Scribus134Format()
{
unregisterAll();
};
void Scribus134Format::languageChange()
{
//(Re)register file formats.
unregisterAll();
registerFormats();
}
const QString Scribus134Format::fullTrName() const
{
return QObject::tr("Scribus 1.3.4 Support");
}
const ScActionPlugin::AboutData* Scribus134Format::getAboutData() const
{
AboutData* about = new AboutData;
Q_CHECK_PTR(about);
return about;
}
void Scribus134Format::deleteAboutData(const AboutData* about) const
{
Q_ASSERT(about);
delete about;
}
void Scribus134Format::registerFormats()
{
FileFormat fmt(this);
fmt.trName = tr("Scribus 1.3.4 Document");
fmt.formatId = FORMATID_SLA134IMPORT;
fmt.load = true;
fmt.save = true;
#ifdef HAVE_LIBZ
fmt.filter = fmt.trName + " (*.sla *.SLA *.sla.gz *.SLA.GZ *.scd *.SCD *.scd.gz *.SCD.GZ)";
fmt.nameMatch = QRegExp("\\.(sla|scd)(\\.gz)?", false);
#else
fmt.filter = fmt.trName + " (*.sla *.SLA *.scd *.SCD)";
fmt.nameMatch = QRegExp("\\.(sla|scd)", false);
#endif
fmt.mimeTypes = QStringList();
fmt.mimeTypes.append("application/x-scribus");
fmt.priority = 64;
registerFormat(fmt);
}
bool Scribus134Format::fileSupported(QIODevice* /* file */, const QString & fileName) const
{
QCString docBytes("");
if(fileName.right(2) == "gz")
{
#ifdef HAVE_LIBZ
static const int gzipExpansionFactor=8;
// The file is gzip encoded and we can load gzip files.
// Set up to read the gzip file
gzFile gzDoc;
int i;
gzDoc = gzopen(fileName.latin1(),"rb");
if(gzDoc == NULL)
{
// FIXME: Needs better error return
return "";
}
// Allocate a buffer of a multiple of the compressed size of the file
// as a starting point for loading. We'll expand this buffer by powers
// of two if we run out of space.
const QFileInfo fi(fileName);
uint bufSize = QMIN(4096, fi.size()*gzipExpansionFactor);
docBytes = QCString(bufSize);
char* buf = docBytes.data();
uint bytesRead = 0;
// While there's free space, read into the buffer....
while (bytesRead<4096 && (i = gzread(gzDoc,buf,bufSize-bytesRead-1)) > 0)
{
// Ensure the string is null-terminated and move the
// write pointer to the current position.
buf[i]=0;
buf+=i;
bytesRead += i;
// And check that there's free space to work with, expanding the
// buffer if there's not.
if (bufSize - bytesRead < 4096)
{
bufSize *= 2;
docBytes.resize(bufSize);
buf = docBytes.data() + bytesRead;
}
}
gzclose(gzDoc);
#else
// The file is gzip encoded but we can't load gzip files.
// Leave `f' empty, since we have no way to
// report a failure condition from here.
return false;
#endif
}
else
{
// Not gzip encoded, just load it
loadRawText(fileName, docBytes);
}
if (docBytes.left(16) == "<SCRIBUSUTF8NEW " && docBytes.left(35).contains("Version=\"1.3.4"))
return true;
return false;
}
QString Scribus134Format::readSLA(const QString & fileName)
{
QCString docBytes("");
if(fileName.right(2) == "gz")
{
#ifdef HAVE_LIBZ
static const int gzipExpansionFactor=8;
// The file is gzip encoded and we can load gzip files.
// Set up to read the gzip file
gzFile gzDoc;
int i;
gzDoc = gzopen(fileName.latin1(),"rb");
if(gzDoc == NULL)
{
// FIXME: Needs better error return
return "";
}
// Allocate a buffer of a multiple of the compressed size of the file
// as a starting point for loading. We'll expand this buffer by powers
// of two if we run out of space.
const QFileInfo fi(fileName);
uint bufSize = fi.size()*gzipExpansionFactor;
docBytes = QCString(bufSize);
char* buf = docBytes.data();
uint bytesRead = 0;
// While there's free space, read into the buffer....
while ((i = gzread(gzDoc,buf,bufSize-bytesRead-1)) > 0)
{
// Ensure the string is null-terminated and move the
// write pointer to the current position.
buf[i]=0;
buf+=i;
bytesRead += i;
// And check that there's free space to work with, expanding the
// buffer if there's not.
if (bufSize - bytesRead < 4096)
{
bufSize *= 2;
docBytes.resize(bufSize);
buf = docBytes.data() + bytesRead;
}
}
gzclose(gzDoc);
#else
// The file is gzip encoded but we can't load gzip files.
// Leave `f' empty, since we have no way to
// report a failure condition from here.
return false;
#endif
}
else
{
// Not gzip encoded, just load it
loadRawText(fileName, docBytes);
}
QString docText("");
if (docBytes.left(16) == "<SCRIBUSUTF8NEW " && docBytes.left(35).contains("Version=\"1.3.4"))
docText = QString::fromUtf8(docBytes);
else
return QString::null;
if (docText.endsWith(QChar(10)) || docText.endsWith(QChar(13)))
docText.truncate(docText.length()-1);
return docText;
}
void Scribus134Format::getReplacedFontData(bool & getNewReplacement, QMap<QString,QString> &getReplacedFonts, QValueList<ScFace> &getDummyScFaces)
{
getNewReplacement=newReplacement;
getReplacedFonts=ReplacedFonts;
getDummyScFaces=dummyScFaces;
}
bool Scribus134Format::loadFile(const QString & fileName, const FileFormat & /* fmt */, int /* flags */, int /* index */)
{
if (m_Doc==0 || m_AvailableFonts==0)
{
Q_ASSERT(m_Doc==0 || m_AvailableFonts==0);
return false;
}
ReplacedFonts.clear();
newReplacement = false;
dummyScFaces.clear();
ParagraphStyle vg;
struct Layer la;
struct ScribusDoc::BookMa bok;
int counter;//, Pgc;
//bool AtFl;
bool newVersion = false;
QString tmp, tmpf, tmp2, tmp3, tmp4, PgNam, Defont, tmf;
QFont fo;
QMap<int,int> TableID;
QPtrList<PageItem> TableItems;
int a;
PageItem *Neu;
Page* Apage;
LFrames.clear();
QDomDocument docu("scridoc");
QString f(readSLA(fileName));
if (f.isEmpty())
return false;
/* 2004/10/02 - petr vanek - bug #1092 - missing <PAGE> crash Scribus. The check constraint moved into IsScribus()
FIXME: I've add test on containig tag PAGE but returning false freezes S. in scribus.cpp need some hack too... */
if (!docu.setContent(f))
return false;
m_Doc->PageColors.clear();
m_Doc->Layers.clear();
int layerToSetActive=0;
ScColor lf = ScColor();
QDomElement elem=docu.documentElement();
if (elem.tagName() != "SCRIBUSUTF8NEW")
return false;
if (elem.hasAttribute("Version"))
newVersion = true;
QDomNode DOC=elem.firstChild();
if (m_mwProgressBar!=0)
{
m_mwProgressBar->setTotalSteps(DOC.childNodes().count());
m_mwProgressBar->setProgress(0);
}
int ObCount = 0;
TableItems.clear();
TableID.clear();
PrefsManager* prefsManager=PrefsManager::instance();
while(!DOC.isNull())
{
QDomElement dc=DOC.toElement();
/*
* Attribute von DOCUMENT auslesen
*/
//CB Add this in to set this in the file in memory. Its saved, why not load it.
//Will of course be replaced by per page settings although we still probably need a document default
m_Doc->m_pageSize = dc.attribute("PAGESIZE");
m_Doc->PageOri = dc.attribute("ORIENTATION", "0").toInt();
m_Doc->FirstPnum = dc.attribute("FIRSTNUM", "1").toInt();
m_Doc->currentPageLayout=dc.attribute("BOOK", "0").toInt();
int fp;
if (m_Doc->currentPageLayout == 0)
fp = 0;
else
{
if (dc.attribute("FIRSTLEFT", "0").toInt() == 1)
fp = 0;
else
fp = 1;
}
if (DOC.namedItem("PageSets").isNull())
{
m_Doc->pageSets[m_Doc->currentPageLayout].FirstPage = fp;
m_Doc->pageSets[m_Doc->currentPageLayout].GapHorizontal = dc.attribute("GapHorizontal", "0").toDouble();
m_Doc->pageSets[m_Doc->currentPageLayout].GapVertical = 0.0;
m_Doc->pageSets[m_Doc->currentPageLayout].GapBelow = dc.attribute("GapVertical", "40").toDouble();
}
m_Doc->setUsesAutomaticTextFrames(dc.attribute("AUTOTEXT").toInt());
m_Doc->PageSp=dc.attribute("AUTOSPALTEN").toInt();
m_Doc->PageSpa=dc.attribute("ABSTSPALTEN").toDouble();
m_Doc->setUnitIndex(dc.attribute("UNITS", "0").toInt());
m_Doc->toolSettings.defSize=qRound(dc.attribute("DSIZE").toDouble() * 10);
Defont=dc.attribute("DFONT");
if ((!m_AvailableFonts->contains(Defont)) || (!(*m_AvailableFonts)[Defont].usable()))
{
ReplacedFonts.insert(Defont, prefsManager->appPrefs.toolSettings.defFont);
Defont = prefsManager->appPrefs.toolSettings.defFont;
}
else
{
// QFont fo = avail[Defont]->Font;
// fo.setPointSize(qRound(m_Doc->toolSettings.defSize / 10.0));
m_Doc->AddFont(Defont, qRound(m_Doc->toolSettings.defSize / 10.0));
}
m_Doc->toolSettings.defFont = Defont;
m_Doc->toolSettings.dCols=dc.attribute("DCOL", "1").toInt();
m_Doc->toolSettings.dGap=dc.attribute("DGAP", "0.0").toDouble();
m_Doc->documentInfo.setAuthor(dc.attribute("AUTHOR"));
m_Doc->documentInfo.setComments(dc.attribute("COMMENTS"));
m_Doc->documentInfo.setKeywords(dc.attribute("KEYWORDS",""));
m_Doc->documentInfo.setTitle(dc.attribute("TITLE"));
m_Doc->documentInfo.setPublisher(dc.attribute("PUBLISHER", ""));
m_Doc->documentInfo.setDate(dc.attribute("DOCDATE", ""));
m_Doc->documentInfo.setType(dc.attribute("DOCTYPE", ""));
m_Doc->documentInfo.setFormat(dc.attribute("DOCFORMAT", ""));
m_Doc->documentInfo.setIdent(dc.attribute("DOCIDENT", ""));
m_Doc->documentInfo.setSource(dc.attribute("DOCSOURCE", ""));
m_Doc->documentInfo.setLangInfo(dc.attribute("DOCLANGINFO", ""));
m_Doc->documentInfo.setRelation(dc.attribute("DOCRELATION", ""));
m_Doc->documentInfo.setCover(dc.attribute("DOCCOVER", ""));
m_Doc->documentInfo.setRights(dc.attribute("DOCRIGHTS", ""));
m_Doc->documentInfo.setContrib(dc.attribute("DOCCONTRIB", ""));
m_Doc->typographicSettings.valueSuperScript = dc.attribute("VHOCH").toInt();
m_Doc->typographicSettings.scalingSuperScript = dc.attribute("VHOCHSC").toInt();
m_Doc->typographicSettings.valueSubScript = dc.attribute("VTIEF").toInt();
m_Doc->typographicSettings.scalingSubScript = dc.attribute("VTIEFSC").toInt();
m_Doc->typographicSettings.valueSmallCaps = dc.attribute("VKAPIT").toInt();
m_Doc->typographicSettings.valueBaseGrid = dc.attribute("BASEGRID", "12").toDouble();
m_Doc->typographicSettings.offsetBaseGrid = dc.attribute("BASEO", "0").toDouble();
m_Doc->typographicSettings.autoLineSpacing = dc.attribute("AUTOL", "20").toInt();
m_Doc->typographicSettings.valueUnderlinePos = dc.attribute("UnderlinePos", "-1").toInt();
m_Doc->typographicSettings.valueUnderlineWidth = dc.attribute("UnderlineWidth", "-1").toInt();
m_Doc->typographicSettings.valueStrikeThruPos = dc.attribute("StrikeThruPos", "-1").toInt();
m_Doc->typographicSettings.valueStrikeThruWidth = dc.attribute("StrikeThruWidth", "-1").toInt();
m_Doc->GroupCounter=dc.attribute("GROUPC", "1").toInt();
//m_Doc->HasCMS = static_cast<bool>(dc.attribute("HCMS", "0").toInt());
m_Doc->CMSSettings.SoftProofOn = static_cast<bool>(dc.attribute("DPSo", "0").toInt());
m_Doc->CMSSettings.SoftProofFullOn = static_cast<bool>(dc.attribute("DPSFo", "0").toInt());
m_Doc->CMSSettings.CMSinUse = static_cast<bool>(dc.attribute("DPuse", "0").toInt());
m_Doc->CMSSettings.GamutCheck = static_cast<bool>(dc.attribute("DPgam", "0").toInt());
m_Doc->CMSSettings.BlackPoint = static_cast<bool>(dc.attribute("DPbla", "1").toInt());
m_Doc->CMSSettings.DefaultMonitorProfile = dc.attribute("DPMo","");
m_Doc->CMSSettings.DefaultPrinterProfile = dc.attribute("DPPr","");
m_Doc->CMSSettings.DefaultImageRGBProfile = dc.attribute("DPIn","");
m_Doc->CMSSettings.DefaultImageCMYKProfile = dc.attribute("DPInCMYK","");
m_Doc->CMSSettings.DefaultSolidColorRGBProfile = dc.attribute("DPIn2","");
if (dc.hasAttribute("DPIn3"))
m_Doc->CMSSettings.DefaultSolidColorCMYKProfile = dc.attribute("DPIn3","");
else
m_Doc->CMSSettings.DefaultSolidColorCMYKProfile = dc.attribute("DPPr","");
//m_Doc->CMSSettings.DefaultIntentPrinter = dc.attribute("DIPr", "0").toInt();
//m_Doc->CMSSettings.DefaultIntentMonitor = dc.attribute("DIMo", "1").toInt();
m_Doc->CMSSettings.DefaultIntentColors = dc.attribute("DISc", "1").toInt();
m_Doc->CMSSettings.DefaultIntentImages = dc.attribute("DIIm", "0").toInt();
layerToSetActive=dc.attribute("ALAYER", "0").toInt();
m_Doc->Language = dc.attribute("LANGUAGE", "");
m_Doc->MinWordLen = dc.attribute("MINWORDLEN", "3").toInt();
m_Doc->HyCount = dc.attribute("HYCOUNT", "2").toInt();
if (dc.hasAttribute("PAGEWIDTH"))
m_Doc->pageWidth=dc.attribute("PAGEWIDTH").toDouble();
else
m_Doc->pageWidth=dc.attribute("PAGEWITH").toDouble();
m_Doc->pageHeight=dc.attribute("PAGEHEIGHT").toDouble();
m_Doc->pageMargins.Left=QMAX(0.0, dc.attribute("BORDERLEFT").toDouble());
m_Doc->pageMargins.Right=QMAX(0.0, dc.attribute("BORDERRIGHT").toDouble());
m_Doc->pageMargins.Top=QMAX(0.0, dc.attribute("BORDERTOP").toDouble());
m_Doc->pageMargins.Bottom=QMAX(0.0, dc.attribute("BORDERBOTTOM").toDouble());
m_Doc->Automatic = static_cast<bool>(dc.attribute("AUTOMATIC", "1").toInt());
m_Doc->AutoCheck = static_cast<bool>(dc.attribute("AUTOCHECK", "0").toInt());
m_Doc->GuideLock = static_cast<bool>(dc.attribute("GUIDELOCK", "0").toInt());
m_Doc->guidesSettings.minorGrid = dc.attribute("MINGRID", tmp.setNum(prefsManager->appPrefs.guidesSettings.minorGrid)).toDouble();
m_Doc->guidesSettings.majorGrid = dc.attribute("MAJGRID", tmp.setNum(prefsManager->appPrefs.guidesSettings.majorGrid)).toDouble();
m_Doc->guidesSettings.gridShown = static_cast<bool>(dc.attribute("SHOWGRID", "0").toInt());
m_Doc->guidesSettings.guidesShown = static_cast<bool>(dc.attribute("SHOWGUIDES", "1").toInt());
m_Doc->guidesSettings.colBordersShown = static_cast<bool>(dc.attribute("showcolborders", "0").toInt());
m_Doc->guidesSettings.framesShown = static_cast<bool>(dc.attribute("SHOWFRAME", "1").toInt());
m_Doc->guidesSettings.layerMarkersShown = static_cast<bool>(dc.attribute("SHOWLAYERM", "0").toInt());
m_Doc->guidesSettings.marginsShown = static_cast<bool>(dc.attribute("SHOWMARGIN", "1").toInt());
m_Doc->guidesSettings.baseShown = static_cast<bool>(dc.attribute("SHOWBASE", "0").toInt());
m_Doc->guidesSettings.showPic = static_cast<bool>(dc.attribute("SHOWPICT", "1").toInt());
m_Doc->guidesSettings.linkShown = static_cast<bool>(dc.attribute("SHOWLINK", "0").toInt());
m_Doc->guidesSettings.showControls = static_cast<bool>(dc.attribute("SHOWControl", "0").toInt());
m_Doc->guidesSettings.rulerMode = static_cast<bool>(dc.attribute("rulerMode", "1").toInt());
m_Doc->guidesSettings.rulersShown = static_cast<bool>(dc.attribute("showrulers", "1").toInt());
m_Doc->rulerXoffset = dc.attribute("rulerXoffset", "0").toDouble();
m_Doc->rulerYoffset =dc.attribute("rulerYoffset", "0").toDouble();
m_Doc->SnapGuides = static_cast<bool>(dc.attribute("SnapToGuides", "0").toInt());
m_Doc->useRaster = static_cast<bool>(dc.attribute("SnapToGrid", "0").toInt());
m_Doc->toolSettings.polyC = dc.attribute("POLYC", "4").toInt();
m_Doc->toolSettings.polyF = dc.attribute("POLYF", "0.5").toDouble();
m_Doc->toolSettings.polyR = dc.attribute("POLYR", "0").toDouble();
m_Doc->toolSettings.polyFd = dc.attribute("POLYFD", "0").toInt();
m_Doc->toolSettings.polyS = static_cast<bool>(dc.attribute("POLYS", "0").toInt());
m_Doc->AutoSave = static_cast<bool>(dc.attribute("AutoSave", "0").toInt());
m_Doc->AutoSaveTime = dc.attribute("AutoSaveTime", "600000").toInt();
m_Doc->ScratchBottom = dc.attribute("ScratchBottom", "20").toDouble();
// FIXME A typo in early 1.3cvs (MAR 05) means we must support loading of
// FIXME 'ScatchLeft' for a while too. This can be removed in a few months.
if (dc.hasAttribute("ScatchLeft"))
m_Doc->ScratchLeft = dc.attribute("ScatchLeft", "100").toDouble();
else
m_Doc->ScratchLeft = dc.attribute("ScratchLeft", "100").toDouble();
m_Doc->ScratchRight = dc.attribute("ScratchRight", "100").toDouble();
m_Doc->ScratchTop = dc.attribute("ScratchTop", "20").toDouble();
m_Doc->toolSettings.dStartArrow = dc.attribute("StartArrow", "0").toInt();
m_Doc->toolSettings.dEndArrow = dc.attribute("EndArrow", "0").toInt();
m_Doc->toolSettings.scaleX = dc.attribute("PICTSCX", "1").toDouble();
m_Doc->toolSettings.scaleY = dc.attribute("PICTSCY", "1").toDouble();
m_Doc->toolSettings.scaleType = static_cast<bool>(dc.attribute("PSCALE", "1").toInt());
m_Doc->toolSettings.aspectRatio = static_cast<bool>(dc.attribute("PASPECT", "0").toInt());
m_Doc->toolSettings.lowResType = dc.attribute("HalfRes", "1").toInt();
m_Doc->toolSettings.useEmbeddedPath = static_cast<bool>(dc.attribute("EmbeddedPath", "0").toInt());
if (dc.hasAttribute("PEN"))
m_Doc->toolSettings.dPen = dc.attribute("PEN");
if (dc.hasAttribute("BRUSH"))
m_Doc->toolSettings.dBrush = dc.attribute("BRUSH");
if (dc.hasAttribute("PENLINE"))
m_Doc->toolSettings.dPenLine = dc.attribute("PENLINE");
if (dc.hasAttribute("PENTEXT"))
m_Doc->toolSettings.dPenText = dc.attribute("PENTEXT");
if (dc.hasAttribute("StrokeText"))
m_Doc->toolSettings.dStrokeText = dc.attribute("StrokeText");
m_Doc->toolSettings.dTextBackGround = dc.attribute("TextBackGround", CommonStrings::None);
m_Doc->toolSettings.dTextLineColor = dc.attribute("TextLineColor", CommonStrings::None);
m_Doc->toolSettings.dTextBackGroundShade = dc.attribute("TextBackGroundShade", "100").toInt();
m_Doc->toolSettings.dTextLineShade = dc.attribute("TextLineShade", "100").toInt();
m_Doc->toolSettings.dTextPenShade = dc.attribute("TextPenShade", "100").toInt();
m_Doc->toolSettings.dTextStrokeShade = dc.attribute("TextStrokeShade", "100").toInt();
m_Doc->toolSettings.dLineArt = static_cast<Qt::PenStyle>(dc.attribute("STIL").toInt());
m_Doc->toolSettings.dLstyleLine = static_cast<Qt::PenStyle>(dc.attribute("STILLINE").toInt());
m_Doc->toolSettings.dWidth = dc.attribute("WIDTH", "1").toDouble();
m_Doc->toolSettings.dWidthLine = dc.attribute("WIDTHLINE", "1").toDouble();
m_Doc->toolSettings.dShade2 = dc.attribute("PENSHADE", "100").toInt();
m_Doc->toolSettings.dShadeLine = dc.attribute("LINESHADE", "100").toInt();
m_Doc->toolSettings.dShade = dc.attribute("BRUSHSHADE", "100").toInt();
m_Doc->toolSettings.magMin = dc.attribute("MAGMIN", "10").toInt();
m_Doc->toolSettings.magMax = dc.attribute("MAGMAX", "3200").toInt();
m_Doc->toolSettings.magStep = dc.attribute("MAGSTEP", "200").toInt();
//CB Reset doc zoom step value to 200% instead of old values.
if (m_Doc->toolSettings.magStep<100)
m_Doc->toolSettings.magStep=200;
m_Doc->toolSettings.tabFillChar = dc.attribute("TabFill","");
m_Doc->toolSettings.dTabWidth=dc.attribute("TabWidth", "36.0").toDouble();
if (dc.hasAttribute("CPICT"))
m_Doc->toolSettings.dBrushPict = dc.attribute("CPICT");
m_Doc->toolSettings.shadePict = dc.attribute("PICTSHADE", "100").toInt();
if (dc.hasAttribute("PAGEC"))
m_Doc->papColor = QColor(dc.attribute("PAGEC"));
if (dc.hasAttribute("MARGC"))
m_Doc->guidesSettings.margColor = QColor(dc.attribute("MARGC"));
if (dc.hasAttribute("MINORC"))
m_Doc->guidesSettings.minorColor = QColor(dc.attribute("MINORC"));
if (dc.hasAttribute("MAJORC"))
m_Doc->guidesSettings.majorColor = QColor(dc.attribute("MAJORC"));
if (dc.hasAttribute("GuideC"))
m_Doc->guidesSettings.guideColor = QColor(dc.attribute("GuideC"));
if (dc.hasAttribute("BaseC"))
m_Doc->guidesSettings.baseColor = QColor(dc.attribute("BaseC"));
m_Doc->marginColored = static_cast<bool>(dc.attribute("RANDF", "0").toInt());
m_Doc->guidesSettings.before = static_cast<bool>(dc.attribute("BACKG", "1").toInt());
m_Doc->guidesSettings.guideRad = dc.attribute("GuideRad", "10").toDouble();
m_Doc->guidesSettings.grabRad = dc.attribute("GRAB", "4").toInt();
if (dc.hasAttribute("currentProfile"))
{
m_Doc->checkerProfiles.clear();
m_Doc->curCheckProfile = dc.attribute("currentProfile");
}
m_Doc->LastAuto = 0;
QDomNode PAGE=DOC.firstChild();
counter = 0;
while(!PAGE.isNull())
{
ObCount++;
if (m_mwProgressBar!=0)
m_mwProgressBar->setProgress(ObCount);
QDomElement pg=PAGE.toElement();
if (pg.tagName()=="PageSets")
{
QDomNode PGS = PAGE.firstChild();
m_Doc->pageSets.clear();
while(!PGS.isNull())
{
QDomElement PgsAttr = PGS.toElement();
if(PgsAttr.tagName() == "Set")
{
struct PageSet pageS;
pageS.Name = CommonStrings::untranslatePageSetString(PgsAttr.attribute("Name"));
pageS.FirstPage = PgsAttr.attribute("FirstPage", "0").toInt();
pageS.Rows = PgsAttr.attribute("Rows", "1").toInt();
pageS.Columns = PgsAttr.attribute("Columns", "1").toInt();
pageS.GapHorizontal = PgsAttr.attribute("GapHorizontal", "0").toDouble();
pageS.GapVertical = PgsAttr.attribute("GapVertical", "0").toDouble();
pageS.GapBelow = PgsAttr.attribute("GapBelow", "0").toDouble();
pageS.pageNames.clear();
QDomNode PGSN = PGS.firstChild();
while(!PGSN.isNull())
{
QDomElement PgsAttrN = PGSN.toElement();
if(PgsAttrN.tagName() == "PageNames")
pageS.pageNames.append(CommonStrings::untranslatePageSetLocString(PgsAttrN.attribute("Name")));
PGSN = PGSN.nextSibling();
}
m_Doc->pageSets.append(pageS);
}
PGS = PGS.nextSibling();
}
}
if (pg.tagName()=="CheckProfile")
{
struct checkerPrefs checkerSettings;
checkerSettings.ignoreErrors = static_cast<bool>(pg.attribute("ignoreErrors", "0").toInt());
checkerSettings.autoCheck = static_cast<bool>(pg.attribute("autoCheck", "1").toInt());
checkerSettings.checkGlyphs = static_cast<bool>(pg.attribute("checkGlyphs", "1").toInt());
checkerSettings.checkOrphans = static_cast<bool>(pg.attribute("checkOrphans", "1").toInt());
checkerSettings.checkOverflow = static_cast<bool>(pg.attribute("checkOverflow", "1").toInt());
checkerSettings.checkPictures = static_cast<bool>(pg.attribute("checkPictures", "1").toInt());
checkerSettings.checkResolution = static_cast<bool>(pg.attribute("checkResolution", "1").toInt());
checkerSettings.checkTransparency = static_cast<bool>(pg.attribute("checkTransparency", "1").toInt());
checkerSettings.minResolution = pg.attribute("minResolution", "72").toDouble();
checkerSettings.maxResolution = pg.attribute("maxResolution", "4800").toDouble();
checkerSettings.checkAnnotations = static_cast<bool>(pg.attribute("checkAnnotations", "0").toInt());
checkerSettings.checkRasterPDF = static_cast<bool>(pg.attribute("checkRasterPDF", "1").toInt());
checkerSettings.checkForGIF = static_cast<bool>(pg.attribute("checkForGIF", "1").toInt());
m_Doc->checkerProfiles[pg.attribute("Name")] = checkerSettings;
}
// 10/25/2004 pv - None is "reserved" color. cannot be defined in any file...
if(pg.tagName()=="COLOR" && pg.attribute("NAME")!=CommonStrings::None)
{
if (pg.hasAttribute("CMYK"))
lf.setNamedColor(pg.attribute("CMYK"));
else
lf.fromQColor(QColor(pg.attribute("RGB")));
if (pg.hasAttribute("Spot"))
lf.setSpotColor(static_cast<bool>(pg.attribute("Spot").toInt()));
else
lf.setSpotColor(false);
if (pg.hasAttribute("Register"))
lf.setRegistrationColor(static_cast<bool>(pg.attribute("Register").toInt()));
else
lf.setRegistrationColor(false);
m_Doc->PageColors.insert(pg.attribute("NAME"), lf);
}
if(pg.tagName()=="STYLE")
{
readParagraphStyle(vg, pg, *m_AvailableFonts, m_Doc);
m_Doc->docParagraphStyles.append(new ParagraphStyle(vg));
}
if(pg.tagName()=="JAVA")
m_Doc->JavaScripts[pg.attribute("NAME")] = pg.attribute("SCRIPT");
if(pg.tagName()=="LAYERS")
{
la.LNr = pg.attribute("NUMMER").toInt();
la.Level = pg.attribute("LEVEL").toInt();
la.Name = pg.attribute("NAME");
la.isViewable = pg.attribute("SICHTBAR").toInt();
la.isPrintable = pg.attribute("DRUCKEN").toInt();
la.isEditable = pg.attribute("EDIT", "1").toInt();
la.flowControl = pg.attribute("FLOW", "1").toInt();
la.transparency = pg.attribute("TRANS", "1").toDouble();
la.blendMode = pg.attribute("BLEND", "0").toInt();
la.outlineMode = pg.attribute("OUTL", "0").toInt();
if (pg.hasAttribute("LAYERC"))
la.markerColor = QColor(pg.attribute("LAYERC","#000000"));
else
{
QColor marker;
switch (la.LNr % 7)
{
case 0:
marker = Qt::black;
break;
case 1:
marker = Qt::red;
break;
case 2:
marker = Qt::green;
break;
case 3:
marker = Qt::blue;
break;
case 4:
marker = Qt::cyan;
break;
case 5:
marker = Qt::magenta;
break;
case 6:
marker = Qt::yellow;;
break;
}
la.markerColor = marker;
}
m_Doc->Layers.append(la);
}
/* if(pg.tagName()=="Bookmark")
{
bok.Title = pg.attribute("Title");
bok.Text = pg.attribute("Text");
bok.Aktion = pg.attribute("Aktion");
bok.ItemNr = pg.attribute("ItemNr").toInt();
bok.Seite = pg.attribute("Seite").toInt();
bok.Element = pg.attribute("Element").toInt();
bok.First = pg.attribute("First").toInt();
bok.Last = pg.attribute("Last").toInt();
bok.Prev = pg.attribute("Prev").toInt();
bok.Next = pg.attribute("Next").toInt();
bok.Parent = pg.attribute("Parent").toInt();
m_Doc->BookMarks.append(bok);
} */
if(pg.tagName()=="MultiLine")
{
multiLine ml;
QDomNode MuLn = PAGE.firstChild();
while(!MuLn.isNull())
{
QDomElement MuL = MuLn.toElement();
struct SingleLine sl;
sl.Color = MuL.attribute("Color");
sl.Dash = MuL.attribute("Dash").toInt();
sl.LineEnd = MuL.attribute("LineEnd").toInt();
sl.LineJoin = MuL.attribute("LineJoin").toInt();
sl.Shade = MuL.attribute("Shade").toInt();
sl.Width = MuL.attribute("Width").toDouble();
ml.push_back(sl);
MuLn = MuLn.nextSibling();
}
m_Doc->MLineStyles.insert(pg.attribute("Name"), ml);
}
if(pg.tagName()=="Arrows")
{
struct ArrowDesc arrow;
arrow.name = pg.attribute("Name");
arrow.userArrow = true;
double xa, ya;
QString tmp = pg.attribute("Points");
QTextStream fp(&tmp, IO_ReadOnly);
for (uint cx = 0; cx < pg.attribute("NumPoints").toUInt(); ++cx)
{
fp >> xa;
fp >> ya;
arrow.points.addPoint(xa, ya);
}
m_Doc->arrowStyles.append(arrow);
}
if(pg.tagName()=="PDF")
{
m_Doc->PDF_Options.Articles = static_cast<bool>(pg.attribute("Articles").toInt());
m_Doc->PDF_Options.Thumbnails = static_cast<bool>(pg.attribute("Thumbnails").toInt());
m_Doc->PDF_Options.Compress = static_cast<bool>(pg.attribute("Compress").toInt());
m_Doc->PDF_Options.CompressMethod = pg.attribute("CMethod", "0").toInt();
m_Doc->PDF_Options.Quality = pg.attribute("Quality", "0").toInt();
m_Doc->PDF_Options.RecalcPic = static_cast<bool>(pg.attribute("RecalcPic").toInt());
m_Doc->PDF_Options.Bookmarks = static_cast<bool>(pg.attribute("Bookmarks").toInt());
if (pg.hasAttribute("MirrorH"))
m_Doc->PDF_Options.MirrorH = static_cast<bool>(pg.attribute("MirrorH").toInt());
else
m_Doc->PDF_Options.MirrorH = false;
if (pg.hasAttribute("MirrorV"))
m_Doc->PDF_Options.MirrorV = static_cast<bool>(pg.attribute("MirrorV").toInt());
else
m_Doc->PDF_Options.MirrorV = false;
if (pg.hasAttribute("RotateDeg"))
m_Doc->PDF_Options.RotateDeg = pg.attribute("RotateDeg", "0").toInt();
else
m_Doc->PDF_Options.RotateDeg = 0;
if (pg.hasAttribute("Clip"))
m_Doc->PDF_Options.doClip = static_cast<bool>(pg.attribute("Clip").toInt());
else
m_Doc->PDF_Options.doClip = false;
m_Doc->PDF_Options.PresentMode = static_cast<bool>(pg.attribute("PresentMode").toInt());
m_Doc->PDF_Options.PicRes = pg.attribute("PicRes").toInt();
// Fixme: check input pdf version
m_Doc->PDF_Options.Version = (PDFOptions::PDFVersion)pg.attribute("Version").toInt();
m_Doc->PDF_Options.Resolution = pg.attribute("Resolution").toInt();
m_Doc->PDF_Options.Binding = pg.attribute("Binding").toInt();
m_Doc->PDF_Options.Datei = "";
m_Doc->PDF_Options.isGrayscale = static_cast<bool>(pg.attribute("Grayscale", "0").toInt());
m_Doc->PDF_Options.UseRGB = static_cast<bool>(pg.attribute("RGBMode", "0").toInt());
m_Doc->PDF_Options.UseProfiles = static_cast<bool>(pg.attribute("UseProfiles", "0").toInt());
m_Doc->PDF_Options.UseProfiles2 = static_cast<bool>(pg.attribute("UseProfiles2", "0").toInt());
m_Doc->PDF_Options.Intent = pg.attribute("Intent", "1").toInt();
m_Doc->PDF_Options.Intent2 = pg.attribute("Intent2", "1").toInt();
m_Doc->PDF_Options.SolidProf = pg.attribute("SolidP", "");
m_Doc->PDF_Options.ImageProf = pg.attribute("ImageP", "");
m_Doc->PDF_Options.PrintProf = pg.attribute("PrintP", "");
m_Doc->PDF_Options.Info = pg.attribute("InfoString", "");
m_Doc->PDF_Options.BleedTop = pg.attribute("BTop", "0").toDouble();
m_Doc->PDF_Options.BleedLeft = pg.attribute("BLeft", "0").toDouble();
m_Doc->PDF_Options.BleedRight = pg.attribute("BRight", "0").toDouble();
m_Doc->PDF_Options.BleedBottom = pg.attribute("BBottom", "0").toDouble();
m_Doc->PDF_Options.EmbeddedI = static_cast<bool>(pg.attribute("ImagePr", "0").toInt());
m_Doc->PDF_Options.PassOwner = pg.attribute("PassOwner", "");
m_Doc->PDF_Options.PassUser = pg.attribute("PassUser", "");
m_Doc->PDF_Options.Permissions = pg.attribute("Permissions", "-4").toInt();
m_Doc->PDF_Options.Encrypt = static_cast<bool>(pg.attribute("Encrypt", "0").toInt());
m_Doc->PDF_Options.useLayers = static_cast<bool>(pg.attribute("UseLayers", "0").toInt());
m_Doc->PDF_Options.UseLPI = static_cast<bool>(pg.attribute("UseLpi", "0").toInt());
m_Doc->PDF_Options.UseSpotColors = static_cast<bool>(pg.attribute("UseSpotColors", "1").toInt());
m_Doc->PDF_Options.doOverprint = static_cast<bool>(pg.attribute("doOverprint", "0").toInt());
m_Doc->PDF_Options.doMultiFile = static_cast<bool>(pg.attribute("doMultiFile", "0").toInt());
m_Doc->PDF_Options.displayBookmarks = static_cast<bool>(pg.attribute("displayBookmarks", "0").toInt());
m_Doc->PDF_Options.displayFullscreen = static_cast<bool>(pg.attribute("displayFullscreen", "0").toInt());
m_Doc->PDF_Options.displayLayers = static_cast<bool>(pg.attribute("displayLayers", "0").toInt());
m_Doc->PDF_Options.displayThumbs = static_cast<bool>(pg.attribute("displayThumbs", "0").toInt());
m_Doc->PDF_Options.hideMenuBar = static_cast<bool>(pg.attribute("hideMenuBar", "0").toInt());
m_Doc->PDF_Options.hideToolBar = static_cast<bool>(pg.attribute("hideToolBar", "0").toInt());
m_Doc->PDF_Options.fitWindow = static_cast<bool>(pg.attribute("fitWindow", "0").toInt());
m_Doc->PDF_Options.PageLayout = pg.attribute("PageLayout", "0").toInt();
m_Doc->PDF_Options.openAction = pg.attribute("openAction", "");
QDomNode PFO = PAGE.firstChild();
while(!PFO.isNull())
{
QDomElement pdfF = PFO.toElement();
if(pdfF.tagName() == "LPI")
{
struct LPIData lpo;
lpo.Angle = pdfF.attribute("Angle").toInt();
lpo.Frequency = pdfF.attribute("Frequency").toInt();
lpo.SpotFunc = pdfF.attribute("SpotFunction").toInt();
m_Doc->PDF_Options.LPISettings[pdfF.attribute("Color")] = lpo;
}
if(pdfF.tagName() == "Fonts")
{
if (!m_Doc->PDF_Options.EmbedList.contains(pdfF.attribute("Name")))
m_Doc->PDF_Options.EmbedList.append(pdfF.attribute("Name"));
}
if(pdfF.tagName() == "Subset")
{
if (!m_Doc->PDF_Options.SubsetList.contains(pdfF.attribute("Name")))
m_Doc->PDF_Options.SubsetList.append(pdfF.attribute("Name"));
}
if(pdfF.tagName() == "Effekte")
{
struct PDFPresentationData ef;
ef.pageEffectDuration = pdfF.attribute("pageEffectDuration").toInt();
ef.pageViewDuration = pdfF.attribute("pageViewDuration").toInt();
ef.effectType = pdfF.attribute("effectType").toInt();
ef.Dm = pdfF.attribute("Dm").toInt();
ef.M = pdfF.attribute("M").toInt();
ef.Di = pdfF.attribute("Di").toInt();
m_Doc->PDF_Options.PresentVals.append(ef);
}
PFO = PFO.nextSibling();
}
}
if(pg.tagName()=="DocItemAttributes")
{
QDomNode DIA = PAGE.firstChild();
m_Doc->docItemAttributes.clear();
while(!DIA.isNull())
{
QDomElement itemAttr = DIA.toElement();
if(itemAttr.tagName() == "ItemAttribute")
{
ObjectAttribute objattr;
objattr.name=itemAttr.attribute("Name");
objattr.type=itemAttr.attribute("Type");
objattr.value=itemAttr.attribute("Value");
objattr.parameter=itemAttr.attribute("Parameter");
objattr.relationship=itemAttr.attribute("Relationship");
objattr.relationshipto=itemAttr.attribute("RelationshipTo");
objattr.autoaddto=itemAttr.attribute("AutoAddTo");
m_Doc->docItemAttributes.append(objattr);
}
DIA = DIA.nextSibling();
}
}
if(pg.tagName()=="TablesOfContents")
{
QDomNode TOC = PAGE.firstChild();
m_Doc->docToCSetups.clear();
while(!TOC.isNull())
{
QDomElement tocElem = TOC.toElement();
if(tocElem.tagName() == "TableOfContents")
{
ToCSetup tocsetup;
tocsetup.name=tocElem.attribute("Name");
tocsetup.itemAttrName=tocElem.attribute("ItemAttributeName");
tocsetup.frameName=tocElem.attribute("FrameName");
tocsetup.listNonPrintingFrames=tocElem.attribute("ListNonPrinting");
tocsetup.textStyle=tocElem.attribute("Style");
QString numberPlacement=tocElem.attribute("NumberPlacement");
if (numberPlacement=="Beginning")
tocsetup.pageLocation=Beginning;
if (numberPlacement=="End")
tocsetup.pageLocation=End;
if (numberPlacement=="NotShown")
tocsetup.pageLocation=NotShown;
m_Doc->docToCSetups.append(tocsetup);
}
TOC = TOC.nextSibling();
}
}
if(pg.tagName()=="Sections")
{
QDomNode Section = PAGE.firstChild();
while(!Section.isNull())
{
QDomElement sectionElem = Section.toElement();
if(sectionElem.tagName() == "Section")
{
struct DocumentSection newSection;
newSection.number=sectionElem.attribute("Number").toInt();
newSection.name=sectionElem.attribute("Name");
newSection.fromindex=sectionElem.attribute("From").toInt();
newSection.toindex=sectionElem.attribute("To").toInt();
if (sectionElem.attribute("Type")=="Type_1_2_3")
newSection.type=Type_1_2_3;
if (sectionElem.attribute("Type")=="Type_i_ii_iii")
newSection.type=Type_i_ii_iii;
if (sectionElem.attribute("Type")=="Type_I_II_III")
newSection.type=Type_I_II_III;
if (sectionElem.attribute("Type")=="Type_a_b_c")
newSection.type=Type_a_b_c;
if (sectionElem.attribute("Type")=="Type_A_B_C")
newSection.type=Type_A_B_C;
newSection.sectionstartindex=sectionElem.attribute("Start").toInt();
newSection.reversed=static_cast<bool>(sectionElem.attribute("Reversed").toInt());
newSection.active=static_cast<bool>(sectionElem.attribute("Active").toInt());
m_Doc->sections.insert(newSection.number, newSection);
}
Section = Section.nextSibling();
}
}
if ((pg.tagName()=="PAGE") || (pg.tagName()=="MASTERPAGE"))
{
a = pg.attribute("NUM").toInt();
PgNam = "";
PgNam = pg.attribute("NAM", "");
//Pgc = m_Doc->pageCount;
//AtFl = m_Doc->usesAutomaticTextFrames();
if (PgNam.isEmpty())
{
//m_Doc->pageCount = Pgc;
//m_Doc->Pages = &m_Doc->DocPages;
//m_Doc->setUsesAutomaticTextFrames(AtFl);
m_Doc->setMasterPageMode(false);
}
else
{
//m_Doc->pageCount = 0;
//m_Doc->setUsesAutomaticTextFrames(false);
//m_Doc->Pages = &m_Doc->MasterPages;
m_Doc->setMasterPageMode(true);
}
//CB: Stop calling damn GUI code in loading docs! IT doesnt *look* like
//this makes a difference apart from being faster, of course.
//ScMW->slotNewPage(a);
//Apage = m_Doc->Pages.at(a);
if (PgNam.isEmpty())
{
Apage = m_Doc->addPage(a);
//m_Doc->DocPages = m_Doc->Pages;
//++m_Doc->pageCount;
}
else
{
Apage = m_Doc->addMasterPage(a, PgNam);
//Apage->setPageName(PgNam);
//m_Doc->MasterNames[PgNam] = a;
//m_Doc->MasterPages = m_Doc->Pages;
//m_Doc->pageCount = Pgc;
}
//m_Doc->setUsesAutomaticTextFrames(AtFl);
Apage->LeftPg=pg.attribute("LEFT", "0").toInt();
QString Mus = "";
Mus = pg.attribute("MNAM","Normal");
if (!m_Doc->masterPageMode())
Apage->MPageNam = Mus;
else
Apage->MPageNam = "";
if (pg.hasAttribute("Size"))
Apage->m_pageSize = pg.attribute("Size");
if (pg.hasAttribute("Orientation"))
Apage->PageOri = pg.attribute("Orientation").toInt();
Apage->setXOffset(pg.attribute("PAGEXPOS").toDouble());
Apage->setYOffset(pg.attribute("PAGEYPOS").toDouble());
if (pg.hasAttribute("PAGEWIDTH"))
Apage->setWidth(pg.attribute("PAGEWIDTH").toDouble());
else
Apage->setWidth(pg.attribute("PAGEWITH").toDouble());
Apage->setHeight(pg.attribute("PAGEHEIGHT").toDouble());
Apage->setInitialHeight(Apage->height());
Apage->setInitialWidth(Apage->width());
Apage->initialMargins.Top = QMAX(0.0, pg.attribute("BORDERTOP").toDouble());
Apage->initialMargins.Bottom = QMAX(0.0, pg.attribute("BORDERBOTTOM").toDouble());
Apage->initialMargins.Left = QMAX(0.0, pg.attribute("BORDERLEFT").toDouble());
Apage->initialMargins.Right = QMAX(0.0, pg.attribute("BORDERRIGHT").toDouble());
Apage->Margins.Top = Apage->initialMargins.Top;
Apage->Margins.Bottom = Apage->initialMargins.Bottom;
m_Doc->setMasterPageMode(false);
//m_Doc->Pages=&m_Doc->DocPages;
// guides reading
tmp = "";
Apage->guides.setHorizontalAutoGap(pg.attribute("AGhorizontalAutoGap", "0.0").toDouble());
Apage->guides.setVerticalAutoGap(pg.attribute("AGverticalAutoGap", "0.0").toDouble());
Apage->guides.setHorizontalAutoCount(pg.attribute("AGhorizontalAutoCount", "0").toInt());
Apage->guides.setVerticalAutoCount(pg.attribute("AGverticalAutoCount", "0").toInt());
Apage->guides.setAutoRefer(pg.attribute("AGautoRefer", "0").toInt());
GuideManagerCore::readVerticalGuides(pg.attribute("VerticalGuides"),
Apage,
GuideManagerCore::Standard,
pg.hasAttribute("NumVGuides"));
GuideManagerCore::readHorizontalGuides(pg.attribute("HorizontalGuides"),
Apage,
GuideManagerCore::Standard,
pg.hasAttribute("NumHGuides"));
}
if ((pg.tagName()=="PAGEOBJECT") || (pg.tagName()=="MASTEROBJECT") || (pg.tagName()=="FRAMEOBJECT"))
{
if ((pg.tagName()=="PAGEOBJECT") || (pg.tagName()=="FRAMEOBJECT"))
{
//m_Doc->Items = m_Doc->DocItems;
//m_Doc->Pages = &m_Doc->DocPages;
m_Doc->setMasterPageMode(false);
}
else
{
//m_Doc->Items = m_Doc->MasterItems;
//m_Doc->Pages = &m_Doc->MasterPages;
m_Doc->setMasterPageMode(true);
}
if ((!pg.attribute("OnMasterPage").isEmpty()) && (pg.tagName()=="MASTEROBJECT"))
m_Doc->setCurrentPage(m_Doc->MasterPages.at(m_Doc->MasterNames[pg.attribute("OnMasterPage")]));
if ((pg.attribute("NEXTITEM").toInt() != -1) || (static_cast<bool>(pg.attribute("AUTOTEXT").toInt())))
{
if (pg.attribute("BACKITEM").toInt() == -1)
LFrames.append(m_Doc->Items->count());
}
int docGc = m_Doc->GroupCounter;
m_Doc->GroupCounter = 0;
Neu = PasteItem(&pg, m_Doc);
Neu->setRedrawBounding();
if (pg.tagName()=="MASTEROBJECT")
Neu->OwnPage = m_Doc->OnPage(Neu);
else
Neu->OwnPage = pg.attribute("OwnPage").toInt();
if (pg.tagName()=="PAGEOBJECT")
Neu->OnMasterPage = "";
m_Doc->GroupCounter = docGc;
tmpf = pg.attribute("IFONT", m_Doc->toolSettings.defFont);
if ((!m_AvailableFonts->contains(tmpf)) || (!(*m_AvailableFonts)[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
}
else
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.GFontSub[tmpf]);
}
else
{
if (!m_Doc->UsedFonts.contains(tmpf))
{
// QFont fo = avail[tmpf]->Font;
// fo.setPointSize(qRound(m_Doc->toolSettings.defSize / 10.0));
m_Doc->AddFont(tmpf, qRound(m_Doc->toolSettings.defSize / 10.0));
}
}
QDomNode IT=pg.firstChild();
LastStyles * last = new LastStyles();
while(!IT.isNull())
{
QDomElement it=IT.toElement();
if (it.tagName()=="CSTOP")
{
QString name = it.attribute("NAME");
double ramp = it.attribute("RAMP", "0.0").toDouble();
int shade = it.attribute("SHADE", "100").toInt();
double opa = it.attribute("TRANS", "1").toDouble();
Neu->fill_gradient.addStop(SetColor(m_Doc, name, shade), ramp, 0.5, opa, name, shade);
}
if (it.tagName()=="ITEXT")
GetItemText(&it, m_Doc, Neu, last);
//CB PageItemAttributes
if(it.tagName()=="PageItemAttributes")
{
QDomNode PIA = it.firstChild();
ObjAttrVector pageItemAttributes;
while(!PIA.isNull())
{
QDomElement itemAttr = PIA.toElement();
if(itemAttr.tagName() == "ItemAttribute")
{
ObjectAttribute objattr;
objattr.name=itemAttr.attribute("Name");
objattr.type=itemAttr.attribute("Type");
objattr.value=itemAttr.attribute("Value");
objattr.parameter=itemAttr.attribute("Parameter");
objattr.relationship=itemAttr.attribute("Relationship");
objattr.relationshipto=itemAttr.attribute("RelationshipTo");
objattr.autoaddto=itemAttr.attribute("AutoAddTo");
pageItemAttributes.append(objattr);
}
PIA = PIA.nextSibling();
}
Neu->setObjectAttributes(&pageItemAttributes);
}
IT=IT.nextSibling();
}
delete last;
if (Neu->fill_gradient.Stops() == 0)
{
Neu->fill_gradient.addStop(m_Doc->PageColors[m_Doc->toolSettings.dBrush].getRGBColor(), 0.0, 0.5, 1.0, m_Doc->toolSettings.dBrush, 100);
Neu->fill_gradient.addStop(m_Doc->PageColors[m_Doc->toolSettings.dPen].getRGBColor(), 1.0, 0.5, 1.0, m_Doc->toolSettings.dPen, 100);
}
// Neu->Language = ScMW->GetLang(pg.attribute("LANGUAGE", m_Doc->Language));
Neu->isAutoText = static_cast<bool>(pg.attribute("AUTOTEXT").toInt());
Neu->isEmbedded = static_cast<bool>(pg.attribute("isInline", "0").toInt());
Neu->gXpos = pg.attribute("gXpos", "0.0").toDouble();
Neu->gYpos = pg.attribute("gYpos", "0.0").toDouble();
QString defaultVal;
defaultVal.setNum(Neu->width());
Neu->gWidth = pg.attribute("gWidth",defaultVal).toDouble();
defaultVal.setNum(Neu->height());
Neu->gHeight = pg.attribute("gHeight",defaultVal).toDouble();
/*FIXME if (Neu->lineSpacingMode() == 3)
{
m_Doc->docParagraphStyles[0].setUseBaselineGrid(true);
Neu->setLineSpacing(m_Doc->typographicSettings.valueBaseGrid-1);
}
*/ if (Neu->isAutoText)
m_Doc->LastAuto = Neu;
Neu->NextIt = pg.attribute("NEXTITEM").toInt();
if (Neu->isTableItem)
{
TableItems.append(Neu);
TableID.insert(pg.attribute("OwnLINK", "0").toInt(), Neu->ItemNr);
}
if (pg.tagName()=="FRAMEOBJECT")
{
m_Doc->FrameItems.append(m_Doc->Items->take(Neu->ItemNr));
Neu->ItemNr = m_Doc->FrameItems.count()-1;
}
/*
if ((pg.tagName()=="PAGEOBJECT") || (pg.tagName()=="FRAMEOBJECT"))
{
//m_Doc->DocItems = m_Doc->Items;
//m_Doc->DocPages = m_Doc->Pages;
}
else
{
//m_Doc->MasterItems = m_Doc->Items;
//m_Doc->MasterPages = m_Doc->Pages;
}
*/
m_Doc->setMasterPageMode(false);
//m_Doc->Pages=&m_Doc->DocPages;
counter++;
}
PAGE=PAGE.nextSibling();
}
PAGE=DOC.firstChild();
while(!PAGE.isNull())
{
QDomElement pg=PAGE.toElement();
if(pg.tagName()=="Bookmark")
{
bok.Title = pg.attribute("Title");
bok.Text = pg.attribute("Text");
bok.Aktion = pg.attribute("Aktion");
bok.ItemNr = pg.attribute("ItemNr").toInt();
bok.PageObject = m_Doc->Items->at(pg.attribute("Element").toInt());
bok.First = pg.attribute("First").toInt();
bok.Last = pg.attribute("Last").toInt();
bok.Prev = pg.attribute("Prev").toInt();
bok.Next = pg.attribute("Next").toInt();
bok.Parent = pg.attribute("Parent").toInt();
m_Doc->BookMarks.append(bok);
}
if(pg.tagName()=="Pattern")
{
ScPattern pat;
QDomNode pa = PAGE.firstChild();
uint ac = m_Doc->Items->count();
while(!pa.isNull())
{
QDomElement pite = pa.toElement();
m_Doc->setMasterPageMode(false);
if ((pite.attribute("NEXTITEM").toInt() != -1) || (static_cast<bool>(pite.attribute("AUTOTEXT").toInt())))
{
if (pite.attribute("BACKITEM").toInt() == -1)
LFrames.append(m_Doc->Items->count());
}
int docGc = m_Doc->GroupCounter;
m_Doc->GroupCounter = 0;
Neu = PasteItem(&pite, m_Doc);
Neu->setRedrawBounding();
Neu->OwnPage = pite.attribute("OwnPage").toInt();
Neu->OnMasterPage = "";
m_Doc->GroupCounter = docGc;
tmpf = pite.attribute("IFONT", m_Doc->toolSettings.defFont);
if ((!m_AvailableFonts->contains(tmpf)) || (!(*m_AvailableFonts)[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
}
else
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.GFontSub[tmpf]);
}
else
{
if (!m_Doc->UsedFonts.contains(tmpf))
m_Doc->AddFont(tmpf, qRound(m_Doc->toolSettings.defSize / 10.0));
}
QDomNode IT=pite.firstChild();
LastStyles * last = new LastStyles();
while(!IT.isNull())
{
QDomElement it=IT.toElement();
if (it.tagName()=="CSTOP")
{
QString name = it.attribute("NAME");
double ramp = it.attribute("RAMP", "0.0").toDouble();
int shade = it.attribute("SHADE", "100").toInt();
double opa = it.attribute("TRANS", "1").toDouble();
Neu->fill_gradient.addStop(SetColor(m_Doc, name, shade), ramp, 0.5, opa, name, shade);
}
if (it.tagName()=="ITEXT")
GetItemText(&it, m_Doc, Neu, last);
if(it.tagName()=="PageItemAttributes")
{
QDomNode PIA = it.firstChild();
ObjAttrVector pageItemAttributes;
while(!PIA.isNull())
{
QDomElement itemAttr = PIA.toElement();
if(itemAttr.tagName() == "ItemAttribute")
{
ObjectAttribute objattr;
objattr.name=itemAttr.attribute("Name");
objattr.type=itemAttr.attribute("Type");
objattr.value=itemAttr.attribute("Value");
objattr.parameter=itemAttr.attribute("Parameter");
objattr.relationship=itemAttr.attribute("Relationship");
objattr.relationshipto=itemAttr.attribute("RelationshipTo");
objattr.autoaddto=itemAttr.attribute("AutoAddTo");
pageItemAttributes.append(objattr);
}
PIA = PIA.nextSibling();
}
Neu->setObjectAttributes(&pageItemAttributes);
}
IT=IT.nextSibling();
}
delete last;
if (Neu->fill_gradient.Stops() == 0)
{
Neu->fill_gradient.addStop(m_Doc->PageColors[m_Doc->toolSettings.dBrush].getRGBColor(), 0.0, 0.5, 1.0, m_Doc->toolSettings.dBrush, 100);
Neu->fill_gradient.addStop(m_Doc->PageColors[m_Doc->toolSettings.dPen].getRGBColor(), 1.0, 0.5, 1.0, m_Doc->toolSettings.dPen, 100);
}
Neu->isAutoText = static_cast<bool>(pite.attribute("AUTOTEXT").toInt());
Neu->isEmbedded = static_cast<bool>(pite.attribute("isInline", "0").toInt());
Neu->gXpos = pite.attribute("gXpos", "0.0").toDouble();
Neu->gYpos = pite.attribute("gYpos", "0.0").toDouble();
QString defaultVal;
defaultVal.setNum(Neu->width());
Neu->gWidth = pite.attribute("gWidth",defaultVal).toDouble();
defaultVal.setNum(Neu->height());
Neu->gHeight = pite.attribute("gHeight",defaultVal).toDouble();
Neu->NextIt = pite.attribute("NEXTITEM").toInt();
if (Neu->isTableItem)
{
TableItems.append(Neu);
TableID.insert(pite.attribute("OwnLINK", "0").toInt(), Neu->ItemNr);
}
pa = pa.nextSibling();
}
uint ae = m_Doc->Items->count();
pat.setDoc(m_Doc);
PageItem* currItem = m_Doc->Items->at(ac);
pat.pattern = currItem->DrawObj_toImage();
for (uint as = ac; as < ae; ++as)
{
Neu = m_Doc->Items->take(ac);
Neu->ItemNr = pat.items.count();
pat.items.append(Neu);
}
pat.offsetX = pg.attribute("offsetX", "0").toDouble();
pat.offsetY = pg.attribute("offsetY", "0").toDouble();
pat.scaleX = pg.attribute("scaleX", "0").toDouble();
pat.scaleY = pg.attribute("scaleY", "0").toDouble();
pat.rotation = pg.attribute("rotation", "0").toDouble();
pat.width = pg.attribute("width", "0").toDouble();
pat.height = pg.attribute("height", "0").toDouble();
m_Doc->docPatterns.insert(pg.attribute("Name"), pat);
}
PAGE=PAGE.nextSibling();
}
DOC=DOC.nextSibling();
}
if (TableItems.count() != 0)
{
for (uint ttc = 0; ttc < TableItems.count(); ++ttc)
{
PageItem* ta = TableItems.at(ttc);
if (ta->TopLinkID != -1)
ta->TopLink = m_Doc->Items->at(TableID[ta->TopLinkID]);
else
ta->TopLink = 0;
if (ta->LeftLinkID != -1)
ta->LeftLink = m_Doc->Items->at(TableID[ta->LeftLinkID]);
else
ta->LeftLink = 0;
if (ta->RightLinkID != -1)
ta->RightLink = m_Doc->Items->at(TableID[ta->RightLinkID]);
else
ta->RightLink = 0;
if (ta->BottomLinkID != -1)
ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
else
ta->BottomLink = 0;
}
}
m_Doc->setActiveLayer(layerToSetActive);
m_Doc->setMasterPageMode(false);
m_Doc->reformPages();
if (m_Doc->Layers.count() == 0)
{
la.LNr = 0;
la.Level = 0;
la.Name = QObject::tr("Background");
la.isViewable = true;
la.isPrintable = true;
la.isEditable = true;
la.flowControl = true;
la.transparency = 1.0;
la.blendMode = 0;
la.markerColor = QColor(0, 0, 0);
la.outlineMode = false;
m_Doc->Layers.append(la);
}
if (LFrames.count() != 0)
{
PageItem *Its;
PageItem *Itn;
PageItem *Itr;
QValueList<int>::Iterator lc;
for (lc = LFrames.begin(); lc != LFrames.end(); ++lc)
{
Its = m_Doc->Items->at((*lc));
Itr = Its;
Its->BackBox = 0;
if (Its->isAutoText)
m_Doc->FirstAuto = Its;
while (Its->NextIt != -1)
{
Itn = m_Doc->Items->at(Its->NextIt);
Its->NextBox = Itn;
Itn->BackBox = Its;
Its->itemText.append(Itn->itemText);
Itn->itemText = Its->itemText;
Its = Itn;
}
Its->NextBox = 0;
}
}
if (m_mwProgressBar!=0)
m_mwProgressBar->setProgress(DOC.childNodes().count());
return true;
// return false;
}
bool Scribus134Format::saveFile(const QString & fileName, const FileFormat & /* fmt */)
{
QString text, tf, tf2, tc, tc2;
QDomDocument docu("scribus");
QString st="<SCRIBUSUTF8NEW></SCRIBUSUTF8NEW>";
docu.setContent(st);
QDomElement elem=docu.documentElement();
elem.setAttribute("Version", QString(VERSION));
QDomElement dc=docu.createElement("DOCUMENT");
dc.setAttribute("ANZPAGES",m_Doc->DocPages.count());
dc.setAttribute("PAGEWIDTH",m_Doc->pageWidth);
dc.setAttribute("PAGEHEIGHT",m_Doc->pageHeight);
dc.setAttribute("BORDERLEFT",m_Doc->pageMargins.Left);
dc.setAttribute("BORDERRIGHT",m_Doc->pageMargins.Right);
dc.setAttribute("BORDERTOP",m_Doc->pageMargins.Top);
dc.setAttribute("BORDERBOTTOM",m_Doc->pageMargins.Bottom);
dc.setAttribute("ORIENTATION",m_Doc->PageOri);
dc.setAttribute("PAGESIZE",m_Doc->m_pageSize);
dc.setAttribute("FIRSTNUM",m_Doc->FirstPnum);
dc.setAttribute("BOOK", m_Doc->currentPageLayout);
if(m_Doc->usesAutomaticTextFrames())
dc.setAttribute("AUTOTEXT",1);
dc.setAttribute("AUTOSPALTEN",m_Doc->PageSp);
dc.setAttribute("ABSTSPALTEN",m_Doc->PageSpa);
dc.setAttribute("UNITS",m_Doc->unitIndex());
dc.setAttribute("DFONT",m_Doc->toolSettings.defFont);
dc.setAttribute("DSIZE",m_Doc->toolSettings.defSize / 10.0);
dc.setAttribute("DCOL",m_Doc->toolSettings.dCols);
dc.setAttribute("DGAP",m_Doc->toolSettings.dGap);
dc.setAttribute("TabFill",m_Doc->toolSettings.tabFillChar);
dc.setAttribute("TabWidth",m_Doc->toolSettings.dTabWidth);
dc.setAttribute("AUTHOR",m_Doc->documentInfo.getAuthor());
dc.setAttribute("COMMENTS",m_Doc->documentInfo.getComments());
dc.setAttribute("KEYWORDS",m_Doc->documentInfo.getKeywords());
dc.setAttribute("PUBLISHER",m_Doc->documentInfo.getPublisher());
dc.setAttribute("DOCDATE",m_Doc->documentInfo.getDate());
dc.setAttribute("DOCTYPE",m_Doc->documentInfo.getType());
dc.setAttribute("DOCFORMAT",m_Doc->documentInfo.getFormat());
dc.setAttribute("DOCIDENT",m_Doc->documentInfo.getIdent());
dc.setAttribute("DOCSOURCE",m_Doc->documentInfo.getSource());
dc.setAttribute("DOCLANGINFO",m_Doc->documentInfo.getLangInfo());
dc.setAttribute("DOCRELATION",m_Doc->documentInfo.getRelation());
dc.setAttribute("DOCCOVER",m_Doc->documentInfo.getCover());
dc.setAttribute("DOCRIGHTS",m_Doc->documentInfo.getRights());
dc.setAttribute("DOCCONTRIB",m_Doc->documentInfo.getContrib());
dc.setAttribute("TITLE",m_Doc->documentInfo.getTitle());
dc.setAttribute("VHOCH",m_Doc->typographicSettings.valueSuperScript);
dc.setAttribute("VHOCHSC",m_Doc->typographicSettings.scalingSuperScript);
dc.setAttribute("VTIEF",m_Doc->typographicSettings.valueSubScript);
dc.setAttribute("VTIEFSC",m_Doc->typographicSettings.scalingSubScript);
dc.setAttribute("VKAPIT",m_Doc->typographicSettings.valueSmallCaps);
dc.setAttribute("BASEGRID",m_Doc->typographicSettings.valueBaseGrid);
dc.setAttribute("BASEO", m_Doc->typographicSettings.offsetBaseGrid);
dc.setAttribute("AUTOL", m_Doc->typographicSettings.autoLineSpacing);
dc.setAttribute("UnderlinePos", m_Doc->typographicSettings.valueUnderlinePos);
dc.setAttribute("UnderlineWidth", m_Doc->typographicSettings.valueUnderlineWidth);
dc.setAttribute("StrikeThruPos", m_Doc->typographicSettings.valueStrikeThruPos);
dc.setAttribute("StrikeThruWidth", m_Doc->typographicSettings.valueStrikeThruWidth);
dc.setAttribute("GROUPC",m_Doc->GroupCounter);
dc.setAttribute("HCMS", static_cast<int>(m_Doc->HasCMS));
dc.setAttribute("DPSo", static_cast<int>(m_Doc->CMSSettings.SoftProofOn));
dc.setAttribute("DPSFo", static_cast<int>(m_Doc->CMSSettings.SoftProofFullOn));
dc.setAttribute("DPuse", static_cast<int>(m_Doc->CMSSettings.CMSinUse));
dc.setAttribute("DPgam", static_cast<int>(m_Doc->CMSSettings.GamutCheck));
dc.setAttribute("DPbla", static_cast<int>(m_Doc->CMSSettings.BlackPoint));
dc.setAttribute("DPMo",m_Doc->CMSSettings.DefaultMonitorProfile);
dc.setAttribute("DPPr",m_Doc->CMSSettings.DefaultPrinterProfile);
dc.setAttribute("DPIn",m_Doc->CMSSettings.DefaultImageRGBProfile);
dc.setAttribute("DPInCMYK",m_Doc->CMSSettings.DefaultImageCMYKProfile);
dc.setAttribute("DPIn2",m_Doc->CMSSettings.DefaultSolidColorRGBProfile);
dc.setAttribute("DPIn3",m_Doc->CMSSettings.DefaultSolidColorCMYKProfile);
dc.setAttribute("DISc",m_Doc->CMSSettings.DefaultIntentColors);
dc.setAttribute("DIIm",m_Doc->CMSSettings.DefaultIntentImages);
dc.setAttribute("ALAYER", m_Doc->activeLayer());
dc.setAttribute("LANGUAGE", m_Doc->Language);
dc.setAttribute("MINWORDLEN", m_Doc->MinWordLen);
dc.setAttribute("HYCOUNT", m_Doc->HyCount);
dc.setAttribute("AUTOMATIC", static_cast<int>(m_Doc->Automatic));
dc.setAttribute("AUTOCHECK", static_cast<int>(m_Doc->AutoCheck));
dc.setAttribute("GUIDELOCK", static_cast<int>(m_Doc->GuideLock));
dc.setAttribute("SnapToGuides", static_cast<int>(m_Doc->SnapGuides));
dc.setAttribute("SnapToGrid", static_cast<int>(m_Doc->useRaster));
dc.setAttribute("MINGRID", m_Doc->guidesSettings.minorGrid);
dc.setAttribute("MAJGRID", m_Doc->guidesSettings.majorGrid);
dc.setAttribute("SHOWGRID", static_cast<int>(m_Doc->guidesSettings.gridShown));
dc.setAttribute("SHOWGUIDES", static_cast<int>(m_Doc->guidesSettings.guidesShown));
dc.setAttribute("showcolborders", static_cast<int>(m_Doc->guidesSettings.colBordersShown));
dc.setAttribute("SHOWFRAME", static_cast<int>(m_Doc->guidesSettings.framesShown));
dc.setAttribute("SHOWLAYERM", static_cast<int>(m_Doc->guidesSettings.layerMarkersShown));
dc.setAttribute("SHOWMARGIN", static_cast<int>(m_Doc->guidesSettings.marginsShown));
dc.setAttribute("SHOWBASE", static_cast<int>(m_Doc->guidesSettings.baseShown));
dc.setAttribute("SHOWPICT", static_cast<int>(m_Doc->guidesSettings.showPic));
dc.setAttribute("SHOWControl", static_cast<int>(m_Doc->guidesSettings.showControls));
dc.setAttribute("SHOWLINK", static_cast<int>(m_Doc->guidesSettings.linkShown));
dc.setAttribute("rulerMode", static_cast<int>(m_Doc->guidesSettings.rulerMode));
dc.setAttribute("showrulers", static_cast<int>(m_Doc->guidesSettings.rulersShown));
dc.setAttribute("rulerXoffset", m_Doc->rulerXoffset);
dc.setAttribute("rulerYoffset", m_Doc->rulerYoffset);
dc.setAttribute("GuideRad", m_Doc->guidesSettings.guideRad);
dc.setAttribute("GRAB",m_Doc->guidesSettings.grabRad);
dc.setAttribute("POLYC", m_Doc->toolSettings.polyC);
dc.setAttribute("POLYF", m_Doc->toolSettings.polyF);
dc.setAttribute("POLYR", m_Doc->toolSettings.polyR);
dc.setAttribute("POLYFD", m_Doc->toolSettings.polyFd);
dc.setAttribute("POLYS", static_cast<int>(m_Doc->toolSettings.polyS));
dc.setAttribute("AutoSave", static_cast<int>(m_Doc->AutoSave));
dc.setAttribute("AutoSaveTime", m_Doc->AutoSaveTime);
dc.setAttribute("ScratchBottom", m_Doc->ScratchBottom);
dc.setAttribute("ScratchLeft", m_Doc->ScratchLeft);
dc.setAttribute("ScratchRight", m_Doc->ScratchRight);
dc.setAttribute("ScratchTop", m_Doc->ScratchTop);
dc.setAttribute("StartArrow", m_Doc->toolSettings.dStartArrow);
dc.setAttribute("EndArrow", m_Doc->toolSettings.dEndArrow);
dc.setAttribute("PEN",m_Doc->toolSettings.dPen);
dc.setAttribute("BRUSH",m_Doc->toolSettings.dBrush);
dc.setAttribute("PENLINE",m_Doc->toolSettings.dPenLine);
dc.setAttribute("PENTEXT",m_Doc->toolSettings.dPenText);
dc.setAttribute("StrokeText",m_Doc->toolSettings.dStrokeText);
dc.setAttribute("TextBackGround", m_Doc->toolSettings.dTextBackGround);
dc.setAttribute("TextLineColor", m_Doc->toolSettings.dTextLineColor);
dc.setAttribute("TextBackGroundShade", m_Doc->toolSettings.dTextBackGroundShade);
dc.setAttribute("TextLineShade", m_Doc->toolSettings.dTextLineShade);
dc.setAttribute("TextPenShade", m_Doc->toolSettings.dTextPenShade);
dc.setAttribute("TextStrokeShade", m_Doc->toolSettings.dTextStrokeShade);
dc.setAttribute("STIL",m_Doc->toolSettings.dLineArt);
dc.setAttribute("STILLINE",m_Doc->toolSettings.dLstyleLine);
dc.setAttribute("WIDTH",m_Doc->toolSettings.dWidth);
dc.setAttribute("WIDTHLINE",m_Doc->toolSettings.dWidthLine);
dc.setAttribute("PENSHADE",m_Doc->toolSettings.dShade2);
dc.setAttribute("LINESHADE",m_Doc->toolSettings.dShadeLine);
dc.setAttribute("BRUSHSHADE",m_Doc->toolSettings.dShade);
dc.setAttribute("MAGMIN",m_Doc->toolSettings.magMin);
dc.setAttribute("MAGMAX",m_Doc->toolSettings.magMax);
dc.setAttribute("MAGSTEP",m_Doc->toolSettings.magStep);
dc.setAttribute("CPICT",m_Doc->toolSettings.dBrushPict);
dc.setAttribute("PICTSHADE",m_Doc->toolSettings.shadePict);
dc.setAttribute("PICTSCX",m_Doc->toolSettings.scaleX);
dc.setAttribute("PICTSCY",m_Doc->toolSettings.scaleY);
dc.setAttribute("PSCALE", static_cast<int>(m_Doc->toolSettings.scaleType));
dc.setAttribute("PASPECT", static_cast<int>(m_Doc->toolSettings.aspectRatio));
dc.setAttribute("EmbeddedPath", static_cast<int>(m_Doc->toolSettings.useEmbeddedPath));
dc.setAttribute("HalfRes", m_Doc->toolSettings.lowResType);
dc.setAttribute("MINORC",m_Doc->guidesSettings.minorColor.name());
dc.setAttribute("MAJORC",m_Doc->guidesSettings.majorColor.name());
dc.setAttribute("GuideC", m_Doc->guidesSettings.guideColor.name());
dc.setAttribute("BaseC", m_Doc->guidesSettings.baseColor.name());
dc.setAttribute("GuideZ", m_Doc->guidesSettings.guideRad);
dc.setAttribute("BACKG", static_cast<int>(m_Doc->guidesSettings.before));
dc.setAttribute("PAGEC",m_Doc->papColor.name());
dc.setAttribute("MARGC",m_Doc->guidesSettings.margColor.name());
dc.setAttribute("RANDF", static_cast<int>(m_Doc->marginColored));
dc.setAttribute("currentProfile", m_Doc->curCheckProfile);
CheckerPrefsList::Iterator itcp;
CheckerPrefsList::Iterator itcpend=m_Doc->checkerProfiles.end();
for (itcp = m_Doc->checkerProfiles.begin(); itcp != itcpend; ++itcp)
{
QDomElement dc79a=docu.createElement("CheckProfile");
dc79a.setAttribute("Name",itcp.key());
dc79a.setAttribute("ignoreErrors", static_cast<int>(itcp.data().ignoreErrors));
dc79a.setAttribute("autoCheck", static_cast<int>(itcp.data().autoCheck));
dc79a.setAttribute("checkGlyphs", static_cast<int>(itcp.data().checkGlyphs));
dc79a.setAttribute("checkOrphans", static_cast<int>(itcp.data().checkOrphans));
dc79a.setAttribute("checkOverflow", static_cast<int>(itcp.data().checkOverflow));
dc79a.setAttribute("checkPictures", static_cast<int>(itcp.data().checkPictures));
dc79a.setAttribute("checkResolution", static_cast<int>(itcp.data().checkResolution));
dc79a.setAttribute("checkTransparency", static_cast<int>(itcp.data().checkTransparency));
dc79a.setAttribute("minResolution",itcp.data().minResolution);
dc79a.setAttribute("maxResolution",itcp.data().maxResolution);
dc79a.setAttribute("checkAnnotations", static_cast<int>(itcp.data().checkAnnotations));
dc79a.setAttribute("checkRasterPDF", static_cast<int>(itcp.data().checkRasterPDF));
dc79a.setAttribute("checkForGIF", static_cast<int>(itcp.data().checkForGIF));
dc.appendChild(dc79a);
}
QMap<QString,multiLine>::Iterator itMU;
for (itMU = m_Doc->MLineStyles.begin(); itMU != m_Doc->MLineStyles.end(); ++itMU)
{
QDomElement MuL=docu.createElement("MultiLine");
MuL.setAttribute("Name",itMU.key());
multiLine ml = itMU.data();
multiLine::iterator itMU2;
for (itMU2 = ml.begin(); itMU2 != ml.end(); ++itMU2)
{
QDomElement SuL=docu.createElement("SubLine");
SuL.setAttribute("Color", (*itMU2).Color);
SuL.setAttribute("Shade", (*itMU2).Shade);
SuL.setAttribute("Dash", (*itMU2).Dash);
SuL.setAttribute("LineEnd", (*itMU2).LineEnd);
SuL.setAttribute("LineJoin", (*itMU2).LineJoin);
SuL.setAttribute("Width", (*itMU2).Width);
MuL.appendChild(SuL);
}
dc.appendChild(MuL);
}
QValueList<ArrowDesc>::Iterator itar;
for (itar = m_Doc->arrowStyles.begin(); itar != m_Doc->arrowStyles.end(); ++itar)
{
if ((*itar).userArrow)
{
QDomElement ar=docu.createElement("Arrows");
ar.setAttribute("NumPoints", (*itar).points.size());
QString arp = "";
QString tmp, tmpy;
double xa, ya;
for (uint nxx = 0; nxx < (*itar).points.size(); ++nxx)
{
(*itar).points.point(nxx, &xa, &ya);
arp += tmp.setNum(xa) + " " + tmpy.setNum(ya) + " ";
}
ar.setAttribute("Points", arp);
ar.setAttribute("Name", (*itar).name);
dc.appendChild(ar);
}
}
QMap<QString,QString>::Iterator itja;
for (itja = m_Doc->JavaScripts.begin(); itja != m_Doc->JavaScripts.end(); ++itja)
{
QDomElement jav=docu.createElement("JAVA");
jav.setAttribute("NAME",itja.key());
jav.setAttribute("SCRIPT",itja.data());
dc.appendChild(jav);
}
QValueList<ScribusDoc::BookMa>::Iterator itbm;
for (itbm = m_Doc->BookMarks.begin(); itbm != m_Doc->BookMarks.end(); ++itbm)
{
QDomElement fn=docu.createElement("Bookmark");
fn.setAttribute("Title",(*itbm).Title);
fn.setAttribute("Text",(*itbm).Text);
fn.setAttribute("Aktion",(*itbm).Aktion);
fn.setAttribute("ItemNr", (*itbm).ItemNr);
fn.setAttribute("Element", (*itbm).PageObject->ItemNr);
fn.setAttribute("First", (*itbm).First);
fn.setAttribute("Last", (*itbm).Last);
fn.setAttribute("Prev", (*itbm).Prev);
fn.setAttribute("Next", (*itbm).Next);
fn.setAttribute("Parent", (*itbm).Parent);
dc.appendChild(fn);
}
ColorList::Iterator itc;
for (itc = m_Doc->PageColors.begin(); itc != m_Doc->PageColors.end(); ++itc)
{
QDomElement co=docu.createElement("COLOR");
co.setAttribute("NAME",itc.key());
if (m_Doc->PageColors[itc.key()].getColorModel() == colorModelRGB)
co.setAttribute("RGB",m_Doc->PageColors[itc.key()].nameRGB());
else
co.setAttribute("CMYK",m_Doc->PageColors[itc.key()].nameCMYK());
co.setAttribute("Spot",static_cast<int>(m_Doc->PageColors[itc.key()].isSpotColor()));
co.setAttribute("Register",static_cast<int>(m_Doc->PageColors[itc.key()].isRegistrationColor()));
dc.appendChild(co);
}
if (m_Doc->docParagraphStyles.count() > 5)
{
for (uint ff = 5; ff < m_Doc->docParagraphStyles.count(); ++ff)
{
QDomElement fo=docu.createElement("STYLE");
fo.setAttribute("NAME",m_Doc->docParagraphStyles[ff].name());
fo.setAttribute("ALIGN",m_Doc->docParagraphStyles[ff].alignment());
fo.setAttribute("LINESPMode",m_Doc->docParagraphStyles[ff].lineSpacingMode());
fo.setAttribute("LINESP",m_Doc->docParagraphStyles[ff].lineSpacing());
fo.setAttribute("INDENT",m_Doc->docParagraphStyles[ff].leftMargin());
fo.setAttribute("FIRST",m_Doc->docParagraphStyles[ff].firstIndent());
fo.setAttribute("VOR",m_Doc->docParagraphStyles[ff].gapBefore());
fo.setAttribute("NACH",m_Doc->docParagraphStyles[ff].gapAfter());
fo.setAttribute("FONT",m_Doc->docParagraphStyles[ff].charStyle().font().scName());
fo.setAttribute("FONTSIZE",m_Doc->docParagraphStyles[ff].charStyle().fontSize() / 10.0);
fo.setAttribute("DROP", static_cast<int>(m_Doc->docParagraphStyles[ff].hasDropCap()));
fo.setAttribute("DROPLIN", m_Doc->docParagraphStyles[ff].dropCapLines());
fo.setAttribute("DROPDIST", m_Doc->docParagraphStyles[ff].dropCapOffset());
fo.setAttribute("EFFECT", m_Doc->docParagraphStyles[ff].charStyle().effects());
if (m_Doc->docParagraphStyles[ff].tabValues().count() != 0)
{
for (uint a = 0; a < m_Doc->docParagraphStyles[ff].tabValues().count(); ++a)
{
QDomElement tabs = docu.createElement("Tabs");
tabs.setAttribute("Type", (*m_Doc->docParagraphStyles[ff].tabValues().at(a)).tabType);
tabs.setAttribute("Pos", (*m_Doc->docParagraphStyles[ff].tabValues().at(a)).tabPosition);
QString tabCh = "";
if (!(*m_Doc->docParagraphStyles[ff].tabValues().at(a)).tabFillChar.isNull())
tabCh = QString((*m_Doc->docParagraphStyles[ff].tabValues().at(a)).tabFillChar);
tabs.setAttribute("Fill", tabCh);
fo.appendChild(tabs);
}
}
fo.setAttribute("FCOLOR",m_Doc->docParagraphStyles[ff].charStyle().fillColor());
fo.setAttribute("FSHADE",m_Doc->docParagraphStyles[ff].charStyle().fillShade());
fo.setAttribute("SCOLOR",m_Doc->docParagraphStyles[ff].charStyle().strokeColor());
fo.setAttribute("SSHADE",m_Doc->docParagraphStyles[ff].charStyle().strokeShade());
fo.setAttribute("BASE", static_cast<int>(m_Doc->docParagraphStyles[ff].useBaselineGrid()));
fo.setAttribute("TXTSHX",m_Doc->docParagraphStyles[ff].charStyle().shadowXOffset() / 10.0);
fo.setAttribute("TXTSHY",m_Doc->docParagraphStyles[ff].charStyle().shadowYOffset() / 10.0);
fo.setAttribute("TXTOUT",m_Doc->docParagraphStyles[ff].charStyle().outlineWidth() / 10.0);
fo.setAttribute("TXTULP",m_Doc->docParagraphStyles[ff].charStyle().underlineOffset() / 10.0);
fo.setAttribute("TXTULW",m_Doc->docParagraphStyles[ff].charStyle().underlineWidth() / 10.0);
fo.setAttribute("TXTSTP",m_Doc->docParagraphStyles[ff].charStyle().strikethruOffset() / 10.0);
fo.setAttribute("TXTSTW",m_Doc->docParagraphStyles[ff].charStyle().strikethruWidth() / 10.0);
fo.setAttribute("SCALEH",m_Doc->docParagraphStyles[ff].charStyle().scaleH() / 10.0);
fo.setAttribute("SCALEV",m_Doc->docParagraphStyles[ff].charStyle().scaleV() / 10.0);
fo.setAttribute("BASEO",m_Doc->docParagraphStyles[ff].charStyle().baselineOffset() / 10.0);
fo.setAttribute("KERN",m_Doc->docParagraphStyles[ff].charStyle().tracking() / 10.0);
dc.appendChild(fo);
}
}
uint layerCount=m_Doc->layerCount();
for (uint lay = 0; lay < layerCount; ++lay)
{
QDomElement la = docu.createElement("LAYERS");
la.setAttribute("NUMMER",m_Doc->Layers[lay].LNr);
la.setAttribute("LEVEL",m_Doc->Layers[lay].Level);
la.setAttribute("NAME",m_Doc->Layers[lay].Name);
la.setAttribute("SICHTBAR", static_cast<int>(m_Doc->Layers[lay].isViewable));
la.setAttribute("DRUCKEN", static_cast<int>(m_Doc->Layers[lay].isPrintable));
la.setAttribute("EDIT", static_cast<int>(m_Doc->Layers[lay].isEditable));
la.setAttribute("FLOW", static_cast<int>(m_Doc->Layers[lay].flowControl));
la.setAttribute("TRANS", m_Doc->Layers[lay].transparency);
la.setAttribute("BLEND", m_Doc->Layers[lay].blendMode);
la.setAttribute("OUTL", static_cast<int>(m_Doc->Layers[lay].outlineMode));
la.setAttribute("LAYERC",m_Doc->Layers[lay].markerColor.name());
dc.appendChild(la);
}
QDomElement pdf = docu.createElement("PDF");
pdf.setAttribute("Thumbnails", static_cast<int>(m_Doc->PDF_Options.Thumbnails));
pdf.setAttribute("Articles", static_cast<int>(m_Doc->PDF_Options.Articles));
pdf.setAttribute("Bookmarks", static_cast<int>(m_Doc->PDF_Options.Bookmarks));
pdf.setAttribute("Compress", static_cast<int>(m_Doc->PDF_Options.Compress));
pdf.setAttribute("CMethod", m_Doc->PDF_Options.CompressMethod);
pdf.setAttribute("Quality", m_Doc->PDF_Options.Quality);
pdf.setAttribute("MirrorH", static_cast<int>(m_Doc->PDF_Options.MirrorH));
pdf.setAttribute("MirrorV", static_cast<int>(m_Doc->PDF_Options.MirrorV));
pdf.setAttribute("Clip", static_cast<int>(m_Doc->PDF_Options.doClip));
pdf.setAttribute("RotateDeg", static_cast<int>(m_Doc->PDF_Options.RotateDeg));
pdf.setAttribute("PresentMode", static_cast<int>(m_Doc->PDF_Options.PresentMode));
pdf.setAttribute("RecalcPic", static_cast<int>(m_Doc->PDF_Options.RecalcPic));
pdf.setAttribute("Grayscale", static_cast<int>(m_Doc->PDF_Options.isGrayscale));
pdf.setAttribute("RGBMode", static_cast<int>(m_Doc->PDF_Options.UseRGB));
pdf.setAttribute("UseProfiles", static_cast<int>(m_Doc->PDF_Options.UseProfiles));
pdf.setAttribute("UseProfiles2", static_cast<int>(m_Doc->PDF_Options.UseProfiles2));
pdf.setAttribute("Binding", m_Doc->PDF_Options.Binding);
pdf.setAttribute("PicRes", m_Doc->PDF_Options.PicRes);
pdf.setAttribute("Resolution", m_Doc->PDF_Options.Resolution);
pdf.setAttribute("Version", m_Doc->PDF_Options.Version);
pdf.setAttribute("Intent", m_Doc->PDF_Options.Intent);
pdf.setAttribute("Intent2", m_Doc->PDF_Options.Intent2);
pdf.setAttribute("SolidP", m_Doc->PDF_Options.SolidProf);
pdf.setAttribute("ImageP", m_Doc->PDF_Options.ImageProf);
pdf.setAttribute("PrintP", m_Doc->PDF_Options.PrintProf);
pdf.setAttribute("InfoString", m_Doc->PDF_Options.Info);
pdf.setAttribute("BTop", m_Doc->PDF_Options.BleedTop);
pdf.setAttribute("BLeft", m_Doc->PDF_Options.BleedLeft);
pdf.setAttribute("BRight", m_Doc->PDF_Options.BleedRight);
pdf.setAttribute("BBottom", m_Doc->PDF_Options.BleedBottom);
pdf.setAttribute("ImagePr", static_cast<int>(m_Doc->PDF_Options.EmbeddedI));
pdf.setAttribute("PassOwner", m_Doc->PDF_Options.PassOwner);
pdf.setAttribute("PassUser", m_Doc->PDF_Options.PassUser);
pdf.setAttribute("Permissions", m_Doc->PDF_Options.Permissions);
pdf.setAttribute("Encrypt", static_cast<int>(m_Doc->PDF_Options.Encrypt));
pdf.setAttribute("UseLayers", static_cast<int>(m_Doc->PDF_Options.useLayers));
pdf.setAttribute("UseLpi", static_cast<int>(m_Doc->PDF_Options.UseLPI));
pdf.setAttribute("UseSpotColors", static_cast<int>(m_Doc->PDF_Options.UseSpotColors));
pdf.setAttribute("doOverprint", static_cast<int>(m_Doc->PDF_Options.doOverprint));
pdf.setAttribute("doMultiFile", static_cast<int>(m_Doc->PDF_Options.doMultiFile));
pdf.setAttribute("displayBookmarks", static_cast<int>(m_Doc->PDF_Options.displayBookmarks));
pdf.setAttribute("displayFullscreen", static_cast<int>(m_Doc->PDF_Options.displayFullscreen));
pdf.setAttribute("displayLayers", static_cast<int>(m_Doc->PDF_Options.displayLayers));
pdf.setAttribute("displayThumbs", static_cast<int>(m_Doc->PDF_Options.displayThumbs));
pdf.setAttribute("hideMenuBar", static_cast<int>(m_Doc->PDF_Options.hideMenuBar));
pdf.setAttribute("hideToolBar", static_cast<int>(m_Doc->PDF_Options.hideToolBar));
pdf.setAttribute("fitWindow", static_cast<int>(m_Doc->PDF_Options.fitWindow));
pdf.setAttribute("PageLayout", m_Doc->PDF_Options.PageLayout);
pdf.setAttribute("openAction", m_Doc->PDF_Options.openAction);
for (uint pdoF = 0; pdoF < m_Doc->PDF_Options.EmbedList.count(); ++pdoF)
{
QDomElement pdf2 = docu.createElement("Fonts");
pdf2.setAttribute("Name", m_Doc->PDF_Options.EmbedList[pdoF]);
pdf.appendChild(pdf2);
}
for (uint pdoS = 0; pdoS < m_Doc->PDF_Options.SubsetList.count(); ++pdoS)
{
QDomElement pdf4 = docu.createElement("Subset");
pdf4.setAttribute("Name", m_Doc->PDF_Options.SubsetList[pdoS]);
pdf.appendChild(pdf4);
}
for (uint pdoE = 0; pdoE < m_Doc->PDF_Options.PresentVals.count(); ++pdoE)
{
QDomElement pdf3 = docu.createElement("Effekte");
pdf3.setAttribute("pageEffectDuration", m_Doc->PDF_Options.PresentVals[pdoE].pageEffectDuration);
pdf3.setAttribute("pageViewDuration", m_Doc->PDF_Options.PresentVals[pdoE].pageViewDuration);
pdf3.setAttribute("effectType", m_Doc->PDF_Options.PresentVals[pdoE].effectType);
pdf3.setAttribute("Dm", m_Doc->PDF_Options.PresentVals[pdoE].Dm);
pdf3.setAttribute("M", m_Doc->PDF_Options.PresentVals[pdoE].M);
pdf3.setAttribute("Di", m_Doc->PDF_Options.PresentVals[pdoE].Di);
pdf.appendChild(pdf3);
}
QMap<QString,LPIData>::Iterator itlp;
for (itlp = m_Doc->PDF_Options.LPISettings.begin(); itlp != m_Doc->PDF_Options.LPISettings.end(); ++itlp)
{
QDomElement pdf4 = docu.createElement("LPI");
pdf4.setAttribute("Color", itlp.key());
pdf4.setAttribute("Frequency", itlp.data().Frequency);
pdf4.setAttribute("Angle", itlp.data().Angle);
pdf4.setAttribute("SpotFunction", itlp.data().SpotFunc);
pdf.appendChild(pdf4);
}
dc.appendChild(pdf);
QDomElement docItemAttrs = docu.createElement("DocItemAttributes");
for(ObjAttrVector::Iterator objAttrIt = m_Doc->docItemAttributes.begin() ; objAttrIt != m_Doc->docItemAttributes.end(); ++objAttrIt )
{
QDomElement itemAttr = docu.createElement("ItemAttribute");
itemAttr.setAttribute("Name", (*objAttrIt).name);
itemAttr.setAttribute("Type", (*objAttrIt).type);
itemAttr.setAttribute("Value", (*objAttrIt).value);
itemAttr.setAttribute("Parameter", (*objAttrIt).parameter);
itemAttr.setAttribute("Relationship", (*objAttrIt).relationship);
itemAttr.setAttribute("RelationshipTo", (*objAttrIt).relationshipto);
itemAttr.setAttribute("AutoAddTo", (*objAttrIt).autoaddto);
docItemAttrs.appendChild(itemAttr);
}
dc.appendChild(docItemAttrs);
QDomElement tocElem = docu.createElement("TablesOfContents");
for(ToCSetupVector::Iterator tocSetupIt = m_Doc->docToCSetups.begin() ; tocSetupIt != m_Doc->docToCSetups.end(); ++tocSetupIt )
{
QDomElement tocsetup = docu.createElement("TableOfContents");
tocsetup.setAttribute("Name", (*tocSetupIt).name);
tocsetup.setAttribute("ItemAttributeName", (*tocSetupIt).itemAttrName);
tocsetup.setAttribute("FrameName", (*tocSetupIt).frameName);
tocsetup.setAttribute("ListNonPrinting", (*tocSetupIt).listNonPrintingFrames);
tocsetup.setAttribute("Style", (*tocSetupIt).textStyle);
switch ((*tocSetupIt).pageLocation)
{
case Beginning:
tocsetup.setAttribute("NumberPlacement", "Beginning");
break;
case End:
tocsetup.setAttribute("NumberPlacement", "End");
break;
case NotShown:
tocsetup.setAttribute("NumberPlacement", "NotShown");
break;
}
tocElem.appendChild(tocsetup);
}
dc.appendChild(tocElem);
QDomElement sectionElem = docu.createElement("Sections");
for(DocumentSectionMap::Iterator it = m_Doc->sections.begin() ; it != m_Doc->sections.end(); ++it )
{
QDomElement currsection = docu.createElement("Section");
currsection.setAttribute("Number", (*it).number);
currsection.setAttribute("Name", (*it).name);
currsection.setAttribute("From", (*it).fromindex);
currsection.setAttribute("To", (*it).toindex);
switch ((*it).type)
{
case Type_1_2_3:
currsection.setAttribute("Type", "Type_1_2_3");
break;
case Type_i_ii_iii:
currsection.setAttribute("Type", "Type_i_ii_iii");
break;
case Type_I_II_III:
currsection.setAttribute("Type", "Type_I_II_III");
break;
case Type_a_b_c:
currsection.setAttribute("Type", "Type_a_b_c");
break;
case Type_A_B_C:
currsection.setAttribute("Type", "Type_A_B_C");
break;
}
currsection.setAttribute("Start", (*it).sectionstartindex);
currsection.setAttribute("Reversed", (*it).reversed);
currsection.setAttribute("Active", (*it).active);
sectionElem.appendChild(currsection);
}
dc.appendChild(sectionElem);
QDomElement pageSetAttr = docu.createElement("PageSets");
QValueList<PageSet>::Iterator itpgset;
for(itpgset = m_Doc->pageSets.begin(); itpgset != m_Doc->pageSets.end(); ++itpgset )
{
QDomElement pgst = docu.createElement("Set");
pgst.setAttribute("Name", (*itpgset).Name);
pgst.setAttribute("FirstPage", (*itpgset).FirstPage);
pgst.setAttribute("Rows", (*itpgset).Rows);
pgst.setAttribute("Columns", (*itpgset).Columns);
pgst.setAttribute("GapHorizontal", (*itpgset).GapHorizontal);
pgst.setAttribute("GapVertical", (*itpgset).GapVertical);
pgst.setAttribute("GapBelow", (*itpgset).GapBelow);
QStringList pNames = (*itpgset).pageNames;
QStringList::Iterator itpgsetN;
for(itpgsetN = pNames.begin(); itpgsetN != pNames.end(); ++itpgsetN )
{
QDomElement pgstN = docu.createElement("PageNames");
pgstN.setAttribute("Name", (*itpgsetN));
pgst.appendChild(pgstN);
}
pageSetAttr.appendChild(pgst);
}
dc.appendChild(pageSetAttr);
QMap<QString, ScPattern>::Iterator itPat;
for (itPat = m_Doc->docPatterns.begin(); itPat != m_Doc->docPatterns.end(); ++itPat)
{
QDomElement pat = docu.createElement("Pattern");
pat.setAttribute("Name",itPat.key());
ScPattern pa = itPat.data();
pat.setAttribute("offsetX", pa.offsetX);
pat.setAttribute("offsetY", pa.offsetY);
pat.setAttribute("scaleX", pa.scaleX);
pat.setAttribute("scaleY", pa.scaleY);
pat.setAttribute("rotation", pa.rotation);
pat.setAttribute("width", pa.width);
pat.setAttribute("height", pa.height);
WriteObjects(m_Doc, &docu, &pat, 0, 0, 3, &pa.items);
dc.appendChild(pat);
}
if (m_mwProgressBar != 0)
{
m_mwProgressBar->setTotalSteps(m_Doc->DocPages.count()+m_Doc->MasterPages.count()+m_Doc->DocItems.count()+m_Doc->MasterItems.count()+m_Doc->FrameItems.count());
m_mwProgressBar->setProgress(0);
}
WritePages(m_Doc, &docu, &dc, m_mwProgressBar, 0, true);
WritePages(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count(), false);
WriteObjects(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count()+m_Doc->DocPages.count(), 2);
WriteObjects(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count()+m_Doc->DocPages.count()+m_Doc->FrameItems.count(), 0);
WriteObjects(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count()+m_Doc->DocPages.count()+m_Doc->MasterItems.count()+m_Doc->FrameItems.count(), 1);
elem.appendChild(dc);
/**
* changed to enable saving
* of *.gz documents
* 2.7.2002 C.Toepp
* <c.toepp@gmx.de>
*/
#ifdef HAVE_LIBZ
QCString cs = docu.toCString(); // UTF-8 QCString
if(fileName.right(2) == "gz")
{
// zipped saving
// XXX: latin1() should probably be local8Bit()
gzFile gzDoc = gzopen(fileName.latin1(),"wb");
if(gzDoc == NULL)
return false;
gzputs(gzDoc, cs.data());
gzclose(gzDoc);
}
else
{
QFile f(fileName);
if(!f.open(IO_WriteOnly))
return false;
QTextStream s(&f);
s.writeRawBytes(cs, cs.length());
f.close();
}
#else
QFile f(fileName);
if(!f.open(IO_WriteOnly))
return false;
QTextStream s(&f);
QCString cs = docu.toCString();
s.writeRawBytes(cs, cs.length());
f.close();
#endif
return true;
}
// Low level plugin API
int scribus134format_getPluginAPIVersion()
{
return PLUGIN_API_VERSION;
}
ScPlugin* scribus134format_getPlugin()
{
Scribus134Format* plug = new Scribus134Format();
Q_CHECK_PTR(plug);
return plug;
}
void scribus134format_freePlugin(ScPlugin* plugin)
{
Scribus134Format* plug = dynamic_cast<Scribus134Format*>(plugin);
Q_ASSERT(plug);
delete plug;
}
void breakPoint() {}
void Scribus134Format::GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo, bool VorLFound)
{
ScFace dummy = ScFace::none();
bool unknown = false;
QString tmp2, tmpf;
tmp2 = it->attribute("CH");
tmp2.replace(QRegExp("\r"), QChar(13));
tmp2.replace(QRegExp("\n"), QChar(13));
tmp2.replace(QRegExp("\t"), QChar(9));
tmpf = it->attribute("CFONT", doc->toolSettings.defFont);
PrefsManager* prefsManager=PrefsManager::instance();
if ((!prefsManager->appPrefs.AvailFonts.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf].usable()))
{
bool isThere = false;
for (uint dl = 0; dl < dummyScFaces.count(); ++dl)
{
if ((*dummyScFaces.at(dl)).scName() == tmpf)
{
isThere = true;
dummy = *dummyScFaces.at(dl);
break;
}
}
if (!isThere)
{
// dummy = ScFace(tmpf, "", tmpf, "", "", 1, false);
dummyScFaces.append(dummy);
}
unknown = true;
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
}
else
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.GFontSub[tmpf]);
}
else
{
if (!doc->UsedFonts.contains(tmpf))
{
doc->AddFont(tmpf, qRound(doc->toolSettings.defSize / 10.0));
}
}
int size = qRound(it->attribute("CSIZE").toDouble() * 10);
QString fcolor = it->attribute("CCOLOR");
int extra;
if (it->hasAttribute("CEXTRA"))
extra = qRound(it->attribute("CEXTRA").toDouble() / it->attribute("CSIZE").toDouble() * 1000.0);
else
extra = it->attribute("CKERN").toInt();
int shade = it->attribute("CSHADE").toInt();
int style = it->attribute("CSTYLE").toInt();
int ab = it->attribute("CAB", "0").toInt();
QString stroke = it->attribute("CSTROKE", CommonStrings::None);
int shade2 = it->attribute("CSHADE2", "100").toInt();
int scale = qRound(it->attribute("CSCALE", "100").toDouble() * 10);
int scalev = qRound(it->attribute("CSCALEV", "100").toDouble() * 10);
int base = qRound(it->attribute("CBASE", "0").toDouble() * 10);
int shX = qRound(it->attribute("CSHX", "5").toDouble() * 10);
int shY = qRound(it->attribute("CSHY", "-5").toDouble() * 10);
int outL = qRound(it->attribute("COUT", "1").toDouble() * 10);
int ulp = qRound(it->attribute("CULP", "-0.1").toDouble() * 10);
int ulw = qRound(it->attribute("CULW", "-0.1").toDouble() * 10);
int stp = qRound(it->attribute("CSTP", "-0.1").toDouble() * 10);
int stw = qRound(it->attribute("CSTW", "-0.1").toDouble() * 10);
int iobj = it->attribute("COBJ", "-1").toInt();
for (uint cxx=0; cxx<tmp2.length(); ++cxx)
{
CharStyle newStyle;
QChar ch = tmp2.at(cxx);
if (ch == QChar(5))
ch = QChar(13);
if (ch == QChar(4))
ch = QChar(9);
if (unknown)
newStyle.setFont(dummy);
else
newStyle.setFont((*doc->AllFonts)[tmpf]);
newStyle.setFontSize(size);
newStyle.setFillColor(fcolor);
newStyle.setTracking(extra);
newStyle.setFillShade(shade);
newStyle.setEffects(static_cast<StyleFlag>(style));
if (ab >= 5) breakPoint();
if (impo)
{
if (VorLFound)
last->ParaStyle = DoVorl[ab].toUInt();
else
{
if (ab < 5)
last->ParaStyle = ab;
else
last->ParaStyle = 0;
}
}
else
last->ParaStyle = ab;
newStyle.setStrokeColor(stroke);
newStyle.setStrokeShade(shade2);
newStyle.setScaleH(QMIN(QMAX(scale, 100), 4000));
newStyle.setScaleV(QMIN(QMAX(scalev, 100), 4000));
newStyle.setBaselineOffset(base);
newStyle.setShadowXOffset(shX);
newStyle.setShadowYOffset(shY);
newStyle.setOutlineWidth(outL);
newStyle.setUnderlineOffset(ulp);
newStyle.setUnderlineWidth(ulw);
newStyle.setStrikethruOffset(stp);
newStyle.setStrikethruWidth(stw);
int pos = obj->itemText.length();
if (ch == SpecialChars::OBJECT) {
if (iobj != -1) {
obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
}
}
else {
obj->itemText.insertChars(pos, QString(ch));
}
if (newStyle != last->Style) {
#ifdef NLS_PROTO
qDebug(QString("new style at %1: %2 -> %3").arg(pos).arg(last->Style.asString()).arg(newStyle.asString()));
#endif
obj->itemText.applyCharStyle(last->StyleStart, pos-last->StyleStart, last->Style);
last->Style = newStyle;
last->StyleStart = pos;
}
if (ch == SpecialChars::PARSEP) {
const ParagraphStyle& pstyle( doc->docParagraphStyles[QMAX(0,last->ParaStyle)]);
qDebug(QString("par style134 at %1: %2/%3 (%4)").arg(pos).arg(pstyle.name()).arg(pstyle.parent()? pstyle.parent()->name():"").arg(last->ParaStyle));
obj->itemText.applyStyle(pos, pstyle);
obj->itemText.applyStyle(pos, doc->docParagraphStyles[QMAX(0,last->ParaStyle)]);
}
}
obj->itemText.applyCharStyle(last->StyleStart, obj->itemText.length()-last->StyleStart, last->Style);
obj->itemText.applyStyle(obj->itemText.length()-1, doc->docParagraphStyles[QMAX(0,last->ParaStyle)]);
return;
}
void Scribus134Format::readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc)
{
vg.setName(pg.attribute("NAME"));
vg.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(pg.attribute("LINESPMode", "0").toInt()));
vg.setLineSpacing(pg.attribute("LINESP").toDouble());
vg.setLeftMargin(pg.attribute("INDENT", "0").toDouble());
if (pg.hasAttribute("RMARGIN"))
vg.setRightMargin(pg.attribute("RMARGIN", "0").toDouble());
else
vg.setRightMargin(0);
vg.setFirstIndent(pg.attribute("FIRST", "0").toDouble());
vg.setAlignment(pg.attribute("ALIGN").toInt());
vg.setGapBefore(pg.attribute("VOR", "0").toDouble());
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
PrefsManager * prefsManager = PrefsManager::instance();
QString tmpf = pg.attribute("FONT", doc->toolSettings.defFont);
if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
}
else {
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.GFontSub[tmpf]); }
vg.charStyle().setFont(avail[ReplacedFonts[tmpf]]);
}
else
{
if (!doc->UsedFonts.contains(tmpf))
{
// QFont fo = avail[tmpf]->Font;
// fo.setPointSize(qRound(doc->toolSettings.defSize / 10.0));
doc->AddFont(tmpf, qRound(doc->toolSettings.defSize / 10.0));
}
vg.charStyle().setFont(avail[tmpf]);
}
vg.charStyle().setFontSize(qRound(pg.attribute("FONTSIZE", "12").toDouble() * 10.0));
vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP", "0").toInt()));
vg.setDropCapLines(pg.attribute("DROPLIN", "2").toInt());
vg.setDropCapOffset(pg.attribute("DROPDIST", "0").toDouble());
vg.charStyle().setEffects(static_cast<StyleFlag>(pg.attribute("EFFECT", "0").toInt()));
vg.charStyle().setFillColor(pg.attribute("FCOLOR", doc->toolSettings.dBrush));
vg.charStyle().setFillShade(pg.attribute("FSHADE", "100").toInt());
vg.charStyle().setStrokeColor(pg.attribute("SCOLOR", doc->toolSettings.dPen));
vg.charStyle().setStrokeShade(pg.attribute("SSHADE", "100").toInt());
vg.setUseBaselineGrid(static_cast<bool>(pg.attribute("BASE", "0").toInt()));
vg.charStyle().setShadowXOffset(qRound(pg.attribute("TXTSHX", "5").toDouble() * 10));
vg.charStyle().setShadowYOffset(qRound(pg.attribute("TXTSHY", "-5").toDouble() * 10));
vg.charStyle().setOutlineWidth(qRound(pg.attribute("TXTOUT", "1").toDouble() * 10));
vg.charStyle().setUnderlineOffset(qRound(pg.attribute("TXTULP", "-0.1").toDouble() * 10));
vg.charStyle().setUnderlineWidth(qRound(pg.attribute("TXTULW", "-0.1").toDouble() * 10));
vg.charStyle().setStrikethruOffset(qRound(pg.attribute("TXTSTP", "-0.1").toDouble() * 10));
vg.charStyle().setStrikethruWidth(qRound(pg.attribute("TXTSTW", "-0.1").toDouble() * 10));
vg.charStyle().setScaleH(qRound(pg.attribute("SCALEH", "100").toDouble() * 10));
vg.charStyle().setScaleV(qRound(pg.attribute("SCALEV", "100").toDouble() * 10));
vg.charStyle().setBaselineOffset(qRound(pg.attribute("BASEO", "0").toDouble() * 10));
vg.charStyle().setTracking(qRound(pg.attribute("KERN", "0").toDouble() * 10));
vg.tabValues().clear();
if ((pg.hasAttribute("NUMTAB")) && (pg.attribute("NUMTAB", "0").toInt() != 0))
{
ParagraphStyle::TabRecord tb;
QString tmp = pg.attribute("TABS");
QTextStream tgv(&tmp, IO_ReadOnly);
double xf, xf2;
for (int cxv = 0; cxv < pg.attribute("NUMTAB", "0").toInt(); cxv += 2)
{
tgv >> xf;
tgv >> xf2;
tb.tabPosition = xf2;
tb.tabType = static_cast<int>(xf);
tb.tabFillChar = QChar();
vg.tabValues().append(tb);
}
tmp = "";
}
else
{
QDomNode IT = pg.firstChild();
while(!IT.isNull())
{
QDomElement it = IT.toElement();
if (it.tagName()=="Tabs")
{
ParagraphStyle::TabRecord tb;
tb.tabPosition = it.attribute("Pos").toDouble();
tb.tabType = it.attribute("Type").toInt();
QString tbCh = "";
tbCh = it.attribute("Fill","");
if (tbCh.isEmpty())
tb.tabFillChar = QChar();
else
tb.tabFillChar = tbCh[0];
vg.tabValues().append(tb);
}
IT=IT.nextSibling();
}
}
}
PageItem* Scribus134Format::PasteItem(QDomElement *obj, ScribusDoc *doc)
{
struct ImageLoadRequest loadingInfo;
int z = 0;
PageItem::ItemType pt = static_cast<PageItem::ItemType>(obj->attribute("PTYPE").toInt());
double x = obj->attribute("XPOS").toDouble();
double y = obj->attribute("YPOS").toDouble();
double w = obj->attribute("WIDTH").toDouble();
double h = obj->attribute("HEIGHT").toDouble();
double pw = obj->attribute("PWIDTH").toDouble();
double scx = obj->attribute("LOCALSCX").toDouble();
double scy = obj->attribute("LOCALSCY").toDouble();
QString Pcolor = obj->attribute("PCOLOR");
QString Pcolor2 = obj->attribute("PCOLOR2");
QColor tmpc;
PageItem *currItem=NULL;
QString tmp;
int xi;
double xf, yf, xf2;
QString clPath;
QDomNode IT;
switch (pt)
{
// OBSOLETE CR 2005-02-06
case PageItem::ItemType1:
z = doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, x, y, w, h, pw, Pcolor, Pcolor2, true);
currItem = doc->Items->at(z);
break;
//
case PageItem::ImageFrame:
z = doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, x, y, w, h, 1, doc->toolSettings.dBrushPict, CommonStrings::None, true);
currItem = doc->Items->at(z);
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(obj->attribute("LOCALX").toDouble(), obj->attribute("LOCALY").toDouble());
currItem->Pfile = obj->attribute("PFILE");
currItem->IProfile = obj->attribute("PRFILE","");
currItem->EmProfile = obj->attribute("EPROF","");
currItem->IRender = obj->attribute("IRENDER", "1").toInt();
currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
currItem->pixm.imgInfo.lowResType = obj->attribute("ImageRes", "1").toInt();
IT = obj->firstChild();
while(!IT.isNull())
{
QDomElement it = IT.toElement();
if (it.tagName()=="ImageEffect")
{
struct ScImage::imageEffect ef;
ef.effectParameters = it.attribute("Param");
ef.effectCode = it.attribute("Code").toInt();
currItem->effectsInUse.append(ef);
}
IT=IT.nextSibling();
}
if (!currItem->Pfile.isEmpty())
doc->loadPict(currItem->Pfile, currItem, false);
currItem->IProfile = obj->attribute("PRFILE","");
currItem->EmProfile = obj->attribute("EPROF","");
currItem->IRender = obj->attribute("IRENDER", "1").toInt();
currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
currItem->setImageXYScale(scx, scy);
clPath = obj->attribute("ImageClip", "");
if (currItem->pixm.imgInfo.PDSpathData.contains(clPath))
{
currItem->imageClip = currItem->pixm.imgInfo.PDSpathData[clPath].copy();
currItem->pixm.imgInfo.usedPath = clPath;
QWMatrix cl;
cl.translate(currItem->imageXOffset()*currItem->imageXScale(), currItem->imageYOffset()*currItem->imageYScale());
cl.scale(currItem->imageXScale(), currItem->imageYScale());
currItem->imageClip.map(cl);
}
currItem->setImageShown(obj->attribute("PICART").toInt());
/* currItem->BBoxX = obj->attribute("BBOXX").toDouble();
currItem->BBoxH = obj->attribute("BBOXH").toDouble(); */
currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
currItem->setLineWidth(pw);
if (currItem->pixm.imgInfo.layerInfo.count() != 0)
{
bool found = false;
IT = obj->firstChild();
while(!IT.isNull())
{
QDomElement it = IT.toElement();
if (it.tagName() == "PSDLayer")
{
found = true;
loadingInfo.blend = it.attribute("Blend");
loadingInfo.opacity = it.attribute("Opacity").toInt();
loadingInfo.visible = static_cast<bool>(it.attribute("Visible").toInt());
loadingInfo.useMask = static_cast<bool>(it.attribute("useMask", "1").toInt());
currItem->pixm.imgInfo.RequestProps.insert(it.attribute("Layer").toInt(), loadingInfo);
}
IT=IT.nextSibling();
}
if (found)
{
currItem->pixm.imgInfo.isRequest = true;
doc->loadPict(currItem->Pfile, currItem, true);
}
}
break;
// OBSOLETE CR 2005-02-06
case PageItem::ItemType3:
z = doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, x, y, w, h, pw, Pcolor, Pcolor2, true);
currItem = doc->Items->at(z);
break;
//
case PageItem::PathText:
z = doc->itemAdd(PageItem::PathText, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor, true);
currItem = doc->Items->at(z);
if ((obj->attribute("ANNOTATION", "0").toInt()) && (static_cast<bool>(obj->attribute("ANICON", "0").toInt())))
{
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(obj->attribute("LOCALX").toDouble(), obj->attribute("LOCALY").toDouble());
currItem->Pfile = obj->attribute("PFILE");
currItem->Pfile2 = obj->attribute("PFILE2","");
currItem->Pfile3 = obj->attribute("PFILE3","");
currItem->IProfile = obj->attribute("PRFILE","");
currItem->EmProfile = obj->attribute("EPROF","");
currItem->IRender = obj->attribute("IRENDER", "1").toInt();
currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
doc->LoadPict(currItem->Pfile, z);
currItem->setImageXYScale(scx, scy);
currItem->setImageShown(obj->attribute("PICART").toInt());
/* currItem->BBoxX = obj->attribute("BBOXX").toDouble();
currItem->BBoxH = obj->attribute("BBOXH").toDouble(); */
currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
}
//currItem->convertTo(pt);
break;
case PageItem::TextFrame:
z = doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor, true);
currItem = doc->Items->at(z);
if ((obj->attribute("ANNOTATION", "0").toInt()) && (static_cast<bool>(obj->attribute("ANICON", "0").toInt())))
{
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(obj->attribute("LOCALX").toDouble(), obj->attribute("LOCALY").toDouble());
currItem->Pfile = obj->attribute("PFILE");
currItem->Pfile2 = obj->attribute("PFILE2","");
currItem->Pfile3 = obj->attribute("PFILE3","");
currItem->IProfile = obj->attribute("PRFILE","");
currItem->EmProfile = obj->attribute("EPROF","");
currItem->IRender = obj->attribute("IRENDER", "1").toInt();
currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
doc->LoadPict(currItem->Pfile, z);
currItem->setImageXYScale(scx, scy);
currItem->setImageShown(obj->attribute("PICART").toInt());
/* currItem->BBoxX = obj->attribute("BBOXX").toDouble();
currItem->BBoxH = obj->attribute("BBOXH").toDouble(); */
currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
}
//currItem->convertTo(pt);
break;
case PageItem::Line:
z = doc->itemAdd(PageItem::Line, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor2, true);
currItem = doc->Items->at(z);
break;
case PageItem::Polygon:
z = doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, x, y, w, h, pw, Pcolor, Pcolor2, true);
currItem = doc->Items->at(z);
break;
case PageItem::PolyLine:
z = doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, w, h, pw, Pcolor, Pcolor2, true);
currItem = doc->Items->at(z);
break;
}
currItem->FrameType = obj->attribute("FRTYPE", "0").toInt();
currItem->setStartArrowIndex(obj->attribute("startArrowIndex", "0").toInt());
currItem->setEndArrowIndex(obj->attribute("endArrowIndex", "0").toInt());
currItem->NamedLStyle = obj->attribute("NAMEDLST", "");
currItem->isBookmark = obj->attribute("BOOKMARK").toInt();
if ((currItem->isBookmark) && (doc->BookMarks.count() == 0))
doc->OldBM = true;
currItem->setImageFlippedH(obj->attribute("FLIPPEDH").toInt());
currItem->setImageFlippedV(obj->attribute("FLIPPEDV").toInt());
currItem->setCornerRadius(obj->attribute("RADRECT", "0").toDouble());
currItem->ClipEdited = obj->attribute("CLIPEDIT", "0").toInt();
currItem->setFillColor(Pcolor);
currItem->setLineColor(Pcolor2);
currItem->setFillShade(obj->attribute("SHADE").toInt());
currItem->setLineShade(obj->attribute("SHADE2").toInt());
ParagraphStyle pstyle;
pstyle.setLineSpacing(obj->attribute("LINESP").toDouble());
pstyle.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(obj->attribute("LINESPMode", "0").toInt()));
pstyle.setAlignment(obj->attribute("ALIGN", "0").toInt());
pstyle.charStyle().setFontSize(qRound(obj->attribute("ISIZE", "12").toDouble() * 10));
pstyle.charStyle().setStrokeColor(obj->attribute("TXTSTROKE", CommonStrings::None));
pstyle.charStyle().setFillColor(obj->attribute("TXTFILL", "Black"));
pstyle.charStyle().setStrokeShade(obj->attribute("TXTSTRSH", "100").toInt());
pstyle.charStyle().setFillShade(obj->attribute("TXTFILLSH", "100").toInt());
pstyle.charStyle().setScaleH(qRound(obj->attribute("TXTSCALE", "100").toDouble() * 10));
pstyle.charStyle().setScaleV(qRound(obj->attribute("TXTSCALEV", "100").toDouble() * 10));
pstyle.charStyle().setBaselineOffset(qRound(obj->attribute("TXTBASE", "0").toDouble() * 10));
pstyle.charStyle().setShadowXOffset(qRound(obj->attribute("TXTSHX", "5").toDouble() * 10));
pstyle.charStyle().setShadowYOffset(qRound(obj->attribute("TXTSHY", "-5").toDouble() * 10));
pstyle.charStyle().setOutlineWidth(qRound(obj->attribute("TXTOUT", "1").toDouble() * 10));
pstyle.charStyle().setUnderlineOffset(qRound(obj->attribute("TXTULP", "-0.1").toDouble() * 10));
pstyle.charStyle().setUnderlineWidth(qRound(obj->attribute("TXTULW", "-0.1").toDouble() * 10));
pstyle.charStyle().setStrikethruOffset(qRound(obj->attribute("TXTSTP", "-0.1").toDouble() * 10));
pstyle.charStyle().setStrikethruWidth(qRound(obj->attribute("TXTSTW", "-0.1").toDouble() * 10));
pstyle.charStyle().setEffects(static_cast<StyleFlag>(obj->attribute("TXTSTYLE", "0").toInt()));
currItem->itemText.setDefaultStyle(pstyle);
currItem->setRotation(obj->attribute("ROT").toDouble());
currItem->setTextToFrameDist(obj->attribute("EXTRA").toDouble(),
obj->attribute("REXTRA", "1").toDouble(),
obj->attribute("TEXTRA", "1").toDouble(),
obj->attribute("BEXTRA", "1").toDouble());
currItem->PLineArt = Qt::PenStyle(obj->attribute("PLINEART").toInt());
currItem->PLineEnd = Qt::PenCapStyle(obj->attribute("PLINEEND", "0").toInt());
currItem->PLineJoin = Qt::PenJoinStyle(obj->attribute("PLINEJOIN", "0").toInt());
currItem->setPrintEnabled(obj->attribute("PRINTABLE").toInt());
currItem->setIsAnnotation(obj->attribute("ANNOTATION", "0").toInt());
currItem->annotation().setType(obj->attribute("ANTYPE", "0").toInt());
QString AnName = obj->attribute("ANNAME","");
if (!AnName.isEmpty())
{
if (currItem->itemName() == AnName)
currItem->AutoName = true;
else
{
currItem->setItemName(AnName);
currItem->AutoName = false;
}
}
currItem->annotation().setAction(obj->attribute("ANACTION",""));
currItem->annotation().setE_act(obj->attribute("ANEACT",""));
currItem->annotation().setX_act(obj->attribute("ANXACT",""));
currItem->annotation().setD_act(obj->attribute("ANDACT",""));
currItem->annotation().setFo_act(obj->attribute("ANFOACT",""));
currItem->annotation().setBl_act(obj->attribute("ANBLACT",""));
currItem->annotation().setK_act(obj->attribute("ANKACT",""));
currItem->annotation().setF_act(obj->attribute("ANFACT",""));
currItem->annotation().setV_act(obj->attribute("ANVACT",""));
currItem->annotation().setC_act(obj->attribute("ANCACT",""));
currItem->annotation().setActionType(obj->attribute("ANACTYP", "0").toInt());
currItem->annotation().setExtern(obj->attribute("ANEXTERN",""));
if ((!currItem->annotation().Extern().isEmpty()) && (currItem->annotation().ActionType() != 8))
{
QFileInfo efp(currItem->annotation().Extern());
currItem->annotation().setExtern(efp.absFilePath());
}
currItem->annotation().setZiel(obj->attribute("ANZIEL", "0").toInt());
currItem->annotation().setToolTip(obj->attribute("ANTOOLTIP",""));
currItem->annotation().setRollOver(obj->attribute("ANROLL",""));
currItem->annotation().setDown(obj->attribute("ANDOWN",""));
currItem->annotation().setBwid(obj->attribute("ANBWID", "1").toInt());
currItem->annotation().setBsty(obj->attribute("ANBSTY", "0").toInt());
currItem->annotation().setFeed(obj->attribute("ANFEED", "1").toInt());
currItem->annotation().setFlag(obj->attribute("ANFLAG", "0").toInt());
currItem->annotation().setFont(obj->attribute("ANFONT", "4").toInt());
currItem->annotation().setFormat(obj->attribute("ANFORMAT", "0").toInt());
currItem->annotation().setVis(obj->attribute("ANVIS", "0").toInt());
currItem->annotation().setIsChk(static_cast<bool>(obj->attribute("ANCHK", "0").toInt()));
currItem->annotation().setAAact(static_cast<bool>(obj->attribute("ANAA", "0").toInt()));
currItem->annotation().setHTML(static_cast<bool>(obj->attribute("ANHTML", "0").toInt()));
currItem->annotation().setUseIcons(static_cast<bool>(obj->attribute("ANICON", "0").toInt()));
currItem->annotation().setChkStil(obj->attribute("ANCHKS", "0").toInt());
currItem->annotation().setMaxChar(obj->attribute("ANMC", "-1").toInt());
currItem->annotation().setBorderColor(obj->attribute("ANBCOL", CommonStrings::None));
currItem->annotation().setIPlace(obj->attribute("ANPLACE", "1").toInt());
currItem->annotation().setScaleW(obj->attribute("ANSCALE", "0").toInt());
currItem->TopLine = static_cast<bool>(obj->attribute("TopLine", "0").toInt());
currItem->LeftLine = static_cast<bool>(obj->attribute("LeftLine", "0").toInt());
currItem->RightLine = static_cast<bool>(obj->attribute("RightLine", "0").toInt());
currItem->BottomLine = static_cast<bool>(obj->attribute("BottomLine", "0").toInt());
currItem->isTableItem = static_cast<bool>(obj->attribute("isTableItem", "0").toInt());
currItem->TopLinkID = obj->attribute("TopLINK", "-1").toInt();
currItem->LeftLinkID = obj->attribute("LeftLINK", "-1").toInt();
currItem->RightLinkID = obj->attribute("RightLINK", "-1").toInt();
currItem->BottomLinkID = obj->attribute("BottomLINK", "-1").toInt();
currItem->PoShow = obj->attribute("PLTSHOW", "0").toInt();
currItem->BaseOffs = obj->attribute("BASEOF", "0").toDouble();
if ( obj->hasAttribute("TEXTFLOWMODE") )
currItem->setTextFlowMode((PageItem::TextFlowMode) obj->attribute("TEXTFLOWMODE", "0").toInt());
else if ( obj->attribute("TEXTFLOW").toInt() )
{
if (obj->attribute("TEXTFLOW2", "0").toInt())
currItem->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
else if (obj->attribute("TEXTFLOW3", "0").toInt())
currItem->setTextFlowMode(PageItem::TextFlowUsesContourLine);
else
currItem->setTextFlowMode(PageItem::TextFlowUsesFrameShape);
}
else
currItem->setTextFlowMode(PageItem::TextFlowDisabled);
if (obj->hasAttribute("EXTRAV"))
currItem->ExtraV = qRound(obj->attribute("EXTRAV", "0").toDouble() / obj->attribute("ISIZE", "12").toDouble() * 1000.0);
else
currItem->ExtraV = obj->attribute("TXTKERN").toInt();
currItem->DashOffset = obj->attribute("DASHOFF", "0.0").toDouble();
currItem->setReversed(static_cast<bool>(obj->attribute("REVERS", "0").toInt()));
currItem->setLocked(static_cast<bool>(obj->attribute("LOCK", "0").toInt()));
currItem->setSizeLocked(static_cast<bool>(obj->attribute("LOCKR", "0").toInt()));
currItem->setFillTransparency(obj->attribute("TransValue", "0.0").toDouble());
currItem->fillRule = static_cast<bool>(obj->attribute("fillRule", "1").toInt());
currItem->doOverprint = static_cast<bool>(obj->attribute("doOverprint", "0").toInt());
if (obj->hasAttribute("TransValueS"))
currItem->setLineTransparency(obj->attribute("TransValueS", "0.0").toDouble());
else
currItem->setLineTransparency(obj->attribute("TransValue", "0.0").toDouble());
currItem->setFillBlendmode(obj->attribute("TransBlend", "0").toInt());
currItem->setLineBlendmode(obj->attribute("TransBlendS", "0").toInt());
if (obj->attribute("TRANSPARENT", "0").toInt() == 1)
currItem->setFillColor(CommonStrings::None);
currItem->Cols = obj->attribute("COLUMNS", "1").toInt();
currItem->ColGap = obj->attribute("COLGAP", "0.0").toDouble();
if (obj->attribute("LAYER", "0").toInt() != -1)
currItem->LayerNr = obj->attribute("LAYER", "0").toInt();
tmp = "";
if ((obj->hasAttribute("GROUPS")) && (obj->attribute("NUMGROUP", "0").toInt() != 0))
{
tmp = obj->attribute("GROUPS");
QTextStream fg(&tmp, IO_ReadOnly);
currItem->Groups.clear();
for (int cx = 0; cx < obj->attribute("NUMGROUP", "0").toInt(); ++cx)
{
fg >> xi;
currItem->Groups.push(xi);
}
tmp = "";
}
else
currItem->Groups.clear();
tmp = "";
currItem->TabValues.clear();
if ((obj->hasAttribute("NUMTAB")) && (obj->attribute("NUMTAB", "0").toInt() != 0))
{
ParagraphStyle::TabRecord tb;
tmp = obj->attribute("TABS");
QTextStream tgv(&tmp, IO_ReadOnly);
for (int cxv = 0; cxv < obj->attribute("NUMTAB", "0").toInt(); cxv += 2)
{
tgv >> xf;
tgv >> xf2;
tb.tabPosition = xf2;
tb.tabType = static_cast<int>(xf);
tb.tabFillChar = QChar();
currItem->TabValues.append(tb);
}
tmp = "";
}
else
{
IT = obj->firstChild();
while(!IT.isNull())
{
QDomElement it = IT.toElement();
if (it.tagName()=="Tabs")
{
ParagraphStyle::TabRecord tb;
tb.tabPosition = it.attribute("Pos").toDouble();
tb.tabType = it.attribute("Type").toInt();
QString tbCh = "";
tbCh = it.attribute("Fill","");
if (tbCh.isEmpty())
tb.tabFillChar = QChar();
else
tb.tabFillChar = tbCh[0];
currItem->TabValues.append(tb);
}
IT=IT.nextSibling();
}
}
if ((obj->hasAttribute("NUMDASH")) && (obj->attribute("NUMDASH", "0").toInt() != 0))
{
tmp = obj->attribute("DASHS");
QTextStream dgv(&tmp, IO_ReadOnly);
currItem->DashValues.clear();
for (int cxv = 0; cxv < obj->attribute("NUMDASH", "0").toInt(); ++cxv)
{
dgv >> xf;
currItem->DashValues.append(xf);
}
tmp = "";
}
else
currItem->DashValues.clear();
tmp = "";
if (obj->hasAttribute("NUMPO"))
{
currItem->PoLine.resize(obj->attribute("NUMPO").toUInt());
tmp = obj->attribute("POCOOR");
QTextStream fp(&tmp, IO_ReadOnly);
for (uint cx=0; cx<obj->attribute("NUMPO").toUInt(); ++cx)
{
fp >> xf;
fp >> yf;
currItem->PoLine.setPoint(cx, xf, yf);
}
}
else
currItem->PoLine.resize(0);
tmp = "";
if (obj->hasAttribute("NUMCO"))
{
currItem->ContourLine.resize(obj->attribute("NUMCO").toUInt());
tmp = obj->attribute("COCOOR");
QTextStream fp(&tmp, IO_ReadOnly);
for (uint cx=0; cx<obj->attribute("NUMCO").toUInt(); ++cx)
{
fp >> xf;
fp >> yf;
currItem->ContourLine.setPoint(cx, xf, yf);
}
}
else
currItem->ContourLine = currItem->PoLine.copy();
if (!currItem->asLine())
currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
else
{
int ph = static_cast<int>(QMAX(1.0, currItem->lineWidth() / 2.0));
currItem->Segments.clear();
currItem->PoLine.resize(0);
currItem->Clip.setPoints(4, -ph,-ph, static_cast<int>(currItem->width()+ph),-ph,
static_cast<int>(currItem->width()+ph),static_cast<int>(currItem->height()+ph),
-ph,static_cast<int>(currItem->height()+ph));
currItem->setHeight(1.0);
}
if (currItem->asImageFrame())
currItem->AdjustPictScale();
if (currItem->asPathText())
{
&n