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

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed Dec 21 17:20:43 PST 2011


 writerfilter/source/dmapper/GraphicImport.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 1c84402c87142f1f473c08dbac926a683f86f067
Author: Miklos Vajna <vmiklos at frugalware.org>
Date:   Thu Dec 22 02:19:00 2011 +0100

    fdo#40937 fix RTF import of images with invalid crop data
    
    Add a try-catch, so in case setting crop data fails, the size data will
    be still set.
    
    (cherry picked from commit 3c86591749aae36f997944d9c972d1c71b21bc7b)

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 744361d..2bb6693 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1475,8 +1475,17 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
                     lcl_CalcCrop( m_pImpl->nRightCrop, aGraphicSize.Width );
 
 
-                    xGraphicProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_GRAPHIC_CROP ),
-                        uno::makeAny(text::GraphicCrop(m_pImpl->nTopCrop, m_pImpl->nBottomCrop, m_pImpl->nLeftCrop, m_pImpl->nRightCrop)));
+                    // We need a separate try-catch here, otherwise a bad crop setting will also nuke the size settings as well.
+                    try
+                    {
+                        xGraphicProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_GRAPHIC_CROP ),
+                                uno::makeAny(text::GraphicCrop(m_pImpl->nTopCrop, m_pImpl->nBottomCrop, m_pImpl->nLeftCrop, m_pImpl->nRightCrop)));
+                    }
+                    catch (const uno::Exception& e)
+                    {
+                        clog << __FILE__ << ":" << __LINE__ << " failed. Message :";
+                        clog << rtl::OUStringToOString (e.Message, RTL_TEXTENCODING_UTF8).getStr() << endl;
+                    }
                 }
 
             }


More information about the Libreoffice-commits mailing list