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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 3 09:11:00 UTC 2019


 test/source/mtfxmldump.cxx |   46 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

New commits:
commit 39e1ff4e068b05fc3e061388489761efef5b394b
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Wed Jan 2 23:26:34 2019 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jan 3 10:10:36 2019 +0100

    Extend MetafileXmlDump::writeXml to cover MAPMODE
    
    Change-Id: I573374db8ae0f14e11fcd884c2e3ada5419c5982
    Reviewed-on: https://gerrit.libreoffice.org/65824
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/test/source/mtfxmldump.cxx b/test/source/mtfxmldump.cxx
index c643834c8d03..593123054329 100644
--- a/test/source/mtfxmldump.cxx
+++ b/test/source/mtfxmldump.cxx
@@ -10,6 +10,7 @@
 #include <test/mtfxmldump.hxx>
 #include <test/xmltesttools.hxx>
 #include <tools/XmlWriter.hxx>
+#include<tools/fract.hxx>
 
 #include <vcl/metaact.hxx>
 #include <vcl/outdev.hxx>
@@ -343,6 +344,38 @@ OUString convertBitmapExTransparentType(TransparentType eType)
     }
 }
 
+OUString convertMapUnitToString(MapUnit eUnit)
+{
+    switch (eUnit)
+    {
+        default:
+        case MapUnit::LASTENUMDUMMY:    return OUString("LASTENUMDUMMY");
+        case MapUnit::Map1000thInch:    return OUString("Map1000thInch");
+        case MapUnit::Map100thInch:     return OUString("Map100thInch");
+        case MapUnit::Map100thMM:       return OUString("Map100thMM");
+        case MapUnit::Map10thInch:      return OUString("Map10thInch");
+        case MapUnit::Map10thMM:        return OUString("Map10thMM");
+        case MapUnit::MapAppFont:       return OUString("MapAppFont");
+        case MapUnit::MapCM:            return OUString("MapCM");
+        case MapUnit::MapInch:          return OUString("MapInch");
+        case MapUnit::MapMM:            return OUString("MapMM");
+        case MapUnit::MapPixel:         return OUString("MapPixel");
+        case MapUnit::MapPoint:         return OUString("MapPoint");
+        case MapUnit::MapRelative:      return OUString("MapRelative");
+        case MapUnit::MapSysFont:       return OUString("MapSysFont");
+        case MapUnit::MapTwip:          return OUString("MapTwip");
+    }
+}
+
+OUString convertFractionToString(const Fraction& aFraction)
+{
+    std::stringstream ss;
+
+    ss << aFraction;
+
+    return OUString::createFromAscii(ss.str().c_str());
+}
+
 
 OUString hex32(sal_uInt32 nNumber)
 {
@@ -1004,6 +1037,19 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
             }
             break;
 
+            case MetaActionType::MAPMODE:
+            {
+                const MetaMapModeAction* pMeta = static_cast<MetaMapModeAction*>(pAction);
+                MapMode aMapMode = pMeta->GetMapMode();
+                rWriter.startElement(sCurrentElementTag);
+                rWriter.attribute("mapunit", convertMapUnitToString( aMapMode.GetMapUnit() ));
+                writePoint(rWriter, aMapMode.GetOrigin());
+                rWriter.attribute("scalex", convertFractionToString(aMapMode.GetScaleX()));
+                rWriter.attribute("scaley", convertFractionToString(aMapMode.GetScaleY()));
+                rWriter.endElement();
+            }
+            break;
+
             default:
             {
                 rWriter.element(sCurrentElementTag);


More information about the Libreoffice-commits mailing list