Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 2450 → Rev 2451

/branches/Version13x/Scribus/scribus/about.cpp
51,7 → 51,7
tabLayout1->addWidget( pixmapLabel1 );
buildID = new QLabel( tab, "BB" );
buildID->setAlignment(Qt::AlignCenter);
QString bu = tr("%1 %2 %3 ").arg("13").arg("June").arg("2005");
QString bu = tr("%1 %2 %3 ").arg("14").arg("June").arg("2005");
#ifdef HAVE_CMS
bu += "C";
#else
/branches/Version13x/Scribus/scribus/pageitem.cpp
520,7 → 520,10
hl->embedded->Ypos = Ypos + (hl->yco - (hl->embedded->Height * (hl->scalev / 1000.0)));
p->translate(hl->xco * p->zoomFactor(), (hl->yco - (hl->embedded->Height * (hl->scalev / 1000.0))) * p->zoomFactor());
if (hl->base != 0)
{
p->translate(0, -hl->embedded->Height * (hl->base / 1000.0) * p->zoomFactor());
hl->embedded->Ypos -= hl->embedded->Height * (hl->base / 1000.0);
}
double pws = hl->embedded->Pwidth;
hl->embedded->Pwidth *= QMIN(hl->scale / 1000.0, hl->scalev / 1000.0);
p->scale(hl->scale / 1000.0, hl->scalev / 1000.0);
797,7 → 800,7
Zli3.Style = hl->cstyle;
Zli3.ZFo = hl->cfont;
if ((hl->ch == QChar(25)) && (hl->cembedded != 0))
Zli3.wide = hl->cembedded->Width * (hl->cscale / 1000.0);
Zli3.wide = (hl->cembedded->Width + hl->cembedded->Pwidth) * (hl->cscale / 1000.0);
else
Zli3.wide = Cwidth(Doc, hl->cfont, chx, hl->csize) * (hl->cscale / 1000.0);
if (hl->cstyle & 16384)
1193,7 → 1196,7
else
{
if ((hl->ch == QChar(25)) && (hl->cembedded != 0))
chs = qRound(hl->cembedded->Height * 10);
chs = qRound((hl->cembedded->Height+ + hl->cembedded->Pwidth) * 10);
else
chs = hl->csize;
}
1205,7 → 1208,7
else
chx2 = chx;
if ((hl->ch == QChar(25)) && (hl->cembedded != 0))
wide = hl->cembedded->Width;
wide = hl->cembedded->Width + hl->cembedded->Pwidth;
else
{
if (a < MaxText-1)
1225,8 → 1228,8
{
if ((hl->ch == QChar(25)) && (hl->cembedded != 0))
{
wide = hl->cembedded->Width;
asce = hl->cembedded->Height;
wide = hl->cembedded->Width + hl->cembedded->Pwidth;
asce = hl->cembedded->Height + hl->cembedded->Pwidth;
}
else
{
1240,7 → 1243,7
{
if ((hl->ch == QChar(25)) && (hl->cembedded != 0))
{
asce = hl->cembedded->Height;
asce = hl->cembedded->Height + hl->cembedded->Pwidth;
desc2 = 0;
desc = 0;
}
1878,7 → 1881,7
if ((Zli2->Zeich == QChar(13)) || (Zli2->Zeich == QChar(28)))
currasce = Zli2->ZFo->numAscent * (Zli2->realSiz / 10.0);
else if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, Zli2->embedded->Height * (Zli2->scalev / 1000.0));
currasce = QMAX(currasce, (Zli2->embedded->Height + Zli2->embedded->Pwidth) * (Zli2->scalev / 1000.0));
else
currasce = RealCAscent(Doc, Zli2->ZFo, Zli2->Zeich, Zli2->realSiz);
for (uint zc = 0; zc < LiList.count(); ++zc)
1890,7 → 1893,7
|| (Zli2->Zeich == QChar(28)) || (Zli2->Zeich == QChar(29)))
continue;
if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, Zli2->embedded->Height * (Zli2->scalev / 1000.0));
currasce = QMAX(currasce, (Zli2->embedded->Height + Zli2->embedded->Pwidth) * (Zli2->scalev / 1000.0));
else
currasce = QMAX(currasce, RealCAscent(Doc, Zli2->ZFo, Zli2->Zeich, Zli2->realSiz));
}
1907,7 → 1910,7
double firstasce = Doc->docParagraphStyles[hl->cab].LineSpa;
double currasce;
if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, Zli2->embedded->Height * (Zli2->scalev / 1000.0));
currasce = QMAX(currasce, (Zli2->embedded->Height + Zli2->embedded->Pwidth) * (Zli2->scalev / 1000.0));
else
currasce = RealFHeight(Doc, Zli2->ZFo, Zli2->realSiz);
for (uint zc = 0; zc < LiList.count(); ++zc)
1919,7 → 1922,7
|| (Zli2->Zeich == QChar(28)) || (Zli2->Zeich == QChar(29)))
continue;
if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, Zli2->embedded->Height * (Zli2->scalev / 1000.0));
currasce = QMAX(currasce, (Zli2->embedded->Height + Zli2->embedded->Pwidth) * (Zli2->scalev / 1000.0));
else
currasce = QMAX(currasce, RealFHeight(Doc, Zli2->ZFo, Zli2->realSiz));
}
2159,7 → 2162,7
if ((Zli2->Zeich == QChar(13)) || (Zli2->Zeich == QChar(28)))
currasce = Zli2->ZFo->numAscent * (Zli2->realSiz / 10.0);
else if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, Zli2->embedded->Height * (Zli2->scalev / 1000.0));
currasce = QMAX(currasce, (Zli2->embedded->Height + Zli2->embedded->Pwidth) * (Zli2->scalev / 1000.0));
else
currasce = RealCAscent(Doc, Zli2->ZFo, Zli2->Zeich, Zli2->realSiz);
for (uint zc = 0; zc < LiList.count(); ++zc)
2171,7 → 2174,7
|| (Zli2->Zeich == QChar(28)) || (Zli2->Zeich == QChar(29)))
continue;
if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, Zli2->embedded->Height * (Zli2->scalev / 1000.0));
currasce = QMAX(currasce, (Zli2->embedded->Height + Zli2->embedded->Pwidth) * (Zli2->scalev / 1000.0));
else
currasce = QMAX(currasce, RealCAscent(Doc, Zli2->ZFo, Zli2->Zeich, Zli2->realSiz));
}
2188,7 → 2191,7
double firstasce = Doc->docParagraphStyles[hl->cab].LineSpa;
double currasce;
if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, Zli2->embedded->Height * (Zli2->scalev / 1000.0));
currasce = QMAX(currasce, (Zli2->embedded->Height + Zli2->embedded->Pwidth) * (Zli2->scalev / 1000.0));
else
currasce = RealFHeight(Doc, Zli2->ZFo, Zli2->realSiz);
for (uint zc = 0; zc < LiList.count(); ++zc)
2200,7 → 2203,7
|| (Zli2->Zeich == QChar(28)) || (Zli2->Zeich == QChar(29)))
continue;
if ((Zli2->Zeich == QChar(25)) && (Zli2->embedded != 0))
currasce = QMAX(currasce, Zli2->embedded->Height * (Zli2->scalev / 1000.0));
currasce = QMAX(currasce, (Zli2->embedded->Height + Zli2->embedded->Pwidth) * (Zli2->scalev / 1000.0));
else
currasce = QMAX(currasce, RealFHeight(Doc, Zli2->ZFo, Zli2->realSiz));
}
/branches/Version13x/Scribus/scribus/libpostscript/pslib.h
79,13 → 79,13
virtual void PS_UseTemplate(QString Name);
virtual void PS_ImageData(PageItem *c, QString fn, QString Name, QString Prof, bool UseEmbedded, bool UseProf);
virtual void CreatePS(ScribusDoc* Doc, ScribusView* view, std::vector<int> &pageNs, bool sep, QString SepNam, bool farb, bool Hm, bool Vm, bool Ic, bool gcr, bool doDev);
virtual void ProcessItem(ScribusDoc* Doc, Page* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master);
virtual void ProcessItem(ScribusDoc* Doc, Page* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master, bool embedded = false);
virtual void ProcessPage(ScribusDoc* Doc, ScribusView* view, Page* a, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
virtual void SetClipPath(FPointArray *c, bool poly = true);
virtual void HandleGradient(ScribusDoc* Doc, PageItem *c, double w, double h, bool gcr);
virtual void SetFarbe(ScribusDoc* Doc, QString farb, int shade, int *h, int *s, int *v, int *k, bool gcr);
virtual void setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a);
virtual void setTextCh(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, uint d, struct ScText *hl);
virtual void setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, Page* pg, bool sep, bool farb, bool ic, bool master);
virtual void setTextCh(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, uint d, struct ScText *hl, Page* pg, bool sep, bool farb, bool ic, bool master);
bool Art;
private:
void PutSeite(QString c);
/branches/Version13x/Scribus/scribus/libpostscript/pslib.cpp
1178,7 → 1178,7
PS_translate(0, -ite->Height);
PS_scale(1, -1);
}
setTextSt(Doc, ite, gcr, a);
setTextSt(Doc, ite, gcr, a, mPage, sep, farb, Ic, true);
if (((ite->lineColor() != "None") || (ite->NamedLStyle != "")) && (!ite->isTableItem))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
1285,7 → 1285,7
PS_close();
}
 
