Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions | Private Member Functions | Private Attributes
SVGExPlug Class Reference

#include <svgexplugin.h>

List of all members.

Public Member Functions

 SVGExPlug (ScribusDoc *doc)
 Create the SVG exporter window.
 ~SVGExPlug ()
bool doExport (QString fName)

Private Member Functions

void ProcessPage (Page *Seite, QDomDocument *docu, QDomElement *elem)
 Process a page to export to SVG format.
QString SetClipPathImage (PageItem *ite)
QString SetClipPath (PageItem *ite)
QString FToStr (double c)
 Converts double to string.
QString IToStr (int c)
 Converts integer to QString.
void SetTextProps (QDomElement *tp, ScText *hl)
 Set text properties.
QString SetFarbe (QString farbe, int shad)
QString GetMultiStroke (struct SingleLine *sl, PageItem *Item)

Private Attributes

ScribusDoc * m_Doc
ScribusMainWindow * m_ScMW
ScribusView * m_View
int GradCount
int ClipCount

Detailed Description

Definition at line 63 of file svgexplugin.h.


Constructor & Destructor Documentation

SVGExPlug::SVGExPlug ( ScribusDoc *  doc)

Create the SVG exporter window.

Author:
Franz Schmid
Parameters:
fNameQString file name

Definition at line 153 of file svgexplugin.cpp.

{
       m_Doc=doc;
       m_View=m_Doc->view();
       m_ScMW=m_Doc->scMW();
}

Definition at line 846 of file svgexplugin.cpp.

{
}

Member Function Documentation

bool SVGExPlug::doExport ( QString  fName)

Definition at line 160 of file svgexplugin.cpp.

{
#ifdef USECAIRO
       Page *Seite = m_Doc->currentPage();
       int clipx = static_cast<int>(Seite->xOffset());
       int clipy = static_cast<int>(Seite->yOffset());
       int clipw = qRound(Seite->width());
       int cliph = qRound(Seite->height());
       double sca = m_View->scale();
       double cx = m_Doc->minCanvasCoordinate.x();
       double cy = m_Doc->minCanvasCoordinate.y();
       m_Doc->minCanvasCoordinate = FPoint(0, 0);
       bool frs = m_Doc->guidesSettings.framesShown;
       bool ctrls = m_Doc->guidesSettings.showControls;
       m_Doc->guidesSettings.framesShown = false;
       m_Doc->guidesSettings.showControls = false;
       m_View->setScale(1.0);
       m_View->previewMode = true;
       ScPainter *painter = new ScPainter(fName, clipw, cliph, 1.0, 0);
       painter->clear(m_Doc->papColor);
       painter->translate(-clipx, -clipy);
       painter->setFillMode(ScPainter::Solid);
       m_View->DrawMasterItems(painter, Seite, QRect(clipx, clipy, clipw, cliph));
       m_View->DrawPageItems(painter, QRect(clipx, clipy, clipw, cliph));
       painter->end();
       m_Doc->guidesSettings.framesShown = frs;
       m_Doc->guidesSettings.showControls = ctrls;
       m_View->setScale(sca);
       delete painter;
       m_View->previewMode = false;
       m_Doc->minCanvasCoordinate = FPoint(cx, cy);
#else
       QDomDocument docu("svgdoc");
       QString vo = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
       QString st = "<svg></svg>";
       docu.setContent(st);
       QDomElement elem = docu.documentElement();
       elem.setAttribute("width", FToStr(m_Doc->pageWidth)+"pt");
       elem.setAttribute("height", FToStr(m_Doc->pageHeight)+"pt");
       elem.setAttribute("xmlns", "http://www.w3.org/2000/svg");
       elem.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");
       Page *Seite;
       GradCount = 0;
       ClipCount = 0;
       Seite = m_Doc->MasterPages.at(m_Doc->MasterNames[m_Doc->currentPage()->MPageNam]);
       ProcessPage(Seite, &docu, &elem);
       Seite = m_Doc->currentPage();
       ProcessPage(Seite, &docu, &elem);
       if(fName.right(2) == "gz")
       {
              // zipped saving
              ScGzFile gzf(fName, docu.toString().utf8());
              if (!gzf.write(vo))
                     return false;
       }
       else
       {
              QFile f(fName);
              if(!f.open(IO_WriteOnly))
                     return false;
              QTextStream s(&f);
              QString wr = vo;
              wr += docu.toString();
              QCString utf8wr = wr.utf8();
              s.writeRawBytes(utf8wr.data(), utf8wr.length());
              f.close();
       }
#endif
       return true;
}

