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