LCOV - code coverage report
Current view: top level - test/source - mtfxmldump.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 97 326 29.8 %
Date: 2014-11-03 Functions: 12 17 70.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include <test/mtfxmldump.hxx>
      11             : #include <test/xmltesttools.hxx>
      12             : #include <test/xmlwriter.hxx>
      13             : 
      14             : #include <vcl/metaact.hxx>
      15             : #include <rtl/string.hxx>
      16             : #include <rtl/strbuf.hxx>
      17             : 
      18             : #include <boost/scoped_ptr.hpp>
      19             : 
      20             : namespace
      21             : {
      22             : 
      23             : const size_t constMaxActionType = 513;
      24             : 
      25           0 : OUString flagToString(PushFlags nFlag)
      26             : {
      27           0 :     if (nFlag & PushFlags::LINECOLOR)
      28           0 :         return OUString("PushLineColor");
      29           0 :     else if (nFlag & PushFlags::FILLCOLOR)
      30           0 :         return OUString("PushFillColor");
      31           0 :     else if (nFlag & PushFlags::FONT)
      32           0 :         return OUString("PushFont");
      33           0 :     else if (nFlag & PushFlags::TEXTCOLOR)
      34           0 :         return OUString("PushTextColor");
      35           0 :     else if (nFlag & PushFlags::MAPMODE)
      36           0 :         return OUString("PushMapMode");
      37           0 :     else if (nFlag & PushFlags::CLIPREGION)
      38           0 :         return OUString("PushClipRegion");
      39           0 :     else if (nFlag & PushFlags::RASTEROP)
      40           0 :         return OUString("PushRasterOp");
      41           0 :     else if (nFlag & PushFlags::TEXTFILLCOLOR)
      42           0 :         return OUString("PushTextFillColor");
      43           0 :     else if (nFlag & PushFlags::TEXTALIGN)
      44           0 :         return OUString("PushTextAlign");
      45           0 :     else if (nFlag & PushFlags::REFPOINT)
      46           0 :         return OUString("PushRefPoint");
      47           0 :     else if (nFlag & PushFlags::TEXTLINECOLOR)
      48           0 :         return OUString("PushTextLineColor");
      49           0 :     else if (nFlag & PushFlags::TEXTLAYOUTMODE)
      50           0 :         return OUString("PushTextLayoutMode");
      51           0 :     else if (nFlag & PushFlags::TEXTLANGUAGE)
      52           0 :         return OUString("PushTextLanguage");
      53           0 :     else if (nFlag & PushFlags::OVERLINECOLOR)
      54           0 :         return OUString("PushOverlineColor");
      55             : 
      56           0 :     return OUString();
      57             : }
      58             : 
      59           0 : OUString collectPushFlags(PushFlags nFlags)
      60             : {
      61           0 :     if ((nFlags & PushFlags::ALL) == nFlags)
      62           0 :         return OUString("PushAll");
      63           0 :     else if ((nFlags & PUSH_ALLFONT) == nFlags)
      64           0 :         return OUString("PushAllFont");
      65           0 :     else if ((nFlags & PUSH_ALLTEXT) == nFlags)
      66           0 :         return OUString("PushAllText");
      67             : 
      68           0 :     OUString sFlags;
      69             : 
      70           0 :     for (sal_uInt16 nFlag = 1; nFlag > 0; nFlag <<= 1)
      71             :     {
      72           0 :         OUString sFlag = flagToString(static_cast<PushFlags>(nFlag));
      73           0 :         if (!sFlag.isEmpty())
      74             :         {
      75           0 :             if (!sFlags.isEmpty())
      76             :             {
      77           0 :                 sFlags += ",";
      78             :             }
      79           0 :             sFlags += flagToString(static_cast<PushFlags>(nFlag));
      80             :         }
      81           0 :     }
      82             : 
      83           0 :     return sFlags;
      84             : }
      85             : 
      86           0 : OUString convertRopToString(RasterOp eRop)
      87             : {
      88           0 :     switch (eRop)
      89             :     {
      90           0 :         case ROP_OVERPAINT: return OUString("overpaint");
      91           0 :         case ROP_XOR:       return OUString("xor");
      92           0 :         case ROP_0:         return OUString("0");
      93           0 :         case ROP_1:         return OUString("1");
      94           0 :         case ROP_INVERT:    return OUString("invert");
      95             :     }
      96           0 :     return OUString();
      97             : }
      98             : 
      99           0 : OUString convertTextAlignToString(TextAlign eAlign)
     100             : {
     101           0 :     switch (eAlign)
     102             :     {
     103           0 :         case ALIGN_BASELINE:             return OUString("baseline");
     104           0 :         case ALIGN_BOTTOM:               return OUString("bottom");
     105           0 :         case ALIGN_TOP:                  return OUString("top");
     106           0 :         case TextAlign_FORCE_EQUAL_SIZE: return OUString("equalsize");
     107             :     }
     108           0 :     return OUString();
     109             : }
     110             : 
     111          32 : OUString convertColorToString(Color aColor)
     112             : {
     113          32 :     OUString aRGBString = aColor.AsRGBHexString();
     114          32 :     return "#" + aRGBString;
     115             : }
     116             : 
     117          84 : OUString convertLineStyleToString(LineStyle eAlign)
     118             : {
     119          84 :     switch (eAlign)
     120             :     {
     121          22 :         case LINE_NONE:    return OUString("none");
     122          62 :         case LINE_SOLID:   return OUString("solid");
     123           0 :         case LINE_DASH:    return OUString("dash");
     124           0 :         case LineStyle_FORCE_EQUAL_SIZE: return OUString("equalsize");
     125             :     }
     126           0 :     return OUString();
     127             : }
     128             : 
     129          16 : OUString convertFontWeigthToString(FontWeight eFontWeight)
     130             : {
     131             :     enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT,
     132             :                   WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL,
     133             :                   WEIGHT_MEDIUM, WEIGHT_SEMIBOLD, WEIGHT_BOLD,
     134             :                   WEIGHT_ULTRABOLD, WEIGHT_BLACK, FontWeight_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
     135          16 :     switch (eFontWeight)
     136             :     {
     137           0 :         case WEIGHT_DONTKNOW:   return OUString("unknown");
     138           0 :         case WEIGHT_THIN:       return OUString("thin");
     139           0 :         case WEIGHT_ULTRALIGHT: return OUString("ultralight");
     140           0 :         case WEIGHT_LIGHT:      return OUString("light");
     141           0 :         case WEIGHT_SEMILIGHT:  return OUString("semilight");
     142           8 :         case WEIGHT_NORMAL:     return OUString("normal");
     143           0 :         case WEIGHT_MEDIUM:     return OUString("medium");
     144           0 :         case WEIGHT_SEMIBOLD:   return OUString("semibold");
     145           8 :         case WEIGHT_BOLD:       return OUString("bold");
     146           0 :         case WEIGHT_ULTRABOLD:  return OUString("ultrabold");
     147           0 :         case WEIGHT_BLACK:      return OUString("black");
     148           0 :         case FontWeight_FORCE_EQUAL_SIZE:    return OUString("equalsize");
     149             :     }
     150           0 :     return OUString();
     151             : }
     152             : 
     153         138 : OString convertLineStyleToString(const sal_uInt16 nActionType)
     154             : {
     155         138 :     switch (nActionType)
     156             :     {
     157           0 :         case META_NULL_ACTION:                  return "null";
     158           0 :         case META_PIXEL_ACTION:                 return "pixel";
     159           0 :         case META_POINT_ACTION:                 return "point";
     160           0 :         case META_LINE_ACTION:                  return "line";
     161           0 :         case META_RECT_ACTION:                  return "rect";
     162           0 :         case META_ROUNDRECT_ACTION:             return "roundrect";
     163           0 :         case META_ELLIPSE_ACTION:               return "ellipse";
     164           0 :         case META_ARC_ACTION:                   return "arc";
     165           0 :         case META_PIE_ACTION:                   return "pie";
     166           0 :         case META_CHORD_ACTION:                 return "chord";
     167          84 :         case META_POLYLINE_ACTION:              return "polyline";
     168           0 :         case META_POLYGON_ACTION:               return "polygon";
     169           0 :         case META_POLYPOLYGON_ACTION:           return "polypolygon";
     170           0 :         case META_TEXT_ACTION:                  return "text";
     171           0 :         case META_TEXTARRAY_ACTION:             return "textarray";
     172           0 :         case META_STRETCHTEXT_ACTION:           return "strechtext";
     173           0 :         case META_TEXTRECT_ACTION:              return "textrect";
     174           0 :         case META_TEXTLINE_ACTION:              return "textline";
     175           0 :         case META_BMP_ACTION:                   return "bmp";
     176           0 :         case META_BMPSCALE_ACTION:              return "bmpscale";
     177           0 :         case META_BMPSCALEPART_ACTION:          return "bmpscalepart";
     178           0 :         case META_BMPEX_ACTION:                 return "bmpex";
     179           0 :         case META_BMPEXSCALE_ACTION:            return "bmpexscale";
     180           0 :         case META_BMPEXSCALEPART_ACTION:        return "bmpexscalepart";
     181           0 :         case META_MASK_ACTION:                  return "mask";
     182           0 :         case META_MASKSCALE_ACTION:             return "maskscale";
     183           0 :         case META_MASKSCALEPART_ACTION:         return "maskscalepart";
     184           0 :         case META_GRADIENT_ACTION:              return "gradient";
     185           0 :         case META_GRADIENTEX_ACTION:            return "gradientex";
     186           0 :         case META_HATCH_ACTION:                 return "hatch";
     187           0 :         case META_WALLPAPER_ACTION:             return "wallpaper";
     188          10 :         case META_CLIPREGION_ACTION:            return "clipregion";
     189          28 :         case META_ISECTRECTCLIPREGION_ACTION:   return "sectrectclipregion";
     190           0 :         case META_ISECTREGIONCLIPREGION_ACTION: return "sectregionclipregion";
     191           0 :         case META_MOVECLIPREGION_ACTION:        return "moveclipregion";
     192           0 :         case META_LINECOLOR_ACTION:             return "linecolor";
     193           0 :         case META_FILLCOLOR_ACTION:             return "fillcolor";
     194           0 :         case META_TEXTCOLOR_ACTION:             return "textcolor";
     195           0 :         case META_TEXTFILLCOLOR_ACTION:         return "textfillcolor";
     196           0 :         case META_TEXTLINECOLOR_ACTION:         return "textlinecolor";
     197           0 :         case META_OVERLINECOLOR_ACTION:         return "overlinecolor";
     198           0 :         case META_TEXTALIGN_ACTION:             return "textalign";
     199           0 :         case META_MAPMODE_ACTION:               return "mapmode";
     200          16 :         case META_FONT_ACTION:                  return "font";
     201           0 :         case META_PUSH_ACTION:                  return "push";
     202           0 :         case META_POP_ACTION:                   return "pop";
     203           0 :         case META_RASTEROP_ACTION:              return "rasterop";
     204           0 :         case META_TRANSPARENT_ACTION:           return "transparent";
     205           0 :         case META_FLOATTRANSPARENT_ACTION:      return "floattransparent";
     206           0 :         case META_EPS_ACTION:                   return "eps";
     207           0 :         case META_REFPOINT_ACTION:              return "refpoint";
     208           0 :         case META_COMMENT_ACTION:               return "comment";
     209           0 :         case META_LAYOUTMODE_ACTION:            return "layoutmode";
     210           0 :         case META_TEXTLANGUAGE_ACTION:          return "textlanguage";
     211             :     }
     212           0 :     return "";
     213             : }
     214             : 
     215             : } // anonymous namespace
     216             : 
     217          10 : MetafileXmlDump::MetafileXmlDump() :
     218          10 :     maFilter(constMaxActionType, false)
     219          10 : {}
     220             : 
     221          10 : MetafileXmlDump::~MetafileXmlDump()
     222          10 : {}
     223             : 
     224          10 : void MetafileXmlDump::filterActionType(const sal_uInt16 nActionType, bool bShouldFilter)
     225             : {
     226          10 :     maFilter[nActionType] = bShouldFilter;
     227          10 : }
     228             : 
     229          10 : void MetafileXmlDump::filterAllActionTypes()
     230             : {
     231          10 :     maFilter.assign(constMaxActionType, true);
     232          10 : }
     233             : 
     234          10 : xmlDocPtr MetafileXmlDump::dumpAndParse(GDIMetaFile& rMetaFile, const OUString& rTempStreamName)
     235             : {
     236          10 :     boost::scoped_ptr<SvStream> pStream;
     237             : 
     238          10 :     if (rTempStreamName.isEmpty())
     239          10 :         pStream.reset(new SvMemoryStream());
     240             :     else
     241           0 :         pStream.reset(new SvFileStream(rTempStreamName, STREAM_STD_READWRITE | STREAM_TRUNC));
     242             : 
     243          20 :     XmlWriter aWriter(pStream.get());
     244          10 :     aWriter.startDocument();
     245          10 :     aWriter.startElement("metafile");
     246             : 
     247          10 :     writeXml(rMetaFile, aWriter);
     248             : 
     249          10 :     aWriter.endElement();
     250          10 :     aWriter.endDocument();
     251             : 
     252          10 :     pStream->Seek(STREAM_SEEK_TO_BEGIN);
     253             : 
     254          10 :     xmlDocPtr pDoc = XmlTestTools::parseXmlStream(pStream.get());
     255             : 
     256          20 :     return pDoc;
     257             : }
     258             : 
     259          10 : void MetafileXmlDump::writeXml(GDIMetaFile& rMetaFile, XmlWriter& rWriter)
     260             : {
     261        2268 :     for(MetaAction* pAction = rMetaFile.FirstAction(); pAction != NULL; pAction = rMetaFile.NextAction())
     262             :     {
     263        2258 :         const sal_uInt16 nActionType = pAction->GetType();
     264        2258 :         if (maFilter[nActionType])
     265        2120 :             continue;
     266             : 
     267         138 :         OString sCurrentElementTag = convertLineStyleToString(nActionType);
     268             : 
     269         138 :         switch (nActionType)
     270             :         {
     271             :             case META_LINE_ACTION:
     272             :             {
     273           0 :                 MetaLineAction* pMetaLineAction = static_cast<MetaLineAction*>(pAction);
     274           0 :                 rWriter.startElement(sCurrentElementTag);
     275             : 
     276           0 :                 rWriter.attribute("startx", pMetaLineAction->GetStartPoint().X());
     277           0 :                 rWriter.attribute("starty", pMetaLineAction->GetStartPoint().Y());
     278           0 :                 rWriter.attribute("endx", pMetaLineAction->GetEndPoint().X());
     279           0 :                 rWriter.attribute("endy", pMetaLineAction->GetEndPoint().Y());
     280             : 
     281           0 :                 LineInfo aLineInfo = pMetaLineAction->GetLineInfo();
     282           0 :                 rWriter.attribute("style", convertLineStyleToString(aLineInfo.GetStyle()));
     283           0 :                 rWriter.attribute("width", aLineInfo.GetWidth());
     284           0 :                 rWriter.attribute("dashlen", aLineInfo.GetDashLen());
     285           0 :                 rWriter.attribute("dotlen", aLineInfo.GetDotLen());
     286           0 :                 rWriter.attribute("distance", aLineInfo.GetDistance());
     287             : 
     288           0 :                 rWriter.endElement();
     289             :             }
     290           0 :             break;
     291             : 
     292             :             case META_PUSH_ACTION:
     293             :             {
     294           0 :                 MetaPushAction* pMetaPushAction = static_cast<MetaPushAction*>(pAction);
     295           0 :                 rWriter.startElement(sCurrentElementTag);
     296             : 
     297           0 :                 rWriter.attribute("flags", collectPushFlags(pMetaPushAction->GetFlags()));
     298             :             }
     299           0 :             break;
     300             : 
     301             :             case META_POP_ACTION:
     302             :             {
     303           0 :                 rWriter.endElement();
     304             :             }
     305           0 :             break;
     306             : 
     307             :             case META_RASTEROP_ACTION:
     308             :             {
     309           0 :                 MetaRasterOpAction* pMetaRasterOpAction = static_cast<MetaRasterOpAction*>(pAction);
     310           0 :                 rWriter.startElement(sCurrentElementTag);
     311             : 
     312           0 :                 if (pMetaRasterOpAction->GetRasterOp() != ROP_OVERPAINT)
     313             :                 {
     314           0 :                     rWriter.attribute("operation", convertRopToString(pMetaRasterOpAction->GetRasterOp()));
     315             :                 }
     316           0 :                 rWriter.endElement();
     317             :             }
     318           0 :             break;
     319             : 
     320             :             case META_TEXTLINECOLOR_ACTION:
     321             :             {
     322           0 :                 MetaTextLineColorAction* pMetaTextLineColorAction = static_cast<MetaTextLineColorAction*>(pAction);
     323           0 :                 rWriter.startElement(sCurrentElementTag);
     324             : 
     325           0 :                 rWriter.attribute("color", convertColorToString(pMetaTextLineColorAction->GetColor()));
     326           0 :                 rWriter.endElement();
     327             :             }
     328           0 :             break;
     329             : 
     330             :             case META_TEXTFILLCOLOR_ACTION:
     331             :             {
     332           0 :                 MetaTextFillColorAction* pMetaTextFillColorAction = static_cast<MetaTextFillColorAction*>(pAction);
     333           0 :                 rWriter.startElement(sCurrentElementTag);
     334             : 
     335           0 :                 rWriter.attribute("color", convertColorToString(pMetaTextFillColorAction->GetColor()));
     336             : 
     337           0 :                 if (pMetaTextFillColorAction->IsSetting())
     338           0 :                     rWriter.attribute("setting", OUString("true"));
     339             : 
     340           0 :                 rWriter.endElement();
     341             :             }
     342           0 :             break;
     343             : 
     344             :             case META_FONT_ACTION:
     345             :             {
     346          16 :                 MetaFontAction* pMetaFontAction = static_cast<MetaFontAction*>(pAction);
     347          16 :                 rWriter.startElement(sCurrentElementTag);
     348             : 
     349          16 :                 vcl::Font aFont = pMetaFontAction->GetFont();
     350             : 
     351          16 :                 rWriter.attribute("color", convertColorToString(aFont.GetColor()));
     352          16 :                 rWriter.attribute("fillcolor", convertColorToString(aFont.GetFillColor()));
     353          16 :                 rWriter.attribute("name", aFont.GetName());
     354          16 :                 rWriter.attribute("stylename", aFont.GetStyleName());
     355          16 :                 rWriter.attribute("width", aFont.GetSize().Width());
     356          16 :                 rWriter.attribute("height", aFont.GetSize().Height());
     357          16 :                 rWriter.attribute("orientation", aFont.GetOrientation());
     358          16 :                 rWriter.attribute("weight", convertFontWeigthToString(aFont.GetWeight()));
     359             : 
     360          16 :                 rWriter.endElement();
     361             :             }
     362          16 :             break;
     363             : 
     364             :             case META_TEXTALIGN_ACTION:
     365             :             {
     366           0 :                 MetaTextAlignAction* pMetaTextAlignAction = static_cast<MetaTextAlignAction*>(pAction);
     367           0 :                 rWriter.startElement(sCurrentElementTag);
     368           0 :                 OUString sAlign = convertTextAlignToString(pMetaTextAlignAction->GetTextAlign());
     369           0 :                 if (!sAlign.isEmpty())
     370           0 :                     rWriter.attribute("align", sAlign);
     371           0 :                 rWriter.endElement();
     372             :             }
     373           0 :             break;
     374             : 
     375             :             case META_TEXTCOLOR_ACTION:
     376             :             {
     377           0 :                 MetaTextColorAction* pMetaTextColorAction = static_cast<MetaTextColorAction*>(pAction);
     378           0 :                 rWriter.startElement(sCurrentElementTag);
     379             : 
     380           0 :                 rWriter.attribute("color", convertColorToString(pMetaTextColorAction->GetColor()));
     381           0 :                 rWriter.endElement();
     382             :             }
     383           0 :             break;
     384             : 
     385             :             case META_TEXTARRAY_ACTION:
     386             :             {
     387           0 :                 MetaTextArrayAction* pMetaTextArrayAction = static_cast<MetaTextArrayAction*>(pAction);
     388           0 :                 rWriter.startElement(sCurrentElementTag);
     389             : 
     390           0 :                 sal_Int32 aIndex = pMetaTextArrayAction->GetIndex();
     391           0 :                 sal_Int32 aLength = pMetaTextArrayAction->GetLen();
     392             : 
     393           0 :                 rWriter.attribute("x", pMetaTextArrayAction->GetPoint().X());
     394           0 :                 rWriter.attribute("y", pMetaTextArrayAction->GetPoint().Y());
     395           0 :                 rWriter.attribute("index", aIndex);
     396           0 :                 rWriter.attribute("length", aLength);
     397             : 
     398           0 :                 rWriter.startElement("dxarray");
     399           0 :                 OUString sDxLengthString;
     400           0 :                 for (sal_Int32 i = 0; i < aLength; ++i)
     401             :                 {
     402           0 :                     sDxLengthString += OUString::number(pMetaTextArrayAction->GetDXArray()[aIndex+i]);
     403           0 :                     sDxLengthString += " ";
     404             :                 }
     405           0 :                 rWriter.content(sDxLengthString);
     406           0 :                 rWriter.endElement();
     407             : 
     408           0 :                 rWriter.startElement("text");
     409           0 :                 rWriter.content(pMetaTextArrayAction->GetText());
     410           0 :                 rWriter.endElement();
     411             : 
     412           0 :                 rWriter.endElement();
     413             :             }
     414           0 :             break;
     415             : 
     416             :             case META_LINECOLOR_ACTION:
     417             :             {
     418           0 :                 MetaLineColorAction* pMetaLineColorAction = static_cast<MetaLineColorAction*>(pAction);
     419           0 :                 rWriter.startElement(sCurrentElementTag);
     420             : 
     421           0 :                 rWriter.attribute("color", convertColorToString(pMetaLineColorAction->GetColor()));
     422           0 :                 rWriter.endElement();
     423             :             }
     424           0 :             break;
     425             : 
     426             :             case META_FILLCOLOR_ACTION:
     427             :             {
     428           0 :                 MetaFillColorAction* pMetaFillColorAction = static_cast<MetaFillColorAction*>(pAction);
     429           0 :                 rWriter.startElement(sCurrentElementTag);
     430             : 
     431           0 :                 rWriter.attribute("color", convertColorToString(pMetaFillColorAction->GetColor()));
     432           0 :                 rWriter.endElement();
     433             :             }
     434           0 :             break;
     435             : 
     436             :             case META_CLIPREGION_ACTION:
     437             :             {
     438          10 :                 const MetaClipRegionAction* pA = static_cast< const MetaClipRegionAction* >(pAction);
     439          10 :                 rWriter.startElement(sCurrentElementTag);
     440             : 
     441             :                 // FIXME for now we dump only the bounding box; this is
     442             :                 // enough for the tests we have, but may need extending to
     443             :                 // dumping the real polypolygon in the future
     444          10 :                 Rectangle aRectangle = pA->GetRegion().GetBoundRect();
     445          10 :                 rWriter.attribute("top",    aRectangle.Top());
     446          10 :                 rWriter.attribute("left",   aRectangle.Left());
     447          10 :                 rWriter.attribute("bottom", aRectangle.Bottom());
     448          10 :                 rWriter.attribute("right",  aRectangle.Right());
     449             : 
     450          10 :                 rWriter.endElement();
     451             :             }
     452          10 :             break;
     453             : 
     454             :             case META_ISECTRECTCLIPREGION_ACTION:
     455             :             {
     456          28 :                 MetaISectRectClipRegionAction* pMetaISectRectClipRegionAction = static_cast<MetaISectRectClipRegionAction*>(pAction);
     457          28 :                 rWriter.startElement(sCurrentElementTag);
     458             : 
     459          28 :                 Rectangle aRectangle = pMetaISectRectClipRegionAction->GetRect();
     460          28 :                 rWriter.attribute("top",    aRectangle.Top());
     461          28 :                 rWriter.attribute("left",   aRectangle.Left());
     462          28 :                 rWriter.attribute("bottom", aRectangle.Bottom());
     463          28 :                 rWriter.attribute("right",  aRectangle.Right());
     464             : 
     465          28 :                 rWriter.endElement();
     466             :             }
     467          28 :             break;
     468             : 
     469             :             case META_POLYLINE_ACTION:
     470             :             {
     471          84 :                 MetaPolyLineAction* pMetaPolyLineAction = static_cast<MetaPolyLineAction*>(pAction);
     472          84 :                 rWriter.startElement(sCurrentElementTag);
     473             : 
     474          84 :                 Polygon aPolygon = pMetaPolyLineAction->GetPolygon();
     475         346 :                 for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
     476             :                 {
     477         262 :                     rWriter.startElement("point");
     478         262 :                     rWriter.attribute("x", aPolygon[i].X());
     479         262 :                     rWriter.attribute("y", aPolygon[i].Y());
     480         262 :                     rWriter.endElement();
     481             :                 }
     482             : 
     483         168 :                 LineInfo aLineInfo = pMetaPolyLineAction->GetLineInfo();
     484          84 :                 rWriter.attribute("style", convertLineStyleToString(aLineInfo.GetStyle()));
     485          84 :                 rWriter.attribute("width", aLineInfo.GetWidth());
     486          84 :                 rWriter.attribute("dashlen", aLineInfo.GetDashLen());
     487          84 :                 rWriter.attribute("dotlen", aLineInfo.GetDotLen());
     488          84 :                 rWriter.attribute("distance", aLineInfo.GetDistance());
     489             : 
     490         168 :                 rWriter.endElement();
     491             :             }
     492          84 :             break;
     493             : 
     494             :             case META_POLYGON_ACTION:
     495             :             {
     496           0 :                 MetaPolygonAction* pMetaPolygonAction = static_cast<MetaPolygonAction*>(pAction);
     497           0 :                 rWriter.startElement(sCurrentElementTag);
     498             : 
     499           0 :                 Polygon aPolygon = pMetaPolygonAction->GetPolygon();
     500           0 :                 for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
     501             :                 {
     502           0 :                     rWriter.startElement("point");
     503           0 :                     rWriter.attribute("x", aPolygon[i].X());
     504           0 :                     rWriter.attribute("y", aPolygon[i].Y());
     505           0 :                     rWriter.endElement();
     506             :                 }
     507             : 
     508           0 :                 rWriter.endElement();
     509             :             }
     510           0 :             break;
     511             : 
     512             :             case META_COMMENT_ACTION:
     513             :             {
     514           0 :                 MetaCommentAction* pMetaCommentAction = static_cast<MetaCommentAction*>(pAction);
     515           0 :                 rWriter.startElement(sCurrentElementTag);
     516             : 
     517           0 :                 if (pMetaCommentAction->GetDataSize() > 0)
     518             :                 {
     519           0 :                     rWriter.attribute("datasize", pMetaCommentAction->GetDataSize());
     520             :                 }
     521           0 :                 if (!pMetaCommentAction->GetComment().isEmpty())
     522             :                 {
     523           0 :                     rWriter.startElement("comment");
     524           0 :                     rWriter.content(pMetaCommentAction->GetComment());
     525           0 :                     rWriter.endElement();
     526             :                 }
     527             : 
     528           0 :                 rWriter.endElement();
     529             :             }
     530           0 :             break;
     531             : 
     532             :             default:
     533             :             {
     534           0 :                 rWriter.element(sCurrentElementTag);
     535             :             }
     536           0 :             break;
     537             :         }
     538         138 :     }
     539         652 : }
     540             : 
     541             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10