void PSLib::ProcessItem(ScribusDoc* Doc, Page* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master)
void PSLib::ProcessItem(ScribusDoc* Doc, Page* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master, bool embedded)
{
int h, s, v, k, tsz;
uint d;
1309,9 → 1309,12
PS_setlinewidth(c->Pwidth);
PS_setcapjoin(c->PLineEnd, c->PLineJoin);
PS_setdash(c->PLineArt, c->DashOffset, c->DashValues);
PS_translate(c->Xpos - a->Xoffset, Doc->pageHeight - (c->Ypos - a->Yoffset));
if (c->Rot != 0)
PS_rotate(-c->Rot);
if (!embedded)
{
PS_translate(c->Xpos - a->Xoffset, Doc->pageHeight - (c->Ypos - a->Yoffset));
if (c->Rot != 0)
PS_rotate(-c->Rot);
}
switch (c->itemType())
{
case PageItem::ImageFrame:
1428,7 → 1431,7
PS_translate(0, -c->Height);
PS_scale(1, -1);
}
setTextSt(Doc, c, gcr, PNr-1);
setTextSt(Doc, c, gcr, PNr-1, a, sep, farb, ic, master);
if (((c->lineColor() != "None") || (c->NamedLStyle != "")) && (!c->isTableItem))
{
SetFarbe(Doc, c->lineColor(), c->lineShade(), &h, &s, &v, &k, gcr);
1966,7 → 1969,7
*k = k1 * shade / 100;
}
 
void PSLib::setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a)
void PSLib::setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, Page* pg, bool sep, bool farb, bool ic, bool master)
{
struct ScText *hl;
double tabDist;
2044,9 → 2047,9
hl3.cunderwidth = hl2.cunderwidth;
hl3.cstrikepos = hl2.cstrikepos;
hl3.cstrikewidth = hl2.cstrikewidth;
setTextCh(Doc, ite, gcr, a, d, &hl3);
setTextCh(Doc, ite, gcr, a, d, &hl3, pg, sep, farb, ic, master);
}
setTextCh(Doc, ite, gcr, a, d, &hl2);
setTextCh(Doc, ite, gcr, a, d, &hl2, pg, sep, farb, ic, master);
}
tabCc++;
continue;
2081,14 → 2084,14
hl2.cunderwidth = hl->cunderwidth;
hl2.cstrikepos = hl->cstrikepos;
hl2.cstrikewidth = hl->cstrikewidth;
setTextCh(Doc, ite, gcr, a, d, &hl2);
setTextCh(Doc, ite, gcr, a, d, &hl2, pg, sep, farb, ic, master);
}
setTextCh(Doc, ite, gcr, a, d, hl);
setTextCh(Doc, ite, gcr, a, d, hl, pg, sep, farb, ic, master);
tabDist = hl->xp + Cwidth(Doc, hl->cfont, hl->ch, hl->csize) * (hl->cscale / 1000.0);
}
}
 
