summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/uiwriter/data/select-row.fodt33
-rw-r--r--sw/qa/extras/uiwriter/uiwriter5.cxx27
-rw-r--r--sw/source/core/crsr/trvltbl.cxx4
3 files changed, 62 insertions, 2 deletions
diff --git a/sw/qa/extras/uiwriter/data/select-row.fodt b/sw/qa/extras/uiwriter/data/select-row.fodt
new file mode 100644
index 000000000000..1493a4f54a3a
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/select-row.fodt
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:ooow="http://openoffice.org/2004/writer" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:body>
+ <office:text>
+ <table:table table:name="Table1" table:style-name="Table1">
+ <table:table-column table:style-name="Table1.A"/>
+ <table:table-column table:style-name="Table1.B"/>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="P3">a1</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table1.B1" office:value-type="string">
+ <table:table table:name="Table2" table:style-name="Table2">
+ <table:table-column table:style-name="Table2.A"/>
+ <table:table-column table:style-name="Table2.B"/>
+ <table:table-row>
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:p text:style-name="P3">nested-a1</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table2.B1" office:value-type="string">
+ <text:p text:style-name="P3">nested-b1</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p text:style-name="Table_20_Contents"/>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p/>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 1ea8b51bb80e..0d191cb1f069 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -1853,6 +1853,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletion)
assertXPath(pXmlDoc, "//page[1]//body/tab", 0);
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testSelectRowWithNestedTable)
+{
+ // load a 1-row table, and select the row
+ createSwDoc(DATA_DIRECTORY, "select-row.fodt");
+
+ // check table
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "//page[1]//body/tab");
+ // nested table in the last cell
+ assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell[2]/tab");
+
+ // select table row
+ dispatchCommand(mxComponent, ".uno:EntireRow", {});
+ Scheduler::ProcessEventsToIdle();
+ // convert selected text content to uppercase
+ dispatchCommand(mxComponent, ".uno:ChangeCaseToUpper", {});
+ Scheduler::ProcessEventsToIdle();
+
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+ assertXPathContent(pXmlDoc, "//page[1]//body/tab/row/cell[2]/tab/row/cell[1]/txt", "NESTED-A1");
+ // This was "a1" (bad selection of the table row)
+ assertXPathContent(pXmlDoc, "//page[1]//body/tab/row/cell[1]/txt[1]", "A1");
+ // This was "nested-b1" (bad selection of the table row)
+ assertXPathContent(pXmlDoc, "//page[1]//body/tab/row/cell[2]/tab/row/cell[2]/txt", "NESTED-B1");
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableRowDeletionWithExport)
{
// load a 1-row table, and delete the row with enabled change tracking:
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index e212553c5844..0aaa899b5a46 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -233,8 +233,8 @@ bool SwCursorShell::SelTableRowOrCol( bool bRow, bool bRowSimple )
m_pTableCursor->DeleteMark();
// set start and end of a column
- m_pTableCursor->GetPoint()->Assign( *pEnd->GetSttNd() );
- m_pTableCursor->Move( fnMoveForward, GoInContent );
+ m_pTableCursor->GetPoint()->Assign( *pEnd->GetSttNd()->EndOfSectionNode() );
+ m_pTableCursor->Move( fnMoveBackward, GoInContent );
m_pTableCursor->SetMark();
m_pTableCursor->GetPoint()->Assign( *pStt->GetSttNd()->EndOfSectionNode() );
m_pTableCursor->Move( fnMoveBackward, GoInContent );