diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-06 21:29:54 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-06 21:39:54 +0100 |
commit | 4056b70e6339102374898fff26f099da455475b1 (patch) | |
tree | 9d9dda8392d63e5f52773da1ff283678e81033fe /sw | |
parent | 4322cdab98bcd4a51c121278944c90a497292b62 (diff) |
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.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/unowriter/unowriter.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 3 |
2 files changed, 26 insertions, 1 deletions
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 3d3301130388..14fbbe2d306a 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> @@ -840,6 +842,28 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTransparentText) CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int16>(xParagraph, "CharTransparence")); } +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 a8615e109a03..73b64b806968 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3659,7 +3659,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 ); |