Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 14743 → Rev 14744

/trunk/Scribus/scribus/canvasmode_legacy.cpp
561,7 → 561,7
ScriXmlDoc *ss = new ScriXmlDoc();
//Q_3DragObject *dr = new Q_3TextDrag(ss->WriteElem(Doc, this, m_doc->m_Selection), this);
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_doc, m_view, m_doc->m_Selection));
md->setScribusElem(ss->WriteElem(m_doc, m_doc->m_Selection));
QDrag* dr = new QDrag(m_view);
dr->setMimeData(md);
const QPixmap& pm = loadIcon("DragPix.xpm");
/trunk/Scribus/scribus/scribusdoc.cpp
64,6 → 64,7
#include "sccolorengine.h"
#include "ui/scmessagebox.h"
#include "colormgmt/sccolormgmtenginefactory.h"
#include "scclocale.h"
#include "scpainter.h"
#include "scraction.h"
#include "scribus.h"
3618,9 → 3619,9
{
setMasterPageMode(true);
ScriXmlDoc *ss = new ScriXmlDoc();
QString dataS = ss->WriteElem(this, view(), &tempSelection);
QString dataS = ss->WriteElem(this, &tempSelection);
setCurrentPage(targetPage);
ss->ReadElemToLayer(dataS, prefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, prefsData.fontPrefs.GFontSub, view(), it->ID);
ss->ReadElemToLayer(dataS, prefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, prefsData.fontPrefs.GFontSub, it->ID);
delete ss;
setMasterPageMode(false);
}
3646,10 → 3647,10
if (tempSelection.count() != 0)
{
ScriXmlDoc *ss = new ScriXmlDoc();
QString dataS = ss->WriteElem(this, view(), &tempSelection);
QString dataS = ss->WriteElem(this, &tempSelection);
setMasterPageMode(true);
setCurrentPage(targetPage);
ss->ReadElemToLayer(dataS, prefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, prefsData.fontPrefs.GFontSub, view(), it->ID);
ss->ReadElemToLayer(dataS, prefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, prefsData.fontPrefs.GFontSub, it->ID);
delete ss;
setMasterPageMode(false);
}
3675,7 → 3676,458
return true;
}
 
