Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 12794 → Rev 12795

/trunk/Scribus/scribus/serializer.cpp
235,7 → 235,27
for (it = names.begin(); it != names.end(); ++it)
doc->patterns[*it].saxx(handler);
*/
/*
QStringList patterns = doc->getUsedPatternsSelection((Selection*)&selection);
for (int c = 0; c < patterns.count(); ++c)
{
ScPattern& pa = doc->docPatterns[patterns[c]];
Xml_attr cattr;
cattr["Name"] = patterns[c];
cattr["scaleX"] = toXMLString(pa.scaleX);
cattr["scaleY"] = toXMLString(pa.scaleY);
cattr["width"] = toXMLString(pa.width);
cattr["height"] = toXMLString(pa.height);
cattr["xoffset"] = toXMLString(pa.xoffset);
cattr["yoffset"] = toXMLString(pa.yoffset);
handler.begin("Pattern", cattr);
for (int o = 0; o < pa.items.count(); o++)
{
pa.items.at(o)->saxx(handler);
}
handler.end("Pattern");
}
*/
for (int i=0; i < doc->Items->count(); ++i)
{
int k = selection.findItem(doc->Items->at(i));
/trunk/Scribus/scribus/scribusXml.cpp
17,6 → 17,7
#include <QtAlgorithms>
#include <QApplication>
#include <QByteArray>
#include <QBuffer>
#include <QCursor>
#include <QDir>
#include <QFile>
51,6 → 52,7
#include "util_color.h"
#include "scpattern.h"
#include "scxmlstreamwriter.h"
#include "scpainter.h"
 
using namespace std;
 
720,7 → 722,24
writer.writeAttribute("REXTRA" , item->textToFrameDistRight());
writer.writeAttribute("FLOP" ,item->firstLineOffset());
if (((item->asImageFrame() && !item->asLatexFrame()) || (item->asTextFrame())) && (!item->Pfile.isEmpty()))
writer.writeAttribute("PFILE",Path2Relative(item->Pfile, baseDir));
{
if (item->isInlineImage)
{
writer.writeAttribute("PFILE", "");
writer.writeAttribute("isInlineImage", static_cast<int>(item->isInlineImage));
QFileInfo inlFi(item->Pfile);
writer.writeAttribute("inlineImageExt", inlFi.suffix());
QFile inFil(item->Pfile);
if (inFil.open(QIODevice::ReadOnly))
{
QByteArray ba = qCompress(inFil.readAll()).toBase64();
writer.writeAttribute("ImageData", QString(ba));
inFil.close();
}
}
else
writer.writeAttribute("PFILE",Path2Relative(item->Pfile, baseDir));
}
if (!item->Pfile2.isEmpty())
writer.writeAttribute("PFILE2",Path2Relative(item->Pfile2, baseDir));
else
1205,6 → 1224,9
int LatexDPI;
bool LatexPream;
QString LatexConfig;
bool inlineF;
QByteArray inlineImageData;
QString inlineImageExt;
while(!sReader.atEnd() && !sReader.hasError())
{
sReader.readNext();
1228,6 → 1250,11
groupsLastItem = attrAsInt (attrs, "groupsLastItem", 0);
itemOwnLink = attrAsInt (attrs, "OwnLINK", 0);
itemClip = attrAsString(attrs, "ImageClip", "");
inlineF = attrAsBool(attrs, "isInlineImage", false);
inlineImageData.resize(0);
QString dat = attrAsString(attrs, "ImageData", "");
inlineImageData.append(dat);
inlineImageExt = attrAsString(attrs, "inlineImageExt", "");
if (!doc->MLineStyles.contains(OB.NamedLStyle))
OB.NamedLStyle = "";
OB.itemText = "";
1356,6 → 1383,37
latexitem->setDpi(LatexDPI);
latexitem->setUsePreamble(LatexPream);
}
if (Neu->asImageFrame() && inlineF)
{
if (inlineImageData.size() > 0)
{
Neu->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_XXXXXX." + inlineImageExt);
Neu->tempImageFile->open();
QString fileName = getLongPathName(Neu->tempImageFile->fileName());
Neu->tempImageFile->close();
Neu->isInlineImage = true;
Neu->Pfile = fileName;
inlineImageData = qUncompress(QByteArray::fromBase64(inlineImageData));
QFile outFil(fileName);
if (outFil.open(QIODevice::WriteOnly))
{
outFil.write(inlineImageData);
outFil.close();
Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
Neu->setImageXYOffset(OB.LocalX, OB.LocalY);
Neu->IProfile = OB.IProfile;
Neu->EmProfile = OB.EmProfile;
Neu->IRender = OB.IRender;
Neu->UseEmbedded = OB.UseEmbedded;
if (!Neu->Pfile.isEmpty())
doc->LoadPict(Neu->Pfile, doc->Items->count()-1);
Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
Neu->setImageShown(OB.PicArt);
Neu->ScaleType = OB.ScaleType;
Neu->AspectRatio = OB.AspectRatio;
}
}
}
Neu->itemText = storyText;
Neu->effectsInUse = imageEffects;
Neu->pixm.imgInfo.RequestProps = loadRequests;
1464,6 → 1522,9
int LatexDPI;
bool LatexPream;
QString LatexConfig;
bool inlineF;
QByteArray inlineImageData;
QString inlineImageExt;
while(!reader.atEnd() && !reader.hasError())
{
reader.readNext();
1480,6 → 1541,11
lastStyles = LastStyles();
GetItemProps(attrs1, &OB, fileDir, newVersion);
patClipPath = attrs1.value("ImageClip").toString();
inlineF = attrAsBool(attrs, "isInlineImage", false);
inlineImageData.resize(0);
QString dat = attrAsString(attrs, "ImageData", "");
inlineImageData.append(dat);
inlineImageExt = attrAsString(attrs, "inlineImageExt", "");
patOwnLink = attrAsInt(attrs1, "OwnLINK", 0);
isGroupControl = attrAsBool(attrs1, "isGroupControl", false);
groupsLastItem = attrAsInt(attrs1, "groupsLastItem", 0);
1598,6 → 1664,37
Neu->setXYPos(Neu->xPos() - doc->currentPage()->xOffset(), Neu->yPos() - doc->currentPage()->yOffset(), true);
storyText.setDefaultStyle(Neu->itemText.defaultStyle());
Neu->itemText = storyText;
if (Neu->asImageFrame() && inlineF)
{
if (inlineImageData.size() > 0)
{
Neu->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_XXXXXX." + inlineImageExt);
Neu->tempImageFile->open();
QString fileName = getLongPathName(Neu->tempImageFile->fileName());
Neu->tempImageFile->close();
inlineImageData = qUncompress(QByteArray::fromBase64(inlineImageData));
QFile outFil(fileName);
if (outFil.open(QIODevice::WriteOnly))
{
outFil.write(inlineImageData);
outFil.close();
Neu->isInlineImage = true;
Neu->Pfile = fileName;
Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
Neu->setImageXYOffset(OB.LocalX, OB.LocalY);
Neu->IProfile = OB.IProfile;
Neu->EmProfile = OB.EmProfile;
Neu->IRender = OB.IRender;
Neu->UseEmbedded = OB.UseEmbedded;
if (!Neu->Pfile.isEmpty())
doc->LoadPict(Neu->Pfile, doc->Items->count()-1);
Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
Neu->setImageShown(OB.PicArt);
Neu->ScaleType = OB.ScaleType;
Neu->AspectRatio = OB.AspectRatio;
}
}
}
Neu->effectsInUse = imageEffects;
Neu->pixm.imgInfo.RequestProps = loadRequests;
Neu->pixm.imgInfo.isRequest = (loadRequests.count() > 0);
1694,8 → 1791,13
//QDomElement elem=docu.documentElement();
item = selection->itemAt(0);
QList<uint> ELL;
QList<PageItem*> emG;
emG.clear();
for (int cor=0; cor<selection->count(); ++cor)
{
ELL.append(selection->itemAt(cor)->ItemNr);
emG.append(selection->itemAt(cor));
}
qSort(ELL);
documentStr.reserve(524288);
ScXmlStreamWriter writer(&documentStr);
1703,6 → 1805,8
// don't use that function here, as it inserts an unneeded version info into that xml, which
// breaks our reading code at several places.
writer.writeStartElement("SCRIBUSELEMUTF8");
double selectionWidth = 0;
double selectionHeight = 0;
if (selection->isMultipleSelection())
{
double gx, gy, gw, gh;
1711,6 → 1815,7
yp = gy - doc->currentPage()->yOffset();
writer.writeAttribute("W", gw);
writer.writeAttribute("H", gh);
selection->getVisualGroupRect(&gx, &gy, &selectionWidth, &selectionHeight);
}
else
{
1742,6 → 1847,8
writer.writeAttribute("W", item->width());
writer.writeAttribute("H", item->height());
}
selectionWidth = item->visualWidth();
selectionHeight = item->visualHeight();
xp = item->xPos() - doc->currentPage()->xOffset();
yp = item->yPos() - doc->currentPage()->yOffset();
}
1749,6 → 1856,55
writer.writeAttribute("YP", yp);
writer.writeAttribute("COUNT", selection->count());
writer.writeAttribute("Version", QString(VERSION));
 
double scaleI = 50.0 / qMax(selectionWidth, selectionHeight);
QImage retImg = QImage(50, 50, QImage::Format_ARGB32);
retImg.fill( qRgba(0, 0, 0, 0) );
ScPainter *painter = new ScPainter(&retImg, retImg.width(), retImg.height(), 1, 0);
painter->setZoomFactor(scaleI);
QStack<PageItem*> groupStack;
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
if (embedded->isGroupControl)
{
painter->save();
FPointArray cl = embedded->PoLine.copy();
QMatrix mm;
mm.translate(embedded->gXpos, embedded->gYpos);
mm.rotate(embedded->rotation());
cl.map( mm );
painter->beginLayer(1.0 - embedded->fillTransparency(), embedded->fillBlendmode(), &cl);
groupStack.push(embedded->groupsLastItem);
continue;
}
painter->save();
double x = embedded->xPos();
double y = embedded->yPos();
embedded->setXYPos(embedded->xPos()- doc->currentPage()->xOffset() - xp, embedded->yPos()- doc->currentPage()->yOffset() - yp, true);
embedded->invalid = true;
embedded->DrawObj(painter, QRectF());
embedded->setXYPos(x, y, true);
painter->restore();
if (groupStack.count() != 0)
{
while (embedded == groupStack.top())
{
painter->endLayer();
painter->restore();
groupStack.pop();
if (groupStack.count() == 0)
break;
}
}
}
QBuffer buffer;
buffer.open(QIODevice::WriteOnly);
retImg.save(&buffer, "PNG");
QByteArray ba = buffer.buffer().toBase64();
buffer.close();
writer.writeAttribute("previewData", QString(ba));
 
QMap<QString,int>::Iterator itf;
for (itf = doc->UsedFonts.begin(); itf != doc->UsedFonts.end(); ++itf)
{
/trunk/Scribus/scribus/pageitem.cpp
67,6 → 67,7
#include "util_formats.h"
#include "util_math.h"
#include "util_text.h"
#include "util_file.h"
#ifdef HAVE_CAIRO
#include <cairo.h>
#endif
245,6 → 246,23
AnName += tmp.setNum(m_Doc->TotalItems);
uniqueNr = m_Doc->TotalItems;
invalid = true;
if (other.isInlineImage)
{
QFileInfo inlFi(Pfile);
QString ext = inlFi.suffix();
tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_XXXXXX." + ext);
tempImageFile->open();
QString fileName = getLongPathName(tempImageFile->fileName());
tempImageFile->close();
copyFile(Pfile, fileName);
Pfile = fileName;
isInlineImage = true;
}
else
{
tempImageFile = NULL;
isInlineImage = false;
}
}
 
 
502,6 → 520,8
)
pageItemAttributes.append(*objAttrIt);
}
tempImageFile = NULL;
isInlineImage = false;
}
 
void PageItem::setXPos(const double newXPos, bool drawingOnly)
/trunk/Scribus/scribus/pageitem_desaxe.cpp
167,7 → 167,24
latexframe = dynamic_cast<const PageItem_LatexFrame*>(item);
if ((item->itemType()==PageItem::ImageFrame || item->itemType()==PageItem::TextFrame) && (!item->externalFile().isEmpty()) && !latexframe)
result.insert("image-file", Path2Relative(item->externalFile(), QDir::homePath()));
{
if (item->isInlineImage)
{
result.insert("image-file", "");
result.insert("isInlineImage", toXMLString(item->isInlineImage));
QFileInfo inlFi(item->Pfile);
result.insert("inlineImageExt", inlFi.suffix());
QFile inFil(item->Pfile);
if (inFil.open(QIODevice::ReadOnly))
{
QByteArray ba = qCompress(inFil.readAll()).toBase64();
result.insert("ImageData", QString(ba));
inFil.close();
}
}
else
result.insert("image-file", Path2Relative(item->externalFile(), QDir::homePath()));
}
if (!item->fileIconPressed().isEmpty())
result.insert("icon-pressed-file", Path2Relative(item->fileIconPressed(), QDir::homePath()));
if (!item->fileIconRollover().isEmpty())
/trunk/Scribus/scribus/collect4output.cpp
189,20 → 189,23
if (ite->asImageFrame())
{
/* hack for subsequent c4o "./" -> "/doc/full/path" */
QString ofName(ite->Pfile);
QFileInfo itf = QFileInfo(ofName);
if (!itf.exists())
if (!ite->isInlineImage)
{
ofName = QDir::convertSeparators(PrefsManager::instance()->documentDir() + "/" + ofName);
itf.setFile(ofName);
}
QString ofName(ite->Pfile);
QFileInfo itf = QFileInfo(ofName);
if (!itf.exists())
{
ofName = QDir::convertSeparators(PrefsManager::instance()->documentDir() + "/" + ofName);
itf.setFile(ofName);
}
// end of hack
if (itf.exists())
{
QString oldFile = ofName;
ite->Pfile = collectFile(oldFile, itf.fileName());
ScCore->fileWatcher->removeFile(oldFile);
ScCore->fileWatcher->addFile(ite->Pfile);
if (itf.exists())
{
QString oldFile = ofName;
ite->Pfile = collectFile(oldFile, itf.fileName());
ScCore->fileWatcher->removeFile(oldFile);
ScCore->fileWatcher->addFile(ite->Pfile);
}
}
}
if (ite->asTextFrame())
212,13 → 215,16
QFileInfo itf;
if (!ite->Pfile.isEmpty())
{
itf = QFileInfo(ite->Pfile);
if (itf.exists())
if (!ite->isInlineImage)
{
QString oldFile = ite->Pfile;
ite->Pfile = collectFile(oldFile, itf.fileName());
ScCore->fileWatcher->removeFile(oldFile);
ScCore->fileWatcher->addFile(ite->Pfile);
itf = QFileInfo(ite->Pfile);
if (itf.exists())
{
QString oldFile = ite->Pfile;
ite->Pfile = collectFile(oldFile, itf.fileName());
ScCore->fileWatcher->removeFile(oldFile);
ScCore->fileWatcher->addFile(ite->Pfile);
}
}
}
if (!ite->Pfile2.isEmpty())
/trunk/Scribus/scribus/scribusdoc.cpp
3834,7 → 3834,13
if (!reload)
{
if ((ScCore->fileWatcher->files().contains(pageItem->Pfile) != 0) && (pageItem->PicAvail))
{
ScCore->fileWatcher->removeFile(pageItem->Pfile);
if (pageItem->tempImageFile != NULL)
delete pageItem->tempImageFile;
pageItem->tempImageFile = NULL;
pageItem->isInlineImage = false;
}
}
if(!pageItem->loadImage(fn, reload, -1, showMsg))
{
7169,6 → 7175,8
target = Pages->at(0);
undoManager->action(target, is, currItem->getUPixmap());
}
else
delete currItem;
}
itemSelection->delaySignalsOff();
updateFrameItems();
/trunk/Scribus/scribus/pageitem.h
34,6 → 34,7
#include <QRect>
#include <QRectF>
#include <QVector>
#include <QTemporaryFile>
 
