1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <vcl/mtfxmldump.hxx>
11 #include <tools/XmlWriter.hxx>
12 #include <tools/fract.hxx>
14 #include <vcl/metaact.hxx>
15 #include <vcl/outdev.hxx>
16 #include <rtl/string.hxx>
17 #include <rtl/ustrbuf.hxx>
24 OUString
collectPushFlags(PushFlags nFlags
)
26 if ((nFlags
& PushFlags::ALL
) == PushFlags::ALL
)
28 else if ((nFlags
& PUSH_ALLFONT
) == PUSH_ALLFONT
)
30 else if ((nFlags
& PUSH_ALLTEXT
) == PUSH_ALLTEXT
)
33 std::vector
<OUString
> aStrings
;
35 if (nFlags
& PushFlags::LINECOLOR
)
36 aStrings
.emplace_back("PushLineColor");
37 if (nFlags
& PushFlags::FILLCOLOR
)
38 aStrings
.emplace_back("PushFillColor");
39 if (nFlags
& PushFlags::FONT
)
40 aStrings
.emplace_back("PushFont");
41 if (nFlags
& PushFlags::TEXTCOLOR
)
42 aStrings
.emplace_back("PushTextColor");
43 if (nFlags
& PushFlags::MAPMODE
)
44 aStrings
.emplace_back("PushMapMode");
45 if (nFlags
& PushFlags::CLIPREGION
)
46 aStrings
.emplace_back("PushClipRegion");
47 if (nFlags
& PushFlags::RASTEROP
)
48 aStrings
.emplace_back("PushRasterOp");
49 if (nFlags
& PushFlags::TEXTFILLCOLOR
)
50 aStrings
.emplace_back("PushTextFillColor");
51 if (nFlags
& PushFlags::TEXTALIGN
)
52 aStrings
.emplace_back("PushTextAlign");
53 if (nFlags
& PushFlags::REFPOINT
)
54 aStrings
.emplace_back("PushRefPoint");
55 if (nFlags
& PushFlags::TEXTLINECOLOR
)
56 aStrings
.emplace_back("PushTextLineColor");
57 if (nFlags
& PushFlags::TEXTLAYOUTMODE
)
58 aStrings
.emplace_back("PushTextLayoutMode");
59 if (nFlags
& PushFlags::TEXTLANGUAGE
)
60 aStrings
.emplace_back("PushTextLanguage");
61 if (nFlags
& PushFlags::OVERLINECOLOR
)
62 aStrings
.emplace_back("PushOverlineColor");
69 aString
= aStrings
[0];
70 for (size_t i
= 1; i
< aStrings
.size(); ++i
)
72 aString
+= ", " + aStrings
[i
];
77 OUString
convertDrawTextFlagsToString(DrawTextFlags eDrawTextFlags
)
79 std::vector
<OUString
> aStrings
;
80 if (eDrawTextFlags
& DrawTextFlags::Disable
)
81 aStrings
.emplace_back("Disable");
82 if (eDrawTextFlags
& DrawTextFlags::Mnemonic
)
83 aStrings
.emplace_back("Mnemonic");
84 if (eDrawTextFlags
& DrawTextFlags::Mono
)
85 aStrings
.emplace_back("Mono");
86 if (eDrawTextFlags
& DrawTextFlags::Clip
)
87 aStrings
.emplace_back("Clip");
88 if (eDrawTextFlags
& DrawTextFlags::Left
)
89 aStrings
.emplace_back("Left");
90 if (eDrawTextFlags
& DrawTextFlags::Center
)
91 aStrings
.emplace_back("Center");
92 if (eDrawTextFlags
& DrawTextFlags::Right
)
93 aStrings
.emplace_back("Right");
94 if (eDrawTextFlags
& DrawTextFlags::Top
)
95 aStrings
.emplace_back("Top");
96 if (eDrawTextFlags
& DrawTextFlags::VCenter
)
97 aStrings
.emplace_back("VCenter");
98 if (eDrawTextFlags
& DrawTextFlags::Bottom
)
99 aStrings
.emplace_back("Bottom");
100 if (eDrawTextFlags
& DrawTextFlags::EndEllipsis
)
101 aStrings
.emplace_back("EndEllipsis");
102 if (eDrawTextFlags
& DrawTextFlags::PathEllipsis
)
103 aStrings
.emplace_back("PathEllipsis");
104 if (eDrawTextFlags
& DrawTextFlags::MultiLine
)
105 aStrings
.emplace_back("MultiLine");
106 if (eDrawTextFlags
& DrawTextFlags::WordBreak
)
107 aStrings
.emplace_back("WordBreak");
108 if (eDrawTextFlags
& DrawTextFlags::NewsEllipsis
)
109 aStrings
.emplace_back("NewsEllipsis");
110 if (eDrawTextFlags
& DrawTextFlags::WordBreakHyphenation
)
111 aStrings
.emplace_back("WordBreakHyphenation");
112 if (eDrawTextFlags
& DrawTextFlags::CenterEllipsis
)
113 aStrings
.emplace_back("CenterEllipsis");
114 if (eDrawTextFlags
& DrawTextFlags::HideMnemonic
)
115 aStrings
.emplace_back("HideMnemonic");
119 if (aStrings
.empty())
122 aString
= aStrings
[0];
123 for (size_t i
= 1; i
< aStrings
.size(); ++i
)
125 aString
+= " " + aStrings
[i
];
130 OUString
convertRopToString(RasterOp eRop
)
134 case RasterOp::OverPaint
: return "overpaint";
135 case RasterOp::Xor
: return "xor";
136 case RasterOp::N0
: return "0";
137 case RasterOp::N1
: return "1";
138 case RasterOp::Invert
: return "invert";
143 OUString
convertTextAlignToString(TextAlign eAlign
)
147 case ALIGN_BASELINE
: return "baseline";
148 case ALIGN_BOTTOM
: return "bottom";
149 case ALIGN_TOP
: return "top";
150 case TextAlign_FORCE_EQUAL_SIZE
: return "equalsize";
155 OUString
convertColorToString(Color aColor
)
157 OUString aRGBString
= aColor
.AsRGBHexString();
158 return "#" + aRGBString
;
161 OUString
convertLineStyleToString(LineStyle eAlign
)
165 case LineStyle::NONE
: return "none";
166 case LineStyle::Solid
: return "solid";
167 case LineStyle::Dash
: return "dash";
173 OUString
convertLineJoinToString(basegfx::B2DLineJoin eJoin
)
178 case basegfx::B2DLineJoin::NONE
: return "none";
179 case basegfx::B2DLineJoin::Bevel
: return "bevel";
180 case basegfx::B2DLineJoin::Miter
: return "miter";
181 case basegfx::B2DLineJoin::Round
: return "round";
185 OUString
convertLineCapToString(css::drawing::LineCap eCap
)
190 case css::drawing::LineCap_BUTT
: return "butt";
191 case css::drawing::LineCap_ROUND
: return "round";
192 case css::drawing::LineCap_SQUARE
: return "square";
196 OUString
convertPolygonFlags(PolyFlags eFlags
)
201 case PolyFlags::Normal
: return "normal";
202 case PolyFlags::Control
: return "control";
203 case PolyFlags::Smooth
: return "smooth";
204 case PolyFlags::Symmetric
: return "symmetric";
208 OUString
convertFontWeightToString(FontWeight eFontWeight
)
212 case WEIGHT_DONTKNOW
: return "unknown";
213 case WEIGHT_THIN
: return "thin";
214 case WEIGHT_ULTRALIGHT
: return "ultralight";
215 case WEIGHT_LIGHT
: return "light";
216 case WEIGHT_SEMILIGHT
: return "semilight";
217 case WEIGHT_NORMAL
: return "normal";
218 case WEIGHT_MEDIUM
: return "medium";
219 case WEIGHT_SEMIBOLD
: return "semibold";
220 case WEIGHT_BOLD
: return "bold";
221 case WEIGHT_ULTRABOLD
: return "ultrabold";
222 case WEIGHT_BLACK
: return "black";
223 case FontWeight_FORCE_EQUAL_SIZE
: return "equalsize";
228 OUString
convertFontStrikeoutToString(FontStrikeout eFontStrikeout
)
230 switch (eFontStrikeout
)
232 case STRIKEOUT_NONE
: return "none";
233 case STRIKEOUT_SINGLE
: return "single";
234 case STRIKEOUT_DOUBLE
: return "double";
235 case STRIKEOUT_DONTKNOW
: return "dontknow";
236 case STRIKEOUT_BOLD
: return "bold";
237 case STRIKEOUT_SLASH
: return "slash";
238 case STRIKEOUT_X
: return "x";
239 case FontStrikeout_FORCE_EQUAL_SIZE
: return "equalsize";
244 OUString
convertFontLineStyleToString(FontLineStyle eFontLineStyle
)
246 switch (eFontLineStyle
)
248 case LINESTYLE_NONE
: return "none";
249 case LINESTYLE_SINGLE
: return "single";
250 case LINESTYLE_DOUBLE
: return "double";
251 case LINESTYLE_DOTTED
: return "dotted";
252 case LINESTYLE_DONTKNOW
: return "dontknow";
253 case LINESTYLE_DASH
: return "dash";
254 case LINESTYLE_LONGDASH
: return "longdash";
255 case LINESTYLE_DASHDOT
: return "dashdot";
256 case LINESTYLE_DASHDOTDOT
: return "dashdotdot";
257 case LINESTYLE_SMALLWAVE
: return "smallwave";
258 case LINESTYLE_WAVE
: return "wave";
259 case LINESTYLE_DOUBLEWAVE
: return "doublewave";
260 case LINESTYLE_BOLD
: return "bold";
261 case LINESTYLE_BOLDDOTTED
: return "bolddotted";
262 case LINESTYLE_BOLDDASH
: return "bolddash";
263 case LINESTYLE_BOLDLONGDASH
: return "boldlongdash";
264 case LINESTYLE_BOLDDASHDOT
: return "bolddashdot";
265 case LINESTYLE_BOLDDASHDOTDOT
: return "bolddashdotdot";
266 case LINESTYLE_BOLDWAVE
: return "boldwave";
267 case FontLineStyle_FORCE_EQUAL_SIZE
: return "equalsize";
272 OString
convertLineStyleToString(const MetaActionType nActionType
)
276 case MetaActionType::NONE
: return "null";
277 case MetaActionType::PIXEL
: return "pixel";
278 case MetaActionType::POINT
: return "point";
279 case MetaActionType::LINE
: return "line";
280 case MetaActionType::RECT
: return "rect";
281 case MetaActionType::ROUNDRECT
: return "roundrect";
282 case MetaActionType::ELLIPSE
: return "ellipse";
283 case MetaActionType::ARC
: return "arc";
284 case MetaActionType::PIE
: return "pie";
285 case MetaActionType::CHORD
: return "chord";
286 case MetaActionType::POLYLINE
: return "polyline";
287 case MetaActionType::POLYGON
: return "polygon";
288 case MetaActionType::POLYPOLYGON
: return "polypolygon";
289 case MetaActionType::TEXT
: return "text";
290 case MetaActionType::TEXTARRAY
: return "textarray";
291 case MetaActionType::STRETCHTEXT
: return "stretchtext";
292 case MetaActionType::TEXTRECT
: return "textrect";
293 case MetaActionType::TEXTLINE
: return "textline";
294 case MetaActionType::BMP
: return "bmp";
295 case MetaActionType::BMPSCALE
: return "bmpscale";
296 case MetaActionType::BMPSCALEPART
: return "bmpscalepart";
297 case MetaActionType::BMPEX
: return "bmpex";
298 case MetaActionType::BMPEXSCALE
: return "bmpexscale";
299 case MetaActionType::BMPEXSCALEPART
: return "bmpexscalepart";
300 case MetaActionType::MASK
: return "mask";
301 case MetaActionType::MASKSCALE
: return "maskscale";
302 case MetaActionType::MASKSCALEPART
: return "maskscalepart";
303 case MetaActionType::GRADIENT
: return "gradient";
304 case MetaActionType::GRADIENTEX
: return "gradientex";
305 case MetaActionType::HATCH
: return "hatch";
306 case MetaActionType::WALLPAPER
: return "wallpaper";
307 case MetaActionType::CLIPREGION
: return "clipregion";
308 case MetaActionType::ISECTRECTCLIPREGION
: return "sectrectclipregion";
309 case MetaActionType::ISECTREGIONCLIPREGION
: return "sectregionclipregion";
310 case MetaActionType::MOVECLIPREGION
: return "moveclipregion";
311 case MetaActionType::LINECOLOR
: return "linecolor";
312 case MetaActionType::FILLCOLOR
: return "fillcolor";
313 case MetaActionType::TEXTCOLOR
: return "textcolor";
314 case MetaActionType::TEXTFILLCOLOR
: return "textfillcolor";
315 case MetaActionType::TEXTLINECOLOR
: return "textlinecolor";
316 case MetaActionType::OVERLINECOLOR
: return "overlinecolor";
317 case MetaActionType::TEXTALIGN
: return "textalign";
318 case MetaActionType::MAPMODE
: return "mapmode";
319 case MetaActionType::FONT
: return "font";
320 case MetaActionType::PUSH
: return "push";
321 case MetaActionType::POP
: return "pop";
322 case MetaActionType::RASTEROP
: return "rasterop";
323 case MetaActionType::Transparent
: return "transparent";
324 case MetaActionType::FLOATTRANSPARENT
: return "floattransparent";
325 case MetaActionType::EPS
: return "eps";
326 case MetaActionType::REFPOINT
: return "refpoint";
327 case MetaActionType::COMMENT
: return "comment";
328 case MetaActionType::LAYOUTMODE
: return "layoutmode";
329 case MetaActionType::TEXTLANGUAGE
: return "textlanguage";
334 OUString
convertBitmapExTransparentType(BitmapEx
const & rBitmapEx
)
336 if (rBitmapEx
.IsAlpha())
342 OUString
convertMapUnitToString(MapUnit eUnit
)
347 case MapUnit::LASTENUMDUMMY
: return "LASTENUMDUMMY";
348 case MapUnit::Map1000thInch
: return "Map1000thInch";
349 case MapUnit::Map100thInch
: return "Map100thInch";
350 case MapUnit::Map100thMM
: return "Map100thMM";
351 case MapUnit::Map10thInch
: return "Map10thInch";
352 case MapUnit::Map10thMM
: return "Map10thMM";
353 case MapUnit::MapAppFont
: return "MapAppFont";
354 case MapUnit::MapCM
: return "MapCM";
355 case MapUnit::MapInch
: return "MapInch";
356 case MapUnit::MapMM
: return "MapMM";
357 case MapUnit::MapPixel
: return "MapPixel";
358 case MapUnit::MapPoint
: return "MapPoint";
359 case MapUnit::MapRelative
: return "MapRelative";
360 case MapUnit::MapSysFont
: return "MapSysFont";
361 case MapUnit::MapTwip
: return "MapTwip";
365 OUString
convertFractionToString(const Fraction
& aFraction
)
367 std::stringstream ss
;
371 return OUString::createFromAscii(ss
.str().c_str());
374 OUString
convertGradientStyle(GradientStyle eStyle
)
378 case GradientStyle::Linear
: return "Linear";
379 case GradientStyle::Axial
: return "Axial";
380 case GradientStyle::Radial
: return "Radial";
381 case GradientStyle::Elliptical
: return "Elliptical";
382 case GradientStyle::Square
: return "Square";
383 case GradientStyle::Rect
: return "Rect";
384 case GradientStyle::FORCE_EQUAL_SIZE
: return "ForceEqualSize";
389 OUString
convertHatchStyle(HatchStyle eStyle
)
393 case HatchStyle::Single
: return "Single";
394 case HatchStyle::Double
: return "Double";
395 case HatchStyle::Triple
: return "Triple";
396 case HatchStyle::FORCE_EQUAL_SIZE
: return "ForceEqualSize";
401 OUString
convertWallpaperStyleToString(WallpaperStyle eWallpaperStyle
)
403 switch (eWallpaperStyle
)
405 case WallpaperStyle::NONE
: return "NONE";
406 case WallpaperStyle::Tile
: return "Tile";
407 case WallpaperStyle::Center
: return "Center";
408 case WallpaperStyle::Scale
: return "Scale";
409 case WallpaperStyle::TopLeft
: return "TopLeft";
410 case WallpaperStyle::Top
: return "Top";
411 case WallpaperStyle::TopRight
: return "TopRight";
412 case WallpaperStyle::Left
: return "Left";
413 case WallpaperStyle::Right
: return "Right";
414 case WallpaperStyle::BottomLeft
: return "BottomLeft";
415 case WallpaperStyle::Bottom
: return "Bottom";
416 case WallpaperStyle::BottomRight
: return "BottomRight";
417 case WallpaperStyle::ApplicationGradient
: return "ApplicationGradient";
422 OUString
convertPixelFormatToString(vcl::PixelFormat ePixelFormat
)
424 switch (ePixelFormat
)
426 case vcl::PixelFormat::INVALID
: return "INVALID";
427 case vcl::PixelFormat::N1_BPP
: return "1BPP";
428 case vcl::PixelFormat::N8_BPP
: return "8BPP";
429 case vcl::PixelFormat::N24_BPP
: return "24BPP";
430 case vcl::PixelFormat::N32_BPP
: return "32BPP";
435 OUString
hex32(sal_uInt32 nNumber
)
437 std::stringstream ss
;
438 ss
<< std::hex
<< std::setfill('0') << std::setw(8) << nNumber
;
439 return OUString::createFromAscii(ss
.str().c_str());
442 void writePoint(tools::XmlWriter
& rWriter
, Point
const& rPoint
)
444 rWriter
.attribute("x", rPoint
.X());
445 rWriter
.attribute("y", rPoint
.Y());
448 void writeStartPoint(tools::XmlWriter
& rWriter
, Point
const& rPoint
)
450 rWriter
.attribute("startx", rPoint
.X());
451 rWriter
.attribute("starty", rPoint
.Y());
454 void writeEndPoint(tools::XmlWriter
& rWriter
, Point
const& rPoint
)
456 rWriter
.attribute("endx", rPoint
.X());
457 rWriter
.attribute("endy", rPoint
.Y());
460 void writeSize(tools::XmlWriter
& rWriter
, Size
const& rSize
)
462 rWriter
.attribute("width", rSize
.Width());
463 rWriter
.attribute("height", rSize
.Height());
466 void writeRectangle(tools::XmlWriter
& rWriter
, tools::Rectangle
const& rRectangle
)
468 rWriter
.attribute("left", rRectangle
.Left());
469 rWriter
.attribute("top", rRectangle
.Top());
470 if (rRectangle
.IsWidthEmpty())
471 rWriter
.attribute("right", OString("empty"));
473 rWriter
.attribute("right", rRectangle
.Right());
474 if (rRectangle
.IsHeightEmpty())
475 rWriter
.attribute("bottom", OString("empty"));
477 rWriter
.attribute("bottom", rRectangle
.Bottom());
480 void writeLineInfo(tools::XmlWriter
& rWriter
, LineInfo
const& rLineInfo
)
482 rWriter
.attribute("style", convertLineStyleToString(rLineInfo
.GetStyle()));
483 rWriter
.attribute("width", rLineInfo
.GetWidth());
484 rWriter
.attribute("dashlen", rLineInfo
.GetDashLen());
485 rWriter
.attribute("dashcount", rLineInfo
.GetDashCount());
486 rWriter
.attribute("dotlen", rLineInfo
.GetDotLen());
487 rWriter
.attribute("dotcount", rLineInfo
.GetDotCount());
488 rWriter
.attribute("distance", rLineInfo
.GetDistance());
489 rWriter
.attribute("join", convertLineJoinToString(rLineInfo
.GetLineJoin()));
490 rWriter
.attribute("cap", convertLineCapToString(rLineInfo
.GetLineCap()));
493 void writeGradient(tools::XmlWriter
& rWriter
, Gradient
const& rGradient
)
495 rWriter
.attribute("style", convertGradientStyle(rGradient
.GetStyle()));
496 rWriter
.attribute("startcolor", convertColorToString(rGradient
.GetStartColor()));
497 rWriter
.attribute("endcolor", convertColorToString(rGradient
.GetEndColor()));
498 rWriter
.attribute("angle", rGradient
.GetAngle().get());
499 rWriter
.attribute("border", rGradient
.GetBorder());
500 rWriter
.attribute("offsetx", rGradient
.GetOfsX());
501 rWriter
.attribute("offsety", rGradient
.GetOfsY());
502 rWriter
.attribute("startintensity", rGradient
.GetStartIntensity());
503 rWriter
.attribute("endintensity", rGradient
.GetEndIntensity());
504 rWriter
.attribute("steps", rGradient
.GetSteps());
507 } // anonymous namespace
509 MetafileXmlDump::MetafileXmlDump()
511 maFilter
.fill(false);
514 MetafileXmlDump::~MetafileXmlDump()
517 void MetafileXmlDump::filterActionType(const MetaActionType nActionType
, bool bShouldFilter
)
519 maFilter
[nActionType
] = bShouldFilter
;
522 void MetafileXmlDump::filterAllActionTypes()
527 void MetafileXmlDump::dump(const GDIMetaFile
& rMetaFile
, SvStream
& rStream
)
529 tools::XmlWriter
aWriter(&rStream
);
530 aWriter
.startDocument();
531 aWriter
.startElement("metafile");
533 writeXml(rMetaFile
, aWriter
);
535 aWriter
.endElement();
536 aWriter
.endDocument();
539 void MetafileXmlDump::writeXml(const GDIMetaFile
& rMetaFile
, tools::XmlWriter
& rWriter
)
541 MapMode aMtfMapMode
= rMetaFile
.GetPrefMapMode();
542 rWriter
.attribute("mapunit", convertMapUnitToString(aMtfMapMode
.GetMapUnit()));
543 writePoint(rWriter
, aMtfMapMode
.GetOrigin());
544 rWriter
.attribute("scalex", convertFractionToString(aMtfMapMode
.GetScaleX()));
545 rWriter
.attribute("scaley", convertFractionToString(aMtfMapMode
.GetScaleY()));
547 Size aMtfSize
= rMetaFile
.GetPrefSize();
548 writeSize(rWriter
, aMtfSize
);
550 for(size_t nAction
= 0; nAction
< rMetaFile
.GetActionSize(); ++nAction
)
552 MetaAction
* pAction
= rMetaFile
.GetAction(nAction
);
553 const MetaActionType nActionType
= pAction
->GetType();
554 if (maFilter
[nActionType
])
557 OString sCurrentElementTag
= convertLineStyleToString(nActionType
);
561 case MetaActionType::NONE
:
563 rWriter
.startElement(sCurrentElementTag
);
564 rWriter
.endElement();
568 case MetaActionType::PIXEL
:
570 auto* pMetaAction
= static_cast<MetaPixelAction
*>(pAction
);
571 rWriter
.startElement(sCurrentElementTag
);
572 writePoint(rWriter
, pMetaAction
->GetPoint());
573 rWriter
.attribute("color", convertColorToString(pMetaAction
->GetColor()));
574 rWriter
.endElement();
578 case MetaActionType::POINT
:
580 auto* pMetaAction
= static_cast<MetaPointAction
*>(pAction
);
581 rWriter
.startElement(sCurrentElementTag
);
582 writePoint(rWriter
, pMetaAction
->GetPoint());
583 rWriter
.endElement();
587 case MetaActionType::LINE
:
589 MetaLineAction
* pMetaLineAction
= static_cast<MetaLineAction
*>(pAction
);
590 rWriter
.startElement(sCurrentElementTag
);
591 writeStartPoint(rWriter
, pMetaLineAction
->GetStartPoint());
592 writeEndPoint(rWriter
, pMetaLineAction
->GetEndPoint());
594 writeLineInfo(rWriter
, pMetaLineAction
->GetLineInfo());
595 rWriter
.endElement();
599 case MetaActionType::RECT
:
601 MetaRectAction
* pMetaAction
= static_cast<MetaRectAction
*>(pAction
);
602 rWriter
.startElement(sCurrentElementTag
);
603 writeRectangle(rWriter
, pMetaAction
->GetRect());
604 rWriter
.endElement();
608 case MetaActionType::ROUNDRECT
:
610 auto pMetaAction
= static_cast<MetaRoundRectAction
*>(pAction
);
611 rWriter
.startElement(sCurrentElementTag
);
612 writeRectangle(rWriter
, pMetaAction
->GetRect());
613 rWriter
.attribute("horizontalround", pMetaAction
->GetHorzRound());
614 rWriter
.attribute("verticalround", pMetaAction
->GetVertRound());
615 rWriter
.endElement();
619 case MetaActionType::ELLIPSE
:
621 auto pMetaAction
= static_cast<MetaEllipseAction
*>(pAction
);
622 rWriter
.startElement(sCurrentElementTag
);
623 writeRectangle(rWriter
, pMetaAction
->GetRect());
624 rWriter
.endElement();
628 case MetaActionType::ARC
:
630 auto pMetaAction
= static_cast<MetaArcAction
*>(pAction
);
631 rWriter
.startElement(sCurrentElementTag
);
632 writeRectangle(rWriter
, pMetaAction
->GetRect());
633 writeStartPoint(rWriter
, pMetaAction
->GetStartPoint());
634 writeEndPoint(rWriter
, pMetaAction
->GetEndPoint());
635 rWriter
.endElement();
639 case MetaActionType::PIE
:
641 auto pMetaAction
= static_cast<MetaPieAction
*>(pAction
);
642 rWriter
.startElement(sCurrentElementTag
);
643 writeRectangle(rWriter
, pMetaAction
->GetRect());
644 writeStartPoint(rWriter
, pMetaAction
->GetStartPoint());
645 writeEndPoint(rWriter
, pMetaAction
->GetEndPoint());
646 rWriter
.endElement();
650 case MetaActionType::CHORD
:
652 auto pMetaAction
= static_cast<MetaChordAction
*>(pAction
);
653 rWriter
.startElement(sCurrentElementTag
);
654 writeRectangle(rWriter
, pMetaAction
->GetRect());
655 writeStartPoint(rWriter
, pMetaAction
->GetStartPoint());
656 writeEndPoint(rWriter
, pMetaAction
->GetEndPoint());
657 rWriter
.endElement();
661 case MetaActionType::POLYLINE
:
663 MetaPolyLineAction
* pMetaPolyLineAction
= static_cast<MetaPolyLineAction
*>(pAction
);
664 rWriter
.startElement(sCurrentElementTag
);
666 writeLineInfo(rWriter
, pMetaPolyLineAction
->GetLineInfo());
668 tools::Polygon aPolygon
= pMetaPolyLineAction
->GetPolygon();
669 bool bFlags
= aPolygon
.HasFlags();
670 for (sal_uInt16 i
= 0; i
< aPolygon
.GetSize(); i
++)
672 rWriter
.startElement("point");
673 writePoint(rWriter
, aPolygon
[i
]);
675 rWriter
.attribute("flags", convertPolygonFlags(aPolygon
.GetFlags(i
)));
676 rWriter
.endElement();
679 rWriter
.endElement();
683 case MetaActionType::POLYGON
:
685 MetaPolygonAction
* pMetaPolygonAction
= static_cast<MetaPolygonAction
*>(pAction
);
686 rWriter
.startElement(sCurrentElementTag
);
688 tools::Polygon aPolygon
= pMetaPolygonAction
->GetPolygon();
689 bool bFlags
= aPolygon
.HasFlags();
690 for (sal_uInt16 i
= 0; i
< aPolygon
.GetSize(); i
++)
692 rWriter
.startElement("point");
693 writePoint(rWriter
, aPolygon
[i
]);
695 rWriter
.attribute("flags", convertPolygonFlags(aPolygon
.GetFlags(i
)));
696 rWriter
.endElement();
699 rWriter
.endElement();
703 case MetaActionType::POLYPOLYGON
:
705 MetaPolyPolygonAction
*const pMetaPolyPolygonAction
= static_cast<MetaPolyPolygonAction
*>(pAction
);
706 rWriter
.startElement(sCurrentElementTag
);
708 tools::PolyPolygon
const& rPolyPolygon(pMetaPolyPolygonAction
->GetPolyPolygon());
710 for (sal_uInt16 j
= 0; j
< rPolyPolygon
.Count(); ++j
)
712 rWriter
.startElement("polygon");
713 tools::Polygon
const& rPolygon
= rPolyPolygon
[j
];
714 bool bFlags
= rPolygon
.HasFlags();
715 for (sal_uInt16 i
= 0; i
< rPolygon
.GetSize(); ++i
)
717 rWriter
.startElement("point");
718 writePoint(rWriter
, rPolygon
[i
]);
720 rWriter
.attribute("flags", convertPolygonFlags(rPolygon
.GetFlags(i
)));
721 rWriter
.endElement();
723 rWriter
.endElement();
725 rWriter
.endElement();
729 case MetaActionType::TEXT
:
731 auto* pMeta
= static_cast<MetaTextAction
*>(pAction
);
732 rWriter
.startElement(sCurrentElementTag
);
733 writePoint(rWriter
, pMeta
->GetPoint());
734 rWriter
.attribute("index", pMeta
->GetIndex());
735 rWriter
.attribute("length", pMeta
->GetLen());
736 rWriter
.startElement("textcontent");
737 rWriter
.content(pMeta
->GetText());
738 rWriter
.endElement();
740 rWriter
.endElement();
744 case MetaActionType::TEXTARRAY
:
746 MetaTextArrayAction
* pMetaTextArrayAction
= static_cast<MetaTextArrayAction
*>(pAction
);
747 rWriter
.startElement(sCurrentElementTag
);
749 sal_Int32 aIndex
= pMetaTextArrayAction
->GetIndex();
750 sal_Int32 aLength
= pMetaTextArrayAction
->GetLen();
752 writePoint(rWriter
, pMetaTextArrayAction
->GetPoint());
753 rWriter
.attribute("index", aIndex
);
754 rWriter
.attribute("length", aLength
);
756 if (pMetaTextArrayAction
->GetDXArray())
758 rWriter
.startElement("dxarray");
759 OUStringBuffer sDxLengthString
;
760 for (sal_Int32 i
= 0; i
< aLength
- aIndex
; ++i
)
762 sDxLengthString
.append(pMetaTextArrayAction
->GetDXArray()[aIndex
+ i
]);
763 sDxLengthString
.append(" ");
765 rWriter
.content(sDxLengthString
.makeStringAndClear());
766 rWriter
.endElement();
769 rWriter
.startElement("text");
770 rWriter
.content(pMetaTextArrayAction
->GetText());
771 rWriter
.endElement();
773 rWriter
.endElement();
777 case MetaActionType::STRETCHTEXT
:
779 auto* pMeta
= static_cast<MetaStretchTextAction
*>(pAction
);
780 rWriter
.startElement(sCurrentElementTag
);
782 writePoint(rWriter
, pMeta
->GetPoint());
783 rWriter
.attribute("index", pMeta
->GetIndex());
784 rWriter
.attribute("length", pMeta
->GetLen());
785 rWriter
.attribute("width", pMeta
->GetWidth());
787 rWriter
.startElement("textcontent");
788 rWriter
.content(pMeta
->GetText());
789 rWriter
.endElement();
791 rWriter
.endElement();
795 case MetaActionType::TEXTRECT
:
797 auto* pMeta
= static_cast<MetaTextRectAction
*>(pAction
);
798 rWriter
.startElement(sCurrentElementTag
);
799 writeRectangle(rWriter
, pMeta
->GetRect());
800 rWriter
.startElement("textcontent");
801 rWriter
.content(pMeta
->GetText());
802 rWriter
.endElement();
804 rWriter
.startElement("style");
805 rWriter
.content(convertDrawTextFlagsToString(pMeta
->GetStyle()));
806 rWriter
.endElement();
808 rWriter
.endElement();
812 case MetaActionType::BMP
:
814 auto pMeta
= static_cast<MetaBmpAction
*>(pAction
);
815 rWriter
.startElement(sCurrentElementTag
);
816 writePoint(rWriter
, pMeta
->GetPoint());
817 rWriter
.attribute("crc", hex32(pMeta
->GetBitmap().GetChecksum()));
818 rWriter
.endElement();
822 case MetaActionType::BMPSCALE
:
824 auto pMeta
= static_cast<MetaBmpScaleAction
*>(pAction
);
825 rWriter
.startElement(sCurrentElementTag
);
826 writePoint(rWriter
, pMeta
->GetPoint());
827 writeSize(rWriter
, pMeta
->GetSize());
828 rWriter
.attribute("crc", hex32(pMeta
->GetBitmap().GetChecksum()));
829 rWriter
.endElement();
833 case MetaActionType::BMPSCALEPART
:
835 auto pMeta
= static_cast<MetaBmpScalePartAction
*>(pAction
);
836 rWriter
.startElement(sCurrentElementTag
);
837 rWriter
.attribute("destx", pMeta
->GetDestPoint().X());
838 rWriter
.attribute("desty", pMeta
->GetDestPoint().Y());
839 rWriter
.attribute("destwidth", pMeta
->GetDestSize().Width());
840 rWriter
.attribute("destheight", pMeta
->GetDestSize().Height());
841 rWriter
.attribute("srcx", pMeta
->GetSrcPoint().X());
842 rWriter
.attribute("srcy", pMeta
->GetSrcPoint().Y());
843 rWriter
.attribute("srcwidth", pMeta
->GetSrcSize().Width());
844 rWriter
.attribute("srcheight", pMeta
->GetSrcSize().Height());
845 rWriter
.attribute("crc", hex32(pMeta
->GetBitmap().GetChecksum()));
846 rWriter
.endElement();
850 case MetaActionType::BMPEX
:
852 auto pMeta
= static_cast<MetaBmpExAction
*>(pAction
);
853 rWriter
.startElement(sCurrentElementTag
);
854 writePoint(rWriter
, pMeta
->GetPoint());
855 rWriter
.attribute("crc", hex32(pMeta
->GetBitmapEx().GetBitmap().GetChecksum()));
856 rWriter
.attribute("transparenttype", convertBitmapExTransparentType(pMeta
->GetBitmapEx()));
857 rWriter
.endElement();
861 case MetaActionType::BMPEXSCALE
:
863 auto pMeta
= static_cast<MetaBmpExScaleAction
*>(pAction
);
864 rWriter
.startElement(sCurrentElementTag
);
865 writePoint(rWriter
, pMeta
->GetPoint());
866 writeSize(rWriter
, pMeta
->GetSize());
867 rWriter
.attribute("crc", hex32(pMeta
->GetBitmapEx().GetBitmap().GetChecksum()));
868 rWriter
.attribute("transparenttype", convertBitmapExTransparentType(pMeta
->GetBitmapEx()));
869 rWriter
.endElement();
873 case MetaActionType::BMPEXSCALEPART
:
875 auto pMeta
= static_cast<MetaBmpExScalePartAction
*>(pAction
);
876 rWriter
.startElement(sCurrentElementTag
);
877 rWriter
.attribute("destx", pMeta
->GetDestPoint().X());
878 rWriter
.attribute("desty", pMeta
->GetDestPoint().Y());
879 rWriter
.attribute("destwidth", pMeta
->GetDestSize().Width());
880 rWriter
.attribute("destheight", pMeta
->GetDestSize().Height());
881 rWriter
.attribute("srcx", pMeta
->GetSrcPoint().X());
882 rWriter
.attribute("srcy", pMeta
->GetSrcPoint().Y());
883 rWriter
.attribute("srcwidth", pMeta
->GetSrcSize().Width());
884 rWriter
.attribute("srcheight", pMeta
->GetSrcSize().Height());
885 rWriter
.attribute("crc", hex32(pMeta
->GetBitmapEx().GetBitmap().GetChecksum()));
886 rWriter
.attribute("transparenttype", convertBitmapExTransparentType(pMeta
->GetBitmapEx()));
887 rWriter
.endElement();
891 case MetaActionType::MASK
:
893 auto pMeta
= static_cast<MetaMaskAction
*>(pAction
);
894 rWriter
.startElement(sCurrentElementTag
);
895 writePoint(rWriter
, pMeta
->GetPoint());
896 rWriter
.attribute("crc", hex32(pMeta
->GetBitmap().GetChecksum()));
897 rWriter
.attribute("color", convertColorToString(pMeta
->GetColor()));
898 rWriter
.endElement();
902 case MetaActionType::MASKSCALE
:
904 auto pMeta
= static_cast<MetaMaskScaleAction
*>(pAction
);
905 rWriter
.startElement(sCurrentElementTag
);
906 writePoint(rWriter
, pMeta
->GetPoint());
907 writeSize(rWriter
, pMeta
->GetSize());
908 rWriter
.attribute("crc", hex32(pMeta
->GetBitmap().GetChecksum()));
909 rWriter
.attribute("color", convertColorToString(pMeta
->GetColor()));
910 rWriter
.endElement();
914 case MetaActionType::MASKSCALEPART
:
916 auto pMeta
= static_cast<MetaMaskScalePartAction
*>(pAction
);
917 rWriter
.startElement(sCurrentElementTag
);
918 rWriter
.attribute("destx", pMeta
->GetDestPoint().X());
919 rWriter
.attribute("desty", pMeta
->GetDestPoint().Y());
920 rWriter
.attribute("destwidth", pMeta
->GetDestSize().Width());
921 rWriter
.attribute("destheight", pMeta
->GetDestSize().Height());
922 rWriter
.attribute("srcx", pMeta
->GetSrcPoint().X());
923 rWriter
.attribute("srcy", pMeta
->GetSrcPoint().Y());
924 rWriter
.attribute("srcwidth", pMeta
->GetSrcSize().Width());
925 rWriter
.attribute("srcheight", pMeta
->GetSrcSize().Height());
926 rWriter
.attribute("crc", hex32(pMeta
->GetBitmap().GetChecksum()));
927 rWriter
.attribute("color", convertColorToString(pMeta
->GetColor()));
928 rWriter
.endElement();
932 case MetaActionType::GRADIENT
:
934 const MetaGradientAction
* pMeta
= static_cast<MetaGradientAction
*>(pAction
);
936 rWriter
.startElement(sCurrentElementTag
);
937 writeGradient(rWriter
, pMeta
->GetGradient());
939 rWriter
.startElement("rectangle");
940 writeRectangle(rWriter
, pMeta
->GetRect());
941 rWriter
.endElement();
943 rWriter
.endElement();
947 case MetaActionType::HATCH
:
949 auto* const pMetaHatchAction
= static_cast<MetaHatchAction
*>(pAction
);
950 rWriter
.startElement(sCurrentElementTag
);
952 tools::PolyPolygon
const& rPolyPolygon(pMetaHatchAction
->GetPolyPolygon());
954 for (sal_uInt16 j
= 0; j
< rPolyPolygon
.Count(); ++j
)
956 rWriter
.startElement("polygon");
957 tools::Polygon
const& rPolygon
= rPolyPolygon
[j
];
958 bool bFlags
= rPolygon
.HasFlags();
959 for (sal_uInt16 i
= 0; i
< rPolygon
.GetSize(); ++i
)
961 rWriter
.startElement("point");
962 writePoint(rWriter
, rPolygon
[i
]);
964 rWriter
.attribute("flags", convertPolygonFlags(rPolygon
.GetFlags(i
)));
965 rWriter
.endElement();
967 rWriter
.endElement();
970 rWriter
.startElement("hatch");
971 const auto& rHatch
= pMetaHatchAction
->GetHatch();
972 rWriter
.attribute("style", convertHatchStyle(rHatch
.GetStyle()));
973 rWriter
.attribute("color", convertColorToString(rHatch
.GetColor()));
974 rWriter
.attribute("distance", sal_Int32(rHatch
.GetDistance()));
975 rWriter
.attribute("angle", sal_Int32(rHatch
.GetAngle().get()));
976 rWriter
.endElement();
978 rWriter
.endElement();
982 case MetaActionType::WALLPAPER
:
984 const auto* pMetaAction
= static_cast<const MetaWallpaperAction
*>(pAction
);
985 rWriter
.startElement(sCurrentElementTag
);
987 writeRectangle(rWriter
, pMetaAction
->GetRect());
989 rWriter
.startElement("wallpaper");
990 const auto& rWallpaper
= pMetaAction
->GetWallpaper();
992 rWriter
.attribute("color", convertColorToString(rWallpaper
.GetColor()));
994 WallpaperStyle eStyle
= rWallpaper
.GetStyle();
995 rWriter
.attribute("style", convertWallpaperStyleToString(eStyle
));
997 if (rWallpaper
.IsBitmap())
999 rWriter
.startElement("bitmap");
1000 BitmapEx
const & rBitmapEx
= rWallpaper
.GetBitmap();
1001 rWriter
.attribute("crc", hex32(rBitmapEx
.GetChecksum()));
1002 rWriter
.attribute("transparenttype", convertBitmapExTransparentType(rBitmapEx
));
1003 rWriter
.attribute("pixelformat", convertPixelFormatToString(rBitmapEx
.GetBitmap().getPixelFormat()));
1004 rWriter
.attribute("width", hex32(rBitmapEx
.GetSizePixel().Width()));
1005 rWriter
.attribute("height", hex32(rBitmapEx
.GetSizePixel().Height()));
1006 rWriter
.endElement();
1009 if (rWallpaper
.IsGradient())
1011 rWriter
.startElement("gradient");
1012 Gradient aGradient
= rWallpaper
.GetGradient();
1013 writeGradient(rWriter
, aGradient
);
1014 rWriter
.endElement();
1017 if (rWallpaper
.IsRect())
1019 tools::Rectangle aRect
= rWallpaper
.GetRect();
1020 rWriter
.startElement("rectangle");
1021 writeRectangle(rWriter
, aRect
);
1022 rWriter
.endElement();
1025 rWriter
.attribute("fixed", rWallpaper
.IsFixed() ? "true" : "false");
1026 rWriter
.attribute("scrollable", rWallpaper
.IsScrollable() ? "true" : "false");
1028 rWriter
.endElement();
1030 rWriter
.endElement();
1034 case MetaActionType::CLIPREGION
:
1036 const auto* pMetaClipRegionAction
= static_cast<const MetaClipRegionAction
*>(pAction
);
1037 rWriter
.startElement(sCurrentElementTag
);
1039 // FIXME for now we dump only the bounding box; this is
1040 // enough for the tests we have, but may need extending to
1041 // dumping the real polypolygon in the future
1042 tools::Rectangle aRectangle
= pMetaClipRegionAction
->GetRegion().GetBoundRect();
1043 writeRectangle(rWriter
, aRectangle
);
1044 rWriter
.endElement();
1048 case MetaActionType::ISECTRECTCLIPREGION
:
1050 MetaISectRectClipRegionAction
* pMetaISectRectClipRegionAction
= static_cast<MetaISectRectClipRegionAction
*>(pAction
);
1051 rWriter
.startElement(sCurrentElementTag
);
1053 tools::Rectangle aRectangle
= pMetaISectRectClipRegionAction
->GetRect();
1054 writeRectangle(rWriter
, aRectangle
);
1055 rWriter
.endElement();
1059 case MetaActionType::ISECTREGIONCLIPREGION
:
1061 MetaISectRegionClipRegionAction
* pMetaISectRegionClipRegionAction
= static_cast<MetaISectRegionClipRegionAction
*>(pAction
);
1062 rWriter
.startElement(sCurrentElementTag
);
1064 // FIXME for now we dump only the bounding box; this is
1065 // enough for the tests we have, but may need extending to
1066 // dumping the real polypolygon in the future
1067 tools::Rectangle aRectangle
= pMetaISectRegionClipRegionAction
->GetRegion().GetBoundRect();
1068 writeRectangle(rWriter
, aRectangle
);
1069 rWriter
.endElement();
1073 // case MetaActionType::MOVECLIPREGION:
1075 case MetaActionType::LINECOLOR
:
1077 MetaLineColorAction
* pMetaLineColorAction
= static_cast<MetaLineColorAction
*>(pAction
);
1078 rWriter
.startElement(sCurrentElementTag
);
1080 rWriter
.attribute("color", convertColorToString(pMetaLineColorAction
->GetColor()));
1081 rWriter
.endElement();
1085 case MetaActionType::FILLCOLOR
:
1087 MetaFillColorAction
* pMetaFillColorAction
= static_cast<MetaFillColorAction
*>(pAction
);
1088 rWriter
.startElement(sCurrentElementTag
);
1090 rWriter
.attribute("color", convertColorToString(pMetaFillColorAction
->GetColor()));
1091 rWriter
.endElement();
1095 case MetaActionType::TEXTCOLOR
:
1097 MetaTextColorAction
* pMetaTextColorAction
= static_cast<MetaTextColorAction
*>(pAction
);
1098 rWriter
.startElement(sCurrentElementTag
);
1100 rWriter
.attribute("color", convertColorToString(pMetaTextColorAction
->GetColor()));
1101 rWriter
.endElement();
1105 case MetaActionType::TEXTFILLCOLOR
:
1107 MetaTextFillColorAction
* pMetaTextFillColorAction
= static_cast<MetaTextFillColorAction
*>(pAction
);
1108 rWriter
.startElement(sCurrentElementTag
);
1110 rWriter
.attribute("color", convertColorToString(pMetaTextFillColorAction
->GetColor()));
1112 if (pMetaTextFillColorAction
->IsSetting())
1113 rWriter
.attribute("setting", u
"true");
1115 rWriter
.endElement();
1119 case MetaActionType::TEXTALIGN
:
1121 MetaTextAlignAction
* pMetaTextAlignAction
= static_cast<MetaTextAlignAction
*>(pAction
);
1122 rWriter
.startElement(sCurrentElementTag
);
1123 OUString sAlign
= convertTextAlignToString(pMetaTextAlignAction
->GetTextAlign());
1124 if (!sAlign
.isEmpty())
1125 rWriter
.attribute("align", sAlign
);
1126 rWriter
.endElement();
1130 case MetaActionType::MAPMODE
:
1132 const MetaMapModeAction
* pMeta
= static_cast<MetaMapModeAction
*>(pAction
);
1133 MapMode aMapMode
= pMeta
->GetMapMode();
1134 rWriter
.startElement(sCurrentElementTag
);
1135 rWriter
.attribute("mapunit", convertMapUnitToString( aMapMode
.GetMapUnit() ));
1136 writePoint(rWriter
, aMapMode
.GetOrigin());
1137 rWriter
.attribute("scalex", convertFractionToString(aMapMode
.GetScaleX()));
1138 rWriter
.attribute("scaley", convertFractionToString(aMapMode
.GetScaleY()));
1139 rWriter
.endElement();
1143 case MetaActionType::FONT
:
1145 MetaFontAction
* pMetaFontAction
= static_cast<MetaFontAction
*>(pAction
);
1146 rWriter
.startElement(sCurrentElementTag
);
1148 vcl::Font aFont
= pMetaFontAction
->GetFont();
1150 rWriter
.attribute("color", convertColorToString(aFont
.GetColor()));
1151 rWriter
.attribute("fillcolor", convertColorToString(aFont
.GetFillColor()));
1152 rWriter
.attribute("name", aFont
.GetFamilyName());
1153 rWriter
.attribute("stylename", aFont
.GetStyleName());
1154 rWriter
.attribute("width", aFont
.GetFontSize().Width());
1155 rWriter
.attribute("height", aFont
.GetFontSize().Height());
1156 rWriter
.attribute("orientation", aFont
.GetOrientation().get());
1157 rWriter
.attribute("weight", convertFontWeightToString(aFont
.GetWeight()));
1158 rWriter
.attribute("vertical", aFont
.IsVertical() ? "true" : "false");
1160 rWriter
.endElement();
1164 case MetaActionType::PUSH
:
1166 MetaPushAction
* pMetaPushAction
= static_cast<MetaPushAction
*>(pAction
);
1167 rWriter
.startElement(sCurrentElementTag
);
1169 rWriter
.attribute("flags", collectPushFlags(pMetaPushAction
->GetFlags()));
1173 case MetaActionType::POP
:
1175 rWriter
.endElement();
1179 case MetaActionType::RASTEROP
:
1181 MetaRasterOpAction
* pMetaRasterOpAction
= static_cast<MetaRasterOpAction
*>(pAction
);
1182 rWriter
.startElement(sCurrentElementTag
);
1184 if (pMetaRasterOpAction
->GetRasterOp() != RasterOp::OverPaint
)
1186 rWriter
.attribute("operation", convertRopToString(pMetaRasterOpAction
->GetRasterOp()));
1188 rWriter
.endElement();
1192 case MetaActionType::Transparent
:
1194 const MetaTransparentAction
* pMeta
= static_cast<MetaTransparentAction
*>(pAction
);
1196 rWriter
.startElement(sCurrentElementTag
);
1197 rWriter
.attribute("transparence", pMeta
->GetTransparence());
1199 tools::PolyPolygon
const& rPolyPolygon(pMeta
->GetPolyPolygon());
1201 for (sal_uInt16 j
= 0; j
< rPolyPolygon
.Count(); ++j
)
1203 rWriter
.startElement("polygon");
1204 tools::Polygon
const& rPolygon
= rPolyPolygon
[j
];
1205 bool bFlags
= rPolygon
.HasFlags();
1206 for (sal_uInt16 i
= 0; i
< rPolygon
.GetSize(); ++i
)
1208 rWriter
.startElement("point");
1209 writePoint(rWriter
, rPolygon
[i
]);
1211 rWriter
.attribute("flags", convertPolygonFlags(rPolygon
.GetFlags(i
)));
1212 rWriter
.endElement();
1214 rWriter
.endElement();
1217 rWriter
.endElement();
1221 //case MetaActionType::EPS:
1223 case MetaActionType::REFPOINT
:
1225 auto* pMeta
= static_cast<MetaRefPointAction
*>(pAction
);
1226 rWriter
.startElement(sCurrentElementTag
);
1227 writePoint(rWriter
, pMeta
->GetRefPoint());
1228 rWriter
.attribute("set", pMeta
->IsSetting() ? "true" : "false");
1229 rWriter
.endElement();
1233 case MetaActionType::TEXTLINECOLOR
:
1235 auto* pMeta
= static_cast<MetaTextLineColorAction
*>(pAction
);
1236 rWriter
.startElement(sCurrentElementTag
);
1237 rWriter
.attribute("color", convertColorToString(pMeta
->GetColor()));
1238 rWriter
.endElement();
1242 case MetaActionType::TEXTLINE
:
1244 auto* pMeta
= static_cast<MetaTextLineAction
*>(pAction
);
1245 rWriter
.startElement(sCurrentElementTag
);
1246 writePoint(rWriter
, pMeta
->GetStartPoint());
1247 rWriter
.attribute("width", pMeta
->GetWidth());
1248 rWriter
.attribute("strikeout", convertFontStrikeoutToString(pMeta
->GetStrikeout()));
1249 rWriter
.attribute("underline", convertFontLineStyleToString(pMeta
->GetUnderline()));
1250 rWriter
.attribute("overline", convertFontLineStyleToString(pMeta
->GetOverline()));
1251 rWriter
.endElement();
1255 case MetaActionType::FLOATTRANSPARENT
:
1257 const auto* pMeta
= static_cast<MetaFloatTransparentAction
*>(pAction
);
1258 rWriter
.startElement(sCurrentElementTag
);
1259 writePoint(rWriter
, pMeta
->GetPoint());
1260 writeSize(rWriter
, pMeta
->GetSize());
1261 rWriter
.attribute("transparent", pMeta
->IsTransparent() ? "true" : "false");
1263 rWriter
.startElement("gradient");
1264 writeGradient(rWriter
, pMeta
->GetGradient());
1265 rWriter
.endElement();
1267 rWriter
.startElement("metafile");
1268 writeXml(pMeta
->GetGDIMetaFile(), rWriter
);
1269 rWriter
.endElement();
1271 rWriter
.endElement();
1275 case MetaActionType::GRADIENTEX
:
1277 const MetaGradientExAction
* pMetaGradientExAction
= static_cast<MetaGradientExAction
*>(pAction
);
1279 rWriter
.startElement(sCurrentElementTag
);
1280 writeGradient(rWriter
, pMetaGradientExAction
->GetGradient());
1282 tools::PolyPolygon
const& rPolyPolygon(pMetaGradientExAction
->GetPolyPolygon());
1283 for (sal_uInt16 j
= 0; j
< rPolyPolygon
.Count(); ++j
)
1285 rWriter
.startElement("polygon");
1286 tools::Polygon
const& rPolygon
= rPolyPolygon
[j
];
1287 bool bFlags
= rPolygon
.HasFlags();
1288 for (sal_uInt16 i
= 0; i
< rPolygon
.GetSize(); ++i
)
1290 rWriter
.startElement("point");
1291 writePoint(rWriter
, rPolygon
[i
]);
1293 rWriter
.attribute("flags", convertPolygonFlags(rPolygon
.GetFlags(i
)));
1294 rWriter
.endElement();
1296 rWriter
.endElement();
1299 rWriter
.endElement();
1303 //case MetaActionType::LAYOUTMODE:
1304 //case MetaActionType::TEXTLANGUAGE:
1306 case MetaActionType::OVERLINECOLOR
:
1308 const auto* pMetaAction
= static_cast<MetaOverlineColorAction
*>(pAction
);
1309 rWriter
.startElement(sCurrentElementTag
);
1310 rWriter
.attribute("color", convertColorToString(pMetaAction
->GetColor()));
1311 rWriter
.endElement();
1315 case MetaActionType::COMMENT
:
1317 MetaCommentAction
* pMetaCommentAction
= static_cast<MetaCommentAction
*>(pAction
);
1318 rWriter
.startElement(sCurrentElementTag
);
1320 if (pMetaCommentAction
->GetDataSize() > 0)
1322 rWriter
.attribute("datasize", pMetaCommentAction
->GetDataSize());
1324 if (!pMetaCommentAction
->GetComment().isEmpty())
1326 rWriter
.startElement("comment");
1327 rWriter
.content(pMetaCommentAction
->GetComment());
1328 rWriter
.endElement();
1331 rWriter
.endElement();
1337 rWriter
.startElement(sCurrentElementTag
);
1338 rWriter
.attribute("note", OString("not implemented in xml dump"));
1339 rWriter
.endElement();
1346 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */