[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - xmloff/source

Michael Stahl mstahl at redhat.com
Mon Dec 5 09:14:10 UTC 2016


 xmloff/source/draw/shapeexport.cxx |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit e1dcbd0f7f6bacafcbdb6e74d29af2151120bc6f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Nov 25 22:46:34 2016 +0100

    tdf#102479 ODF export: ignore exceptions when checking shape text
    
    The bugdoc contains a SwXShape-SwXTextFrame aggregate which contains
    only a table, no top-level paragraph.  Because of that,
    SwXTextFrame::createTextCursor() throws a RuntimeException.
    
    Assuming that the exception itself is intentional, work around it
    in XMLShapeExport::collectShapeAutoStyles() and assume that the
    getString() check that was added there in commit
    73fcb052edf1a21d785583bc53e8b4323b577bb1 is just a performance
    optimization; the actual export of auto styles and content uses
    XEnumerationAccess anyway.
    
    Change-Id: I7c23164b1e692ce16e5b4e03dd945e46768677de
    Reviewed-on: https://gerrit.libreoffice.org/31218
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit 7661bbbaef31adfdb298b1447301b24a70f85834)
    Reviewed-on: https://gerrit.libreoffice.org/31378
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index ed70149..04fb177 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -302,7 +302,22 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap
     if( xPropSet.is() && bObjSupportsText )
     {
         uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
-        if(xText.is() && !xText->getString().isEmpty())
+        bool bSkip = false;
+        if (xText.is())
+        {
+            try
+            {
+                bSkip = xText->getString().isEmpty();
+            }
+            catch (uno::RuntimeException const&)
+            {
+                // tdf#102479: SwXTextFrame that contains only a table will
+                // throw, but the table must be iterated so that
+                // SwXMLExport::ExportTableLines() can find its auto styles
+                // so do not skip it!
+            }
+        }
+        if (!bSkip)
         {
             uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
 


More information about the Libreoffice-commits mailing list