vcl/qa/cppunit/svm/svmtest.cxx |    4 ++--
 vcl/source/gdi/mtfxmldump.cxx  |   32 ++++++++++++++++++++++++--------
 2 files changed, 26 insertions(+), 10 deletions(-)

New commits:
commit 77dab2ac3a4dfdc6f51fdfc31078fb828e8164fa
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Thu Aug 17 17:19:09 2023 +0300
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Tue Aug 22 10:52:58 2023 +0200

    vcl: Fix dumping meta file layout flags to XML
    
    These are bit flags, so we were always writing #0000, so now it does
    bitwise check for the flags and while at it write the names of the flags
    not the numeric values.
    
    Change-Id: I13cae38c0e549b2da1f834a264e3a3255bfa5c5a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155793
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index 5161f4cce960..d89f2f93118d 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -2298,11 +2298,11 @@ void SvmTest::checkLayoutMode(const GDIMetaFile& 
rMetaFile)
     xmlDocUniquePtr pDoc = dumpMeta(rMetaFile);
 
     assertXPathAttrs(pDoc, "/metafile/layoutmode[1]", {
-        {"textlayout", "#0004"}
+        {"textlayout", "TextOriginLeft"}
     });
 
     assertXPathAttrs(pDoc, "/metafile/layoutmode[2]", {
-        {"textlayout", "#0001"}
+        {"textlayout", "BiDiRtl"}
     });
 }
 
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 8726316324de..c26a44310774 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -439,17 +439,33 @@ OUString convertPixelFormatToString(vcl::PixelFormat 
ePixelFormat)
     return OUString();
 }
 
-OUString convertComplexTestLayoutFlags(vcl::text::ComplexTextLayoutFlags 
eComplexTestLayoutFlags)
+OUString convertComplexTestLayoutFlags(vcl::text::ComplexTextLayoutFlags 
nFlags)
 {
-    switch(eComplexTestLayoutFlags)
+    if (nFlags == vcl::text::ComplexTextLayoutFlags::Default)
+        return "Default";
+
+    std::vector<OUString> aStrings;
+
+    if (nFlags & vcl::text::ComplexTextLayoutFlags::BiDiRtl)
+        aStrings.emplace_back("BiDiRtl");
+    if (nFlags & vcl::text::ComplexTextLayoutFlags::BiDiStrong)
+        aStrings.emplace_back("BiDiStrong");
+    if (nFlags & vcl::text::ComplexTextLayoutFlags::TextOriginLeft)
+        aStrings.emplace_back("TextOriginLeft");
+    if (nFlags & vcl::text::ComplexTextLayoutFlags::TextOriginRight)
+        aStrings.emplace_back("TextOriginRight");
+
+    OUString aString;
+
+    if (aStrings.empty())
+        return aString;
+
+    aString = aStrings[0];
+    for (size_t i = 1; i < aStrings.size(); ++i)
     {
-        default:
-        case vcl::text::ComplexTextLayoutFlags::Default: return "#0000";
-        case vcl::text::ComplexTextLayoutFlags::BiDiRtl: return "#0001";
-        case vcl::text::ComplexTextLayoutFlags::BiDiStrong: return "#0002";
-        case vcl::text::ComplexTextLayoutFlags::TextOriginLeft: return "#0004";
-        case vcl::text::ComplexTextLayoutFlags::TextOriginRight: return 
"#0008";
+        aString += ", " + aStrings[i];
     }
+    return aString;
 }
 
 OUString convertGfxLinkTypeToString(GfxLinkType eGfxLinkType)

Reply via email to