summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/crsrsh.hxx4
-rw-r--r--sw/qa/extras/odfimport/data/fdo69862.odtbin0 -> 9743 bytes
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx19
-rw-r--r--sw/source/core/crsr/crsrsh.cxx12
-rw-r--r--sw/source/core/edit/eddel.cxx2
-rw-r--r--sw/source/core/edit/edglss.cxx2
-rw-r--r--sw/source/ui/wrtsh/select.cxx2
7 files changed, 30 insertions, 11 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index f8dfdd221f26..f078357df33d 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -323,9 +323,9 @@ public:
// SelAll() selects the document body content
// if ExtendedSelect() is called afterwards, the whole nodes array is selected
// only for usage in special cases allowed!
- void ExtendedSelectAll();
+ void ExtendedSelectAll(bool bFootnotes = true);
/// If ExtendedSelectAll() was called and selection didn't change since then.
- bool ExtendedSelectedAll();
+ bool ExtendedSelectedAll(bool bFootnotes = true);
/// If document body starts with a table.
bool StartsWithTable();
diff --git a/sw/qa/extras/odfimport/data/fdo69862.odt b/sw/qa/extras/odfimport/data/fdo69862.odt
new file mode 100644
index 000000000000..aec48fd13913
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/fdo69862.odt
Binary files differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 456eb503ac54..6a1240e6a3f8 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -48,6 +48,7 @@ public:
void testFdo56272();
void testFdo37606();
void testFdo37606Copy();
+ void testFdo69862();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -68,6 +69,7 @@ void Test::run()
{"fdo56272.odt", &Test::testFdo56272},
{"fdo37606.odt", &Test::testFdo37606},
{"fdo37606.odt", &Test::testFdo37606Copy},
+ {"fdo69862.odt", &Test::testFdo69862},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
@@ -355,6 +357,23 @@ void Test::testFdo37606Copy()
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
}
+void Test::testFdo69862()
+{
+ // The test doc is special in that it starts with a table and it also has a footnote.
+ 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 "Footnote.", as Ctrl-A also selected footnotes, but it should not.
+ CPPUNIT_ASSERT_EQUAL(String("A1"), rStart.GetTxt());
+
+ SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode());
+ CPPUNIT_ASSERT_EQUAL(String("H" "\x01" "ello."), rEnd.GetTxt());
+
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 75dec387d2c0..357e9c947765 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -239,7 +239,7 @@ void SwCrsrShell::StartAction()
void SwCrsrShell::EndAction( const sal_Bool bIdleEnd )
{
sal_Bool bVis = bSVCrsrVis;
- comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll());
+ comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false));
// Idle-formatting?
if( bIdleEnd && Imp()->GetRegion() )
@@ -535,11 +535,11 @@ sal_Bool SwCrsrShell::SttEndDoc( sal_Bool bStt )
return bRet;
}
-void SwCrsrShell::ExtendedSelectAll()
+void SwCrsrShell::ExtendedSelectAll(bool bFootnotes)
{
SwNodes& rNodes = GetDoc()->GetNodes();
SwPosition* pPos = pCurCrsr->GetPoint();
- pPos->nNode = rNodes.GetEndOfPostIts();
+ pPos->nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfInserts();
pPos->nContent.Assign( rNodes.GoNext( &pPos->nNode ), 0 );
pPos = pCurCrsr->GetMark();
pPos->nNode = rNodes.GetEndOfContent();
@@ -547,10 +547,10 @@ void SwCrsrShell::ExtendedSelectAll()
pPos->nContent.Assign( pCNd, pCNd ? pCNd->Len() : 0 );
}
-bool SwCrsrShell::ExtendedSelectedAll()
+bool SwCrsrShell::ExtendedSelectedAll(bool bFootnotes)
{
SwNodes& rNodes = GetDoc()->GetNodes();
- SwNodeIndex nNode = rNodes.GetEndOfPostIts();
+ SwNodeIndex nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfInserts();
SwCntntNode* pStart = rNodes.GoNext(&nNode);
nNode = rNodes.GetEndOfContent();
@@ -1158,7 +1158,7 @@ sal_Bool SwCrsrShell::GoPrevCrsr()
void SwCrsrShell::Paint( const Rectangle &rRect)
{
- comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll());
+ comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false));
SET_CURR_SHELL( this );
// always switch off all cursors when painting
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 1f98618f3507..064fe3df5f8b 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -39,7 +39,7 @@
void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo )
{
- bool bSelectAll = StartsWithTable() && ExtendedSelectedAll();
+ bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false);
// nur bei Selektion
if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark())
return;
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 8828b97e6249..8199db4729af 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -226,7 +226,7 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
bool bColSel = _GetCrsr()->IsColumnSelection();
if( bColSel && pInsDoc->IsClipBoard() )
pInsDoc->SetColumnSelection( true );
- bool bSelectAll = StartsWithTable() && ExtendedSelectedAll();
+ bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false);
{
FOREACHPAM_START(this)
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index c57c13c9e952..3923fe3d0395 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -162,7 +162,7 @@ long SwWrtShell::SelAll()
bool bStartsWithTable = StartsWithTable();
if (bStartsWithTable)
- ExtendedSelectAll();
+ ExtendedSelectAll(/*bFootnotes =*/ false);
if( pStartPos )
{