#include "scribusapi.h"
#include "annotation.h"
193,7 → 194,11
public:
PageItem(ScribusDoc *pa, ItemType newType, double x, double y, double w, double h, double w2, QString fill, QString outline);
~PageItem() {};
~PageItem()
{
if (tempImageFile != NULL)
delete tempImageFile;
}
 
static const Xml_string saxxDefaultElem;
static void desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
1254,6 → 1259,10
/** Line width */
double m_lineWidth;
double Oldm_lineWidth;
 
/** Inline Image */
bool isInlineImage;
QTemporaryFile *tempImageFile;
signals:
//Frame signals
/trunk/Scribus/scribus/pageitem_imageframe.cpp
139,6 → 139,10
setFillTransparency(0.0);
setLineTransparency(0.0);
imageClip.resize(0);
if (tempImageFile != NULL)
delete tempImageFile;
tempImageFile = NULL;
isInlineImage = false;
// emit UpdtObj(Doc->currentPage->pageNr(), ItemNr);
}
 
/trunk/Scribus/scribus/plugins/svgimplugin/svgplugin.cpp
12,7 → 12,7
#include <QMimeData>
#include <QPainterPath>
#include <QRegExp>
// #include <QTemporaryFile>
#include <QTemporaryFile>
#include <cmath>
#include <QDebug>
#include "color.h"
208,7 → 208,6
docDesc = "";
docTitle = "";
groupLevel = 0;
imgNum = 0;
interactive = (flags & LoadSavePlugin::lfInteractive);
// m_gc.setAutoDelete( true );
}
220,8 → 219,6
QString CurDirP = QDir::currentPath();
QFileInfo efp(fname);
QDir::setCurrent(efp.path());
baseFile = QDir::cleanPath(QDir::toNativeSeparators(ScPaths::getTempFileDir()+"/"+efp.baseName()));
imgNum = 0;
convert(flags);
QDir::setCurrent(CurDirP);
return true;
1217,6 → 1214,7
setupNode(e);
parseClipPathAttr(e, clipPath);
int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, x+BaseX, y+BaseY, w, h, 1, m_Doc->toolSettings.dBrushPict, CommonStrings::None, true);
PageItem* ite = m_Doc->Items->at(z);
if (!fname.isEmpty())
{
if (!fname.startsWith("data:"))
1230,21 → 1228,17
ba.append(fname);
if (dataType.contains("base64"))
ba = QByteArray::fromBase64(ba);
/* QTemporaryFile *tempfile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_svg_XXXXXX");
tempfile->open();
QString fileName = getLongPathName(tempfile->fileName());
tempfile->setAutoRemove(false);
tempfile->close();
delete tempfile; */
QString imgName = baseFile + QString("-Img-%1").arg(imgNum) + ".png";
ite->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_svg_XXXXXX.png");
ite->tempImageFile->open();
QString fileName = getLongPathName(ite->tempImageFile->fileName());
ite->tempImageFile->close();
ite->isInlineImage = true;
QImage img;
img.loadFromData(ba);
img.save(imgName, "PNG");
m_Doc->LoadPict(imgName, z);
imgNum++;
img.save(fileName, "PNG");
m_Doc->LoadPict(fileName, z);
}
}
PageItem* ite = m_Doc->Items->at(z);
if (clipPath.size() != 0)
ite->PoLine = clipPath.copy();
clipPath.resize(0);
/trunk/Scribus/scribus/plugins/svgimplugin/svgplugin.h
261,8 → 261,6
QMap<QString, QString> importedPattTrans;
double inGroupXOrigin;
double inGroupYOrigin;
QString baseFile;
int imgNum;
};
 
#endif
/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
1419,7 → 1419,24
docu.writeAttribute("REXTRA",item->textToFrameDistRight());
docu.writeAttribute("FLOP",item->firstLineOffset()); // here I think this FLOP "cher à mon cœur" is legitimate!
if (((item->asImageFrame() && !item->asLatexFrame()) || (item->asTextFrame())) && (!item->Pfile.isEmpty()))
docu.writeAttribute("PFILE",Path2Relative(item->Pfile, baseDir));
{
if (item->isInlineImage)
{
docu.writeAttribute("PFILE", "");
docu.writeAttribute("isInlineImage", static_cast<int>(item->isInlineImage));
QFileInfo inlFi(item->Pfile);
docu.writeAttribute("inlineImageExt", inlFi.suffix());
QFile inFil(item->Pfile);
if (inFil.open(QIODevice::ReadOnly))
{
QByteArray ba = qCompress(inFil.readAll()).toBase64();
docu.writeAttribute("ImageData", QString(ba));
inFil.close();
}
}
else
docu.writeAttribute("PFILE",Path2Relative(item->Pfile, baseDir));
}
else
docu.writeAttribute("PFILE","");
if (!item->Pfile2.isEmpty())
/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
2023,7 → 2023,8
currItem = doc->Items->at(z);
currItem->setImageXYScale(scx, scy);
currItem->setImageXYOffset(obj->attribute("LOCALX").toDouble(), obj->attribute("LOCALY").toDouble());
if (currItem->asLatexFrame()) {
if (currItem->asLatexFrame())
{
PageItem_LatexFrame *latexitem = currItem->asLatexFrame();
IT = obj->firstChild();
while(!IT.isNull())
2035,14 → 2036,14
latexitem->setDpi(it.attribute("DPI").toInt());
latexitem->setUsePreamble(static_cast<bool>(it.attribute("USE_PREAMBLE").toInt()));
QDomElement property = it.firstChildElement("PROPERTY");
while (!property.isNull()) {
while (!property.isNull())
{
QString name = property.attribute("name");
QString value = property.attribute("value");
property = property.nextSiblingElement("PROPERTY");
if (name.isEmpty()) continue;
latexitem->editorProperties[name] = value;
}
}
QString temp = it.text();
latexitem->setFormula(temp, false);
2049,9 → 2050,36
}
IT=IT.nextSibling();
}
} else {
currItem->Pfile = Relative2Path(obj->attribute("PFILE"), baseDir);
}
else
{
bool inlineF = static_cast<bool>(obj->attribute("isInlineImage", "0").toInt());
QString dat = obj->attribute("ImageData", "");
QByteArray inlineImageData;
inlineImageData.append(dat);
QString inlineImageExt = obj->attribute("inlineImageExt", "");
if (inlineF)
{
if (inlineImageData.size() > 0)
{
currItem->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_XXXXXX." + inlineImageExt);
currItem->tempImageFile->open();
QString fileName = getLongPathName(currItem->tempImageFile->fileName());
currItem->tempImageFile->close();
inlineImageData = qUncompress(QByteArray::fromBase64(inlineImageData));
QFile outFil(fileName);
if (outFil.open(QIODevice::WriteOnly))
{
outFil.write(inlineImageData);
outFil.close();
currItem->isInlineImage = true;
currItem->Pfile = fileName;
}
}
}
else
currItem->Pfile = Relative2Path(obj->attribute("PFILE"), baseDir);
}
currItem->IProfile = obj->attribute("PRFILE","");
currItem->EmProfile = obj->attribute("EPROF","");
currItem->IRender = obj->attribute("IRENDER", "1").toInt();
/trunk/Scribus/scribus/scpreview.cpp
19,6 → 19,7
#include <QPolygon>
#include <QTextStream>
#include <QPixmap>
#include <QTemporaryFile>
#include <cmath>
#include <cstdlib>
 
