[Libreoffice-commits] core.git: 2 commits - filter/source svx/source

Caolán McNamara caolanm at redhat.com
Tue Jul 1 05:50:36 PDT 2014


 filter/source/msfilter/msdffimp.cxx         |   37 ++++++++++++++++----
 svx/source/dialog/compressgraphicdialog.cxx |   20 +++++------
 svx/source/dialog/compressgraphicdialog.hrc |   10 +++++
 svx/source/dialog/compressgraphicdialog.src |   50 ++++++++++++++++++++++++++++
 4 files changed, 99 insertions(+), 18 deletions(-)

New commits:
commit 33e9d408aa2c0a9b86c5daaed0e15d86f6c599dc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 1 13:48:59 2014 +0100

    Related: fdo#80713 make 'Gif image', etc. translatable
    
    Change-Id: I47d15623bd12b4b63a8d3701aaf1bebbba5ca7c5

diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index 987a20c9..7b22043 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -116,34 +116,34 @@ void CompressGraphicsDialog::Update()
     switch(aLinkType)
     {
         case GFX_LINK_TYPE_NATIVE_GIF:
-            aGraphicTypeString = "Gif image";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_GIF);
             break;
         case GFX_LINK_TYPE_NATIVE_JPG:
-            aGraphicTypeString = "Jpeg image";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_JPEG);
             break;
         case GFX_LINK_TYPE_NATIVE_PNG:
-            aGraphicTypeString = "PNG image";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_PNG);
             break;
         case GFX_LINK_TYPE_NATIVE_TIF:
-            aGraphicTypeString = "TIFF image";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_TIFF);
             break;
         case GFX_LINK_TYPE_NATIVE_WMF:
-            aGraphicTypeString = "WMF image";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_WMF);
             break;
         case GFX_LINK_TYPE_NATIVE_MET:
-            aGraphicTypeString = "MET image";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_MET);
             break;
         case GFX_LINK_TYPE_NATIVE_PCT:
-            aGraphicTypeString = "PCT image";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_PCT);
             break;
         case GFX_LINK_TYPE_NATIVE_SVG:
-            aGraphicTypeString = "SVG image";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_SVG);
             break;
         case GFX_LINK_TYPE_NATIVE_BMP:
-            aGraphicTypeString = "BMP image";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_BMP);
             break;
         default:
-            aGraphicTypeString = "Unknown";
+            aGraphicTypeString = SVX_RESSTR(STR_IMAGE_UNKNOWN);
             break;
     }
     m_pLabelGraphicType->SetText(aGraphicTypeString);
diff --git a/svx/source/dialog/compressgraphicdialog.hrc b/svx/source/dialog/compressgraphicdialog.hrc
index 3c608ff..2dd73ca 100644
--- a/svx/source/dialog/compressgraphicdialog.hrc
+++ b/svx/source/dialog/compressgraphicdialog.hrc
@@ -20,5 +20,15 @@
 #define STR_IMAGE_ORIGINAL_SIZE 256
 #define STR_IMAGE_VIEW_SIZE 257
 #define STR_IMAGE_CAPACITY 258
+#define STR_IMAGE_GIF 259
+#define STR_IMAGE_JPEG 260
+#define STR_IMAGE_PNG 261
+#define STR_IMAGE_TIFF 262
+#define STR_IMAGE_WMF 263
+#define STR_IMAGE_MET 264
+#define STR_IMAGE_PCT 265
+#define STR_IMAGE_SVG 266
+#define STR_IMAGE_BMP 267
+#define STR_IMAGE_UNKNOWN 268
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/compressgraphicdialog.src b/svx/source/dialog/compressgraphicdialog.src
index bca7b2c..b2377c8 100644
--- a/svx/source/dialog/compressgraphicdialog.src
+++ b/svx/source/dialog/compressgraphicdialog.src
@@ -34,4 +34,54 @@ String STR_IMAGE_CAPACITY
     Text [ en-US ] = "$(CAPACITY) kiB" ;
 };
 
