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

Hossein (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 7 13:06:57 UTC 2021


 drawinglayer/source/tools/emfpstringformat.cxx |   64 +++++--------------------
 1 file changed, 14 insertions(+), 50 deletions(-)

New commits:
commit a2b1c2835733fb028bc5433eb6805820c329daf3
Author:     Hossein <hossein at libreoffice.org>
AuthorDate: Thu Oct 7 00:12:24 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Oct 7 15:06:23 2021 +0200

    Clean StringFormatFlags() in emfpstringformat.cxx
    
    * Fix: StringFormatDirectionVertical was missing, and another enum
      was used instead by mistake
    
    * Cleaned up StringFormatFlags() method
        + There was no need to check for each flag and add ", "
        + The method is only used for SAL_INFO
        + Just adding space in the end of each flag every time
        + Goal: Making code faster and also more readable
    
    Change-Id: I4be2d291611f2b5d3c8a4490a8b273d5a4511dfe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123200
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/drawinglayer/source/tools/emfpstringformat.cxx b/drawinglayer/source/tools/emfpstringformat.cxx
index 071493c13062..0a053201b4ec 100644
--- a/drawinglayer/source/tools/emfpstringformat.cxx
+++ b/drawinglayer/source/tools/emfpstringformat.cxx
@@ -46,75 +46,39 @@ namespace emfplushelper
     {
         OUStringBuffer sFlags;
 
+        // These are extracted from enum in emfpstringformat.hxx
         if (flag & StringFormatDirectionRightToLeft)
-            sFlags.append("StringFormatDirectionRightToLeft");
+            sFlags.append("StringFormatDirectionRightToLeft ");
 
-        if (flag & StringFormatDirectionRightToLeft)
-        {
-            if (!sFlags.isEmpty())
-                sFlags.append(", ");
-
-            sFlags.append("StringFormatDirectionRightToLeft");
-        }
+        if (flag & StringFormatDirectionVertical)
+            sFlags.append("StringFormatDirectionVertical ");
 
         if (flag & StringFormatNoFitBlackBox)
-        {
-            if (!sFlags.isEmpty())
-                sFlags.append(", ");
-
-            sFlags.append("StringFormatNoFitBlackBox");
-        }
+            sFlags.append("StringFormatNoFitBlackBox ");
 
         if (flag & StringFormatDisplayFormatControl)
-        {
-            if (!sFlags.isEmpty())
-                sFlags.append(", ");
+            sFlags.append("StringFormatDisplayFormatControl ");
 
-            sFlags.append("StringFormatDisplayFormatControl");
-        }
         if (flag & StringFormatNoFontFallback)
-        {
-            if (!sFlags.isEmpty())
-                sFlags.append(", ");
+            sFlags.append("StringFormatNoFontFallback ");
 
-            sFlags.append("StringFormatNoFontFallback");
-        }
         if (flag & StringFormatMeasureTrailingSpaces)
-        {
-            if (!sFlags.isEmpty())
-                sFlags.append(", ");
+            sFlags.append("StringFormatMeasureTrailingSpaces ");
 
-            sFlags.append("StringFormatMeasureTrailingSpaces");
-        }
         if (flag & StringFormatNoWrap)
-        {
-            if (!sFlags.isEmpty())
-                sFlags.append(", ");
+            sFlags.append("StringFormatNoWrap ");
 
-            sFlags.append("StringFormatNoWrap");
-        }
         if (flag & StringFormatLineLimit)
-        {
-            if (!sFlags.isEmpty())
-                sFlags.append(", ");
+            sFlags.append("StringFormatLineLimit ");
 
-            sFlags.append("StringFormatLineLimit");
-        }
         if (flag & StringFormatNoClip)
-        {
-            if (!sFlags.isEmpty())
-                sFlags.append(", ");
+            sFlags.append("StringFormatNoClip ");
 
-            sFlags.append("StringFormatNoClip");
-        }
         if (flag & StringFormatBypassGDI)
-        {
-            if (!sFlags.isEmpty())
-                sFlags.append(", ");
-
-            sFlags.append("StringFormatBypassGDI");
-        }
+            sFlags.append("StringFormatBypassGDI ");
 
+        // There will be 1 extra space in the end. It could be truncated, but
+        // as it is for SAL_INFO() only, it would not be important
         return sFlags.makeStringAndClear();
     }
 


More information about the Libreoffice-commits mailing list