Here is the call graph for this function:

QString SVGExPlug::FToStr ( double  c) [private]

Converts double to string.

Author:
Franz Schmid
Parameters:
cdouble
Return values:
QString

Definition at line 732 of file svgexplugin.cpp.

{
       QString cc;
       return cc.setNum(c);
}

Here is the caller graph for this function:

QString SVGExPlug::GetMultiStroke ( struct SingleLine sl,
PageItem *  Item 
) [private]
Author:
Franz Schmid
Parameters:
slstruct SingleLine *
ItemPageItem *
Return values:
QStringStroke settings

Definition at line 779 of file svgexplugin.cpp.

{
       QString tmp = "fill:none; ";
       tmp += "stroke:"+SetFarbe(sl->Color, sl->Shade)+"; ";
       if (Item->fillTransparency() != 0)
              tmp += " stroke-opacity:"+FToStr(1.0 - Item->fillTransparency())+"; ";
       tmp += "stroke-width:"+FToStr(sl->Width)+"pt; ";
       tmp += "stroke-linecap:";
       switch (static_cast<PenCapStyle>(sl->LineEnd))
              {
              case Qt::FlatCap:
                     tmp += "butt;";
                     break;
              case Qt::SquareCap:
                     tmp += "square;";
                     break;
              case Qt::RoundCap:
                     tmp += "round;";
                     break;
              default:
                     tmp += "butt;";
                     break;
              }
       tmp += " stroke-linejoin:";
       switch (static_cast<PenJoinStyle>(sl->LineJoin))
              {
              case Qt::MiterJoin:
                     tmp += "miter;";
                     break;
              case Qt::BevelJoin:
                     tmp += "bevel;";
                     break;
              case Qt::RoundJoin:
                     tmp += "round;";
                     break;
              default:
                     tmp += "miter;";
                     break;
              }
       tmp += " stroke-dasharray:";
       QString Dt = FToStr(QMAX(2*sl->Width, 1));
       QString Da = FToStr(QMAX(6*sl->Width, 1));
       switch (static_cast<PenStyle>(sl->Dash))
              {
              case Qt::SolidLine:
                     tmp += "none;";
                     break;
              case Qt::DashLine:
                     tmp += Da+","+Dt+";";
                     break;
              case Qt::DotLine:
                     tmp += Dt+";";
                     break;
              case Qt::DashDotLine:
                     tmp += Da+","+Dt+","+Dt+","+Dt+";";
                     break;
              case Qt::DashDotDotLine:
                     tmp += Da+","+Dt+","+Dt+","+Dt+","+Dt+","+Dt+";";
                     break;
              default:
                     tmp += "none;";
                     break;
              }
       return tmp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

QString SVGExPlug::IToStr ( int  c) [private]

Converts integer to QString.

Author:
Franz Schmid
Parameters:
cint
Return values:
QStringrepresentation of value

Definition at line 738 of file svgexplugin.cpp.

{
       QString cc;
       return cc.setNum(c);
}

Here is the caller graph for this function:

void SVGExPlug::ProcessPage ( Page *  Seite,
QDomDocument *  docu,
QDomElement *  elem 
) [private]

Process a page to export to SVG format.

Author:
Franz Schmid
Parameters:
SeitePage *
docuQDomDocument *
elemQDomElement *

Definition at line 232 of file svgexplugin.cpp.

{
       QString tmp, trans, fill, stroke, strokeW, strokeLC, strokeLJ, strokeDA, gradi, Clipi, chx;
       int d;
       ScText *hl;
       int Lnr = 0;
       struct Layer ll;
       ll.isPrintable = false;
       ll.LNr = 0;
       QDomElement ob, gr, tp, tp2, defi, grad;
       QDomText tp1;
       PageItem *Item;
       gradi = "Grad";
       Clipi = "Clip";
       QPtrList<PageItem> Items;
       Page* SavedAct = m_Doc->currentPage();
       m_Doc->setCurrentPage(Seite);
       if (Seite->pageName().isEmpty())
              Items = m_Doc->DocItems;
       else
              Items = m_Doc->MasterItems;
       for (uint la = 0; la < m_Doc->Layers.count(); la++)
              {
              Level2Layer(m_Doc, &ll, Lnr);
              if (ll.isPrintable)
                     {
                     for(uint j = 0; j < Items.count(); ++j)
                     {
                            Item = Items.at(j);
                            if (Item->LayerNr != ll.LNr)
                                   continue;
                            double x = Seite->xOffset();
                            double y = Seite->yOffset();
                            double w = Seite->width();
                            double h = Seite->height();
                            double x2 = Item->BoundingX;
                            double y2 = Item->BoundingY;
                            double w2 = Item->BoundingW;
                            double h2 = Item->BoundingH;
                            if (!( QMAX( x, x2 ) <= QMIN( x+w, x2+w2 ) && QMAX( y, y2 ) <= QMIN( y+h, y2+h2 )))
                                   continue;
                            if ((Item->fillColor() != CommonStrings::None) || (Item->GrType != 0))
                            {
                                   fill = "fill:"+SetFarbe(Item->fillColor(), Item->fillShade())+";";
                                   if (Item->GrType != 0)
                                   {
                                          defi = docu->createElement("defs");
                                          if ((Item->GrType == 5) || (Item->GrType == 7))
                                                 grad = docu->createElement("radialGradient");
                                          else
                                                 grad = docu->createElement("linearGradient");
                                          grad.setAttribute("id", gradi+IToStr(GradCount));
                                          grad.setAttribute("gradientUnits", "userSpaceOnUse");
                                          switch (Item->GrType)
                                          {
                                                 case 1:
                                                        grad.setAttribute("x1", "0");
                                                        grad.setAttribute("y1", FToStr(Item->height() / 2));
                                                        grad.setAttribute("x2", FToStr(Item->width()));
                                                        grad.setAttribute("y2", FToStr(Item->height() / 2));
                                                        break;
                                                 case 2:
                                                        grad.setAttribute("x1", FToStr(Item->width()/ 2));
                                                        grad.setAttribute("y1", "0");
                                                        grad.setAttribute("x2", FToStr(Item->width()/ 2));
                                                        grad.setAttribute("y2", FToStr(Item->height()));
                                                        break;
                                                 case 3:
                                                        grad.setAttribute("x1", "0");
                                                        grad.setAttribute("y1", "0");
                                                        grad.setAttribute("x2", FToStr(Item->width()));
                                                        grad.setAttribute("y2", FToStr(Item->height()));
                                                        break;
                                                 case 4:
                                                        grad.setAttribute("x1", "0");
                                                        grad.setAttribute("y1", FToStr(Item->height()));
                                                        grad.setAttribute("x2", FToStr(Item->width()));
                                                        grad.setAttribute("y2", "0");
                                                        break;
                                                 case 5:
                                                        grad.setAttribute("r", FToStr(QMAX(Item->width() / 2, Item->height() / 2)));
                                                        grad.setAttribute("cx", FToStr(Item->width() / 2));
                                                        grad.setAttribute("cy", FToStr(Item->height() / 2));
                                                        break;
                                                 case 6:
                                                        grad.setAttribute("x1", FToStr(Item->GrStartX));
                                                        grad.setAttribute("y1", FToStr(Item->GrStartY));
                                                        grad.setAttribute("x2", FToStr(Item->GrEndX));
                                                        grad.setAttribute("y2", FToStr(Item->GrEndY));
                                                        break;
                                                 case 7:
                                                        grad.setAttribute("r", FToStr(QMAX(Item->width() / 2, Item->height() / 2)));
                                                        grad.setAttribute("cx", FToStr(Item->GrStartX));
                                                        grad.setAttribute("cy", FToStr(Item->GrStartY));
                                                        break;
                                          }
                                          QPtrVector<VColorStop> cstops = Item->fill_gradient.colorStops();
                                          for (uint cst = 0; cst < Item->fill_gradient.Stops(); ++cst)
                                          {
                                                 QDomElement itcl = docu->createElement("stop");
                                                 itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100)+"%");
                                                 itcl.setAttribute("stop-opacity", FToStr(cstops.at(cst)->opacity));
                                                 itcl.setAttribute("stop-color", SetFarbe(cstops.at(cst)->name, cstops.at(cst)->shade));
                                                 grad.appendChild(itcl);
                                          }
                                          defi.appendChild(grad);
                                          fill = "fill:url(#"+gradi+IToStr(GradCount)+");";
                                          GradCount++;
                                   }
                                   if (Item->fillRule)
                                          fill += " fill-rule:evenodd;";
                                   else
                                          fill += " fill-rule:nonzero;";
                                   if (Item->fillTransparency() != 0)
                                          fill += " fill-opacity:"+FToStr(1.0 - Item->fillTransparency())+";";
                            }
                            else
                                   fill = "fill:none;";
                            if (Item->lineColor() != CommonStrings::None)
                            {
                                   stroke = "stroke:"+SetFarbe(Item->lineColor(), Item->lineShade())+";";
                                   if (Item->lineTransparency() != 0)
                                          stroke += " stroke-opacity:"+FToStr(1.0 - Item->lineTransparency())+";";
                            }
                            else
                                   stroke = "stroke:none;";
                            trans = "translate("+FToStr(Item->xPos()-Seite->xOffset())+", "+FToStr(Item->yPos()-Seite->yOffset())+")";
                            if (Item->rotation() != 0)
                                   trans += " rotate("+FToStr(Item->rotation())+")";
                            strokeW = "stroke-width:"+FToStr(Item->lineWidth())+"pt;";
                            strokeLC = "stroke-linecap:";
                            switch (Item->PLineEnd)
                            {
                                   case Qt::FlatCap:
                                          strokeLC += "butt;";
                                          break;
                                   case Qt::SquareCap:
                                          strokeLC += "square;";
                                          break;
                                   case Qt::RoundCap:
                                          strokeLC += "round;";
                                          break;
                                   default:
                                          strokeLC += "butt;";
                                          break;
                            }
                            strokeLJ = "stroke-linejoin:";
                            switch (Item->PLineJoin)
                            {
                                   case Qt::MiterJoin:
                                          strokeLJ += "miter;";
                                          break;
                                   case Qt::BevelJoin:
                                          strokeLJ += "bevel;";
                                          break;
                                   case Qt::RoundJoin:
                                          strokeLJ += "round;";
                                          break;
                                   default:
                                          strokeLJ += "miter;";
                                          break;
                            }
                            strokeDA = "stroke-dasharray:";
                            if (Item->DashValues.count() != 0)
                            {
                                   QValueList<double>::iterator it;
                                   for ( it = Item->DashValues.begin(); it != Item->DashValues.end(); ++it )
                                   {
                                          strokeDA += IToStr(static_cast<int>(*it))+" ";
                                   }
                                   strokeDA += "; stroke-dashoffset:"+IToStr(static_cast<int>(Item->DashOffset))+";";
                            }
                            else
                            {
                                   QString Dt = FToStr(QMAX(2*Item->lineWidth(), 1));
                                   QString Da = FToStr(QMAX(6*Item->lineWidth(), 1));
                                   switch (Item->PLineArt)
                                   {
                                          case Qt::SolidLine:
                                                 strokeDA += "none;";
                                                 break;
                                          case Qt::DashLine:
                                                 strokeDA += Da+","+Dt+";";
                                                 break;
                                          case Qt::DotLine:
                                                 strokeDA += Dt+";";
                                                 break;
                                          case Qt::DashDotLine:
                                                 strokeDA += Da+","+Dt+","+Dt+","+Dt+";";
                                                 break;
                                          case Qt::DashDotDotLine:
                                                 strokeDA += Da+","+Dt+","+Dt+","+Dt+","+Dt+","+Dt+";";
                                                 break;
                                          default:
                                                 strokeDA += "none;";
                                                 break;
                                          }
                            }
                            gr = docu->createElement("g");
                            gr.setAttribute("transform", trans);
                            if (!Item->asTextFrame())
                            {
                                   if (Item->NamedLStyle.isEmpty())
                                   {
                                          if (Item->asPathText())
                                                 gr.setAttribute("style", "fill:none; "+stroke+" "+strokeW+" "+strokeLC+" "+strokeLJ+" "+strokeDA);
                                          else
                                                 gr.setAttribute("style", fill+" "+stroke+" "+strokeW+" "+strokeLC+" "+strokeLJ+" "+strokeDA);
                                   }
                            }
                            switch (Item->itemType())
                            {
                            /* Item types 3 and 1 are OBSOLETE: CR 2005-02-06
                            case 1:
                            case 3:
                            */
                            case PageItem::Polygon:
                                          if (Item->NamedLStyle.isEmpty())
                                          {
                                                 ob = docu->createElement("path");
                                                 ob.setAttribute("d", SetClipPath(Item)+"Z");
                                          }
                                          else
                                          {
                                                 ob = docu->createElement("path");
                                                 ob.setAttribute("d", SetClipPath(Item)+"Z");
                                                 ob.setAttribute("style", fill);
                                                 gr.appendChild(ob);
                                                 multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
                                                 for (int it = ml.size()-1; it > -1; it--)
                                                 {
                                                        if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
                                                        {
                                                               ob = docu->createElement("path");
                                                               ob.setAttribute("d", SetClipPath(Item)+"Z");
                                                               ob.setAttribute("style", GetMultiStroke(&ml[it], Item));
                                                               gr.appendChild(ob);
                                                        }
                                                 }
                                          }
                                   break;
                            case PageItem::ImageFrame:
                                          if ((Item->fillColor() != CommonStrings::None) || (Item->GrType != 0))
                                          {
                                                 ob = docu->createElement("path");
                                                 ob.setAttribute("d", SetClipPath(Item)+"Z");
                                                 ob.setAttribute("style", fill);
                                                 gr.appendChild(ob);
                                          }
                                          if ((Item->PicAvail) && (!Item->Pfile.isEmpty()))
                                          {
                                                 ob = docu->createElement("clipPath");
                                                 ob.setAttribute("id", Clipi+IToStr(ClipCount));
                                                 ob.setAttribute("clipPathUnits", "userSpaceOnUse");
                                                 ob.setAttribute("clip-rule", "evenodd");
                                                 QDomElement cl = docu->createElement("path");
                                                 if (Item->imageClip.size() != 0)
                                                        cl.setAttribute("d", SetClipPathImage(Item)+"Z");
                                                 else
                                                        cl.setAttribute("d", SetClipPath(Item)+"Z");
                                                 ob.appendChild(cl);
                                                 gr.appendChild(ob);
                                                 ScImage img;
                                                 CMSettings cms(m_Doc, Item->IProfile, Item->IRender);
                                                 img.LoadPicture(Item->Pfile, cms, Item->UseEmbedded, true, ScImage::RGBProof, 72);
                                                 img.applyEffect(Item->effectsInUse, m_Doc->PageColors, true);
                                                 QFileInfo fi = QFileInfo(Item->Pfile);
                                                 img.qImage().save(fi.baseName()+".png", "PNG");
                                                 ob = docu->createElement("image");
                                                 ob.setAttribute("clip-path", "url(#"+Clipi+IToStr(ClipCount)+")");
                                                 ob.setAttribute("xlink:href", fi.baseName()+".png");
                                                 ob.setAttribute("x", "0pt");
                                                 ob.setAttribute("y", "0pt");
                                                 ob.setAttribute("width", FToStr(Item->width())+"pt");
                                                 ob.setAttribute("height", FToStr(Item->height())+"pt");
                                                 ClipCount++;
                                                 gr.appendChild(ob);
                                          }
                                          if (Item->NamedLStyle.isEmpty())
                                          {
                                                 ob = docu->createElement("path");
                                                 ob.setAttribute("d", SetClipPath(Item)+"Z");
                                                 ob.setAttribute("style", "fill:none; "+stroke+" "+strokeW+" "+strokeLC+" "+strokeLJ+" "+strokeDA);
                                          }
                                          else
                                          {
                                                 multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
                                                 for (int it = ml.size()-1; it > -1; it--)
                                                 {
                                                        if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
                                                        {
                                                               ob = docu->createElement("path");
                                                               ob.setAttribute("d", SetClipPath(Item)+"Z");
                                                               ob.setAttribute("style", "fill:none; "+GetMultiStroke(&ml[it], Item));
                                                               gr.appendChild(ob);
                                                        }
                                                 }
                                          }
                                   break;
                            case PageItem::PolyLine:
                                          if (Item->NamedLStyle.isEmpty())
                                          {
                                                 ob = docu->createElement("path");
                                                 ob.setAttribute("d", SetClipPath(Item));
                                          }
                                          else
                                          {
                                                 multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
                                                 for (int it = ml.size()-1; it > -1; it--)
                                                 {
                                                        if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
                                                        {
                                                               ob = docu->createElement("path");
                                                               ob.setAttribute("d", SetClipPath(Item));
                                                               ob.setAttribute("style", GetMultiStroke(&ml[it], Item));
                                                               gr.appendChild(ob);
                                                        }
                                                 }
                                          }
                                   break;
                            case PageItem::TextFrame:
                                          if ((Item->fillColor() != CommonStrings::None) || (Item->GrType != 0))
                                          {
                                                 ob = docu->createElement("path");
                                                 ob.setAttribute("d", SetClipPath(Item)+"Z");
                                                 ob.setAttribute("style", fill);
                                                 gr.appendChild(ob);
                                          }
                                          ob = docu->createElement("text");
                                          for (d = 0; d < Item->itemText.length() && ! Item->frameDisplays(d); ++d)
                                                 ;
                                          for (; d < Item->itemText.length() && Item->frameDisplays(d); ++d)
                                          {
                                                 hl = Item->itemText.item(d);
                                                 if ((hl->ch == QChar(13)) || (hl->ch == QChar(10)) || (hl->ch == QChar(9)) || (hl->ch == QChar(28)))
                                                        continue;
                                                 if (hl->glyph.yoffset == 0)
                                                        break;
                                                 if (hl->ch == QChar(29))
                                                        chx = " ";
                                                 else
                                                        chx = hl->ch;
                                                 tp = docu->createElement("tspan");
                                                 tp.setAttribute("x", FToStr(hl->glyph.xoffset)+"pt");
                                                 tp.setAttribute("y", FToStr(hl->glyph.yoffset)+"pt");
                                                 SetTextProps(&tp, hl);
                                                 tp1 = docu->createTextNode(chx);
                                                 tp.appendChild(tp1);
                                                 ob.appendChild(tp);
                                          }
                                   break;
                            case PageItem::Line:
                                          if (Item->NamedLStyle.isEmpty())
                                          {
                                                 ob = docu->createElement("path");
                                                 ob.setAttribute("d", "M 0 0 L "+FToStr(Item->width())+" 0");
                                          }
                                          else
                                          {
                                                 multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
                                                 for (int it = ml.size()-1; it > -1; it--)
                                                 {
                                                        if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
                                                        {
                                                               ob = docu->createElement("path");
                                                               ob.setAttribute("d", "M 0 0 L "+FToStr(Item->width())+" 0");
                                                               ob.setAttribute("style", GetMultiStroke(&ml[it], Item));
                                                               gr.appendChild(ob);
                                                        }
                                                 }
                                          }
                                   break;
                            case PageItem::PathText:
                                          if (Item->PoShow)
                                          {
                                                 if (Item->NamedLStyle.isEmpty())
                                                 {
                                                        ob = docu->createElement("path");
                                                        ob.setAttribute("d", SetClipPath(Item));
                                                        gr.appendChild(ob);
                                                 }
                                                 else
                                                 {
                                                        multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
                                                        for (int it = ml.size()-1; it > -1; it--)
                                                        {
                                                               if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
                                                               {
                                                                      ob = docu->createElement("path");
                                                                      ob.setAttribute("d", SetClipPath(Item));
                                                                      ob.setAttribute("style", GetMultiStroke(&ml[it], Item));
                                                                      gr.appendChild(ob);
                                                               }
                                                        }
                                                 }
                                          }
                                          ob = docu->createElement("text");
                                          for (d = 0; d < Item->itemText.length() && !Item->frameDisplays(d); ++d)
                                                 ;
                                          for (; d < Item->itemText.length() && Item->frameDisplays(d); ++d)
                                          {
                                                 hl = Item->itemText.item(d);
                                                 if ((hl->ch == QChar(13)) || (hl->ch == QChar(10)) || (hl->ch == QChar(9)) || (hl->ch == QChar(25)) || (hl->ch == QChar(28)))
                                                        continue;
                                                 if (hl->ch == QChar(29))
                                                        chx = " ";
                                                 else
                                                        chx = hl->ch;
                                                 tp = docu->createElement("tspan");
                                                 tp.setAttribute("x", FToStr(hl->PtransX)+"pt");
                                                 tp.setAttribute("y", FToStr(hl->PtransY)+"pt");
                                                 tp.setAttribute("rotate", hl->PRot);
                                                 tp2 = docu->createElement("tspan");
                                                 tp2.setAttribute("dx", FToStr(hl->glyph.xoffset)+"pt");
                                                 tp2.setAttribute("dy", FToStr(hl->glyph.yoffset)+"pt");
                                                 SetTextProps(&tp2, hl);
                                                 tp1 = docu->createTextNode(chx);
                                                 tp2.appendChild(tp1);
                                                 tp.appendChild(tp2);
                                                 ob.appendChild(tp);
                                          }
                                   break;
                            default:
                                   break;
                            }
                            if (Item->GrType != 0)
                                   elem->appendChild(defi);
                            gr.appendChild(ob);
                            elem->appendChild(gr);
                     }
              }
              Lnr++;
       }
       m_Doc->setCurrentPage(SavedAct);
}

Here is the call graph for this function:

Here is the caller graph for this function:

QString SVGExPlug::SetClipPath ( PageItem *  ite) [private]
Author:
Franz Schmid
Parameters:
itePageItem *
Return values:
QStringClipping Path

Definition at line 668 of file svgexplugin.cpp.

{
       QString tmp = "";
       FPoint np, np1, np2;
       bool nPath = true;
       if (ite->PoLine.size() > 3)
              {
              for (uint poi=0; poi<ite->PoLine.size()-3; poi += 4)
                     {
                     if (ite->PoLine.point(poi).x() > 900000)
                            {
                            tmp += "Z ";
                            nPath = true;
                            continue;
                            }
                     if (nPath)
                            {
                            np = ite->PoLine.point(poi);
                            tmp += "M"+FToStr(np.x())+" "+FToStr(np.y())+" ";
                            nPath = false;
                            }
                     np = ite->PoLine.point(poi+1);
                     tmp += "C"+FToStr(np.x())+" "+FToStr(np.y())+" ";
                     np1 = ite->PoLine.point(poi+3);
                     tmp += FToStr(np1.x())+" "+FToStr(np1.y())+" ";
                     np2 = ite->PoLine.point(poi+2);
                     tmp += FToStr(np2.x())+" "+FToStr(np2.y())+" ";
                     }
              }
       return tmp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

QString SVGExPlug::SetClipPathImage ( PageItem *  ite) [private]

Definition at line 700 of file svgexplugin.cpp.

{
       QString tmp = "";
       FPoint np, np1, np2;
       bool nPath = true;
       if (ite->imageClip.size() > 3)
              {
              for (uint poi=0; poi<ite->imageClip.size()-3; poi += 4)
                     {
                     if (ite->imageClip.point(poi).x() > 900000)
                            {
                            tmp += "Z ";
                            nPath = true;
                            continue;
                            }
                     if (nPath)
                            {
                            np = ite->imageClip.point(poi);
                            tmp += "M"+FToStr(np.x())+" "+FToStr(np.y())+" ";
                            nPath = false;
                            }
                     np = ite->imageClip.point(poi+1);
                     tmp += "C"+FToStr(np.x())+" "+FToStr(np.y())+" ";
                     np1 = ite->imageClip.point(poi+3);
                     tmp += FToStr(np1.x())+" "+FToStr(np1.y())+" ";
                     np2 = ite->imageClip.point(poi+2);
                     tmp += FToStr(np2.x())+" "+FToStr(np2.y())+" ";
                     }
              }
       return tmp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

QString SVGExPlug::SetFarbe ( QString  farbe,
int  shad 
) [private]
Author:
Franz Schmid
Parameters:
farbeQString color
shadint
plugScribusMainWindow *
Return values:
QStringColour settings

Definition at line 773 of file svgexplugin.cpp.

{
       const ScColor& col = m_Doc->PageColors[farbe];
       return ScColorEngine::getShadeColorProof(col, m_Doc, shad).name();
}

Here is the caller graph for this function:

void SVGExPlug::SetTextProps ( QDomElement *  tp,
ScText *  hl 
) [private]

Set text properties.

Author:
Franz Schmid
Parameters:
tpQDomElement *
hlScText *

Definition at line 744 of file svgexplugin.cpp.

{
       int chst = hl->effects() & 127;
       if (hl->fillColor() != CommonStrings::None)
              tp->setAttribute("fill", SetFarbe(hl->fillColor(), hl->fillShade()));
       else
              tp->setAttribute("fill", "none");
       if ((hl->strokeColor() != CommonStrings::None) && (chst & 4))
              {
              tp->setAttribute("stroke", SetFarbe(hl->strokeColor(), hl->strokeShade()));
              tp->setAttribute("stroke-width", FToStr(hl->font().strokeWidth(hl->fontSize() / 10.0))+"pt");
              }
       else
              tp->setAttribute("stroke", "none");
       tp->setAttribute("font-size", (hl->fontSize() / 10.0));
       tp->setAttribute("font-family", hl->font().family());
       if (chst != 0)
              {
              if (chst & 64)
                     tp->setAttribute("font-variant", "small-caps");
              if (chst & 32)
                     tp->setAttribute("font-weight", "bold");
              if (chst & 16)
                     tp->setAttribute("text-decoration", "line-through");
              if (chst & 8)
                     tp->setAttribute("text-decoration", "underline");
              }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 136 of file svgexplugin.h.

Definition at line 135 of file svgexplugin.h.

ScribusDoc* SVGExPlug::m_Doc [private]

Definition at line 79 of file svgexplugin.h.

ScribusMainWindow* SVGExPlug::m_ScMW [private]

Definition at line 80 of file svgexplugin.h.

ScribusView* SVGExPlug::m_View [private]

Definition at line 81 of file svgexplugin.h.


The documentation for this class was generated from the following files: