summaryrefslogtreecommitdiff
path: root/sw/source/uibase/wrtsh/select.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-01-03 11:40:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-01-24 20:41:26 +0000
commitd41349d8456361f8507f579d5bab388f56530b33 (patch)
treeb91b9426c54f3fca2eb6711c546afdb885c3f9b8 /sw/source/uibase/wrtsh/select.cxx
parent2e44619d919b60fabf0fc528d6e0ac5c997069c0 (diff)
fdo#72486 SwWrtShell::SelAll: if in table, then call extended select all ...
... only in case the whole table is already selected Change-Id: If7626954460e16945af6b21402a84e90c71ae138 (cherry picked from commit fa39e7970496537258eaad1f5351db2d675225b6) Reviewed-on: https://gerrit.libreoffice.org/14157 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/wrtsh/select.cxx')
-rw-r--r--sw/source/uibase/wrtsh/select.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index 8e058602f1bd..bab2cd6dcb6d 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -132,7 +132,12 @@ long SwWrtShell::SelAll()
boost::scoped_ptr<SwPosition> pStartPos;
boost::scoped_ptr<SwPosition> pEndPos;
SwShellCrsr* pTmpCrsr = 0;
- if( !HasWholeTabSelection() )
+
+ // Query these early, before we move the cursor.
+ bool bHasWholeTabSelection = HasWholeTabSelection();
+ bool bIsCursorInTable = IsCrsrInTbl();
+
+ if (!bHasWholeTabSelection)
{
if ( IsSelection() && IsCrsrPtAtEnd() )
SwapPam();
@@ -157,8 +162,16 @@ long SwWrtShell::SelAll()
SttSelect();
GoEnd(true, &bMoveTable);
- bool bStartsWithTable = StartsWithTable();
- if (bStartsWithTable)
+ bool bNeedsExtendedSelectAll = StartsWithTable();
+
+ // If the cursor was in a table, then we only need the extended select
+ // all if the whole table is already selected, to still allow selecting
+ // only a single cell or a single table before selecting the whole
+ // document.
+ if (bNeedsExtendedSelectAll && bIsCursorInTable)
+ bNeedsExtendedSelectAll = bHasWholeTabSelection;
+
+ if (bNeedsExtendedSelectAll)
{
// Disable table cursor to make sure getShellCrsr() returns m_pCurCrsr, not m_pTblCrsr.
if (IsTableMode())
@@ -185,7 +198,7 @@ long SwWrtShell::SelAll()
// In this both cases we select to the end of document
if( ( *pTmpCrsr->GetPoint() < *pEndPos ||
( *pStartPos == *pTmpCrsr->GetMark() &&
- *pEndPos == *pTmpCrsr->GetPoint() ) ) && !bStartsWithTable)
+ *pEndPos == *pTmpCrsr->GetPoint() ) ) && !bNeedsExtendedSelectAll)
SwCrsrShell::SttEndDoc(false);
}
}