+String STR_IMAGE_GIF
+{
+    Text [ en-US ] = "Gif image";
+};
+
+String STR_IMAGE_JPEG
+{
+    Text [ en-US ] = "Jpeg image";
+};
+
+String STR_IMAGE_PNG
+{
+    Text [ en-US ] = "PNG image";
+};
+
+String STR_IMAGE_TIFF
+{
+    Text [ en-US ] = "TIFF image";
+};
+
+String STR_IMAGE_WMF
+{
+    Text [ en-US ] = "WMF image";
+};
+
+String STR_IMAGE_MET
+{
+    Text [ en-US ] = "MET image";
+};
+
+String STR_IMAGE_PCT
+{
+    Text [ en-US ] = "PCT image";
+};
+
+String STR_IMAGE_SVG
+{
+    Text [ en-US ] = "SVG image";
+};
+
+String STR_IMAGE_BMP
+{
+    Text [ en-US ] = "BMP image";
+};
+
+String STR_IMAGE_UNKNOWN
+{
+    Text [ en-US ] = "Unknown";
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3ea17073114cae99d7c323f051a4a2ba074f043c
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Jul 1 11:55:03 2014 +0000

    Resolves: #i125187# more precision where the BLIP graphic is located
    
    (cherry picked from commit 2be700effa5568859a0c6ba5f596e35ffc600320)
    
    Conflicts:
    	filter/source/msfilter/msdffimp.cxx
    
    Change-Id: I3926d5f47469049662a292063f9810826c575154

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index e397e3b..350d4d5 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5821,25 +5821,46 @@ void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, sal_uLong nLe
             nLenFBSE = nLength;
             // is FBSE big enough for our data
             bool bOk = ( nSkipBLIPLen + 4 + nSkipBLIPPos + 4 <= nLenFBSE );
+            bool bBLIPIsDirectlyEmbedded(false);
 
-            if( bOk )
+            if(bOk)
             {
-                rSt.SeekRel( nSkipBLIPLen );
+                rSt.SeekRel(nSkipBLIPLen);
                 rSt.ReadUInt32( nBLIPLen );
-                rSt.SeekRel( nSkipBLIPPos );
+
+                // #i125187# do not simply skip these four bytes, but read them. This value
+                // is zero when the BLIP is embedded to the FBSE directly following in the
+                // stream, else 1. Use this as hint to be more reliable (see below)
+                rSt.ReadUInt32( nBLIPPos );
+
+                if (0 == nBLIPPos)
+                {
+                    bBLIPIsDirectlyEmbedded = true;
+                }
+
                 rSt.ReadUInt32( nBLIPPos );
                 bOk = rSt.GetError() == 0;
 
-                nLength -= nSkipBLIPLen+ 4 + nSkipBLIPPos + 4;
+                nLength -= nSkipBLIPLen + 4 + nSkipBLIPPos + 4;
             }
 
             if( bOk )
             {
-                // specialty:
-                // If nBLIPLen is less than nLenFBSE AND nBLIPPos is NULL,
-                // then we assume, that the image is in FBSE!
-                if( (!nBLIPPos) && (nBLIPLen < nLenFBSE) )
+                // #i125187# the original check to test if the BLIP is following embeded in the FBSE was
+                // was (!nBLIPPos && nBLIPLen < nLenFBSE), but there are ppt documents
+                // where this is not sufficient (what means that for BLIPs in the picture
+                // stream the same conditions can be true sometimes). I experimented with various
+                // ppt files and detected that the four bytes before reading the nBLIPPos
+                // contain a flag which describes that embedding more reliable, thus I will
+                // use it here now in the form of the bBLIPIsDirectlyEmbedded variable (see above).
+                // This modification works with all ppt files I found which use directly embedded
+                // BLIPs and with the file which showed the error. More work may be needed when
+                // exceptions to this more strict schema may show up, though.
+                if (0 == nBLIPPos && nBLIPLen < nLenFBSE && bBLIPIsDirectlyEmbedded)
+                {
+                    // get BLIP file position as directly following embedded
                     nBLIPPos = rSt.Tell() + 4;
+                }
 
                 // That worked great!
                 // We store, that we do have one FBSE more in the pointer array.


More information about the Libreoffice-commits mailing list