void ScribusDoc::PasteItem(struct CopyPasteBuffer *Buffer, bool drag, bool resize)
{
QColor tmp;
double x = Buffer->Xpos;
double y = Buffer->Ypos;
double w = Buffer->Width;
double h = Buffer->Height;
double pw = Buffer->Pwidth;
int z = 0;
switch (Buffer->PType)
{
// OBSOLETE CR 2005-02-06
case PageItem::ItemType1:
z = itemAdd(PageItem::Polygon, PageItem::Ellipse, x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2, true);
break;
//
case PageItem::ImageFrame:
z = itemAdd(PageItem::ImageFrame, PageItem::Unspecified, x, y, w, h, 1, itemToolPrefs.imageFillColor, CommonStrings::None, true);
undoManager->setUndoEnabled(false);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
Items->at(z)->Pfile = Buffer->Pfile;
Items->at(z)->IProfile = Buffer->IProfile;
Items->at(z)->EmProfile = Buffer->EmProfile;
Items->at(z)->IRender = Buffer->IRender;
Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
if (!Items->at(z)->Pfile.isEmpty())
LoadPict(Items->at(z)->Pfile, z);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageShown(Buffer->PicArt);
Items->at(z)->ScaleType = Buffer->ScaleType;
Items->at(z)->AspectRatio = Buffer->AspectRatio;
Items->at(z)->setLineWidth(Buffer->Pwidth);
undoManager->setUndoEnabled(true);
break;
// OBSOLETE CR 2005-02-06
case PageItem::ItemType3:
z = itemAdd(PageItem::Polygon, PageItem::Rectangle, x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2, true);
break;
//
case PageItem::PathText:
case PageItem::TextFrame:
#ifndef NLS_PROTO
if (Buffer->PType == PageItem::PathText)
z = itemAdd(PageItem::PathText, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Buffer->Pcolor, true);
else
z = itemAdd(PageItem::TextFrame, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Buffer->Pcolor, true);
undoManager->setUndoEnabled(false);
if ((Buffer->m_isAnnotation) && (Buffer->m_annotation.UseIcons()))
{
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
Items->at(z)->Pfile = Buffer->Pfile;
Items->at(z)->Pfile2 = Buffer->Pfile2;
Items->at(z)->Pfile3 = Buffer->Pfile3;
Items->at(z)->IProfile = Buffer->IProfile;
Items->at(z)->EmProfile = Buffer->EmProfile;
Items->at(z)->IRender = Buffer->IRender;
Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
LoadPict(Items->at(z)->Pfile, z);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageShown(Buffer->PicArt);
}
if (!Buffer->itemText.isEmpty())
{
QTextStream t(&Buffer->itemText, QIODevice::ReadOnly);
QString cc;
while (!t.atEnd())
{
cc = t.readLine();
if (cc.isEmpty())
continue;
QStringList wt;
QStringList::Iterator it;
wt = cc.split("\t", QString::SkipEmptyParts);
it = wt.begin();
CharStyle nstyle;
QString ch = (*it);
if (ch == QChar(5))
ch = SpecialChars::PARSEP;
if (ch == QChar(4))
ch = SpecialChars::TAB;
it++;
nstyle.setFont((*AllFonts)[*it]);
it++;
nstyle.setFontSize(qRound(ScCLocale::toDoubleC((*it)) * 10));
it++;
nstyle.setFillColor(*it);
it++;
nstyle.setTracking((*it).toInt());
it++;
nstyle.setFillShade((*it).toInt());
it++;
nstyle.setFeatures(static_cast<StyleFlag>(it == wt.end() ? 0 : (*it).toInt()).featureList());
it++;
int cab = it == wt.end() ? 0 : (*it).toInt();
it++;
nstyle.setStrokeColor(it == wt.end() ? CommonStrings::None : *it);
it++;
nstyle.setStrokeShade(it == wt.end() ? 100 : (*it).toInt());
it++;
if (it == wt.end())
nstyle.setScaleH(1000);
else
nstyle.setScaleH(qMin(qMax((*it).toInt(), 100), 4000));
it++;
if (it == wt.end())
nstyle.setScaleV(1000);
else
nstyle.setScaleV(qMin(qMax((*it).toInt(), 100), 4000));
it++;
nstyle.setBaselineOffset(it == wt.end() ? 0 : (*it).toInt());
it++;
nstyle.setShadowXOffset(it == wt.end() ? 50 : (*it).toInt());
it++;
nstyle.setShadowYOffset(it == wt.end() ? -50 : (*it).toInt());
it++;
nstyle.setOutlineWidth(it == wt.end() ? 10 : (*it).toInt());
it++;
nstyle.setUnderlineOffset(it == wt.end() ? -1 : (*it).toInt());
it++;
nstyle.setUnderlineWidth(it == wt.end() ? -1 : (*it).toInt());
it++;
nstyle.setStrikethruOffset(it == wt.end() ? -1 : (*it).toInt());
it++;
nstyle.setStrikethruWidth(it == wt.end() ? -1 : (*it).toInt());
uint pos = Items->at(z)->itemText.length();
Items->at(z)->itemText.insertChars(pos, ch);
if (ch == SpecialChars::PARSEP && cab > 0) {
ParagraphStyle pstyle;
pstyle.setParent(paragraphStyles()[cab].name());
Items->at(z)->itemText.applyStyle(pos, pstyle);
}
else {
Items->at(z)->itemText.applyCharStyle(pos, 1, nstyle);
}
}
}
{
ParagraphStyle pstyle;
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(Buffer->textAlignment));
pstyle.setLineSpacing(Buffer->LineSp);
pstyle.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(Buffer->LineSpMode));
if (AllFonts->contains(Buffer->IFont))
pstyle.charStyle().setFont((*AllFonts)[Buffer->IFont]);
else
pstyle.charStyle().setFont((*AllFonts)[itemToolPrefs.textFont]);
pstyle.charStyle().setFontSize(Buffer->ISize);
pstyle.charStyle().setFillColor(Buffer->TxtFill);
pstyle.charStyle().setStrokeColor(Buffer->TxtStroke);
pstyle.charStyle().setFillShade(Buffer->ShTxtFill);
pstyle.charStyle().setStrokeShade(Buffer->ShTxtStroke);
pstyle.charStyle().setScaleH(Buffer->TxtScale);
pstyle.charStyle().setScaleV(Buffer->TxtScaleV);
pstyle.charStyle().setBaselineOffset(Buffer->TxTBase);
pstyle.charStyle().setFeatures(StyleFlag(Buffer->TxTStyle).featureList());
pstyle.charStyle().setShadowXOffset(Buffer->TxtShadowX);
pstyle.charStyle().setShadowYOffset(Buffer->TxtShadowY);
pstyle.charStyle().setOutlineWidth(Buffer->TxtOutline);
pstyle.charStyle().setUnderlineOffset(Buffer->TxtUnderPos);
pstyle.charStyle().setUnderlineWidth(Buffer->TxtUnderWidth);
pstyle.charStyle().setStrikethruOffset(Buffer->TxtStrikePos);
pstyle.charStyle().setStrikethruWidth(Buffer->TxtStrikeWidth);
Items->at(z)->itemText.setDefaultStyle(pstyle);
}
undoManager->setUndoEnabled(true);
#endif
break;
case PageItem::Line:
z = itemAdd(PageItem::Line, PageItem::Unspecified, x, y, w ,0, pw, CommonStrings::None, Buffer->Pcolor2, true);
break;
case PageItem::Polygon:
z = itemAdd(PageItem::Polygon, PageItem::Unspecified, x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2, true);
break;
case PageItem::PolyLine:
z = itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2, true);
break;
case PageItem::Multiple:
Q_ASSERT(false);
break;
case PageItem::LatexFrame:
{
z = itemAdd(PageItem::LatexFrame, PageItem::Unspecified, x, y, w, h, 1, itemToolPrefs.imageFillColor, CommonStrings::None, true);
undoManager->setUndoEnabled(false);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
Items->at(z)->Pfile = Buffer->Pfile;
Items->at(z)->IProfile = Buffer->IProfile;
Items->at(z)->EmProfile = Buffer->EmProfile;
Items->at(z)->IRender = Buffer->IRender;
Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
if (!Items->at(z)->Pfile.isEmpty())
LoadPict(Items->at(z)->Pfile, z);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageShown(Buffer->PicArt);
Items->at(z)->ScaleType = Buffer->ScaleType;
Items->at(z)->AspectRatio = Buffer->AspectRatio;
Items->at(z)->setLineWidth(Buffer->Pwidth);
PageItem_LatexFrame *latexframe = Items->at(z)->asLatexFrame();
latexframe->setFormula(Buffer->itemText); //itemText seems to be a good choice...
undoManager->setUndoEnabled(true);
break;
}
case PageItem::OSGFrame:
#ifdef HAVE_OSG
z = itemAdd(PageItem::OSGFrame, PageItem::Unspecified, x, y, w, h, 1, itemToolPrefs.imageFillColor, CommonStrings::None, true);
undoManager->setUndoEnabled(false);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
Items->at(z)->Pfile = Buffer->Pfile;
Items->at(z)->IProfile = Buffer->IProfile;
Items->at(z)->EmProfile = Buffer->EmProfile;
Items->at(z)->IRender = Buffer->IRender;
Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
if (!Items->at(z)->Pfile.isEmpty())
LoadPict(Items->at(z)->Pfile, z);
Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Items->at(z)->setImageShown(Buffer->PicArt);
Items->at(z)->ScaleType = Buffer->ScaleType;
Items->at(z)->AspectRatio = Buffer->AspectRatio;
Items->at(z)->setLineWidth(Buffer->Pwidth);
undoManager->setUndoEnabled(true);
#endif
break;
}
PageItem *currItem = Items->at(z);
undoManager->setUndoEnabled(false);
/*FIXME
currItem->setLineSpacingMode(Buffer->LineSpMode);
if (currItem->lineSpacingMode() == 3)
{
currItem->setLineSpacing(Doc->typographicSettings.valueBaseGrid-1);
}
*/
currItem->setImageFlippedH(Buffer->flippedH);
currItem->setImageFlippedV(Buffer->flippedV);
currItem->setCornerRadius(Buffer->RadRect);
currItem->FrameType = Buffer->FrameType;
currItem->ClipEdited = Buffer->ClipEdited;
currItem->setFillColor(Buffer->Pcolor);
currItem->setLineColor(Buffer->Pcolor2);
currItem->setFillShade(Buffer->Shade);
currItem->setLineShade(Buffer->Shade2);
currItem->fillRule = Buffer->FillRule;
currItem->setRotation(Buffer->Rot);
currItem->setTextToFrameDist(Buffer->Extra, Buffer->RExtra, Buffer->TExtra, Buffer->BExtra);
currItem->PLineArt = Qt::PenStyle(Buffer->PLineArt);
currItem->PLineEnd = Qt::PenCapStyle(Buffer->PLineEnd);
currItem->PLineJoin = Qt::PenJoinStyle(Buffer->PLineJoin);
currItem->setPrintEnabled(Buffer->isPrintable);
currItem->isBookmark = Buffer->isBookmark;
currItem->Groups = Buffer->Groups;
currItem->setIsAnnotation(Buffer->m_isAnnotation);
currItem->setAnnotation(Buffer->m_annotation);
if (!Buffer->AnName.isEmpty())
{
if (!drag)
{
if (currItem->itemName() == Buffer->AnName)
currItem->AutoName = true;
else
{
currItem->setItemName(Buffer->AnName);
currItem->AutoName = false;
}
}
else
{
currItem->setItemName(Buffer->AnName);
currItem->AutoName = false;
}
}
else
{
if (currItem->isGroupControl)
currItem->setItemName( tr("Group%1").arg(currItem->Groups.top()));
}
 
currItem->TopLine = Buffer->TopLine;
currItem->RightLine = Buffer->RightLine;
currItem->LeftLine = Buffer->LeftLine;
currItem->BottomLine = Buffer->BottomLine;
currItem->isTableItem = Buffer->isTableItem;
currItem->TopLinkID = Buffer->TopLinkID;
currItem->LeftLinkID = Buffer->LeftLinkID;
currItem->RightLinkID = Buffer->RightLinkID;
currItem->BottomLinkID = Buffer->BottomLinkID;
currItem->Clip = Buffer->Clip; //irrelevant, overwritten below
currItem->PoShow = Buffer->PoShow;
currItem->BaseOffs = Buffer->BaseOffs;
currItem->textPathFlipped = Buffer->textPathFlipped;
currItem->textPathType = Buffer->textPathType;
currItem->setTextFlowMode((PageItem::TextFlowMode) Buffer->TextflowMode);
currItem->DashValues = Buffer->DashValues;
currItem->DashOffset = Buffer->DashOffset;
currItem->setLocked(Buffer->Locked);
currItem->setSizeLocked(Buffer->LockRes);
currItem->setFillTransparency(Buffer->Transparency);
currItem->setLineTransparency(Buffer->TranspStroke);
currItem->setFillBlendmode(Buffer->TransBlend);
currItem->setLineBlendmode(Buffer->TransBlendS);
currItem->setStartArrowIndex(Buffer->startArrowIndex);
currItem->setEndArrowIndex(Buffer->endArrowIndex);
currItem->setReversed(Buffer->Reverse);
currItem->NamedLStyle = Buffer->NamedLStyle;
currItem->Cols = Buffer->Cols;
currItem->ColGap = Buffer->ColGap;
currItem->setFirstLineOffset(Buffer->firstLineOffsetP);
if (Buffer->LayerID != -1)
currItem->LayerID = Buffer->LayerID;
currItem->PoLine = Buffer->PoLine.copy();
currItem->setTextFlowMode((PageItem::TextFlowMode) Buffer->TextflowMode);
if (Buffer->ContourLine.size() == 0)
currItem->ContourLine = currItem->PoLine.copy();
else
currItem->ContourLine = Buffer->ContourLine.copy();
if (!currItem->asLine())
{
// OBSOLETE CR 2005-02-06
if ((currItem->PoLine.size() == 0) && (currItem->itemType() != PageItem::ItemType1))
currItem->convertClip();
else
//
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);
}
// OBSOLETE CR 2005-02-06
if (currItem->itemType() == PageItem::ItemType1)
{
currItem->SetOvalFrame();
setRedrawBounding(currItem);
}
// OBSOLETE CR 2005-02-06
if (currItem->itemType() == PageItem::ItemType3)
{
if (currItem->cornerRadius() != 0.0)
{
nodeEdit.deselect();
currItem->SetFrameRound();
setRedrawBounding(currItem);
}
else
{
currItem->SetRectFrame();
setRedrawBounding(currItem);
}
currItem->ClipEdited = true;
}
if (currItem->asImageFrame())
currItem->AdjustPictScale();
if (currItem->asPathText())
{
currItem->ClipEdited = true;
currItem->FrameType = 3;
currItem->updatePolyClip();
currItem->Frame = true;
}
if (Buffer->GrType != 0)
{
if (Buffer->GrType == 8)
{
currItem->setPattern(Buffer->pattern);
currItem->GrType = Buffer->GrType;
currItem->setPatternTransform(Buffer->patternScaleX, Buffer->patternScaleY, Buffer->patternOffsetX, Buffer->patternOffsetY, Buffer->patternRotation, Buffer->patternSkewX, Buffer->patternSkewY);
currItem->setPatternFlip(Buffer->patternMirrorX, Buffer->patternMirrorY);
}
else
{
if ((!Buffer->GrColor.isEmpty()) && (!Buffer->GrColor2.isEmpty()))
{
currItem->fill_gradient.clearStops();
if (Buffer->GrType == 5)
{
if ((Buffer->GrColor != CommonStrings::None) && (!Buffer->GrColor.isEmpty()))
currItem->SetQColor(&tmp, Buffer->GrColor, Buffer->GrShade);
currItem->fill_gradient.addStop(tmp, 0.0, 0.5, 1.0, Buffer->GrColor, Buffer->GrShade);
if ((Buffer->GrColor2 != CommonStrings::None) && (!Buffer->GrColor2.isEmpty()))
currItem->SetQColor(&tmp, Buffer->GrColor2, Buffer->GrShade2);
currItem->fill_gradient.addStop(tmp, 1.0, 0.5, 1.0, Buffer->GrColor2, Buffer->GrShade2);
}
else
{
if ((Buffer->GrColor2 != CommonStrings::None) && (!Buffer->GrColor2.isEmpty()))
currItem->SetQColor(&tmp, Buffer->GrColor2, Buffer->GrShade2);
currItem->fill_gradient.addStop(tmp, 0.0, 0.5, 1.0, Buffer->GrColor2, Buffer->GrShade2);
if ((Buffer->GrColor != CommonStrings::None) && (!Buffer->GrColor.isEmpty()))
currItem->SetQColor(&tmp, Buffer->GrColor, Buffer->GrShade);
currItem->fill_gradient.addStop(tmp, 1.0, 0.5, 1.0, Buffer->GrColor, Buffer->GrShade);
}
}
else
currItem->fill_gradient = Buffer->fill_gradient;
currItem->GrType = Buffer->GrType;
currItem->GrStartX = Buffer->GrStartX;
currItem->GrStartY = Buffer->GrStartY;
currItem->GrEndX = Buffer->GrEndX;
currItem->GrEndY = Buffer->GrEndY;
currItem->GrFocalX = Buffer->GrFocalX;
currItem->GrFocalY = Buffer->GrFocalY;
currItem->GrScale = Buffer->GrScale;
currItem->GrSkew = Buffer->GrSkew;
}
}
if (Buffer->GrTypeStroke >0)
{
currItem->stroke_gradient = Buffer->stroke_gradient;
currItem->GrTypeStroke = Buffer->GrTypeStroke;
currItem->GrStrokeStartX = Buffer->GrStrokeStartX;
currItem->GrStrokeStartY = Buffer->GrStrokeStartY;
currItem->GrStrokeEndX = Buffer->GrStrokeEndX;
currItem->GrStrokeEndY = Buffer->GrStrokeEndY;
currItem->GrStrokeFocalX = Buffer->GrStrokeFocalX;
currItem->GrStrokeFocalY = Buffer->GrStrokeFocalY;
currItem->GrStrokeScale = Buffer->GrStrokeScale;
currItem->GrStrokeSkew = Buffer->GrStrokeSkew;
}
currItem->GrMask = Buffer->GrMask;
if ((currItem->GrMask == 1) || (currItem->GrMask == 2) || (currItem->GrMask == 4) || (currItem->GrMask == 5))
{
currItem->mask_gradient = Buffer->mask_gradient;
currItem->GrMaskStartX = Buffer->GrMaskStartX;
currItem->GrMaskStartY = Buffer->GrMaskStartY;
currItem->GrMaskEndX = Buffer->GrMaskEndX;
currItem->GrMaskEndY = Buffer->GrMaskEndY;
currItem->GrMaskFocalX = Buffer->GrMaskFocalX;
currItem->GrMaskFocalY = Buffer->GrMaskFocalY;
currItem->GrMaskScale = Buffer->GrMaskScale;
currItem->GrMaskSkew = Buffer->GrMaskSkew;
}
else if ((currItem->GrMask == 3) || (currItem->GrMask == 6))
{
currItem->setPatternMask(Buffer->patternMaskVal);
currItem->setMaskTransform(Buffer->patternMaskScaleX, Buffer->patternMaskScaleY, Buffer->patternMaskOffsetX, Buffer->patternMaskOffsetY, Buffer->patternMaskRotation, Buffer->patternMaskSkewX, Buffer->patternMaskSkewY);
currItem->setMaskFlip(Buffer->patternMaskMirrorX, Buffer->patternMaskMirrorY);
}
currItem->updateGradientVectors();
currItem->setObjectAttributes(&(Buffer->pageItemAttributes));
if (resize)
setRedrawBounding(currItem);
currItem->OwnPage = OnPage(currItem);
undoManager->setUndoEnabled(true);
}
 
int ScribusDoc::itemAdd(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const double x, const double y, const double b, const double h, const double w, const QString& fill, const QString& outline, const bool itemFinalised)
{
assert(itemFinalised); // av: caller must wrap transaction around this if wanted
5042,7 → 5494,7
if (m_Selection->count() != 0)
{
ScriXmlDoc *ss = new ScriXmlDoc();
itemBuffer.append(ss->WriteElem(this, view(), m_Selection));
itemBuffer.append(ss->WriteElem(this, m_Selection));
m_Selection->clear();
delete ss;
}
5120,7 → 5572,7
if ((lcount < itemBuffer.count()) && !itemBuffer[lcount].isEmpty())
{
ScriXmlDoc *ss = new ScriXmlDoc();
ss->ReadElemToLayer(itemBuffer[lcount], prefsData.fontPrefs.AvailFonts, this, destination->xOffset(), destination->yOffset(), false, true, prefsData.fontPrefs.GFontSub, view(),(*it).ID);
ss->ReadElemToLayer(itemBuffer[lcount], prefsData.fontPrefs.AvailFonts, this, destination->xOffset(), destination->yOffset(), false, true, prefsData.fontPrefs.GFontSub,(*it).ID);
delete ss;
}
lcount++;
/trunk/Scribus/scribus/scribusview.h
224,7 → 224,6
void SetFrameRect();
void SetFrameRounded();
void SetFrameOval();
void PasteItem(struct CopyPasteBuffer *Buffer, bool loading, bool drag = false, bool noResize = true);
// void QueryFarben();
void rememberOldZoomLocation(int mx=0, int my=0);
bool groupTransactionStarted() { return m_groupTransactions > 0; }
/trunk/Scribus/scribus/scribusXml.h
30,7 → 30,6
#include <QXmlStreamWriter>
class PageItem;
class PrefsManager;
class ScribusView;
class SCFonts;
class ScribusDoc;
class ScPattern;
51,9 → 50,9
\retval bool true = Scribus format file, false : not Scribus
*/
bool ReadElemHeader(QString file, bool isFile, double *x, double *y, double *w, double *h);
bool ReadElem(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, ScribusView *view);
bool ReadElemToLayer(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, ScribusView *view, int toLayer);
QString WriteElem(ScribusDoc *doc, ScribusView *view, Selection *selection);
bool ReadElem(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub);
bool ReadElemToLayer(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, int toLayer);
QString WriteElem(ScribusDoc *doc, Selection *selection);
 
ColorList Farben;
StyleSet<ParagraphStyle> docParagraphStyles;
79,7 → 78,7
void GetItemText (const QXmlStreamAttributes& attrs, StoryText& story, ScribusDoc *doc, LastStyles* last, bool VorLFound, bool impo);
void GetStyle(QXmlStreamReader& reader, ParagraphStyle &vg, StyleSet<ParagraphStyle>* tempStyles, ScribusDoc* doc, bool fl);
 
void ReadPattern(QXmlStreamReader& reader, ScribusDoc* doc, ScribusView *view, const QString& fileName, int& GrMax, bool styleFound, bool newVersion);
void ReadPattern(QXmlStreamReader& reader, ScribusDoc* doc, const QString& fileName, int& GrMax, bool styleFound, bool newVersion);
void ReadLegacyCStyle (const QXmlStreamAttributes& attrs, CharStyle& style, ScribusDoc* doc);
void ReadCStyle (const QXmlStreamAttributes& attrs, CharStyle& style, ScribusDoc* doc);
void ReadPStyle (QXmlStreamReader& reader, ParagraphStyle &style, ScribusDoc* doc);
/trunk/Scribus/scribus/scribusXml.cpp
40,7 → 40,6
#endif
#include "prefsmanager.h"
#include "scclocale.h"
#include "scribusview.h"
#include "scribusdoc.h"
#include "selection.h"
#include "text/nlsconfig.h"
1024,14 → 1023,14
return (succeed && !sReader.hasError());
}
 
bool ScriXmlDoc::ReadElem(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, ScribusView *view)
bool ScriXmlDoc::ReadElem(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub)
{
// Do not suppose the existence of layer with id = 0
// return ReadElemToLayer(fileName, avail, doc, Xp, Yp, Fi, loc, FontSub, view, 0);
return ReadElemToLayer(fileName, avail, doc, Xp, Yp, Fi, loc, FontSub, view, doc->activeLayer());
return ReadElemToLayer(fileName, avail, doc, Xp, Yp, Fi, loc, FontSub, doc->activeLayer());
}
 
bool ScriXmlDoc::ReadElemToLayer(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, ScribusView *view, int toLayer)
bool ScriXmlDoc::ReadElemToLayer(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, int toLayer)
{
QString ff;
struct CopyPasteBuffer OB;
1247,7 → 1246,7
ScPattern pat;
// uint ac = doc->Items->count();
QString patFile = Fi ? fileName : QString();
ReadPattern(sReader, doc, view, patFile, GrMax, VorLFound, newVersion);
ReadPattern(sReader, doc, patFile, GrMax, VorLFound, newVersion);
}
}
1544,7 → 1543,7
if (sReader.isEndElement() && (tagName == "ITEM"))
{
LastStyles lastStyle;
view->PasteItem(&OB, true, true, false);
doc->PasteItem(&OB, true, false);
PageItem* Neu = doc->Items->at(doc->Items->count()-1);
Neu->OverrideCompressionMethod = OB.OverrideCompressionMethod;
Neu->OverrideCompressionQuality = OB.OverrideCompressionQuality;
1683,8 → 1682,7
return (!sReader.hasError());
}
 
void ScriXmlDoc::ReadPattern(QXmlStreamReader &reader, ScribusDoc *doc, ScribusView *view, const QString& fileName,
int& GrMax, bool styleFound, bool newVersion)
void ScriXmlDoc::ReadPattern(QXmlStreamReader &reader, ScribusDoc *doc, const QString& fileName, int& GrMax, bool styleFound, bool newVersion)
{
QString tmp, tmpf, tmf;
QList<PageItem*> TableItems;
1920,7 → 1918,7
if (tagName1 == "PatternItem" && reader.isEndElement())
{
LastStyles lastStyle;
view->PasteItem(&OB, true, true, false);
doc->PasteItem(&OB, true, false);
PageItem* Neu = doc->Items->at(doc->Items->count()-1);
Neu->OverrideCompressionMethod = OB.OverrideCompressionMethod;
Neu->OverrideCompressionQuality = OB.OverrideCompressionQuality;
2051,7 → 2049,7
doc->GroupCounter = GrMax + 1;
}
 
QString ScriXmlDoc::WriteElem(ScribusDoc *doc, ScribusView *view, Selection* selection)
QString ScriXmlDoc::WriteElem(ScribusDoc *doc, Selection* selection)
{
if (selection->count()==0)
return "";
2412,8 → 2410,7
return documentStr;
}
 
void ScriXmlDoc::WriteObject(ScXmlStreamWriter& writer, ScribusDoc *doc, PageItem *item, const QString& baseDir,
QMap<int, int> &UsedMapped2Saved)
void ScriXmlDoc::WriteObject(ScXmlStreamWriter& writer, ScribusDoc *doc, PageItem *item, const QString& baseDir, QMap<int, int> &UsedMapped2Saved)
{
QString text, tmp, tmpy;
QString CurDirP = QDir::currentPath();
/trunk/Scribus/scribus/scribusdoc.h
584,6 → 584,7
* unnecessary part from the view for now which is overloaded with non ScrollView code.
*/
//TODO: void PasteItem(struct CopyPasteBuffer *Buffer, bool loading, bool drag = false);
void PasteItem(struct CopyPasteBuffer *Buffer, bool drag = false, bool noResize = true);
/**
* @brief Add an Item to the document.
/trunk/Scribus/scribus/scribusview.cpp
3403,501 → 3403,6
}
}
 
//CB Stop using this for putting items on pages apart from pasting
//IE write a more generic function in the doc
void ScribusView::PasteItem(struct CopyPasteBuffer *Buffer, bool loading, bool drag, bool resize)
{
QColor tmp;
if (!loading)
Deselect(true);
double x = Buffer->Xpos;
double y = Buffer->Ypos;
double w = Buffer->Width;
double h = Buffer->Height;
double pw = Buffer->Pwidth;
int z = 0;
// qDebug() << "Pasting frame of type " << Buffer->PType;
switch (Buffer->PType)
{
// OBSOLETE CR 2005-02-06
case PageItem::ItemType1:
z = Doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2, true);
break;
//
case PageItem::ImageFrame:
z = Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, x, y, w, h, 1, Doc->itemToolPrefs.imageFillColor, CommonStrings::None, true);
undoManager->setUndoEnabled(false);
Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Doc->Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
Doc->Items->at(z)->Pfile = Buffer->Pfile;
Doc->Items->at(z)->IProfile = Buffer->IProfile;
Doc->Items->at(z)->EmProfile = Buffer->EmProfile;
Doc->Items->at(z)->IRender = Buffer->IRender;
Doc->Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
if (!Doc->Items->at(z)->Pfile.isEmpty())
Doc->LoadPict(Doc->Items->at(z)->Pfile, z);
Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Doc->Items->at(z)->setImageShown(Buffer->PicArt);
/* Doc->Items->at(z)->BBoxX = Buffer->BBoxX;
Doc->Items->at(z)->BBoxH = Buffer->BBoxH; */
Doc->Items->at(z)->ScaleType = Buffer->ScaleType;
Doc->Items->at(z)->AspectRatio = Buffer->AspectRatio;
Doc->Items->at(z)->setLineWidth(Buffer->Pwidth);
undoManager->setUndoEnabled(true);
break;
// OBSOLETE CR 2005-02-06
case PageItem::ItemType3:
z = Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2, true);
break;
//
case PageItem::PathText:
case PageItem::TextFrame:
#ifndef NLS_PROTO
if (Buffer->PType == PageItem::PathText)
z = Doc->itemAdd(PageItem::PathText, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Buffer->Pcolor, true);
else
z = Doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Buffer->Pcolor, true);
undoManager->setUndoEnabled(false);
if ((Buffer->m_isAnnotation) && (Buffer->m_annotation.UseIcons()))
{
Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Doc->Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
Doc->Items->at(z)->Pfile = Buffer->Pfile;
Doc->Items->at(z)->Pfile2 = Buffer->Pfile2;
Doc->Items->at(z)->Pfile3 = Buffer->Pfile3;
Doc->Items->at(z)->IProfile = Buffer->IProfile;
Doc->Items->at(z)->EmProfile = Buffer->EmProfile;
Doc->Items->at(z)->IRender = Buffer->IRender;
Doc->Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
Doc->LoadPict(Doc->Items->at(z)->Pfile, z);
Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Doc->Items->at(z)->setImageShown(Buffer->PicArt);
}
if (!Buffer->itemText.isEmpty())
{
QTextStream t(&Buffer->itemText, QIODevice::ReadOnly);
QString cc;
while (!t.atEnd())
{
cc = t.readLine();
if (cc.isEmpty())
continue;
QStringList wt;
QStringList::Iterator it;
wt = cc.split("\t", QString::SkipEmptyParts);
it = wt.begin();
CharStyle nstyle;
QString ch = (*it);
if (ch == QChar(5))
ch = SpecialChars::PARSEP;
if (ch == QChar(4))
ch = SpecialChars::TAB;
it++;
nstyle.setFont((*Doc->AllFonts)[*it]);
it++;
nstyle.setFontSize(qRound(ScCLocale::toDoubleC((*it)) * 10));
it++;
nstyle.setFillColor(*it);
it++;
nstyle.setTracking((*it).toInt());
it++;
nstyle.setFillShade((*it).toInt());
it++;
nstyle.setFeatures(static_cast<StyleFlag>(it == wt.end() ? 0 : (*it).toInt()).featureList());
it++;
int cab = it == wt.end() ? 0 : (*it).toInt();
it++;
nstyle.setStrokeColor(it == wt.end() ? CommonStrings::None : *it);
it++;
nstyle.setStrokeShade(it == wt.end() ? 100 : (*it).toInt());
it++;
if (it == wt.end())
nstyle.setScaleH(1000);
else
nstyle.setScaleH(qMin(qMax((*it).toInt(), 100), 4000));
it++;
if (it == wt.end())
nstyle.setScaleV(1000);
else
nstyle.setScaleV(qMin(qMax((*it).toInt(), 100), 4000));
it++;
nstyle.setBaselineOffset(it == wt.end() ? 0 : (*it).toInt());
it++;
nstyle.setShadowXOffset(it == wt.end() ? 50 : (*it).toInt());
it++;
nstyle.setShadowYOffset(it == wt.end() ? -50 : (*it).toInt());
it++;
nstyle.setOutlineWidth(it == wt.end() ? 10 : (*it).toInt());
it++;
nstyle.setUnderlineOffset(it == wt.end() ? -1 : (*it).toInt());
it++;
nstyle.setUnderlineWidth(it == wt.end() ? -1 : (*it).toInt());
it++;
nstyle.setStrikethruOffset(it == wt.end() ? -1 : (*it).toInt());
it++;
nstyle.setStrikethruWidth(it == wt.end() ? -1 : (*it).toInt());
uint pos = Doc->Items->at(z)->itemText.length();
Doc->Items->at(z)->itemText.insertChars(pos, ch);
if (ch == SpecialChars::PARSEP && cab > 0) {
ParagraphStyle pstyle;
pstyle.setParent(Doc->paragraphStyles()[cab].name());
Doc->Items->at(z)->itemText.applyStyle(pos, pstyle);
}
else {
Doc->Items->at(z)->itemText.applyCharStyle(pos, 1, nstyle);
}
}
}
{
ParagraphStyle pstyle;
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(Buffer->textAlignment));
pstyle.setLineSpacing(Buffer->LineSp);
pstyle.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(Buffer->LineSpMode));
if (Doc->AllFonts->contains(Buffer->IFont))
pstyle.charStyle().setFont((*Doc->AllFonts)[Buffer->IFont]);
else
pstyle.charStyle().setFont((*Doc->AllFonts)[Doc->itemToolPrefs.textFont]);
pstyle.charStyle().setFontSize(Buffer->ISize);
pstyle.charStyle().setFillColor(Buffer->TxtFill);
pstyle.charStyle().setStrokeColor(Buffer->TxtStroke);
pstyle.charStyle().setFillShade(Buffer->ShTxtFill);
pstyle.charStyle().setStrokeShade(Buffer->ShTxtStroke);
pstyle.charStyle().setScaleH(Buffer->TxtScale);
pstyle.charStyle().setScaleV(Buffer->TxtScaleV);
pstyle.charStyle().setBaselineOffset(Buffer->TxTBase);
pstyle.charStyle().setFeatures(StyleFlag(Buffer->TxTStyle).featureList());
pstyle.charStyle().setShadowXOffset(Buffer->TxtShadowX);
pstyle.charStyle().setShadowYOffset(Buffer->TxtShadowY);
pstyle.charStyle().setOutlineWidth(Buffer->TxtOutline);
pstyle.charStyle().setUnderlineOffset(Buffer->TxtUnderPos);
pstyle.charStyle().setUnderlineWidth(Buffer->TxtUnderWidth);
pstyle.charStyle().setStrikethruOffset(Buffer->TxtStrikePos);
pstyle.charStyle().setStrikethruWidth(Buffer->TxtStrikeWidth);
Doc->Items->at(z)->itemText.setDefaultStyle(pstyle);
}
undoManager->setUndoEnabled(true);
#endif
break;
case PageItem::Line:
z = Doc->itemAdd(PageItem::Line, PageItem::Unspecified, x, y, w ,0, pw, CommonStrings::None, Buffer->Pcolor2, true);
break;
case PageItem::Polygon:
z = Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2, true);
break;
case PageItem::PolyLine:
z = Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2, true);
break;
case PageItem::Multiple:
Q_ASSERT(false);
break;
case PageItem::LatexFrame:
{
z = Doc->itemAdd(PageItem::LatexFrame, PageItem::Unspecified, x, y, w, h, 1, Doc->itemToolPrefs.imageFillColor, CommonStrings::None, true);
undoManager->setUndoEnabled(false);
Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Doc->Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
Doc->Items->at(z)->Pfile = Buffer->Pfile;
Doc->Items->at(z)->IProfile = Buffer->IProfile;
Doc->Items->at(z)->EmProfile = Buffer->EmProfile;
Doc->Items->at(z)->IRender = Buffer->IRender;
Doc->Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
if (!Doc->Items->at(z)->Pfile.isEmpty())
Doc->LoadPict(Doc->Items->at(z)->Pfile, z);
Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Doc->Items->at(z)->setImageShown(Buffer->PicArt);
Doc->Items->at(z)->ScaleType = Buffer->ScaleType;
Doc->Items->at(z)->AspectRatio = Buffer->AspectRatio;
Doc->Items->at(z)->setLineWidth(Buffer->Pwidth);
PageItem_LatexFrame *latexframe = Doc->Items->at(z)->asLatexFrame();
latexframe->setFormula(Buffer->itemText); //itemText seems to be a good choice...
undoManager->setUndoEnabled(true);
break;
}
case PageItem::OSGFrame:
#ifdef HAVE_OSG
z = Doc->itemAdd(PageItem::OSGFrame, PageItem::Unspecified, x, y, w, h, 1, Doc->itemToolPrefs.imageFillColor, CommonStrings::None, true);
undoManager->setUndoEnabled(false);
Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Doc->Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
Doc->Items->at(z)->Pfile = Buffer->Pfile;
Doc->Items->at(z)->IProfile = Buffer->IProfile;
Doc->Items->at(z)->EmProfile = Buffer->EmProfile;
Doc->Items->at(z)->IRender = Buffer->IRender;
Doc->Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
if (!Doc->Items->at(z)->Pfile.isEmpty())
Doc->LoadPict(Doc->Items->at(z)->Pfile, z);
Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
Doc->Items->at(z)->setImageShown(Buffer->PicArt);
Doc->Items->at(z)->ScaleType = Buffer->ScaleType;
Doc->Items->at(z)->AspectRatio = Buffer->AspectRatio;
Doc->Items->at(z)->setLineWidth(Buffer->Pwidth);
undoManager->setUndoEnabled(true);
#endif
break;
}
PageItem *currItem = Doc->Items->at(z);
undoManager->setUndoEnabled(false);
/*FIXME
currItem->setLineSpacingMode(Buffer->LineSpMode);
if (currItem->lineSpacingMode() == 3)
{
currItem->setLineSpacing(Doc->typographicSettings.valueBaseGrid-1);
}
*/
currItem->setImageFlippedH(Buffer->flippedH);
currItem->setImageFlippedV(Buffer->flippedV);
currItem->setCornerRadius(Buffer->RadRect);
currItem->FrameType = Buffer->FrameType;
currItem->ClipEdited = Buffer->ClipEdited;
currItem->setFillColor(Buffer->Pcolor);
currItem->setLineColor(Buffer->Pcolor2);
currItem->setFillShade(Buffer->Shade);
currItem->setLineShade(Buffer->Shade2);
currItem->fillRule = Buffer->FillRule;
/* currItem->TxtStroke = Buffer->TxtStroke;
currItem->TxtFill = Buffer->TxtFill;
currItem->ShTxtStroke = Buffer->ShTxtStroke;
currItem->ShTxtFill = Buffer->ShTxtFill;
currItem->TxtScale = Buffer->TxtScale;
currItem->TxtScaleV = Buffer->TxtScaleV;
currItem->TxTStyle = Buffer->TxTStyle;
currItem->TxtShadowX = Buffer->TxtShadowX;
currItem->TxtShadowY = Buffer->TxtShadowY;
currItem->TxtOutline = Buffer->TxtOutline;
currItem->TxtUnderPos = Buffer->TxtUnderPos;
currItem->TxtUnderWidth = Buffer->TxtUnderWidth;
currItem->TxtStrikePos = Buffer->TxtStrikePos;
currItem->TxtStrikeWidth = Buffer->TxtStrikeWidth;
*/
currItem->setRotation(Buffer->Rot);
currItem->setTextToFrameDist(Buffer->Extra, Buffer->RExtra, Buffer->TExtra, Buffer->BExtra);
currItem->PLineArt = Qt::PenStyle(Buffer->PLineArt);
currItem->PLineEnd = Qt::PenCapStyle(Buffer->PLineEnd);
currItem->PLineJoin = Qt::PenJoinStyle(Buffer->PLineJoin);
currItem->setPrintEnabled(Buffer->isPrintable);
currItem->isBookmark = Buffer->isBookmark;
// currItem->BMnr = Buffer->BMnr;
currItem->Groups = Buffer->Groups;
currItem->setIsAnnotation(Buffer->m_isAnnotation);
currItem->setAnnotation(Buffer->m_annotation);
if (!Buffer->AnName.isEmpty())
{
if (!drag)
{
if (currItem->itemName() == Buffer->AnName)
currItem->AutoName = true;
else
{
currItem->setItemName(Buffer->AnName);
currItem->AutoName = false;
}
}
else
{
// currItem->setItemName(currItem->generateUniqueCopyName(Buffer->AnName));
currItem->setItemName(Buffer->AnName);
currItem->AutoName = false;
}
}
else
{
if (currItem->isGroupControl)
currItem->setItemName( tr("Group%1").arg(currItem->Groups.top()));
}
 
currItem->TopLine = Buffer->TopLine;
currItem->RightLine = Buffer->RightLine;
currItem->LeftLine = Buffer->LeftLine;
currItem->BottomLine = Buffer->BottomLine;
currItem->isTableItem = Buffer->isTableItem;
currItem->TopLinkID = Buffer->TopLinkID;
currItem->LeftLinkID = Buffer->LeftLinkID;
currItem->RightLinkID = Buffer->RightLinkID;
currItem->BottomLinkID = Buffer->BottomLinkID;
currItem->Clip = Buffer->Clip; //irrelevant, overwritten below
currItem->PoShow = Buffer->PoShow;
currItem->BaseOffs = Buffer->BaseOffs;
currItem->textPathFlipped = Buffer->textPathFlipped;
currItem->textPathType = Buffer->textPathType;
//currItem->setTextFlowsAroundFrame(Buffer->Textflow);
//currItem->setTextFlowUsesBoundingBox(Buffer->Textflow2);
currItem->setTextFlowMode((PageItem::TextFlowMode) Buffer->TextflowMode);
// currItem->textAlignment = Buffer->textAlignment;
// currItem->setFont(Buffer->IFont);
// currItem->setFontSize(Buffer->ISize);
// currItem->ExtraV = Buffer->ExtraV;
// currItem->TabValues = Buffer->TabValues;
currItem->DashValues = Buffer->DashValues;
currItem->DashOffset = Buffer->DashOffset;
currItem->setLocked(Buffer->Locked);
currItem->setSizeLocked(Buffer->LockRes);
currItem->setFillTransparency(Buffer->Transparency);
currItem->setLineTransparency(Buffer->TranspStroke);
currItem->setFillBlendmode(Buffer->TransBlend);
currItem->setLineBlendmode(Buffer->TransBlendS);
currItem->setStartArrowIndex(Buffer->startArrowIndex);
currItem->setEndArrowIndex(Buffer->endArrowIndex);
currItem->setReversed(Buffer->Reverse);
currItem->NamedLStyle = Buffer->NamedLStyle;
// currItem->Language = m_ScMW->GetLang(Buffer->Language);
currItem->Cols = Buffer->Cols;
currItem->ColGap = Buffer->ColGap;
currItem->setFirstLineOffset(Buffer->firstLineOffsetP);
if (Buffer->LayerID != -1)
currItem->LayerID = Buffer->LayerID;
currItem->PoLine = Buffer->PoLine.copy();
//currItem->setTextFlowUsesContourLine(Buffer->UseContour);
currItem->setTextFlowMode((PageItem::TextFlowMode) Buffer->TextflowMode);
if (Buffer->ContourLine.size() == 0)
currItem->ContourLine = currItem->PoLine.copy();
else
currItem->ContourLine = Buffer->ContourLine.copy();
if (!currItem->asLine())
{
// OBSOLETE CR 2005-02-06
if ((currItem->PoLine.size() == 0) && (currItem->itemType() != PageItem::ItemType1))
currItem->convertClip();
else
//
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);
}
// OBSOLETE CR 2005-02-06
if (currItem->itemType() == PageItem::ItemType1)
{
currItem->SetOvalFrame();
Doc->setRedrawBounding(currItem);
}
// OBSOLETE CR 2005-02-06
if (currItem->itemType() == PageItem::ItemType3)
{
if (currItem->cornerRadius() != 0.0)
{
Doc->nodeEdit.deselect();
currItem->SetFrameRound();
Doc->setRedrawBounding(currItem);
}
else
{
currItem->SetRectFrame();
Doc->setRedrawBounding(currItem);
}
currItem->ClipEdited = true;
}
if (currItem->asImageFrame())
currItem->AdjustPictScale();
// if (!(currItem->asTextFrame()) && !(currItem->asPathText()))
// currItem->setFont(Doc->toolSettings.textFont);
if (currItem->asPathText())
{
currItem->ClipEdited = true;
currItem->FrameType = 3;
currItem->updatePolyClip();
currItem->Frame = true;
}
if (Buffer->GrType != 0)
{
if (Buffer->GrType == 8)
{
currItem->setPattern(Buffer->pattern);
currItem->GrType = Buffer->GrType;
currItem->setPatternTransform(Buffer->patternScaleX, Buffer->patternScaleY, Buffer->patternOffsetX, Buffer->patternOffsetY, Buffer->patternRotation, Buffer->patternSkewX, Buffer->patternSkewY);
currItem->setPatternFlip(Buffer->patternMirrorX, Buffer->patternMirrorY);
}
else
{
if ((!Buffer->GrColor.isEmpty()) && (!Buffer->GrColor2.isEmpty()))
{
currItem->fill_gradient.clearStops();
if (Buffer->GrType == 5)
{
if ((Buffer->GrColor != CommonStrings::None) && (!Buffer->GrColor.isEmpty()))
currItem->SetQColor(&tmp, Buffer->GrColor, Buffer->GrShade);
currItem->fill_gradient.addStop(tmp, 0.0, 0.5, 1.0, Buffer->GrColor, Buffer->GrShade);
if ((Buffer->GrColor2 != CommonStrings::None) && (!Buffer->GrColor2.isEmpty()))
currItem->SetQColor(&tmp, Buffer->GrColor2, Buffer->GrShade2);
currItem->fill_gradient.addStop(tmp, 1.0, 0.5, 1.0, Buffer->GrColor2, Buffer->GrShade2);
}
else
{
if ((Buffer->GrColor2 != CommonStrings::None) && (!Buffer->GrColor2.isEmpty()))
currItem->SetQColor(&tmp, Buffer->GrColor2, Buffer->GrShade2);
currItem->fill_gradient.addStop(tmp, 0.0, 0.5, 1.0, Buffer->GrColor2, Buffer->GrShade2);
if ((Buffer->GrColor != CommonStrings::None) && (!Buffer->GrColor.isEmpty()))
currItem->SetQColor(&tmp, Buffer->GrColor, Buffer->GrShade);
currItem->fill_gradient.addStop(tmp, 1.0, 0.5, 1.0, Buffer->GrColor, Buffer->GrShade);
}
}
else
currItem->fill_gradient = Buffer->fill_gradient;
currItem->GrType = Buffer->GrType;
currItem->GrStartX = Buffer->GrStartX;
currItem->GrStartY = Buffer->GrStartY;
currItem->GrEndX = Buffer->GrEndX;
currItem->GrEndY = Buffer->GrEndY;
currItem->GrFocalX = Buffer->GrFocalX;
currItem->GrFocalY = Buffer->GrFocalY;
currItem->GrScale = Buffer->GrScale;
currItem->GrSkew = Buffer->GrSkew;
}
}
if (Buffer->GrTypeStroke >0)
{
currItem->stroke_gradient = Buffer->stroke_gradient;
currItem->GrTypeStroke = Buffer->GrTypeStroke;
currItem->GrStrokeStartX = Buffer->GrStrokeStartX;
currItem->GrStrokeStartY = Buffer->GrStrokeStartY;
currItem->GrStrokeEndX = Buffer->GrStrokeEndX;
currItem->GrStrokeEndY = Buffer->GrStrokeEndY;
currItem->GrStrokeFocalX = Buffer->GrStrokeFocalX;
currItem->GrStrokeFocalY = Buffer->GrStrokeFocalY;
currItem->GrStrokeScale = Buffer->GrStrokeScale;
currItem->GrStrokeSkew = Buffer->GrStrokeSkew;
}
currItem->GrMask = Buffer->GrMask;
if ((currItem->GrMask == 1) || (currItem->GrMask == 2) || (currItem->GrMask == 4) || (currItem->GrMask == 5))
{
currItem->mask_gradient = Buffer->mask_gradient;
currItem->GrMaskStartX = Buffer->GrMaskStartX;
currItem->GrMaskStartY = Buffer->GrMaskStartY;
currItem->GrMaskEndX = Buffer->GrMaskEndX;
currItem->GrMaskEndY = Buffer->GrMaskEndY;
currItem->GrMaskFocalX = Buffer->GrMaskFocalX;
currItem->GrMaskFocalY = Buffer->GrMaskFocalY;
currItem->GrMaskScale = Buffer->GrMaskScale;
currItem->GrMaskSkew = Buffer->GrMaskSkew;
}
else if ((currItem->GrMask == 3) || (currItem->GrMask == 6))
{
currItem->setPatternMask(Buffer->patternMaskVal);
currItem->setMaskTransform(Buffer->patternMaskScaleX, Buffer->patternMaskScaleY, Buffer->patternMaskOffsetX, Buffer->patternMaskOffsetY, Buffer->patternMaskRotation, Buffer->patternMaskSkewX, Buffer->patternMaskSkewY);
currItem->setMaskFlip(Buffer->patternMaskMirrorX, Buffer->patternMaskMirrorY);
}
currItem->updateGradientVectors();
currItem->setObjectAttributes(&(Buffer->pageItemAttributes));
if (resize)
Doc->setRedrawBounding(currItem);
currItem->OwnPage = Doc->OnPage(currItem);
undoManager->setUndoEnabled(true);
if (!loading)
{
Doc->m_Selection->addItem(currItem);
emit HaveSel(currItem->itemType());
currItem->emitAllToGUI();
emit DocChanged();
updateContents();
}
}
 