void PSLib::setTextCh(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, uint d, struct ScText *hl)
void PSLib::setTextCh(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, uint d, struct ScText *hl, Page* pg, bool sep, bool farb, bool ic, bool master)
{
QString chx;
int h, s, v, k, tsz;
2112,9 → 2115,20
}
}
}
/* just for being save for now, remove later */
if (hl->ch == QChar(25))
chx = " ";
if ((hl->ch == QChar(25)) && (hl->cembedded != 0))
{
PS_save();
PS_translate(hl->xp, (hl->yp - (hl->cembedded->Height * (hl->cscalev / 1000.0))) * -1);
if (hl->cbase != 0)
PS_translate(0, hl->cembedded->Height * (hl->cbase / 1000.0));
if (hl->cscale != 100)
PS_scale(hl->cscale / 1000.0, 1);
if (hl->cscalev != 100)
PS_scale(1, hl->cscalev / 1000.0);
ProcessItem(Doc, pg, hl->cembedded, a, sep, farb, ic, gcr, master, true);
PS_restore();
return;
}
if (hl->ch == QChar(29))
chx = " ";
if (hl->ch == QChar(24))
/branches/Version13x/Scribus/scribus/scribus.cpp
5755,6 → 5755,7
currItem2->isEmbedded = true;
currItem2->isAnnotation = false;
currItem2->isBookmark = false;
currItem2->Rot = 0.0;
currItem2->ItemNr = doc->FrameItems.count();
doc->FrameItems.append(doc->Items.take(doc->Items.count()-1));
if (doc->masterPageMode)
7329,6 → 7330,15
ite->NamedLStyle = dia->Replacement[ite->NamedLStyle];
}
}
for (uint d1 = 0; d1 < doc->FrameItems.count(); ++d1)
{
ite = doc->FrameItems.at(d1);
if (ite->NamedLStyle != "")
{
if (!doc->MLineStyles.contains(ite->NamedLStyle))
ite->NamedLStyle = dia->Replacement[ite->NamedLStyle];
}
}
propertiesPalette->SetLineFormats(doc);
view->DrawNew();
}
7604,6 → 7614,85
}
}
}
for (uint d=0; d<doc->FrameItems.count(); ++d)
{
ite = doc->FrameItems.at(d);
if (ite->itemType() == PageItem::TextFrame)
{
for (uint e=0; e<ite->itemText.count(); ++e)
{
int cabori = ite->itemText.at(e)->cab;
int cabneu = ers[cabori];
if (cabori > 4)
{
if (cabneu > 0)
{
if (ite->itemText.at(e)->cfont == (*doc->AllFonts)[doc->docParagraphStyles[cabori].Font])
ite->itemText.at(e)->cfont = (*doc->AllFonts)[dia->TempVorl[cabneu].Font];
if (ite->itemText.at(e)->csize == doc->docParagraphStyles[cabori].FontSize)
ite->itemText.at(e)->csize = dia->TempVorl[cabneu].FontSize;
if ((ite->itemText.at(e)->cstyle & 1919 ) == doc->docParagraphStyles[cabori].FontEffect)
{
ite->itemText.at(e)->cstyle &= ~1919;
ite->itemText.at(e)->cstyle |= dia->TempVorl[cabneu].FontEffect;
}
if (ite->itemText.at(e)->ccolor == doc->docParagraphStyles[cabori].FColor)
ite->itemText.at(e)->ccolor = dia->TempVorl[cabneu].FColor;
if (ite->itemText.at(e)->cshade == doc->docParagraphStyles[cabori].FShade)
ite->itemText.at(e)->cshade = dia->TempVorl[cabneu].FShade;
if (ite->itemText.at(e)->cstroke == doc->docParagraphStyles[cabori].SColor)
ite->itemText.at(e)->cstroke = dia->TempVorl[cabneu].SColor;
if (ite->itemText.at(e)->cshade2 == doc->docParagraphStyles[cabori].SShade)
ite->itemText.at(e)->cshade2 = dia->TempVorl[cabneu].SShade;
if (ite->itemText.at(e)->cshadowx == doc->docParagraphStyles[cabori].txtShadowX)
ite->itemText.at(e)->cshadowx = dia->TempVorl[cabneu].txtShadowX;
if (ite->itemText.at(e)->cshadowy == doc->docParagraphStyles[cabori].txtShadowY)
ite->itemText.at(e)->cshadowy = dia->TempVorl[cabneu].txtShadowY;
if (ite->itemText.at(e)->coutline == doc->docParagraphStyles[cabori].txtOutline)
ite->itemText.at(e)->coutline = dia->TempVorl[cabneu].txtOutline;
if (ite->itemText.at(e)->cunderpos == doc->docParagraphStyles[cabori].txtUnderPos)
ite->itemText.at(e)->cunderpos = dia->TempVorl[cabneu].txtUnderPos;
if (ite->itemText.at(e)->cunderwidth == doc->docParagraphStyles[cabori].txtUnderWidth)
ite->itemText.at(e)->cunderwidth = dia->TempVorl[cabneu].txtUnderWidth;
if (ite->itemText.at(e)->cstrikepos == doc->docParagraphStyles[cabori].txtStrikePos)
ite->itemText.at(e)->cstrikepos = dia->TempVorl[cabneu].txtStrikePos;
if (ite->itemText.at(e)->cstrikewidth == doc->docParagraphStyles[cabori].txtStrikeWidth)
ite->itemText.at(e)->cstrikewidth = dia->TempVorl[cabneu].txtStrikeWidth;
if (ite->itemText.at(e)->cscale == doc->docParagraphStyles[cabori].scaleH)
ite->itemText.at(e)->cscale = dia->TempVorl[cabneu].scaleH;
if (ite->itemText.at(e)->cscalev == doc->docParagraphStyles[cabori].scaleV)
ite->itemText.at(e)->cscalev = dia->TempVorl[cabneu].scaleV;
if (ite->itemText.at(e)->cbase == doc->docParagraphStyles[cabori].baseOff)
ite->itemText.at(e)->cbase = dia->TempVorl[cabneu].baseOff;
if (ite->itemText.at(e)->cextra == doc->docParagraphStyles[cabori].kernVal)
ite->itemText.at(e)->cextra = dia->TempVorl[cabneu].kernVal;
}
else
{
ite->itemText.at(e)->ccolor = ite->TxtFill;
ite->itemText.at(e)->cshade = ite->ShTxtFill;
ite->itemText.at(e)->cstroke = ite->TxtStroke;
ite->itemText.at(e)->cshade2 = ite->ShTxtStroke;
ite->itemText.at(e)->csize = ite->ISize;
ite->itemText.at(e)->cstyle &= ~1919;
ite->itemText.at(e)->cstyle |= ite->TxTStyle;
ite->itemText.at(e)->cshadowx = ite->TxtShadowX;
ite->itemText.at(e)->cshadowy = ite->TxtShadowY;
ite->itemText.at(e)->coutline = ite->TxtOutline;
ite->itemText.at(e)->cunderpos = ite->TxtUnderPos;
ite->itemText.at(e)->cunderwidth = ite->TxtUnderWidth;
ite->itemText.at(e)->cstrikepos = ite->TxtStrikePos;
ite->itemText.at(e)->cstrikewidth = ite->TxtStrikeWidth;
ite->itemText.at(e)->cscale = ite->TxtScale;
ite->itemText.at(e)->cscalev = ite->TxtScaleV;
ite->itemText.at(e)->cbase = ite->TxtBase;
ite->itemText.at(e)->cextra = ite->ExtraV;
}
ite->itemText.at(e)->cab = cabneu;
}
}
}
}
if (CurrStED != NULL)
{
if (CurrStED->Editor->StyledText.count() != 0)
7835,6 → 7924,37
}
for (it = ers.begin(); it != ers.end(); ++it)
{
for (c=0; c<doc->FrameItems.count(); ++c)
{
ite = doc->FrameItems.at(c);
if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText))
{
for (d=0; d<ite->itemText.count(); ++d)
{
if (it.key() == ite->itemText.at(d)->ccolor)
ite->itemText.at(d)->ccolor = it.data();
if (it.key() == ite->itemText.at(d)->cstroke)
ite->itemText.at(d)->cstroke = it.data();
}
}
if (it.key() == ite->fillColor())
ite->setFillColor(it.data());
if (it.key() == ite->lineColor())
ite->setLineColor(it.data());
QPtrVector<VColorStop> cstops = ite->fill_gradient.colorStops();
for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
{
if (it.key() == cstops.at(cst)->name)
{
ite->SetFarbe(&tmpc, it.data(), cstops.at(cst)->shade);
cstops.at(cst)->color = tmpc;
cstops.at(cst)->name = it.data();
}
}
}
}
for (it = ers.begin(); it != ers.end(); ++it)
{
for (c=0; c<doc->MasterItems.count(); ++c)
{
ite = doc->MasterItems.at(c);
10407,6 → 10527,18
}
}
}
for (uint d = 0; d < doc->FrameItems.count(); ++d)
{
it = doc->FrameItems.at(d);
Really.insert(it->IFont, doc->UsedFonts[it->IFont]);
if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
{
for (uint e = 0; e < it->itemText.count(); ++e)
{
Really.insert(it->itemText.at(e)->cfont->SCName, doc->UsedFonts[it->itemText.at(e)->cfont->SCName]);
}
}
}
QMap<QString,QFont>::Iterator itfo, itnext;
for (itfo = doc->UsedFonts.begin(); itfo != doc->UsedFonts.end(); itfo = itnext)
{
/branches/Version13x/Scribus/scribus/libpdf/pdflib.cpp
1113,7 → 1113,7
if ((ite->fillColor() != "None") || (ite->GrType != 0))
{
if (ite->GrType != 0)
PDF_Gradient(ite);
PutPage(PDF_Gradient(ite));
else
{
PutPage(SetClipPath(ite));
1131,7 → 1131,7
if (ite->imageFlippedV())
PutPage("1 0 0 -1 0 "+FToStr(-ite->Height)+" cm\n");
if ((ite->PicAvail) && (ite->Pfile != ""))
PDF_Image(ite, ite->Pfile, ite->LocalScX, ite->LocalScY, ite->LocalX, -ite->LocalY, false, ite->IProfile, ite->UseEmbedded, ite->IRender);
PutPage(PDF_Image(ite, ite->Pfile, ite->LocalScX, ite->LocalScY, ite->LocalX, -ite->LocalY, false, ite->IProfile, ite->UseEmbedded, ite->IRender));
PutPage("Q\n");
if (((ite->lineColor() != "None") || (ite->NamedLStyle != "")) && (!ite->isTableItem))
{
1228,7 → 1228,7
case PageItem::FrameType3:
case PageItem::Polygon:
if (ite->GrType != 0)
PDF_Gradient(ite);
PutPage(PDF_Gradient(ite));
else
{
if (ite->fillColor() != "None")
1260,7 → 1260,7
if ((ite->PoLine.size() > 3) && ((ite->PoLine.point(0) != ite->PoLine.point(1)) || (ite->PoLine.point(2) != ite->PoLine.point(3))))
{
if (ite->GrType != 0)
PDF_Gradient(ite);
PutPage(PDF_Gradient(ite));
else
{
if (ite->fillColor() != "None")
1389,7 → 1389,7
PutPage("Q\n");
}
}
PutPage(setTextSt(ite, pag->PageNr));
PutPage(setTextSt(ite, pag->PageNr, pag));
break;
}
PutPage("Q\n");
1707,7 → 1707,7
if ((ite->fillColor() != "None") || (ite->GrType != 0))
{
if (ite->GrType != 0)
PDF_Gradient(ite);
PutPage(PDF_Gradient(ite));
else
{
PutPage(SetClipPath(ite));
1719,7 → 1719,7
PutPage("-1 0 0 1 "+FToStr(ite->Width)+" 0 cm\n");
if (ite->imageFlippedV())
PutPage("1 0 0 -1 0 "+FToStr(-ite->Height)+" cm\n");
PutPage(setTextSt(ite, PNr));
PutPage(setTextSt(ite, PNr, pag));
PutPage("Q\n");
if (((ite->lineColor() != "None") || (ite->NamedLStyle != "")) && (!ite->isTableItem))
{
1874,447 → 1874,11
PutPage("/OC /"+OCGEntries[ll.Name].Name+" BDC\n");
for (uint a = 0; a < PItems.count(); ++a)
{
ite =PItems.at(a);
ite = PItems.at(a);
if (ite->LayerNr != ll.LNr)
continue;
int x = static_cast<int>(pag->Xoffset);
int y = static_cast<int>(pag->Yoffset);
int w = static_cast<int>(pag->Width);
int h1 = static_cast<int>(pag->Height);
int x2 = static_cast<int>(ite->BoundingX - ite->Pwidth / 2.0);
int y2 = static_cast<int>(ite->BoundingY - ite->Pwidth / 2.0);
int w2 = static_cast<int>(ite->BoundingW + ite->Pwidth);
int h2 = static_cast<int>(ite->BoundingH + ite->Pwidth);
if (!QRect(x, y, w, h1).intersects(QRect(x2, y2, w2, h2)))
continue;
if (ite->ChangedMasterItem)
continue;
if ((pag->PageNam != "") && (ite->OwnPage != static_cast<int>(pag->PageNr)) && (ite->OwnPage != -1))
continue;
PutPage("q\n");
if (((ite->fillTransparency() != 0) || (ite->lineTransparency() != 0)) && (Options->Version >= 14))
PDF_Transparenz(ite);
if ((ite->isBookmark) && (Options->Bookmarks))
PDF_Bookmark(ite->BMnr, pag->Height - (ite->Ypos - pag->Yoffset));
if (!ite->printable() || ((ite->itemType() == PageItem::TextFrame) && (pag->PageNam != "")))
{
PutPage("Q\n");
continue;
}
if (ite->fillColor() != "None")
PutPage(putColor(ite->fillColor(), ite->fillShade(), true));
if (ite->lineColor() != "None")
PutPage(putColor(ite->lineColor(), ite->lineShade(), false));
Inhalt += FToStr(fabs(ite->Pwidth))+" w\n";
if (ite->DashValues.count() != 0)
{
PutPage("[ ");
QValueList<double>::iterator it;
for ( it = ite->DashValues.begin(); it != ite->DashValues.end(); ++it )
{
int da = static_cast<int>(*it);
if (da != 0)
PutPage(IToStr(da)+" ");
}
PutPage("] "+IToStr(static_cast<int>(ite->DashOffset))+" d\n");
}
else
{
QString Dt = FToStr(QMAX(2*fabs(ite->Pwidth), 1));
QString Da = FToStr(QMAX(6*fabs(ite->Pwidth), 1));
switch (ite->PLineArt)
{
case Qt::SolidLine:
PutPage("[] 0 d\n");
break;
case Qt::DashLine:
PutPage("["+Da+" "+Dt+"] 0 d\n");
break;
case Qt::DotLine:
PutPage("["+Dt+"] 0 d\n");
break;
case Qt::DashDotLine:
PutPage("["+Da+" "+Dt+" "+Dt+" "+Dt+"] 0 d\n");
break;
case Qt::DashDotDotLine:
PutPage("["+Da+" "+Dt+" "+Dt+" "+Dt+" "+Dt+" "+Dt+"] 0 d\n");
break;
default:
PutPage("[] 0 d\n");
break;
}
}
switch (ite->PLineEnd)
{
case Qt::FlatCap:
PutPage("0 J\n");
break;
case Qt::SquareCap:
PutPage("2 J\n");
break;
case Qt::RoundCap:
PutPage("1 J\n");
break;
default:
PutPage("0 J\n");
break;
}
switch (ite->PLineJoin)
{
case Qt::MiterJoin:
PutPage("0 j\n");
break;
case Qt::BevelJoin:
PutPage("2 j\n");
break;
case Qt::RoundJoin:
PutPage("1 j\n");
break;
default:
PutPage("0 j\n");
break;
}
PutPage("1 0 0 1 "+FToStr(ite->Xpos - pag->Xoffset)+" "+FToStr(doc->pageHeight - (ite->Ypos - pag->Yoffset))+" cm\n");
if (ite->Rot != 0)
{
double sr = sin(-ite->Rot* M_PI / 180.0);
double cr = cos(-ite->Rot* M_PI / 180.0);
if ((cr * cr) < 0.000001)
cr = 0;
if ((sr * sr) < 0.000001)
sr = 0;
PutPage(FToStr(cr)+" "+FToStr(sr)+" "+FToStr(-sr)+" "+FToStr(cr)+" 0 0 cm\n");
}
switch (ite->itemType())
{
case PageItem::ImageFrame:
if ((ite->fillColor() != "None") || (ite->GrType != 0))
{
if (ite->GrType != 0)
PDF_Gradient(ite);
else
{
PutPage(SetClipPath(ite));
PutPage("h\nf*\n");
}
}
PutPage("q\n");
if (ite->imageClip.size() != 0)
PutPage(SetClipPathImage(ite));
else
PutPage(SetClipPath(ite));
PutPage("h\nW*\nn\n");
if (ite->imageFlippedH())
PutPage("-1 0 0 1 "+FToStr(ite->Width)+" 0 cm\n");
if (ite->imageFlippedV())
PutPage("1 0 0 -1 0 "+FToStr(-ite->Height)+" cm\n");
if ((ite->PicAvail) && (ite->Pfile != ""))
PDF_Image(ite, ite->Pfile, ite->LocalScX,
ite->LocalScY, ite->LocalX, -ite->LocalY,
false, ite->IProfile, ite->UseEmbedded,
ite->IRender);
PutPage("Q\n");
if (((ite->lineColor() != "None") || (ite->NamedLStyle != "")) && (!ite->isTableItem))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
PutPage(SetClipPath(ite));
PutPage("h\nS\n");
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
PutPage(setStrokeMulti(&ml[it]));
PutPage(SetClipPath(ite));
PutPage("h\nS\n");
}
}
}
break;
case PageItem::TextFrame:
if ((ite->isAnnotation) && (Options->Version != 12))
{
PDF_Annotation(ite, PNr);
break;
}
if ((ite->fillColor() != "None") || (ite->GrType != 0))
{
if (ite->GrType != 0)
PDF_Gradient(ite);
else
{
PutPage(SetClipPath(ite));
PutPage("h\nf*\n");
}
}
PutPage("q\n");
if (ite->imageFlippedH())
PutPage("-1 0 0 1 "+FToStr(ite->Width)+" 0 cm\n");
if (ite->imageFlippedV())
PutPage("1 0 0 -1 0 "+FToStr(-ite->Height)+" cm\n");
PutPage(setTextSt(ite, PNr));
PutPage("Q\n");
if (((ite->lineColor() != "None") || (ite->NamedLStyle != "")) && (!ite->isTableItem))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
PutPage(SetClipPath(ite));
PutPage("h\nS\n");
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
PutPage(setStrokeMulti(&ml[it]));
PutPage(SetClipPath(ite));
PutPage("h\nS\n");
}
}
}
break;
case PageItem::Line:
if (ite->NamedLStyle == "")
{
PutPage("0 0 m\n");
PutPage(FToStr(ite->Width)+" 0 l\n");
PutPage("S\n");
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
PutPage(setStrokeMulti(&ml[it]));
PutPage("0 0 m\n");
PutPage(FToStr(ite->Width)+" 0 l\n");
PutPage("S\n");
}
}
if (ite->startArrowIndex != 0)
{
QWMatrix arrowTrans;
FPointArray arrow = (*doc->arrowStyles.at(ite->startArrowIndex-1)).points.copy();
arrowTrans.translate(0, 0);
arrowTrans.scale(ite->Pwidth, ite->Pwidth);
arrowTrans.scale(-1,1);
arrow.map(arrowTrans);
if ((ite->lineTransparency() != 0) && (Options->Version >= 14))
{
StartObj(ObjCounter);
QString ShName = ResNam+IToStr(ResCount);
Transpar[ShName] = ObjCounter;
ResCount++;
ObjCounter++;
PutDoc("<< /Type /ExtGState\n");
PutDoc("/CA "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/ca "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/SMask /None\n/AIS false\n/OPM 1\n");
PutDoc("/BM /Normal\n>>\nendobj\n");
PutPage("/"+ShName+" gs\n");
}
PutPage(putColor(ite->lineColor(), ite->lineShade(), false));
PutPage(SetClipPathArray(&arrow));
PutPage("h\nf*\n");
}
if (ite->endArrowIndex != 0)
{
QWMatrix arrowTrans;
FPointArray arrow = (*doc->arrowStyles.at(ite->endArrowIndex-1)).points.copy();
arrowTrans.translate(ite->Width, 0);
arrowTrans.scale(ite->Pwidth, ite->Pwidth);
arrow.map(arrowTrans);
if ((ite->lineTransparency() != 0) && (Options->Version >= 14))
{
StartObj(ObjCounter);
QString ShName = ResNam+IToStr(ResCount);
Transpar[ShName] = ObjCounter;
ResCount++;
ObjCounter++;
PutDoc("<< /Type /ExtGState\n");
PutDoc("/CA "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/ca "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/SMask /None\n/AIS false\n/OPM 1\n");
PutDoc("/BM /Normal\n>>\nendobj\n");
PutPage("/"+ShName+" gs\n");
}
PutPage(putColor(ite->lineColor(), ite->lineShade(), false));
PutPage(SetClipPathArray(&arrow));
PutPage("h\nf*\n");
}
break;
case PageItem::FrameType1:
case PageItem::FrameType3:
case PageItem::Polygon:
if (ite->GrType != 0)
PDF_Gradient(ite);
else
{
if (ite->fillColor() != "None")
{
PutPage(SetClipPath(ite));
PutPage("h\nf*\n");
}
}
if ((ite->lineColor() != "None") || (ite->NamedLStyle != ""))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
PutPage(SetClipPath(ite));
PutPage("h\nS\n");
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
PutPage(setStrokeMulti(&ml[it]));
PutPage(SetClipPath(ite));
PutPage("h\nS\n");
}
}
}
break;
case PageItem::PolyLine:
if (ite->PoLine.size() > 4) // && ((ite->PoLine.point(0) != ite->PoLine.point(1)) || (ite->PoLine.point(2) != ite->PoLine.point(3))))
{
if (ite->GrType != 0)
PDF_Gradient(ite);
else
{
if (ite->fillColor() != "None")
{
PutPage(SetClipPath(ite));
PutPage("h\nf*\n");
}
}
}
if ((ite->lineColor() != "None") || (ite->NamedLStyle != ""))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
PutPage(SetClipPath(ite, false));
PutPage("S\n");
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
PutPage(setStrokeMulti(&ml[it]));
PutPage(SetClipPath(ite, false));
PutPage("S\n");
}
}
}
if (ite->startArrowIndex != 0)
{
FPoint Start = ite->PoLine.point(0);
for (uint xx = 1; xx < ite->PoLine.size(); xx += 2)
{
FPoint Vector = ite->PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
QWMatrix arrowTrans;
FPointArray arrow = (*doc->arrowStyles.at(ite->startArrowIndex-1)).points.copy();
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(r);
arrowTrans.scale(ite->Pwidth, ite->Pwidth);
arrow.map(arrowTrans);
if ((ite->lineTransparency() != 0) && (Options->Version >= 14))
{
StartObj(ObjCounter);
QString ShName = ResNam+IToStr(ResCount);
Transpar[ShName] = ObjCounter;
ResCount++;
ObjCounter++;
PutDoc("<< /Type /ExtGState\n");
PutDoc("/CA "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/ca "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/SMask /None\n/AIS false\n/OPM 1\n");
PutDoc("/BM /Normal\n>>\nendobj\n");
PutPage("/"+ShName+" gs\n");
}
PutPage(putColor(ite->lineColor(), ite->lineShade(), false));
PutPage(SetClipPathArray(&arrow));
PutPage("h\nf*\n");
break;
}
}
}
if (ite->endArrowIndex != 0)
{
FPoint End = ite->PoLine.point(ite->PoLine.size()-2);
for (uint xx = ite->PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = ite->PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
QWMatrix arrowTrans;
FPointArray arrow = (*doc->arrowStyles.at(ite->endArrowIndex-1)).points.copy();
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(r);
arrowTrans.scale(ite->Pwidth, ite->Pwidth);
arrow.map(arrowTrans);
if ((ite->lineTransparency() != 0) && (Options->Version >= 14))
{
StartObj(ObjCounter);
QString ShName = ResNam+IToStr(ResCount);
Transpar[ShName] = ObjCounter;
ResCount++;
ObjCounter++;
PutDoc("<< /Type /ExtGState\n");
PutDoc("/CA "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/ca "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/SMask /None\n/AIS false\n/OPM 1\n");
PutDoc("/BM /Normal\n>>\nendobj\n");
PutPage("/"+ShName+" gs\n");
}
PutPage(putColor(ite->lineColor(), ite->lineShade(), false));
PutPage(SetClipPathArray(&arrow));
PutPage("h\nf*\n");
break;
}
}
}
break;
case PageItem::PathText:
if (ite->PoShow)
{
if (ite->PoLine.size() > 3)
{
PutPage("q\n");
if ((ite->lineColor() != "None") || (ite->NamedLStyle != ""))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
PutPage(SetClipPath(ite, false));
PutPage("S\n");
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1;
it > -1; it--)
{
PutPage(setStrokeMulti(&ml[it]));
PutPage(SetClipPath(ite, false));
PutPage("S\n");
}
}
}
PutPage("Q\n");
}
}
PutPage(setTextSt(ite, PNr));
break;
}
PutPage("Q\n");
}
PutPage(PDF_ProcessItem(ite, pag, PNr));
}
for (uint a = 0; a < PItems.count(); ++a)
{
ite = PItems.at(a);
2450,6 → 2014,449
}
}
 
