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
21namespace
22{
23
24OUString collectPushFlags(vcl::PushFlags nFlags)
25{
27 return "PushAll";
28 else if ((nFlags & PUSH_ALLFONT) == PUSH_ALLFONT)
29 return "PushAllFont";
30
31 std::vector<OUString> aStrings;
32
33 if (nFlags & vcl::PushFlags::LINECOLOR)
34 aStrings.emplace_back("PushLineColor");
35 if (nFlags & vcl::PushFlags::FILLCOLOR)
36 aStrings.emplace_back("PushFillColor");
37 if (nFlags & vcl::PushFlags::FONT)
38 aStrings.emplace_back("PushFont");
39 if (nFlags & vcl::PushFlags::TEXTCOLOR)
40 aStrings.emplace_back("PushTextColor");
41 if (nFlags & vcl::PushFlags::MAPMODE)
42 aStrings.emplace_back("PushMapMode");
43 if (nFlags & vcl::PushFlags::CLIPREGION)
44 aStrings.emplace_back("PushClipRegion");
45 if (nFlags & vcl::PushFlags::RASTEROP)
46 aStrings.emplace_back("PushRasterOp");
48 aStrings.emplace_back("PushTextFillColor");
49 if (nFlags & vcl::PushFlags::TEXTALIGN)
50 aStrings.emplace_back("PushTextAlign");
51 if (nFlags & vcl::PushFlags::REFPOINT)
52 aStrings.emplace_back("PushRefPoint");
54 aStrings.emplace_back("PushTextLineColor");
56 aStrings.emplace_back("PushTextLayoutMode");
58 aStrings.emplace_back("PushTextLanguage");
60 aStrings.emplace_back("PushOverlineColor");
61
62 OUString aString;
63
64 if (aStrings.empty())
65 return aString;
66
67 aString = aStrings[0];
68 for (size_t i = 1; i < aStrings.size(); ++i)
69 {
70 aString += ", " + aStrings[i];
71 }
72 return aString;
73}
74
75OUString convertDrawTextFlagsToString(DrawTextFlags eDrawTextFlags)
76{
77 std::vector<OUString> aStrings;
78 if (eDrawTextFlags & DrawTextFlags::Disable)
79 aStrings.emplace_back("Disable");
80 if (eDrawTextFlags & DrawTextFlags::Mnemonic)
81 aStrings.emplace_back("Mnemonic");
82 if (eDrawTextFlags & DrawTextFlags::Mono)
83 aStrings.emplace_back("Mono");
84 if (eDrawTextFlags & DrawTextFlags::Clip)
85 aStrings.emplace_back("Clip");
86 if (eDrawTextFlags & DrawTextFlags::Left)
87 aStrings.emplace_back("Left");
88 if (eDrawTextFlags & DrawTextFlags::Center)
89 aStrings.emplace_back("Center");
90 if (eDrawTextFlags & DrawTextFlags::Right)
91 aStrings.emplace_back("Right");
92 if (eDrawTextFlags & DrawTextFlags::Top)
93 aStrings.emplace_back("Top");
94 if (eDrawTextFlags & DrawTextFlags::VCenter)
95 aStrings.emplace_back("VCenter");
96 if (eDrawTextFlags & DrawTextFlags::Bottom)
97 aStrings.emplace_back("Bottom");
98 if (eDrawTextFlags & DrawTextFlags::EndEllipsis)
99 aStrings.emplace_back("EndEllipsis");
100 if (eDrawTextFlags & DrawTextFlags::PathEllipsis)
101 aStrings.emplace_back("PathEllipsis");
102 if (eDrawTextFlags & DrawTextFlags::MultiLine)
103 aStrings.emplace_back("MultiLine");
104 if (eDrawTextFlags & DrawTextFlags::WordBreak)
105 aStrings.emplace_back("WordBreak");
106 if (eDrawTextFlags & DrawTextFlags::NewsEllipsis)
107 aStrings.emplace_back("NewsEllipsis");
108 if (eDrawTextFlags & DrawTextFlags::WordBreakHyphenation)
109 aStrings.emplace_back("WordBreakHyphenation");
110 if (eDrawTextFlags & DrawTextFlags::CenterEllipsis)
111 aStrings.emplace_back("CenterEllipsis");
112 if (eDrawTextFlags & DrawTextFlags::HideMnemonic)
113 aStrings.emplace_back("HideMnemonic");
114
115 OUString aString;
116
117 if (aStrings.empty())
118 return "None";
119
120 aString = aStrings[0];
121 for (size_t i = 1; i < aStrings.size(); ++i)
122 {
123 aString += " " + aStrings[i];
124 }
125 return aString;
126};
127
128OUString convertRopToString(RasterOp eRop)
129{
130 switch (eRop)
131 {
132 case RasterOp::OverPaint: return "overpaint";
133 case RasterOp::Xor: return "xor";
134 case RasterOp::N0: return "0";
135 case RasterOp::N1: return "1";
136 case RasterOp::Invert: return "invert";
137 }
138 return OUString();
139}
140
141OUString convertTextAlignToString(TextAlign eAlign)
142{
143 switch (eAlign)
144 {
145 case ALIGN_BASELINE: return "baseline";
146 case ALIGN_BOTTOM: return "bottom";
147 case ALIGN_TOP: return "top";
148 case TextAlign_FORCE_EQUAL_SIZE: return "equalsize";
149 }
150 return OUString();
151}
152
153OUString convertColorToString(Color aColor)
154{
155 OUString aRGBString = aColor.AsRGBHexString();
156 return "#" + aRGBString;
157}
158
159OUString convertLineStyleToString(LineStyle eAlign)
160{
161 switch (eAlign)
162 {
163 case LineStyle::NONE: return "none";
164 case LineStyle::Solid: return "solid";
165 case LineStyle::Dash: return "dash";
166 default: break;
167 }
168 return OUString();
169}
170
171OUString convertLineJoinToString(basegfx::B2DLineJoin eJoin)
172{
173 switch (eJoin)
174 {
175 default:
176 case basegfx::B2DLineJoin::NONE: return "none";
177 case basegfx::B2DLineJoin::Bevel: return "bevel";
178 case basegfx::B2DLineJoin::Miter: return "miter";
179 case basegfx::B2DLineJoin::Round: return "round";
180 }
181}
182
183OUString convertLineCapToString(css::drawing::LineCap eCap)
184{
185 switch (eCap)
186 {
187 default:
188 case css::drawing::LineCap_BUTT: return "butt";
189 case css::drawing::LineCap_ROUND: return "round";
190 case css::drawing::LineCap_SQUARE: return "square";
191 }
192}
193
194OUString convertPolygonFlags(PolyFlags eFlags)
195{
196 switch (eFlags)
197 {
198 default:
199 case PolyFlags::Normal: return "normal";
200 case PolyFlags::Control: return "control";
201 case PolyFlags::Smooth: return "smooth";
202 case PolyFlags::Symmetric: return "symmetric";
203 }
204}
205
206OUString convertFontWeightToString(FontWeight eFontWeight)
207{
208 switch (eFontWeight)
209 {
210 case WEIGHT_DONTKNOW: return "unknown";
211 case WEIGHT_THIN: return "thin";
212 case WEIGHT_ULTRALIGHT: return "ultralight";
213 case WEIGHT_LIGHT: return "light";
214 case WEIGHT_SEMILIGHT: return "semilight";
215 case WEIGHT_NORMAL: return "normal";
216 case WEIGHT_MEDIUM: return "medium";
217 case WEIGHT_SEMIBOLD: return "semibold";
218 case WEIGHT_BOLD: return "bold";
219 case WEIGHT_ULTRABOLD: return "ultrabold";
220 case WEIGHT_BLACK: return "black";
221 case FontWeight_FORCE_EQUAL_SIZE: return "equalsize";
222 }
223 return OUString();
224}
225
226OUString convertFontStrikeoutToString(FontStrikeout eFontStrikeout)
227{
228 switch (eFontStrikeout)
229 {
230 case STRIKEOUT_NONE: return "none";
231 case STRIKEOUT_SINGLE: return "single";
232 case STRIKEOUT_DOUBLE: return "double";
233 case STRIKEOUT_DONTKNOW: return "dontknow";
234 case STRIKEOUT_BOLD: return "bold";
235 case STRIKEOUT_SLASH: return "slash";
236 case STRIKEOUT_X: return "x";
237 case FontStrikeout_FORCE_EQUAL_SIZE: return "equalsize";
238 }
239 return OUString();
240}
241
242OUString convertFontLineStyleToString(FontLineStyle eFontLineStyle)
243{
244 switch (eFontLineStyle)
245 {
246 case LINESTYLE_NONE: return "none";
247 case LINESTYLE_SINGLE: return "single";
248 case LINESTYLE_DOUBLE: return "double";
249 case LINESTYLE_DOTTED: return "dotted";
250 case LINESTYLE_DONTKNOW: return "dontknow";
251 case LINESTYLE_DASH: return "dash";
252 case LINESTYLE_LONGDASH: return "longdash";
253 case LINESTYLE_DASHDOT: return "dashdot";
254 case LINESTYLE_DASHDOTDOT: return "dashdotdot";
255 case LINESTYLE_SMALLWAVE: return "smallwave";
256 case LINESTYLE_WAVE: return "wave";
257 case LINESTYLE_DOUBLEWAVE: return "doublewave";
258 case LINESTYLE_BOLD: return "bold";
259 case LINESTYLE_BOLDDOTTED: return "bolddotted";
260 case LINESTYLE_BOLDDASH: return "bolddash";
261 case LINESTYLE_BOLDLONGDASH: return "boldlongdash";
262 case LINESTYLE_BOLDDASHDOT: return "bolddashdot";
263 case LINESTYLE_BOLDDASHDOTDOT: return "bolddashdotdot";
264 case LINESTYLE_BOLDWAVE: return "boldwave";
265 case FontLineStyle_FORCE_EQUAL_SIZE: return "equalsize";
266 }
267 return OUString();
268}
269
270OString convertLineStyleToString(const MetaActionType nActionType)
271{
272 switch (nActionType)
273 {
274 case MetaActionType::NONE: return "null";
275 case MetaActionType::PIXEL: return "pixel";
276 case MetaActionType::POINT: return "point";
277 case MetaActionType::LINE: return "line";
278 case MetaActionType::RECT: return "rect";
279 case MetaActionType::ROUNDRECT: return "roundrect";
280 case MetaActionType::ELLIPSE: return "ellipse";
281 case MetaActionType::ARC: return "arc";
282 case MetaActionType::PIE: return "pie";
283 case MetaActionType::CHORD: return "chord";
284 case MetaActionType::POLYLINE: return "polyline";
285 case MetaActionType::POLYGON: return "polygon";
286 case MetaActionType::POLYPOLYGON: return "polypolygon";
287 case MetaActionType::TEXT: return "text";
288 case MetaActionType::TEXTARRAY: return "textarray";
289 case MetaActionType::STRETCHTEXT: return "stretchtext";
290 case MetaActionType::TEXTRECT: return "textrect";
291 case MetaActionType::TEXTLINE: return "textline";
292 case MetaActionType::BMP: return "bmp";
293 case MetaActionType::BMPSCALE: return "bmpscale";
294 case MetaActionType::BMPSCALEPART: return "bmpscalepart";
295 case MetaActionType::BMPEX: return "bmpex";
296 case MetaActionType::BMPEXSCALE: return "bmpexscale";
297 case MetaActionType::BMPEXSCALEPART: return "bmpexscalepart";
298 case MetaActionType::MASK: return "mask";
299 case MetaActionType::MASKSCALE: return "maskscale";
300 case MetaActionType::MASKSCALEPART: return "maskscalepart";
301 case MetaActionType::GRADIENT: return "gradient";
302 case MetaActionType::GRADIENTEX: return "gradientex";
303 case MetaActionType::HATCH: return "hatch";
304 case MetaActionType::WALLPAPER: return "wallpaper";
305 case MetaActionType::CLIPREGION: return "clipregion";
306 case MetaActionType::ISECTRECTCLIPREGION: return "sectrectclipregion";
307 case MetaActionType::ISECTREGIONCLIPREGION: return "sectregionclipregion";
308 case MetaActionType::MOVECLIPREGION: return "moveclipregion";
309 case MetaActionType::LINECOLOR: return "linecolor";
310 case MetaActionType::FILLCOLOR: return "fillcolor";
311 case MetaActionType::TEXTCOLOR: return "textcolor";
312 case MetaActionType::TEXTFILLCOLOR: return "textfillcolor";
313 case MetaActionType::TEXTLINECOLOR: return "textlinecolor";
314 case MetaActionType::OVERLINECOLOR: return "overlinecolor";
315 case MetaActionType::TEXTALIGN: return "textalign";
316 case MetaActionType::MAPMODE: return "mapmode";
317 case MetaActionType::FONT: return "font";
318 case MetaActionType::PUSH: return "push";
319 case MetaActionType::POP: return "pop";
320 case MetaActionType::RASTEROP: return "rasterop";
321 case MetaActionType::Transparent: return "transparent";
322 case MetaActionType::FLOATTRANSPARENT: return "floattransparent";
323 case MetaActionType::EPS: return "eps";
324 case MetaActionType::REFPOINT: return "refpoint";
325 case MetaActionType::COMMENT: return "comment";
326 case MetaActionType::LAYOUTMODE: return "layoutmode";
327 case MetaActionType::TEXTLANGUAGE: return "textlanguage";
328 }
329 return "";
330}
331
332OUString convertBitmapExTransparentType(BitmapEx const & rBitmapEx)
333{
334 if (rBitmapEx.IsAlpha())
335 return "bitmap";
336 else
337 return "none";
338}
339
340OUString convertMapUnitToString(MapUnit eUnit)
341{
342 switch (eUnit)
343 {
344 default:
345 case MapUnit::LASTENUMDUMMY: return "LASTENUMDUMMY";
346 case MapUnit::Map1000thInch: return "Map1000thInch";
347 case MapUnit::Map100thInch: return "Map100thInch";
348 case MapUnit::Map100thMM: return "Map100thMM";
349 case MapUnit::Map10thInch: return "Map10thInch";
350 case MapUnit::Map10thMM: return "Map10thMM";
351 case MapUnit::MapAppFont: return "MapAppFont";
352 case MapUnit::MapCM: return "MapCM";
353 case MapUnit::MapInch: return "MapInch";
354 case MapUnit::MapMM: return "MapMM";
355 case MapUnit::MapPixel: return "MapPixel";
356 case MapUnit::MapPoint: return "MapPoint";
357 case MapUnit::MapRelative: return "MapRelative";
358 case MapUnit::MapSysFont: return "MapSysFont";
359 case MapUnit::MapTwip: return "MapTwip";
360 }
361}
362
363OUString convertFractionToString(const Fraction& aFraction)
364{
365 std::stringstream ss;
366
367 ss << aFraction;
368
369 return OUString::createFromAscii(ss.str().c_str());
370}
371
372OUString convertGradientStyle(GradientStyle eStyle)
373{
374 switch (eStyle)
375 {
376 case GradientStyle::Linear: return "Linear";
377 case GradientStyle::Axial: return "Axial";
378 case GradientStyle::Radial: return "Radial";
379 case GradientStyle::Elliptical: return "Elliptical";
380 case GradientStyle::Square: return "Square";
381 case GradientStyle::Rect: return "Rect";
382 case GradientStyle::FORCE_EQUAL_SIZE: return "ForceEqualSize";
383 }
384 return OUString();
385}
386
387OUString convertHatchStyle(HatchStyle eStyle)
388{
389 switch (eStyle)
390 {
391 case HatchStyle::Single: return "Single";
392 case HatchStyle::Double: return "Double";
393 case HatchStyle::Triple: return "Triple";
394 case HatchStyle::FORCE_EQUAL_SIZE: return "ForceEqualSize";
395 }
396 return OUString();
397}
398
399OUString convertLanguageTypeToString(LanguageType rLanguageType)
400{
401 std::stringstream ss;
402 ss << std::hex << std::setfill ('0') << std::setw(4) << rLanguageType.get();
403 return "#" + OUString::createFromAscii(ss.str().c_str());
404}
405
406OUString convertWallpaperStyleToString(WallpaperStyle eWallpaperStyle)
407{
408 switch (eWallpaperStyle)
409 {
410 case WallpaperStyle::NONE: return "NONE";
411 case WallpaperStyle::Tile: return "Tile";
412 case WallpaperStyle::Center: return "Center";
413 case WallpaperStyle::Scale: return "Scale";
414 case WallpaperStyle::TopLeft: return "TopLeft";
415 case WallpaperStyle::Top: return "Top";
416 case WallpaperStyle::TopRight: return "TopRight";
417 case WallpaperStyle::Left: return "Left";
418 case WallpaperStyle::Right: return "Right";
419 case WallpaperStyle::BottomLeft: return "BottomLeft";
420 case WallpaperStyle::Bottom: return "Bottom";
421 case WallpaperStyle::BottomRight: return "BottomRight";
422 case WallpaperStyle::ApplicationGradient: return "ApplicationGradient";
423 }
424 return OUString();
425}
426
427OUString convertPixelFormatToString(vcl::PixelFormat ePixelFormat)
428{
429 switch (ePixelFormat)
430 {
431 case vcl::PixelFormat::INVALID: return "INVALID";
432 case vcl::PixelFormat::N1_BPP: return "1BPP";
433 case vcl::PixelFormat::N8_BPP: return "8BPP";
434 case vcl::PixelFormat::N24_BPP: return "24BPP";
435 case vcl::PixelFormat::N32_BPP: return "32BPP";
436 }
437 return OUString();
438}
439
440OUString convertComplexTestLayoutFlags(vcl::text::ComplexTextLayoutFlags eComplexTestLayoutFlags)
441{
442 switch(eComplexTestLayoutFlags)
443 {
444 default:
450 }
451}
452
453OUString convertGfxLinkTypeToString(GfxLinkType eGfxLinkType)
454{
455 switch(eGfxLinkType)
456 {
457 case GfxLinkType::EpsBuffer: return "EpsBuffer";
458 case GfxLinkType::NativeBmp: return "NativeBmp";
459 case GfxLinkType::NativeGif: return "NativeGif";
460 case GfxLinkType::NativeJpg: return "NativeJpg";
461 case GfxLinkType::NativeMet: return "NativeMet";
462 case GfxLinkType::NativeMov: return "NativeMov";
463 case GfxLinkType::NativePct: return "NativePct";
464 case GfxLinkType::NativePdf: return "NativePdf";
465 case GfxLinkType::NativePng: return "NativePng";
466 case GfxLinkType::NativeSvg: return "NativeSvg";
467 case GfxLinkType::NativeTif: return "NativeTif";
468 case GfxLinkType::NativeWmf: return "NativeWmf";
469 case GfxLinkType::NativeWebp: return "NativeWebp";
470 case GfxLinkType::NONE: return "None";
471 }
472 return OUString();
473}
474
475OUString hex32(sal_uInt32 nNumber)
476{
477 std::stringstream ss;
478 ss << std::hex << std::setfill('0') << std::setw(8) << nNumber;
479 return OUString::createFromAscii(ss.str().c_str());
480}
481
482OUString toHexString(const sal_uInt8* nData, sal_uInt32 nDataSize){
483
484 std::stringstream aStrm;
485 for (sal_uInt32 i = 0; i < nDataSize; i++)
486 {
487 aStrm << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(nData[i]);
488 }
489
490 return OUString::createFromAscii(aStrm.str().c_str());
491}
492
493void writePoint(tools::XmlWriter& rWriter, Point const& rPoint)
494{
495 rWriter.attribute("x", rPoint.X());
496 rWriter.attribute("y", rPoint.Y());
497}
498
499void writeStartPoint(tools::XmlWriter& rWriter, Point const& rPoint)
500{
501 rWriter.attribute("startx", rPoint.X());
502 rWriter.attribute("starty", rPoint.Y());
503}
504
505void writeEndPoint(tools::XmlWriter& rWriter, Point const& rPoint)
506{
507 rWriter.attribute("endx", rPoint.X());
508 rWriter.attribute("endy", rPoint.Y());
509}
510
511void writeSize(tools::XmlWriter& rWriter, Size const& rSize)
512{
513 rWriter.attribute("width", rSize.Width());
514 rWriter.attribute("height", rSize.Height());
515}
516
517void writeRectangle(tools::XmlWriter& rWriter, tools::Rectangle const& rRectangle)
518{
519 rWriter.attribute("left", rRectangle.Left());
520 rWriter.attribute("top", rRectangle.Top());
521 if (rRectangle.IsWidthEmpty())
522 rWriter.attribute("right", OString("empty"));
523 else
524 rWriter.attribute("right", rRectangle.Right());
525 if (rRectangle.IsHeightEmpty())
526 rWriter.attribute("bottom", OString("empty"));
527 else
528 rWriter.attribute("bottom", rRectangle.Bottom());
529}
530
531void writeMapMode(tools::XmlWriter& rWriter, MapMode const& rMapMode)
532{
533 rWriter.attribute("mapunit", convertMapUnitToString( rMapMode.GetMapUnit() ));
534 writePoint(rWriter, rMapMode.GetOrigin());
535 rWriter.attribute("scalex", convertFractionToString(rMapMode.GetScaleX()));
536 rWriter.attribute("scaley", convertFractionToString(rMapMode.GetScaleY()));
537}
538
539void writeLineInfo(tools::XmlWriter& rWriter, LineInfo const& rLineInfo)
540{
541 rWriter.attribute("style", convertLineStyleToString(rLineInfo.GetStyle()));
542 rWriter.attribute("width", rLineInfo.GetWidth());
543 rWriter.attribute("dashlen", rLineInfo.GetDashLen());
544 rWriter.attribute("dashcount", rLineInfo.GetDashCount());
545 rWriter.attribute("dotlen", rLineInfo.GetDotLen());
546 rWriter.attribute("dotcount", rLineInfo.GetDotCount());
547 rWriter.attribute("distance", rLineInfo.GetDistance());
548 rWriter.attribute("join", convertLineJoinToString(rLineInfo.GetLineJoin()));
549 rWriter.attribute("cap", convertLineCapToString(rLineInfo.GetLineCap()));
550}
551
552void writeGradient(tools::XmlWriter& rWriter, Gradient const& rGradient)
553{
554 rWriter.attribute("style", convertGradientStyle(rGradient.GetStyle()));
555 rWriter.attribute("startcolor", convertColorToString(rGradient.GetStartColor()));
556 rWriter.attribute("endcolor", convertColorToString(rGradient.GetEndColor()));
557 rWriter.attribute("angle", rGradient.GetAngle().get());
558 rWriter.attribute("border", rGradient.GetBorder());
559 rWriter.attribute("offsetx", rGradient.GetOfsX());
560 rWriter.attribute("offsety", rGradient.GetOfsY());
561 rWriter.attribute("startintensity", rGradient.GetStartIntensity());
562 rWriter.attribute("endintensity", rGradient.GetEndIntensity());
563 rWriter.attribute("steps", rGradient.GetSteps());
564}
565
566} // anonymous namespace
567
569{
570 maFilter.fill(false);
571}
572
573void MetafileXmlDump::filterActionType(const MetaActionType nActionType, bool bShouldFilter)
574{
575 maFilter[nActionType] = bShouldFilter;
576}
577
579{
580 maFilter.fill(true);
581}
582
583void MetafileXmlDump::dump(const GDIMetaFile& rMetaFile, SvStream& rStream)
584{
585 tools::XmlWriter aWriter(&rStream);
586 aWriter.startDocument();
587 aWriter.startElement("metafile");
588
589 writeXml(rMetaFile, aWriter);
590
591 aWriter.endElement();
592 aWriter.endDocument();
593}
594
596{
597 MapMode aMtfMapMode = rMetaFile.GetPrefMapMode();
598 rWriter.attribute("mapunit", convertMapUnitToString(aMtfMapMode.GetMapUnit()));
599 writePoint(rWriter, aMtfMapMode.GetOrigin());
600 rWriter.attribute("scalex", convertFractionToString(aMtfMapMode.GetScaleX()));
601 rWriter.attribute("scaley", convertFractionToString(aMtfMapMode.GetScaleY()));
602
603 Size aMtfSize = rMetaFile.GetPrefSize();
604 writeSize(rWriter, aMtfSize);
605
606 for(size_t nAction = 0; nAction < rMetaFile.GetActionSize(); ++nAction)
607 {
608 MetaAction* pAction = rMetaFile.GetAction(nAction);
609 const MetaActionType nActionType = pAction->GetType();
610 if (maFilter[nActionType])
611 continue;
612
613 OString sCurrentElementTag = convertLineStyleToString(nActionType);
614
615 switch (nActionType)
616 {
618 {
619 rWriter.startElement(sCurrentElementTag);
620 rWriter.endElement();
621 }
622 break;
623
625 {
626 auto* pMetaAction = static_cast<MetaPixelAction*>(pAction);
627 rWriter.startElement(sCurrentElementTag);
628 writePoint(rWriter, pMetaAction->GetPoint());
629 rWriter.attribute("color", convertColorToString(pMetaAction->GetColor()));
630 rWriter.endElement();
631 }
632 break;
633
635 {
636 auto* pMetaAction = static_cast<MetaPointAction*>(pAction);
637 rWriter.startElement(sCurrentElementTag);
638 writePoint(rWriter, pMetaAction->GetPoint());
639 rWriter.endElement();
640 }
641 break;
642
644 {
645 MetaLineAction* pMetaLineAction = static_cast<MetaLineAction*>(pAction);
646 rWriter.startElement(sCurrentElementTag);
647 writeStartPoint(rWriter, pMetaLineAction->GetStartPoint());
648 writeEndPoint(rWriter, pMetaLineAction->GetEndPoint());
649
650 writeLineInfo(rWriter, pMetaLineAction->GetLineInfo());
651 rWriter.endElement();
652 }
653 break;
654
656 {
657 MetaRectAction* pMetaAction = static_cast<MetaRectAction*>(pAction);
658 rWriter.startElement(sCurrentElementTag);
659 writeRectangle(rWriter, pMetaAction->GetRect());
660 rWriter.endElement();
661 }
662 break;
663
665 {
666 auto pMetaAction = static_cast<MetaRoundRectAction*>(pAction);
667 rWriter.startElement(sCurrentElementTag);
668 writeRectangle(rWriter, pMetaAction->GetRect());
669 rWriter.attribute("horizontalround", pMetaAction->GetHorzRound());
670 rWriter.attribute("verticalround", pMetaAction->GetVertRound());
671 rWriter.endElement();
672 }
673 break;
674
676 {
677 auto pMetaAction = static_cast<MetaEllipseAction*>(pAction);
678 rWriter.startElement(sCurrentElementTag);
679 writeRectangle(rWriter, pMetaAction->GetRect());
680 rWriter.endElement();
681 }
682 break;
683
685 {
686 auto pMetaAction = static_cast<MetaArcAction*>(pAction);
687 rWriter.startElement(sCurrentElementTag);
688 writeRectangle(rWriter, pMetaAction->GetRect());
689 writeStartPoint(rWriter, pMetaAction->GetStartPoint());
690 writeEndPoint(rWriter, pMetaAction->GetEndPoint());
691 rWriter.endElement();
692 }
693 break;
694
696 {
697 auto pMetaAction = static_cast<MetaPieAction*>(pAction);
698 rWriter.startElement(sCurrentElementTag);
699 writeRectangle(rWriter, pMetaAction->GetRect());
700 writeStartPoint(rWriter, pMetaAction->GetStartPoint());
701 writeEndPoint(rWriter, pMetaAction->GetEndPoint());
702 rWriter.endElement();
703 }
704 break;
705
707 {
708 auto pMetaAction = static_cast<MetaChordAction*>(pAction);
709 rWriter.startElement(sCurrentElementTag);
710 writeRectangle(rWriter, pMetaAction->GetRect());
711 writeStartPoint(rWriter, pMetaAction->GetStartPoint());
712 writeEndPoint(rWriter, pMetaAction->GetEndPoint());
713 rWriter.endElement();
714 }
715 break;
716
718 {
719 MetaPolyLineAction* pMetaPolyLineAction = static_cast<MetaPolyLineAction*>(pAction);
720 rWriter.startElement(sCurrentElementTag);
721
722 writeLineInfo(rWriter, pMetaPolyLineAction->GetLineInfo());
723
724 tools::Polygon aPolygon = pMetaPolyLineAction->GetPolygon();
725 bool bFlags = aPolygon.HasFlags();
726 for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
727 {
728 rWriter.startElement("point");
729 writePoint(rWriter, aPolygon[i]);
730 if (bFlags)
731 rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
732 rWriter.endElement();
733 }
734
735 rWriter.endElement();
736 }
737 break;
738
740 {
741 MetaPolygonAction* pMetaPolygonAction = static_cast<MetaPolygonAction*>(pAction);
742 rWriter.startElement(sCurrentElementTag);
743
744 tools::Polygon aPolygon = pMetaPolygonAction->GetPolygon();
745 bool bFlags = aPolygon.HasFlags();
746 for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
747 {
748 rWriter.startElement("point");
749 writePoint(rWriter, aPolygon[i]);
750 if (bFlags)
751 rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
752 rWriter.endElement();
753 }
754
755 rWriter.endElement();
756 }
757 break;
758
760 {
761 MetaPolyPolygonAction *const pMetaPolyPolygonAction = static_cast<MetaPolyPolygonAction*>(pAction);
762 rWriter.startElement(sCurrentElementTag);
763
764 tools::PolyPolygon const& rPolyPolygon(pMetaPolyPolygonAction->GetPolyPolygon());
765
766 for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
767 {
768 rWriter.startElement("polygon");
769 tools::Polygon const& rPolygon = rPolyPolygon[j];
770 bool bFlags = rPolygon.HasFlags();
771 for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
772 {
773 rWriter.startElement("point");
774 writePoint(rWriter, rPolygon[i]);
775 if (bFlags)
776 rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
777 rWriter.endElement();
778 }
779 rWriter.endElement();
780 }
781 rWriter.endElement();
782 }
783 break;
784
786 {
787 auto* pMeta = static_cast<MetaTextAction*>(pAction);
788 rWriter.startElement(sCurrentElementTag);
789 writePoint(rWriter, pMeta->GetPoint());
790 rWriter.attribute("index", pMeta->GetIndex());
791 rWriter.attribute("length", pMeta->GetLen());
792 rWriter.startElement("textcontent");
793 rWriter.content(pMeta->GetText());
794 rWriter.endElement();
795
796 rWriter.endElement();
797 }
798 break;
799
801 {
802 MetaTextArrayAction* pMetaTextArrayAction = static_cast<MetaTextArrayAction*>(pAction);
803 rWriter.startElement(sCurrentElementTag);
804
805 sal_Int32 aIndex = pMetaTextArrayAction->GetIndex();
806 sal_Int32 aLength = pMetaTextArrayAction->GetLen();
807
808 writePoint(rWriter, pMetaTextArrayAction->GetPoint());
809 rWriter.attribute("index", aIndex);
810 rWriter.attribute("length", aLength);
811
812 if (!pMetaTextArrayAction->GetDXArray().empty())
813 {
814 rWriter.startElement("dxarray");
815 OUStringBuffer sDxLengthString;
816 for (sal_Int32 i = 0; i < aLength - aIndex; ++i)
817 {
818 sDxLengthString.append(pMetaTextArrayAction->GetDXArray()[aIndex + i]);
819 sDxLengthString.append(" ");
820 }
821 rWriter.content(sDxLengthString);
822 rWriter.endElement();
823 }
824
825 rWriter.startElement("text");
826
827 const OUString& rStr = pMetaTextArrayAction->GetText();
828 // fix bad XML dump by removing forbidden 0x01
829 // FIXME: expand footnote anchor point 0x01 instead of this
830 if ( rStr.indexOf(0x01) > -1 )
831 rWriter.content(rStr.replaceAll("\001", ""));
832 else
833 rWriter.content(rStr);
834
835 rWriter.endElement();
836
837 rWriter.endElement();
838 }
839 break;
840
842 {
843 auto* pMeta = static_cast<MetaStretchTextAction*>(pAction);
844 rWriter.startElement(sCurrentElementTag);
845
846 writePoint(rWriter, pMeta->GetPoint());
847 rWriter.attribute("index", pMeta->GetIndex());
848 rWriter.attribute("length", pMeta->GetLen());
849 rWriter.attribute("width", pMeta->GetWidth());
850
851 rWriter.startElement("textcontent");
852 rWriter.content(pMeta->GetText());
853 rWriter.endElement();
854
855 rWriter.endElement();
856 }
857 break;
858
860 {
861 auto* pMeta = static_cast<MetaTextRectAction*>(pAction);
862 rWriter.startElement(sCurrentElementTag);
863 writeRectangle(rWriter, pMeta->GetRect());
864 rWriter.startElement("textcontent");
865 rWriter.content(pMeta->GetText());
866 rWriter.endElement();
867
868 rWriter.startElement("style");
869 rWriter.content(convertDrawTextFlagsToString(pMeta->GetStyle()));
870 rWriter.endElement();
871
872 rWriter.endElement();
873 }
874 break;
875
877 {
878 auto pMeta = static_cast<MetaBmpAction*>(pAction);
879 rWriter.startElement(sCurrentElementTag);
880 writePoint(rWriter, pMeta->GetPoint());
881 rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
882 rWriter.endElement();
883 }
884 break;
885
887 {
888 auto pMeta = static_cast<MetaBmpScaleAction*>(pAction);
889 rWriter.startElement(sCurrentElementTag);
890 writePoint(rWriter, pMeta->GetPoint());
891 writeSize(rWriter, pMeta->GetSize());
892 rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
893 rWriter.endElement();
894 }
895 break;
896
898 {
899 auto pMeta = static_cast<MetaBmpScalePartAction*>(pAction);
900 rWriter.startElement(sCurrentElementTag);
901 rWriter.attribute("destx", pMeta->GetDestPoint().X());
902 rWriter.attribute("desty", pMeta->GetDestPoint().Y());
903 rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
904 rWriter.attribute("destheight", pMeta->GetDestSize().Height());
905 rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
906 rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
907 rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
908 rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
909 rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
910 rWriter.endElement();
911 }
912 break;
913
915 {
916 auto pMeta = static_cast<MetaBmpExAction*>(pAction);
917 rWriter.startElement(sCurrentElementTag);
918 writePoint(rWriter, pMeta->GetPoint());
919 rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
920 rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
921 rWriter.endElement();
922 }
923 break;
924
926 {
927 auto pMeta = static_cast<MetaBmpExScaleAction*>(pAction);
928 rWriter.startElement(sCurrentElementTag);
929 writePoint(rWriter, pMeta->GetPoint());
930 writeSize(rWriter, pMeta->GetSize());
931 rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
932 rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
933 rWriter.endElement();
934 }
935 break;
936
938 {
939 auto pMeta = static_cast<MetaBmpExScalePartAction*>(pAction);
940 rWriter.startElement(sCurrentElementTag);
941 rWriter.attribute("destx", pMeta->GetDestPoint().X());
942 rWriter.attribute("desty", pMeta->GetDestPoint().Y());
943 rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
944 rWriter.attribute("destheight", pMeta->GetDestSize().Height());
945 rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
946 rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
947 rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
948 rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
949 rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
950 rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
951 rWriter.endElement();
952 }
953 break;
954
956 {
957 auto pMeta = static_cast<MetaMaskAction*>(pAction);
958 rWriter.startElement(sCurrentElementTag);
959 writePoint(rWriter, pMeta->GetPoint());
960 rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
961 rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
962 rWriter.endElement();
963 }
964 break;
965
967 {
968 auto pMeta = static_cast<MetaMaskScaleAction*>(pAction);
969 rWriter.startElement(sCurrentElementTag);
970 writePoint(rWriter, pMeta->GetPoint());
971 writeSize(rWriter, pMeta->GetSize());
972 rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
973 rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
974 rWriter.endElement();
975 }
976 break;
977
979 {
980 auto pMeta = static_cast<MetaMaskScalePartAction*>(pAction);
981 rWriter.startElement(sCurrentElementTag);
982 rWriter.attribute("destx", pMeta->GetDestPoint().X());
983 rWriter.attribute("desty", pMeta->GetDestPoint().Y());
984 rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
985 rWriter.attribute("destheight", pMeta->GetDestSize().Height());
986 rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
987 rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
988 rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
989 rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
990 rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
991 rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
992 rWriter.endElement();
993 }
994 break;
995
997 {
998 const MetaGradientAction* pMeta = static_cast<MetaGradientAction*>(pAction);
999
1000 rWriter.startElement(sCurrentElementTag);
1001 writeGradient(rWriter, pMeta->GetGradient());
1002
1003 rWriter.startElement("rectangle");
1004 writeRectangle(rWriter, pMeta->GetRect());
1005 rWriter.endElement();
1006
1007 rWriter.endElement();
1008 }
1009 break;
1010
1012 {
1013 auto* const pMetaHatchAction = static_cast<MetaHatchAction*>(pAction);
1014 rWriter.startElement(sCurrentElementTag);
1015
1016 tools::PolyPolygon const& rPolyPolygon(pMetaHatchAction->GetPolyPolygon());
1017
1018 for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
1019 {
1020 rWriter.startElement("polygon");
1021 tools::Polygon const& rPolygon = rPolyPolygon[j];
1022 bool bFlags = rPolygon.HasFlags();
1023 for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
1024 {
1025 rWriter.startElement("point");
1026 writePoint(rWriter, rPolygon[i]);
1027 if (bFlags)
1028 rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
1029 rWriter.endElement();
1030 }
1031 rWriter.endElement();
1032 }
1033
1034 rWriter.startElement("hatch");
1035 const auto& rHatch = pMetaHatchAction->GetHatch();
1036 rWriter.attribute("style", convertHatchStyle(rHatch.GetStyle()));
1037 rWriter.attribute("color", convertColorToString(rHatch.GetColor()));
1038 rWriter.attribute("distance", sal_Int32(rHatch.GetDistance()));
1039 rWriter.attribute("angle", sal_Int32(rHatch.GetAngle().get()));
1040 rWriter.endElement();
1041
1042 rWriter.endElement();
1043 }
1044 break;
1045
1047 {
1048 const auto* pMetaAction = static_cast<const MetaWallpaperAction*>(pAction);
1049 rWriter.startElement(sCurrentElementTag);
1050
1051 writeRectangle(rWriter, pMetaAction->GetRect());
1052
1053 rWriter.startElement("wallpaper");
1054 const auto& rWallpaper = pMetaAction->GetWallpaper();
1055
1056 rWriter.attribute("color", convertColorToString(rWallpaper.GetColor()));
1057
1058 WallpaperStyle eStyle = rWallpaper.GetStyle();
1059 rWriter.attribute("style", convertWallpaperStyleToString(eStyle));
1060
1061 if (rWallpaper.IsBitmap())
1062 {
1063 rWriter.startElement("bitmap");
1064 BitmapEx const & rBitmapEx = rWallpaper.GetBitmap();
1065 rWriter.attribute("crc", hex32(rBitmapEx.GetChecksum()));
1066 rWriter.attribute("transparenttype", convertBitmapExTransparentType(rBitmapEx));
1067 rWriter.attribute("pixelformat", convertPixelFormatToString(rBitmapEx.GetBitmap().getPixelFormat()));
1068 rWriter.attribute("width", hex32(rBitmapEx.GetSizePixel().Width()));
1069 rWriter.attribute("height", hex32(rBitmapEx.GetSizePixel().Height()));
1070 rWriter.endElement();
1071 }
1072
1073 if (rWallpaper.IsGradient())
1074 {
1075 rWriter.startElement("gradient");
1076 Gradient aGradient = rWallpaper.GetGradient();
1077 writeGradient(rWriter, aGradient);
1078 rWriter.endElement();
1079 }
1080
1081 if (rWallpaper.IsRect())
1082 {
1083 tools::Rectangle aRect = rWallpaper.GetRect();
1084 rWriter.startElement("rectangle");
1085 writeRectangle(rWriter, aRect);
1086 rWriter.endElement();
1087 }
1088
1089 rWriter.attribute("fixed", rWallpaper.IsFixed() ? "true" : "false");
1090 rWriter.attribute("scrollable", rWallpaper.IsScrollable() ? "true" : "false");
1091
1092 rWriter.endElement();
1093
1094 rWriter.endElement();
1095 }
1096 break;
1097
1099 {
1100 const auto* pMetaClipRegionAction = static_cast<const MetaClipRegionAction*>(pAction);
1101 rWriter.startElement(sCurrentElementTag);
1102
1103 tools::Rectangle aRectangle = pMetaClipRegionAction->GetRegion().GetBoundRect();
1104 writeRectangle(rWriter, aRectangle);
1105
1106 vcl::Region aRegion = pMetaClipRegionAction->GetRegion();
1107
1108 if (aRegion.HasPolyPolygonOrB2DPolyPolygon())
1109 {
1110 tools::PolyPolygon aPolyPolygon = aRegion.GetAsPolyPolygon();
1111
1112 for (sal_uInt16 j = 0; j < aPolyPolygon.Count(); ++j)
1113 {
1114 rWriter.startElement("polygon");
1115 tools::Polygon const& rPolygon = aPolyPolygon[j];
1116 bool bFlags = rPolygon.HasFlags();
1117 for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
1118 {
1119 rWriter.startElement("point");
1120 writePoint(rWriter, rPolygon[i]);
1121 if (bFlags)
1122 rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
1123 rWriter.endElement();
1124 }
1125 rWriter.endElement();
1126 }
1127 }
1128
1129 rWriter.endElement();
1130 }
1131 break;
1132
1134 {
1135 MetaISectRectClipRegionAction* pMetaISectRectClipRegionAction = static_cast<MetaISectRectClipRegionAction*>(pAction);
1136 rWriter.startElement(sCurrentElementTag);
1137
1138 tools::Rectangle aRectangle = pMetaISectRectClipRegionAction->GetRect();
1139 writeRectangle(rWriter, aRectangle);
1140 rWriter.endElement();
1141 }
1142 break;
1143
1145 {
1146 MetaISectRegionClipRegionAction* pMetaISectRegionClipRegionAction = static_cast<MetaISectRegionClipRegionAction*>(pAction);
1147 rWriter.startElement(sCurrentElementTag);
1148
1149 // FIXME for now we dump only the bounding box; this is
1150 // enough for the tests we have, but may need extending to
1151 // dumping the real polypolygon in the future
1152 tools::Rectangle aRectangle = pMetaISectRegionClipRegionAction->GetRegion().GetBoundRect();
1153 writeRectangle(rWriter, aRectangle);
1154 rWriter.endElement();
1155 }
1156 break;
1157
1159 {
1160 const auto* pMetaMoveClipRegionAction = static_cast<MetaMoveClipRegionAction*>(pAction);
1161 rWriter.startElement(sCurrentElementTag);
1162
1163 rWriter.attribute("horzmove", pMetaMoveClipRegionAction->GetHorzMove());
1164 rWriter.attribute("vertmove", pMetaMoveClipRegionAction->GetVertMove());
1165 rWriter.endElement();
1166 }
1167 break;
1168
1170 {
1171 MetaLineColorAction* pMetaLineColorAction = static_cast<MetaLineColorAction*>(pAction);
1172 rWriter.startElement(sCurrentElementTag);
1173
1174 rWriter.attribute("color", convertColorToString(pMetaLineColorAction->GetColor()));
1175 rWriter.endElement();
1176 }
1177 break;
1178
1180 {
1181 MetaFillColorAction* pMetaFillColorAction = static_cast<MetaFillColorAction*>(pAction);
1182 rWriter.startElement(sCurrentElementTag);
1183
1184 rWriter.attribute("color", convertColorToString(pMetaFillColorAction->GetColor()));
1185 rWriter.endElement();
1186 }
1187 break;
1188
1190 {
1191 MetaTextColorAction* pMetaTextColorAction = static_cast<MetaTextColorAction*>(pAction);
1192 rWriter.startElement(sCurrentElementTag);
1193
1194 rWriter.attribute("color", convertColorToString(pMetaTextColorAction->GetColor()));
1195 rWriter.endElement();
1196 }
1197 break;
1198
1200 {
1201 MetaTextFillColorAction* pMetaTextFillColorAction = static_cast<MetaTextFillColorAction*>(pAction);
1202 rWriter.startElement(sCurrentElementTag);
1203
1204 rWriter.attribute("color", convertColorToString(pMetaTextFillColorAction->GetColor()));
1205
1206 if (pMetaTextFillColorAction->IsSetting())
1207 rWriter.attribute("setting", u"true");
1208
1209 rWriter.endElement();
1210 }
1211 break;
1212
1214 {
1215 MetaTextAlignAction* pMetaTextAlignAction = static_cast<MetaTextAlignAction*>(pAction);
1216 rWriter.startElement(sCurrentElementTag);
1217 OUString sAlign = convertTextAlignToString(pMetaTextAlignAction->GetTextAlign());
1218 if (!sAlign.isEmpty())
1219 rWriter.attribute("align", sAlign);
1220 rWriter.endElement();
1221 }
1222 break;
1223
1225 {
1226 const MetaMapModeAction* pMeta = static_cast<MetaMapModeAction*>(pAction);
1227 MapMode aMapMode = pMeta->GetMapMode();
1228 rWriter.startElement(sCurrentElementTag);
1229 rWriter.attribute("mapunit", convertMapUnitToString( aMapMode.GetMapUnit() ));
1230 writePoint(rWriter, aMapMode.GetOrigin());
1231 rWriter.attribute("scalex", convertFractionToString(aMapMode.GetScaleX()));
1232 rWriter.attribute("scaley", convertFractionToString(aMapMode.GetScaleY()));
1233 rWriter.endElement();
1234 }
1235 break;
1236
1238 {
1239 MetaFontAction* pMetaFontAction = static_cast<MetaFontAction*>(pAction);
1240 rWriter.startElement(sCurrentElementTag);
1241
1242 vcl::Font aFont = pMetaFontAction->GetFont();
1243
1244 rWriter.attribute("color", convertColorToString(aFont.GetColor()));
1245 rWriter.attribute("fillcolor", convertColorToString(aFont.GetFillColor()));
1246 rWriter.attribute("name", aFont.GetFamilyName());
1247 rWriter.attribute("stylename", aFont.GetStyleName());
1248 rWriter.attribute("width", aFont.GetFontSize().Width());
1249 rWriter.attribute("height", aFont.GetFontSize().Height());
1250 rWriter.attribute("orientation", aFont.GetOrientation().get());
1251 rWriter.attribute("weight", convertFontWeightToString(aFont.GetWeight()));
1252 rWriter.attribute("vertical", aFont.IsVertical() ? "true" : "false");
1253
1254 rWriter.endElement();
1255 }
1256 break;
1257
1259 {
1260 MetaPushAction* pMetaPushAction = static_cast<MetaPushAction*>(pAction);
1261 rWriter.startElement(sCurrentElementTag);
1262
1263 rWriter.attribute("flags", collectPushFlags(pMetaPushAction->GetFlags()));
1264 }
1265 break;
1266
1268 {
1269 rWriter.endElement();
1270 }
1271 break;
1272
1274 {
1275 MetaRasterOpAction* pMetaRasterOpAction = static_cast<MetaRasterOpAction*>(pAction);
1276 rWriter.startElement(sCurrentElementTag);
1277
1278 if (pMetaRasterOpAction->GetRasterOp() != RasterOp::OverPaint)
1279 {
1280 rWriter.attribute("operation", convertRopToString(pMetaRasterOpAction->GetRasterOp()));
1281 }
1282 rWriter.endElement();
1283 }
1284 break;
1285
1287 {
1288 const MetaTransparentAction* pMeta = static_cast<MetaTransparentAction*>(pAction);
1289
1290 rWriter.startElement(sCurrentElementTag);
1291 rWriter.attribute("transparence", pMeta->GetTransparence());
1292
1293 tools::PolyPolygon const& rPolyPolygon(pMeta->GetPolyPolygon());
1294
1295 for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
1296 {
1297 rWriter.startElement("polygon");
1298 tools::Polygon const& rPolygon = rPolyPolygon[j];
1299 bool bFlags = rPolygon.HasFlags();
1300 for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
1301 {
1302 rWriter.startElement("point");
1303 writePoint(rWriter, rPolygon[i]);
1304 if (bFlags)
1305 rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
1306 rWriter.endElement();
1307 }
1308 rWriter.endElement();
1309 }
1310
1311 rWriter.endElement();
1312 }
1313 break;
1314
1316 {
1317 MetaEPSAction* pMetaEPSAction = static_cast<MetaEPSAction*>(pAction);
1318 rWriter.startElement(sCurrentElementTag);
1319
1320 writePoint(rWriter, pMetaEPSAction->GetPoint());
1321 writeSize(rWriter, pMetaEPSAction->GetSize());
1322
1323 rWriter.startElement("gfxlink");
1324 writeSize(rWriter, pMetaEPSAction->GetLink().GetPrefSize());
1325 rWriter.attribute("type", convertGfxLinkTypeToString(pMetaEPSAction->GetLink().GetType()));
1326 rWriter.attribute("userid", pMetaEPSAction->GetLink().GetUserId());
1327 rWriter.attribute("datasize", pMetaEPSAction->GetLink().GetDataSize());
1328 rWriter.attribute("data", toHexString(pMetaEPSAction->GetLink().GetData(), pMetaEPSAction->GetLink().GetDataSize()));
1329 rWriter.attribute("native", pMetaEPSAction->GetLink().IsNative() ? "true" : "false");
1330 rWriter.attribute("emf", pMetaEPSAction->GetLink().IsEMF() ? "true" : "false");
1331 rWriter.attribute("validmapmode", pMetaEPSAction->GetLink().IsPrefMapModeValid() ? "true" : "false");
1332 rWriter.startElement("prefmapmode");
1333 writeMapMode(rWriter, pMetaEPSAction->GetLink().GetPrefMapMode());
1334 rWriter.endElement();
1335 rWriter.endElement();
1336
1337 rWriter.startElement("metafile");
1338 writeXml(pMetaEPSAction->GetSubstitute(), rWriter);
1339 rWriter.endElement();
1340
1341 rWriter.endElement();
1342 }
1343 break;
1344
1346 {
1347 auto* pMeta = static_cast<MetaRefPointAction*>(pAction);
1348 rWriter.startElement(sCurrentElementTag);
1349 writePoint(rWriter, pMeta->GetRefPoint());
1350 rWriter.attribute("set", pMeta->IsSetting() ? "true" : "false");
1351 rWriter.endElement();
1352 }
1353 break;
1354
1356 {
1357 auto* pMeta = static_cast<MetaTextLineColorAction*>(pAction);
1358 rWriter.startElement(sCurrentElementTag);
1359 rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
1360 rWriter.endElement();
1361 }
1362 break;
1363
1365 {
1366 auto* pMeta = static_cast<MetaTextLineAction*>(pAction);
1367 rWriter.startElement(sCurrentElementTag);
1368 writePoint(rWriter, pMeta->GetStartPoint());
1369 rWriter.attribute("width", pMeta->GetWidth());
1370 rWriter.attribute("strikeout", convertFontStrikeoutToString(pMeta->GetStrikeout()));
1371 rWriter.attribute("underline", convertFontLineStyleToString(pMeta->GetUnderline()));
1372 rWriter.attribute("overline", convertFontLineStyleToString(pMeta->GetOverline()));
1373 rWriter.endElement();
1374 }
1375 break;
1376
1378 {
1379 const auto* pMeta = static_cast<MetaFloatTransparentAction*>(pAction);
1380 rWriter.startElement(sCurrentElementTag);
1381 writePoint(rWriter, pMeta->GetPoint());
1382 writeSize(rWriter, pMeta->GetSize());
1383 rWriter.attribute("transparent", pMeta->IsTransparent() ? "true" : "false");
1384
1385 rWriter.startElement("gradient");
1386 writeGradient(rWriter, pMeta->GetGradient());
1387 rWriter.endElement();
1388
1389 rWriter.startElement("metafile");
1390 writeXml(pMeta->GetGDIMetaFile(), rWriter);
1391 rWriter.endElement();
1392
1393 rWriter.endElement();
1394 }
1395 break;
1396
1398 {
1399 const MetaGradientExAction* pMetaGradientExAction = static_cast<MetaGradientExAction*>(pAction);
1400
1401 rWriter.startElement(sCurrentElementTag);
1402 writeGradient(rWriter, pMetaGradientExAction->GetGradient());
1403
1404 tools::PolyPolygon const& rPolyPolygon(pMetaGradientExAction->GetPolyPolygon());
1405 for (sal_uInt16 j = 0; j < rPolyPolygon.Count(); ++j)
1406 {
1407 rWriter.startElement("polygon");
1408 tools::Polygon const& rPolygon = rPolyPolygon[j];
1409 bool bFlags = rPolygon.HasFlags();
1410 for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
1411 {
1412 rWriter.startElement("point");
1413 writePoint(rWriter, rPolygon[i]);
1414 if (bFlags)
1415 rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
1416 rWriter.endElement();
1417 }
1418 rWriter.endElement();
1419 }
1420
1421 rWriter.endElement();
1422 }
1423 break;
1424
1426 {
1427 const MetaLayoutModeAction* pMetaLayoutModeAction = static_cast<MetaLayoutModeAction*>(pAction);
1428
1429 rWriter.startElement(sCurrentElementTag);
1430
1431 rWriter.attribute("textlayout", convertComplexTestLayoutFlags(pMetaLayoutModeAction->GetLayoutMode()));
1432
1433 rWriter.endElement();
1434 }
1435 break;
1436
1438 {
1439 const MetaTextLanguageAction* pMetaTextLanguageAction = static_cast<MetaTextLanguageAction*>(pAction);
1440
1441 rWriter.startElement(sCurrentElementTag);
1442
1443 rWriter.attribute("language", convertLanguageTypeToString(pMetaTextLanguageAction->GetTextLanguage()));
1444
1445 rWriter.endElement();
1446 }
1447 break;
1448
1450 {
1451 const auto* pMetaAction = static_cast<MetaOverlineColorAction*>(pAction);
1452 rWriter.startElement(sCurrentElementTag);
1453 rWriter.attribute("color", convertColorToString(pMetaAction->GetColor()));
1454 rWriter.endElement();
1455 }
1456 break;
1457
1459 {
1460 MetaCommentAction* pMetaCommentAction = static_cast<MetaCommentAction*>(pAction);
1461 rWriter.startElement(sCurrentElementTag);
1462
1463 if (pMetaCommentAction->GetDataSize() > 0)
1464 {
1465 rWriter.attribute("datasize", pMetaCommentAction->GetDataSize());
1466 rWriter.attribute("data", toHexString(pMetaCommentAction->GetData(), pMetaCommentAction->GetDataSize()));
1467 }
1468 rWriter.attribute("value", pMetaCommentAction->GetValue());
1469
1470 if (!pMetaCommentAction->GetComment().isEmpty())
1471 {
1472 rWriter.startElement("comment");
1473 rWriter.content(pMetaCommentAction->GetComment());
1474 rWriter.endElement();
1475 }
1476 rWriter.endElement();
1477 }
1478 break;
1479
1480 default:
1481 {
1482 rWriter.startElement(sCurrentElementTag);
1483 rWriter.attribute("note", OString("not implemented in xml dump"));
1484 rWriter.endElement();
1485 }
1486 break;
1487 }
1488 }
1489}
1490
1491/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawTextFlags
RasterOp
Definition: RasterOp.hxx:23
#define PUSH_ALLFONT
Definition: State.hxx:66
bool IsAlpha() const
Definition: BitmapEx.cxx:193
BitmapChecksum GetChecksum() const
Definition: BitmapEx.cxx:230
Bitmap GetBitmap(Color aTransparentReplaceColor) const
Definition: BitmapEx.cxx:203
const Size & GetSizePixel() const
Definition: bitmapex.hxx:72
vcl::PixelFormat getPixelFormat() const
OUString AsRGBHexString() const
size_t GetActionSize() const
Definition: gdimtf.cxx:179
const Size & GetPrefSize() const
Definition: gdimtf.hxx:172
MetaAction * GetAction(size_t nAction) const
Definition: gdimtf.cxx:184
const MapMode & GetPrefMapMode() const
Definition: gdimtf.hxx:175
sal_uInt16 GetStartIntensity() const
GradientStyle GetStyle() const
Degree10 GetAngle() const
sal_uInt16 GetEndIntensity() const
sal_uInt16 GetOfsX() const
sal_uInt16 GetBorder() const
const Color & GetEndColor() const
sal_uInt16 GetOfsY() const
const Color & GetStartColor() const
sal_uInt16 GetSteps() const
const Fraction & GetScaleX() const
Definition: mapmod.cxx:154
MapUnit GetMapUnit() const
Definition: mapmod.cxx:150
const Point & GetOrigin() const
Definition: mapmod.cxx:152
const Fraction & GetScaleY() const
Definition: mapmod.cxx:156
MetaActionType GetType() const
Definition: metaact.hxx:94
sal_Int32 GetValue() const
Definition: metaact.hxx:1693
const sal_uInt8 * GetData() const
Definition: metaact.hxx:1695
const OString & GetComment() const
Definition: metaact.hxx:1692
sal_uInt32 GetDataSize() const
Definition: metaact.hxx:1694
const GDIMetaFile & GetSubstitute() const
Definition: metaact.hxx:1630
const Point & GetPoint() const
Definition: metaact.hxx:1631
const Size & GetSize() const
Definition: metaact.hxx:1632
const GfxLink & GetLink() const
Definition: metaact.hxx:1629
const Color & GetColor() const
Definition: metaact.hxx:1270
const vcl::Font & GetFont() const
Definition: metaact.hxx:1463
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:1013
const Gradient & GetGradient() const
Definition: metaact.hxx:1014
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1043
const Gradient & GetGradient() const
Definition: metaact.hxx:1044
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:1162
const vcl::Region & GetRegion() const
Definition: metaact.hxx:1189
vcl::text::ComplexTextLayoutFlags GetLayoutMode() const
Definition: metaact.hxx:1722
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:185
const Point & GetEndPoint() const
Definition: metaact.hxx:184
const Point & GetStartPoint() const
Definition: metaact.hxx:183
const Color & GetColor() const
Definition: metaact.hxx:1243
const MapMode & GetMapMode() const
Definition: metaact.hxx:1429
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:407
const tools::Polygon & GetPolygon() const
Definition: metaact.hxx:406
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:462
const tools::Polygon & GetPolygon() const
Definition: metaact.hxx:435
vcl::PushFlags GetFlags() const
Definition: metaact.hxx:1488
RasterOp GetRasterOp() const
Definition: metaact.hxx:1528
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:214
TextAlign GetTextAlign() const
Definition: metaact.hxx:1403
const Color & GetColor() const
Definition: metaact.hxx:1297
bool IsSetting() const
Definition: metaact.hxx:1325
const Color & GetColor() const
Definition: metaact.hxx:1322
LanguageType GetTextLanguage() const
Definition: metaact.hxx:1746
sal_uInt16 GetTransparence() const
Definition: metaact.hxx:1557
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1556
void filterAllActionTypes()
Definition: mtfxmldump.cxx:578
void writeXml(const GDIMetaFile &rMetaFile, tools::XmlWriter &rWriter)
Definition: mtfxmldump.cxx:595
void dump(const GDIMetaFile &rMetaFile, SvStream &rStream)
The actual result that will be used for testing.
Definition: mtfxmldump.cxx:583
o3tl::enumarray< MetaActionType, bool > maFilter
Definition: mtfxmldump.hxx:46
void filterActionType(const MetaActionType nActionType, bool bShouldFilter)
Definition: mtfxmldump.cxx:573
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void fill(V val)
sal_uInt16 Count() const
PolyFlags GetFlags(sal_uInt16 nPos) const
bool HasFlags() const
sal_uInt16 GetSize() const
constexpr tools::Long Top() const
constexpr tools::Long Right() const
constexpr bool IsWidthEmpty() const
constexpr bool IsHeightEmpty() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
void content(const OString &sValue)
bool startDocument(sal_Int32 nIndent=2, bool bWriteXmlHeader=true)
void attribute(const OString &sTagName, const OString &aValue)
void startElement(const OString &sName)
const OUString & GetStyleName() const
Definition: font/font.cxx:879
const OUString & GetFamilyName() const
Definition: font/font.cxx:878
const Size & GetFontSize() const
Definition: font/font.cxx:881
const Color & GetColor() const
Definition: font/font.cxx:872
FontWeight GetWeight()
Definition: font/font.cxx:899
bool IsVertical() const
Definition: font/font.cxx:895
Degree10 GetOrientation() const
Definition: font/font.cxx:894
const Color & GetFillColor() const
Definition: font/font.cxx:873
tools::PolyPolygon GetAsPolyPolygon() const
Definition: region.cxx:1266
bool HasPolyPolygonOrB2DPolyPolygon() const
Definition: region.hxx:107
tools::Rectangle GetBoundRect() const
Definition: region.cxx:1219
float u
std::deque< AttacherIndex_Impl > aIndex
FontLineStyle
LINESTYLE_BOLDDASHDOT
LINESTYLE_BOLDDASHDOTDOT
LINESTYLE_SINGLE
LINESTYLE_BOLDLONGDASH
LINESTYLE_BOLDWAVE
LINESTYLE_DASHDOTDOT
LINESTYLE_BOLDDASH
LINESTYLE_BOLDDOTTED
LINESTYLE_DOUBLEWAVE
LINESTYLE_DOUBLE
LINESTYLE_NONE
LINESTYLE_DASH
LINESTYLE_DONTKNOW
LINESTYLE_SMALLWAVE
LINESTYLE_DASHDOT
LINESTYLE_DOTTED
LINESTYLE_WAVE
LINESTYLE_LONGDASH
FontLineStyle_FORCE_EQUAL_SIZE
LINESTYLE_BOLD
FontStrikeout
STRIKEOUT_BOLD
STRIKEOUT_DOUBLE
STRIKEOUT_SINGLE
STRIKEOUT_X
STRIKEOUT_SLASH
FontStrikeout_FORCE_EQUAL_SIZE
STRIKEOUT_NONE
STRIKEOUT_DONTKNOW
TextAlign_FORCE_EQUAL_SIZE
ALIGN_BOTTOM
ALIGN_TOP
ALIGN_BASELINE
WEIGHT_ULTRALIGHT
WEIGHT_ULTRABOLD
WEIGHT_THIN
WEIGHT_BOLD
WEIGHT_NORMAL
WEIGHT_LIGHT
WEIGHT_DONTKNOW
WEIGHT_SEMIBOLD
WEIGHT_SEMILIGHT
FontWeight_FORCE_EQUAL_SIZE
WEIGHT_MEDIUM
WEIGHT_BLACK
MapUnit
MetaActionType
HatchStyle
GradientStyle
int i
TextAlign
FontWeight
ComplexTextLayoutFlags
Definition: State.hxx:76
PushFlags
Definition: State.hxx:40
PixelFormat
Pixel format of the bitmap in bits per pixel.
Definition: BitmapTypes.hxx:20
PolyFlags
UNDERLYING_TYPE get() const
unsigned char sal_uInt8
LineStyle
Definition: vclenum.hxx:165
WallpaperStyle
Definition: wall.hxx:35