[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 19 02:20:43 PDT 2012


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 9a2f97b9539f8101745467758fe03d5e76c0346f
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Oct 11 16:48:55 2012 +0200

    fdo#55493 fix RTF import of specific PNG image
    
    The image was special in that the resulting Graphic's
    GetPrefMapMode().GetMapUnit() wasn't MAP_PIXEL.
    
    (cherry picked from commit 5ef0f1dc9a70c20fe6879832b782a0c34724353f)
    
    Conflicts:
    	writerfilter/source/rtftok/rtfdocumentimpl.cxx
    
    Change-Id: I681e344a042721b99f6cb2e599f9c65156d219a4
    Reviewed-on: https://gerrit.libreoffice.org/860
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 45e1920..bf981d9 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -646,12 +646,18 @@ int RTFDocumentImpl::resolvePict(bool bInline)
         // provided by picw and pich.
         OString aURLBS(OUStringToOString(aGraphicUrl, RTL_TEXTENCODING_UTF8));
         const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
-        Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
-        Size aSize(aGraphic.GetPrefSize());
-        MapMode aMap(MAP_100TH_MM);
-        aSize = Application::GetDefaultDevice()->PixelToLogic( aSize, aMap );
-        m_aStates.top().aPicture.nWidth = aSize.Width();
-        m_aStates.top().aPicture.nHeight = aSize.Height();
+        if (aURLBS.compareTo(aURLBegin, RTL_CONSTASCII_LENGTH(aURLBegin)) == 0)
+        {
+            Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
+            Size aSize(aGraphic.GetPrefSize());
+            MapMode aMap(MAP_100TH_MM);
+            if (aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL)
+                aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMap);
+            else
+                aSize = OutputDevice::LogicToLogic(aSize, aGraphic.GetPrefMapMode(), aMap);
+            m_aStates.top().aPicture.nWidth = aSize.Width();
+            m_aStates.top().aPicture.nHeight = aSize.Height();
+        }
     }
 
     // Wrap it in an XShape.


More information about the Libreoffice-commits mailing list