[Libreoffice-commits] .: writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Jun 11 02:05:29 PDT 2012


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

New commits:
commit 993eb829f357e64b3042caf1227828ae00fd125f
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Jun 11 11:03:42 2012 +0200

    RTFDocumentImpl::resolvePict: handle failure from importGraphicObject()
    
    This fixes an assert from the fdo#49659 bugdoc.
    
    Change-Id: I4c4d56aa119dcdb965a0b30ca137d7e7d719259c

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3acbddc..b2a6962 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -635,12 +635,15 @@ 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);
+            aSize = Application::GetDefaultDevice()->PixelToLogic( aSize, 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