77,6 → 78,16
QPixmap tmp = QPixmap(0, 0);
return tmp;
}
if (elem.hasAttribute("previewData"))
{
QString dat = elem.attribute("previewData", "");
QByteArray inlineImageData;
inlineImageData.append(dat);
inlineImageData = QByteArray::fromBase64(inlineImageData);
QImage tmp;
tmp.loadFromData(inlineImageData);
return QPixmap::fromImage(tmp);
}
double GrX = elem.attribute("XP").toDouble();
double GrY = elem.attribute("YP").toDouble();
double GrW = elem.attribute("W").toDouble();
604,6 → 615,52
pS->restore();
}
}
else
{
if (static_cast<bool>(pg.attribute("isInlineImage", "0").toInt()))
{
QByteArray inlineImageData;
QString dat = pg.attribute("ImageData", "");
inlineImageData.append(dat);
QString inlineImageExt = pg.attribute("inlineImageExt", "");
if (inlineImageData.size() > 0)
{
QTemporaryFile *tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_XXXXXX." + inlineImageExt);
tempImageFile->open();
QString fileName = getLongPathName(tempImageFile->fileName());
tempImageFile->close();
inlineImageData = qUncompress(QByteArray::fromBase64(inlineImageData));
QFile outFil(fileName);
if (outFil.open(QIODevice::WriteOnly))
{
outFil.write(inlineImageData);
outFil.close();
pS->setupPolygon(&OB.PoLine);
pS->setClipPath();
pS->save();
if (OB.flippedH)
{
pS->translate(OB.Width, 0);
pS->scale(-1, 1);
}
if (OB.flippedV)
{
pS->translate(0, OB.Height);
pS->scale(1, -1);
}
ScImage pixm;
CMSettings cms(0, "", 0);
pixm.LoadPicture(fileName, 1, cms, false, false, ScImage::RGBData, 72); //FIXME: OB doesnt know about pagenr
pS->scale(OB.LocalScX, OB.LocalScY);
pS->translate(static_cast<int>(OB.LocalX), static_cast<int>(OB.LocalY));
QImage img(pixm.qImage());
pS->drawImage(&img);
pS->restore();
}
delete tempImageFile;
}
}
}
break;
case PageItem::TextFrame:
#ifndef NLS_PROTO