LibreOffice Module vcl (master)  1
mtfxmldump.cxx
Go to the documentation of this file.
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 <vcl/mtfxmldump.hxx>
11 #include <tools/XmlWriter.hxx>
12 #include <tools/fract.hxx>
13 
14 #include <vcl/metaact.hxx>
15 #include <vcl/outdev.hxx>
16 #include <rtl/string.hxx>
17 #include <rtl/ustrbuf.hxx>
18 
19 #include <sstream>
20 
21 namespace
22 {
23 
24 OUString collectPushFlags(PushFlags nFlags)
25 {
26  if ((nFlags & PushFlags::ALL) == PushFlags::ALL)
27  return "PushAll";
28  else if ((nFlags & PUSH_ALLFONT) == PUSH_ALLFONT)
29  return "PushAllFont";
30  else if ((nFlags & PUSH_ALLTEXT) == PUSH_ALLTEXT)
31  return "PushAllText";
32 
33  std::vector<OUString> aStrings;
34 
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");
63 
64  OUString aString;
65 
66  if (aStrings.empty())
67  return aString;
68 
69  aString = aStrings[0];
70  for (size_t i = 1; i < aStrings.size(); ++i)
71  {
72  aString += ", " + aStrings[i];
73  }
74  return aString;
75 }
76 
77 OUString convertDrawTextFlagsToString(DrawTextFlags eDrawTextFlags)
78 {
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");
116 
117  OUString aString;
118 
119  if (aStrings.empty())
120  return "None";
121 
122  aString = aStrings[0];
123  for (size_t i = 1; i < aStrings.size(); ++i)
124  {
125  aString += " " + aStrings[i];
126  }
127  return aString;
128 };
129 
130 OUString convertRopToString(RasterOp eRop)
131 {
132  switch (eRop)
133  {
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";
139  }
140  return OUString();
141 }
142 
143 OUString convertTextAlignToString(TextAlign eAlign)
144 {
145  switch (eAlign)
146  {
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";
151  }
152  return OUString();
153 }
154 
155 OUString convertColorToString(Color aColor)
156 {
157  OUString aRGBString = aColor.AsRGBHexString();
158  return "#" + aRGBString;
159 }
160 
161 OUString convertLineStyleToString(LineStyle eAlign)
162 {
163  switch (eAlign)
164  {
165  case LineStyle::NONE: return "none";
166  case LineStyle::Solid: return "solid";
167  case LineStyle::Dash: return "dash";
168  default: break;
169  }
170  return OUString();
171 }
172 
173 OUString convertLineJoinToString(basegfx::B2DLineJoin eJoin)
174 {
175  switch (eJoin)
176  {
177  default:
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";
182  }
183 }
184 
185 OUString convertLineCapToString(css::drawing::LineCap eCap)
186 {
187  switch (eCap)
188  {
189  default:
190  case css::drawing::LineCap_BUTT: return "butt";
191  case css::drawing::LineCap_ROUND: return "round";
192  case css::drawing::LineCap_SQUARE: return "square";
193  }
194 }
195 
196 OUString convertPolygonFlags(PolyFlags eFlags)
197 {
198  switch (eFlags)
199  {
200  default:
201  case PolyFlags::Normal: return "normal";
202  case PolyFlags::Control: return "control";
203  case PolyFlags::Smooth: return "smooth";
204  case PolyFlags::Symmetric: return "symmetric";
205  }
206 }
207 
208 OUString convertFontWeightToString(FontWeight eFontWeight)
209 {
210  switch (eFontWeight)
211  {
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";
224  }
225  return OUString();
226 }
227 
228 OUString convertFontStrikeoutToString(FontStrikeout eFontStrikeout)
229 {
230  switch (eFontStrikeout)
231  {
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";
240  }
241  return OUString();
242 }
243 
244 OUString convertFontLineStyleToString(FontLineStyle eFontLineStyle)
245 {
246  switch (eFontLineStyle)
247  {
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";
268  }
269  return OUString();
270 }
271 
272 OString convertLineStyleToString(const MetaActionType nActionType)
273 {
274  switch (nActionType)
275  {
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";
330  }
331  return "";
332 }
333 
334 OUString convertBitmapExTransparentType(BitmapEx const & rBitmapEx)
335 {
336  if (rBitmapEx.IsAlpha())
337  return "bitmap";
338  else
339  return "none";
340 }
341 
342 OUString convertMapUnitToString(MapUnit eUnit)
343 {
344  switch (eUnit)
345  {
346  default:
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";
362  }
363 }
364 
365 OUString convertFractionToString(const Fraction& aFraction)
366 {
367  std::stringstream ss;
368 
369  ss << aFraction;
370 
371  return OUString::createFromAscii(ss.str().c_str());
372 }
373 
374 OUString convertGradientStyle(GradientStyle eStyle)
375 {
376  switch (eStyle)
377  {
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";
385  }
386  return OUString();
387 }
388 
389 OUString convertHatchStyle(HatchStyle eStyle)
390 {
391  switch (eStyle)
392  {
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";
397  }
398  return OUString();
399 }
400 
401 OUString convertWallpaperStyleToString(WallpaperStyle eWallpaperStyle)
402 {
403  switch (eWallpaperStyle)
404  {
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";
418  }
419  return OUString();
420 }
421 
422 OUString convertPixelFormatToString(vcl::PixelFormat ePixelFormat)
423 {
424  switch (ePixelFormat)
425  {
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";
431  }
432  return OUString();
433 }
434 
435 OUString hex32(sal_uInt32 nNumber)
436 {
437  std::stringstream ss;
438  ss << std::hex << std::setfill('0') << std::setw(8) << nNumber;
439  return OUString::createFromAscii(ss.str().c_str());
440 }
441 
442 void writePoint(tools::XmlWriter& rWriter, Point const& rPoint)
443 {
444  rWriter.attribute("x", rPoint.X());
445  rWriter.attribute("y", rPoint.Y());
446 }
447 
448 void writeStartPoint(tools::XmlWriter& rWriter, Point const& rPoint)
449 {
450  rWriter.attribute("startx", rPoint.X());
451  rWriter.attribute("starty", rPoint.Y());
452 }
453 
454 void writeEndPoint(tools::XmlWriter& rWriter, Point const& rPoint)
455 {
456  rWriter.attribute("endx", rPoint.X());
457  rWriter.attribute("endy", rPoint.Y());
458 }
459 
460 void writeSize(tools::XmlWriter& rWriter, Size const& rSize)
461 {
462  rWriter.attribute("width", rSize.Width());
463  rWriter.attribute("height", rSize.Height());
464 }
465 
466 void writeRectangle(tools::XmlWriter& rWriter, tools::Rectangle const& rRectangle)
467 {
468  rWriter.attribute("left", rRectangle.Left());
469  rWriter.attribute("top", rRectangle.Top());
470  if (rRectangle.IsWidthEmpty())
471  rWriter.attribute("right", OString("empty"));
472  else
473  rWriter.attribute("right", rRectangle.Right());
474  if (rRectangle.IsHeightEmpty())
475  rWriter.attribute("bottom", OString("empty"));
476  else
477  rWriter.attribute("bottom", rRectangle.Bottom());
478 }
479 
480 void writeLineInfo(tools::XmlWriter& rWriter, LineInfo const& rLineInfo)
481 {
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()));
491 }
492 
493 void writeGradient(tools::XmlWriter& rWriter, Gradient const& rGradient)
494 {
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());
505 }
506 
507 } // anonymous namespace
508 
510 {
511  maFilter.fill(false);
512 }
513 
515 {}
516 
517 void MetafileXmlDump::filterActionType(const MetaActionType nActionType, bool bShouldFilter)
518 {
519  maFilter[nActionType] = bShouldFilter;
520 }
521 
523 {
524  maFilter.fill(true);
525 }
526 
527 void MetafileXmlDump::dump(const GDIMetaFile& rMetaFile, SvStream& rStream)
528 {
529  tools::XmlWriter aWriter(&rStream);
530  aWriter.startDocument();
531  aWriter.startElement("metafile");
532 
533  writeXml(rMetaFile, aWriter);
534 
535  aWriter.endElement();
536  aWriter.endDocument();
537 }
538 
540 {
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()));
546 
547  Size aMtfSize = rMetaFile.GetPrefSize();
548  writeSize(rWriter, aMtfSize);
549 
550  for(size_t nAction = 0; nAction < rMetaFile.GetActionSize(); ++nAction)
551  {
552  MetaAction* pAction = rMetaFile.GetAction(nAction);
553  const MetaActionType nActionType = pAction->GetType();
554  if (maFilter[nActionType])
555  continue;
556 
557  OString sCurrentElementTag = convertLineStyleToString(nActionType);
558 
559  switch (nActionType)
560  {
562  {
563  rWriter.startElement(sCurrentElementTag);
564  rWriter.endElement();
565  }
566  break;
567 
569  {
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();
575  }
576  break;
577 
579  {
580  auto* pMetaAction = static_cast<MetaPointAction*>(pAction);
581  rWriter.startElement(sCurrentElementTag);
582  writePoint(rWriter, pMetaAction->GetPoint());
583  rWriter.endElement();
584  }
585  break;
586 
588  {
589  MetaLineAction* pMetaLineAction = static_cast<MetaLineAction*>(pAction);
590  rWriter.startElement(sCurrentElementTag);
591  writeStartPoint(rWriter, pMetaLineAction->GetStartPoint());
592  writeEndPoint(rWriter, pMetaLineAction->GetEndPoint());
593 
594  writeLineInfo(rWriter, pMetaLineAction->GetLineInfo());
595  rWriter.endElement();
596  }
597  break;
598 
600  {
601  MetaRectAction* pMetaAction = static_cast<MetaRectAction*>(pAction);
602  rWriter.startElement(sCurrentElementTag);
603  writeRectangle(rWriter, pMetaAction->GetRect());
604  rWriter.endElement();
605  }
606  break;
607 
609  {
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();
616  }
617  break;
618 
620  {
621  auto pMetaAction = static_cast<MetaEllipseAction*>(pAction);
622  rWriter.startElement(sCurrentElementTag);
623  writeRectangle(rWriter, pMetaAction->GetRect());
624  rWriter.endElement();
625  }
626  break;
627 
628  case MetaActionType::ARC:
629  {
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();
636  }
637  break;
638 
639  case MetaActionType::PIE:
640  {
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();
647  }
648  break;
649 
651  {
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();
658  }
659  break;
660 
662  {
663  MetaPolyLineAction* pMetaPolyLineAction = static_cast<MetaPolyLineAction*>(pAction);
664  rWriter.startElement(sCurrentElementTag);
665 
666  writeLineInfo(rWriter, pMetaPolyLineAction->GetLineInfo());
667 
668  tools::Polygon aPolygon = pMetaPolyLineAction->GetPolygon();
669  bool bFlags = aPolygon.HasFlags();
670  for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
671  {
672  rWriter.startElement("point");
673  writePoint(rWriter, aPolygon[i]);
674  if (bFlags)
675  rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
676  rWriter.endElement();
677  }
678 
679  rWriter.endElement();
680  }
681  break;
682 
684  {
685  MetaPolygonAction* pMetaPolygonAction = static_cast<MetaPolygonAction*>(pAction);
686  rWriter.startElement(sCurrentElementTag);
687 
688  tools::Polygon aPolygon = pMetaPolygonAction->GetPolygon();
689  bool bFlags = aPolygon.HasFlags();
690  for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
691  {
692  rWriter.startElement("point");
693  writePoint(rWriter, aPolygon[i]);
694  if (bFlags)
695  rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
696  rWriter.endElement();
697  }
698 
699  rWriter.endElement();
700  }
701  break;
702 
704  {
705  MetaPolyPolygonAction *const pMetaPolyPolygonAction = static_cast<MetaPolyPolygonAction*>(pAction);
706  rWriter.startElement(sCurrentElementTag);
707 
708  tools::PolyPolygon const& rPolyPolygon(pMetaPolyPolygonAction->GetPolyPolygon());
709 
710  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
711  {
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)
716  {
717  rWriter.startElement("point");
718  writePoint(rWriter, rPolygon[i]);
719  if (bFlags)
720  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
721  rWriter.endElement();
722  }
723  rWriter.endElement();
724  }
725  rWriter.endElement();
726  }
727  break;
728 
730  {
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();
739 
740  rWriter.endElement();
741  }
742  break;
743 
745  {
746  MetaTextArrayAction* pMetaTextArrayAction = static_cast<MetaTextArrayAction*>(pAction);
747  rWriter.startElement(sCurrentElementTag);
748 
749  sal_Int32 aIndex = pMetaTextArrayAction->GetIndex();
750  sal_Int32 aLength = pMetaTextArrayAction->GetLen();
751 
752  writePoint(rWriter, pMetaTextArrayAction->GetPoint());
753  rWriter.attribute("index", aIndex);
754  rWriter.attribute("length", aLength);
755 
756  if (pMetaTextArrayAction->GetDXArray())
757  {
758  rWriter.startElement("dxarray");
759  OUStringBuffer sDxLengthString;
760  for (sal_Int32 i = 0; i < aLength - aIndex; ++i)
761  {
762  sDxLengthString.append(pMetaTextArrayAction->GetDXArray()[aIndex + i]);
763  sDxLengthString.append(" ");
764  }
765  rWriter.content(sDxLengthString.makeStringAndClear());
766  rWriter.endElement();
767  }
768 
769  rWriter.startElement("text");
770  rWriter.content(pMetaTextArrayAction->GetText());
771  rWriter.endElement();
772 
773  rWriter.endElement();
774  }
775  break;
776 
778  {
779  auto* pMeta = static_cast<MetaStretchTextAction*>(pAction);
780  rWriter.startElement(sCurrentElementTag);
781 
782  writePoint(rWriter, pMeta->GetPoint());
783  rWriter.attribute("index", pMeta->GetIndex());
784  rWriter.attribute("length", pMeta->GetLen());
785  rWriter.attribute("width", pMeta->GetWidth());
786 
787  rWriter.startElement("textcontent");
788  rWriter.content(pMeta->GetText());
789  rWriter.endElement();
790 
791  rWriter.endElement();
792  }
793  break;
794 
796  {
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();
803 
804  rWriter.startElement("style");
805  rWriter.content(convertDrawTextFlagsToString(pMeta->GetStyle()));
806  rWriter.endElement();
807 
808  rWriter.endElement();
809  }
810  break;
811 
812  case MetaActionType::BMP:
813  {
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();
819  }
820  break;
821 
823  {
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();
830  }
831  break;
832 
834  {
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();
847  }
848  break;
849 
851  {
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();
858  }
859  break;
860 
862  {
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();
870  }
871  break;
872 
874  {
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();
888  }
889  break;
890 
892  {
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();
899  }
900  break;
901 
903  {
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();
911  }
912  break;
913 
915  {
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();
929  }
930  break;
931 
933  {
934  const MetaGradientAction* pMeta = static_cast<MetaGradientAction*>(pAction);
935 
936  rWriter.startElement(sCurrentElementTag);
937  writeGradient(rWriter, pMeta->GetGradient());
938 
939  rWriter.startElement("rectangle");
940  writeRectangle(rWriter, pMeta->GetRect());
941  rWriter.endElement();
942 
943  rWriter.endElement();
944  }
945  break;
946 
948  {
949  auto* const pMetaHatchAction = static_cast<MetaHatchAction*>(pAction);
950  rWriter.startElement(sCurrentElementTag);
951 
952  tools::PolyPolygon const& rPolyPolygon(pMetaHatchAction->GetPolyPolygon());
953 
954  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
955  {
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)
960  {
961  rWriter.startElement("point");
962  writePoint(rWriter, rPolygon[i]);
963  if (bFlags)
964  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
965  rWriter.endElement();
966  }
967  rWriter.endElement();
968  }
969 
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();
977 
978  rWriter.endElement();
979  }
980  break;
981 
983  {
984  const auto* pMetaAction = static_cast<const MetaWallpaperAction*>(pAction);
985  rWriter.startElement(sCurrentElementTag);
986 
987  writeRectangle(rWriter, pMetaAction->GetRect());
988 
989  rWriter.startElement("wallpaper");
990  const auto& rWallpaper = pMetaAction->GetWallpaper();
991 
992  rWriter.attribute("color", convertColorToString(rWallpaper.GetColor()));
993 
994  WallpaperStyle eStyle = rWallpaper.GetStyle();
995  rWriter.attribute("style", convertWallpaperStyleToString(eStyle));
996 
997  if (rWallpaper.IsBitmap())
998  {
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();
1007  }
1008 
1009  if (rWallpaper.IsGradient())
1010  {
1011  rWriter.startElement("gradient");
1012  Gradient aGradient = rWallpaper.GetGradient();
1013  writeGradient(rWriter, aGradient);
1014  rWriter.endElement();
1015  }
1016 
1017  if (rWallpaper.IsRect())
1018  {
1019  tools::Rectangle aRect = rWallpaper.GetRect();
1020  rWriter.startElement("rectangle");
1021  writeRectangle(rWriter, aRect);
1022  rWriter.endElement();
1023  }
1024 
1025  rWriter.attribute("fixed", rWallpaper.IsFixed() ? "true" : "false");
1026  rWriter.attribute("scrollable", rWallpaper.IsScrollable() ? "true" : "false");
1027 
1028  rWriter.endElement();
1029 
1030  rWriter.endElement();
1031  }
1032  break;
1033 
1035  {
1036  const auto* pMetaClipRegionAction = static_cast<const MetaClipRegionAction*>(pAction);
1037  rWriter.startElement(sCurrentElementTag);
1038 
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 
1045  vcl::Region aRegion = pMetaClipRegionAction->GetRegion();
1046 
1047  if (aRegion.HasPolyPolygonOrB2DPolyPolygon())
1048  {
1049  tools::PolyPolygon aPolyPolygon = aRegion.GetAsPolyPolygon();
1050 
1051  for (sal_uInt16 j = 0; j < aPolyPolygon.Count(); ++j)
1052  {
1053  rWriter.startElement("polygon");
1054  tools::Polygon const& rPolygon = aPolyPolygon[j];
1055  bool bFlags = rPolygon.HasFlags();
1056  for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
1057  {
1058  rWriter.startElement("point");
1059  writePoint(rWriter, rPolygon[i]);
1060  if (bFlags)
1061  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
1062  rWriter.endElement();
1063  }
1064  rWriter.endElement();
1065  }
1066  }
1067 
1068  rWriter.endElement();
1069  }
1070  break;
1071 
1073  {
1074  MetaISectRectClipRegionAction* pMetaISectRectClipRegionAction = static_cast<MetaISectRectClipRegionAction*>(pAction);
1075  rWriter.startElement(sCurrentElementTag);
1076 
1077  tools::Rectangle aRectangle = pMetaISectRectClipRegionAction->GetRect();
1078  writeRectangle(rWriter, aRectangle);
1079  rWriter.endElement();
1080  }
1081  break;
1082 
1084  {
1085  MetaISectRegionClipRegionAction* pMetaISectRegionClipRegionAction = static_cast<MetaISectRegionClipRegionAction*>(pAction);
1086  rWriter.startElement(sCurrentElementTag);
1087 
1088  // FIXME for now we dump only the bounding box; this is
1089  // enough for the tests we have, but may need extending to
1090  // dumping the real polypolygon in the future
1091  tools::Rectangle aRectangle = pMetaISectRegionClipRegionAction->GetRegion().GetBoundRect();
1092  writeRectangle(rWriter, aRectangle);
1093  rWriter.endElement();
1094  }
1095  break;
1096 
1098  {
1099  const auto* pMetaMoveClipRegionAction = static_cast<MetaMoveClipRegionAction*>(pAction);
1100  rWriter.startElement(sCurrentElementTag);
1101 
1102  rWriter.attribute("horzmove", pMetaMoveClipRegionAction->GetHorzMove());
1103  rWriter.attribute("vertmove", pMetaMoveClipRegionAction->GetVertMove());
1104  rWriter.endElement();
1105  }
1106  break;
1107 
1109  {
1110  MetaLineColorAction* pMetaLineColorAction = static_cast<MetaLineColorAction*>(pAction);
1111  rWriter.startElement(sCurrentElementTag);
1112 
1113  rWriter.attribute("color", convertColorToString(pMetaLineColorAction->GetColor()));
1114  rWriter.endElement();
1115  }
1116  break;
1117 
1119  {
1120  MetaFillColorAction* pMetaFillColorAction = static_cast<MetaFillColorAction*>(pAction);
1121  rWriter.startElement(sCurrentElementTag);
1122 
1123  rWriter.attribute("color", convertColorToString(pMetaFillColorAction->GetColor()));
1124  rWriter.endElement();
1125  }
1126  break;
1127 
1129  {
1130  MetaTextColorAction* pMetaTextColorAction = static_cast<MetaTextColorAction*>(pAction);
1131  rWriter.startElement(sCurrentElementTag);
1132 
1133  rWriter.attribute("color", convertColorToString(pMetaTextColorAction->GetColor()));
1134  rWriter.endElement();
1135  }
1136  break;
1137 
1139  {
1140  MetaTextFillColorAction* pMetaTextFillColorAction = static_cast<MetaTextFillColorAction*>(pAction);
1141  rWriter.startElement(sCurrentElementTag);
1142 
1143  rWriter.attribute("color", convertColorToString(pMetaTextFillColorAction->GetColor()));
1144 
1145  if (pMetaTextFillColorAction->IsSetting())
1146  rWriter.attribute("setting", u"true");
1147 
1148  rWriter.endElement();
1149  }
1150  break;
1151 
1153  {
1154  MetaTextAlignAction* pMetaTextAlignAction = static_cast<MetaTextAlignAction*>(pAction);
1155  rWriter.startElement(sCurrentElementTag);
1156  OUString sAlign = convertTextAlignToString(pMetaTextAlignAction->GetTextAlign());
1157  if (!sAlign.isEmpty())
1158  rWriter.attribute("align", sAlign);
1159  rWriter.endElement();
1160  }
1161  break;
1162 
1164  {
1165  const MetaMapModeAction* pMeta = static_cast<MetaMapModeAction*>(pAction);
1166  MapMode aMapMode = pMeta->GetMapMode();
1167  rWriter.startElement(sCurrentElementTag);
1168  rWriter.attribute("mapunit", convertMapUnitToString( aMapMode.GetMapUnit() ));
1169  writePoint(rWriter, aMapMode.GetOrigin());
1170  rWriter.attribute("scalex", convertFractionToString(aMapMode.GetScaleX()));
1171  rWriter.attribute("scaley", convertFractionToString(aMapMode.GetScaleY()));
1172  rWriter.endElement();
1173  }
1174  break;
1175 
1176  case MetaActionType::FONT:
1177  {
1178  MetaFontAction* pMetaFontAction = static_cast<MetaFontAction*>(pAction);
1179  rWriter.startElement(sCurrentElementTag);
1180 
1181  vcl::Font aFont = pMetaFontAction->GetFont();
1182 
1183  rWriter.attribute("color", convertColorToString(aFont.GetColor()));
1184  rWriter.attribute("fillcolor", convertColorToString(aFont.GetFillColor()));
1185  rWriter.attribute("name", aFont.GetFamilyName());
1186  rWriter.attribute("stylename", aFont.GetStyleName());
1187  rWriter.attribute("width", aFont.GetFontSize().Width());
1188  rWriter.attribute("height", aFont.GetFontSize().Height());
1189  rWriter.attribute("orientation", aFont.GetOrientation().get());
1190  rWriter.attribute("weight", convertFontWeightToString(aFont.GetWeight()));
1191  rWriter.attribute("vertical", aFont.IsVertical() ? "true" : "false");
1192 
1193  rWriter.endElement();
1194  }
1195  break;
1196 
1197  case MetaActionType::PUSH:
1198  {
1199  MetaPushAction* pMetaPushAction = static_cast<MetaPushAction*>(pAction);
1200  rWriter.startElement(sCurrentElementTag);
1201 
1202  rWriter.attribute("flags", collectPushFlags(pMetaPushAction->GetFlags()));
1203  }
1204  break;
1205 
1206  case MetaActionType::POP:
1207  {
1208  rWriter.endElement();
1209  }
1210  break;
1211 
1213  {
1214  MetaRasterOpAction* pMetaRasterOpAction = static_cast<MetaRasterOpAction*>(pAction);
1215  rWriter.startElement(sCurrentElementTag);
1216 
1217  if (pMetaRasterOpAction->GetRasterOp() != RasterOp::OverPaint)
1218  {
1219  rWriter.attribute("operation", convertRopToString(pMetaRasterOpAction->GetRasterOp()));
1220  }
1221  rWriter.endElement();
1222  }
1223  break;
1224 
1226  {
1227  const MetaTransparentAction* pMeta = static_cast<MetaTransparentAction*>(pAction);
1228 
1229  rWriter.startElement(sCurrentElementTag);
1230  rWriter.attribute("transparence", pMeta->GetTransparence());
1231 
1232  tools::PolyPolygon const& rPolyPolygon(pMeta->GetPolyPolygon());
1233 
1234  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
1235  {
1236  rWriter.startElement("polygon");
1237  tools::Polygon const& rPolygon = rPolyPolygon[j];
1238  bool bFlags = rPolygon.HasFlags();
1239  for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
1240  {
1241  rWriter.startElement("point");
1242  writePoint(rWriter, rPolygon[i]);
1243  if (bFlags)
1244  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
1245  rWriter.endElement();
1246  }
1247  rWriter.endElement();
1248  }
1249 
1250  rWriter.endElement();
1251  }
1252  break;
1253 
1254  //case MetaActionType::EPS:
1255 
1257  {
1258  auto* pMeta = static_cast<MetaRefPointAction*>(pAction);
1259  rWriter.startElement(sCurrentElementTag);
1260  writePoint(rWriter, pMeta->GetRefPoint());
1261  rWriter.attribute("set", pMeta->IsSetting() ? "true" : "false");
1262  rWriter.endElement();
1263  }
1264  break;
1265 
1267  {
1268  auto* pMeta = static_cast<MetaTextLineColorAction*>(pAction);
1269  rWriter.startElement(sCurrentElementTag);
1270  rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
1271  rWriter.endElement();
1272  }
1273  break;
1274 
1276  {
1277  auto* pMeta = static_cast<MetaTextLineAction*>(pAction);
1278  rWriter.startElement(sCurrentElementTag);
1279  writePoint(rWriter, pMeta->GetStartPoint());
1280  rWriter.attribute("width", pMeta->GetWidth());
1281  rWriter.attribute("strikeout", convertFontStrikeoutToString(pMeta->GetStrikeout()));
1282  rWriter.attribute("underline", convertFontLineStyleToString(pMeta->GetUnderline()));
1283  rWriter.attribute("overline", convertFontLineStyleToString(pMeta->GetOverline()));
1284  rWriter.endElement();
1285  }
1286  break;
1287 
1289  {
1290  const auto* pMeta = static_cast<MetaFloatTransparentAction*>(pAction);
1291  rWriter.startElement(sCurrentElementTag);
1292  writePoint(rWriter, pMeta->GetPoint());
1293  writeSize(rWriter, pMeta->GetSize());
1294  rWriter.attribute("transparent", pMeta->IsTransparent() ? "true" : "false");
1295 
1296  rWriter.startElement("gradient");
1297  writeGradient(rWriter, pMeta->GetGradient());
1298  rWriter.endElement();
1299 
1300  rWriter.startElement("metafile");
1301  writeXml(pMeta->GetGDIMetaFile(), rWriter);
1302  rWriter.endElement();
1303 
1304  rWriter.endElement();
1305  }
1306  break;
1307 
1309  {
1310  const MetaGradientExAction* pMetaGradientExAction = static_cast<MetaGradientExAction*>(pAction);
1311 
1312  rWriter.startElement(sCurrentElementTag);
1313  writeGradient(rWriter, pMetaGradientExAction->GetGradient());
1314 
1315  tools::PolyPolygon const& rPolyPolygon(pMetaGradientExAction->GetPolyPolygon());
1316  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
1317  {
1318  rWriter.startElement("polygon");
1319  tools::Polygon const& rPolygon = rPolyPolygon[j];
1320  bool bFlags = rPolygon.HasFlags();
1321  for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
1322  {
1323  rWriter.startElement("point");
1324  writePoint(rWriter, rPolygon[i]);
1325  if (bFlags)
1326  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
1327  rWriter.endElement();
1328  }
1329  rWriter.endElement();
1330  }
1331 
1332  rWriter.endElement();
1333  }
1334  break;
1335 
1336  //case MetaActionType::LAYOUTMODE:
1337  //case MetaActionType::TEXTLANGUAGE:
1338 
1340  {
1341  const auto* pMetaAction = static_cast<MetaOverlineColorAction*>(pAction);
1342  rWriter.startElement(sCurrentElementTag);
1343  rWriter.attribute("color", convertColorToString(pMetaAction->GetColor()));
1344  rWriter.endElement();
1345  }
1346  break;
1347 
1349  {
1350  MetaCommentAction* pMetaCommentAction = static_cast<MetaCommentAction*>(pAction);
1351  rWriter.startElement(sCurrentElementTag);
1352 
1353  if (pMetaCommentAction->GetDataSize() > 0)
1354  {
1355  rWriter.attribute("datasize", pMetaCommentAction->GetDataSize());
1356  }
1357  if (!pMetaCommentAction->GetComment().isEmpty())
1358  {
1359  rWriter.startElement("comment");
1360  rWriter.content(pMetaCommentAction->GetComment());
1361  rWriter.endElement();
1362  }
1363 
1364  rWriter.endElement();
1365  }
1366  break;
1367 
1368  default:
1369  {
1370  rWriter.startElement(sCurrentElementTag);
1371  rWriter.attribute("note", OString("not implemented in xml dump"));
1372  rWriter.endElement();
1373  }
1374  break;
1375  }
1376  }
1377 }
1378 
1379 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString AsRGBHexString() const
PixelFormat
Pixel format of the bitmap in bits per pixel.
Definition: BitmapTypes.hxx:19
sal_uInt16 Count() const
const Fraction & GetScaleX() const
Definition: mapmod.cxx:140
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:190
void dump(const GDIMetaFile &rMetaFile, SvStream &rStream)
The actual result that will be used for testing.
Definition: mtfxmldump.cxx:527
GradientStyle GetStyle() const
bool IsHeightEmpty() const
const OUString & GetFamilyName() const
Definition: font/font.cxx:827
const OUString & GetStyleName() const
Definition: font/font.cxx:828
#define PUSH_ALLTEXT
Definition: outdevstate.hxx:61
sal_uInt16 GetOfsY() const
FontStrikeout_FORCE_EQUAL_SIZE
const MapMode & GetPrefMapMode() const
Definition: gdimtf.hxx:178
LINESTYLE_BOLD
WEIGHT_THIN
sal_uInt16 GetBorder() const
WEIGHT_BLACK
LINESTYLE_BOLDWAVE
WEIGHT_SEMIBOLD
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1542
const Point & GetEndPoint() const
Definition: metaact.hxx:189
STRIKEOUT_SLASH
void writeXml(const GDIMetaFile &rMetaFile, tools::XmlWriter &rWriter)
Definition: mtfxmldump.cxx:539
WEIGHT_LIGHT
BitmapChecksum GetChecksum() const
Definition: BitmapEx.cxx:230
DrawTextFlags
void fill(V val)
void filterAllActionTypes()
Definition: mtfxmldump.cxx:522
LINESTYLE_DASH
WEIGHT_BOLD
constexpr tools::Long Width() const
LINESTYLE_DASHDOT
bool IsAlpha() const
Definition: BitmapEx.cxx:193
LINESTYLE_BOLDDASHDOTDOT
bool IsVertical() const
Definition: font/font.cxx:844
tools::Long Left() const
LINESTYLE_NONE
LineStyle
Definition: vclenum.hxx:184
const Fraction & GetScaleY() const
Definition: mapmod.cxx:142
RasterOp
Definition: vclenum.hxx:192
PolyFlags GetFlags(sal_uInt16 nPos) const
tools::Long Bottom() const
const Gradient & GetGradient() const
Definition: metaact.hxx:992
void attribute(const OString &sTagName, const OString &aValue)
const Color & GetColor() const
Definition: metaact.hxx:1224
PushFlags
Definition: outdevstate.hxx:38
MetaActionType
GradientStyle
FontWeight_FORCE_EQUAL_SIZE
STRIKEOUT_SINGLE
tools::PolyPolygon GetAsPolyPolygon() const
Definition: region.cxx:1261
FontLineStyle_FORCE_EQUAL_SIZE
WEIGHT_DONTKNOW
WEIGHT_SEMILIGHT
UNDERLYING_TYPE get() const
ALIGN_BASELINE
vcl::PixelFormat getPixelFormat() const
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:218
const Size & GetPrefSize() const
Definition: gdimtf.hxx:175
int i
void content(const OString &sValue)
sal_uInt16 GetTransparence() const
Definition: metaact.hxx:1543
LINESTYLE_DOUBLEWAVE
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:991
LINESTYLE_WAVE
sal_uInt16 GetOfsX() const
WEIGHT_MEDIUM
bool startDocument(sal_Int32 nIndent=2, bool bWriteXmlHeader=true)
bool HasFlags() const
WEIGHT_NORMAL
LINESTYLE_SINGLE
WEIGHT_ULTRALIGHT
float u
const Size & GetFontSize() const
Definition: font/font.cxx:830
sal_uInt16 GetEndIntensity() const
ALIGN_BOTTOM
LINESTYLE_BOLDLONGDASH
sal_uInt16 GetSize() const
LINESTYLE_SMALLWAVE
void startElement(const OString &sName)
MapUnit GetMapUnit() const
Definition: mapmod.cxx:136
WEIGHT_ULTRABOLD
const Color & GetFillColor() const
Definition: font/font.cxx:822
tools::Long Top() const
LINESTYLE_DONTKNOW
#define PUSH_ALLFONT
Definition: outdevstate.hxx:62
STRIKEOUT_X
TextAlign
sal_uInt16 GetSteps() const
LINESTYLE_LONGDASH
const Color & GetStartColor() const
Bitmap GetBitmap(Color aTransparentReplaceColor) const
Definition: BitmapEx.cxx:203
const Point & GetStartPoint() const
Definition: metaact.hxx:188
ALIGN_TOP
sal_uInt32 GetDataSize() const
Definition: metaact.hxx:1676
const Color & GetColor() const
Definition: font/font.cxx:821
FontWeight
Degree10 GetAngle() const
std::deque< AttacherIndex_Impl > aIndex
STRIKEOUT_DOUBLE
LINESTYLE_DASHDOTDOT
FontWeight GetWeight()
Definition: font/font.cxx:848
constexpr tools::Long Height() const
LINESTYLE_DOTTED
WallpaperStyle
Definition: wall.hxx:34
MetaAction * GetAction(size_t nAction) const
Definition: gdimtf.cxx:185
const Color & GetEndColor() const
void filterActionType(const MetaActionType nActionType, bool bShouldFilter)
Definition: mtfxmldump.cxx:517
TextAlign_FORCE_EQUAL_SIZE
bool HasPolyPolygonOrB2DPolyPolygon() const
Definition: region.hxx:110
size_t GetActionSize() const
Definition: gdimtf.cxx:180
Degree10 GetOrientation() const
Definition: font/font.cxx:843
bool IsWidthEmpty() const
const Point & GetOrigin() const
Definition: mapmod.cxx:138
MetaActionType GetType() const
Definition: metaact.hxx:90
LINESTYLE_BOLDDOTTED
STRIKEOUT_DONTKNOW
LINESTYLE_BOLDDASH
MapUnit
o3tl::enumarray< MetaActionType, bool > maFilter
Definition: mtfxmldump.hxx:29
const OString & GetComment() const
Definition: metaact.hxx:1674
LINESTYLE_DOUBLE
STRIKEOUT_NONE
const Size & GetSizePixel() const
Definition: bitmapex.hxx:73
const Color & GetColor() const
Definition: metaact.hxx:1251
FontLineStyle
sal_uInt16 GetStartIntensity() const
FontStrikeout
tools::Long Right() const
LINESTYLE_BOLDDASHDOT
STRIKEOUT_BOLD
HatchStyle
PolyFlags