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(TransparentType eType)
335 {
336  switch (eType)
337  {
338  default:
339  case TransparentType::NONE: return "none";
340  case TransparentType::Bitmap: return "bitmap";
341  }
342 }
343 
344 OUString convertMapUnitToString(MapUnit eUnit)
345 {
346  switch (eUnit)
347  {
348  default:
349  case MapUnit::LASTENUMDUMMY: return "LASTENUMDUMMY";
350  case MapUnit::Map1000thInch: return "Map1000thInch";
351  case MapUnit::Map100thInch: return "Map100thInch";
352  case MapUnit::Map100thMM: return "Map100thMM";
353  case MapUnit::Map10thInch: return "Map10thInch";
354  case MapUnit::Map10thMM: return "Map10thMM";
355  case MapUnit::MapAppFont: return "MapAppFont";
356  case MapUnit::MapCM: return "MapCM";
357  case MapUnit::MapInch: return "MapInch";
358  case MapUnit::MapMM: return "MapMM";
359  case MapUnit::MapPixel: return "MapPixel";
360  case MapUnit::MapPoint: return "MapPoint";
361  case MapUnit::MapRelative: return "MapRelative";
362  case MapUnit::MapSysFont: return "MapSysFont";
363  case MapUnit::MapTwip: return "MapTwip";
364  }
365 }
366 
367 OUString convertFractionToString(const Fraction& aFraction)
368 {
369  std::stringstream ss;
370 
371  ss << aFraction;
372 
373  return OUString::createFromAscii(ss.str().c_str());
374 }
375 
376 OUString convertGradientStyle(GradientStyle eStyle)
377 {
378  switch (eStyle)
379  {
380  case GradientStyle::Linear: return "Linear";
381  case GradientStyle::Axial: return "Axial";
382  case GradientStyle::Radial: return "Radial";
383  case GradientStyle::Elliptical: return "Elliptical";
384  case GradientStyle::Square: return "Square";
385  case GradientStyle::Rect: return "Rect";
386  case GradientStyle::FORCE_EQUAL_SIZE: return "ForceEqualSize";
387  }
388  return OUString();
389 }
390 
391 OUString convertHatchStyle(HatchStyle eStyle)
392 {
393  switch (eStyle)
394  {
395  case HatchStyle::Single: return "Single";
396  case HatchStyle::Double: return "Double";
397  case HatchStyle::Triple: return "Triple";
398  case HatchStyle::FORCE_EQUAL_SIZE: return "ForceEqualSize";
399  }
400  return OUString();
401 }
402 
403 OUString convertWallpaperStyleToString(WallpaperStyle eWallpaperStyle)
404 {
405  switch (eWallpaperStyle)
406  {
407  case WallpaperStyle::NONE: return "NONE";
408  case WallpaperStyle::Tile: return "Tile";
409  case WallpaperStyle::Center: return "Center";
410  case WallpaperStyle::Scale: return "Scale";
411  case WallpaperStyle::TopLeft: return "TopLeft";
412  case WallpaperStyle::Top: return "Top";
413  case WallpaperStyle::TopRight: return "TopRight";
414  case WallpaperStyle::Left: return "Left";
415  case WallpaperStyle::Right: return "Right";
416  case WallpaperStyle::BottomLeft: return "BottomLeft";
417  case WallpaperStyle::Bottom: return "Bottom";
418  case WallpaperStyle::BottomRight: return "BottomRight";
419  case WallpaperStyle::ApplicationGradient: return "ApplicationGradient";
420  }
421  return OUString();
422 }
423 
424 OUString convertPixelFormatToString(vcl::PixelFormat ePixelFormat)
425 {
426  switch (ePixelFormat)
427  {
428  case vcl::PixelFormat::INVALID: return "INVALID";
429  case vcl::PixelFormat::N1_BPP: return "1BPP";
430  case vcl::PixelFormat::N8_BPP: return "8BPP";
431  case vcl::PixelFormat::N24_BPP: return "24BPP";
432  case vcl::PixelFormat::N32_BPP: return "32BPP";
433  }
434  return OUString();
435 }
436 
437 OUString hex32(sal_uInt32 nNumber)
438 {
439  std::stringstream ss;
440  ss << std::hex << std::setfill('0') << std::setw(8) << nNumber;
441  return OUString::createFromAscii(ss.str().c_str());
442 }
443 
444 void writePoint(tools::XmlWriter& rWriter, Point const& rPoint)
445 {
446  rWriter.attribute("x", rPoint.X());
447  rWriter.attribute("y", rPoint.Y());
448 }
449 
450 void writeStartPoint(tools::XmlWriter& rWriter, Point const& rPoint)
451 {
452  rWriter.attribute("startx", rPoint.X());
453  rWriter.attribute("starty", rPoint.Y());
454 }
455 
456 void writeEndPoint(tools::XmlWriter& rWriter, Point const& rPoint)
457 {
458  rWriter.attribute("endx", rPoint.X());
459  rWriter.attribute("endy", rPoint.Y());
460 }
461 
462 void writeSize(tools::XmlWriter& rWriter, Size const& rSize)
463 {
464  rWriter.attribute("width", rSize.Width());
465  rWriter.attribute("height", rSize.Height());
466 }
467 
468 void writeRectangle(tools::XmlWriter& rWriter, tools::Rectangle const& rRectangle)
469 {
470  rWriter.attribute("left", rRectangle.Left());
471  rWriter.attribute("top", rRectangle.Top());
472  if (rRectangle.IsWidthEmpty())
473  rWriter.attribute("right", OString("empty"));
474  else
475  rWriter.attribute("right", rRectangle.Right());
476  if (rRectangle.IsHeightEmpty())
477  rWriter.attribute("bottom", OString("empty"));
478  else
479  rWriter.attribute("bottom", rRectangle.Bottom());
480 }
481 
482 void writeLineInfo(tools::XmlWriter& rWriter, LineInfo const& rLineInfo)
483 {
484  rWriter.attribute("style", convertLineStyleToString(rLineInfo.GetStyle()));
485  rWriter.attribute("width", rLineInfo.GetWidth());
486  rWriter.attribute("dashlen", rLineInfo.GetDashLen());
487  rWriter.attribute("dashcount", rLineInfo.GetDashCount());
488  rWriter.attribute("dotlen", rLineInfo.GetDotLen());
489  rWriter.attribute("dotcount", rLineInfo.GetDotCount());
490  rWriter.attribute("distance", rLineInfo.GetDistance());
491  rWriter.attribute("join", convertLineJoinToString(rLineInfo.GetLineJoin()));
492  rWriter.attribute("cap", convertLineCapToString(rLineInfo.GetLineCap()));
493 }
494 
495 void writeGradient(tools::XmlWriter& rWriter, Gradient const& rGradient)
496 {
497  rWriter.attribute("style", convertGradientStyle(rGradient.GetStyle()));
498  rWriter.attribute("startcolor", convertColorToString(rGradient.GetStartColor()));
499  rWriter.attribute("endcolor", convertColorToString(rGradient.GetEndColor()));
500  rWriter.attribute("angle", rGradient.GetAngle().get());
501  rWriter.attribute("border", rGradient.GetBorder());
502  rWriter.attribute("offsetx", rGradient.GetOfsX());
503  rWriter.attribute("offsety", rGradient.GetOfsY());
504  rWriter.attribute("startintensity", rGradient.GetStartIntensity());
505  rWriter.attribute("endintensity", rGradient.GetEndIntensity());
506  rWriter.attribute("steps", rGradient.GetSteps());
507 }
508 
509 } // anonymous namespace
510 
512 {
513  maFilter.fill(false);
514 }
515 
517 {}
518 
519 void MetafileXmlDump::filterActionType(const MetaActionType nActionType, bool bShouldFilter)
520 {
521  maFilter[nActionType] = bShouldFilter;
522 }
523 
525 {
526  maFilter.fill(true);
527 }
528 
529 void MetafileXmlDump::dump(const GDIMetaFile& rMetaFile, SvStream& rStream)
530 {
531  tools::XmlWriter aWriter(&rStream);
532  aWriter.startDocument();
533  aWriter.startElement("metafile");
534 
535  writeXml(rMetaFile, aWriter);
536 
537  aWriter.endElement();
538  aWriter.endDocument();
539 }
540 
542 {
543  MapMode aMtfMapMode = rMetaFile.GetPrefMapMode();
544  rWriter.attribute("mapunit", convertMapUnitToString(aMtfMapMode.GetMapUnit()));
545  writePoint(rWriter, aMtfMapMode.GetOrigin());
546  rWriter.attribute("scalex", convertFractionToString(aMtfMapMode.GetScaleX()));
547  rWriter.attribute("scaley", convertFractionToString(aMtfMapMode.GetScaleY()));
548 
549  Size aMtfSize = rMetaFile.GetPrefSize();
550  writeSize(rWriter, aMtfSize);
551 
552  for(size_t nAction = 0; nAction < rMetaFile.GetActionSize(); ++nAction)
553  {
554  MetaAction* pAction = rMetaFile.GetAction(nAction);
555  const MetaActionType nActionType = pAction->GetType();
556  if (maFilter[nActionType])
557  continue;
558 
559  OString sCurrentElementTag = convertLineStyleToString(nActionType);
560 
561  switch (nActionType)
562  {
564  {
565  rWriter.startElement(sCurrentElementTag);
566  rWriter.endElement();
567  }
568  break;
569 
571  {
572  auto* pMetaAction = static_cast<MetaPixelAction*>(pAction);
573  rWriter.startElement(sCurrentElementTag);
574  writePoint(rWriter, pMetaAction->GetPoint());
575  rWriter.attribute("color", convertColorToString(pMetaAction->GetColor()));
576  rWriter.endElement();
577  }
578  break;
579 
581  {
582  auto* pMetaAction = static_cast<MetaPointAction*>(pAction);
583  rWriter.startElement(sCurrentElementTag);
584  writePoint(rWriter, pMetaAction->GetPoint());
585  rWriter.endElement();
586  }
587  break;
588 
590  {
591  MetaLineAction* pMetaLineAction = static_cast<MetaLineAction*>(pAction);
592  rWriter.startElement(sCurrentElementTag);
593  writeStartPoint(rWriter, pMetaLineAction->GetStartPoint());
594  writeEndPoint(rWriter, pMetaLineAction->GetEndPoint());
595 
596  writeLineInfo(rWriter, pMetaLineAction->GetLineInfo());
597  rWriter.endElement();
598  }
599  break;
600 
602  {
603  MetaRectAction* pMetaAction = static_cast<MetaRectAction*>(pAction);
604  rWriter.startElement(sCurrentElementTag);
605  writeRectangle(rWriter, pMetaAction->GetRect());
606  rWriter.endElement();
607  }
608  break;
609 
611  {
612  auto pMetaAction = static_cast<MetaRoundRectAction*>(pAction);
613  rWriter.startElement(sCurrentElementTag);
614  writeRectangle(rWriter, pMetaAction->GetRect());
615  rWriter.attribute("horizontalround", pMetaAction->GetHorzRound());
616  rWriter.attribute("verticalround", pMetaAction->GetVertRound());
617  rWriter.endElement();
618  }
619  break;
620 
622  {
623  auto pMetaAction = static_cast<MetaEllipseAction*>(pAction);
624  rWriter.startElement(sCurrentElementTag);
625  writeRectangle(rWriter, pMetaAction->GetRect());
626  rWriter.endElement();
627  }
628  break;
629 
630  case MetaActionType::ARC:
631  {
632  auto pMetaAction = static_cast<MetaArcAction*>(pAction);
633  rWriter.startElement(sCurrentElementTag);
634  writeRectangle(rWriter, pMetaAction->GetRect());
635  writeStartPoint(rWriter, pMetaAction->GetStartPoint());
636  writeEndPoint(rWriter, pMetaAction->GetEndPoint());
637  rWriter.endElement();
638  }
639  break;
640 
641  case MetaActionType::PIE:
642  {
643  auto pMetaAction = static_cast<MetaPieAction*>(pAction);
644  rWriter.startElement(sCurrentElementTag);
645  writeRectangle(rWriter, pMetaAction->GetRect());
646  writeStartPoint(rWriter, pMetaAction->GetStartPoint());
647  writeEndPoint(rWriter, pMetaAction->GetEndPoint());
648  rWriter.endElement();
649  }
650  break;
651 
653  {
654  auto pMetaAction = static_cast<MetaChordAction*>(pAction);
655  rWriter.startElement(sCurrentElementTag);
656  writeRectangle(rWriter, pMetaAction->GetRect());
657  writeStartPoint(rWriter, pMetaAction->GetStartPoint());
658  writeEndPoint(rWriter, pMetaAction->GetEndPoint());
659  rWriter.endElement();
660  }
661  break;
662 
664  {
665  MetaPolyLineAction* pMetaPolyLineAction = static_cast<MetaPolyLineAction*>(pAction);
666  rWriter.startElement(sCurrentElementTag);
667 
668  writeLineInfo(rWriter, pMetaPolyLineAction->GetLineInfo());
669 
670  tools::Polygon aPolygon = pMetaPolyLineAction->GetPolygon();
671  bool bFlags = aPolygon.HasFlags();
672  for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
673  {
674  rWriter.startElement("point");
675  writePoint(rWriter, aPolygon[i]);
676  if (bFlags)
677  rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
678  rWriter.endElement();
679  }
680 
681  rWriter.endElement();
682  }
683  break;
684 
686  {
687  MetaPolygonAction* pMetaPolygonAction = static_cast<MetaPolygonAction*>(pAction);
688  rWriter.startElement(sCurrentElementTag);
689 
690  tools::Polygon aPolygon = pMetaPolygonAction->GetPolygon();
691  bool bFlags = aPolygon.HasFlags();
692  for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
693  {
694  rWriter.startElement("point");
695  writePoint(rWriter, aPolygon[i]);
696  if (bFlags)
697  rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
698  rWriter.endElement();
699  }
700 
701  rWriter.endElement();
702  }
703  break;
704 
706  {
707  MetaPolyPolygonAction *const pMetaPolyPolygonAction = static_cast<MetaPolyPolygonAction*>(pAction);
708  rWriter.startElement(sCurrentElementTag);
709 
710  tools::PolyPolygon const& rPolyPolygon(pMetaPolyPolygonAction->GetPolyPolygon());
711 
712  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
713  {
714  rWriter.startElement("polygon");
715  tools::Polygon const& rPolygon = rPolyPolygon[j];
716  bool bFlags = rPolygon.HasFlags();
717  for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
718  {
719  rWriter.startElement("point");
720  writePoint(rWriter, rPolygon[i]);
721  if (bFlags)
722  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
723  rWriter.endElement();
724  }
725  rWriter.endElement();
726  }
727 
728  rWriter.endElement();
729  }
730  break;
731 
733  {
734  auto* pMeta = static_cast<MetaTextAction*>(pAction);
735  rWriter.startElement(sCurrentElementTag);
736  writePoint(rWriter, pMeta->GetPoint());
737  rWriter.attribute("index", pMeta->GetIndex());
738  rWriter.attribute("length", pMeta->GetLen());
739  rWriter.startElement("textcontent");
740  rWriter.content(pMeta->GetText());
741  rWriter.endElement();
742 
743  rWriter.endElement();
744  }
745  break;
746 
748  {
749  MetaTextArrayAction* pMetaTextArrayAction = static_cast<MetaTextArrayAction*>(pAction);
750  rWriter.startElement(sCurrentElementTag);
751 
752  sal_Int32 aIndex = pMetaTextArrayAction->GetIndex();
753  sal_Int32 aLength = pMetaTextArrayAction->GetLen();
754 
755  writePoint(rWriter, pMetaTextArrayAction->GetPoint());
756  rWriter.attribute("index", aIndex);
757  rWriter.attribute("length", aLength);
758 
759  if (pMetaTextArrayAction->GetDXArray())
760  {
761  rWriter.startElement("dxarray");
762  OUStringBuffer sDxLengthString;
763  for (sal_Int32 i = 0; i < aLength - aIndex; ++i)
764  {
765  sDxLengthString.append(OUString::number(pMetaTextArrayAction->GetDXArray()[aIndex + i]));
766  sDxLengthString.append(" ");
767  }
768  rWriter.content(sDxLengthString.makeStringAndClear());
769  rWriter.endElement();
770  }
771 
772  rWriter.startElement("text");
773  rWriter.content(pMetaTextArrayAction->GetText());
774  rWriter.endElement();
775 
776  rWriter.endElement();
777  }
778  break;
779 
781  {
782  auto* pMeta = static_cast<MetaStretchTextAction*>(pAction);
783  rWriter.startElement(sCurrentElementTag);
784 
785  writePoint(rWriter, pMeta->GetPoint());
786  rWriter.attribute("index", pMeta->GetIndex());
787  rWriter.attribute("length", pMeta->GetLen());
788  rWriter.attribute("width", pMeta->GetWidth());
789 
790  rWriter.startElement("textcontent");
791  rWriter.content(pMeta->GetText());
792  rWriter.endElement();
793 
794  rWriter.endElement();
795  }
796  break;
797 
799  {
800  auto* pMeta = static_cast<MetaTextRectAction*>(pAction);
801  rWriter.startElement(sCurrentElementTag);
802  writeRectangle(rWriter, pMeta->GetRect());
803  rWriter.startElement("textcontent");
804  rWriter.content(pMeta->GetText());
805  rWriter.endElement();
806 
807  rWriter.startElement("style");
808  rWriter.content(convertDrawTextFlagsToString(pMeta->GetStyle()));
809  rWriter.endElement();
810 
811  rWriter.endElement();
812  }
813  break;
814 
815  case MetaActionType::BMP:
816  {
817  auto pMeta = static_cast<MetaBmpAction*>(pAction);
818  rWriter.startElement(sCurrentElementTag);
819  writePoint(rWriter, pMeta->GetPoint());
820  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
821  rWriter.endElement();
822  }
823  break;
824 
826  {
827  auto pMeta = static_cast<MetaBmpScaleAction*>(pAction);
828  rWriter.startElement(sCurrentElementTag);
829  writePoint(rWriter, pMeta->GetPoint());
830  writeSize(rWriter, pMeta->GetSize());
831  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
832  rWriter.endElement();
833  }
834  break;
835 
837  {
838  auto pMeta = static_cast<MetaBmpScalePartAction*>(pAction);
839  rWriter.startElement(sCurrentElementTag);
840  rWriter.attribute("destx", pMeta->GetDestPoint().X());
841  rWriter.attribute("desty", pMeta->GetDestPoint().Y());
842  rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
843  rWriter.attribute("destheight", pMeta->GetDestSize().Height());
844  rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
845  rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
846  rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
847  rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
848  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
849  rWriter.endElement();
850  }
851  break;
852 
854  {
855  auto pMeta = static_cast<MetaBmpExAction*>(pAction);
856  rWriter.startElement(sCurrentElementTag);
857  writePoint(rWriter, pMeta->GetPoint());
858  rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
859  rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
860  rWriter.endElement();
861  }
862  break;
863 
865  {
866  auto pMeta = static_cast<MetaBmpExScaleAction*>(pAction);
867  rWriter.startElement(sCurrentElementTag);
868  writePoint(rWriter, pMeta->GetPoint());
869  writeSize(rWriter, pMeta->GetSize());
870  rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
871  rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
872  rWriter.endElement();
873  }
874  break;
875 
877  {
878  auto pMeta = static_cast<MetaBmpExScalePartAction*>(pAction);
879  rWriter.startElement(sCurrentElementTag);
880  rWriter.attribute("destx", pMeta->GetDestPoint().X());
881  rWriter.attribute("desty", pMeta->GetDestPoint().Y());
882  rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
883  rWriter.attribute("destheight", pMeta->GetDestSize().Height());
884  rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
885  rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
886  rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
887  rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
888  rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
889  rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
890  rWriter.endElement();
891  }
892  break;
893 
895  {
896  auto pMeta = static_cast<MetaMaskAction*>(pAction);
897  rWriter.startElement(sCurrentElementTag);
898  writePoint(rWriter, pMeta->GetPoint());
899  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
900  rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
901  rWriter.endElement();
902  }
903  break;
904 
906  {
907  auto pMeta = static_cast<MetaMaskScaleAction*>(pAction);
908  rWriter.startElement(sCurrentElementTag);
909  writePoint(rWriter, pMeta->GetPoint());
910  writeSize(rWriter, pMeta->GetSize());
911  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
912  rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
913  rWriter.endElement();
914  }
915  break;
916 
918  {
919  auto pMeta = static_cast<MetaMaskScalePartAction*>(pAction);
920  rWriter.startElement(sCurrentElementTag);
921  rWriter.attribute("destx", pMeta->GetDestPoint().X());
922  rWriter.attribute("desty", pMeta->GetDestPoint().Y());
923  rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
924  rWriter.attribute("destheight", pMeta->GetDestSize().Height());
925  rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
926  rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
927  rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
928  rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
929  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
930  rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
931  rWriter.endElement();
932  }
933  break;
934 
936  {
937  const MetaGradientAction* pMeta = static_cast<MetaGradientAction*>(pAction);
938 
939  rWriter.startElement(sCurrentElementTag);
940  writeGradient(rWriter, pMeta->GetGradient());
941 
942  rWriter.startElement("rectangle");
943  writeRectangle(rWriter, pMeta->GetRect());
944  rWriter.endElement();
945 
946  rWriter.endElement();
947  }
948  break;
949 
951  {
952  auto* const pMetaHatchAction = static_cast<MetaHatchAction*>(pAction);
953  rWriter.startElement(sCurrentElementTag);
954 
955  tools::PolyPolygon const& rPolyPolygon(pMetaHatchAction->GetPolyPolygon());
956 
957  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
958  {
959  rWriter.startElement("polygon");
960  tools::Polygon const& rPolygon = rPolyPolygon[j];
961  bool bFlags = rPolygon.HasFlags();
962  for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
963  {
964  rWriter.startElement("point");
965  writePoint(rWriter, rPolygon[i]);
966  if (bFlags)
967  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
968  rWriter.endElement();
969  }
970  rWriter.endElement();
971  }
972 
973  rWriter.startElement("hatch");
974  const auto& rHatch = pMetaHatchAction->GetHatch();
975  rWriter.attribute("style", convertHatchStyle(rHatch.GetStyle()));
976  rWriter.attribute("color", convertColorToString(rHatch.GetColor()));
977  rWriter.attribute("distance", sal_Int32(rHatch.GetDistance()));
978  rWriter.attribute("angle", sal_Int32(rHatch.GetAngle().get()));
979  rWriter.endElement();
980 
981  rWriter.endElement();
982  }
983  break;
984 
986  {
987  const auto* pMetaAction = static_cast<const MetaWallpaperAction*>(pAction);
988  rWriter.startElement(sCurrentElementTag);
989 
990  writeRectangle(rWriter, pMetaAction->GetRect());
991 
992  rWriter.startElement("wallpaper");
993  const auto& rWallpaper = pMetaAction->GetWallpaper();
994 
995  rWriter.attribute("color", convertColorToString(rWallpaper.GetColor()));
996 
997  WallpaperStyle eStyle = rWallpaper.GetStyle();
998  rWriter.attribute("style", convertWallpaperStyleToString(eStyle));
999 
1000  if (rWallpaper.IsBitmap())
1001  {
1002  rWriter.startElement("bitmap");
1003  BitmapEx const & rBitmapEx = rWallpaper.GetBitmap();
1004  rWriter.attribute("crc", hex32(rBitmapEx.GetChecksum()));
1005  rWriter.attribute("transparenttype", convertBitmapExTransparentType(rBitmapEx.GetTransparentType()));
1006  rWriter.attribute("pixelformat", convertPixelFormatToString(rBitmapEx.GetBitmap().getPixelFormat()));
1007  rWriter.attribute("width", hex32(rBitmapEx.GetSizePixel().Width()));
1008  rWriter.attribute("height", hex32(rBitmapEx.GetSizePixel().Height()));
1009  rWriter.endElement();
1010  }
1011 
1012  if (rWallpaper.IsGradient())
1013  {
1014  rWriter.startElement("gradient");
1015  Gradient aGradient = rWallpaper.GetGradient();
1016  writeGradient(rWriter, aGradient);
1017  rWriter.endElement();
1018  }
1019 
1020  if (rWallpaper.IsRect())
1021  {
1022  tools::Rectangle aRect = rWallpaper.GetRect();
1023  rWriter.startElement("rectangle");
1024  writeRectangle(rWriter, aRect);
1025  rWriter.endElement();
1026  }
1027 
1028  rWriter.attribute("fixed", rWallpaper.IsFixed() ? "true" : "false");
1029  rWriter.attribute("scrollable", rWallpaper.IsScrollable() ? "true" : "false");
1030 
1031  rWriter.endElement();
1032 
1033  rWriter.endElement();
1034  }
1035  break;
1036 
1038  {
1039  const auto* pMetaClipRegionAction = static_cast<const MetaClipRegionAction*>(pAction);
1040  rWriter.startElement(sCurrentElementTag);
1041 
1042  // FIXME for now we dump only the bounding box; this is
1043  // enough for the tests we have, but may need extending to
1044  // dumping the real polypolygon in the future
1045  tools::Rectangle aRectangle = pMetaClipRegionAction->GetRegion().GetBoundRect();
1046  writeRectangle(rWriter, aRectangle);
1047  rWriter.endElement();
1048  }
1049  break;
1050 
1052  {
1053  MetaISectRectClipRegionAction* pMetaISectRectClipRegionAction = static_cast<MetaISectRectClipRegionAction*>(pAction);
1054  rWriter.startElement(sCurrentElementTag);
1055 
1056  tools::Rectangle aRectangle = pMetaISectRectClipRegionAction->GetRect();
1057  writeRectangle(rWriter, aRectangle);
1058  rWriter.endElement();
1059  }
1060  break;
1061 
1063  {
1064  MetaISectRegionClipRegionAction* pMetaISectRegionClipRegionAction = static_cast<MetaISectRegionClipRegionAction*>(pAction);
1065  rWriter.startElement(sCurrentElementTag);
1066 
1067  // FIXME for now we dump only the bounding box; this is
1068  // enough for the tests we have, but may need extending to
1069  // dumping the real polypolygon in the future
1070  tools::Rectangle aRectangle = pMetaISectRegionClipRegionAction->GetRegion().GetBoundRect();
1071  writeRectangle(rWriter, aRectangle);
1072  rWriter.endElement();
1073  }
1074  break;
1075 
1076  // case MetaActionType::MOVECLIPREGION:
1077 
1079  {
1080  MetaLineColorAction* pMetaLineColorAction = static_cast<MetaLineColorAction*>(pAction);
1081  rWriter.startElement(sCurrentElementTag);
1082 
1083  rWriter.attribute("color", convertColorToString(pMetaLineColorAction->GetColor()));
1084  rWriter.endElement();
1085  }
1086  break;
1087 
1089  {
1090  MetaFillColorAction* pMetaFillColorAction = static_cast<MetaFillColorAction*>(pAction);
1091  rWriter.startElement(sCurrentElementTag);
1092 
1093  rWriter.attribute("color", convertColorToString(pMetaFillColorAction->GetColor()));
1094  rWriter.endElement();
1095  }
1096  break;
1097 
1099  {
1100  MetaTextColorAction* pMetaTextColorAction = static_cast<MetaTextColorAction*>(pAction);
1101  rWriter.startElement(sCurrentElementTag);
1102 
1103  rWriter.attribute("color", convertColorToString(pMetaTextColorAction->GetColor()));
1104  rWriter.endElement();
1105  }
1106  break;
1107 
1109  {
1110  MetaTextFillColorAction* pMetaTextFillColorAction = static_cast<MetaTextFillColorAction*>(pAction);
1111  rWriter.startElement(sCurrentElementTag);
1112 
1113  rWriter.attribute("color", convertColorToString(pMetaTextFillColorAction->GetColor()));
1114 
1115  if (pMetaTextFillColorAction->IsSetting())
1116  rWriter.attribute("setting", u"true");
1117 
1118  rWriter.endElement();
1119  }
1120  break;
1121 
1123  {
1124  MetaTextAlignAction* pMetaTextAlignAction = static_cast<MetaTextAlignAction*>(pAction);
1125  rWriter.startElement(sCurrentElementTag);
1126  OUString sAlign = convertTextAlignToString(pMetaTextAlignAction->GetTextAlign());
1127  if (!sAlign.isEmpty())
1128  rWriter.attribute("align", sAlign);
1129  rWriter.endElement();
1130  }
1131  break;
1132 
1134  {
1135  const MetaMapModeAction* pMeta = static_cast<MetaMapModeAction*>(pAction);
1136  MapMode aMapMode = pMeta->GetMapMode();
1137  rWriter.startElement(sCurrentElementTag);
1138  rWriter.attribute("mapunit", convertMapUnitToString( aMapMode.GetMapUnit() ));
1139  writePoint(rWriter, aMapMode.GetOrigin());
1140  rWriter.attribute("scalex", convertFractionToString(aMapMode.GetScaleX()));
1141  rWriter.attribute("scaley", convertFractionToString(aMapMode.GetScaleY()));
1142  rWriter.endElement();
1143  }
1144  break;
1145 
1146  case MetaActionType::FONT:
1147  {
1148  MetaFontAction* pMetaFontAction = static_cast<MetaFontAction*>(pAction);
1149  rWriter.startElement(sCurrentElementTag);
1150 
1151  vcl::Font aFont = pMetaFontAction->GetFont();
1152 
1153  rWriter.attribute("color", convertColorToString(aFont.GetColor()));
1154  rWriter.attribute("fillcolor", convertColorToString(aFont.GetFillColor()));
1155  rWriter.attribute("name", aFont.GetFamilyName());
1156  rWriter.attribute("stylename", aFont.GetStyleName());
1157  rWriter.attribute("width", aFont.GetFontSize().Width());
1158  rWriter.attribute("height", aFont.GetFontSize().Height());
1159  rWriter.attribute("orientation", aFont.GetOrientation().get());
1160  rWriter.attribute("weight", convertFontWeightToString(aFont.GetWeight()));
1161  rWriter.attribute("vertical", aFont.IsVertical() ? "true" : "false");
1162 
1163  rWriter.endElement();
1164  }
1165  break;
1166 
1167  case MetaActionType::PUSH:
1168  {
1169  MetaPushAction* pMetaPushAction = static_cast<MetaPushAction*>(pAction);
1170  rWriter.startElement(sCurrentElementTag);
1171 
1172  rWriter.attribute("flags", collectPushFlags(pMetaPushAction->GetFlags()));
1173  }
1174  break;
1175 
1176  case MetaActionType::POP:
1177  {
1178  rWriter.endElement();
1179  }
1180  break;
1181 
1183  {
1184  MetaRasterOpAction* pMetaRasterOpAction = static_cast<MetaRasterOpAction*>(pAction);
1185  rWriter.startElement(sCurrentElementTag);
1186 
1187  if (pMetaRasterOpAction->GetRasterOp() != RasterOp::OverPaint)
1188  {
1189  rWriter.attribute("operation", convertRopToString(pMetaRasterOpAction->GetRasterOp()));
1190  }
1191  rWriter.endElement();
1192  }
1193  break;
1194 
1196  {
1197  const MetaTransparentAction* pMeta = static_cast<MetaTransparentAction*>(pAction);
1198 
1199  rWriter.startElement(sCurrentElementTag);
1200  rWriter.attribute("transparence", pMeta->GetTransparence());
1201 
1202  tools::PolyPolygon const& rPolyPolygon(pMeta->GetPolyPolygon());
1203 
1204  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
1205  {
1206  rWriter.startElement("polygon");
1207  tools::Polygon const& rPolygon = rPolyPolygon[j];
1208  bool bFlags = rPolygon.HasFlags();
1209  for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
1210  {
1211  rWriter.startElement("point");
1212  writePoint(rWriter, rPolygon[i]);
1213  if (bFlags)
1214  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
1215  rWriter.endElement();
1216  }
1217  rWriter.endElement();
1218  }
1219 
1220  rWriter.endElement();
1221  }
1222  break;
1223 
1224  //case MetaActionType::EPS:
1225 
1227  {
1228  auto* pMeta = static_cast<MetaRefPointAction*>(pAction);
1229  rWriter.startElement(sCurrentElementTag);
1230  writePoint(rWriter, pMeta->GetRefPoint());
1231  rWriter.attribute("set", pMeta->IsSetting() ? "true" : "false");
1232  rWriter.endElement();
1233  }
1234  break;
1235 
1237  {
1238  auto* pMeta = static_cast<MetaTextLineColorAction*>(pAction);
1239  rWriter.startElement(sCurrentElementTag);
1240  rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
1241  rWriter.endElement();
1242  }
1243  break;
1244 
1246  {
1247  auto* pMeta = static_cast<MetaTextLineAction*>(pAction);
1248  rWriter.startElement(sCurrentElementTag);
1249  writePoint(rWriter, pMeta->GetStartPoint());
1250  rWriter.attribute("width", pMeta->GetWidth());
1251  rWriter.attribute("strikeout", convertFontStrikeoutToString(pMeta->GetStrikeout()));
1252  rWriter.attribute("underline", convertFontLineStyleToString(pMeta->GetUnderline()));
1253  rWriter.attribute("overline", convertFontLineStyleToString(pMeta->GetOverline()));
1254  rWriter.endElement();
1255  }
1256  break;
1257 
1259  {
1260  const auto* pMeta = static_cast<MetaFloatTransparentAction*>(pAction);
1261  rWriter.startElement(sCurrentElementTag);
1262  writePoint(rWriter, pMeta->GetPoint());
1263  writeSize(rWriter, pMeta->GetSize());
1264  rWriter.attribute("transparent", pMeta->IsTransparent() ? "true" : "false");
1265 
1266  rWriter.startElement("gradient");
1267  writeGradient(rWriter, pMeta->GetGradient());
1268  rWriter.endElement();
1269 
1270  rWriter.startElement("metafile");
1271  writeXml(pMeta->GetGDIMetaFile(), rWriter);
1272  rWriter.endElement();
1273 
1274  rWriter.endElement();
1275  }
1276  break;
1277 
1278  //case MetaActionType::GRADIENTEX:
1279  //case MetaActionType::LAYOUTMODE:
1280  //case MetaActionType::TEXTLANGUAGE:
1281 
1283  {
1284  const auto* pMetaAction = static_cast<MetaOverlineColorAction*>(pAction);
1285  rWriter.startElement(sCurrentElementTag);
1286  rWriter.attribute("color", convertColorToString(pMetaAction->GetColor()));
1287  rWriter.endElement();
1288  }
1289  break;
1290 
1292  {
1293  MetaCommentAction* pMetaCommentAction = static_cast<MetaCommentAction*>(pAction);
1294  rWriter.startElement(sCurrentElementTag);
1295 
1296  if (pMetaCommentAction->GetDataSize() > 0)
1297  {
1298  rWriter.attribute("datasize", pMetaCommentAction->GetDataSize());
1299  }
1300  if (!pMetaCommentAction->GetComment().isEmpty())
1301  {
1302  rWriter.startElement("comment");
1303  rWriter.content(pMetaCommentAction->GetComment());
1304  rWriter.endElement();
1305  }
1306 
1307  rWriter.endElement();
1308  }
1309  break;
1310 
1311  default:
1312  {
1313  rWriter.startElement(sCurrentElementTag);
1314  rWriter.attribute("note", OString("not implemented in xml dump"));
1315  rWriter.endElement();
1316  }
1317  break;
1318  }
1319  }
1320 }
1321 
1322 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString AsRGBHexString() const
PixelFormat
Pixel format of the bitmap in bits per pixel.
Definition: BitmapTypes.hxx:16
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:529
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
TransparentType
Definition: bitmapex.hxx:37
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:541
WEIGHT_LIGHT
BitmapChecksum GetChecksum() const
Definition: BitmapEx.cxx:280
void fill(V val)
void filterAllActionTypes()
Definition: mtfxmldump.cxx:524
LINESTYLE_DASH
WEIGHT_BOLD
LINESTYLE_DASHDOT
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
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
tools::Long Width() const
WEIGHT_NORMAL
LINESTYLE_SINGLE
WEIGHT_ULTRALIGHT
float u
TransparentType GetTransparentType() const
Definition: bitmapex.hxx:73
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
DrawTextFlags
Definition: outdev.hxx:143
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:229
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
LINESTYLE_DOTTED
WallpaperStyle
Definition: wall.hxx:32
MetaAction * GetAction(size_t nAction) const
Definition: gdimtf.cxx:185
const Color & GetEndColor() const
void filterActionType(const MetaActionType nActionType, bool bShouldFilter)
Definition: mtfxmldump.cxx:519
TextAlign_FORCE_EQUAL_SIZE
tools::Long Height() const
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:83
const Color & GetColor() const
Definition: metaact.hxx:1251
FontLineStyle
sal_uInt16 GetStartIntensity() const
FontStrikeout
tools::Long Right() const
LINESTYLE_BOLDDASHDOT
STRIKEOUT_BOLD
HatchStyle
PolyFlags