summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-09-21 11:11:47 +0300
committerMichael Stahl <michael.stahl@allotropia.de>2022-09-23 12:35:21 +0200
commit941949ff88bf01db41ce9793a3d306c96ff88ab5 (patch)
tree7c21f30a32e74d697a47a74812cb8c709b0f1c65
parentRemove extra space (diff)
downloadcore-941949ff88bf01db41ce9793a3d306c96ff88ab5.tar.gz
core-941949ff88bf01db41ce9793a3d306c96ff88ab5.zip
tdf#151100: xText->getString() may be empty for content needing export
The check that is removed prevents collecting the table data. Assume that it's the performance optimization, and that processing empty text objects would be fast anyway. This basically reverts commit 73fcb052edf1a21d785583bc53e8b4323b577bb1 Author Christian Lippka <cl@openoffice.org> Date Thu Nov 22 12:26:35 2001 +0000 #90330# only export text autostyles for shapes with text and commit 7661bbbaef31adfdb298b1447301b24a70f85834 Author Michael Stahl <mstahl@redhat.com> Date Fri Nov 25 22:46:34 2016 +0100 tdf#102479 ODF export: ignore exceptions when checking shape text that becomes unnecessary after the former change is reverted. Change-Id: I709a7b4c5ac1cc0621d3a1b18f2eb74feb987efb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140313 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140352 Tested-by: Jenkins (cherry picked from commit 226b1c2006e936e4b32748b810624c5d655c4a98) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140379 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/qa/extras/odfexport/data/tdf151100.docxbin0 -> 17741 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport2.cxx14
-rw-r--r--xmloff/source/draw/shapeexport.cxx15
3 files changed, 14 insertions, 15 deletions
diff --git a/sw/qa/extras/odfexport/data/tdf151100.docx b/sw/qa/extras/odfexport/data/tdf151100.docx
new file mode 100644
index 000000000000..e0341bdb9c8c
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/tdf151100.docx
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index 2ced17e903de..c6f5d025edea 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -28,6 +28,20 @@ public:
};
+CPPUNIT_TEST_FIXTURE(Test, tdf151100)
+{
+ // Similar to tdf135942
+
+ loadAndReload("tdf151100.docx");
+ // All table autostyles should be collected, including nested, and must not crash.
+
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+ xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
+
+ assertXPath(pXmlDoc, "/office:document-styles/office:automatic-styles/style:style[@style:family='table']", 1);
+}
+
DECLARE_ODFEXPORT_TEST(testTdf52065_centerTabs, "testTdf52065_centerTabs.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getPages());
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 727489f5b7a5..b804b6800efa 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -306,23 +306,8 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap
if( xPropSet.is() && bObjSupportsText )
{
uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
- 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() );
if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("IsEmptyPresentationObject") )