[Libreoffice-commits] core.git: 100 commits - sw/inc sw/source
Bjoern Michaelsen
bjoern.michaelsen at canonical.com
Wed Dec 3 16:38:09 PST 2014
sw/inc/ring.hxx | 192 +++++++++++++++++----------------
sw/source/core/access/accdoc.cxx | 2
sw/source/core/access/accframebase.cxx | 2
sw/source/core/access/accmap.cxx | 27 +---
sw/source/core/access/accpara.cxx | 48 +++-----
sw/source/core/crsr/crsrsh.cxx | 52 +++-----
sw/source/core/crsr/crstrvl.cxx | 21 +--
sw/source/core/crsr/swcrsr.cxx | 8 -
sw/source/core/crsr/trvltbl.cxx | 12 +-
sw/source/core/crsr/viscrs.cxx | 6 -
sw/source/core/doc/CntntIdxStore.cxx | 14 +-
sw/source/core/doc/doccomp.cxx | 14 +-
sw/source/core/draw/dcontact.cxx | 6 -
sw/source/core/draw/dpage.cxx | 2
sw/source/core/edit/autofmt.cxx | 2
sw/source/core/edit/edatmisc.cxx | 19 +--
sw/source/core/edit/edattr.cxx | 61 +++++-----
sw/source/core/edit/eddel.cxx | 16 +-
sw/source/core/edit/editsh.cxx | 25 ++--
sw/source/core/edit/ednumber.cxx | 20 +--
sw/source/core/edit/edredln.cxx | 11 -
sw/source/core/edit/edws.cxx | 37 ++----
sw/source/core/frmedt/fecopy.cxx | 6 -
sw/source/core/frmedt/feshview.cxx | 18 +--
sw/source/core/frmedt/fetab.cxx | 7 -
sw/source/core/frmedt/fews.cxx | 14 +-
sw/source/core/graphic/ndgrf.cxx | 6 -
sw/source/core/layout/fly.cxx | 11 -
sw/source/core/layout/frmtool.cxx | 10 -
sw/source/core/layout/layact.cxx | 70 +++++-------
sw/source/core/layout/newfrm.cxx | 2
sw/source/core/layout/pagechg.cxx | 119 ++++++++------------
sw/source/core/layout/paintfrm.cxx | 17 +-
sw/source/core/text/xmldump.cxx | 13 --
sw/source/core/undo/docundo.cxx | 11 +
sw/source/core/unocore/unoobj2.cxx | 41 ++-----
sw/source/core/view/viewimp.cxx | 92 +++++----------
sw/source/core/view/viewsh.cxx | 95 ++++++----------
sw/source/core/view/vnew.cxx | 2
sw/source/filter/basflt/shellio.cxx | 4
sw/source/filter/html/swhtml.cxx | 13 +-
sw/source/uibase/docvw/edtwin.cxx | 2
42 files changed, 518 insertions(+), 632 deletions(-)
New commits:
commit f810d84663742694a12bc1517c39bfd014839d7c
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:21:12 2014 +0100
fix indent
Change-Id: I420009e0892a815e0017208c3bb2a90e1533c916
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 97c3338..d9b6a1c 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5431,7 +5431,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
// Cancel all selections other than the last selected one.
while( rSh.GetCrsr()->GetNext() != rSh.GetCrsr() )
- delete rSh.GetCrsr()->GetNext();
+ delete rSh.GetCrsr()->GetNext();
}
if( pCrsr )
commit f87c46b0fa3c01a163d6aded8889ff305823166b
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:19:00 2014 +0100
use C++11 iteration
Change-Id: Iaf050d7b574864c27b84919aa3a04eadd25312e0
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 2685a0a..fe225ba 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2590,13 +2590,12 @@ SwViewShell *SwHTMLParser::CallEndAction( bool bChkAction, bool bChkPtr )
if( bSetCrsr )
{
- // an allen CrsrEditShells die Cursor auf den Doc-Anfang setzen
- SwViewShell *pSh = pActionViewShell;
- do {
- if( pSh->IsA( TYPE( SwCrsrShell ) ) )
- static_cast<SwCrsrShell*>(pSh)->SttEndDoc(true);
- pSh = static_cast<SwViewShell *>(pSh->GetNext());
- } while( pSh != pActionViewShell );
+ // set the cursor to the doc begin in all CrsrEditShells
+ for(SwViewShell& rSh : pActionViewShell->GetRingContainer())
+ {
+ if( rSh.IsA( TYPE( SwCrsrShell ) ) )
+ static_cast<SwCrsrShell*>(&rSh)->SttEndDoc(true);
+ }
bSetCrsr = false;
}
commit 12f2bcaee5948c3ac2d14d75180c357ae3830179
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:16:38 2014 +0100
unnecessary cast
Change-Id: I59988b27b199ffb50118255026a8d9e5aa3debbd
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 06b3708..d01c456 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -776,7 +776,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName )
while(true)
{
bHasMark = bHasMark || pPam->HasMark();
- pPam = static_cast<SwPaM *>( pPam->GetNext() );
+ pPam = pPam->GetNext();
if(bHasMark || pPam == pEnd)
break;
}
commit e2583ed3168460d5e2bb89dd7fe5a7ddb7c41ccd
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:15:52 2014 +0100
unnecessary cast
Change-Id: I9b0ac0ba1b3dce2d37dd514a75523ddcbbaa0111
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 1163f61..06b3708 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -315,7 +315,7 @@ sal_uLong SwReader::Read( const Reader& rOptions )
delete pUndoPam;
- pPam = static_cast<SwPaM *>( pPam->GetNext());
+ pPam = pPam->GetNext();
if( pPam == pEnd )
break;
commit 82944c9f3093a2cb7eda382ef54615c3b7bd8f54
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:11:25 2014 +0100
unnecessary cast
Change-Id: Ie86244d8180cba07260af4b8c82c4ce588a66528
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 6432d3a..3cfe679 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -358,7 +358,7 @@ SwViewShell::~SwViewShell()
GetLayout()->DeRegisterShell( this );
if(mpDoc->getIDocumentLayoutAccess().GetCurrentViewShell()==this)
mpDoc->getIDocumentLayoutAccess().SetCurrentViewShell( this->GetNext()!=this ?
- static_cast<SwViewShell*>(this->GetNext()) : NULL );
+ this->GetNext() : nullptr );
}
delete mpTmpRef;
commit 354da848ad9ca890e8f977bf210eb9952b72f6cb
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:10:12 2014 +0100
use C++11 iteration
Change-Id: Iba781628aa39e537d403b1bbbd5c8891d6068026
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index a8de6ea..301bcf9 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2186,14 +2186,15 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
if( bOnlineSpellChgd )
{
- SwViewShell *pSh = static_cast<SwViewShell*>(this->GetNext());
bool bOnlineSpl = rOpt.IsOnlineSpell();
- while( pSh != this )
- { pSh->mpOpt->SetOnlineSpell( bOnlineSpl );
- vcl::Window *pTmpWin = pSh->GetWin();
+ for(SwViewShell& rSh : GetRingContainer())
+ {
+ if(&rSh == this)
+ continue;
+ rSh.mpOpt->SetOnlineSpell( bOnlineSpl );
+ vcl::Window *pTmpWin = rSh.GetWin();
if( pTmpWin )
pTmpWin->Invalidate();
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
}
}
commit ae3e797258f14f4348ce542c71815e44e2c3f9f8
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:08:17 2014 +0100
use C++11 iteration
Change-Id: I78d4184f73a11e0f1ef0a1763d207a9a97ac44ee
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 23b7657..a8de6ea 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2032,21 +2032,20 @@ SfxItemPool& SwViewShell::GetAttrPool()
void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt )
{
- SwViewShell *pSh = this;
- do
- { pSh->StartAction();
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
- } while ( pSh != this );
+ for(SwViewShell& rSh : GetRingContainer())
+ rSh.StartAction();
ImplApplyViewOptions( rOpt );
// With one layout per view it is not longer necessary
// to sync these "layout related" view options
// But as long as we have to disable "multiple layout"
- pSh = static_cast<SwViewShell*>(this->GetNext());
- while ( pSh != this )
+
+ for(SwViewShell& rSh : GetRingContainer())
{
- SwViewOption aOpt( *pSh->GetViewOptions() );
+ if(&rSh == this)
+ continue;
+ SwViewOption aOpt( *rSh.GetViewOptions() );
aOpt.SetFldName( rOpt.IsFldName() );
aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
@@ -2054,18 +2053,13 @@ void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt )
aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
aOpt.SetViewLayoutColumns( rOpt.GetViewLayoutColumns() );
aOpt.SetPostIts(rOpt.IsPostIts());
- if ( !(aOpt == *pSh->GetViewOptions()) )
- pSh->ImplApplyViewOptions( aOpt );
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
+ if ( !(aOpt == *rSh.GetViewOptions()) )
+ rSh.ImplApplyViewOptions( aOpt );
}
// End of disabled multiple window
- pSh = this;
- do
- { pSh->EndAction();
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
- } while ( pSh != this );
-
+ for(SwViewShell& rSh : GetRingContainer())
+ rSh.EndAction();
}
void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
commit 7cc956c554c74525d63b9eb98083b2811a9170f6
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:04:55 2014 +0100
use C++11 iteration
Change-Id: I388df85bf547fd159741938307db6e04e6f0a336
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 4351ba5..23b7657 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -941,14 +941,11 @@ void SwViewShell::CalcLayout()
void SwViewShell::SetFirstVisPageInvalid()
{
- SwViewShell *pSh = this;
- do
+ for(SwViewShell& rSh : GetRingContainer())
{
- if ( pSh->Imp() )
- pSh->Imp()->SetFirstVisPageInvalid();
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != this );
+ if ( rSh.Imp() )
+ rSh.Imp()->SetFirstVisPageInvalid();
+ }
}
void SwViewShell::SizeChgNotify()
commit 0426f2946148833aa92d2ba4e2274e18db6f1a28
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:04:05 2014 +0100
use C++11 iteration
Change-Id: I4ca471d9d849b43a60cb34ac81baf023e30891e1
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 5fc9560..4351ba5 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -645,13 +645,11 @@ void SwViewShell::LayoutIdle()
return;
//No idle when printing is going on.
- SwViewShell *pSh = this;
- do
- { if ( !pSh->GetWin() )
+ for(SwViewShell& rSh : GetRingContainer())
+ {
+ if ( !rSh.GetWin() )
return;
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != this );
+ }
SET_CURR_SHELL( this );
commit 23c950ec58c32bca814c8fee946e3aa028bbc679
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:02:25 2014 +0100
use C++11 iteration
Change-Id: I6eae9754e5fcb465f4f27e8c2896e6cea53fbb7a
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 06496b8..5fc9560 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -512,19 +512,16 @@ void SwViewShell::InvalidateWindows( const SwRect &rRect )
{
if ( !Imp()->IsCalcLayoutProgress() )
{
- SwViewShell *pSh = this;
- do
+ for(SwViewShell& rSh : GetRingContainer())
{
- if ( pSh->GetWin() )
+ if ( rSh.GetWin() )
{
- if ( pSh->IsPreview() )
- ::RepaintPagePreview( pSh, rRect );
- else if ( pSh->VisArea().IsOver( rRect ) )
- pSh->GetWin()->Invalidate( rRect.SVRect() );
+ if ( rSh.IsPreview() )
+ ::RepaintPagePreview( &rSh, rRect );
+ else if ( rSh.VisArea().IsOver( rRect ) )
+ rSh.GetWin()->Invalidate( rRect.SVRect() );
}
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != this );
+ }
}
}
commit 4d4b2ecb4e348ba783b6282e4fb27a771a589660
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 22:55:09 2014 +0100
use C++11 iteration
Change-Id: Idcbc7a2a88623ce370d0325284d2e8f96a9e2033
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 70ba96b..06496b8 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -495,18 +495,16 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
bool SwViewShell::AddPaintRect( const SwRect & rRect )
{
bool bRet = false;
- SwViewShell *pSh = this;
- do
+ for(SwViewShell& rSh : GetRingContainer())
{
- if( pSh->Imp() )
+ if( rSh.Imp() )
{
- if ( pSh->IsPreview() && pSh->GetWin() )
- ::RepaintPagePreview( pSh, rRect );
+ if ( rSh.IsPreview() && rSh.GetWin() )
+ ::RepaintPagePreview( &rSh, rRect );
else
- bRet |= pSh->Imp()->AddPaintRect( rRect );
+ bRet |= rSh.Imp()->AddPaintRect( rRect );
}
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
- } while ( pSh != this );
+ }
return bRet;
}
commit 3c1b9b89caddeff71afd3d97f52dd93df5c529af
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 19:00:34 2014 +0100
unnecessary cast
Change-Id: I8096a0dfe0478671183c66fd9d1d516ec4ed3537
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 73ea54f..70ba96b 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -224,7 +224,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
//will this put the EndAction of the last shell in the sequence?
SwViewShell::mbLstAct = true;
- SwViewShell *pSh = static_cast<SwViewShell*>(this->GetNext());
+ SwViewShell *pSh = this->GetNext();
while ( pSh != this )
{
if ( pSh->ActionPend() )
@@ -233,7 +233,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
pSh = this;
}
else
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
+ pSh = pSh->GetNext();
}
const bool bIsShellForCheckViewLayout = ( this == GetLayout()->GetCurrShell() );
commit 005b96a409bd87b2a73842079a0de06b548334b8
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:58:26 2014 +0100
use C++11 iteration
Change-Id: If49d9f859ce9827adf7f578f5f5d5d421f65fcf5
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 2010f1a..b08aa42 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -394,17 +394,13 @@ void SwViewImp::_InvalidateAccessibleParaTextSelection()
/// invalidate attributes for paragraphs
void SwViewImp::_InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm )
{
- SwViewShell* pVSh = GetShell();
- SwViewShell* pTmp = pVSh;
- do
+ for(SwViewShell& rTmp : GetShell()->GetRingContainer())
{
- if ( pTmp->Imp()->IsAccessible() )
+ if ( rTmp.Imp()->IsAccessible() )
{
- pTmp->Imp()->GetAccessibleMap().InvalidateAttr( rTxtFrm );
+ rTmp.Imp()->GetAccessibleMap().InvalidateAttr( rTxtFrm );
}
-
- pTmp = static_cast<SwViewShell *>(pTmp->GetNext());
- } while ( pTmp != pVSh );
+ }
}
// OD 15.01.2003 #103492# - method signature change due to new page preview functionality
commit 7cfba9f7154ab9914ac18f98f7020c5c5b776d2d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:57:56 2014 +0100
use C++11 iteration
Change-Id: I4cc45d4391ad724919b2253ca32b4cafa53c796a
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 174e658..2010f1a 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -382,17 +382,13 @@ void SwViewImp::_InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxt
/// invalidate text selection for paragraphs
void SwViewImp::_InvalidateAccessibleParaTextSelection()
{
- SwViewShell* pVSh = GetShell();
- SwViewShell* pTmp = pVSh;
- do
+ for(SwViewShell& rTmp : GetShell()->GetRingContainer())
{
- if ( pTmp->Imp()->IsAccessible() )
+ if ( rTmp.Imp()->IsAccessible() )
{
- pTmp->Imp()->GetAccessibleMap().InvalidateTextSelectionOfAllParas();
+ rTmp.Imp()->GetAccessibleMap().InvalidateTextSelectionOfAllParas();
}
-
- pTmp = static_cast<SwViewShell *>(pTmp->GetNext());
- } while ( pTmp != pVSh );
+ }
}
/// invalidate attributes for paragraphs
commit 0794cbf28e2cc5d548853d92b23be85615b2416a
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:56:56 2014 +0100
use C++11 iteration
Change-Id: Ib1c6dd47b9168845ad1b864ffbda01c1d6a3afe8
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 9c9f286..174e658 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -361,25 +361,22 @@ void SwViewImp::_InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxt
return;
}
- SwViewShell* pVSh = GetShell();
- SwViewShell* pTmp = pVSh;
- do
+ for(SwViewShell& rTmp : GetShell()->GetRingContainer())
{
- if ( pTmp->Imp()->IsAccessible() )
+ if ( rTmp.Imp()->IsAccessible() )
{
if ( _pFromTxtFrm )
{
- pTmp->Imp()->GetAccessibleMap().
+ rTmp.Imp()->GetAccessibleMap().
InvalidateParaFlowRelation( *_pFromTxtFrm, true );
}
if ( _pToTxtFrm )
{
- pTmp->Imp()->GetAccessibleMap().
+ rTmp.Imp()->GetAccessibleMap().
InvalidateParaFlowRelation( *_pToTxtFrm, false );
}
}
- pTmp = static_cast<SwViewShell *>(pTmp->GetNext());
- } while ( pTmp != pVSh );
+ }
}
/// invalidate text selection for paragraphs
commit f221da28f676b9f72364394cc52dc49b04cbc17d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:56:11 2014 +0100
use C++11 iteration
Change-Id: I27d2c8caed61096d47970fba2104b61b0141997c
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 7355257..9c9f286 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -343,15 +343,12 @@ void SwViewImp::InvalidateAccessibleEditableState( bool bAllShells,
void SwViewImp::InvalidateAccessibleRelationSet( const SwFlyFrm *pMaster,
const SwFlyFrm *pFollow )
{
- SwViewShell *pVSh = GetShell();
- SwViewShell *pTmp = pVSh;
- do
+ for(SwViewShell& rTmp : GetShell()->GetRingContainer())
{
- if( pTmp->Imp()->IsAccessible() )
- pTmp->Imp()->GetAccessibleMap().InvalidateRelationSet( pMaster,
+ if( rTmp.Imp()->IsAccessible() )
+ rTmp.Imp()->GetAccessibleMap().InvalidateRelationSet( pMaster,
pFollow );
- pTmp = static_cast<SwViewShell *>(pTmp->GetNext());
- } while ( pTmp != pVSh );
+ }
}
/// invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
commit 65a1a6afd3474f2b56f1d42cefeed971411b0d61
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:55:32 2014 +0100
use C++11 iteration
Change-Id: I06fa257210d58fef53eb8cdce44d5559ad0309f1
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 998a1a3..7355257 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -328,14 +328,11 @@ void SwViewImp::InvalidateAccessibleEditableState( bool bAllShells,
{
if( bAllShells )
{
- SwViewShell *pVSh = GetShell();
- SwViewShell *pTmp = pVSh;
- do
+ for(SwViewShell& rTmp : GetShell()->GetRingContainer())
{
- if( pTmp->Imp()->IsAccessible() )
- pTmp->Imp()->GetAccessibleMap().InvalidateStates( ACC_STATE_EDITABLE, pFrm );
- pTmp = static_cast<SwViewShell *>(pTmp->GetNext());
- } while ( pTmp != pVSh );
+ if( rTmp.Imp()->IsAccessible() )
+ rTmp.Imp()->GetAccessibleMap().InvalidateStates( ACC_STATE_EDITABLE, pFrm );
+ }
}
else if( IsAccessible() )
{
commit 548a3c8fb5a2a05589159bf4fbde5b37601b728a
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:54:55 2014 +0100
use C++11 iteration
Change-Id: I1b72decd1ef34575508d39c9ee09bb6e5c3f108b
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index a1db803..998a1a3 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -310,14 +310,11 @@ void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
void SwViewImp::InvalidateAccessibleFrmContent( const SwFrm *pFrm )
{
OSL_ENSURE( pFrm->IsAccessibleFrm(), "frame is not accessible" );
- SwViewShell *pVSh = GetShell();
- SwViewShell *pTmp = pVSh;
- do
+ for(SwViewShell& rTmp : GetShell()->GetRingContainer())
{
- if( pTmp->Imp()->IsAccessible() )
- pTmp->Imp()->GetAccessibleMap().InvalidateContent( pFrm );
- pTmp = static_cast<SwViewShell *>(pTmp->GetNext());
- } while ( pTmp != pVSh );
+ if( rTmp.Imp()->IsAccessible() )
+ rTmp.Imp()->GetAccessibleMap().InvalidateContent( pFrm );
+ }
}
void SwViewImp::InvalidateAccessibleCursorPosition( const SwFrm *pFrm )
commit fb793876f6c25a4c55fbc2423055d3fd5d49b174
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:54:09 2014 +0100
use C++11 iteration
Change-Id: I317f0d6c48f0936cfe2d2f8707e42d9e7b5aad7d
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index a1d3786..a1db803 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -299,15 +299,12 @@ void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
const SwRect& rOldFrm )
{
OSL_ENSURE( !pFrm || pFrm->IsAccessibleFrm(), "frame is not accessible" );
- SwViewShell *pVSh = GetShell();
- SwViewShell *pTmp = pVSh;
- do
+ for(SwViewShell& rTmp : GetShell()->GetRingContainer())
{
- if( pTmp->Imp()->IsAccessible() )
- pTmp->Imp()->GetAccessibleMap().InvalidatePosOrSize( pFrm, pObj, 0,
+ if( rTmp.Imp()->IsAccessible() )
+ rTmp.Imp()->GetAccessibleMap().InvalidatePosOrSize( pFrm, pObj, 0,
rOldFrm );
- pTmp = static_cast<SwViewShell *>(pTmp->GetNext());
- } while ( pTmp != pVSh );
+ }
}
void SwViewImp::InvalidateAccessibleFrmContent( const SwFrm *pFrm )
commit 5326f670ff0e8a442fa3f54e787d90b2bc489ff8
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:53:31 2014 +0100
use C++11 iteration
Change-Id: I859453d7b18bd5f4af7bad25bd0439c1f926b02f
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 1a569a3..a1d3786 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -288,14 +288,11 @@ void SwViewImp::DisposeAccessible( const SwFrm *pFrm,
bool bRecursive )
{
OSL_ENSURE( !pFrm || pFrm->IsAccessibleFrm(), "frame is not accessible" );
- SwViewShell *pVSh = GetShell();
- SwViewShell *pTmp = pVSh;
- do
+ for(SwViewShell& rTmp : GetShell()->GetRingContainer())
{
- if( pTmp->Imp()->IsAccessible() )
- pTmp->Imp()->GetAccessibleMap().Dispose( pFrm, pObj, 0, bRecursive );
- pTmp = static_cast<SwViewShell *>(pTmp->GetNext());
- } while ( pTmp != pVSh );
+ if( rTmp.Imp()->IsAccessible() )
+ rTmp.Imp()->GetAccessibleMap().Dispose( pFrm, pObj, 0, bRecursive );
+ }
}
void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
commit 6e778991147395b7385decf797c75051da08e29d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 23:11:23 2014 +0100
use C++11 iteration
Change-Id: I8f12726aee31dd123861340a85f247ba546bf8a8
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 45f95e5..ec47aff 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1536,22 +1536,19 @@ void SwXTextRanges::Impl::Modify( const SfxPoolItem *pOld, const SfxPoolItem *pN
void SwXTextRanges::Impl::MakeRanges()
{
- SwUnoCrsr *const pCursor = GetCursor();
- if (pCursor)
+ if (GetCursor())
{
- SwPaM *pTmpCursor = pCursor;
- do {
+ for(SwPaM& rTmpCursor : GetCursor()->GetRingContainer())
+ {
const uno::Reference< text::XTextRange > xRange(
SwXTextRange::CreateXTextRange(
- *pTmpCursor->GetDoc(),
- *pTmpCursor->GetPoint(), pTmpCursor->GetMark()));
+ *rTmpCursor.GetDoc(),
+ *rTmpCursor.GetPoint(), rTmpCursor.GetMark()));
if (xRange.is())
{
m_Ranges.push_back(xRange);
}
- pTmpCursor = static_cast<SwPaM*>(pTmpCursor->GetNext());
}
- while (pTmpCursor != pCursor);
}
}
commit 1de19df963513a3f78e5bd4a73c059f1c32c599d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:48:19 2014 +0100
unnecessary cast
Change-Id: I15fb840897556ebef63611ced01468461179203d
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 9cc2e34..45f95e5 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1077,7 +1077,7 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill,
: ((pPortion) ? pPortion->GetCursor() : 0);
if (pUnoCrsr && pDoc == rToFill.GetDoc())
{
- OSL_ENSURE(static_cast<SwPaM*>(pUnoCrsr->GetNext()) == pUnoCrsr,
+ OSL_ENSURE(pUnoCrsr->GetNext() == pUnoCrsr,
"what to do about rings?");
bRet = true;
*rToFill.GetPoint() = *pUnoCrsr->GetPoint();
commit 723753385dfb7c31835427fef4db8bc8df7d78dd
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:47:46 2014 +0100
use C++11 iteration
Change-Id: I0e2279ebe223d17b2ee2f337faaa69cee956e1c6
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 49d4600..9cc2e34 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -351,11 +351,10 @@ void SwUnoCursorHelper::GetCrsrAttr(SwPaM & rPam,
static const sal_uLong nMaxLookup = 1000;
SfxItemSet aSet( *rSet.GetPool(), rSet.GetRanges() );
SfxItemSet *pSet = &rSet;
- SwPaM *pCurrent = & rPam;
- do
+ for(SwPaM& rCurrent : rPam.GetRingContainer())
{
- SwPosition const & rStart( *pCurrent->Start() );
- SwPosition const & rEnd( *pCurrent->End() );
+ SwPosition const & rStart( *rCurrent.Start() );
+ SwPosition const & rEnd( *rCurrent.End() );
const sal_uLong nSttNd = rStart.nNode.GetIndex();
const sal_uLong nEndNd = rEnd .nNode.GetIndex();
@@ -407,8 +406,7 @@ void SwUnoCursorHelper::GetCrsrAttr(SwPaM & rPam,
aSet.ClearItem();
}
}
- pCurrent= static_cast<SwPaM *>(pCurrent->GetNext());
- } while ( pCurrent != &rPam );
+ }
}
class SwXParagraphEnumeration::Impl
commit 001180222a995b2b76900d1de9ddf3c844037edc
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:46:13 2014 +0100
use C++11 iteration
Change-Id: I1a892b13d8716c9963f344bb57febbc7118561b2
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 883ff5c..49d4600 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -315,17 +315,15 @@ void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam,
{
pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
- SwPaM *pCurrent = &rPam;
- do
+ for(SwPaM& rCurrent : rPam.GetRingContainer())
{
- if (pCurrent->HasMark() &&
+ if (rCurrent.HasMark() &&
( (bTableMode) ||
- (*pCurrent->GetPoint() != *pCurrent->GetMark()) ))
+ (*rCurrent.GetPoint() != *rCurrent.GetMark()) ))
{
- pDoc->getIDocumentContentOperations().InsertItemSet(*pCurrent, rSet, nFlags);
+ pDoc->getIDocumentContentOperations().InsertItemSet(rCurrent, rSet, nFlags);
}
- pCurrent= static_cast<SwPaM *>(pCurrent->GetNext());
- } while (pCurrent != &rPam);
+ }
pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
}
commit ec47c1b80b264e21b6ee6ffe00ca2fa6d82b5396
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:44:10 2014 +0100
unnecessary cast
Change-Id: I32f3396f97e7144f5aa4037d4a312085ac113e3d
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 09cdf3e..883ff5c 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -140,14 +140,14 @@ void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget)
if (rSource.GetNext() != &rSource)
{
- SwPaM *pPam = static_cast<SwPaM *>(rSource.GetNext());
+ SwPaM *pPam = rSource.GetNext();
do
{
// create new PaM
SwPaM *const pNew = new SwPaM(*pPam);
// insert into ring
pNew->MoveTo(&rTarget);
- pPam = static_cast<SwPaM *>(pPam->GetNext());
+ pPam = pPam->GetNext();
}
while (pPam != &rSource);
}
commit 63ca4cd4aa5c6b52bb68aaaa1b2e30ce366eb5ee
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:40:51 2014 +0100
use C++11 iteration
Change-Id: I49b2c2f825a23972a0bad321cbb41eb2d8651d8f
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 470abe1..63cc4b0 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -561,16 +561,17 @@ bool UndoManager::Repeat(::sw::RepeatContext & rContext,
EnterListAction(comment, rcomment, nId);
}
- SwPaM *const pFirstCursor(& rContext.GetRepeatPaM());
- do { // iterate over ring
+ SwPaM* pTmp = rContext.m_pCurrentPaM;
+ for(SwPaM& rPaM : rContext.GetRepeatPaM().GetRingContainer())
+ { // iterate over ring
+ rContext.m_pCurrentPaM = &rPaM;
for (sal_uInt16 nRptCnt = nRepeatCount; nRptCnt > 0; --nRptCnt)
{
pRepeatAction->Repeat(rContext);
}
rContext.m_bDeleteRepeated = false; // reset for next PaM
- rContext.m_pCurrentPaM =
- static_cast<SwPaM*>(rContext.m_pCurrentPaM->GetNext());
- } while (pFirstCursor != & rContext.GetRepeatPaM());
+ }
+ rContext.m_pCurrentPaM = pTmp;
if (DoesUndo())
{
commit f0b92b8bdf60dab4c60263d29bf7d5b415fde284
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:32:23 2014 +0100
use C++11 iteration
Change-Id: I383e7552160c5e12796ddf7cb13058d99032c7f5
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index e5865b3..58e52f7 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -299,19 +299,16 @@ void SwFrm::dumpAsXml( xmlTextWriterPtr writer ) const
const SwRootFrm* const pRootFrm = static_cast<const SwRootFrm* const>(this);
SwEditShell* pEditShell = pRootFrm->GetCurrShell()->GetDoc()->GetEditShell();
xmlTextWriterStartElement(writer, BAD_CAST("shellCrsr"));
- SwPaM* pPaM = pEditShell->getShellCrsr(false);
- do
+ for(SwPaM& rPaM : pEditShell->getShellCrsr(false)->GetRingContainer())
{
xmlTextWriterStartElement(writer, BAD_CAST("swpam"));
- xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("pointNodeIndex"), "%ld", pPaM->GetPoint()->nNode.GetIndex());
- xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("pointContentIndex"), "%" SAL_PRIdINT32, pPaM->GetPoint()->nContent.GetIndex());
+ xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("pointNodeIndex"), "%ld", rPaM.GetPoint()->nNode.GetIndex());
+ xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("pointContentIndex"), "%" SAL_PRIdINT32, rPaM.GetPoint()->nContent.GetIndex());
- xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("markNodeIndex"), "%ld", pPaM->GetMark()->nNode.GetIndex());
- xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("markContentIndex"), "%" SAL_PRIdINT32, pPaM->GetMark()->nContent.GetIndex());
+ xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("markNodeIndex"), "%ld", rPaM.GetMark()->nNode.GetIndex());
+ xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("markContentIndex"), "%" SAL_PRIdINT32, rPaM.GetMark()->nContent.GetIndex());
xmlTextWriterEndElement(writer);
- pPaM = static_cast<SwPaM*>(pPaM->GetNext());
}
- while (pPaM && pPaM != pEditShell->getShellCrsr(false));
xmlTextWriterEndElement(writer);
}
commit 71101b2ced8ed7aa252e3fcb0c9c7a6f13b0bc9a
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:27:44 2014 +0100
use C++11 iteration
Change-Id: I725c39b8cda4f4f395cae2d70f221650f1e2a790
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 6107635..228bbee 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3197,18 +3197,19 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c
// all existing <SwViewShell> instances.
bool bPerformLayoutAction( true );
{
- SwViewShell* pTmpViewShell = pSh;
- do {
- if ( pTmpViewShell->IsInEndAction() ||
- pTmpViewShell->IsPaintInProgress() ||
- ( pTmpViewShell->Imp()->IsAction() &&
- pTmpViewShell->Imp()->GetLayAction().IsActionInProgress() ) )
+ for(SwViewShell& rTmpViewShell : pSh->GetRingContainer())
+ {
+ if ( rTmpViewShell.IsInEndAction() ||
+ rTmpViewShell.IsPaintInProgress() ||
+ ( rTmpViewShell.Imp()->IsAction() &&
+ rTmpViewShell.Imp()->GetLayAction().IsActionInProgress() ) )
{
bPerformLayoutAction = false;
}
- pTmpViewShell = static_cast<SwViewShell*>(pTmpViewShell->GetNext());
- } while ( bPerformLayoutAction && pTmpViewShell != pSh );
+ if(!bPerformLayoutAction)
+ break;
+ }
}
if ( bPerformLayoutAction )
{
commit 5e023bf54abbae936230899edac03ec5f6bec441
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:25:22 2014 +0100
use C++11 iteration
Change-Id: Ic51ddaf05c6377c27dfe81277228b43c305fc632
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index d4e54088..02c523b 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1776,14 +1776,12 @@ static void lcl_MoveAllLowerObjs( SwFrm* pFrm, const Point& rOffset )
svt::EmbeddedObjectRef& xObj = pNode->GetOLEObj().GetObject();
if ( xObj.is() )
{
- SwViewShell* pTmp = pSh;
- do
+ for(SwViewShell& rSh : pSh->GetRingContainer())
{
- SwFEShell* pFEShell = dynamic_cast< SwFEShell* >( pTmp );
+ SwFEShell* pFEShell = dynamic_cast< SwFEShell* >( &rSh );
if ( pFEShell )
pFEShell->MoveObjectIfActive( xObj, rOffset );
- pTmp = static_cast<SwViewShell*>( pTmp->GetNext() );
- } while( pTmp != pSh );
+ }
}
}
}
commit 0dcdbefaf9a7ac2c1d632d0246fca3f9d55b1f85
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:24:01 2014 +0100
use C++11 iteration
Change-Id: Ifc64a7e301e9ecaa59890d0363d699eb9ff5812d
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 09f6ad0..d4e54088 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1711,23 +1711,20 @@ void SwRootFrm::UnoRemoveAllActions()
void SwRootFrm::UnoRestoreAllActions()
{
- SwViewShell *pSh = GetCurrShell();
- if ( pSh )
- do
+ if ( GetCurrShell() )
+ for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
{
- sal_uInt16 nActions = pSh->GetRestoreActions();
+ sal_uInt16 nActions = rSh.GetRestoreActions();
while( nActions-- )
{
- if ( pSh->ISA( SwCrsrShell ) )
- static_cast<SwCrsrShell*>(pSh)->StartAction();
+ if ( rSh.ISA( SwCrsrShell ) )
+ static_cast<SwCrsrShell*>(&rSh)->StartAction();
else
- pSh->StartAction();
+ rSh.StartAction();
}
- pSh->SetRestoreActions(0);
- pSh->LockView(false);
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != GetCurrShell() );
+ rSh.SetRestoreActions(0);
+ rSh.LockView(false);
+ }
}
// Helper functions for SwRootFrm::CheckViewLayout
commit d14ab0133c683409dcf6287006d9c62dfa445f7a
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:23:03 2014 +0100
use C++11 iteration
Change-Id: I20a3aeef306ca83daa2d78647814ff6bb32ef082
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index e562a8d..09f6ad0 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1678,38 +1678,35 @@ void SwRootFrm::EndAllAction( bool bVirDev )
void SwRootFrm::UnoRemoveAllActions()
{
- SwViewShell *pSh = GetCurrShell();
- if ( pSh )
- do
+ if ( GetCurrShell() )
+ for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
{
// #i84729#
// No end action, if <SwViewShell> instance is currently in its end action.
// Recursives calls to <::EndAction()> are not allowed.
- if ( !pSh->IsInEndAction() )
+ if ( !rSh.IsInEndAction() )
{
- OSL_ENSURE(!pSh->GetRestoreActions(), "Restore action count is already set!");
- bool bCrsr = pSh->ISA( SwCrsrShell );
- bool bFE = pSh->ISA( SwFEShell );
+ OSL_ENSURE(!rSh.GetRestoreActions(), "Restore action count is already set!");
+ bool bCrsr = rSh.ISA( SwCrsrShell );
+ bool bFE = rSh.ISA( SwFEShell );
sal_uInt16 nRestore = 0;
- while( pSh->ActionCount() )
+ while( rSh.ActionCount() )
{
if( bCrsr )
{
- static_cast<SwCrsrShell*>(pSh)->EndAction();
- static_cast<SwCrsrShell*>(pSh)->CallChgLnk();
+ static_cast<SwCrsrShell*>(&rSh)->EndAction();
+ static_cast<SwCrsrShell*>(&rSh)->CallChgLnk();
if ( bFE )
- static_cast<SwFEShell*>(pSh)->SetChainMarker();
+ static_cast<SwFEShell*>(&rSh)->SetChainMarker();
}
else
- pSh->EndAction();
+ rSh.EndAction();
nRestore++;
}
- pSh->SetRestoreActions(nRestore);
+ rSh.SetRestoreActions(nRestore);
}
- pSh->LockView(true);
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != GetCurrShell() );
+ rSh.LockView(true);
+ }
}
void SwRootFrm::UnoRestoreAllActions()
commit 63ef826b08623ff3cdd8f9692544fcb87bb16206
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:21:31 2014 +0100
use C++11 iteration
Change-Id: Ic43c07b1530595980794f89f94dfad28771fc155
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 2d93441..e562a8d 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1658,25 +1658,22 @@ void SwRootFrm::StartAllAction()
void SwRootFrm::EndAllAction( bool bVirDev )
{
- SwViewShell *pSh = GetCurrShell();
- if ( pSh )
- do
+ if ( GetCurrShell() )
+ for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
{
- const bool bOldEndActionByVirDev = pSh->IsEndActionByVirDev();
- pSh->SetEndActionByVirDev( bVirDev );
- if ( pSh->ISA( SwCrsrShell ) )
+ const bool bOldEndActionByVirDev = rSh.IsEndActionByVirDev();
+ rSh.SetEndActionByVirDev( bVirDev );
+ if ( rSh.ISA( SwCrsrShell ) )
{
- static_cast<SwCrsrShell*>(pSh)->EndAction();
- static_cast<SwCrsrShell*>(pSh)->CallChgLnk();
- if ( pSh->ISA( SwFEShell ) )
- static_cast<SwFEShell*>(pSh)->SetChainMarker();
+ static_cast<SwCrsrShell*>(&rSh)->EndAction();
+ static_cast<SwCrsrShell*>(&rSh)->CallChgLnk();
+ if ( rSh.ISA( SwFEShell ) )
+ static_cast<SwFEShell*>(&rSh)->SetChainMarker();
}
else
- pSh->EndAction();
- pSh->SetEndActionByVirDev( bOldEndActionByVirDev );
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != GetCurrShell() );
+ rSh.EndAction();
+ rSh.SetEndActionByVirDev( bOldEndActionByVirDev );
+ }
}
void SwRootFrm::UnoRemoveAllActions()
commit 65bc59b22c8c1eab0cc56baf4987f6af384a6808
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:18:45 2014 +0100
use C++11 iteration
Change-Id: Ie7f7b7125029b1e0e2935b061d454cd5b6719543
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 8b2c8c6..2d93441 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1646,16 +1646,14 @@ void SwRootFrm::ImplCalcBrowseWidth()
void SwRootFrm::StartAllAction()
{
- SwViewShell *pSh = GetCurrShell();
- if ( pSh )
- do
- { if ( pSh->ISA( SwCrsrShell ) )
- static_cast<SwCrsrShell*>(pSh)->StartAction();
+ if ( GetCurrShell() )
+ for(SwViewShell& rSh : GetCurrShell()->GetRingContainer())
+ {
+ if ( rSh.ISA( SwCrsrShell ) )
+ static_cast<SwCrsrShell*>(&rSh)->StartAction();
else
- pSh->StartAction();
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != GetCurrShell() );
+ rSh.StartAction();
+ }
}
void SwRootFrm::EndAllAction( bool bVirDev )
commit e132165bc4b17eb154c729507bd6cbb1b5724e6f
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:16:04 2014 +0100
use C++11 iteration and simplify cast
Change-Id: I773bc94800ab0b2354543524fb337ccca9aa6f01
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 43ed48e..8b2c8c6 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -762,19 +762,17 @@ void AdjustSizeChgNotify( SwRootFrm *pRoot )
{
const bool bOld = pRoot->IsSuperfluous();
pRoot->bCheckSuperfluous = false;
- SwViewShell *pSh = pRoot->GetCurrShell();
- if ( pSh )
+ if ( pRoot->GetCurrShell() )
{
- do
+ for(SwViewShell& rSh : pRoot->GetCurrShell()->GetRingContainer())
{
- if( pRoot == pSh->GetLayout() )
+ if( pRoot == rSh.GetLayout() )
{
- pSh->SizeChgNotify();
- if ( pSh->Imp() )
- pSh->Imp()->NotifySizeChg( pRoot->Frm().SSize() );
+ rSh.SizeChgNotify();
+ if ( rSh.Imp() )
+ rSh.Imp()->NotifySizeChg( pRoot->Frm().SSize() );
}
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
- } while ( pSh != pRoot->GetCurrShell() );
+ }
}
pRoot->bCheckSuperfluous = bOld;
}
commit f3cebf364414068f8e5f4105a64fcff0dc29ecc9
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:12:55 2014 +0100
unnecessary cast
Change-Id: I606960e54719700d0bc3b5c2dee6f2c1f2ee0b1b
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index aea4480..041267a 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -415,7 +415,7 @@ void SwRootFrm::DeRegisterShell( SwViewShell *pSh )
{
// Activate some shell if possible
if ( pCurrShell == pSh )
- pCurrShell = pSh->GetNext() != pSh ? static_cast<SwViewShell*>(pSh->GetNext()) : 0;
+ pCurrShell = pSh->GetNext() != pSh ? pSh->GetNext() : nullptr;
// Doesn't matter anymore
if ( pWaitingCurrShell == pSh )
commit f367924f17f43448e7077e524145229549005ee2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:10:53 2014 +0100
use C++11 iteration and simplify cast
Change-Id: I3de5f37adfa0d3d46d9cbc1ce74205750357c481
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 137b429..d830ed7 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2172,88 +2172,87 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) :
// somewhere or if the visibility of the CharRects has changed.
bool bActions = false;
size_t nBoolIdx = 0;
- do
+ for(SwViewShell& rSh : pImp->GetShell()->GetRingContainer())
{
- --pSh->mnStartAction;
+ --rSh.mnStartAction;
- if ( pSh->Imp()->GetRegion() )
+ if ( rSh.Imp()->GetRegion() )
bActions = true;
else
{
- SwRect aTmp( pSh->VisArea() );
- pSh->UISizeNotify();
+ SwRect aTmp( rSh.VisArea() );
+ rSh.UISizeNotify();
// #137134#
- // Are we supposed to crash if pSh isn't a cursor shell?!
- // bActions |= aTmp != pSh->VisArea() ||
- // aBools[nBoolIdx] != ((SwCrsrShell*)pSh)->GetCharRect().IsOver( pSh->VisArea() );
+ // Are we supposed to crash if rSh isn't a cursor shell?!
+ // bActions |= aTmp != rSh.VisArea() ||
+ // aBools[nBoolIdx] != ((SwCrsrShell*)&rSh)->GetCharRect().IsOver( rSh.VisArea() );
// aBools[ i ] is true, if the i-th shell is a cursor shell (!!!)
// and the cursor is visible.
- bActions |= aTmp != pSh->VisArea();
- if ( aTmp == pSh->VisArea() && pSh->ISA(SwCrsrShell) )
+ bActions |= aTmp != rSh.VisArea();
+ if ( aTmp == rSh.VisArea() && rSh.ISA(SwCrsrShell) )
{
bActions |= aBools[nBoolIdx] !=
- static_cast<SwCrsrShell*>(pSh)->GetCharRect().IsOver( pSh->VisArea() );
+ static_cast<SwCrsrShell*>(&rSh)->GetCharRect().IsOver( rSh.VisArea() );
}
}
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
++nBoolIdx;
- } while ( pSh != pImp->GetShell() );
+ }
if ( bActions )
{
// Prepare start/end actions via CrsrShell, so the cursor, selection
// and VisArea can be set correctly.
nBoolIdx = 0;
- do
+ for(SwViewShell& rSh : pImp->GetShell()->GetRingContainer())
{
- bool bCrsrShell = pSh->IsA( TYPE(SwCrsrShell) );
+ SwCrsrShell* pCrsrShell = nullptr;
+ if(rSh.IsA( TYPE(SwCrsrShell) ))
+ pCrsrShell = static_cast<SwCrsrShell*>(&rSh);
- if ( bCrsrShell )
- static_cast<SwCrsrShell*>(pSh)->SttCrsrMove();
+ if ( pCrsrShell )
+ pCrsrShell->SttCrsrMove();
// If there are accrued paints, it's best to simply invalidate
// the whole window. Otherwise there would arise paint problems whose
// solution would be disproportionally expensive.
//fix(18176):
- SwViewImp *pViewImp = pSh->Imp();
+ SwViewImp *pViewImp = rSh.Imp();
bool bUnlock = false;
if ( pViewImp->GetRegion() )
{
pViewImp->DelRegion();
// Cause a repaint with virtual device.
- pSh->LockPaint();
+ rSh.LockPaint();
bUnlock = true;
}
- if ( bCrsrShell )
+ if ( pCrsrShell )
// If the Crsr was visible, we need to make it visible again.
// Otherwise, EndCrsrMove with true for IdleEnd
- static_cast<SwCrsrShell*>(pSh)->EndCrsrMove( !aBools[nBoolIdx] );
+ pCrsrShell->EndCrsrMove( !aBools[nBoolIdx] );
if( bUnlock )
{
- if( bCrsrShell )
+ if( pCrsrShell )
{
// UnlockPaint overwrite the selection from the
// CrsrShell and calls the virtual method paint
// to fill the virtual device. This fill dont have
// paint the selection! -> Set the focus flag at
// CrsrShell and it dont paint the selection.
- static_cast<SwCrsrShell*>(pSh)->ShLooseFcs();
- pSh->UnlockPaint( true );
- static_cast<SwCrsrShell*>(pSh)->ShGetFcs( false );
+ pCrsrShell->ShLooseFcs();
+ pCrsrShell->UnlockPaint( true );
+ pCrsrShell->ShGetFcs( false );
}
else
- pSh->UnlockPaint( true );
+ rSh.UnlockPaint( true );
}
-
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
++nBoolIdx;
- } while ( pSh != pImp->GetShell() );
+ }
}
if (!bInterrupt)
commit f0d0c8a4d6ca0371cabca56a095f6c00bd828287
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 18:01:28 2014 +0100
use C++11 iteration
Change-Id: Ifc772d50d6431d9c377d00729bfa77b4359af98a
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 7f23905..137b429 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2147,17 +2147,16 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) :
// We remember the shells where the cursor is visible, so we can make
// it visible again if needed after a document change.
std::vector<bool> aBools;
- SwViewShell *pSh = pImp->GetShell();
- do
- { ++pSh->mnStartAction;
+ for(SwViewShell& rSh : pImp->GetShell()->GetRingContainer())
+ {
+ ++rSh.mnStartAction;
bool bVis = false;
- if ( pSh->ISA(SwCrsrShell) )
+ if ( rSh.ISA(SwCrsrShell) )
{
- bVis = static_cast<SwCrsrShell*>(pSh)->GetCharRect().IsOver(pSh->VisArea());
+ bVis = static_cast<SwCrsrShell*>(&rSh)->GetCharRect().IsOver(rSh.VisArea());
}
aBools.push_back( bVis );
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
- } while ( pSh != pImp->GetShell() );
+ }
bool bInterrupt(false);
{
commit b9e413c8192be0f962076debf41fec4544697c5b
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:57:14 2014 +0100
use C++11 iteration
Change-Id: I104af918584aa49491787536f03ba734acb942bd
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 6118656..30875f2 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -856,11 +856,10 @@ SwCntntNotify::~SwCntntNotify()
SwFlyFrm *pFly = pCnt->FindFlyFrm();
svt::EmbeddedObjectRef& xObj = pNd->GetOLEObj().GetObject();
SwFEShell *pFESh = 0;
- SwViewShell *pTmp = pSh;
- do
- { if ( pTmp->ISA( SwCrsrShell ) )
+ for(SwViewShell& rCurrentShell : pSh->GetRingContainer())
+ { if ( rCurrentShell.ISA( SwCrsrShell ) )
{
- pFESh = static_cast<SwFEShell*>(pTmp);
+ pFESh = static_cast<SwFEShell*>(&rCurrentShell);
// #108369#: Here used to be the condition if (!bFirst).
// I think this should mean "do not call CalcAndSetScale"
// if the frame is formatted for the first time.
@@ -882,8 +881,7 @@ SwCntntNotify::~SwCntntNotify()
&pFly->Prt(), &pFly->Frm(),
bNoTxtFrmPrtAreaChanged );
}
- pTmp = static_cast<SwViewShell*>(pTmp->GetNext());
- } while ( pTmp != pSh );
+ }
if ( pFESh && pNd->IsOLESizeInvalid() )
{
commit 42981b6d8ada48ce9f7144f23f5aa5751cc02664
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:54:59 2014 +0100
use C++11 iteration
Change-Id: I88510a9a0569ce9241ea28ace9eaa5ce7700990b
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index a43f820..3a05a73 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -430,15 +430,12 @@ void SwFlyFrm::FinitDrawObj()
SwViewShell *p1St = getRootFrm()->GetCurrShell();
if ( p1St )
{
- SwViewShell *pSh = p1St;
- do
+ for(SwViewShell& rCurrentShell : p1St->GetRingContainer())
{ // At the moment the Drawing can do just do an Unmark on everything,
// as the Object was already removed
- if( pSh->HasDrawView() )
- pSh->Imp()->GetDrawView()->UnmarkAll();
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != p1St );
+ if( rCurrentShell.HasDrawView() )
+ rCurrentShell.Imp()->GetDrawView()->UnmarkAll();
+ }
}
}
commit dd53ee608dd06ef4db95e36f6786a95df21517a0
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:52:12 2014 +0100
use C++11 iteration
Change-Id: Iff18fa8d3860437f9d9a14ba52d06b1aa4d38076
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 0989b78..6e60afa 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -1095,15 +1095,15 @@ bool SwGrfNode::IsSelected() const
{
const SwNode* pN = this;
const SwViewShell* pV = pESh;
- do {
- if( pV->ISA( SwEditShell ) && pN == &static_cast<const SwCrsrShell*>(pV)
+ for(const SwViewShell& rCurrentShell : pESh->GetRingContainer())
+ {
+ if( rCurrentShell.ISA( SwEditShell ) && pN == &static_cast<const SwCrsrShell*>(&rCurrentShell)
->GetCrsr()->GetPoint()->nNode.GetNode() )
{
bRet = true;
break;
}
}
- while( pESh != ( pV = static_cast<SwViewShell*>(pV->GetNext()) ));
}
return bRet;
}
commit b9b8095cd11ffb4b7299f03ff03e543468fd5251
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:49:12 2014 +0100
use C++11 iteration
Change-Id: I8e667f97668b312c61587893cd75d9967a46ce2d
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 8b0aa53..4fafe52 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -55,16 +55,16 @@ TYPEINIT1(SwFEShell,SwEditShell)
void SwFEShell::EndAllActionAndCall()
{
- SwViewShell *pTmp = this;
- do {
- if( pTmp->IsA( TYPE(SwCrsrShell) ) )
+ for(SwViewShell& rCurrentShell : GetRingContainer())
+ {
+ if( rCurrentShell.IsA( TYPE(SwCrsrShell) ) )
{
- static_cast<SwFEShell*>(pTmp)->EndAction();
- static_cast<SwFEShell*>(pTmp)->CallChgLnk();
+ static_cast<SwFEShell*>(&rCurrentShell)->EndAction();
+ static_cast<SwFEShell*>(&rCurrentShell)->CallChgLnk();
}
else
- pTmp->EndAction();
- } while( this != ( pTmp = static_cast<SwViewShell*>(pTmp->GetNext()) ));
+ rCurrentShell.EndAction();
+ }
}
// Determine the Cntnt's nearest to the point
commit ff9d42ae8e39e036952e5e0f92c1103d3c0f908c
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:46:49 2014 +0100
use C++11 iteration
Change-Id: Ib7f4ebc935da3eeff9fa7fe6ae4fc8d1c9226843
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 9880be5..35ab823 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -106,12 +106,11 @@ void SwFEShell::ParkCursorInTab()
SwPosition aStartPos = *pSwCrsr->GetPoint(), aEndPos = aStartPos;
- SwCursor * pTmpCrsr = (SwCursor *) pSwCrsr;
-
/* Search least and greatest position in current cursor ring.
*/
- do
+ for(SwPaM& rTmpCrsr : pSwCrsr->GetRingContainer())
{
+ SwCursor* pTmpCrsr = static_cast<SwCursor *>(&rTmpCrsr);
const SwPosition * pPt = pTmpCrsr->GetPoint(),
* pMk = pTmpCrsr->GetMark();
@@ -127,9 +126,7 @@ void SwFEShell::ParkCursorInTab()
if (*pMk > aEndPos)
aEndPos = *pMk;
- pTmpCrsr = static_cast<SwCursor *>( pTmpCrsr->GetNext() );
}
- while (pTmpCrsr != pSwCrsr);
KillPams();
commit a782a3f3292dfeec40c2bf8c463a8ab913d8e1d7
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:43:17 2014 +0100
use C++11 iteration
Change-Id: Idc13d5c04db1a3529a37c37147079814f5117d14
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 026e3af..fafe863 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -637,11 +637,8 @@ long SwFEShell::EndDrag( const Point *, bool )
SdrView *pView = Imp()->GetDrawView();
if ( pView->IsDragObj() )
{
- // Setup Start-/EndActions only to the SwViewShell
- SwViewShell *pSh = this;
- do {
- pSh->StartAction();
- } while ( this != (pSh = static_cast<SwViewShell*>(pSh->GetNext())) );
+ for(SwViewShell& rSh : GetRingContainer())
+ rSh.StartAction();
StartUndo( UNDO_START );
@@ -662,11 +659,12 @@ long SwFEShell::EndDrag( const Point *, bool )
EndUndo( UNDO_END );
- do {
- pSh->EndAction();
- if( pSh->IsA( TYPE( SwCrsrShell ) ) )
- static_cast<SwCrsrShell*>(pSh)->CallChgLnk();
- } while ( this != (pSh = static_cast<SwViewShell*>(pSh->GetNext())) );
+ for(SwViewShell& rSh : GetRingContainer())
+ {
+ rSh.EndAction();
+ if( rSh.IsA( TYPE( SwCrsrShell ) ) )
+ static_cast<SwCrsrShell*>(&rSh)->CallChgLnk();
+ }
GetDoc()->getIDocumentState().SetModified();
::FrameNotify( this, FLY_DRAG );
commit 8145c0bdfbab7295d78daea12236742a46eec192
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:40:06 2014 +0100
unnecessary cast
Change-Id: I3c7c04f8da9829e50e4bf82500d226710fd3b9c9
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 8825995..907bb9b 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -759,7 +759,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
}
else // as long as we find more insert positions in the cursor ring
{ // we'll take them
- pCurrCrsr = static_cast<SwPaM*>(pCurrCrsr->GetNext());
+ pCurrCrsr = pCurrCrsr->GetNext();
aInsertPos = *pCurrCrsr->GetPoint();
--nCursorCount;
}
commit 4e1d9ab9077d388cea56b9387a9a02c3e0c4946e
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:39:48 2014 +0100
unnecessary cast
Change-Id: Iaf5f3dee59b2ee045a524059c4342465ce3b3a0c
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 5093f65..8825995 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -724,7 +724,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
// cursor of the ring points to identical document positions. Then
// we should avoid double insertion of text portions...
while( nCursorCount > 1 && *pCurrCrsr->GetPoint() ==
- *(static_cast<SwPaM*>(pCurrCrsr->GetPrev())->GetPoint()) )
+ *(pCurrCrsr->GetPrev()->GetPoint()) )
{
--nCursorCount;
pCurrCrsr = pCurrCrsr->GetNext();
commit 2255627696236fa889d907a492055c77b382ba0a
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:39:24 2014 +0100
unnecessary cast
Change-Id: Ic61d755bf5d67aae3eb1f4ffbf655216fec9c18b
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index c10c8d9..5093f65 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -727,7 +727,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
*(static_cast<SwPaM*>(pCurrCrsr->GetPrev())->GetPoint()) )
{
--nCursorCount;
- pCurrCrsr = static_cast<SwPaM*>(pCurrCrsr->GetNext());
+ pCurrCrsr = pCurrCrsr->GetNext();
pStartCursor = pCurrCrsr;
}
SwPosition aStartPos( *pStartCursor->GetPoint() );
commit da2c52538700a147673bfa46cc5c9bdc2dcf7d81
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Dec 4 00:46:12 2014 +0100
use C++11 iteration
Change-Id: Ibf34d6653db6141dc365759a660208896b9bf553
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 009a9bb..3700e2c 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -95,14 +95,11 @@ void SwEditShell::CalcLayout()
StartAllAction();
SwViewShell::CalcLayout();
- SwViewShell *pSh = this;
- do
+ for(SwViewShell& rCurrentShell : GetRingContainer())
{
- if ( pSh->GetWin() )
- pSh->GetWin()->Invalidate();
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != this );
+ if ( rCurrentShell.GetWin() )
+ rCurrentShell.GetWin()->Invalidate();
+ }
EndAllAction();
}
commit 2b98706f0ad97756549287195aef878f1758f9ea
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Dec 4 00:45:16 2014 +0100
use C++11 iteration
Change-Id: I1d5a4f21272f0b42f2f89ebab39d39e5c9e0a181
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 3a1f24f..009a9bb 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -81,14 +81,13 @@ void SwEditShell::StartAllAction()
void SwEditShell::EndAllAction()
{
- SwViewShell *pSh = this;
- do {
- if( pSh->IsA( TYPE( SwEditShell ) ) )
- static_cast<SwEditShell*>(pSh)->EndAction();
+ for(SwViewShell& rCurrentShell : GetRingContainer())
+ {
+ if( rCurrentShell.IsA( TYPE( SwEditShell ) ) )
+ static_cast<SwEditShell*>(&rCurrentShell)->EndAction();
else
- pSh->EndAction();
- pSh = static_cast<SwViewShell *>(pSh->GetNext());
- } while(pSh != this);
+ rCurrentShell.EndAction();
+ }
}
void SwEditShell::CalcLayout()
commit cd187f9d3476d9b8be9069bd949952b37195c4f5
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:34:35 2014 +0100
use C++11 iteration
Change-Id: If84202b478a296654912ed9509591ac59f976c4e
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 3816ab6..3a1f24f 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -70,14 +70,13 @@ void SwEditShell::SetUndoNoResetModified()
void SwEditShell::StartAllAction()
{
- SwViewShell *pSh = this;
- do {
- if( pSh->IsA( TYPE( SwEditShell ) ) )
- static_cast<SwEditShell*>(pSh)->StartAction();
+ for(SwViewShell& rCurrentShell : GetRingContainer())
+ {
+ if( rCurrentShell.IsA( TYPE( SwEditShell ) ) )
+ static_cast<SwEditShell*>(&rCurrentShell)->StartAction();
else
- pSh->StartAction();
- pSh = static_cast<SwViewShell *>(pSh->GetNext());
- } while(pSh != this);
+ rCurrentShell.StartAction();
+ }
}
void SwEditShell::EndAllAction()
commit 8347b140c9533c95891b0e4ad158b6eb9d7f0e1d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:32:21 2014 +0100
use C++11 iteration
Change-Id: If660a785dba2fd6c2e53a9bc0b93042359f5eaa7
diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index f62eaa7..2948ad2 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -59,14 +59,11 @@ const SwRangeRedline& SwEditShell::GetRedline( sal_uInt16 nPos ) const
static void lcl_InvalidateAll( SwViewShell* pSh )
{
- SwViewShell *pStop = pSh;
- do
+ for(SwViewShell& rCurrentShell : pSh->GetRingContainer())
{
- if ( pSh->GetWin() )
- pSh->GetWin()->Invalidate();
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
-
- } while ( pSh != pStop );
+ if ( rCurrentShell.GetWin() )
+ rCurrentShell.GetWin()->Invalidate();
+ }
}
bool SwEditShell::AcceptRedline( sal_uInt16 nPos )
commit 6fa11c72cca11062ddd63e095445e1ad2faee24b
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:29:53 2014 +0100
use C++11 iteration
Change-Id: I35592172210b83cc7d24308c001dd73bdf30c01b
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 7b8237b..e118362 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -697,14 +697,12 @@ const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const
{
const SwNumRule* pNumRuleAtCurrentSelection = NULL;
- const SwPaM* pCurrentCrsr = GetCrsr();
bool bDifferentNumRuleFound = false;
- const SwPaM* pCrsr = pCurrentCrsr;
- do
+ for(const SwPaM& rCurrentCrsr : GetCrsr()->GetRingContainer())
{
- const SwNodeIndex aEndNode = pCrsr->End()->nNode;
+ const SwNodeIndex aEndNode = rCurrentCrsr.End()->nNode;
- for ( SwNodeIndex aNode = pCrsr->Start()->nNode; aNode <= aEndNode; aNode++ )
+ for ( SwNodeIndex aNode = rCurrentCrsr.Start()->nNode; aNode <= aEndNode; aNode++ )
{
const SwNumRule* pNumRule = GetDoc()->GetNumRuleAtPos( SwPosition( aNode ) );
if ( pNumRule == NULL )
@@ -725,9 +723,9 @@ const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const
}
}
}
-
- pCrsr = static_cast< const SwPaM* >(pCrsr->GetNext());
- } while ( !bDifferentNumRuleFound && pCrsr != pCurrentCrsr );
+ if(bDifferentNumRuleFound)
+ break;
+ }
return pNumRuleAtCurrentSelection;
}
commit 369f01170266e60f1af42418297d48f36b5f7a1b
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:26:09 2014 +0100
use C++11 iteration
Change-Id: Ib8245b8a4b653cca36e5782eaa53cd2a7d64d295
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 33c5e06..7b8237b 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -30,10 +30,8 @@
SwPamRanges::SwPamRanges( const SwPaM& rRing )
{
- const SwPaM* pTmp = &rRing;
- do {
- Insert( pTmp->GetMark()->nNode, pTmp->GetPoint()->nNode );
- } while( &rRing != ( pTmp = static_cast<const SwPaM*>(pTmp->GetNext()) ));
+ for(const SwPaM& rTmp : rRing.GetRingContainer())
+ Insert( rTmp.GetMark()->nNode, rTmp.GetPoint()->nNode );
}
void SwPamRanges::Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 )
commit 233299e3fc14bf17d6cd6277ae8264247d637d79
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:22:44 2014 +0100
use C++11 iteration
Change-Id: I24ccf954176f93f89f6e075907bd69cdf225458a
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 9a86337..617a4e3 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -505,16 +505,15 @@ void SwEditShell::ReplaceDropTxt( const OUString &rStr, SwPaM* pPaM )
OUString SwEditShell::Calculate()
{
OUString aFormel; // the final formula
- SwPaM *pPaMLast = static_cast<SwPaM*>(GetCrsr()->GetNext()),
- *pPaM = pPaMLast; // cursor pointers
SwCalc aCalc( *GetDoc() );
const CharClass& rCC = GetAppCharClass();
- do {
- SwTxtNode* pTxtNd = pPaM->GetNode().GetTxtNode();
+ for(SwPaM& rCurrentPaM : GetCrsr()->GetNext()->GetRingContainer())
+ {
+ SwTxtNode* pTxtNd = rCurrentPaM.GetNode().GetTxtNode();
if(pTxtNd)
{
- const SwPosition *pStart = pPaM->Start(), *pEnd = pPaM->End();
+ const SwPosition *pStart = rCurrentPaM.Start(), *pEnd = rCurrentPaM.End();
const sal_Int32 nStt = pStart->nContent.GetIndex();
OUString aStr = pTxtNd->GetExpandTxt( nStt, pEnd->nContent.
GetIndex() - nStt );
@@ -561,7 +560,7 @@ OUString SwEditShell::Calculate()
aFormel += OUString(ch);
}
}
- } while( pPaMLast != (pPaM = static_cast<SwPaM*>(pPaM->GetNext())) );
+ }
return aCalc.GetStrResult( aCalc.Calculate(aFormel) );
}
commit 24c1c91b181a506acbd16998c95aff0bc2239b20
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:19:27 2014 +0100
use C++11 iteration
Change-Id: I78423acfe10d7972e4aad5dc90cb517a2ba72400
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 2699984..9a86337 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -94,27 +94,27 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints )
IDocumentContentOperations::INS_EMPTYEXPAND)
: IDocumentContentOperations::INS_EMPTYEXPAND;
- SwPaM *_pStartCrsr = getShellCrsr( true ), *__pStartCrsr = _pStartCrsr;
- do {
+ for(SwPaM& rCurrentCrsr : getShellCrsr( true )->GetRingContainer())
+ {
//OPT: GetSystemCharSet
const bool bSuccess =
- GetDoc()->getIDocumentContentOperations().InsertString(*_pStartCrsr, rStr, nInsertFlags);
+ GetDoc()->getIDocumentContentOperations().InsertString(rCurrentCrsr, rStr, nInsertFlags);
OSL_ENSURE( bSuccess, "Doc->Insert() failed." );
if (bSuccess)
{
- GetDoc()->UpdateRsid( *_pStartCrsr, rStr.getLength() );
+ GetDoc()->UpdateRsid( rCurrentCrsr, rStr.getLength() );
// Set paragraph rsid if beginning of paragraph
SwTxtNode *const pTxtNode =
- _pStartCrsr->GetPoint()->nNode.GetNode().GetTxtNode();
+ rCurrentCrsr.GetPoint()->nNode.GetNode().GetTxtNode();
if( pTxtNode && pTxtNode->Len() == 1)
GetDoc()->UpdateParRsid( pTxtNode );
}
- SaveTblBoxCntnt( _pStartCrsr->GetPoint() );
+ SaveTblBoxCntnt( rCurrentCrsr.GetPoint() );
- } while( (_pStartCrsr = static_cast<SwPaM *>(_pStartCrsr->GetNext() )) != __pStartCrsr );
+ }
}
// calculate cursor bidi level
commit 37132921c83265c2a46327a2de295f8e2cf84fd2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:15:13 2014 +0100
use C++11 iteration
Change-Id: I94b45f984be471f77ed6b11367d08c7af1ac9bac
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 3e4f06d..4a2a634 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -264,15 +264,15 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
#if OSL_DEBUG_LEVEL > 0
// check if the indices are registered in the correct nodes
{
- SwPaM* pCmp = (SwPaM*)pDestShell->GetCrsr(); // store pointer to cursor
- do {
- OSL_ENSURE( pCmp->GetPoint()->nContent.GetIdxReg()
- == pCmp->GetCntntNode(), "Point in wrong Node" );
- OSL_ENSURE( pCmp->GetMark()->nContent.GetIdxReg()
- == pCmp->GetCntntNode(false), "Mark in wrong Node" );
- bool bTst = *pCmp->GetPoint() == *pCmp->GetMark();
+ for(SwPaM& rCmp : pDestShell->GetCrsr()->GetRingContainer())
+ {
+ OSL_ENSURE( rCmp.GetPoint()->nContent.GetIdxReg()
+ == rCmp.GetCntntNode(), "Point in wrong Node" );
+ OSL_ENSURE( rCmp.GetMark()->nContent.GetIdxReg()
+ == rCmp.GetCntntNode(false), "Mark in wrong Node" );
+ bool bTst = *rCmp.GetPoint() == *rCmp.GetMark();
(void) bTst;
- } while( pDestShell->GetCrsr() != ( pCmp = static_cast<SwPaM*>(pCmp->GetNext()) ) );
+ }
}
#endif
commit d2043e583a5e42d3a55abde1bd658ece18c3aed9
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:12:09 2014 +0100
use C++11 iteration
Change-Id: I8a05445fe59c68b867a5ebf7291df0cfd07c0fb9
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 48f08c0..3d8a190 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -407,12 +407,12 @@ bool SwEditShell::SetCurFtn( const SwFmtFtn& rFillFtn )
bool bChgd = false;
StartAllAction();
- SwPaM* pCrsr = GetCrsr(), *pFirst = pCrsr;
- do {
+ for(SwPaM& rCrsr : GetCrsr()->GetRingContainer())
+ {
bChgd |=
- mpDoc->SetCurFtn( *pCrsr, rFillFtn.GetNumStr(), rFillFtn.GetNumber(), rFillFtn.IsEndNote() );
+ mpDoc->SetCurFtn( rCrsr, rFillFtn.GetNumStr(), rFillFtn.GetNumber(), rFillFtn.IsEndNote() );
- } while( pFirst != ( pCrsr = static_cast<SwPaM*>(pCrsr->GetNext()) ));
+ }
EndAllAction();
return bChgd;
commit 5b9b4eb0b143832bceed681ab653be94862289a2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:10:25 2014 +0100
use C++11 iteration
Change-Id: I29172f321ebb040278cc4d59ed193973ec6e2af0
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 145c975..48f08c0 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -285,15 +285,14 @@ SwTxtFmtColl* SwEditShell::GetPaMTxtFmtColl( SwPaM* pPaM ) const
std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> SwEditShell::GetItemWithPaM( sal_uInt16 nWhich )
{
std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> vItem;
- SwPaM* pPaM = GetCrsr();
- SwPaM* pStartPaM = pPaM;
- do { // for all the point and mark (selections)
+ for(SwPaM& rCurrentPaM : GetCrsr()->GetRingContainer())
+ { // for all the point and mark (selections)
// get the start and the end node of the current selection
- sal_uLong nSttNd = pPaM->Start()->nNode.GetIndex(),
- nEndNd = pPaM->End()->nNode.GetIndex();
- sal_Int32 nSttCnt = pPaM->Start()->nContent.GetIndex();
- sal_Int32 nEndCnt = pPaM->End()->nContent.GetIndex();
+ sal_uLong nSttNd = rCurrentPaM.Start()->nNode.GetIndex(),
+ nEndNd = rCurrentPaM.End()->nNode.GetIndex();
+ sal_Int32 nSttCnt = rCurrentPaM.Start()->nContent.GetIndex();
+ sal_Int32 nEndCnt = rCurrentPaM.End()->nContent.GetIndex();
SwPaM* pNewPaM = 0;
const SfxPoolItem* pItem = 0;
@@ -379,7 +378,7 @@ std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> SwEditShell
}
}
}
- } while ( ( pPaM = static_cast<SwPaM*>(pPaM->GetNext()) ) != pStartPaM );
+ }
return vItem;
}
commit c2276599680c6916f85be6e6a9a859720ec14c6d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:07:09 2014 +0100
use C++11 iteration
Change-Id: I0a220d6cec1f50e3bfb5ae3c4eb7fd43836236f8
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 3413731..145c975 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -243,12 +243,12 @@ SwTxtFmtColl* SwEditShell::GetPaMTxtFmtColl( SwPaM* pPaM ) const
// number of nodes the function have explored so far
sal_uInt16 numberOfLookup = 0;
- SwPaM* pStartPaM = pPaM;
- do { // for all the point and mark (selections)
+ for(SwPaM& rCurrentPaM : pPaM->GetRingContainer())
+ { // for all the point and mark (selections)
// get the start and the end node of the current selection
- sal_uLong nSttNd = pPaM->GetMark()->nNode.GetIndex(),
- nEndNd = pPaM->GetPoint()->nNode.GetIndex();
+ sal_uLong nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(),
+ nEndNd = rCurrentPaM.GetPoint()->nNode.GetIndex();
// reverse start and end if they aren't sorted correctly
if( nSttNd > nEndNd )
@@ -276,7 +276,7 @@ SwTxtFmtColl* SwEditShell::GetPaMTxtFmtColl( SwPaM* pPaM ) const
return pFmt;
}
}
- } while ( ( pPaM = static_cast<SwPaM*>(pPaM->GetNext()) ) != pStartPaM );
+ }
// if none of the selected node contain a named paragraph format
return NULL;
commit b4f8a3dd1030151e593ba8988c1e5648b6bbdab9
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:05:29 2014 +0100
use C++11 iteration
Change-Id: Ib8ab87e5581cd4026c5571becc58c9b7c07cbdbe
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 7cc5a30..3413731 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -189,12 +189,12 @@ bool SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const
SfxItemSet aSet( *rSet.GetPool(), rSet.GetRanges() );
SfxItemSet* pSet = &rSet;
- SwPaM* pStartPaM = pPaM;
- do { // for all the point and mark (selections)
+ for(SwPaM& rCurrentPaM : pPaM->GetRingContainer())
+ { // for all the point and mark (selections)
// get the start and the end node of the current selection
- sal_uLong nSttNd = pPaM->GetMark()->nNode.GetIndex(),
- nEndNd = pPaM->GetPoint()->nNode.GetIndex();
+ sal_uLong nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(),
+ nEndNd = rCurrentPaM.GetPoint()->nNode.GetIndex();
// reverse start and end if there number aren't sorted correctly
if( nSttNd > nEndNd )
@@ -228,7 +228,7 @@ bool SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const
if (numberOfLookup >= getMaxLookup())
return false;
}
- } while ( ( pPaM = static_cast<SwPaM*>(pPaM->GetNext()) ) != pStartPaM );
+ }
return true;
}
commit ecb4e05fb2019bc9c8ea0db40313dbe25d8ec707
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:03:45 2014 +0100
use C++11 iteration
Change-Id: I83bed43706cc1dcc17f1b1f37404340ee13afaa4
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index bc4651b..7cc5a30 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -73,13 +73,13 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
SfxItemSet aSet( *rSet.GetPool(), rSet.GetRanges() );
SfxItemSet *pSet = &rSet;
- SwPaM* pStartPaM = pPaM;
- do {
+ for(SwPaM& rCurrentPaM : pPaM->GetRingContainer())
+ {
// #i27615# if the cursor is in front of the numbering label
// the attributes to get are those from the numbering format.
- if (pPaM->IsInFrontOfLabel())
+ if (rCurrentPaM.IsInFrontOfLabel())
{
- SwTxtNode * pTxtNd = pPaM->GetPoint()->nNode.GetNode().GetTxtNode();
+ SwTxtNode * pTxtNd = rCurrentPaM.GetPoint()->nNode.GetNode().GetTxtNode();
if (pTxtNd)
{
@@ -108,10 +108,10 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
continue;
}
- sal_uLong nSttNd = pPaM->GetMark()->nNode.GetIndex(),
- nEndNd = pPaM->GetPoint()->nNode.GetIndex();
- sal_Int32 nSttCnt = pPaM->GetMark()->nContent.GetIndex();
- sal_Int32 nEndCnt = pPaM->GetPoint()->nContent.GetIndex();
+ sal_uLong nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(),
+ nEndNd = rCurrentPaM.GetPoint()->nNode.GetIndex();
+ sal_Int32 nSttCnt = rCurrentPaM.GetMark()->nContent.GetIndex();
+ sal_Int32 nEndCnt = rCurrentPaM.GetPoint()->nContent.GetIndex();
if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
{
@@ -165,7 +165,7 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
pSet = &aSet;
}
- } while ( ( pPaM = static_cast<SwPaM*>(pPaM->GetNext()) ) != pStartPaM );
+ }
return true;
}
commit dae21218d26570e09d0ccf097ccb38d5308e2ae2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 17:01:22 2014 +0100
use C++11 iteration
Change-Id: Idfa3fa4c2279137075acff9c12f26ebcaeb59ec0
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 868818b..56a1a33 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -41,10 +41,8 @@ void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM )
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_RESETATTR, NULL);
}
- SwPaM* pStartCrsr = pCrsr;
- do {
- GetDoc()->ResetAttrs(*pCrsr, true, attrs);
- } while ( ( pCrsr = static_cast< SwPaM* >( pCrsr->GetNext() ) ) != pStartCrsr );
+ for(SwPaM& rCurCrsr : pCrsr->GetRingContainer())
+ GetDoc()->ResetAttrs(rCurCrsr, true, attrs);
if( bUndoGroup )
{
commit c07f3fbc961b4e5cd6619a64b706bb361f8bbe70
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:58:56 2014 +0100
use C++11 iteration
Change-Id: Iec8b1f86e4fb243127fcf12bd258465bd8a5b4fe
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 8f16eaf..868818b 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -136,15 +136,14 @@ void SwEditShell::SetAttrSet( const SfxItemSet& rSet, sal_uInt16 nFlags, SwPaM*
bool bIsTblMode = IsTableMode();
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
- SwPaM* pTmpCrsr = pCrsr;
- SwPaM* pStartPaM = pCrsr;
- do {
- if( pTmpCrsr->HasMark() && ( bIsTblMode ||
- *pTmpCrsr->GetPoint() != *pTmpCrsr->GetMark() ))
+ for(SwPaM& rTmpCrsr : pCrsr->GetRingContainer())
+ {
+ if( rTmpCrsr.HasMark() && ( bIsTblMode ||
+ *rTmpCrsr.GetPoint() != *rTmpCrsr.GetMark() ))
{
- GetDoc()->getIDocumentContentOperations().InsertItemSet(*pTmpCrsr, rSet, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertItemSet(rTmpCrsr, rSet, nFlags );
}
- } while ( ( pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext()) ) != pStartPaM );
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
}
commit 21bfc10b234991c51009e6b020eaa47de9dd2bff
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:55:15 2014 +0100
unnecessary cast
Change-Id: I7a5d7bd2685297c9ce29dfe6d421c679dec0294d
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 132501f..4326f71 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1196,7 +1196,7 @@ void SwAutoFormat::DelMoreLinesBlanks( bool bWithLineBreaks )
SwPaM* pNxt;
do {
- pNxt = static_cast<SwPaM*>(m_aDelPam.GetNext());
+ pNxt = m_aDelPam.GetNext();
if( pNxt->HasMark() && *pNxt->GetPoint() != *pNxt->GetMark() )
{
bool bHasBlnks = HasSelBlanks( *pNxt );
commit ada94e72afeb2371e476177cb0936722fbb5db73
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:53:44 2014 +0100
unnecessary cast
Change-Id: Ib00a00332c1a8841106243a57f555b543037b0de
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
index 1793c19..048394c 100644
--- a/sw/source/core/draw/dpage.cxx
+++ b/sw/source/core/draw/dpage.cxx
@@ -86,7 +86,7 @@ const SdrPageGridFrameList* SwDPage::GetGridFrameList(
{
SwViewShell *pSh = static_cast< SwDrawModel* >(GetModel())->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
while (pSh && pSh->Imp()->GetPageView() != pPV)
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
+ pSh = pSh->GetNext();
if (pSh)
{
if ( pGridLst )
commit 4fbe3e79c4111355809ab9881caf62c3af4f2eb4
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:52:04 2014 +0100
unnecessary cast
Change-Id: I160bfc482a9f7bcdea1e3104e6172f142db6d9d6
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 3dd8e3b..7d93642 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1058,7 +1058,7 @@ void SwDrawContact::Changed( const SdrObject& rObj,
}
//Put on Action, but not if presently anywhere an action runs.
- SwViewShell *pSh = 0, *pOrg;
+ SwViewShell *pSh = nullptr, *pOrg;
SwRootFrm *pTmpRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
if ( pTmpRoot && pTmpRoot->IsCallbackActionEnabled() )
{
@@ -1067,9 +1067,9 @@ void SwDrawContact::Changed( const SdrObject& rObj,
if ( pSh )
do
{ if ( pSh->Imp()->IsAction() || pSh->Imp()->IsIdleAction() )
- pSh = 0;
+ pSh = nullptr;
else
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
+ pSh = pSh->GetNext();
} while ( pSh && pSh != pOrg );
commit fef168c1a86d4da5f34c7fb9be5c40748c01b5e4
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:49:44 2014 +0100
unnecessary cast
Change-Id: I4cfd4875262b8c2efeede0475f7be1b5a878ecf8
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 16018c1..8b8a223 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -2065,7 +2065,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
do {
nRet += pTmp->InsertRedline();
- } while( pRing != ( pTmp = static_cast<_SaveMergeRedlines*>(pTmp->GetNext()) ));
+ } while( pRing != ( pTmp = pTmp->GetNext()) );
while( pRing != pRing->GetNext() )
delete pRing->GetNext();
commit 3eea18a04536e6e4b02b14ae3408172703b6cfa6
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:49:18 2014 +0100
unnecessary cast
Change-Id: I5877b60addaf12ddb0242e4b6716c14bc8beda3a
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 0517fe7..16018c1 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1756,7 +1756,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, true ));
rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
}
- } while( pInsRing != ( pTmp = static_cast<SwPaM*>(pTmp->GetNext()) ));
+ } while( pInsRing != ( pTmp = pTmp->GetNext()) );
}
}
commit 8136a1fd9e04bb86ad9a851acbc810fa8e080f03
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:48:55 2014 +0100
unnecessary cast
Change-Id: Idc6c92fab2e0baddde535a8a2a4b6e208b9c0d64
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index a8e280a..0517fe7 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1745,7 +1745,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
}
}
else
- pTmp = static_cast<SwPaM*>(pTmp->GetNext());
+ pTmp = pTmp->GetNext();
} while( pInsRing != pTmp );
}
commit 697cb1f5e1adaddfd7d45486996f54fb969b95cc
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:48:37 2014 +0100
unnecessary cast
Change-Id: I7b8bbf5e2577fc5f3a0a40552a0f2f410bd55a6a
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index a908a2f..a8e280a 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1740,7 +1740,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
else
{
// are consecutive, so combine
- rSttEnd = *static_cast<SwPaM*>(pTmp->GetNext())->End();
+ rSttEnd = *(pTmp->GetNext())->End();
delete pTmp->GetNext();
}
}
commit 08bc3e1fa36e3b4c88033594fb48a788618d37b4
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:48:20 2014 +0100
unnecessary cast
Change-Id: Ic3d612274809891c3e135d4f05d7d3bdab65b3fb
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 54fb379..a908a2f 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1723,7 +1723,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
const SwCntntNode* pCNd;
do {
SwPosition& rSttEnd = *pTmp->End(),
- & rEndStt = *static_cast<SwPaM*>(pTmp->GetNext())->Start();
+ & rEndStt = *(pTmp->GetNext())->Start();
if( rSttEnd == rEndStt ||
(!rEndStt.nContent.GetIndex() &&
rEndStt.nNode.GetIndex() - 1 == rSttEnd.nNode.GetIndex() &&
commit 8748be61ee16c699d3ff78de79efc4996c9daa84
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:47:47 2014 +0100
unnecessary cast
Change-Id: I042407e9a34c0158ed46d4483f0eb5e62fe461bc
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index d0fbf34..54fb379 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1713,7 +1713,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
pTmp->GetPoint()->nContent.Assign( pContentNode,
(pContentNode) ? pContentNode->Len() : 0 );
}
- } while( pInsRing != ( pTmp = static_cast<SwPaM*>(pTmp->GetNext()) ));
+ } while( pInsRing != ( pTmp = pTmp->GetNext()) );
SwRedlineData aRedlnData( nsRedlineType_t::REDLINE_INSERT, nAuthor, aTimeStamp,
OUString(), 0, 0 );
commit eedf2d6b7c18d0b8fec010624c3a55b9926041f0
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:47:23 2014 +0100
unnecessary cast
Change-Id: I78ca4f79e9d044349e117401357ec22538c43c33
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 729323b..d0fbf34 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1691,7 +1691,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
}
rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( aRedlnData, *pTmp ), true );
- } while( pDelRing != ( pTmp = static_cast<SwPaM*>(pTmp->GetNext()) ));
+ } while( pDelRing != ( pTmp = pTmp->GetNext()) );
}
pTmp = pInsRing;
commit 32a39571c83be6181499fe008190b9a8ba8558fc
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:46:37 2014 +0100
use C++11 iteration
Change-Id: I887b402cfd0d4556e0e0b4fd45ec6fe061c84e06
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index 7cf0b66..353f6f7 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -408,22 +408,22 @@ void CntntIdxStoreImpl::SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 n
SwCrsrShell* pShell = pDoc->GetEditShell();
if( !pShell )
return;
- SwViewShell *_pStartShell = pShell;
- do {
- if( _pStartShell->IsA( TYPE( SwCrsrShell )) )
+ for(SwViewShell& rCurShell : pShell->GetRingContainer())
+ {
+ if( rCurShell.IsA( TYPE( SwCrsrShell )) )
{
- SwPaM *_pStkCrsr = static_cast<SwCrsrShell*>(_pStartShell)->GetStkCrsr();
+ SwPaM *_pStkCrsr = static_cast<SwCrsrShell*>(&rCurShell)->GetStkCrsr();
if( _pStkCrsr )
do {
lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, *_pStkCrsr);
} while ( (_pStkCrsr != 0 ) &&
- ((_pStkCrsr = _pStkCrsr->GetNext()) != static_cast<SwCrsrShell*>(_pStartShell)->GetStkCrsr()) );
+ ((_pStkCrsr = _pStkCrsr->GetNext()) != static_cast<SwCrsrShell*>(&rCurShell)->GetStkCrsr()) );
- FOREACHPAM_START( static_cast<SwCrsrShell*>(_pStartShell)->_GetCrsr() )
+ FOREACHPAM_START( static_cast<SwCrsrShell*>(&rCurShell)->_GetCrsr() )
lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, *PCURCRSR);
FOREACHPAM_END()
}
- } while((_pStartShell = static_cast<SwViewShell*>(_pStartShell->GetNext()))!= pShell );
+ }
}
void CntntIdxStoreImpl::RestoreShellCrsrs(updater_t& rUpdater)
commit 7299e98ca06615c3035ee02c464f4b2ec2934b48
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:42:19 2014 +0100
unnecessary cast
Change-Id: I9b77a5af763977836058f6bd435a5bdb78fdf522
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index 35f4829..7cf0b66 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -417,7 +417,7 @@ void CntntIdxStoreImpl::SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 n
do {
lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, *_pStkCrsr);
} while ( (_pStkCrsr != 0 ) &&
- ((_pStkCrsr = static_cast<SwPaM *>(_pStkCrsr->GetNext())) != static_cast<SwCrsrShell*>(_pStartShell)->GetStkCrsr()) );
+ ((_pStkCrsr = _pStkCrsr->GetNext()) != static_cast<SwCrsrShell*>(_pStartShell)->GetStkCrsr()) );
FOREACHPAM_START( static_cast<SwCrsrShell*>(_pStartShell)->_GetCrsr() )
lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, *PCURCRSR);
commit d1c6e5fccda936387242663aa041156c541df928
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:38:47 2014 +0100
unnecessary cast
Change-Id: Ic5a6dfb58ea2545c8474bff8841c650b3eb2c93f
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index a565420..4bb9588 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -611,7 +611,7 @@ short SwShellCrsr::MaxReplaceArived()
{
for( nActCnt = aArr[n]; nActCnt--; )
pSh->StartAction();
- pSh = static_cast<SwViewShell*>(pSh->GetNext());
+ pSh = pSh->GetNext();
}
}
else
commit ff517661da8ed0e33a674fa05aeb25ade6cd1bd8
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:38:07 2014 +0100
unnecessary cast
Change-Id: I8e4f11fe8d6ed444e3f863a15745145e2ca359e1
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index a7d3110..a565420 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -600,7 +600,7 @@ short SwShellCrsr::MaxReplaceArived()
for( nActCnt = 0; pSh->ActionPend(); ++nActCnt )
pSh->EndAction();
aArr.push_back( nActCnt );
- } while( pShell != ( pSh = static_cast<SwViewShell*>(pSh->GetNext()) ) );
+ } while( pShell != ( pSh = pSh->GetNext()) );
{
nRet = MessageDialog(pDlg, "AskSearchDialog",
commit 8b6a3c3b02c7e1b38d3f8e99e4bb9b6a9d7adfb8
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:36:52 2014 +0100
add note about fishy dynamic_cast
Change-Id: Icabb2c9574083db73b8d0a40095fa18f84d7d6ab
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 8c1b5d1..a7d3110 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -571,6 +571,8 @@ void SwShellCrsr::Invalidate( const SwRect& rRect )
void SwShellCrsr::Hide()
{
SwShellCrsr * pTmp = this;
+ // TODO: this doesnt look sane: if the dynamic_cast ever returns a nullptr,
+ // the next pTmp->GetNext() call is a nullptr deref
do {
if (pTmp)
pTmp->SwSelPaintRects::Hide();
commit e6678eba1c3d768d4cc468721ee865814d13cb4f
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Dec 3 16:32:24 2014 +0100
use C++11 iteration
Change-Id: I780df3b23e6ee9ad61dcd57472d0efb37d640d15
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index aa4a78d..2eabdde 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -882,13 +882,13 @@ void SwCrsrShell::ClearTblBoxCntnt()
bool SwCrsrShell::EndAllTblBoxEdit()
{
bool bRet = false;
- SwViewShell *pSh = this;
- do {
- if( pSh->IsA( TYPE( SwCrsrShell ) ) )
- bRet |= static_cast<SwCrsrShell*>(pSh)->CheckTblBoxCntnt(
- static_cast<SwCrsrShell*>(pSh)->m_pCurCrsr->GetPoint() );
+ for(SwViewShell& rSh : GetRingContainer())
+ {
+ if( rSh.IsA( TYPE( SwCrsrShell ) ) )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list