19#include <rtl/string.hxx>
20#include <rtl/ustrbuf.hxx>
36 std::vector<OUString> aStrings;
39 aStrings.emplace_back(
"PushLineColor");
41 aStrings.emplace_back(
"PushFillColor");
43 aStrings.emplace_back(
"PushFont");
45 aStrings.emplace_back(
"PushTextColor");
47 aStrings.emplace_back(
"PushMapMode");
49 aStrings.emplace_back(
"PushClipRegion");
51 aStrings.emplace_back(
"PushRasterOp");
53 aStrings.emplace_back(
"PushTextFillColor");
55 aStrings.emplace_back(
"PushTextAlign");
57 aStrings.emplace_back(
"PushRefPoint");
59 aStrings.emplace_back(
"PushTextLineColor");
61 aStrings.emplace_back(
"PushTextLayoutMode");
63 aStrings.emplace_back(
"PushTextLanguage");
65 aStrings.emplace_back(
"PushOverlineColor");
72 aString = aStrings[0];
73 for (
size_t i = 1;
i < aStrings.size(); ++
i)
75 aString +=
", " + aStrings[
i];
80OUString convertDrawTextFlagsToString(
DrawTextFlags eDrawTextFlags)
82 std::vector<OUString> aStrings;
84 aStrings.emplace_back(
"Disable");
86 aStrings.emplace_back(
"Mnemonic");
88 aStrings.emplace_back(
"Mono");
90 aStrings.emplace_back(
"Clip");
92 aStrings.emplace_back(
"Left");
94 aStrings.emplace_back(
"Center");
96 aStrings.emplace_back(
"Right");
98 aStrings.emplace_back(
"Top");
100 aStrings.emplace_back(
"VCenter");
102 aStrings.emplace_back(
"Bottom");
104 aStrings.emplace_back(
"EndEllipsis");
106 aStrings.emplace_back(
"PathEllipsis");
108 aStrings.emplace_back(
"MultiLine");
110 aStrings.emplace_back(
"WordBreak");
112 aStrings.emplace_back(
"NewsEllipsis");
114 aStrings.emplace_back(
"WordBreakHyphenation");
116 aStrings.emplace_back(
"CenterEllipsis");
120 if (aStrings.empty())
123 aString = aStrings[0];
124 for (
size_t i = 1;
i < aStrings.size(); ++
i)
126 aString +=
" " + aStrings[
i];
131OUString convertRopToString(
RasterOp eRop)
144OUString convertTextAlignToString(
TextAlign eAlign)
156OUString convertColorToString(
Color aColor)
159 return "#" + aRGBString;
162OUString convertLineStyleToString(
LineStyle eAlign)
186OUString convertLineCapToString(css::drawing::LineCap eCap)
191 case css::drawing::LineCap_BUTT:
return "butt";
192 case css::drawing::LineCap_ROUND:
return "round";
193 case css::drawing::LineCap_SQUARE:
return "square";
197OUString convertPolygonFlags(
PolyFlags eFlags)
202 case PolyFlags::Normal:
return "normal";
203 case PolyFlags::Control:
return "control";
204 case PolyFlags::Smooth:
return "smooth";
205 case PolyFlags::Symmetric:
return "symmetric";
209OUString convertFontWeightToString(
FontWeight eFontWeight)
229OUString convertFontStrikeoutToString(
FontStrikeout eFontStrikeout)
231 switch (eFontStrikeout)
245OUString convertFontLineStyleToString(
FontLineStyle eFontLineStyle)
247 switch (eFontLineStyle)
335OUString convertBitmapExTransparentType(
BitmapEx const & rBitmapEx)
343OUString convertMapUnitToString(
MapUnit eUnit)
348 case MapUnit::LASTENUMDUMMY:
return "LASTENUMDUMMY";
349 case MapUnit::Map1000thInch:
return "Map1000thInch";
350 case MapUnit::Map100thInch:
return "Map100thInch";
351 case MapUnit::Map100thMM:
return "Map100thMM";
352 case MapUnit::Map10thInch:
return "Map10thInch";
353 case MapUnit::Map10thMM:
return "Map10thMM";
354 case MapUnit::MapAppFont:
return "MapAppFont";
355 case MapUnit::MapCM:
return "MapCM";
356 case MapUnit::MapInch:
return "MapInch";
357 case MapUnit::MapMM:
return "MapMM";
358 case MapUnit::MapPixel:
return "MapPixel";
359 case MapUnit::MapPoint:
return "MapPoint";
360 case MapUnit::MapRelative:
return "MapRelative";
361 case MapUnit::MapSysFont:
return "MapSysFont";
362 case MapUnit::MapTwip:
return "MapTwip";
366OUString convertFractionToString(
const Fraction& aFraction)
368 std::stringstream ss;
372 return OUString::createFromAscii(ss.str());
375OUString convertGradientStyleToOUString(css::awt::GradientStyle eStyle)
379 case css::awt::GradientStyle_LINEAR:
return "Linear";
380 case css::awt::GradientStyle_AXIAL:
return "Axial";
381 case css::awt::GradientStyle_RADIAL:
return "Radial";
382 case css::awt::GradientStyle_ELLIPTICAL:
return "Elliptical";
383 case css::awt::GradientStyle_SQUARE:
return "Square";
384 case css::awt::GradientStyle_RECT:
return "Rect";
385 case css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE:
return "ForceEqualSize";
394 case HatchStyle::Single:
return "Single";
395 case HatchStyle::Double:
return "Double";
396 case HatchStyle::Triple:
return "Triple";
397 case HatchStyle::FORCE_EQUAL_SIZE:
return "ForceEqualSize";
402OUString convertLanguageTypeToString(
LanguageType rLanguageType)
404 std::stringstream ss;
405 ss << std::hex << std::setfill (
'0') << std::setw(4) << rLanguageType.
get();
406 return "#" + OUString::createFromAscii(ss.str());
409OUString convertWallpaperStyleToString(
WallpaperStyle eWallpaperStyle)
411 switch (eWallpaperStyle)
432 switch (ePixelFormat)
444 switch(eComplexTestLayoutFlags)
455OUString convertGfxLinkTypeToString(
GfxLinkType eGfxLinkType)
477OUString hex32(sal_uInt32 nNumber)
479 std::stringstream ss;
480 ss << std::hex << std::setfill(
'0') << std::setw(8) << nNumber;
481 return OUString::createFromAscii(ss.str());
484OUString toHexString(
const sal_uInt8* nData, sal_uInt32 nDataSize){
486 std::stringstream aStrm;
487 for (sal_uInt32 i = 0;
i < nDataSize;
i++)
489 aStrm << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(nData[i]);
492 return OUString::createFromAscii(aStrm.str());
524 rWriter.
attribute(
"right", OString(
"empty"));
528 rWriter.
attribute(
"bottom", OString(
"empty"));
536 writePoint(rWriter, rMapMode.
GetOrigin());
543 rWriter.
attribute(
"style", convertLineStyleToString(rLineInfo.GetStyle()));
544 rWriter.
attribute(
"width", rLineInfo.GetWidth());
545 rWriter.
attribute(
"dashlen", rLineInfo.GetDashLen());
546 rWriter.
attribute(
"dashcount", rLineInfo.GetDashCount());
547 rWriter.
attribute(
"dotlen", rLineInfo.GetDotLen());
548 rWriter.
attribute(
"dotcount", rLineInfo.GetDotCount());
549 rWriter.
attribute(
"distance", rLineInfo.GetDistance());
550 rWriter.
attribute(
"join", convertLineJoinToString(rLineInfo.GetLineJoin()));
551 rWriter.
attribute(
"cap", convertLineCapToString(rLineInfo.GetLineCap()));
556 rWriter.
attribute(
"style", convertGradientStyleToOUString(rGradient.
GetStyle()));
568OString toHexString(
const std::vector<unsigned char>& a)
570 std::stringstream aStrm;
573 aStrm << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(i);
576 return OString(aStrm.str());
596 aHashEngine.update(&r, 1);
597 aHashEngine.update(&g, 1);
598 aHashEngine.update(&b, 1);
599 aHashEngine.update(&a, 1);
602 std::vector<unsigned char> aVector = aHashEngine.finalize();
603 rWriter.
attribute(
"contentchecksum", toHexString(aVector));
608 writeBitmapContentChecksum(rWriter, rBitmap);
624 maFilter[nActionType] = bShouldFilter;
648 writePoint(rWriter, aMtfMapMode.
GetOrigin());
653 writeSize(rWriter, aMtfSize);
655 for(
size_t nAction = 0; nAction < rMetaFile.
GetActionSize(); ++nAction)
662 OString sCurrentElementTag = convertLineStyleToString(nActionType);
677 writePoint(rWriter, pMetaAction->GetPoint());
678 rWriter.
attribute(
"color", convertColorToString(pMetaAction->GetColor()));
687 writePoint(rWriter, pMetaAction->GetPoint());
697 writeEndPoint(rWriter, pMetaLineAction->
GetEndPoint());
699 writeLineInfo(rWriter, pMetaLineAction->
GetLineInfo());
708 writeRectangle(rWriter, pMetaAction->
GetRect());
717 writeRectangle(rWriter, pMetaAction->GetRect());
718 rWriter.
attribute(
"horizontalround", pMetaAction->GetHorzRound());
719 rWriter.
attribute(
"verticalround", pMetaAction->GetVertRound());
728 writeRectangle(rWriter, pMetaAction->GetRect());
737 writeRectangle(rWriter, pMetaAction->GetRect());
738 writeStartPoint(rWriter, pMetaAction->GetStartPoint());
739 writeEndPoint(rWriter, pMetaAction->GetEndPoint());
748 writeRectangle(rWriter, pMetaAction->GetRect());
749 writeStartPoint(rWriter, pMetaAction->GetStartPoint());
750 writeEndPoint(rWriter, pMetaAction->GetEndPoint());
759 writeRectangle(rWriter, pMetaAction->GetRect());
760 writeStartPoint(rWriter, pMetaAction->GetStartPoint());
761 writeEndPoint(rWriter, pMetaAction->GetEndPoint());
771 writeLineInfo(rWriter, pMetaPolyLineAction->
GetLineInfo());
775 for (sal_uInt16
i = 0;
i < aPolygon.
GetSize();
i++)
778 writePoint(rWriter, aPolygon[
i]);
795 for (sal_uInt16
i = 0;
i < aPolygon.
GetSize();
i++)
798 writePoint(rWriter, aPolygon[
i]);
815 for (sal_uInt16 j = 0; j < rPolyPolygon.
Count(); ++j)
820 for (sal_uInt16
i = 0;
i < rPolygon.
GetSize(); ++
i)
823 writePoint(rWriter, rPolygon[
i]);
838 writePoint(rWriter, pMeta->GetPoint());
839 rWriter.
attribute(
"index", pMeta->GetIndex());
840 rWriter.
attribute(
"length", pMeta->GetLen());
842 rWriter.
content(pMeta->GetText());
855 sal_Int32 aLength = pMetaTextArrayAction->
GetLen();
857 writePoint(rWriter, pMetaTextArrayAction->
GetPoint());
863 auto & rArray = pMetaTextArrayAction->
GetDXArray();
865 if (
aIndex < o3tl::narrowing<sal_Int32>(rArray.size()))
867 if (
aIndex + aLength - 1 < o3tl::narrowing<sal_Int32>(rArray.size()))
869 OUStringBuffer sDxLengthString(std::max((aLength -
aIndex) * 4, sal_Int32(0)));
870 for (sal_Int32
i = 0;
i < aLength -
aIndex; ++
i)
872 sDxLengthString.append(OUString::number(rArray[
aIndex +
i]) +
" ");
874 rWriter.
content(sDxLengthString);
880 const OUString& rStr = pMetaTextArrayAction->
GetText();
883 if ( rStr.indexOf(0x01) > -1 )
884 rWriter.
content(rStr.replaceAll(
"\001",
""));
899 writePoint(rWriter, pMeta->GetPoint());
900 rWriter.
attribute(
"index", pMeta->GetIndex());
901 rWriter.
attribute(
"length", pMeta->GetLen());
902 rWriter.
attribute(
"width", pMeta->GetWidth());
905 rWriter.
content(pMeta->GetText());
916 writeRectangle(rWriter, pMeta->GetRect());
918 rWriter.
content(pMeta->GetText());
922 rWriter.
content(convertDrawTextFlagsToString(pMeta->GetStyle()));
932 Bitmap aBitmap = pMeta->GetBitmap();
934 writePoint(rWriter, pMeta->GetPoint());
935 writeBitmap(rWriter, aBitmap);
943 Bitmap aBitmap = pMeta->GetBitmap();
945 writePoint(rWriter, pMeta->GetPoint());
946 writeSize(rWriter, pMeta->GetSize());
947 writeBitmap(rWriter, aBitmap);
955 Bitmap aBitmap = pMeta->GetBitmap();
957 rWriter.
attribute(
"destx", pMeta->GetDestPoint().X());
958 rWriter.
attribute(
"desty", pMeta->GetDestPoint().Y());
959 rWriter.
attribute(
"destwidth", pMeta->GetDestSize().Width());
960 rWriter.
attribute(
"destheight", pMeta->GetDestSize().Height());
961 rWriter.
attribute(
"srcx", pMeta->GetSrcPoint().X());
962 rWriter.
attribute(
"srcy", pMeta->GetSrcPoint().Y());
963 rWriter.
attribute(
"srcwidth", pMeta->GetSrcSize().Width());
964 rWriter.
attribute(
"srcheight", pMeta->GetSrcSize().Height());
965 writeBitmap(rWriter, aBitmap);
974 writePoint(rWriter, pMeta->GetPoint());
975 Bitmap aBitmap = pMeta->GetBitmapEx().GetBitmap();
976 rWriter.
attribute(
"transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
977 writeBitmap(rWriter, aBitmap);
986 writePoint(rWriter, pMeta->GetPoint());
987 writeSize(rWriter, pMeta->GetSize());
988 Bitmap aBitmap = pMeta->GetBitmapEx().GetBitmap();
989 rWriter.
attribute(
"transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
990 writeBitmap(rWriter, aBitmap);
998 Bitmap aBitmap = pMeta->GetBitmapEx().GetBitmap();
1000 rWriter.
attribute(
"destx", pMeta->GetDestPoint().X());
1001 rWriter.
attribute(
"desty", pMeta->GetDestPoint().Y());
1002 rWriter.
attribute(
"destwidth", pMeta->GetDestSize().Width());
1003 rWriter.
attribute(
"destheight", pMeta->GetDestSize().Height());
1004 rWriter.
attribute(
"srcx", pMeta->GetSrcPoint().X());
1005 rWriter.
attribute(
"srcy", pMeta->GetSrcPoint().Y());
1006 rWriter.
attribute(
"srcwidth", pMeta->GetSrcSize().Width());
1007 rWriter.
attribute(
"srcheight", pMeta->GetSrcSize().Height());
1008 rWriter.
attribute(
"transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx()));
1009 writeBitmap(rWriter, aBitmap);
1018 writePoint(rWriter, pMeta->GetPoint());
1019 rWriter.
attribute(
"crc", hex32(pMeta->GetBitmap().GetChecksum()));
1020 rWriter.
attribute(
"color", convertColorToString(pMeta->GetColor()));
1029 writePoint(rWriter, pMeta->GetPoint());
1030 writeSize(rWriter, pMeta->GetSize());
1031 rWriter.
attribute(
"crc", hex32(pMeta->GetBitmap().GetChecksum()));
1032 rWriter.
attribute(
"color", convertColorToString(pMeta->GetColor()));
1041 rWriter.
attribute(
"destx", pMeta->GetDestPoint().X());
1042 rWriter.
attribute(
"desty", pMeta->GetDestPoint().Y());
1043 rWriter.
attribute(
"destwidth", pMeta->GetDestSize().Width());
1044 rWriter.
attribute(
"destheight", pMeta->GetDestSize().Height());
1045 rWriter.
attribute(
"srcx", pMeta->GetSrcPoint().X());
1046 rWriter.
attribute(
"srcy", pMeta->GetSrcPoint().Y());
1047 rWriter.
attribute(
"srcwidth", pMeta->GetSrcSize().Width());
1048 rWriter.
attribute(
"srcheight", pMeta->GetSrcSize().Height());
1049 rWriter.
attribute(
"crc", hex32(pMeta->GetBitmap().GetChecksum()));
1050 rWriter.
attribute(
"color", convertColorToString(pMeta->GetColor()));
1063 writeRectangle(rWriter, pMeta->
GetRect());
1072 auto*
const pMetaHatchAction =
static_cast<MetaHatchAction*
>(pAction);
1077 for (sal_uInt16 j = 0; j < rPolyPolygon.
Count(); ++j)
1082 for (sal_uInt16
i = 0;
i < rPolygon.
GetSize(); ++
i)
1085 writePoint(rWriter, rPolygon[
i]);
1094 const auto& rHatch = pMetaHatchAction->GetHatch();
1095 rWriter.
attribute(
"style", convertHatchStyle(rHatch.GetStyle()));
1096 rWriter.
attribute(
"color", convertColorToString(rHatch.GetColor()));
1097 rWriter.
attribute(
"distance", sal_Int32(rHatch.GetDistance()));
1098 rWriter.
attribute(
"angle", sal_Int32(rHatch.GetAngle().get()));
1110 writeRectangle(rWriter, pMetaAction->GetRect());
1113 const auto& rWallpaper = pMetaAction->GetWallpaper();
1115 rWriter.
attribute(
"color", convertColorToString(rWallpaper.GetColor()));
1118 rWriter.
attribute(
"style", convertWallpaperStyleToString(eStyle));
1120 if (rWallpaper.IsBitmap())
1125 rWriter.
attribute(
"transparenttype", convertBitmapExTransparentType(rBitmapEx));
1132 if (rWallpaper.IsGradient())
1135 Gradient aGradient = rWallpaper.GetGradient();
1136 writeGradient(rWriter, aGradient);
1140 if (rWallpaper.IsRect())
1144 writeRectangle(rWriter, aRect);
1148 rWriter.
attribute(
"fixed", rWallpaper.IsFixed() ?
"true" :
"false");
1149 rWriter.
attribute(
"scrollable", rWallpaper.IsScrollable() ?
"true" :
"false");
1162 tools::Rectangle aRectangle = pMetaClipRegionAction->GetRegion().GetBoundRect();
1163 writeRectangle(rWriter, aRectangle);
1165 vcl::Region aRegion = pMetaClipRegionAction->GetRegion();
1171 for (sal_uInt16 j = 0; j < aPolyPolygon.
Count(); ++j)
1176 for (sal_uInt16
i = 0;
i < rPolygon.
GetSize(); ++
i)
1179 writePoint(rWriter, rPolygon[
i]);
1198 writeRectangle(rWriter, aRectangle);
1212 writeRectangle(rWriter, aRectangle);
1222 rWriter.
attribute(
"horzmove", pMetaMoveClipRegionAction->GetHorzMove());
1223 rWriter.
attribute(
"vertmove", pMetaMoveClipRegionAction->GetVertMove());
1233 rWriter.
attribute(
"color", convertColorToString(pMetaLineColorAction->
GetColor()));
1243 rWriter.
attribute(
"color", convertColorToString(pMetaFillColorAction->
GetColor()));
1253 rWriter.
attribute(
"color", convertColorToString(pMetaTextColorAction->
GetColor()));
1263 rWriter.
attribute(
"color", convertColorToString(pMetaTextFillColorAction->
GetColor()));
1265 if (pMetaTextFillColorAction->
IsSetting())
1276 OUString sAlign = convertTextAlignToString(pMetaTextAlignAction->
GetTextAlign());
1277 if (!sAlign.isEmpty())
1289 writePoint(rWriter, aMapMode.
GetOrigin());
1354 for (sal_uInt16 j = 0; j < rPolyPolygon.
Count(); ++j)
1359 for (sal_uInt16
i = 0;
i < rPolygon.
GetSize(); ++
i)
1362 writePoint(rWriter, rPolygon[
i]);
1379 writePoint(rWriter, pMetaEPSAction->
GetPoint());
1380 writeSize(rWriter, pMetaEPSAction->
GetSize());
1408 writePoint(rWriter, pMeta->GetRefPoint());
1409 rWriter.
attribute(
"set", pMeta->IsSetting() ?
"true" :
"false");
1418 rWriter.
attribute(
"color", convertColorToString(pMeta->GetColor()));
1427 writePoint(rWriter, pMeta->GetStartPoint());
1428 rWriter.
attribute(
"width", pMeta->GetWidth());
1429 rWriter.
attribute(
"strikeout", convertFontStrikeoutToString(pMeta->GetStrikeout()));
1430 rWriter.
attribute(
"underline", convertFontLineStyleToString(pMeta->GetUnderline()));
1431 rWriter.
attribute(
"overline", convertFontLineStyleToString(pMeta->GetOverline()));
1440 writePoint(rWriter, pMeta->GetPoint());
1441 writeSize(rWriter, pMeta->GetSize());
1442 rWriter.
attribute(
"transparent", pMeta->IsTransparent() ?
"true" :
"false");
1445 writeGradient(rWriter, pMeta->GetGradient());
1449 writeXml(pMeta->GetGDIMetaFile(), rWriter);
1461 writeGradient(rWriter, pMetaGradientExAction->
GetGradient());
1464 for (sal_uInt16 j = 0; j < rPolyPolygon.
Count(); ++j)
1469 for (sal_uInt16
i = 0;
i < rPolygon.
GetSize(); ++
i)
1472 writePoint(rWriter, rPolygon[
i]);
1512 rWriter.
attribute(
"color", convertColorToString(pMetaAction->GetColor()));
1529 if (!pMetaCommentAction->
GetComment().isEmpty())
1542 rWriter.
attribute(
"note", OString(
"not implemented in xml dump"));
BitmapChecksum GetChecksum() const
Bitmap GetBitmap(Color aTransparentReplaceColor) const
const Size & GetSizePixel() const
BitmapChecksum GetChecksum() const
Size GetSizePixel() const
vcl::PixelFormat getPixelFormat() const
sal_uInt8 GetBlue() const
OUString AsRGBHexString() const
sal_uInt8 GetAlpha() const
sal_uInt8 GetGreen() const
bool IsPrefMapModeValid() const
const sal_uInt8 * GetData() const
const Size & GetPrefSize() const
sal_uInt32 GetDataSize() const
GfxLinkType GetType() const
const MapMode & GetPrefMapMode() const
sal_uInt32 GetUserId() const
sal_uInt16 GetStartIntensity() 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
css::awt::GradientStyle GetStyle() const
sal_uInt16 GetSteps() const
const Fraction & GetScaleX() const
MapUnit GetMapUnit() const
const Point & GetOrigin() const
const Fraction & GetScaleY() const
TextAlign GetTextAlign() const
sal_Int32 GetIndex() const
const KernArray & GetDXArray() const
const OUString & GetText() const
const Point & GetPoint() const
const Color & GetColor() const
const Color & GetColor() const
LanguageType GetTextLanguage() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
const Size & GetFontSize() const
const Color & GetColor() const
Degree10 GetOrientation() const
const Color & GetFillColor() const
tools::PolyPolygon GetAsPolyPolygon() const
bool HasPolyPolygonOrB2DPolyPolygon() const
tools::Rectangle GetBoundRect() const
std::deque< AttacherIndex_Impl > aIndex
FontLineStyle_FORCE_EQUAL_SIZE
FontStrikeout_FORCE_EQUAL_SIZE
TextAlign_FORCE_EQUAL_SIZE
FontWeight_FORCE_EQUAL_SIZE
GfxLinkType
GfxLink graphic types that are supported by GfxLink.
PixelFormat
Pixel format of the bitmap in bits per pixel.
UNDERLYING_TYPE get() const