diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-02-20 11:04:16 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-02-25 08:52:17 +0000 |
commit | fd155af5369e3ec782c768f54781658d210e375c (patch) | |
tree | f8f018093c046b224d8f97da8f53de9fc247f946 /sw | |
parent | f0cc8071aa5e9c058f6bf1a1144d84c5252987a7 (diff) |
n#779642: Fixed floating tables import in writerfilter
(cherry picked from commit d0cde9640b52ccfbb28ed1f65bba0927afd7b69b)
Change-Id: Id60a08811f238db505d51b0e1381427a8f5df9cf
Reviewed-on: https://gerrit.libreoffice.org/2307
Reviewed-by: Miklos Vajna <vmiklos@suse.cz>
Tested-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 17 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 9 |
2 files changed, 24 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index bb5e4e7667e7..69dc0cbfc779 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1066,8 +1066,23 @@ void Test::testFineTableDash() void Test::testN779642() { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + + // First problem: check that we have 2 tables, nesting caused the + // creation of outer one to fail uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong number of imported tables", sal_Int32(2), xTables->getCount()); + + // Second problem: check that the outer table is in a frame, at the bottom of the page + uno::Reference<text::XTextTable> xTextTable(xTextTablesSupplier->getTextTables()->getByName("Table2"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xAnchor(xTextTable->getAnchor(), uno::UNO_QUERY); + uno::Any aFrame = xAnchor->getPropertyValue("TextFrame"); + uno::Reference<beans::XPropertySet> xFrame; + aFrame >>= xFrame; + sal_Int16 nValue; + xFrame->getPropertyValue("VertOrient") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation", nValue, text::VertOrientation::BOTTOM); + xFrame->getPropertyValue("VertOrientRelation") >>= nValue; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical orientation relation", nValue, text::RelOrientation::PAGE_PRINT_AREA); } CPPUNIT_TEST_SUITE_REGISTRATION(Test); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index ebc9de006817..004e7af2c87e 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1623,7 +1623,14 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) // remove the addtional paragraphs in the end if (pStartStartNode->GetStartNodeType() == SwTableBoxStartNode) { - SwTableNode *const pStartTableNode(pStartStartNode->FindTableNode()); + SwTableNode * pStartTableNode(pStartStartNode->FindTableNode()); + // Is it the same table start node than the end? + SwTableNode *const pEndStartTableNode(pEndStartNode->FindTableNode()); + while (pEndStartTableNode->GetIndex() < pStartTableNode->GetIndex()) + { + SwStartNode* pStartStartTableNode = pStartTableNode->StartOfSectionNode(); + pStartTableNode = pStartStartTableNode->FindTableNode(); + } const SwNodeIndex aTblIdx( *pStartTableNode, -1 ); SwPosition aBefore(aTblIdx); bParaBeforeInserted = GetDoc()->AppendTxtNode( aBefore ); |