sw/qa/extras/unowriter/unowriter.cxx | 24 ++++++++++++++++++++++++ sw/source/core/unocore/unotbl.cxx | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-)
New commits: commit b63257344e3808b3aec9196250929ee3384b2b4b Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Jan 6 21:29:54 2020 +0300 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Mon Jan 20 14:03:17 2020 +0100 tdf#129839: pass initialized shared_ptr to SwDoc::GetBoxAttr Regression after commit 1e2682235cded9a7cd90e55f0bfc60a1285e9a46 Change-Id: I40acc9e0ffdd292283381366a31eb6647b80324f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86291 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 4056b70e6339102374898fff26f099da455475b1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86329 Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit ed7dc32834e11c93eaf21de8424d9d46c7fa0d53) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86964 diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index b618dd04c24b..7a7e79b0740e 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -9,8 +9,10 @@ #include <swmodeltestbase.hxx> #include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/table/XCellRange.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/AutoTextContainer.hpp> +#include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/XAutoTextGroup.hpp> #include <com/sun/star/text/XTextPortionAppend.hpp> #include <com/sun/star/text/XTextContentAppend.hpp> @@ -624,6 +626,28 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testPasteListener) CPPUNIT_ASSERT(pListener->GetString().isEmpty()); } +CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129839) +{ + // Create a new document and add a table + loadURL("private:factory/swriter", nullptr); + css::uno::Reference<css::text::XTextDocument> xTextDocument(mxComponent, + css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::lang::XMultiServiceFactory> xFac(xTextDocument, + css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::text::XTextTable> xTable( + xFac->createInstance("com.sun.star.text.TextTable"), css::uno::UNO_QUERY_THROW); + xTable->initialize(4, 4); + auto xSimpleText = xTextDocument->getText(); + xSimpleText->insertTextContent(xSimpleText->createTextCursor(), xTable, true); + css::uno::Reference<css::table::XCellRange> xTableCellRange(xTable, css::uno::UNO_QUERY_THROW); + // Get instance of SwXCellRange + css::uno::Reference<css::beans::XPropertySet> xCellRange( + xTableCellRange->getCellRangeByPosition(0, 0, 1, 1), css::uno::UNO_QUERY_THROW); + // Test retrieval of VertOrient property - this crashed + css::uno::Any aOrient = xCellRange->getPropertyValue("VertOrient"); + CPPUNIT_ASSERT_EQUAL(css::uno::Any(css::text::VertOrientation::NONE), aOrient); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 3fdb6fa6d6ad..c3e361df39c9 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3569,7 +3569,8 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName) break; case RES_VERT_ORIENT: { - std::shared_ptr<SfxPoolItem> aVertOrient; + std::shared_ptr<SfxPoolItem> aVertOrient( + std::make_shared<SwFormatVertOrient>(RES_VERT_ORIENT)); if (SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aVertOrient)) { aVertOrient->QueryValue( aRet, pEntry->nMemberId ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits