summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx17
-rw-r--r--sw/source/core/unocore/unotext.cxx9
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 );