[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Oct 2 02:40:50 PDT 2013
sw/qa/extras/odfimport/data/fdo69979.odt |binary
sw/qa/extras/odfimport/odfimport.cxx | 17 +++++++++++++++++
sw/source/core/crsr/crsrsh.cxx | 4 ++--
3 files changed, 19 insertions(+), 2 deletions(-)
New commits:
commit 232df42b8dc0b4f7a335d2931fc0f29e73b8bca0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Oct 2 11:19:18 2013 +0200
fdo#69979 SwCrsrShell::ExtendedSelectAll: exclude headers, too
It turns out, normal Ctrl-A doesn't select headers, footers and fly
content, either (just like not selecting footnotes). So do the same when
in the "doc starts with table" special mode.
Change-Id: Ib9bc397944a4d07ea03bc326f1536733c57f42e6
diff --git a/sw/qa/extras/odfimport/data/fdo69979.odt b/sw/qa/extras/odfimport/data/fdo69979.odt
new file mode 100644
index 0000000..8f7d77e
Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo69979.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index f541d22..ef6d7a1 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -37,6 +37,7 @@ public:
void testFdo37606();
void testFdo37606Copy();
void testFdo69862();
+ void testFdo69979();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -64,6 +65,7 @@ void Test::run()
{"fdo37606.odt", &Test::testFdo37606},
{"fdo37606.odt", &Test::testFdo37606Copy},
{"fdo69862.odt", &Test::testFdo69862},
+ {"fdo69979.odt", &Test::testFdo69979},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -442,7 +444,22 @@ void Test::testFdo69862()
SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode());
CPPUNIT_ASSERT_EQUAL(OUString("H" "\x01" "ello."), rEnd.GetTxt());
+}
+
+void Test::testFdo69979()
+{
+ // The test doc is special in that it starts with a table and it also has a header.
+ SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+ SwWrtShell* pWrtShell = pTxtDoc->GetDocShell()->GetWrtShell();
+ SwShellCrsr* pShellCrsr = pWrtShell->getShellCrsr(false);
+ pWrtShell->SelAll();
+ SwTxtNode& rStart = dynamic_cast<SwTxtNode&>(pShellCrsr->Start()->nNode.GetNode());
+ // This was "", as Ctrl-A also selected headers, but it should not.
+ CPPUNIT_ASSERT_EQUAL(OUString("A1"), rStart.GetTxt());
+
+ SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode());
+ CPPUNIT_ASSERT_EQUAL(OUString("Hello."), rEnd.GetTxt());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 106e150..128684e 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -524,7 +524,7 @@ void SwCrsrShell::ExtendedSelectAll(bool bFootnotes)
{
SwNodes& rNodes = GetDoc()->GetNodes();
SwPosition* pPos = m_pCurCrsr->GetPoint();
- pPos->nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfInserts();
+ pPos->nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfAutotext();
pPos->nContent.Assign( rNodes.GoNext( &pPos->nNode ), 0 );
pPos = m_pCurCrsr->GetMark();
pPos->nNode = rNodes.GetEndOfContent();
@@ -535,7 +535,7 @@ void SwCrsrShell::ExtendedSelectAll(bool bFootnotes)
bool SwCrsrShell::ExtendedSelectedAll(bool bFootnotes)
{
SwNodes& rNodes = GetDoc()->GetNodes();
- SwNodeIndex nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfInserts();
+ SwNodeIndex nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfAutotext();
SwCntntNode* pStart = rNodes.GoNext(&nNode);
nNode = rNodes.GetEndOfContent();
More information about the Libreoffice-commits
mailing list