[Libreoffice-commits] core.git: vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 13 17:31:47 UTC 2020


 vcl/source/gdi/mtfxmldump.cxx |   46 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)

New commits:
commit fa844c15233f108a0e9b0b2e8c9757c1aa088a4b
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Jul 7 23:05:27 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jul 13 19:31:03 2020 +0200

    write additional actions in MetafileXmlDump
    
    - initial MapMode and size
    - REFPOINT
    - FLOATTRANSPARENT
    
    Change-Id: I6d590e71a8f69042e882b8c8b4938ccbf04029da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98626
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 461321c1cb54..4af6c43c9acd 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -528,6 +528,15 @@ void MetafileXmlDump::dump(const GDIMetaFile& rMetaFile, SvStream& rStream)
 
 void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& rWriter)
 {
+    MapMode aMtfMapMode = rMetaFile.GetPrefMapMode();
+    rWriter.attribute("mapunit", convertMapUnitToString(aMtfMapMode.GetMapUnit()));
+    writePoint(rWriter, aMtfMapMode.GetOrigin());
+    rWriter.attribute("scalex", convertFractionToString(aMtfMapMode.GetScaleX()));
+    rWriter.attribute("scaley", convertFractionToString(aMtfMapMode.GetScaleY()));
+
+    Size aMtfSize = rMetaFile.GetPrefSize();
+    writeSize(rWriter, aMtfSize);
+
     for(size_t nAction = 0; nAction < rMetaFile.GetActionSize(); ++nAction)
     {
         MetaAction* pAction = rMetaFile.GetAction(nAction);
@@ -1201,14 +1210,22 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
             break;
 
             //case MetaActionType::EPS:
-            //case MetaActionType::REFPOINT:
 
-            case MetaActionType::TEXTLINECOLOR:
+            case MetaActionType::REFPOINT:
             {
-                MetaTextLineColorAction* pMetaTextLineColorAction = static_cast<MetaTextLineColorAction*>(pAction);
+                auto* pMeta = static_cast<MetaRefPointAction*>(pAction);
                 rWriter.startElement(sCurrentElementTag);
+                writePoint(rWriter, pMeta->GetRefPoint());
+                rWriter.attribute("set", pMeta->IsSetting() ? "true" : "false");
+                rWriter.endElement();
+            }
+            break;
 
-                rWriter.attribute("color", convertColorToString(pMetaTextLineColorAction->GetColor()));
+            case MetaActionType::TEXTLINECOLOR:
+            {
+                auto* pMeta = static_cast<MetaTextLineColorAction*>(pAction);
+                rWriter.startElement(sCurrentElementTag);
+                rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
                 rWriter.endElement();
             }
             break;
@@ -1226,7 +1243,26 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
             }
             break;
 
-            //case MetaActionType::FLOATTRANSPARENT:
+            case MetaActionType::FLOATTRANSPARENT:
+            {
+                const auto* pMeta = static_cast<MetaFloatTransparentAction*>(pAction);
+                rWriter.startElement(sCurrentElementTag);
+                writePoint(rWriter, pMeta->GetPoint());
+                writeSize(rWriter, pMeta->GetSize());
+                rWriter.attribute("transparent", pMeta->IsTransparent() ? "true" : "false");
+
+                rWriter.startElement("gradient");
+                writeGradient(rWriter, pMeta->GetGradient());
+                rWriter.endElement();
+
+                rWriter.startElement("metafile");
+                writeXml(pMeta->GetGDIMetaFile(), rWriter);
+                rWriter.endElement();
+
+                rWriter.endElement();
+            }
+            break;
+
             //case MetaActionType::GRADIENTEX:
             //case MetaActionType::LAYOUTMODE:
             //case MetaActionType::TEXTLANGUAGE:


More information about the Libreoffice-commits mailing list