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

Chris Sherlock chris.sherlock79 at gmail.com
Sun Oct 1 19:12:07 UTC 2017


 drawinglayer/source/tools/emfphelperdata.cxx |   29 +++++++++++++++++++++++++++
 drawinglayer/source/tools/emfphelperdata.hxx |    2 -
 2 files changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 6996c65015703b6aaa6d44f76c492371f47b138d
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Thu Sep 21 02:05:06 2017 +1000

    tdf#31814 drawinglayer: dump EmfPlusRecordTypeComment records
    
    When we get an EMF+ comment record (which is NOT an EMF comment
    record, EMF has comment records which is how you store EMF+
    records, EMF+ records also have comment records for "private
    data") then if we are a debug build then dump the private data
    to stdout.
    
    To make this work, set:
    
    SAL_LOG=+INFO.cppcanvas.emf+WARN.cppcanvas.emf
    
    Change-Id: I293875f45b692971379a5945ff7feb273bc54c73
    Reviewed-on: https://gerrit.libreoffice.org/42558
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 2962193b9e5f..73422124c2d5 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -46,6 +46,7 @@ namespace emfplushelper
         {
             case EmfPlusRecordTypeHeader: return "EmfPlusRecordTypeHeader";
             case EmfPlusRecordTypeEndOfFile: return "EmfPlusRecordTypeEndOfFile";
+            case EmfPlusRecordTypeComment: return "EmfPlusRecordTypeComment";
             case EmfPlusRecordTypeGetDC: return "EmfPlusRecordTypeGetDC";
             case EmfPlusRecordTypeObject: return "EmfPlusRecordTypeObject";
             case EmfPlusRecordTypeFillRects: return "EmfPlusRecordTypeFillRects";
@@ -809,6 +810,33 @@ namespace emfplushelper
                         SAL_INFO("cppcanvas.emf", "EMF+ EndOfFile");
                         break;
                     }
+                    case EmfPlusRecordTypeComment:
+                    {
+#if OSL_DEBUG_LEVEL > 1
+                        unsigned char data;
+                        OUString hexdata;
+
+                        SAL_INFO("cppcanvas.emf", "EMF+ Comment");
+                        SAL_INFO("cppcanvas.emf", "\tdatasize: 0x" << std::hex << dataSize << std::dec);
+
+                        for (sal_uInt32 i=0; i<dataSize; i++)
+                        {
+                            rMS.ReadUChar(data);
+
+                            if (i % 16 == 0)
+                                hexdata += "\n";
+
+                            OUString padding;
+                            if ((data & 0xF0) == 0)
+                                padding = "0";
+
+                            hexdata += "0x" + padding + OUString::number(data, 16) + " ";
+                        }
+
+                        SAL_INFO("cppcanvas.emf", "\t" << hexdata);
+#endif
+                        break;
+                    }
                     case EmfPlusRecordTypeGetDC:
                     {
                         SAL_INFO("cppcanvas.emf", "EMF+ GetDC");
@@ -1194,6 +1222,7 @@ namespace emfplushelper
                             // read the layout rectangle
                             float lx, ly, lw, lh;
                             rMS.ReadFloat(lx).ReadFloat(ly).ReadFloat(lw).ReadFloat(lh);
+
                             SAL_INFO("cppcanvas.emf", "EMF+ DrawString layoutRect: " << lx << "," << ly << " - " << lw << "x" << lh);
                             // parse the string
                             OUString text = read_uInt16s_ToOUString(rMS, stringLength);
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index c36626139b4d..99ef9964b945 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -37,7 +37,7 @@ namespace emfplushelper
     // EMF+ commands
     #define EmfPlusRecordTypeHeader 0x4001
     #define EmfPlusRecordTypeEndOfFile 0x4002
-    //TODO EmfPlusRecordTypeComment 0x4003
+    #define EmfPlusRecordTypeComment 0x4003
     #define EmfPlusRecordTypeGetDC 0x4004
     //TODO EmfPlusRecordTypeMultiFormatStart 0x4005
     //TODO EmfPlusRecordTypeMultiFormatSection 0x4006


More information about the Libreoffice-commits mailing list