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  for(size_t nAction = 0; nAction < rMetaFile.GetActionSize(); ++nAction)
532  {
533  MetaAction* pAction = rMetaFile.GetAction(nAction);
534  const MetaActionType nActionType = pAction->GetType();
535  if (maFilter[nActionType])
536  continue;
537 
538  OString sCurrentElementTag = convertLineStyleToString(nActionType);
539 
540  switch (nActionType)
541  {
543  {
544  rWriter.startElement(sCurrentElementTag);
545  rWriter.endElement();
546  }
547  break;
548 
550  {
551  auto* pMetaAction = static_cast<MetaPixelAction*>(pAction);
552  rWriter.startElement(sCurrentElementTag);
553  writePoint(rWriter, pMetaAction->GetPoint());
554  rWriter.attribute("color", convertColorToString(pMetaAction->GetColor()));
555  rWriter.endElement();
556  }
557  break;
558 
560  {
561  auto* pMetaAction = static_cast<MetaPointAction*>(pAction);
562  rWriter.startElement(sCurrentElementTag);
563  writePoint(rWriter, pMetaAction->GetPoint());
564  rWriter.endElement();
565  }
566  break;
567 
569  {
570  MetaLineAction* pMetaLineAction = static_cast<MetaLineAction*>(pAction);
571  rWriter.startElement(sCurrentElementTag);
572  writeStartPoint(rWriter, pMetaLineAction->GetStartPoint());
573  writeEndPoint(rWriter, pMetaLineAction->GetEndPoint());
574 
575  writeLineInfo(rWriter, pMetaLineAction->GetLineInfo());
576  rWriter.endElement();
577  }
578  break;
579 
581  {
582  MetaRectAction* pMetaAction = static_cast<MetaRectAction*>(pAction);
583  rWriter.startElement(sCurrentElementTag);
584  writeRectangle(rWriter, pMetaAction->GetRect());
585  rWriter.endElement();
586  }
587  break;
588 
590  {
591  auto pMetaAction = static_cast<MetaRoundRectAction*>(pAction);
592  rWriter.startElement(sCurrentElementTag);
593  writeRectangle(rWriter, pMetaAction->GetRect());
594  rWriter.attribute("horizontalround", pMetaAction->GetHorzRound());
595  rWriter.attribute("verticalround", pMetaAction->GetVertRound());
596  rWriter.endElement();
597  }
598  break;
599 
601  {
602  auto pMetaAction = static_cast<MetaEllipseAction*>(pAction);
603  rWriter.startElement(sCurrentElementTag);
604  writeRectangle(rWriter, pMetaAction->GetRect());
605  rWriter.endElement();
606  }
607  break;
608 
609  case MetaActionType::ARC:
610  {
611  auto pMetaAction = static_cast<MetaArcAction*>(pAction);
612  rWriter.startElement(sCurrentElementTag);
613  writeRectangle(rWriter, pMetaAction->GetRect());
614  writeStartPoint(rWriter, pMetaAction->GetStartPoint());
615  writeEndPoint(rWriter, pMetaAction->GetEndPoint());
616  rWriter.endElement();
617  }
618  break;
619 
620  case MetaActionType::PIE:
621  {
622  auto pMetaAction = static_cast<MetaPieAction*>(pAction);
623  rWriter.startElement(sCurrentElementTag);
624  writeRectangle(rWriter, pMetaAction->GetRect());
625  writeStartPoint(rWriter, pMetaAction->GetStartPoint());
626  writeEndPoint(rWriter, pMetaAction->GetEndPoint());
627  rWriter.endElement();
628  }
629  break;
630 
632  {
633  auto pMetaAction = static_cast<MetaChordAction*>(pAction);
634  rWriter.startElement(sCurrentElementTag);
635  writeRectangle(rWriter, pMetaAction->GetRect());
636  writeStartPoint(rWriter, pMetaAction->GetStartPoint());
637  writeEndPoint(rWriter, pMetaAction->GetEndPoint());
638  rWriter.endElement();
639  }
640  break;
641 
643  {
644  MetaPolyLineAction* pMetaPolyLineAction = static_cast<MetaPolyLineAction*>(pAction);
645  rWriter.startElement(sCurrentElementTag);
646 
647  writeLineInfo(rWriter, pMetaPolyLineAction->GetLineInfo());
648 
649  tools::Polygon aPolygon = pMetaPolyLineAction->GetPolygon();
650  bool bFlags = aPolygon.HasFlags();
651  for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
652  {
653  rWriter.startElement("point");
654  writePoint(rWriter, aPolygon[i]);
655  if (bFlags)
656  rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
657  rWriter.endElement();
658  }
659 
660  rWriter.endElement();
661  }
662  break;
663 
665  {
666  MetaPolygonAction* pMetaPolygonAction = static_cast<MetaPolygonAction*>(pAction);
667  rWriter.startElement(sCurrentElementTag);
668 
669  tools::Polygon aPolygon = pMetaPolygonAction->GetPolygon();
670  bool bFlags = aPolygon.HasFlags();
671  for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
672  {
673  rWriter.startElement("point");
674  writePoint(rWriter, aPolygon[i]);
675  if (bFlags)
676  rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
677  rWriter.endElement();
678  }
679 
680  rWriter.endElement();
681  }
682  break;
683 
685  {
686  MetaPolyPolygonAction *const pMetaPolyPolygonAction = static_cast<MetaPolyPolygonAction*>(pAction);
687  rWriter.startElement(sCurrentElementTag);
688 
689  tools::PolyPolygon const& rPolyPolygon(pMetaPolyPolygonAction->GetPolyPolygon());
690 
691  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
692  {
693  rWriter.startElement("polygon");
694  tools::Polygon const& rPolygon = rPolyPolygon[j];
695  bool bFlags = rPolygon.HasFlags();
696  for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
697  {
698  rWriter.startElement("point");
699  writePoint(rWriter, rPolygon[i]);
700  if (bFlags)
701  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
702  rWriter.endElement();
703  }
704  rWriter.endElement();
705  }
706 
707  rWriter.endElement();
708  }
709  break;
710 
712  {
713  auto* pMeta = static_cast<MetaTextAction*>(pAction);
714  rWriter.startElement(sCurrentElementTag);
715  writePoint(rWriter, pMeta->GetPoint());
716  rWriter.attribute("index", pMeta->GetIndex());
717  rWriter.attribute("length", pMeta->GetLen());
718  rWriter.startElement("textcontent");
719  rWriter.content(pMeta->GetText());
720  rWriter.endElement();
721 
722  rWriter.endElement();
723  }
724  break;
725 
727  {
728  MetaTextArrayAction* pMetaTextArrayAction = static_cast<MetaTextArrayAction*>(pAction);
729  rWriter.startElement(sCurrentElementTag);
730 
731  sal_Int32 aIndex = pMetaTextArrayAction->GetIndex();
732  sal_Int32 aLength = pMetaTextArrayAction->GetLen();
733 
734  writePoint(rWriter, pMetaTextArrayAction->GetPoint());
735  rWriter.attribute("index", aIndex);
736  rWriter.attribute("length", aLength);
737 
738  if (pMetaTextArrayAction->GetDXArray())
739  {
740  rWriter.startElement("dxarray");
741  OUStringBuffer sDxLengthString;
742  for (sal_Int32 i = 0; i < aLength - aIndex; ++i)
743  {
744  sDxLengthString.append(OUString::number(pMetaTextArrayAction->GetDXArray()[aIndex + i]));
745  sDxLengthString.append(" ");
746  }
747  rWriter.content(sDxLengthString.makeStringAndClear());
748  rWriter.endElement();
749  }
750 
751  rWriter.startElement("text");
752  rWriter.content(pMetaTextArrayAction->GetText());
753  rWriter.endElement();
754 
755  rWriter.endElement();
756  }
757  break;
758 
760  {
761  auto* pMeta = static_cast<MetaStretchTextAction*>(pAction);
762  rWriter.startElement(sCurrentElementTag);
763 
764  writePoint(rWriter, pMeta->GetPoint());
765  rWriter.attribute("index", pMeta->GetIndex());
766  rWriter.attribute("length", pMeta->GetLen());
767  rWriter.attribute("width", pMeta->GetWidth());
768 
769  rWriter.startElement("textcontent");
770  rWriter.content(pMeta->GetText());
771  rWriter.endElement();
772 
773  rWriter.endElement();
774  }
775  break;
776 
778  {
779  auto* pMeta = static_cast<MetaTextRectAction*>(pAction);
780  rWriter.startElement(sCurrentElementTag);
781  writeRectangle(rWriter, pMeta->GetRect());
782  rWriter.startElement("textcontent");
783  rWriter.content(pMeta->GetText());
784  rWriter.endElement();
785 
786  rWriter.startElement("style");
787  rWriter.content(convertDrawTextFlagsToString(pMeta->GetStyle()));
788  rWriter.endElement();
789 
790  rWriter.endElement();
791  }
792  break;
793 
794  case MetaActionType::BMP:
795  {
796  auto pMeta = static_cast<MetaBmpAction*>(pAction);
797  rWriter.startElement(sCurrentElementTag);
798  writePoint(rWriter, pMeta->GetPoint());
799  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
800  rWriter.endElement();
801  }
802  break;
803 
805  {
806  auto pMeta = static_cast<MetaBmpScaleAction*>(pAction);
807  rWriter.startElement(sCurrentElementTag);
808  writePoint(rWriter, pMeta->GetPoint());
809  writeSize(rWriter, pMeta->GetSize());
810  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
811  rWriter.endElement();
812  }
813  break;
814 
816  {
817  auto pMeta = static_cast<MetaBmpScalePartAction*>(pAction);
818  rWriter.startElement(sCurrentElementTag);
819  rWriter.attribute("destx", pMeta->GetDestPoint().X());
820  rWriter.attribute("desty", pMeta->GetDestPoint().Y());
821  rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
822  rWriter.attribute("destheight", pMeta->GetDestSize().Height());
823  rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
824  rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
825  rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
826  rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
827  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
828  rWriter.endElement();
829  }
830  break;
831 
833  {
834  auto pMeta = static_cast<MetaBmpExAction*>(pAction);
835  rWriter.startElement(sCurrentElementTag);
836  writePoint(rWriter, pMeta->GetPoint());
837  rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
838  rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
839  rWriter.endElement();
840  }
841  break;
842 
844  {
845  auto pMeta = static_cast<MetaBmpExScaleAction*>(pAction);
846  rWriter.startElement(sCurrentElementTag);
847  writePoint(rWriter, pMeta->GetPoint());
848  writeSize(rWriter, pMeta->GetSize());
849  rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
850  rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
851  rWriter.endElement();
852  }
853  break;
854 
856  {
857  auto pMeta = static_cast<MetaBmpExScalePartAction*>(pAction);
858  rWriter.startElement(sCurrentElementTag);
859  rWriter.attribute("destx", pMeta->GetDestPoint().X());
860  rWriter.attribute("desty", pMeta->GetDestPoint().Y());
861  rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
862  rWriter.attribute("destheight", pMeta->GetDestSize().Height());
863  rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
864  rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
865  rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
866  rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
867  rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
868  rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
869  rWriter.endElement();
870  }
871  break;
872 
874  {
875  auto pMeta = static_cast<MetaMaskAction*>(pAction);
876  rWriter.startElement(sCurrentElementTag);
877  writePoint(rWriter, pMeta->GetPoint());
878  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
879  rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
880  rWriter.endElement();
881  }
882  break;
883 
885  {
886  auto pMeta = static_cast<MetaMaskScaleAction*>(pAction);
887  rWriter.startElement(sCurrentElementTag);
888  writePoint(rWriter, pMeta->GetPoint());
889  writeSize(rWriter, pMeta->GetSize());
890  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
891  rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
892  rWriter.endElement();
893  }
894  break;
895 
897  {
898  auto pMeta = static_cast<MetaMaskScalePartAction*>(pAction);
899  rWriter.startElement(sCurrentElementTag);
900  rWriter.attribute("destx", pMeta->GetDestPoint().X());
901  rWriter.attribute("desty", pMeta->GetDestPoint().Y());
902  rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
903  rWriter.attribute("destheight", pMeta->GetDestSize().Height());
904  rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
905  rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
906  rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
907  rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
908  rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
909  rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
910  rWriter.endElement();
911  }
912  break;
913 
915  {
916  const MetaGradientAction* pMeta = static_cast<MetaGradientAction*>(pAction);
917 
918  rWriter.startElement(sCurrentElementTag);
919  writeGradient(rWriter, pMeta->GetGradient());
920 
921  rWriter.startElement("rectangle");
922  writeRectangle(rWriter, pMeta->GetRect());
923  rWriter.endElement();
924 
925  rWriter.endElement();
926  }
927  break;
928 
930  {
931  auto* const pMetaHatchAction = static_cast<MetaHatchAction*>(pAction);
932  rWriter.startElement(sCurrentElementTag);
933 
934  tools::PolyPolygon const& rPolyPolygon(pMetaHatchAction->GetPolyPolygon());
935 
936  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
937  {
938  rWriter.startElement("polygon");
939  tools::Polygon const& rPolygon = rPolyPolygon[j];
940  bool bFlags = rPolygon.HasFlags();
941  for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
942  {
943  rWriter.startElement("point");
944  writePoint(rWriter, rPolygon[i]);
945  if (bFlags)
946  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
947  rWriter.endElement();
948  }
949  rWriter.endElement();
950  }
951 
952  rWriter.startElement("hatch");
953  const auto& rHatch = pMetaHatchAction->GetHatch();
954  rWriter.attribute("style", convertHatchStyle(rHatch.GetStyle()));
955  rWriter.attribute("color", convertColorToString(rHatch.GetColor()));
956  rWriter.attribute("distance", sal_Int32(rHatch.GetDistance()));
957  rWriter.attribute("angle", sal_Int32(rHatch.GetAngle()));
958  rWriter.endElement();
959 
960  rWriter.endElement();
961  }
962  break;
963 
965  {
966  const auto* pMetaAction = static_cast<const MetaWallpaperAction*>(pAction);
967  rWriter.startElement(sCurrentElementTag);
968 
969  writeRectangle(rWriter, pMetaAction->GetRect());
970 
971  rWriter.startElement("wallpaper");
972  const auto& rWallpaper = pMetaAction->GetWallpaper();
973 
974  rWriter.attribute("color", convertColorToString(rWallpaper.GetColor()));
975 
976  WallpaperStyle eStyle = rWallpaper.GetStyle();
977  rWriter.attribute("style", convertWallpaperStyleToString(eStyle));
978 
979  if (rWallpaper.IsBitmap())
980  {
981  rWriter.startElement("bitmap");
982  BitmapEx const & rBitmapEx = rWallpaper.GetBitmap();
983  rWriter.attribute("crc", hex32(rBitmapEx.GetChecksum()));
984  rWriter.attribute("transparenttype", convertBitmapExTransparentType(rBitmapEx.GetTransparentType()));
985  rWriter.attribute("bitcount", hex32(rBitmapEx.GetBitmap().GetBitCount()));
986  rWriter.attribute("width", hex32(rBitmapEx.GetSizePixel().Width()));
987  rWriter.attribute("height", hex32(rBitmapEx.GetSizePixel().Height()));
988  rWriter.endElement();
989  }
990 
991  if (rWallpaper.IsGradient())
992  {
993  rWriter.startElement("gradient");
994  Gradient aGradient = rWallpaper.GetGradient();
995  writeGradient(rWriter, aGradient);
996  rWriter.endElement();
997  }
998 
999  if (rWallpaper.IsRect())
1000  {
1001  tools::Rectangle aRect = rWallpaper.GetRect();
1002  rWriter.startElement("rectangle");
1003  writeRectangle(rWriter, aRect);
1004  rWriter.endElement();
1005  }
1006 
1007  rWriter.attribute("fixed", rWallpaper.IsFixed() ? "true" : "false");
1008  rWriter.attribute("scrollable", rWallpaper.IsScrollable() ? "true" : "false");
1009 
1010  rWriter.endElement();
1011 
1012  rWriter.endElement();
1013  }
1014  break;
1015 
1017  {
1018  const auto* pMetaClipRegionAction = static_cast<const MetaClipRegionAction*>(pAction);
1019  rWriter.startElement(sCurrentElementTag);
1020 
1021  // FIXME for now we dump only the bounding box; this is
1022  // enough for the tests we have, but may need extending to
1023  // dumping the real polypolygon in the future
1024  tools::Rectangle aRectangle = pMetaClipRegionAction->GetRegion().GetBoundRect();
1025  writeRectangle(rWriter, aRectangle);
1026  rWriter.endElement();
1027  }
1028  break;
1029 
1031  {
1032  MetaISectRectClipRegionAction* pMetaISectRectClipRegionAction = static_cast<MetaISectRectClipRegionAction*>(pAction);
1033  rWriter.startElement(sCurrentElementTag);
1034 
1035  tools::Rectangle aRectangle = pMetaISectRectClipRegionAction->GetRect();
1036  writeRectangle(rWriter, aRectangle);
1037  rWriter.endElement();
1038  }
1039  break;
1040 
1042  {
1043  MetaISectRegionClipRegionAction* pMetaISectRegionClipRegionAction = static_cast<MetaISectRegionClipRegionAction*>(pAction);
1044  rWriter.startElement(sCurrentElementTag);
1045 
1046  // FIXME for now we dump only the bounding box; this is
1047  // enough for the tests we have, but may need extending to
1048  // dumping the real polypolygon in the future
1049  tools::Rectangle aRectangle = pMetaISectRegionClipRegionAction->GetRegion().GetBoundRect();
1050  writeRectangle(rWriter, aRectangle);
1051  rWriter.endElement();
1052  }
1053  break;
1054 
1055  // case MetaActionType::MOVECLIPREGION:
1056 
1058  {
1059  MetaLineColorAction* pMetaLineColorAction = static_cast<MetaLineColorAction*>(pAction);
1060  rWriter.startElement(sCurrentElementTag);
1061 
1062  rWriter.attribute("color", convertColorToString(pMetaLineColorAction->GetColor()));
1063  rWriter.endElement();
1064  }
1065  break;
1066 
1068  {
1069  MetaFillColorAction* pMetaFillColorAction = static_cast<MetaFillColorAction*>(pAction);
1070  rWriter.startElement(sCurrentElementTag);
1071 
1072  rWriter.attribute("color", convertColorToString(pMetaFillColorAction->GetColor()));
1073  rWriter.endElement();
1074  }
1075  break;
1076 
1078  {
1079  MetaTextColorAction* pMetaTextColorAction = static_cast<MetaTextColorAction*>(pAction);
1080  rWriter.startElement(sCurrentElementTag);
1081 
1082  rWriter.attribute("color", convertColorToString(pMetaTextColorAction->GetColor()));
1083  rWriter.endElement();
1084  }
1085  break;
1086 
1088  {
1089  MetaTextFillColorAction* pMetaTextFillColorAction = static_cast<MetaTextFillColorAction*>(pAction);
1090  rWriter.startElement(sCurrentElementTag);
1091 
1092  rWriter.attribute("color", convertColorToString(pMetaTextFillColorAction->GetColor()));
1093 
1094  if (pMetaTextFillColorAction->IsSetting())
1095  rWriter.attribute("setting", OUString("true"));
1096 
1097  rWriter.endElement();
1098  }
1099  break;
1100 
1102  {
1103  MetaTextAlignAction* pMetaTextAlignAction = static_cast<MetaTextAlignAction*>(pAction);
1104  rWriter.startElement(sCurrentElementTag);
1105  OUString sAlign = convertTextAlignToString(pMetaTextAlignAction->GetTextAlign());
1106  if (!sAlign.isEmpty())
1107  rWriter.attribute("align", sAlign);
1108  rWriter.endElement();
1109  }
1110  break;
1111 
1113  {
1114  const MetaMapModeAction* pMeta = static_cast<MetaMapModeAction*>(pAction);
1115  MapMode aMapMode = pMeta->GetMapMode();
1116  rWriter.startElement(sCurrentElementTag);
1117  rWriter.attribute("mapunit", convertMapUnitToString( aMapMode.GetMapUnit() ));
1118  writePoint(rWriter, aMapMode.GetOrigin());
1119  rWriter.attribute("scalex", convertFractionToString(aMapMode.GetScaleX()));
1120  rWriter.attribute("scaley", convertFractionToString(aMapMode.GetScaleY()));
1121  rWriter.endElement();
1122  }
1123  break;
1124 
1125  case MetaActionType::FONT:
1126  {
1127  MetaFontAction* pMetaFontAction = static_cast<MetaFontAction*>(pAction);
1128  rWriter.startElement(sCurrentElementTag);
1129 
1130  vcl::Font aFont = pMetaFontAction->GetFont();
1131 
1132  rWriter.attribute("color", convertColorToString(aFont.GetColor()));
1133  rWriter.attribute("fillcolor", convertColorToString(aFont.GetFillColor()));
1134  rWriter.attribute("name", aFont.GetFamilyName());
1135  rWriter.attribute("stylename", aFont.GetStyleName());
1136  rWriter.attribute("width", aFont.GetFontSize().Width());
1137  rWriter.attribute("height", aFont.GetFontSize().Height());
1138  rWriter.attribute("orientation", aFont.GetOrientation());
1139  rWriter.attribute("weight", convertFontWeigthToString(aFont.GetWeight()));
1140  rWriter.attribute("vertical", aFont.IsVertical() ? "true" : "false");
1141 
1142  rWriter.endElement();
1143  }
1144  break;
1145 
1146  case MetaActionType::PUSH:
1147  {
1148  MetaPushAction* pMetaPushAction = static_cast<MetaPushAction*>(pAction);
1149  rWriter.startElement(sCurrentElementTag);
1150 
1151  rWriter.attribute("flags", collectPushFlags(pMetaPushAction->GetFlags()));
1152  }
1153  break;
1154 
1155  case MetaActionType::POP:
1156  {
1157  rWriter.endElement();
1158  }
1159  break;
1160 
1162  {
1163  MetaRasterOpAction* pMetaRasterOpAction = static_cast<MetaRasterOpAction*>(pAction);
1164  rWriter.startElement(sCurrentElementTag);
1165 
1166  if (pMetaRasterOpAction->GetRasterOp() != RasterOp::OverPaint)
1167  {
1168  rWriter.attribute("operation", convertRopToString(pMetaRasterOpAction->GetRasterOp()));
1169  }
1170  rWriter.endElement();
1171  }
1172  break;
1173 
1175  {
1176  const MetaTransparentAction* pMeta = static_cast<MetaTransparentAction*>(pAction);
1177 
1178  rWriter.startElement(sCurrentElementTag);
1179  rWriter.attribute("transparence", pMeta->GetTransparence());
1180 
1181  tools::PolyPolygon const& rPolyPolygon(pMeta->GetPolyPolygon());
1182 
1183  for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
1184  {
1185  rWriter.startElement("polygon");
1186  tools::Polygon const& rPolygon = rPolyPolygon[j];
1187  bool bFlags = rPolygon.HasFlags();
1188  for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
1189  {
1190  rWriter.startElement("point");
1191  writePoint(rWriter, rPolygon[i]);
1192  if (bFlags)
1193  rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
1194  rWriter.endElement();
1195  }
1196  rWriter.endElement();
1197  }
1198 
1199  rWriter.endElement();
1200  }
1201  break;
1202 
1203  //case MetaActionType::EPS:
1204  //case MetaActionType::REFPOINT:
1205 
1207  {
1208  MetaTextLineColorAction* pMetaTextLineColorAction = static_cast<MetaTextLineColorAction*>(pAction);
1209  rWriter.startElement(sCurrentElementTag);
1210 
1211  rWriter.attribute("color", convertColorToString(pMetaTextLineColorAction->GetColor()));
1212  rWriter.endElement();
1213  }
1214  break;
1215 
1217  {
1218  auto* pMeta = static_cast<MetaTextLineAction*>(pAction);
1219  rWriter.startElement(sCurrentElementTag);
1220  writePoint(rWriter, pMeta->GetStartPoint());
1221  rWriter.attribute("width", pMeta->GetWidth());
1222  rWriter.attribute("strikeout", convertFontStrikeoutToString(pMeta->GetStrikeout()));
1223  rWriter.attribute("underline", convertFontLineStyleToString(pMeta->GetUnderline()));
1224  rWriter.attribute("overline", convertFontLineStyleToString(pMeta->GetOverline()));
1225  rWriter.endElement();
1226  }
1227  break;
1228 
1229  //case MetaActionType::FLOATTRANSPARENT:
1230  //case MetaActionType::GRADIENTEX:
1231  //case MetaActionType::LAYOUTMODE:
1232  //case MetaActionType::TEXTLANGUAGE:
1233 
1235  {
1236  const auto* pMetaAction = static_cast<MetaOverlineColorAction*>(pAction);
1237  rWriter.startElement(sCurrentElementTag);
1238  rWriter.attribute("color", convertColorToString(pMetaAction->GetColor()));
1239  rWriter.endElement();
1240  }
1241  break;
1242 
1244  {
1245  MetaCommentAction* pMetaCommentAction = static_cast<MetaCommentAction*>(pAction);
1246  rWriter.startElement(sCurrentElementTag);
1247 
1248  if (pMetaCommentAction->GetDataSize() > 0)
1249  {
1250  rWriter.attribute("datasize", pMetaCommentAction->GetDataSize());
1251  }
1252  if (!pMetaCommentAction->GetComment().isEmpty())
1253  {
1254  rWriter.startElement("comment");
1255  rWriter.content(pMetaCommentAction->GetComment());
1256  rWriter.endElement();
1257  }
1258 
1259  rWriter.endElement();
1260  }
1261  break;
1262 
1263  default:
1264  {
1265  rWriter.startElement(sCurrentElementTag);
1266  rWriter.attribute("note", OString("not implemented in xml dump"));
1267  rWriter.endElement();
1268  }
1269  break;
1270  }
1271  }
1272 }
1273 
1274 /* 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:183
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
LINESTYLE_BOLD
WEIGHT_THIN
sal_uInt16 GetBorder() const
WEIGHT_BLACK
LINESTYLE_BOLDWAVE
WEIGHT_SEMIBOLD
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1524
const Point & GetEndPoint() const
Definition: metaact.hxx:182
STRIKEOUT_SLASH
void writeXml(const GDIMetaFile &rMetaFile, tools::XmlWriter &rWriter)
Definition: mtfxmldump.cxx:529
WEIGHT_LIGHT
BitmapChecksum GetChecksum() const
Definition: bitmapex.cxx:293
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:982
void attribute(const OString &sTagName, const OString &aValue)
const Color & GetColor() const
Definition: metaact.hxx:1214
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:211
int i
void content(const OString &sValue)
sal_uInt16 GetTransparence() const
Definition: metaact.hxx:1525
LINESTYLE_DOUBLEWAVE
sal_uInt16 GetAngle() const
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:981
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:144
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:237
const Point & GetStartPoint() const
Definition: metaact.hxx:181
ALIGN_TOP
sal_uInt32 GetDataSize() const
Definition: metaact.hxx:1655
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:162
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:157
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:1653
sal_uInt16 GetBitCount() const
LINESTYLE_DOUBLE
STRIKEOUT_NONE
const Size & GetSizePixel() const
Definition: bitmapex.hxx:83
const Color & GetColor() const
Definition: metaact.hxx:1241
FontLineStyle
sal_uInt16 GetStartIntensity() const
FontStrikeout
LINESTYLE_BOLDDASHDOT
STRIKEOUT_BOLD
HatchStyle
PolyFlags