Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scpageoutput.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "scpageoutput.h"
00008 
00009 #include <qptrstack.h>
00010 #include "pageitem.h"
00011 #include "cmsettings.h"
00012 #include "commonstrings.h"
00013 #include "prefsmanager.h"
00014 #include "pageitem_imageframe.h"
00015 #include "pageitem_line.h"
00016 #include "pageitem_pathtext.h"
00017 #include "pageitem_polygon.h"
00018 #include "pageitem_polyline.h"
00019 #include "pageitem_textframe.h"
00020 #include "scfonts.h"
00021 #include "scribus.h"
00022 #include "scimage.h"
00023 #include "util.h"
00024 
00025 MarksOptions::MarksOptions(void)
00026 {
00027        markOffset = 0.0;
00028        BleedTop = 0.0;
00029        BleedLeft = 0.0;
00030        BleedRight = 0.0;
00031        BleedBottom = 0.0;
00032        cropMarks = false;
00033        bleedMarks = false;
00034        registrationMarks = false;
00035        colorMarks = false;
00036        docInfoMarks = false;
00037 }
00038 
00039 MarksOptions::MarksOptions(struct PrintOptions& opt)
00040 {
00041        markOffset = opt.markOffset;
00042        BleedTop = opt.bleeds.Top;
00043        BleedLeft = opt.bleeds.Left;
00044        BleedRight = opt.bleeds.Right;
00045        BleedBottom = opt.bleeds.Bottom;
00046        cropMarks = opt.cropMarks;
00047        bleedMarks = opt.bleedMarks;
00048        registrationMarks = opt.registrationMarks;
00049        colorMarks = opt.colorMarks;
00050        docInfoMarks = true;
00051 }
00052 
00053 ScPageOutput::ScPageOutput(ScribusDoc* doc, bool reloadImages, int resolution, bool useProfiles) 
00054                      : m_marksOptions()
00055 {
00056        m_doc = doc;
00057        m_reloadImages = reloadImages;
00058        m_imageRes = resolution;
00059        m_useProfiles = useProfiles;
00060 }
00061 
00062 ScImage::RequestType ScPageOutput::translateImageModeToRequest( ScPainterExBase::ImageMode mode )
00063 {
00064        ScImage::RequestType value = ScImage::RGBData;
00065        if ( mode == ScPainterExBase::cmykImages )
00066               value = ScImage::CMYKData;
00067        else if ( mode == ScPainterExBase::rgbImages )
00068               value = ScImage::RGBData;
00069        else if ( mode == ScPainterExBase::rgbProofImages )
00070               value = ScImage::RGBProof;
00071        else if ( mode == ScPainterExBase::rawImages )
00072               value = ScImage::RawData;
00073        return value;
00074 }
00075 
00076 void ScPageOutput::DrawPage( Page* page, ScPainterExBase* painter)
00077 {
00078        int clipx = static_cast<int>(page->xOffset());
00079        int clipy = static_cast<int>(page->yOffset());
00080        int clipw = qRound(page->width());
00081        int cliph = qRound(page->height());
00082        DrawMasterItems(painter, page, QRect(clipx, clipy, clipw, cliph));
00083        DrawPageItems(painter, page, QRect(clipx, clipy, clipw, cliph));
00084        DrawMarks(page, painter, m_marksOptions);
00085 }
00086 
00087 void ScPageOutput::DrawMasterItems(ScPainterExBase *painter, Page *page, QRect& clip)
00088 {
00089        QPtrStack<PageItem> groupStack;
00090        QPtrStack<PageItem> groupClips;
00091        if (!page->MPageNam.isEmpty())
00092        {
00093               Page* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]);
00094               if (page->FromMaster.count() != 0)
00095               {
00096                      int Lnr;
00097                      struct Layer ll;
00098                      PageItem *currItem;
00099                      ll.isViewable = false;
00100                      ll.LNr = 0;
00101                      Lnr = 0;
00102                      uint layerCount = m_doc->layerCount();
00103                      for (uint la = 0; la < layerCount; ++la)
00104                      {
00105                             Level2Layer(m_doc, &ll, Lnr);
00106                             bool pr = true;
00107                             if ( !ll.isPrintable )
00108                                    pr = false;
00109                             if ((ll.isViewable) && (pr))
00110                             {
00111                                    uint pageFromMasterCount=page->FromMaster.count();
00112                                    for (uint a = 0; a < pageFromMasterCount; ++a)
00113                                    {
00114                                           currItem = page->FromMaster.at(a);
00115                                           if (currItem->LayerNr != ll.LNr)
00116                                                  continue;
00117                                           if ((currItem->OwnPage != -1) && (currItem->OwnPage != static_cast<int>(Mp->pageNr())))
00118                                                  continue;
00119                                           if (!currItem->printEnabled())
00120                                                  continue;
00121                                           if (currItem->isGroupControl)
00122                                           {
00123                                                  painter->save();
00124                                                  groupClips.push(currItem);
00125                                                  groupStack.push(currItem->groupsLastItem);
00126                                                  continue;
00127                                           }
00128                                           int savedOwnPage = currItem->OwnPage;
00129                                           double OldX = currItem->xPos();
00130                                           double OldY = currItem->yPos();
00131                                           double OldBX = currItem->BoundingX;
00132                                           double OldBY = currItem->BoundingY;
00133                                           currItem->OwnPage = page->pageNr();
00134                                           if (!currItem->ChangedMasterItem)
00135                                           {
00136                                                  currItem->moveBy(-Mp->xOffset() + page->xOffset(), -Mp->yOffset() + page->yOffset());
00137                                                  currItem->BoundingX = OldBX - Mp->xOffset() + page->xOffset();
00138                                                  currItem->BoundingY = OldBY - Mp->yOffset() + page->yOffset();
00139                                           }
00140                                           /*if (evSpon)
00141                                                  currItem->Dirty = true;*/
00142                                           QRect oldR(currItem->getRedrawBounding(1.0));
00143                                           if (clip.intersects(oldR))
00144                                                  DrawItem(currItem, painter, clip);
00145                                           currItem->OwnPage = savedOwnPage;
00146                                           if (!currItem->ChangedMasterItem)
00147                                           {
00148                                                  currItem->setXPos(OldX);
00149                                                  currItem->setYPos(OldY);
00150                                                  currItem->BoundingX = OldBX;
00151                                                  currItem->BoundingY = OldBY;
00152                                           }
00153                                           if (groupStack.count() != 0)
00154                                           {
00155                                                  while (currItem == groupStack.top())
00156                                                  {
00157                                                         QWMatrix mm;
00158                                                         PageItem *tmpItem = groupClips.pop();
00159                                                         FPointArray cl = tmpItem->PoLine.copy();
00160                                                         mm.translate(tmpItem->xPos(), tmpItem->yPos());
00161                                                         mm.rotate(tmpItem->rotation());
00162                                                         cl.map( mm );
00163                                                         painter->setupPolygon(&cl);
00164                                                         painter->setClipPath();
00165                                                         painter->restore();
00166                                                         groupStack.pop();
00167                                                  }
00168                                           }
00169                                    }
00170                                    for (uint a = 0; a < pageFromMasterCount; ++a)
00171                                    {
00172                                           currItem = page->FromMaster.at(a);
00173                                           if (currItem->LayerNr != ll.LNr)
00174                                                  continue;
00175                                           if (!currItem->isTableItem)
00176                                                  continue;
00177                                           if ((currItem->OwnPage != -1) && (currItem->OwnPage != static_cast<int>(Mp->pageNr())))
00178                                                  continue;
00179                                           double OldX = currItem->xPos();
00180                                           double OldY = currItem->yPos();
00181                                           double OldBX = currItem->BoundingX;
00182                                           double OldBY = currItem->BoundingY;
00183                                           if (!currItem->ChangedMasterItem)
00184                                           {
00185                                                  currItem->setXPos(OldX - Mp->xOffset() + page->xOffset());
00186                                                  currItem->setYPos(OldY - Mp->yOffset() + page->yOffset());
00187                                                  currItem->BoundingX = OldBX - Mp->xOffset() + page->xOffset();
00188                                                  currItem->BoundingY = OldBY - Mp->yOffset() + page->yOffset();
00189                                           }
00190                                           QRect oldR(currItem->getRedrawBounding(1.0));
00191                                           if (clip.intersects(oldR))
00192                                           {
00193                                                  painter->save();
00194                                                  painter->translate(currItem->xPos(), currItem->yPos());
00195                                                  painter->rotate(currItem->rotation());
00196                                                  if (currItem->lineColor() != CommonStrings::None)
00197                                                  {
00198                                                         ScColorShade tmp( m_doc->PageColors[currItem->lineColor()], currItem->lineShade());
00199                                                         if ((currItem->TopLine) || (currItem->RightLine) || (currItem->BottomLine) || (currItem->LeftLine))
00200                                                         {
00201                                                                painter->setPen(tmp, currItem->lineWidth(), currItem->PLineArt, Qt::SquareCap, currItem->PLineJoin);
00202                                                                if (currItem->TopLine)
00203                                                                       painter->drawLine(FPoint(0.0, 0.0), FPoint(currItem->width(), 0.0));
00204                                                                if (currItem->RightLine)
00205                                                                       painter->drawLine(FPoint(currItem->width(), 0.0), FPoint(currItem->width(), currItem->height()));
00206                                                                if (currItem->BottomLine)
00207                                                                       painter->drawLine(FPoint(currItem->width(), currItem->height()), FPoint(0.0, currItem->height()));
00208                                                                if (currItem->LeftLine)
00209                                                                       painter->drawLine(FPoint(0.0, currItem->height()), FPoint(0.0, 0.0));
00210                                                         }
00211                                                  }
00212                                                  painter->restore();
00213                                           }
00214                                           if (!currItem->ChangedMasterItem)
00215                                           {
00216                                                  currItem->setXPos(OldX);
00217                                                  currItem->setYPos(OldY);
00218                                                  currItem->BoundingX = OldBX;
00219                                                  currItem->BoundingY = OldBY;
00220                                           }
00221                                    }
00222                             }
00223                             Lnr++;
00224                      }
00225               }
00226        }
00227 }
00228 
00229 void ScPageOutput::DrawPageItems(ScPainterExBase *painter, Page *page, QRect& clip)
00230 {
00231        //linkedFramesToShow.clear();
00232        QPtrStack<PageItem> groupStack;
00233        QPtrStack<PageItem> groupClips;
00234        if (m_doc->Items->count() != 0)
00235        {
00236               int Lnr=0;
00237               struct Layer ll;
00238               PageItem *currItem;
00239               ll.isViewable = false;
00240               ll.LNr = 0;
00241               uint layerCount = m_doc->layerCount();
00242               //int docCurrPageNo=static_cast<int>(m_doc->currentPageNumber());
00243               int docCurrPageNo=static_cast<int>(page->pageNr());
00244               for (uint la2 = 0; la2 < layerCount; ++la2)
00245               {
00246                      Level2Layer(m_doc, &ll, Lnr);
00247                      bool pr = true;
00248                      if (!ll.isPrintable)
00249                             pr = false;
00250                      if ((ll.isViewable) && (pr))
00251                      {
00252                             QPtrListIterator<PageItem> docItem(*m_doc->Items);
00253                             while ( (currItem = docItem.current()) != 0)
00254                             {
00255                                    ++docItem;
00256                                    if (currItem->LayerNr != ll.LNr)
00257                                           continue;
00258                                    if (!currItem->printEnabled())
00259                                           continue;
00260                                    if ((m_doc->masterPageMode()) && ((currItem->OwnPage != -1) && (currItem->OwnPage != docCurrPageNo)))
00261                                           continue;
00262                                    if (!m_doc->masterPageMode() && !currItem->OnMasterPage.isEmpty())
00263                                    {
00264                                           if (currItem->OnMasterPage != page->pageName())
00265                                                  continue;
00266                                    }
00267                                    if (currItem->isGroupControl)
00268                                    {
00269                                           painter->save();
00270                                           groupClips.push(currItem);
00271                                           groupStack.push(currItem->groupsLastItem);
00272                                           continue;
00273                                    }
00274                                    QRect oldR(currItem->getRedrawBounding(1.0));
00275                                    if (clip.intersects(oldR))
00276                                    {
00277                                           DrawItem( currItem, painter, clip );
00278                                           if ((currItem->asTextFrame()) && ((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0)))
00279                                           {
00280                                                  PageItem *nextItem = currItem;
00281                                                  while (nextItem != 0)
00282                                                  {
00283                                                         if (nextItem->prevInChain() != 0)
00284                                                                nextItem = nextItem->prevInChain();
00285                                                         else
00286                                                                break;
00287                                                  }
00288                                           }
00289                                    }
00290                                    if (groupStack.count() != 0)
00291                                    {
00292                                           while (currItem == groupStack.top())
00293                                           {
00294                                                  QWMatrix mm;
00295                                                  PageItem *tmpItem = groupClips.pop();
00296                                                  FPointArray cl = tmpItem->PoLine.copy();
00297                                                  mm.translate(tmpItem->xPos(), tmpItem->yPos());
00298                                                  mm.rotate(tmpItem->rotation());
00299                                                  cl.map( mm );
00300                                                  painter->setupPolygon(&cl);
00301                                                  painter->setClipPath();
00302                                                  painter->restore();
00303                                                  groupStack.pop();
00304                                           }
00305                                    }
00306                             }
00307                             QPtrListIterator<PageItem> docItem2(*m_doc->Items);
00308                             while ( (currItem = docItem2.current()) != 0 )
00309                             {
00310                                    ++docItem2;
00311                                    if (currItem->LayerNr != ll.LNr)
00312                                           continue;
00313                                    if (!currItem->isTableItem)
00314                                           continue;
00315                                    QRect oldR(currItem->getRedrawBounding(1.0));
00316                                    if (clip.intersects(oldR))
00317                                    {
00318                                           painter->save();
00319                                           painter->translate(currItem->xPos(), currItem->yPos());
00320                                           painter->rotate(currItem->rotation());
00321                                           if (currItem->lineColor() != CommonStrings::None)
00322                                           {
00323                                                  ScColorShade tmp( m_doc->PageColors[currItem->lineColor()], currItem->lineShade() );
00324                                                  if ((currItem->TopLine) || (currItem->RightLine) || (currItem->BottomLine) || (currItem->LeftLine))
00325                                                  {
00326                                                         painter->setPen(tmp, currItem->lineWidth(), currItem->PLineArt, Qt::SquareCap, currItem->PLineJoin);
00327                                                         if (currItem->TopLine)
00328                                                                painter->drawLine(FPoint(0.0, 0.0), FPoint(currItem->width(), 0.0));
00329                                                         if (currItem->RightLine)
00330                                                                painter->drawLine(FPoint(currItem->width(), 0.0), FPoint(currItem->width(), currItem->height()));
00331                                                         if (currItem->BottomLine)
00332                                                                painter->drawLine(FPoint(currItem->width(), currItem->height()), FPoint(0.0, currItem->height()));
00333                                                         if (currItem->LeftLine)
00334                                                                painter->drawLine(FPoint(0.0, currItem->height()), FPoint(0.0, 0.0));
00335                                                  }
00336                                           }
00337                                           painter->restore();
00338                                    }
00339                             }
00340                      }
00341                      Lnr++;
00342               }
00343        }
00344 }
00345 
00346 void ScPageOutput::DrawItem( PageItem* item, ScPainterExBase* painter, QRect& clip )
00347 {
00348        DrawItem_Pre(item, painter);
00349        PageItem::ItemType itemType = item->itemType();
00350        if( itemType == PageItem::ImageFrame )
00351               DrawItem_ImageFrame( (PageItem_ImageFrame*) item, painter, clip);
00352        else if( itemType == PageItem::Line )
00353               DrawItem_Line( (PageItem_Line*) item, painter, clip);
00354        else if( itemType == PageItem::PathText )
00355               DrawItem_PathText(  (PageItem_PathText*) item, painter, clip);
00356        else if( itemType == PageItem::Polygon )
00357               DrawItem_Polygon( (PageItem_Polygon*) item, painter, clip);
00358        else if( itemType == PageItem::PolyLine )
00359               DrawItem_PolyLine( (PageItem_PolyLine*) item, painter, clip);
00360        else if( itemType == PageItem::TextFrame )
00361               DrawItem_TextFrame( (PageItem_TextFrame*) item, painter, clip);
00362        DrawItem_Post(item, painter);
00363 }
00364 
00365 void ScPageOutput::DrawItem_Pre( PageItem* item, ScPainterExBase* painter)
00366 {
00367        painter->save();
00368        if (!item->isEmbedded)
00369        {
00370               painter->translate( item->xPos(), item->yPos());
00371 //            painter->rotate(item->rotation());
00372        }
00373        painter->rotate(item->rotation());
00374        painter->setLineWidth(item->lineWidth());
00375        if (item->GrType == 8)
00376        {
00377               QString pat = item->pattern();
00378               if ((pat.isEmpty()) || (!m_doc->docPatterns.contains(pat)))
00379               {
00380                      painter->m_fillGradient = VGradientEx(VGradientEx::linear);
00381                      if (item->fillColor() != CommonStrings::None)
00382                      {
00383                             painter->setBrush(ScColorShade(m_doc->PageColors[item->fillColor()], item->fillShade()));
00384                             painter->setFillMode(ScPainterExBase::Solid);
00385                      }
00386                      else
00387                             painter->setFillMode(ScPainterExBase::None);
00388               }
00389               else
00390               {
00391                      QWMatrix patternTransform;
00392                      ScPattern& pattern = m_doc->docPatterns[item->pattern()];
00393                      double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation;
00394                      item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation);
00395                      patternTransform.translate(patternOffsetX, patternOffsetY);
00396                      patternTransform.rotate(patternRotation);
00397                      patternTransform.scale(pattern.scaleX, pattern.scaleY);
00398                      patternTransform.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
00399                      painter->setPattern(&pattern, patternTransform);
00400                      painter->setFillMode(ScPainterExBase::Pattern);
00401               }
00402        }
00403        else if (item->GrType != 0)
00404        {
00405               painter->setFillMode(ScPainterExBase::Gradient);
00406               painter->m_fillGradient = VGradientEx(item->fill_gradient, *m_doc);
00407               QWMatrix grm;
00408               grm.rotate(item->rotation());
00409               FPointArray gra;
00410               switch (item->GrType)
00411               {
00412                      case 1:
00413                      case 2:
00414                      case 3:
00415                      case 4:
00416                      case 6:
00417                             gra.setPoints(2, item->GrStartX, item->GrStartY, item->GrEndX, item->GrEndY);
00418                             gra.map(grm);
00419                             painter->setGradient(VGradientEx::linear, gra.point(0), gra.point(1));
00420                             break;
00421                      case 5:
00422                      case 7:
00423                             gra.setPoints(2, item->GrStartX, item->GrStartY, item->GrEndX, item->GrEndY);
00424                             painter->setGradient(VGradientEx::radial, gra.point(0), gra.point(1), gra.point(0));
00425                             break;
00426               }
00427        }
00428        else
00429        {
00430               painter->m_fillGradient = VGradientEx(VGradientEx::linear);
00431               if (item->fillColor() != CommonStrings::None)
00432               {
00433                      painter->setBrush( ScColorShade(m_doc->PageColors[item->fillColor()], item->fillShade()) );
00434                      painter->setFillMode(ScPainterExBase::Solid);
00435               }
00436               else
00437                      painter->setFillMode(ScPainterExBase::None);
00438        }
00439        if (item->lineColor() != CommonStrings::None)
00440        {
00441               if ((item->lineWidth() == 0) && !item->asLine())
00442                      painter->setLineWidth(0);
00443               else
00444               {
00445                      ScColorShade tmp(m_doc->PageColors[item->lineColor()], item->lineShade());
00446                      painter->setPen( tmp , item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin);
00447                      if (item->DashValues.count() != 0)
00448                             painter->setDash(item->DashValues, item->DashOffset);
00449               }
00450        }
00451        else
00452               painter->setLineWidth(0);
00453        painter->setBrushOpacity(1.0 - item->fillTransparency());
00454        painter->setPenOpacity(1.0 - item->lineTransparency());
00455        painter->setFillRule(item->fillRule);
00456 }
00457 
00458 void ScPageOutput::DrawItem_Post( PageItem* item, ScPainterExBase* painter )
00459 {
00460        bool doStroke=true;
00461        if ( item->itemType() == PageItem::PathText || item->itemType() == PageItem::PolyLine || item->itemType() == PageItem::Line )
00462               doStroke=false;
00463        if ((doStroke))
00464        {
00465               if (item->lineColor() != CommonStrings::None)
00466               {
00467                      ScColorShade tmp(m_doc->PageColors[item->lineColor()], item->lineShade());
00468                      painter->setPen(tmp, item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin);
00469                      if (item->DashValues.count() != 0)
00470                             painter->setDash(item->DashValues, item->DashOffset);
00471               }
00472               else
00473                      painter->setLineWidth(0);
00474               if (!item->isTableItem)
00475               {
00476                      painter->setupPolygon(&item->PoLine);
00477                      if (item->NamedLStyle.isEmpty())
00478                             painter->strokePath();
00479                      else
00480                      {
00481                             multiLine ml = m_doc->MLineStyles[item->NamedLStyle];
00482                             for (int it = ml.size()-1; it > -1; it--)
00483                             {
00484                                    const SingleLine& sl = ml[it];
00485                                    if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
00486                                    {
00487                                           ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade);
00488                                           painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash),
00489                                                         static_cast<Qt::PenCapStyle>(sl.LineEnd),
00490                                                         static_cast<Qt::PenJoinStyle>(sl.LineJoin));
00491                                           painter->strokePath();
00492                                    }
00493                             }
00494                      }
00495               }
00496        }
00497        if ((!item->isEmbedded))
00498               double scpInv = 1.0;
00499 //     item->Tinput = false;
00500        painter->restore();
00501 }
00502 
00503 void ScPageOutput::DrawGlyphs(PageItem* item, ScPainterExBase *painter, const CharStyle& style, GlyphLayout& glyphs, QRect& clip)
00504 {
00505        uint glyph = glyphs.glyph;
00506        if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode())) // NBSPACE
00507               glyph = style.font().char2CMap(QChar(' '));
00508        else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode())) // NBHYPHEN
00509               glyph = style.font().char2CMap(QChar('-'));
00510        
00511        if (glyph >= ScFace::CONTROL_GLYPHS)
00512        {
00513               if (glyphs.more)
00514               {
00515                      painter->translate(glyphs.xadvance, 0);
00516                      DrawGlyphs(item, painter, style, *glyphs.more, clip);
00517               }
00518               return;
00519        }
00520        
00521        //if (style.font().canRender(QChar(glyph)))
00522        {
00523               QWMatrix chma, chma2, chma3, chma4, chma5, chma6;
00524               chma.scale(glyphs.scaleH * style.fontSize() / 100.00, glyphs.scaleV * style.fontSize() / 100.0);
00525 //            qDebug(QString("glyphscale: %1 %2").arg(glyphs.scaleH).arg(glyphs.scaleV));
00526               FPointArray gly = style.font().glyphOutline(glyph);
00527               // Do underlining first so you can get typographically correct
00528               // underlines when drawing a white outline
00529               if ((style.effects() & ScStyle_Underline) || ((style.effects() & ScStyle_UnderlineWords) && (glyph != style.font().char2CMap(QChar(' ')))))
00530               {
00531                      double st, lw;
00532                      if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
00533                      {
00534                             if (style.underlineOffset() != -1)
00535                                    st = (style.underlineOffset() / 1000.0) * (style.font().descent(style.fontSize() / 10.0));
00536                             else
00537                                    st = style.font().underlinePos(style.fontSize() / 10.0);
00538                             if (style.underlineWidth() != -1)
00539                                    lw = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0);
00540                             else
00541                                    lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
00542                      }
00543                      else
00544                      {
00545                             st = style.font().underlinePos(style.fontSize() / 10.0);
00546                             lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
00547                      }
00548                      if (style.baselineOffset() != 0)
00549                             st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0);
00550                      ScColorShade tmpPen = painter->pen();
00551                      painter->setPen(painter->brush());
00552                      painter->setLineWidth(lw);
00553                      if (style.effects() & ScStyle_Subscript)
00554                             painter->drawLine(FPoint(glyphs.xoffset, glyphs.yoffset - st), FPoint(glyphs.xoffset + glyphs.xadvance, glyphs.yoffset - st));
00555                      else
00556                             painter->drawLine(FPoint(glyphs.xoffset, -st), FPoint(glyphs.xoffset + glyphs.xadvance, -st));
00557                      painter->setPen(tmpPen);
00558               }
00559               if (gly.size() > 3)
00560               {
00561                      painter->save();
00562                      painter->translate(glyphs.xoffset, glyphs.yoffset - ((style.fontSize() / 10.0) * glyphs.scaleV));
00563                      if (item->reversed())
00564                      {
00565                             painter->scale(-1, 1);
00566                             painter->translate(-glyphs.xadvance, 0);
00567                      }
00568                      if (style.baselineOffset() != 0)
00569                             painter->translate(0, -(style.fontSize() / 10.0) * (style.baselineOffset() / 1000.0));
00570                      double glxSc = glyphs.scaleH * style.fontSize() / 100.00;
00571                      double glySc = glyphs.scaleV * style.fontSize() / 100.0;
00572                      painter->scale(glxSc, glySc);
00573                      painter->setFillMode(ScPainterExBase::Solid);
00574                      bool fr = painter->fillRule();
00575                      painter->setFillRule(false);
00576                      painter->setupTextPolygon(&gly);
00577                      if (glyph == 0)
00578                      {
00579                             ScColorShade tmp(PrefsManager::instance()->appPrefs.DControlCharColor, 100);
00580                             painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
00581                             painter->setLineWidth(style.fontSize() * glyphs.scaleV * style.outlineWidth() * 2 / 10000.0);
00582                             painter->strokePath();
00583                      }
00584                      else if ((style.font().isStroked()) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0))
00585                      {
00586                             ScColorShade tmp = painter->brush();
00587                             painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
00588                             painter->setLineWidth(style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0);
00589                             painter->strokePath();
00590                      }
00591                      else
00592                      {
00593                             if ((style.effects() & ScStyle_Shadowed) && (style.strokeColor() != CommonStrings::None))
00594                             {
00595                                    painter->save();
00596                                    painter->translate((style.fontSize() * glyphs.scaleH * style.shadowXOffset() / 10000.0) / glxSc, -(style.fontSize() * glyphs.scaleV * style.shadowYOffset() / 10000.0) / glySc);
00597                                    ScColorShade tmp = painter->brush();
00598                                    painter->setBrush(painter->pen());
00599                                    painter->setupTextPolygon(&gly);
00600                                    FillPath(item, painter, clip);
00601                                    painter->setBrush(tmp);
00602                                    painter->restore();
00603                                    painter->setupTextPolygon(&gly);
00604                             }
00605                             if (style.fillColor() != CommonStrings::None)
00606                                    FillPath(item, painter, clip);
00607                             if ((style.effects() & ScStyle_Outline) && (style.strokeColor() != CommonStrings::None) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0))
00608                             {
00609                                    painter->setLineWidth((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) / glySc);
00610                                    painter->strokePath();
00611                             }
00612                      }
00613                      painter->setFillRule(fr);
00614                      painter->restore();
00615               }
00616               if (style.effects() & ScStyle_Strikethrough)
00617               {
00618                      double st, lw;
00619                      if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
00620                      {
00621                             if (style.strikethruOffset() != -1)
00622                                    st = (style.strikethruOffset() / 1000.0) * (style.font().ascent(style.fontSize() / 10.0));
00623                             else
00624                                    st = style.font().strikeoutPos(style.fontSize() / 10.0);
00625                             if (style.strikethruWidth() != -1)
00626                                    lw = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0);
00627                             else
00628                                    lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
00629                      }
00630                      else
00631                      {
00632                             st = style.font().strikeoutPos(style.fontSize() / 10.0);
00633                             lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
00634                      }
00635                      if (style.baselineOffset() != 0)
00636                             st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0);
00637                      painter->setPen(painter->brush());
00638                      painter->setLineWidth(lw);
00639                      painter->drawLine(FPoint(glyphs.xoffset, glyphs.yoffset - st), FPoint(glyphs.xoffset + glyphs.xadvance, glyphs.yoffset - st));
00640               }
00641        }
00642        /*else
00643        {
00644               painter->setLineWidth(1);
00645               painter->setPen(ScColorShade(Qt::red, 100));
00646               painter->setBrush(ScColorShade(Qt::red, 100));
00647               painter->setFillMode(1);
00648               painter->drawRect(glyphs.xoffset, glyphs.yoffset - (style.fontSize() / 10.0) * glyphs.scaleV , (style.fontSize() / 10.0) * glyphs.scaleH, (style.fontSize() / 10.0) * glyphs.scaleV);
00649        }*/
00650        if (glyphs.more)
00651        {
00652               painter->translate(glyphs.xadvance, 0);
00653               DrawGlyphs(item, painter, style, *glyphs.more, clip);
00654        }
00655 }
00656 
00657 void ScPageOutput::DrawItem_Embedded( PageItem* item, ScPainterExBase *p, QRect& clip, const CharStyle& style, PageItem* cembedded)
00658 {
00659        if (!cembedded)
00660               return;
00661        QPtrList<PageItem> emG;
00662        QPtrStack<PageItem> groupStack;
00663        emG.clear();
00664        emG.append(cembedded);
00665        if (cembedded->Groups.count() != 0)
00666        {
00667               for (uint ga=0; ga < m_doc->FrameItems.count(); ++ga)
00668               {
00669                      if (m_doc->FrameItems.at(ga)->Groups.count() != 0)
00670                      {
00671                             if (m_doc->FrameItems.at(ga)->Groups.top() == cembedded->Groups.top())
00672                             {
00673                                    if (m_doc->FrameItems.at(ga)->ItemNr != cembedded->ItemNr)
00674                                    {
00675                                           if (emG.find(m_doc->FrameItems.at(ga)) == -1)
00676                                                  emG.append(m_doc->FrameItems.at(ga));
00677                                    }
00678                             }
00679                      }
00680               }
00681        }
00682        for (uint em = 0; em < emG.count(); ++em)
00683        {
00684               PageItem* embedded = emG.at(em);
00685               p->save();
00686               embedded->setXPos( item->xPos() + embedded->gXpos );
00687               embedded->setYPos( item->yPos() - (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos );
00688               p->translate((embedded->gXpos * (style.scaleH() / 1000.0)), ( - (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos * (style.scaleV() / 1000.0)));
00689               if (style.baselineOffset() != 0)
00690               {
00691                      p->translate(0, -embedded->gHeight * (style.baselineOffset() / 1000.0));
00692                      embedded->setYPos( embedded->yPos() - embedded->gHeight * (style.baselineOffset() / 1000.0) );
00693               }
00694               p->scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
00695               if (embedded->isGroupControl)
00696               {
00697                      p->restore();
00698                      p->save();
00699                      FPointArray cl = embedded->PoLine.copy();
00700                      QWMatrix mm;
00701                      mm.translate(embedded->xPos() - item->xPos(), embedded->yPos() - item->yPos());
00702                      mm.rotate(embedded->rotation());
00703                      cl.map( mm );
00704                      groupStack.push(embedded->groupsLastItem);
00705                      continue;
00706               }
00707               double pws = embedded->m_lineWidth;
00708               DrawItem_Pre(embedded, p);
00709               switch(embedded->itemType())
00710               {
00711                      case PageItem::ImageFrame:
00712                      case PageItem::TextFrame:
00713                      case PageItem::Polygon:
00714                      case PageItem::PathText:
00715                             DrawItem(embedded, p, clip);
00716                             break;
00717                      case PageItem::Line:
00718                      case PageItem::PolyLine:
00719                             embedded->m_lineWidth = pws * QMIN(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
00720                             DrawItem(embedded, p, clip);
00721                             break;
00722                      default:
00723                             break;
00724               }
00725               embedded->m_lineWidth = pws * QMIN(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
00726               DrawItem_Post(embedded, p);
00727               p->restore();
00728               if (groupStack.count() != 0)
00729               {
00730                      while (embedded == groupStack.top())
00731                      {
00732                             p->restore();
00733                             groupStack.pop();
00734                      }
00735               }
00736               embedded->m_lineWidth = pws;
00737        }
00738 }
00739 
00740 void ScPageOutput::DrawPattern( PageItem* item, ScPainterExBase* painter, QRect& clip)
00741 {
00742        double x1, x2, y1, y2;
00743        ScPattern& pattern = m_doc->docPatterns[item->pattern()];
00744        double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation;
00745        item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation);
00746 
00747        // Compute pattern tansformation matrix and its inverse for converting pattern coordinates
00748        // to pageitem coordinates 
00749        QWMatrix matrix, invMat;
00750        matrix.translate(patternOffsetX, patternOffsetY);
00751        matrix.rotate(patternRotation);
00752        matrix.scale(pattern.scaleX, pattern.scaleY);
00753        matrix.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
00754        invMat.scale((patternScaleX != 0) ? (100 /patternScaleX) : 1.0, (patternScaleY != 0) ? (100 /patternScaleY) : 1.0);
00755        invMat.scale((pattern.scaleX != 0) ? (1 /pattern.scaleX) : 1.0, (pattern.scaleY != 0) ? (1 /pattern.scaleY) : 1.0);
00756        invMat.rotate(-patternRotation);
00757        invMat.translate(-patternOffsetX, -patternOffsetY);
00758 
00759        // Compute bounding box in which pattern item will be drawn
00760        double width  = item->width();
00761        double height = item->height();
00762        double rot    = patternRotation - floor(patternRotation / 90) * 90;
00763        double ctheta = cos(rot * M_PI / 180);
00764        double stheta = sin(rot * M_PI / 180);
00765        QRect itemRect(0, 0, item->width(), item->height());
00766        QPoint pa( width * stheta * stheta, -width * stheta * ctheta );
00767        QPoint pb( width + height * ctheta * stheta, height * stheta * stheta );
00768        QPoint pc( -height * ctheta * stheta, height * ctheta * ctheta );
00769        QPoint pd( width * ctheta * ctheta, height + width * ctheta * stheta );
00770        QPoint ipa = invMat.map(pa), ipb = invMat.map(pb);
00771        QPoint ipc = invMat.map(pc), ipd = invMat.map(pd);
00772 
00773        painter->save();
00774        if (item->imageClip.size() != 0)
00775        {
00776               painter->setupPolygon(&item->imageClip);
00777               painter->setClipPath();
00778        }
00779        painter->setupPolygon(&item->PoLine);
00780        painter->setClipPath();
00781        for (uint index = 0; index < pattern.items.count(); index++)
00782        {
00783               QRect itRect;
00784               PageItem* it = pattern.items.at(index);
00785               if (it->isGroupControl)
00786                      continue;
00787 
00788               painter->save();
00789               painter->translate(patternOffsetX, patternOffsetY);
00790               painter->rotate(patternRotation);
00791               painter->scale(pattern.scaleX, pattern.scaleY);
00792               painter->scale(patternScaleX / 100.0, patternScaleY / 100.0);
00793 
00794               double patWidth  = (pattern.width != 0.0) ? pattern.width : 1.0;
00795               double patHeight = (pattern.height != 0.0) ? pattern.height : 1.0;
00796               double kxa = (ipa.x() - it->gXpos) / patWidth;
00797               double kxb = (ipb.x() - it->gXpos) / patWidth;
00798               double kxc = (ipc.x() - it->gXpos) / patWidth;
00799               double kxd = (ipd.x() - it->gXpos) / patWidth;
00800               double kya = (ipa.y() - it->gYpos) / patHeight;
00801               double kyb = (ipb.y() - it->gYpos) / patHeight;
00802               double kyc = (ipc.y() - it->gYpos) / patHeight;
00803               double kyd = (ipd.y() - it->gYpos) / patHeight;
00804               int kxMin = floor( QMIN(QMIN(kxa, kxb), QMIN(kxc, kxd)) );
00805               int kxMax = ceil ( QMAX(QMAX(kxa, kxb), QMAX(kxc, kxd)) );
00806               int kyMin = floor( QMIN(QMIN(kya, kyb), QMIN(kyc, kyd)) );
00807               int kyMax = ceil ( QMAX(QMAX(kya, kyb), QMAX(kyc, kyd)) );
00808 
00809               double itx = it->xPos();
00810               double ity = it->yPos();
00811               double itPosX = it->gXpos, itPosY = it->gYpos;
00812               for ( int kx = kxMin; kx <= kxMax; kx++ )
00813               {
00814                      for ( int ky = kyMin; ky <= kyMax; ky++ )
00815                      {
00816                             itPosX = it->gXpos + kx * pattern.width;
00817                             itPosY = it->gYpos + ky * pattern.height;
00818                             it->setXYPos(itPosX, itPosY);
00819                             it->getBoundingRect(&x1, &y1, &x2, &y2);
00820                             itRect.setCoords(x1, y1, x2, y2);
00821                             itRect = matrix.mapRect( itRect );
00822                             if ( itRect.intersects(itemRect) )
00823                                    DrawItem(it, painter, clip);
00824                      }
00825               }
00826               it->setXYPos(itx, ity);
00827               painter->restore();
00828        }
00829        painter->restore();
00830 }
00831 
00832 void ScPageOutput::DrawItem_ImageFrame( PageItem_ImageFrame* item, ScPainterExBase* painter, QRect& clip  )
00833 {
00834        ScPainterExBase::ImageMode mode = ScPainterExBase::rgbImages;
00835        if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0))
00836        {
00837               painter->setupPolygon(&item->PoLine);
00838               FillPath(item, painter, clip);
00839        }
00840        if (item->Pfile.isEmpty())
00841        {
00842               painter->setPen( ScColorShade(Qt::black, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
00843               painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height()));
00844               painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0));
00845        }
00846        else
00847        {
00848               if ((!item->imageShown()) || (!item->PicAvail))
00849               {
00850                      painter->setPen( ScColorShade(Qt::red, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
00851                      painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height()));
00852                      painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0));
00853               }
00854               else
00855               {
00856                      ScImage scImg;
00857                      ScImage* pImage = NULL;
00858                      double imScaleX = item->imageXScale();
00859                      double imScaleY = item->imageYScale();
00860                      if( m_reloadImages )
00861                      {
00862                             bool dummy;
00863                             bool useCmyk = false;
00864                             ScPainterExBase::ImageMode imageMode = painter->imageMode();
00865                             if ( imageMode == ScPainterExBase::cmykImages )
00866                                    useCmyk = true;
00867                             QFileInfo fInfo(item->Pfile);
00868                             QString ext = fInfo.extension(false);
00869                             CMSettings cmsSettings(item->doc(), item->IProfile, item->IRender);
00870                             scImg.imgInfo.valid = false;
00871                             scImg.imgInfo.clipPath = "";
00872                             scImg.imgInfo.PDSpathData.clear();
00873                             scImg.imgInfo.layerInfo.clear();
00874                             scImg.imgInfo.RequestProps = item->pixm.imgInfo.RequestProps;
00875                             scImg.imgInfo.isRequest = item->pixm.imgInfo.isRequest;
00876                             scImg.LoadPicture(item->Pfile, cmsSettings, item->UseEmbedded, m_useProfiles, translateImageModeToRequest(imageMode), m_imageRes, &dummy);
00877                             if( ext == "eps" || ext == "epsi" || ext == "pdf" || ext == "ps" )
00878                             {
00879                                    imScaleX *= (72.0 / (double) m_imageRes);
00880                                    imScaleY *= (72.0 / (double) m_imageRes);
00881                             }
00882                             scImg.applyEffect(item->effectsInUse, m_doc->PageColors, useCmyk);
00883                             mode = imageMode;
00884                             pImage = &scImg;
00885                      }
00886                      else
00887                             pImage = &item->pixm;
00888 
00889                      painter->save();
00890                      if (item->imageClip.size() != 0)
00891                      {
00892                             painter->setupPolygon(&item->imageClip);
00893                             painter->setClipPath();
00894                      }
00895                      painter->setupPolygon(&item->PoLine);
00896                      painter->setClipPath();
00897                      if (item->imageFlippedH())
00898                      {
00899                             painter->translate(item->width(), 0);
00900                             painter->scale(-1, 1);
00901                      }
00902                      if (item->imageFlippedV())
00903                      {
00904                             painter->translate(0, item->height());
00905                             painter->scale(1, -1);
00906                      }
00907                      painter->translate(item->imageXOffset() * item->imageXScale(), item->imageYOffset() * item->imageYScale());
00908                      //painter->translate(item->LocalX * imScaleX * scale, item->LocalY * imScaleY * scale); ??
00909                      painter->scale( imScaleX, imScaleY );
00910                      if (pImage->imgInfo.lowResType != 0)
00911                             painter->scale(pImage->imgInfo.lowResScale, pImage->imgInfo.lowResScale);
00912                      painter->drawImage(pImage, mode);
00913                      painter->restore();
00914               }
00915        }
00916 }
00917 
00918 void ScPageOutput::DrawItem_Line( PageItem_Line* item, ScPainterExBase* painter, QRect& clip )
00919 {
00920  int startArrowIndex;
00921  int endArrowIndex;
00922 
00923        startArrowIndex = item->startArrowIndex();
00924        endArrowIndex = item->endArrowIndex();
00925 
00926        if (item->NamedLStyle.isEmpty())
00927               painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0));
00928        else
00929        {
00930               multiLine ml = m_doc->MLineStyles[item->NamedLStyle];
00931               for (int it = ml.size()-1; it > -1; it--)
00932               {
00933                      const SingleLine& sl = ml[it];
00934                      if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
00935                      {
00936                             ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade);
00937                             painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash),
00938                                           static_cast<Qt::PenCapStyle>(sl.LineEnd),
00939                                           static_cast<Qt::PenJoinStyle>(sl.LineJoin));
00940                             painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0));
00941                      }
00942               }
00943        }
00944        if (startArrowIndex != 0)
00945        {
00946               QWMatrix arrowTrans;
00947               FPointArray arrow = ( *m_doc->arrowStyles.at(startArrowIndex - 1) ).points.copy();
00948               arrowTrans.translate( 0, 0 );
00949               arrowTrans.scale( item->lineWidth(), item->lineWidth());
00950               arrowTrans.scale( -1 , 1 );
00951               arrow.map( arrowTrans );
00952               painter->setBrush( painter->pen() );
00953               painter->setBrushOpacity( 1.0 - item->lineTransparency() );
00954               painter->setLineWidth( 0 );
00955               painter->setFillMode(ScPainterExBase::Solid);
00956               painter->setupPolygon( &arrow );
00957               FillPath(item, painter, clip);
00958        }
00959        if (endArrowIndex != 0)
00960        {
00961               QWMatrix arrowTrans;
00962               FPointArray arrow = (*m_doc->arrowStyles.at(endArrowIndex-1) ).points.copy();
00963               arrowTrans.translate( item->width(), 0 );
00964               arrowTrans.scale( item->lineWidth(), item->lineWidth());
00965               arrow.map( arrowTrans );
00966               painter->setBrush( painter->pen() );
00967               painter->setBrushOpacity( 1.0 - item->lineTransparency() );
00968               painter->setLineWidth( 0 );
00969               painter->setFillMode( ScPainterExBase::Solid );
00970               painter->setupPolygon( &arrow );
00971               FillPath(item, painter, clip);
00972        }
00973 }
00974 
00975 void ScPageOutput::DrawItem_PathText( PageItem_PathText* item, ScPainterExBase* painter, QRect& clip )
00976 {
00977        int a;
00978        int chs;
00979        QString chstr, chstr2, chstr3;
00980        ScText *hl;
00981        double dx;
00982        double sp = 0;
00983        double oldSp = 0;
00984        double oCurX = 0;
00985        FPoint point = FPoint(0, 0);
00986        FPoint normal = FPoint(0, 0);
00987        FPoint tangent = FPoint(0, 0);
00988        FPoint extPoint = FPoint(0, 0);
00989        bool ext = false;
00990        bool first = true;
00991        double fsx = 0;
00992        uint seg = 0;
00993        double segLen = 0;
00994        double distCurX;
00995        double CurX = item->textToFrameDistLeft(); // item->CurX = item->textToFrameDistLeft()
00996        double CurY = 0;
00997        if (item->lineColor() != CommonStrings::None && item->PoShow)
00998        {
00999               painter->setupPolygon(&item->PoLine, false);
01000               painter->strokePath();
01001        }
01002        else if (item->NamedLStyle.isEmpty())
01003               painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0));
01004        else
01005        {
01006               multiLine ml = m_doc->MLineStyles[item->NamedLStyle];
01007               for (int it = ml.size() - 1; it > -1; it--)
01008               {
01009                      const SingleLine& sl = ml[it];
01010                      if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
01011                      {
01012                             ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade);
01013                             painter->setPen(tmp, sl.Width,  static_cast<Qt::PenStyle>(sl.Dash), 
01014                                            static_cast<Qt::PenCapStyle>(sl.LineEnd), 
01015                                            static_cast<Qt::PenJoinStyle>(sl.LineJoin));
01016                             painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0));
01017                      }
01018               }
01019        }
01020        if (item->itemText.length() != 0)
01021               CurX += item->itemText.item(0)->fontSize() * item->itemText.item(0)->tracking() / 10000.0;
01022        segLen = item->PoLine.lenPathSeg(seg);
01023        for (a = 0; a < item->itemText.length(); ++a)
01024        {
01025               CurY = 0;
01026               hl = item->itemText.item(a);
01027               chstr = hl->ch;
01028               if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP
01029                      || chstr[0] == SpecialChars::TAB || chstr == SpecialChars::LINEBREAK)
01030                      continue;
01031               chs = hl->fontSize();
01032               if (a < item->itemText.length()-1)
01033                      chstr += item->itemText.text(a+1, 1);
01034               hl->glyph.yadvance = 0;
01035               item->layoutGlyphs(item->itemText.charStyle(a), chstr, hl->glyph);
01036               hl->glyph.shrink();
01037               dx = hl->glyph.wide() / 2.0;
01038               CurX += dx;
01039               ext = false;
01040               while ( (seg < item->PoLine.size()-3) && (CurX > fsx + segLen))
01041               {
01042                      fsx += segLen;
01043                      seg += 4;
01044                      if (seg > item->PoLine.size()-3)
01045                             break;
01046                      segLen = item->PoLine.lenPathSeg(seg);
01047                      ext = true;
01048               }
01049               if (seg > item->PoLine.size()-3)
01050                      break;
01051               if (CurX > fsx + segLen)
01052                      break;
01053               if (ext)
01054               {
01055                      sp = 0;
01056                      distCurX = item->PoLine.lenPathDist(seg, 0, sp);
01057                      while (distCurX <= ((CurX - oCurX) - (fsx - oCurX)))
01058                      {
01059                             sp += 0.001;
01060                             distCurX = item->PoLine.lenPathDist(seg, 0, sp);
01061                      }
01062                      item->PoLine.pointTangentNormalAt(seg, sp, &point, &tangent, &normal );
01063                      CurX = (CurX - (CurX - fsx)) + distCurX;
01064                      oldSp = sp;
01065                      ext = false;
01066               }
01067               else
01068               {
01069                      if( seg < item->PoLine.size()-3 )
01070                      {
01071                             if (CurX > fsx + segLen)
01072                                    break;
01073                             distCurX = item->PoLine.lenPathDist(seg, oldSp, sp);
01074                             while (distCurX <= (CurX - oCurX))
01075                             {
01076                                    sp += 0.001;
01077                                    if (sp >= 1.0)
01078                                    {
01079                                           sp = 0.9999;
01080                                           break;
01081                                    }
01082                                    distCurX = item->PoLine.lenPathDist(seg, oldSp, sp);
01083                             }
01084                             item->PoLine.pointTangentNormalAt(seg, sp, &point, &tangent, &normal );
01085                             CurX = oCurX + distCurX;
01086                             oldSp = sp;
01087                      }
01088                      else
01089                             break;
01090               }
01091               hl->glyph.xoffset = point.x();
01092               hl->glyph.yoffset = point.y();
01093               hl->PtransX = tangent.x();
01094               hl->PtransY = tangent.y();
01095               hl->PRot = dx;
01096               QWMatrix trafo = QWMatrix( 1, 0, 0, -1, -dx, 0 );
01097               if (item->textPathFlipped)
01098                      trafo *= QWMatrix(1, 0, 0, -1, 0, 0);
01099               if (item->textPathType == 0)
01100                      trafo *= QWMatrix( tangent.x(), tangent.y(), tangent.y(), -tangent.x(), point.x(), point.y() ); // ID's Rainbow mode
01101               else if (item->textPathType == 1)
01102                      trafo *= QWMatrix( 1, 0, 0, -1, point.x(), point.y() ); // ID's Stair Step mode
01103               else if (item->textPathType == 2)
01104               {
01105                      double a = 1;
01106                      if (tangent.x() < 0)
01107                             a = -1;
01108                      if (fabs(tangent.x()) > 0.1)
01109                             trafo *= QWMatrix( a, (tangent.y() / tangent.x()) * a, 0, -1, point.x(), point.y() ); // ID's Skew mode
01110                      else
01111                             trafo *= QWMatrix( a, 4 * a, 0, -1, point.x(), point.y() );
01112               }
01113               QWMatrix sca = painter->worldMatrix();
01114               trafo *= sca;
01115               painter->save();
01116               QWMatrix savWM = painter->worldMatrix();
01117               painter->setWorldMatrix(trafo);
01118               DrawGlyphs(item, painter, item->itemText.charStyle(a), hl->glyph, clip);
01119               painter->setWorldMatrix(savWM);
01120               painter->restore();
01121               //item->MaxChars = a+1;
01122               oCurX = CurX;
01123               CurX -= dx;
01124               CurX += hl->glyph.wide() + hl->fontSize() * hl->tracking() / 10000.0;
01125               first = false;
01126        }
01127 }
01128 
01129 void ScPageOutput::DrawItem_Polygon ( PageItem_Polygon* item , ScPainterExBase* painter, QRect& clip )
01130 {
01131        painter->setupPolygon(&item->PoLine);
01132        FillPath(item, painter, clip);
01133 }
01134 
01135 void ScPageOutput::DrawItem_PolyLine( PageItem_PolyLine* item, ScPainterExBase* painter, QRect& clip )
01136 {
01137  int startArrowIndex;
01138  int endArrowIndex;
01139 
01140        startArrowIndex = item->startArrowIndex();
01141        endArrowIndex = item->endArrowIndex();
01142 
01143        if (item->PoLine.size()>=4)
01144        {
01145               if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0))
01146               {
01147                      FPointArray cli;
01148                      FPoint Start;
01149                      bool firstp = true;
01150                      for (uint n = 0; n < item->PoLine.size()-3; n += 4)
01151                      {
01152                             if (firstp)
01153                             {
01154                                    Start = item->PoLine.point(n);
01155                                    firstp = false;
01156                             }
01157                             if (item->PoLine.point(n).x() > 900000)
01158                             {
01159                                    cli.addPoint(item->PoLine.point(n-2));
01160                                    cli.addPoint(item->PoLine.point(n-2));
01161                                    cli.addPoint(Start);
01162                                    cli.addPoint(Start);
01163                                    cli.setMarker();
01164                                    firstp = true;
01165                                    continue;
01166                             }
01167                             cli.addPoint(item->PoLine.point(n));
01168                             cli.addPoint(item->PoLine.point(n+1));
01169                             cli.addPoint(item->PoLine.point(n+2));
01170                             cli.addPoint(item->PoLine.point(n+3));
01171                      }
01172                      if (cli.size() > 2)
01173                      {
01174                             FPoint l1 = cli.point(cli.size()-2);
01175                             cli.addPoint(l1);
01176                             cli.addPoint(l1);
01177                             cli.addPoint(Start);
01178                             cli.addPoint(Start);
01179                      }
01180                      painter->setupPolygon(&cli);
01181                      FillPath(item, painter, clip);
01182               }
01183               painter->setupPolygon(&item->PoLine, false);
01184               if (item->NamedLStyle.isEmpty())
01185                      painter->strokePath();
01186               else
01187               {
01188                      multiLine ml = m_doc->MLineStyles[item->NamedLStyle];
01189                      for (int it = ml.size()-1; it > -1; it--)
01190                      {
01191                             const SingleLine& sl = ml[it];
01192                             if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
01193                             {
01194                                    ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade);
01195                                    painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash),
01196                                                  static_cast<Qt::PenCapStyle>(sl.LineEnd),
01197                                                  static_cast<Qt::PenJoinStyle>(sl.LineJoin));
01198                                    painter->strokePath();
01199                             }
01200                      }
01201               }
01202               if (startArrowIndex != 0)
01203               {
01204                      FPoint Start = item->PoLine.point(0);
01205                      for (uint xx = 1; xx < item->PoLine.size(); xx += 2)
01206                      {
01207                             FPoint Vector = item->PoLine.point(xx);
01208                             if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
01209                             {
01210                                    double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
01211                                    QWMatrix arrowTrans;
01212                                    FPointArray arrow = (*m_doc->arrowStyles.at(startArrowIndex-1)).points.copy();
01213                                    arrowTrans.translate(Start.x(), Start.y());
01214                                    arrowTrans.rotate(r);
01215                                    arrowTrans.scale(item->lineWidth(), item->lineWidth());
01216                                    arrow.map(arrowTrans);
01217                                    painter->setBrush(painter->pen());
01218                                    painter->setBrushOpacity(1.0 - item->lineTransparency());
01219                                    painter->setLineWidth(0);
01220                                    painter->setFillMode(ScPainterExBase::Solid);
01221                                    painter->setupPolygon(&arrow);
01222                                    FillPath(item, painter, clip);
01223                                    break;
01224                             }
01225                      }
01226               }
01227               if (endArrowIndex != 0)
01228               {
01229                      FPoint End = item->PoLine.point(item->PoLine.size()-2);
01230                      for (uint xx = item->PoLine.size()-1; xx > 0; xx -= 2)
01231                      {
01232                             FPoint Vector = item->PoLine.point(xx);
01233                             if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
01234                             {
01235                                    double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
01236                                    QWMatrix arrowTrans;
01237                                    FPointArray arrow = (*m_doc->arrowStyles.at(endArrowIndex-1)).points.copy();
01238                                    arrowTrans.translate(End.x(), End.y());
01239                                    arrowTrans.rotate(r);
01240                                    arrowTrans.scale( item->lineWidth(), item->lineWidth() );
01241                                    arrow.map(arrowTrans);
01242                                    painter->setBrush(painter->pen());
01243                                    painter->setBrushOpacity(1.0 - item->lineTransparency());
01244                                    painter->setLineWidth(0);
01245                                    painter->setFillMode(ScPainterExBase::Solid);
01246                                    painter->setupPolygon(&arrow);
01247                                    FillPath(item, painter, clip);
01248                                    break;
01249                             }
01250                      }
01251               }
01252        }
01253 }
01254 
01255 void ScPageOutput::DrawItem_TextFrame( PageItem_TextFrame* item, ScPainterExBase* painter, QRect& clip )
01256 {
01257        QWMatrix wm;
01258        QPoint pt1, pt2;
01259        FPoint ColBound;
01260        QRegion cm;
01261        int a;
01262        double lineCorr;
01263        QString chstr, chstr2, chstr3;
01264        ScText *hl;
01265        double desc, asce, tabDist;
01266        
01267        QRect e2;
01268        painter->save();
01269        if (item->isEmbedded)
01270               e2 = clip;
01271        else
01272        {
01273               e2 = QRect(qRound(clip.x() + m_doc->minCanvasCoordinate.x()), qRound(clip.y() + m_doc->minCanvasCoordinate.y()), qRound(clip.width()), qRound(clip.height()));
01274               wm.translate(item->xPos(), item->yPos());
01275        }
01276        wm.rotate(item->rotation());
01277        if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0))
01278        {
01279               painter->setupPolygon(&item->PoLine);
01280               FillPath(item, painter, clip);
01281        }
01282        if (item->lineColor() != CommonStrings::None)
01283               lineCorr = item->lineWidth() / 2.0;
01284        else
01285               lineCorr = 0;
01286        if ((item->isAnnotation()) && (item->annotation().Type() == 2) && (!item->Pfile.isEmpty()) && (item->PicAvail) && (item->imageShown()) && (item->annotation().UseIcons()))
01287        {
01288               painter->save();
01289               painter->setupPolygon(&item->PoLine);
01290               painter->setClipPath();
01291               painter->scale(item->imageXScale(), item->imageYScale());
01292               painter->translate(static_cast<int>(item->imageXOffset() * item->imageXScale()), static_cast<int>(item->imageYOffset()  * item->imageYScale()));
01293               if (!item->pixm.qImage().isNull())
01294                      painter->drawImage(&item->pixm, ScPainterExBase::rgbImages);
01295               painter->restore();
01296        }
01297        if ((item->itemText.length() != 0))
01298        {
01299               if (item->imageFlippedH())
01300               {
01301                      painter->translate(item->width(), 0);
01302                      painter->scale(-1, 1);
01303               }
01304               if (item->imageFlippedV())
01305               {
01306                      painter->translate(0, item->height());
01307                      painter->scale(1, -1);
01308               }
01309               uint tabCc = 0;
01310               for (uint ll=0; ll < item->itemText.lines(); ++ll)
01311               {
01312                      LineSpec ls = item->itemText.line(ll);
01313                      tabDist = ls.x;
01314                      double CurX = ls.x;
01315                      for (a = ls.firstItem; a <= ls.lastItem; ++a)
01316                      {
01317                             hl = item->itemText.item(a);
01318                             const CharStyle& charStyle = item->itemText.charStyle(a);
01319                             const ParagraphStyle& style = item->itemText.paragraphStyle(a);
01320                             double chs = charStyle.fontSize() * hl->glyph.scaleV;
01321                             if (charStyle.effects() & ScStyle_StartOfLine)
01322                                    tabCc = 0;
01323                             chstr = hl->ch;
01324                             if (charStyle.fillColor() != CommonStrings::None)
01325                             {
01326                                    ScColorShade tmp(m_doc->PageColors[charStyle.fillColor()], hl->fillShade());
01327                                    painter->setBrush(tmp);
01328                             }
01329                             if (charStyle.strokeColor() != CommonStrings::None)
01330                             {
01331                                    ScColorShade tmp(m_doc->PageColors[charStyle.strokeColor()], hl->strokeShade());
01332                                    painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
01333                             }
01334                             if (charStyle.effects() & ScStyle_DropCap)
01335                             {
01336                                    const ParagraphStyle& style(item->itemText.paragraphStyle(a));
01337                                    if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing)
01338                                           chs = qRound(10 * ((m_doc->typographicSettings.valueBaseGrid * (style.dropCapLines()-1) + (charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
01339                                    else
01340                                    {
01341                                           if (style.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
01342                                                  chs = qRound(10 * ((style.lineSpacing() * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
01343                                           else
01344                                           {
01345                                                  double currasce = charStyle.font().height(style.charStyle().fontSize() / 10.0);
01346                                                  chs = qRound(10 * ((currasce * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
01347                                           }
01348                                    }
01349                             }
01350                             if (chstr[0] == SpecialChars::TAB)
01351                                    tabCc++;
01352                             //if (!m_doc->RePos)
01353                             {
01354                                    double xcoZli = CurX + hl->glyph.xoffset;
01355                                    desc = - charStyle.font().descent(charStyle.fontSize() / 10.0);
01356                                    asce = charStyle.font().ascent(charStyle.fontSize() / 10.0);
01357                                    if (charStyle.strokeColor() != CommonStrings::None)
01358                                    {
01359                                           ScColorShade tmp(m_doc->PageColors[charStyle.strokeColor()], charStyle.strokeShade());
01360                                           painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
01361                                    }
01362                                    if (e2.intersects(wm.mapRect(QRect(qRound(CurX + hl->glyph.xoffset),qRound(ls.y + hl->glyph.yoffset-asce), qRound(hl->glyph.xadvance+1), qRound(asce+desc)))))
01363                                    {
01364                                           painter->save();
01365                                           painter->translate(CurX, ls.y);
01366                                           if (hl->ch[0] == SpecialChars::OBJECT)
01367                                                  DrawItem_Embedded(item, painter, clip, charStyle, hl->embedded.getItem());
01368                                           else
01369                                                  DrawGlyphs(item, painter, charStyle, hl->glyph, clip);
01370                                           painter->restore();
01371                                    }
01372                                    if (hl->ch[0] == SpecialChars::OBJECT)
01373                                           CurX += (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth());
01374                                    else
01375                                           CurX += hl->glyph.wide();
01376                             }
01377                             tabDist = CurX;
01378                      }
01379               }
01380        }
01381        painter->restore();
01382 }
01383 
01384 void ScPageOutput::DrawMarks( Page* page, ScPainterExBase* painter, const MarksOptions& options )
01385 {
01386        double markOffs  = options.markOffset;
01387        double bleedLeft = 0.0, bleedRight = 0.0;
01388        double bleedBottom = options.BleedBottom;
01389        double bleedTop = options.BleedTop;
01390        if (!options.cropMarks && !options.bleedMarks && !options.registrationMarks && !options.colorMarks)
01391               return;
01392        if (m_doc->locationOfPage(page->pageNr()) == LeftPage)
01393        {
01394               bleedRight = options.BleedRight;
01395               bleedLeft  = options.BleedLeft;
01396        }
01397        else if (m_doc->locationOfPage(page->pageNr()) == RightPage)
01398        {
01399               bleedRight = options.BleedLeft;
01400               bleedLeft  = options.BleedRight;
01401        }
01402        else
01403        {
01404               bleedRight = options.BleedLeft;
01405               bleedLeft  = options.BleedLeft;
01406        }
01407        double width = page->width();
01408        double height = page->height();
01409        double offsetX = page->xOffset();
01410        double offsetY = page->yOffset();
01411        painter->save();
01412        painter->setLineWidth(0.5);
01413        painter->setPen(ScColorShade(Qt::black, 100), 0.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin );
01414        if (options.cropMarks)
01415        {
01416               FPoint start, end;
01417               double left = offsetX, right = offsetX + width;
01418               double bottom = offsetY + height, top = offsetY;
01419               DrawBoxMarks( painter, FPoint(left, top), FPoint(right, bottom), markOffs );
01420        }
01421        if (options.bleedMarks)
01422        {
01423               FPoint start, end;
01424               double left = offsetX - bleedLeft, right = offsetX + width + bleedRight;
01425               double bottom = offsetY + height + bleedBottom, top = offsetY - bleedTop;;
01426               DrawBoxMarks( painter, FPoint(left, top), FPoint(right, bottom), markOffs );
01427        }
01428        if (options.registrationMarks)
01429        {
01430               double posX = (2* offsetX + width) / 2.0 - 7.0;
01431               double posY = (offsetY + height + bleedBottom + markOffs + 3.0);
01432               painter->save();
01433               painter->translate(posX, posY);
01434               DrawRegistrationCross( painter );
01435               painter->restore();
01436               posX = (2 * offsetX + width) / 2.0 - 7.0;
01437               posY = (offsetY - bleedTop - markOffs - 17);
01438               painter->save();
01439               painter->translate(posX, posY);
01440               DrawRegistrationCross( painter );
01441               painter->restore();
01442 
01443               posX = (offsetX - bleedLeft - markOffs - 17);
01444               posY = (2 * offsetY + height) / 2.0 - 7.0;
01445               painter->save();
01446               painter->translate(posX, posY);
01447               DrawRegistrationCross( painter );
01448               painter->restore();
01449               posX = (offsetX + width + bleedRight + markOffs + 3.0);
01450               posY = (2 * offsetY + height) / 2.0 - 7.0;
01451               painter->save();
01452               painter->translate(posX, posY);
01453               DrawRegistrationCross( painter );
01454               painter->restore();
01455        }
01456        if (options.colorMarks)
01457        {
01458               int shade = 100;
01459               double startX = offsetX + 6.0;
01460               double startY = offsetY - bleedTop - markOffs - 16.0;
01461               ScColorShade strokecolor( ScColor(0, 0, 0, 255), 100 );
01462               painter->setPen( strokecolor, 0.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin );
01463               painter->setFillMode( ScPainterExBase::Solid );
01464               for (int i = 0; i < 11; i++ )
01465               {
01466                      ScColorShade fillcolor( ScColor(0, 0, 0, 255), shade );
01467                      painter->setBrush( fillcolor );
01468                      painter->drawRect( startX + i * 14, startY, 14, 14 );
01469                      shade -= 10;
01470               }
01471               startX = offsetX + width - 20.0;
01472               painter->setBrush( ScColorShade(ScColor(0, 0, 0, 255), 50) );
01473               painter->drawRect( startX, startY, 14, 14 );
01474               startX -= 14;
01475               painter->setBrush( ScColorShade(ScColor(0, 0, 255, 0), 50) );
01476               painter->drawRect( startX, startY, 14, 14 );
01477               startX -= 14;
01478               painter->setBrush( ScColorShade(ScColor(0, 255, 0, 0), 50) );
01479               painter->drawRect( startX, startY, 14, 14 );
01480               startX -= 14;
01481               painter->setBrush( ScColorShade(ScColor(255, 0, 0, 0), 50) );
01482               painter->drawRect( startX, startY, 14, 14 );
01483               startX -= 14;
01484               painter->setBrush( ScColorShade(ScColor(255, 255, 0, 0), 100) );
01485               painter->drawRect( startX, startY, 14, 14 );
01486               startX -= 14;
01487               painter->setBrush( ScColorShade(ScColor(255, 0, 255, 0), 100) );
01488               painter->drawRect( startX, startY, 14, 14 );
01489               startX -= 14;
01490               painter->setBrush( ScColorShade(ScColor(0, 255, 255, 0), 100) );
01491               painter->drawRect( startX, startY, 14, 14 );
01492               startX -= 14;
01493               painter->setBrush( ScColorShade(ScColor(0, 0, 0, 255), 100) );
01494               painter->drawRect( startX, startY, 14, 14 );
01495               startX -= 14;
01496               painter->setBrush( ScColorShade(ScColor(0, 0, 255, 0), 100) );
01497               painter->drawRect( startX, startY, 14, 14 );
01498               startX -= 14;
01499               painter->setBrush( ScColorShade(ScColor(0, 255, 0, 0), 100) );
01500               painter->drawRect( startX, startY, 14, 14 );
01501               startX -= 14;
01502               painter->setBrush( ScColorShade(ScColor(255, 0, 0, 0), 100) );
01503               painter->drawRect( startX, startY, 14, 14 );
01504        }
01505        painter->restore();
01506 }
01507 
01508 void ScPageOutput::DrawBoxMarks( ScPainterExBase* painter, FPoint& topLeft, FPoint& bottomRight, double offset )
01509 {
01510        FPoint start, end;
01511        double left = topLeft.x(), right = bottomRight.x();
01512        double bottom = bottomRight.y(), top = topLeft.y();
01513        // Top Left
01514        start.setXY( left - offset, top );
01515        end.setXY  ( left - offset - 20, top );
01516        painter->drawLine(start, end);
01517        start.setXY( left, top - offset );
01518        end.setXY  ( left, top - offset - 20);
01519        painter->drawLine(start, end);
01520        // Top Right
01521        start.setXY( right + offset, top );
01522        end.setXY  ( right + offset + 20, top );
01523        painter->drawLine(start, end);
01524        start.setXY( right, top - offset );
01525        end.setXY  ( right, top - offset - 20);
01526        painter->drawLine(start, end);
01527        // Bottom Left
01528        start.setXY( left - offset, bottom );
01529        end.setXY  ( left - offset - 20, bottom  );
01530        painter->drawLine(start, end);
01531        start.setXY( left, bottom + offset );
01532        end.setXY  ( left, bottom + offset + 20);
01533        painter->drawLine(start, end);
01534        // Bottom Right
01535        start.setXY( right + offset, bottom );
01536        end.setXY  ( right + offset + 20, bottom  );
01537        painter->drawLine(start, end);
01538        start.setXY( right, bottom + offset );
01539        end.setXY  ( right, bottom + offset + 20);
01540        painter->drawLine(start, end);
01541 }
01542 
01543 void ScPageOutput::DrawRegistrationCross( ScPainterExBase* painter )
01544 {
01545        painter->save();
01546 
01547        painter->newPath();
01548        painter->moveTo(0.0, 7.0);
01549        painter->lineTo(14.0, 7.0);
01550        painter->strokePath();
01551 
01552        painter->newPath();
01553        painter->moveTo(7.0, 0.0);
01554        painter->lineTo(7.0, 14.0);
01555        painter->strokePath();
01556 
01557        painter->newPath();
01558        painter->moveTo(13.0, 7.0);
01559        painter->curveTo( FPoint(13.0, 10.31383), FPoint(10.31383, 13.0), FPoint(7.0, 13.0) );
01560        painter->curveTo( FPoint(3.68629, 13.0) , FPoint(1.0, 10.31383) , FPoint(1.0, 7.0) );
01561        painter->curveTo( FPoint(1.0, 3.68629)  , FPoint(3.68629, 1.0) , FPoint(7.0, 1.0) );
01562        painter->curveTo( FPoint(10.31383, 1.0) , FPoint(13.0, 3.68629) , FPoint(13.0, 7.0) );
01563        painter->strokePath();
01564 
01565        painter->newPath();
01566        painter->moveTo(10.5, 7.0);
01567        painter->curveTo( FPoint(10.5, 8.93307), FPoint(8.93307, 10.5), FPoint(7.0, 10.5) );
01568        painter->curveTo( FPoint(5.067, 10.5)  , FPoint(3.5, 8.93307) , FPoint(3.5, 7.0) );
01569        painter->curveTo( FPoint(3.5, 5.067)   , FPoint(5.067, 3.5)   , FPoint(7.0, 3.5) );
01570        painter->curveTo( FPoint(8.93307, 3.5) , FPoint(10.5, 5.067)  , FPoint(10.5, 7.0) );
01571        painter->strokePath();
01572 
01573        painter->restore();
01574 }
01575 
01576 void ScPageOutput::FillPath( PageItem* item, ScPainterExBase* painter, QRect& clip )
01577 {
01578        if( painter->fillMode() == ScPainterExBase::Pattern && !painter->hasCapability(ScPainterExBase::patterns) )
01579               DrawPattern( item, painter, clip );
01580        else
01581               painter->fillPath();
01582 }
01583 
01584 void ScPageOutput::StrokePath( PageItem* item, ScPainterExBase* painter, QRect& clip )
01585 {
01586        painter->strokePath();
01587 }
01588