void ScribusView::ToPicFrame()
{
Selection tempSelection(*Doc->m_Selection);
/trunk/Scribus/scribus/ui/masterpagepalette.cpp
270,8 → 270,8
if (currentDoc->m_Selection->count() != 0)
{
ScriXmlDoc *ss = new ScriXmlDoc();
QString buffer = ss->WriteElem(currentDoc, currentView, currentDoc->m_Selection);
ss->ReadElemToLayer(buffer, prefsManager->appPrefs.fontPrefs.AvailFonts, currentDoc, destination->xOffset(), destination->yOffset(), false, true, prefsManager->appPrefs.fontPrefs.GFontSub, currentView, it->ID);
QString buffer = ss->WriteElem(currentDoc, currentDoc->m_Selection);
ss->ReadElemToLayer(buffer, prefsManager->appPrefs.fontPrefs.AvailFonts, currentDoc, destination->xOffset(), destination->yOffset(), false, true, prefsManager->appPrefs.fontPrefs.GFontSub, it->ID);
currentDoc->m_Selection->clear();
delete ss;
}
/trunk/Scribus/scribus/scribus.cpp
4781,7 → 4781,7
if (prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook)
{
ScriXmlDoc ss;
QString buffer = ss.WriteElem(doc, view, doc->m_Selection);
QString buffer = ss.WriteElem(doc, doc->m_Selection);
scrapbookPalette->ObjFromCopyAction(buffer, currItem->itemName());
rebuildRecentPasteMenu();
}
4866,7 → 4866,7
if ((prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy))
{
ScriXmlDoc ss;
QString buffer = ss.WriteElem(doc, view, doc->m_Selection);
QString buffer = ss.WriteElem(doc, doc->m_Selection);
scrapbookPalette->ObjFromCopyAction(buffer, currItem->itemName());
rebuildRecentPasteMenu();
}
8110,7 → 8110,7
view->requestMode(submodeEndNodeEdit);
 
ScriXmlDoc ss;
if(ss.ReadElem(xml, prefsManager->appPrefs.fontPrefs.AvailFonts, docc, x, y, art, loca, prefsManager->appPrefs.fontPrefs.GFontSub, vie))
if(ss.ReadElem(xml, prefsManager->appPrefs.fontPrefs.AvailFonts, docc, x, y, art, loca, prefsManager->appPrefs.fontPrefs.GFontSub))
{
vie->DrawNew();
if (doc == docc)
8693,7 → 8693,7
void ScribusMainWindow::PutScrap()
{
ScriXmlDoc ss;
QString objectString = ss.WriteElem(doc, view, doc->m_Selection);
QString objectString = ss.WriteElem(doc, doc->m_Selection);
QDomDocument docu("scridoc");
docu.setContent(objectString);
QDomElement elem = docu.documentElement();
/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
552,7 → 552,7
/*int docGc = m_Doc->GroupCounter;
m_Doc->GroupCounter = 0;*/
uint last = m_Doc->Items->count();
m_View->PasteItem(&OB, true);
m_Doc->PasteItem(&OB);
/*m_Doc->GroupCounter = docGc;*/
Neu = m_Doc->Items->at(last);
Neu->OnMasterPage = PgNam;
1427,7 → 1427,7
IT=IT.nextSibling();
}
OB.itemText = "";
m_View->PasteItem(&OB, true);
m_Doc->PasteItem(&OB);
Neu = m_Doc->Items->at(counter);
IT=OBJ.firstChild();
LastStyles* last = new LastStyles();
/trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
379,7 → 379,7
tmpSel->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
m_Doc->itemSelection_DeleteItem(tmpSel);
m_Doc->view()->updatesOn(true);
/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
625,7 → 625,7
ScriXmlDoc *ss = new ScriXmlDoc();
tmpSel->setGroupRect();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
/*#ifndef Q_WS_MAC*/
// see #2526
/trunk/Scribus/scribus/plugins/import/ps/importps.cpp
323,7 → 323,7
tmpSel->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
/*#ifndef Q_WS_MAC*/
// see #2196
/trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
380,7 → 380,7
tmpSel->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
m_Doc->itemSelection_DeleteItem(tmpSel);
m_Doc->view()->updatesOn(true);
/trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
380,7 → 380,7
tmpSel->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
m_Doc->itemSelection_DeleteItem(tmpSel);
m_Doc->view()->updatesOn(true);
/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
521,7 → 521,7
tmpSel->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
/*#ifndef Q_WS_MAC*/
// see #2196
/trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
801,7 → 801,7
ScriXmlDoc *ss = new ScriXmlDoc();
m_tmpSel->setGroupRect();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), m_tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, m_tmpSel));
delete ss;
/*#ifndef QT_MAC*/
// see #2526
/trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
338,7 → 338,7
tmpSel->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
m_Doc->itemSelection_DeleteItem(tmpSel);
m_Doc->view()->updatesOn(true);
/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
734,7 → 734,7
//CB keep for reference conversion for now
//Q3DragObject *dr = new Q3TextDrag(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel), m_Doc->view()->viewport());
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
/*#ifndef Q_WS_MAC*/
// see #2196, #2526
/trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
394,7 → 394,7
tmpSel->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
m_Doc->itemSelection_DeleteItem(tmpSel);
m_Doc->view()->updatesOn(true);
583,7 → 583,7
{
recordCount++;
bool printMSG = false;
/* if ((recordCount > 15) && (recordCount < 17))
/* if ((recordCount > 29) && (recordCount < 33))
{
QFile f(QString("/home/franz/cmddatas%1.bin").arg(recordCount));
f.open(QIODevice::WriteOnly);
849,19 → 849,24
}
if (!found)
{
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(fontName))
if (importerFlags & LoadSavePlugin::lfCreateThumbnail)
fontName = PrefsManager::instance()->appPrefs.itemToolPrefs.textFont;
else
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
MissingFont *dia = new MissingFont(0, fontName, m_Doc);
dia->exec();
textFont = dia->getReplacementFont();
delete dia;
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName] = textFont;
fontName = textFont;
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(fontName))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
MissingFont *dia = new MissingFont(0, fontName, m_Doc);
dia->exec();
textFont = dia->getReplacementFont();
delete dia;
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName] = textFont;
fontName = textFont;
}
else
fontName = PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName];
}
else
fontName = PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName];
}
}
fontMap.insert(fontID, fontName);
907,6 → 912,7
pattern.resize(16);
ds.readRawData(pattern.data(), 16);
patternDataMap.insert(data8, pattern);
printMSG = true;
break;
case 29:
cmdText += "DRW Locked";
1849,6 → 1855,7
cmdText += "Unknown";
break;
}
printMSG = false;
if (printMSG)
{
if (currentItem != NULL)
/trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
788,7 → 788,7
tmpSel->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
m_Doc->itemSelection_DeleteItem(tmpSel);
m_Doc->view()->updatesOn(true);
/trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
515,7 → 515,7
tmpSel->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel));
md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
delete ss;
/*#ifndef Q_WS_MAC*/
// see #2196
/trunk/Scribus/scribus/canvasmode_normal.cpp
312,7 → 312,7
m_doc->DragElements.append(m_doc->m_Selection->itemAt(dre)->ItemNr);
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_doc, m_view, m_doc->m_Selection));
md->setScribusElem(ss->WriteElem(m_doc, m_doc->m_Selection));
delete ss;
ss = NULL;
QDrag* dr = new QDrag(m_view);