sw/qa/extras/unowriter/unowriter.cxx | 23 +++++++++++++++++++++++ sw/source/core/unocore/unotbl.cxx | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-)
New commits: commit a031dc687bb35aa42835e0b4aa046250795d8fc0 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Jan 6 21:29:54 2020 +0300 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Sat Jan 18 20:29:56 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/+/86965 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> Reviewed-by: Miklos Vajna <vmik...@collabora.com> Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index faaac078bff6..788acffbef7e 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -12,6 +12,7 @@ #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> @@ -821,6 +822,28 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTextConvertToTableLineSpacing) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(convertTwipToMm100(220)), aLineSpacing.Height); } +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 1ad6dc454657..fa378c7e8ae1 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3572,7 +3572,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