summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-05 05:58:45 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-05 16:10:36 +0100
commit41104b6ea86aacd5bc5dc68b1b6daac8f31e4982 (patch)
treee4fdb53bb82060f4ce1d267f5ec95f7fadc0011b /sw
parentcb11bca59019682c0d7eae837e2022bfe02ddc9d (diff)
use unique() for checks for multiselection
Change-Id: I595dea68b67d1a40df7955bee7e6a935b4efdc1c
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/pam.hxx2
-rw-r--r--sw/source/core/crsr/crstrvl.cxx2
-rw-r--r--sw/source/core/edit/eddel.cxx2
-rw-r--r--sw/source/core/edit/editsh.cxx2
-rw-r--r--sw/source/core/edit/ednumber.cxx10
-rw-r--r--sw/source/uibase/uiview/formatclipboard.cxx2
-rw-r--r--sw/source/uibase/uiview/viewling.cxx2
7 files changed, 12 insertions, 10 deletions
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 4e34cc41c222..26d847fa331f 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -312,6 +312,8 @@ public:
{ return GetPrevInRing(); }
const SwPaM* GetPrev() const
{ return GetPrevInRing(); }
+ bool IsMultiSelection() const
+ { return !unique(); }
};
std::ostream &operator <<(std::ostream& s, const SwPaM& pam);
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index c1c8943e3c73..a37abdaf5e32 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -840,7 +840,7 @@ SwField* SwCrsrShell::GetFieldAtCrsr(
SwField* SwCrsrShell::GetCurFld( const bool bIncludeInputFldAtStart ) const
{
SwPaM* pCrsr = GetCrsr();
- if ( pCrsr->GetNext() != pCrsr )
+ if ( pCrsr->IsMultiSelection() )
{
// multi selection not handled.
return NULL;
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 4a2a63452171..7cc097316fff 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -326,7 +326,7 @@ bool SwEditShell::DelFullPara()
{
SwPaM* pCrsr = GetCrsr();
// no multi selection
- if( pCrsr->GetNext() == pCrsr && !HasReadonlySel() )
+ if( !pCrsr->IsMultiSelection() && !HasReadonlySel() )
{
SET_CURR_SHELL( this );
StartAllAction();
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 617a4e3c7fc5..a646d20a7681 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -621,7 +621,7 @@ bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const OUString& rStr, boo
{
// Selection existent, multi selection?
bool bDelTxt = true;
- if( pCrsr->GetNext() == pCrsr )
+ if( !pCrsr->IsMultiSelection() )
{
// einfach Selection -> Text ueberpruefen
const OUString sTxt(comphelper::string::stripEnd(GetSelTxt(), ' '));
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 92f24287db2b..fc86a601940c 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -276,7 +276,7 @@ void SwEditShell::DelNumRules()
StartAllAction();
SwPaM* pCrsr = GetCrsr();
- if( pCrsr->GetNext() != pCrsr ) // multi-selection?
+ if( pCrsr->IsMultiSelection() )
{
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
@@ -307,7 +307,7 @@ bool SwEditShell::NumUpDown( bool bDown )
bool bRet = true;
SwPaM* pCrsr = GetCrsr();
- if( pCrsr->GetNext() == pCrsr ) // no multiple selection ?
+ if( !pCrsr->IsMultiSelection() )
bRet = GetDoc()->NumUpDown( *pCrsr, bDown );
else
{
@@ -528,7 +528,7 @@ bool SwEditShell::OutlineUpDown( short nOffset )
bool bRet = true;
SwPaM* pCrsr = GetCrsr();
- if( pCrsr->GetNext() == pCrsr ) // no multi selection?
+ if( !pCrsr->IsMultiSelection() )
bRet = GetDoc()->OutlineUpDown( *pCrsr, nOffset );
else
{
@@ -789,7 +789,7 @@ void SwEditShell::SetNumRuleStart( bool bFlag, SwPaM* pPaM )
{
StartAllAction();
SwPaM* pCrsr = pPaM ? pPaM : GetCrsr();
- if( pCrsr->GetNext() != pCrsr ) // multiple selection ?
+ if( pCrsr->IsMultiSelection() ) // multiple selection ?
{
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
@@ -816,7 +816,7 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt, SwPaM* pPaM )
StartAllAction();
SwPaM* pCrsr = pPaM ? pPaM : GetCrsr();
- if( pCrsr->GetNext() != pCrsr ) // multiple selection ?
+ if( pCrsr->IsMultiSelection() ) // multiple selection ?
{
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx
index ffaa51547446..229fb83869ea 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -294,7 +294,7 @@ void SwFormatClipboard::Copy( SwWrtShell& rWrtShell, SfxItemPool& rPool, bool bP
bool bHasSelection = pCrsr->HasMark();
bool bForwardSelection = false;
- if(!bHasSelection && pCrsr->GetPrev() != pCrsr && pCrsr->GetPrev() != 0)
+ if(!bHasSelection && pCrsr->IsMultiSelection())
{
// if cursor has multiple selections
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 1abec862378a..17cb15b06cbc 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -487,7 +487,7 @@ bool SwView::IsValidSelectionForThesaurus() const
// must not be a multi-selection, and if it is a selection it needs
// to be within a single paragraph
- const bool bMultiSel = m_pWrtShell->GetCrsr() != m_pWrtShell->GetCrsr()->GetNext();
+ const bool bMultiSel = m_pWrtShell->GetCrsr()->IsMultiSelection();
const bool bSelection = static_cast<SwCrsrShell*>(m_pWrtShell)->HasSelection();
return !bMultiSel && (!bSelection || m_pWrtShell->IsSelOnePara() );
}