QString PDFlib::PDF_ProcessItem(PageItem* ite, Page* pag, uint PNr, bool embedded)
{
QString tmp = "";
int x = static_cast<int>(pag->Xoffset);
int y = static_cast<int>(pag->Yoffset);
int w = static_cast<int>(pag->Width);
int h1 = static_cast<int>(pag->Height);
int x2 = static_cast<int>(ite->BoundingX - ite->Pwidth / 2.0);
int y2 = static_cast<int>(ite->BoundingY - ite->Pwidth / 2.0);
int w2 = static_cast<int>(ite->BoundingW + ite->Pwidth);
int h2 = static_cast<int>(ite->BoundingH + ite->Pwidth);
if (!QRect(x, y, w, h1).intersects(QRect(x2, y2, w2, h2)))
return tmp;
if (ite->ChangedMasterItem)
return tmp;
if ((pag->PageNam != "") && (ite->OwnPage != static_cast<int>(pag->PageNr)) && (ite->OwnPage != -1))
return tmp;
PutPage("q\n");
if (((ite->fillTransparency() != 0) || (ite->lineTransparency() != 0)) && (Options->Version >= 14))
PDF_Transparenz(ite);
if ((ite->isBookmark) && (Options->Bookmarks))
PDF_Bookmark(ite->BMnr, pag->Height - (ite->Ypos - pag->Yoffset));
if (!ite->printable() || ((ite->itemType() == PageItem::TextFrame) && (pag->PageNam != "")))
{
tmp += "Q\n";
return tmp;
}
if (ite->fillColor() != "None")
tmp += putColor(ite->fillColor(), ite->fillShade(), true);
if (ite->lineColor() != "None")
tmp += putColor(ite->lineColor(), ite->lineShade(), false);
tmp += FToStr(fabs(ite->Pwidth))+" w\n";
if (ite->DashValues.count() != 0)
{
PutPage("[ ");
QValueList<double>::iterator it;
for ( it = ite->DashValues.begin(); it != ite->DashValues.end(); ++it )
{
int da = static_cast<int>(*it);
if (da != 0)
tmp += IToStr(da)+" ";
}
tmp += "] "+IToStr(static_cast<int>(ite->DashOffset))+" d\n";
}
else
{
QString Dt = FToStr(QMAX(2*fabs(ite->Pwidth), 1));
QString Da = FToStr(QMAX(6*fabs(ite->Pwidth), 1));
switch (ite->PLineArt)
{
case Qt::SolidLine:
tmp += "[] 0 d\n";
break;
case Qt::DashLine:
tmp += "["+Da+" "+Dt+"] 0 d\n";
break;
case Qt::DotLine:
tmp += "["+Dt+"] 0 d\n";
break;
case Qt::DashDotLine:
tmp += "["+Da+" "+Dt+" "+Dt+" "+Dt+"] 0 d\n";
break;
case Qt::DashDotDotLine:
tmp += "["+Da+" "+Dt+" "+Dt+" "+Dt+" "+Dt+" "+Dt+"] 0 d\n";
break;
default:
tmp += "[] 0 d\n";
break;
}
}
switch (ite->PLineEnd)
{
case Qt::FlatCap:
tmp += "0 J\n";
break;
case Qt::SquareCap:
tmp += "2 J\n";
break;
case Qt::RoundCap:
tmp += "1 J\n";
break;
default:
tmp += "0 J\n";
break;
}
switch (ite->PLineJoin)
{
case Qt::MiterJoin:
tmp += "0 j\n";
break;
case Qt::BevelJoin:
tmp += "2 j\n";
break;
case Qt::RoundJoin:
tmp += "1 j\n";
break;
default:
tmp += "0 j\n";
break;
}
if (!embedded)
{
tmp += "1 0 0 1 "+FToStr(ite->Xpos - pag->Xoffset)+" "+FToStr(doc->pageHeight - (ite->Ypos - pag->Yoffset))+" cm\n";
if (ite->Rot != 0)
{
double sr = sin(-ite->Rot* M_PI / 180.0);
double cr = cos(-ite->Rot* M_PI / 180.0);
if ((cr * cr) < 0.000001)
cr = 0;
if ((sr * sr) < 0.000001)
sr = 0;
tmp += FToStr(cr)+" "+FToStr(sr)+" "+FToStr(-sr)+" "+FToStr(cr)+" 0 0 cm\n";
}
}
switch (ite->itemType())
{
case PageItem::ImageFrame:
if ((ite->fillColor() != "None") || (ite->GrType != 0))
{
if (ite->GrType != 0)
tmp += PDF_Gradient(ite);
else
{
tmp += SetClipPath(ite);
tmp += "h\nf*\n";
}
}
tmp += "q\n";
if (ite->imageClip.size() != 0)
tmp += SetClipPathImage(ite);
else
tmp += SetClipPath(ite);
tmp += "h\nW*\nn\n";
if (ite->imageFlippedH())
tmp += "-1 0 0 1 "+FToStr(ite->Width)+" 0 cm\n";
if (ite->imageFlippedV())
tmp += "1 0 0 -1 0 "+FToStr(-ite->Height)+" cm\n";
if ((ite->PicAvail) && (ite->Pfile != ""))
tmp += PDF_Image(ite, ite->Pfile, ite->LocalScX, ite->LocalScY, ite->LocalX, -ite->LocalY, false, ite->IProfile, ite->UseEmbedded, ite->IRender);
tmp += "Q\n";
if (((ite->lineColor() != "None") || (ite->NamedLStyle != "")) && (!ite->isTableItem))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
tmp += SetClipPath(ite);
tmp += "h\nS\n";
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
tmp += setStrokeMulti(&ml[it]);
tmp += SetClipPath(ite);
tmp += "h\nS\n";
}
}
}
break;
case PageItem::TextFrame:
if ((ite->isAnnotation) && (Options->Version != 12))
{
PDF_Annotation(ite, PNr);
break;
}
if ((ite->fillColor() != "None") || (ite->GrType != 0))
{
if (ite->GrType != 0)
tmp += PDF_Gradient(ite);
else
{
tmp += SetClipPath(ite);
tmp += "h\nf*\n";
}
}
tmp += "q\n";
if (ite->imageFlippedH())
tmp += "-1 0 0 1 "+FToStr(ite->Width)+" 0 cm\n";
if (ite->imageFlippedV())
tmp += "1 0 0 -1 0 "+FToStr(-ite->Height)+" cm\n";
tmp += setTextSt(ite, PNr, pag);
tmp += "Q\n";
if (((ite->lineColor() != "None") || (ite->NamedLStyle != "")) && (!ite->isTableItem))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
tmp += SetClipPath(ite);
tmp += "h\nS\n";
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
tmp += setStrokeMulti(&ml[it]);
tmp += SetClipPath(ite);
tmp += "h\nS\n";
}
}
}
break;
case PageItem::Line:
if (ite->NamedLStyle == "")
{
tmp += "0 0 m\n";
tmp += FToStr(ite->Width)+" 0 l\n";
tmp += "S\n";
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
tmp += setStrokeMulti(&ml[it]);
tmp += "0 0 m\n";
tmp += FToStr(ite->Width)+" 0 l\n";
tmp += "S\n";
}
}
if (ite->startArrowIndex != 0)
{
QWMatrix arrowTrans;
FPointArray arrow = (*doc->arrowStyles.at(ite->startArrowIndex-1)).points.copy();
arrowTrans.translate(0, 0);
arrowTrans.scale(ite->Pwidth, ite->Pwidth);
arrowTrans.scale(-1,1);
arrow.map(arrowTrans);
if ((ite->lineTransparency() != 0) && (Options->Version >= 14))
{
StartObj(ObjCounter);
QString ShName = ResNam+IToStr(ResCount);
Transpar[ShName] = ObjCounter;
ResCount++;
ObjCounter++;
PutDoc("<< /Type /ExtGState\n");
PutDoc("/CA "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/ca "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/SMask /None\n/AIS false\n/OPM 1\n");
PutDoc("/BM /Normal\n>>\nendobj\n");
tmp += "/"+ShName+" gs\n";
}
tmp += putColor(ite->lineColor(), ite->lineShade(), false);
tmp += SetClipPathArray(&arrow);
tmp += "h\nf*\n";
}
if (ite->endArrowIndex != 0)
{
QWMatrix arrowTrans;
FPointArray arrow = (*doc->arrowStyles.at(ite->endArrowIndex-1)).points.copy();
arrowTrans.translate(ite->Width, 0);
arrowTrans.scale(ite->Pwidth, ite->Pwidth);
arrow.map(arrowTrans);
if ((ite->lineTransparency() != 0) && (Options->Version >= 14))
{
StartObj(ObjCounter);
QString ShName = ResNam+IToStr(ResCount);
Transpar[ShName] = ObjCounter;
ResCount++;
ObjCounter++;
PutDoc("<< /Type /ExtGState\n");
PutDoc("/CA "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/ca "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/SMask /None\n/AIS false\n/OPM 1\n");
PutDoc("/BM /Normal\n>>\nendobj\n");
tmp += "/"+ShName+" gs\n";
}
tmp += putColor(ite->lineColor(), ite->lineShade(), false);
tmp += SetClipPathArray(&arrow);
tmp += "h\nf*\n";
}
break;
case PageItem::FrameType1:
case PageItem::FrameType3:
case PageItem::Polygon:
if (ite->GrType != 0)
tmp += PDF_Gradient(ite);
else
{
if (ite->fillColor() != "None")
{
tmp += SetClipPath(ite);
tmp += "h\nf*\n";
}
}
if ((ite->lineColor() != "None") || (ite->NamedLStyle != ""))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
tmp += SetClipPath(ite);
tmp += "h\nS\n";
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
tmp += setStrokeMulti(&ml[it]);
tmp += SetClipPath(ite);
tmp += "h\nS\n";
}
}
}
break;
case PageItem::PolyLine:
if (ite->PoLine.size() > 4) // && ((ite->PoLine.point(0) != ite->PoLine.point(1)) || (ite->PoLine.point(2) != ite->PoLine.point(3))))
{
if (ite->GrType != 0)
tmp += PDF_Gradient(ite);
else
{
if (ite->fillColor() != "None")
{
tmp += SetClipPath(ite);
tmp += "h\nf*\n";
}
}
}
if ((ite->lineColor() != "None") || (ite->NamedLStyle != ""))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
tmp += SetClipPath(ite, false);
tmp += "S\n";
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1; it > -1; it--)
{
tmp += setStrokeMulti(&ml[it]);
tmp += SetClipPath(ite, false);
tmp += "S\n";
}
}
}
if (ite->startArrowIndex != 0)
{
FPoint Start = ite->PoLine.point(0);
for (uint xx = 1; xx < ite->PoLine.size(); xx += 2)
{
FPoint Vector = ite->PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
QWMatrix arrowTrans;
FPointArray arrow = (*doc->arrowStyles.at(ite->startArrowIndex-1)).points.copy();
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(r);
arrowTrans.scale(ite->Pwidth, ite->Pwidth);
arrow.map(arrowTrans);
if ((ite->lineTransparency() != 0) && (Options->Version >= 14))
{
StartObj(ObjCounter);
QString ShName = ResNam+IToStr(ResCount);
Transpar[ShName] = ObjCounter;
ResCount++;
ObjCounter++;
PutDoc("<< /Type /ExtGState\n");
PutDoc("/CA "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/ca "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/SMask /None\n/AIS false\n/OPM 1\n");
PutDoc("/BM /Normal\n>>\nendobj\n");
tmp += "/"+ShName+" gs\n";
}
tmp += putColor(ite->lineColor(), ite->lineShade(), false);
tmp += SetClipPathArray(&arrow);
tmp += "h\nf*\n";
break;
}
}
}
if (ite->endArrowIndex != 0)
{
FPoint End = ite->PoLine.point(ite->PoLine.size()-2);
for (uint xx = ite->PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = ite->PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
QWMatrix arrowTrans;
FPointArray arrow = (*doc->arrowStyles.at(ite->endArrowIndex-1)).points.copy();
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(r);
arrowTrans.scale(ite->Pwidth, ite->Pwidth);
arrow.map(arrowTrans);
if ((ite->lineTransparency() != 0) && (Options->Version >= 14))
{
StartObj(ObjCounter);
QString ShName = ResNam+IToStr(ResCount);
Transpar[ShName] = ObjCounter;
ResCount++;
ObjCounter++;
PutDoc("<< /Type /ExtGState\n");
PutDoc("/CA "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/ca "+FToStr(1.0 - ite->lineTransparency())+"\n");
PutDoc("/SMask /None\n/AIS false\n/OPM 1\n");
PutDoc("/BM /Normal\n>>\nendobj\n");
PutPage("/"+ShName+" gs\n");
}
tmp += putColor(ite->lineColor(), ite->lineShade(), false);
tmp += SetClipPathArray(&arrow);
tmp += "h\nf*\n";
break;
}
}
}
break;
case PageItem::PathText:
if (ite->PoShow)
{
if (ite->PoLine.size() > 3)
{
tmp += "q\n";
if ((ite->lineColor() != "None") || (ite->NamedLStyle != ""))
{
if ((ite->NamedLStyle == "") && (ite->Pwidth != 0.0))
{
tmp += SetClipPath(ite, false);
tmp += "S\n";
}
else
{
multiLine ml = doc->MLineStyles[ite->NamedLStyle];
for (int it = ml.size()-1;
it > -1; it--)
{
tmp += setStrokeMulti(&ml[it]);
tmp += SetClipPath(ite, false);
tmp += "S\n";
}
}
}
tmp += "Q\n";
}
}
tmp += setTextSt(ite, PNr, pag);
break;
}
tmp += "Q\n";
return tmp;
}
 
QString PDFlib::putColor(QString color, int shade, bool fill)
{
QString tmp = "";
2574,7 → 2581,7
return tmp;
}
 
QString PDFlib::setTextSt(PageItem *ite, uint PNr)
QString PDFlib::setTextSt(PageItem *ite, uint PNr, Page* pag)
{
struct ScText *hl;
QString tmp = "";
2657,9 → 2664,9
hl3.cunderwidth = hl2.cunderwidth;
hl3.cstrikepos = hl2.cstrikepos;
hl3.cstrikewidth = hl2.cstrikewidth;
setTextCh(ite, PNr, d, tmp, tmp2, &hl3);
setTextCh(ite, PNr, d, tmp, tmp2, &hl3, pag);
}
setTextCh(ite, PNr, d, tmp, tmp2, &hl2);
setTextCh(ite, PNr, d, tmp, tmp2, &hl2, pag);
}
tabCc++;
continue;
2694,9 → 2701,9
hl2.cunderwidth = hl->cunderwidth;
hl2.cstrikepos = hl->cstrikepos;
hl2.cstrikewidth = hl->cstrikewidth;
setTextCh(ite, PNr, d, tmp, tmp2, &hl2);
setTextCh(ite, PNr, d, tmp, tmp2, &hl2, pag);
}
setTextCh(ite, PNr, d, tmp, tmp2, hl);
setTextCh(ite, PNr, d, tmp, tmp2, hl, pag);
tabDist = hl->xp + Cwidth(doc, hl->cfont, hl->ch, hl->csize) * (hl->cscale / 1000.0);
}
if (ite->itemType() == PageItem::TextFrame)
2704,7 → 2711,7
return tmp;
}
 
void PDFlib::setTextCh(PageItem *ite, uint PNr, uint d, QString &tmp, QString &tmp2, struct ScText *hl)
void PDFlib::setTextCh(PageItem *ite, uint PNr, uint d, QString &tmp, QString &tmp2, struct ScText *hl, Page* pag)
{
QString FillColor = "";
QString StrokeColor = "";
2735,9 → 2742,14
}
}
}
/* just for being save for now, remove later */
if (hl->ch == QChar(25))
chx = " ";
if ((hl->ch == QChar(25)) && (hl->cembedded != 0))
{
tmp2 += "q\n";
tmp2 += FToStr(hl->cscale / 1000.0)+" 0 0 "+FToStr(hl->cscalev / 1000.0)+" "+FToStr(hl->xp)+" "+FToStr(-hl->yp + (hl->cembedded->Height * (hl->cscalev / 1000.0))+hl->cembedded->Height * (hl->cbase / 1000.0))+" cm\n";
tmp2 += PDF_ProcessItem(hl->cembedded, pag, PNr, true);
tmp2 += "Q\n";
return;
}
if (hl->ch == QChar(29))
chx = " ";
if (hl->ch == QChar(24))
3225,7 → 3237,7
PutPage("/"+ShName+" gs\n");
}
 
void PDFlib::PDF_Gradient(PageItem *currItem)
QString PDFlib::PDF_Gradient(PageItem *currItem)
{
double w = currItem->Width;
double h = -currItem->Height;
3315,11 → 3327,12
Gcolors.append(SetFarbe(cstops.at(cst)->name, cstops.at(cst)->shade));
}
}
PDF_DoLinGradient(currItem, StopVec, TransVec, Gcolors);
return PDF_DoLinGradient(currItem, StopVec, TransVec, Gcolors);
}
 
void PDFlib::PDF_DoLinGradient(PageItem *currItem, QValueList<double> Stops, QValueList<double> Trans, QStringList Colors)
QString PDFlib::PDF_DoLinGradient(PageItem *currItem, QValueList<double> Stops, QValueList<double> Trans, QStringList Colors)
{
QString tmp = "";
bool first = true;
double w = currItem->Width;
double h = -currItem->Height;
3469,13 → 3482,14
PutDoc("/C1 ["+Colors[c+1]+"]\n");
}
PutDoc("/N 1\n>>\n>>\nendobj\n");
PutPage("q\n");
tmp += "q\n";
if ((Options->Version == 14) && (((*Trans.at(c+1)) != 1) || ((*Trans.at(c)) != 1)))
PutPage("/"+TRes+" gs\n");
PutPage(SetClipPath(currItem));
PutPage("h\nW* n\n");
PutPage("/"+ShName+" sh\nQ\n");
tmp += "/"+TRes+" gs\n";
tmp += SetClipPath(currItem);
tmp += "h\nW* n\n";
tmp += "/"+ShName+" sh\nQ\n";
}
return tmp;
}
 
void PDFlib::PDF_Annotation(PageItem *ite, uint)
4027,7 → 4041,7
BookMinUse = true;
}
 
void PDFlib::PDF_Image(PageItem* c, QString fn, double sx, double sy, double x, double y, bool fromAN, QString Profil, bool Embedded, int Intent)
QString PDFlib::PDF_Image(PageItem* c, QString fn, double sx, double sy, double x, double y, bool fromAN, QString Profil, bool Embedded, int Intent)
{
QFileInfo fi = QFileInfo(fn);
QString ext = fi.extension(false).lower();
4504,10 → 4518,9
}
}
if (!fromAN)
{
Inhalt += FToStr(ImWid*sxn)+" 0 0 "+FToStr(ImHei*syn)+" "+FToStr(x*sx)+" "+FToStr((-ImHei*syn+y*sy))+" cm\n";
Inhalt += "/"+ResNam+IToStr(ImRes)+" Do\n";
}
return FToStr(ImWid*sxn)+" 0 0 "+FToStr(ImHei*syn)+" "+FToStr(x*sx)+" "+FToStr((-ImHei*syn+y*sy))+" cm\n/"+ResNam+IToStr(ImRes)+" Do\n";
else
return "";
}
 
void PDFlib::PDF_End_Doc(QString PrintPr, QString Name, int Components)
/branches/Version13x/Scribus/scribus/libpdf/pdflib.h
69,8 → 69,9
QString SetClipPath(PageItem *ite, bool poly = true);
QString SetFarbe(QString farbe, int Shade);
QString putColor(QString color, int Shade, bool fill);
QString setTextSt(PageItem *ite, uint PNr);
void setTextCh(PageItem *ite, uint PNr, uint d, QString &tmp, QString &tmp2, struct ScText *hl);
QString PDF_ProcessItem(PageItem* ite, Page* pag, uint PNr, bool embedded = false);
QString setTextSt(PageItem *ite, uint PNr, Page* pag);
void setTextCh(PageItem *ite, uint PNr, uint d, QString &tmp, QString &tmp2, struct ScText *hl, Page* pag);
void PutDoc(QString in);
void PutPage(QString in);
void StartObj(int nr);
78,13 → 79,13
QString PDFEncode(QString in);
QByteArray ComputeMD5(QString in);
void PDF_Bookmark(int nr, double ypos);
void PDF_Gradient(PageItem *currItem);
void PDF_DoLinGradient(PageItem *currItem, QValueList<double> Stops, QValueList<double> Trans, QStringList Colors);
QString PDF_Gradient(PageItem *currItem);
QString PDF_DoLinGradient(PageItem *currItem, QValueList<double> Stops, QValueList<double> Trans, QStringList Colors);
void PDF_Transparenz(PageItem *currItem);
void PDF_Annotation(PageItem *ite, uint PNr);
void PDF_Form(QString im);
void PDF_xForm(double w, double h, QString im);
void PDF_Image(PageItem* c, QString fn, double sx, double sy, double x, double y, bool fromAN = false, QString Profil = "", bool Embedded = false, int Intent = 1);
QString PDF_Image(PageItem* c, QString fn, double sx, double sy, double x, double y, bool fromAN = false, QString Profil = "", bool Embedded = false, int Intent = 1);
QString Inhalt;
ScribusDoc* doc;
ScribusView* view;