diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2011-12-22 02:19:00 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@frugalware.org> | 2011-12-22 02:19:00 +0100 |
commit | 3c86591749aae36f997944d9c972d1c71b21bc7b (patch) | |
tree | 695e84730c2e948d441b71680c981542e1878ad4 /writerfilter | |
parent | acfdec468d54d44f94ca6752bbbfbdab07ef9a0c (diff) |
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.
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 744361dfc494..2bb6693eed56 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; + } } } |