diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-05-08 16:42:55 +0300 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2017-11-08 14:13:21 +0100 |
commit | 9352932ec8f0582cc91f9d3b016555244d4c980d (patch) | |
tree | 0037c6b2667aa48778fa5887dc06caa6897c659c /writerfilter/source | |
parent | PPTX export: correct position of rotated groups (diff) | |
download | core-9352932ec8f0582cc91f9d3b016555244d4c980d.tar.gz core-9352932ec8f0582cc91f9d3b016555244d4c980d.zip |
tdf#105688: findZOrder: catch exceptions from getPropertyValue
For some reason, sometimes items in GraphicZOrderHelper don't
have ZOrder property value, and so throw in getPropertyValue.
E.g., SwXFrame::getPropertyValue throws uno::RuntimeException
when its GetFrameFormat() returns nullptr.
The patch catches these to allow to proceed with fallback z-order.
Change-Id: I96140195f45364bccee7c5547d373158e2b49154
Reviewed-on: https://gerrit.libreoffice.org/37392
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit f66b76a4d20719e4c13bd755c49f8140a0e72816)
Reviewed-on: https://gerrit.libreoffice.org/44463
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'writerfilter/source')
-rw-r--r-- | writerfilter/source/dmapper/GraphicHelpers.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx index 8c4dd9c5aed8..6674af5132f4 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -273,20 +273,23 @@ sal_Int32 GraphicZOrderHelper::findZOrder( sal_Int32 relativeHeight, bool bOldSt else ++it; } + sal_Int32 itemZOrderOffset(0); // before the item if( it == items.end()) // we're topmost { if( items.empty()) return 0; - sal_Int32 itemZOrder(0); --it; - if( it->second->getPropertyValue(getPropertyName( PROP_Z_ORDER )) >>= itemZOrder ) - return itemZOrder + 1; // after the topmost + itemZOrderOffset = 1; // after the topmost } - else - { + // SwXFrame::getPropertyValue throws uno::RuntimeException + // when its GetFrameFormat() returns nullptr + try { sal_Int32 itemZOrder(0); if( it->second->getPropertyValue(getPropertyName( PROP_Z_ORDER )) >>= itemZOrder ) - return itemZOrder; // before the item + return itemZOrder + itemZOrderOffset; + } + catch (const uno::RuntimeException&) { + SAL_WARN("writerfilter", "Exception when getting item z-order"); } SAL_WARN( "writerfilter", "findZOrder() didn't find item z-order" ); return 0; // this should not(?) happen |