[Libreoffice-commits] core.git: 15 commits - sw/inc sw/source

2015-04-05 Thread Matteo Casalin
 sw/inc/docary.hxx  |6 -
 sw/inc/section.hxx |2 
 sw/source/core/doc/docredln.cxx|  140 ++-
 sw/source/core/doc/doctxm.cxx  |  139 +++
 sw/source/core/doc/tblcpy.cxx  |  110 --
 sw/source/core/doc/tblrwcl.cxx |  221 +
 sw/source/core/docnode/section.cxx |3 
 sw/source/ui/dialog/uiregionsw.cxx |   31 ++---
 8 files changed, 304 insertions(+), 348 deletions(-)

New commits:
commit 91c7343da2400ea1ebf4fef3c309e8e7b8558b77
Author: Matteo Casalin matteo.casa...@yahoo.com
Date:   Wed Mar 25 22:08:38 2015 +0100

Use more proper integer types and range-for loops, reduce scope

Change-Id: Ibcf9d404b2f189fb486c5a26c2b8cfe198860b73

diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 1cee55f..2fed3d8 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -326,7 +326,7 @@ static void lcl_CopyCol( _FndBox  rFndBox, _CpyPara *const 
pCpyPara)
 // The first Line should be enough
 _FndBoxes const rFndBoxes = pCmpLine-GetBoxes();
 long nSz = 0;
-for( sal_uInt16 n = rFndBoxes.size(); n; )
+for( auto n = rFndBoxes.size(); n; )
 {
 nSz += rFndBoxes[--n].GetBox()-
 GetFrmFmt()-GetFrmSize().GetWidth();
@@ -459,8 +459,8 @@ static void lcl_InsCol( _FndLine* pFndLn, _CpyPara 
rCpyPara, sal_uInt16 nCpyCnt
 !( pFBox = pFndLn-GetBoxes()[0] )-GetBox()-GetSttNd() )
 {
 // A Box with multiple Lines, so insert into these Lines
-for( sal_uInt16 n = 0; n  pFBox-GetLines().size(); ++n )
-lcl_InsCol( pFBox-GetLines()[ n ], rCpyPara, nCpyCnt, bBehind );
+for( auto rLine : pFBox-GetLines() )
+lcl_InsCol( rLine, rCpyPara, nCpyCnt, bBehind );
 }
 else
 {
@@ -528,8 +528,8 @@ bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes 
rBoxes, sal_uInt16 nCnt,
 _CpyTabFrms aTabFrmArr;
 _CpyPara aCpyPara( pTblNd, nCnt, aTabFrmArr );
 
-for( sal_uInt16 n = 0; n  aFndBox.GetLines().size(); ++n )
-lcl_InsCol( aFndBox.GetLines()[ n ], aCpyPara, nCnt, bBehind );
+for( auto rLine : aFndBox.GetLines() )
+lcl_InsCol( rLine, aCpyPara, nCnt, bBehind );
 
 // clean up this Line's structure once again, generally all of them
 GCLines();
@@ -656,9 +656,8 @@ static void lcl_LastBoxSetWidth( SwTableBoxes rBoxes, 
const long nOffset,
 static void lcl_LastBoxSetWidthLine( SwTableLines rLines, const long nOffset,
 bool bFirst, SwShareBoxFmts rShareFmts )
 {
-for ( sal_uInt16 i = 0; i  rLines.size(); ++i )
-::lcl_LastBoxSetWidth( rLines[i]-GetTabBoxes(), nOffset, bFirst,
-rShareFmts );
+for ( auto pLine : rLines )
+::lcl_LastBoxSetWidth( pLine-GetTabBoxes(), nOffset, bFirst, 
rShareFmts );
 }
 
 static void lcl_LastBoxSetWidth( SwTableBoxes rBoxes, const long nOffset,
@@ -852,14 +851,17 @@ lcl_FndNxtPrvDelBox( const SwTableLines rTblLns,
 SwTableLine* pLine = rTblLns[ nLinePos ];
 SwTwips nFndBoxWidth = 0;
 SwTwips nFndWidth = nBoxStt + nBoxWidth;
-sal_uInt16 nBoxCnt = pLine-GetTabBoxes().size();
 
 pFndBox = pLine-GetTabBoxes()[ 0 ];
-for( sal_uInt16 n = 0; 0  nFndWidth  n  nBoxCnt; ++n )
+for( auto pBox : pLine-GetTabBoxes() )
 {
-pFndBox = pLine-GetTabBoxes()[ n ];
-nFndWidth -= (nFndBoxWidth = pFndBox-GetFrmFmt()-
-GetFrmSize().GetWidth());
+if ( nFndWidth = 0 )
+{
+break;
+}
+pFndBox = pBox;
+nFndBoxWidth = pFndBox-GetFrmFmt()-GetFrmSize().GetWidth();
+nFndWidth -= nFndBoxWidth;
 }
 
 // Find the first ContentBox
@@ -1207,7 +1209,6 @@ bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes 
rBoxes, sal_uInt16 nCnt )
 
 _CpyTabFrms aFrmArr;
 std::vectorSwTableBoxFmt* aLastBoxArr;
-sal_uInt16 nFndPos;
 for (size_t n = 0; n  aSelBoxes.size(); ++n)
 {
 SwTableBox* pSelBox = aSelBoxes[n];
@@ -1225,7 +1226,7 @@ bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes 
rBoxes, sal_uInt16 nCnt )
 SwTableBoxFmt* pLastBoxFmt;
 _CpyTabFrm aFindFrm( static_castSwTableBoxFmt*(pSelBox-GetFrmFmt()) 
);
 _CpyTabFrms::const_iterator itFind = aFrmArr.lower_bound( aFindFrm );
-nFndPos = itFind - aFrmArr.begin();
+const size_t nFndPos = itFind - aFrmArr.begin();
 if( itFind == aFrmArr.end() || !(*itFind == aFindFrm) )
 {
 // Change the FrmFmt
@@ -1273,7 +1274,7 @@ bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes 
rBoxes, sal_uInt16 nCnt )
 

[Libreoffice-commits] core.git: 15 commits - sw/inc sw/source

2015-01-23 Thread Bjoern Michaelsen
 sw/inc/viewsh.hxx|8 
 sw/source/core/crsr/crsrsh.cxx   |   10 -
 sw/source/core/crsr/viscrs.cxx   |   36 ++--
 sw/source/core/doc/DocumentDeviceManager.cxx |8 +---
 sw/source/core/doc/DocumentStatisticsManager.cxx |   19 --
 sw/source/core/doc/docdesc.cxx   |   22 ++--
 sw/source/core/doc/doclay.cxx|   32 +++---
 sw/source/core/doc/notxtfrm.cxx  |   40 ++-
 sw/source/core/draw/dcontact.cxx |   28 
 sw/source/core/draw/dpage.cxx|   14 +---
 sw/source/core/layout/newfrm.cxx |   12 ++
 sw/source/core/text/frmcrsr.cxx  |2 -
 sw/source/core/view/viewsh.cxx   |9 +
 sw/source/core/view/vnew.cxx |   16 +++--
 sw/source/core/view/vprint.cxx   |2 -
 15 files changed, 133 insertions(+), 125 deletions(-)

New commits:
commit 0a77c9f15bbb38d8c281daef4512d570683d2cb7
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Fri Jan 23 23:11:32 2015 +0100

remove manual iteration in SwViewShell

Change-Id: Id7bd121067e86e4f8e4c3fe584cac05a85f47060

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 89ebbc6..6a73d55 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -586,14 +586,6 @@ public:
 /// Are we doing tiled rendering?
 bool isTiledRendering();
 
-SwViewShell* GetNext()
-{ return GetNextInRing(); }
-const SwViewShell* GetNext() const
-{ return GetNextInRing(); }
-SwViewShell* GetPrev()
-{ return GetPrevInRing(); }
-const SwViewShell* GetPrev() const
-{ return GetPrevInRing(); }
 };
 
 // manages global ShellPointer
commit 3dbd1e69b94b6e91db5ddc36ed6808d7be0a418c
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Fri Jan 23 23:10:43 2015 +0100

do not use manual iteration

Change-Id: If456086bc6195c04794178df22d9c937bb7073b4

diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index c5dead7..4c23e0d 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -119,7 +119,7 @@ bool sw_ChangeOffset( SwTxtFrm* pFrm, sal_Int32 nNew )
 SwViewShell* pVsh = pFrm-getRootFrm()-GetCurrShell();
 if( pVsh )
 {
-if( pVsh-GetNext() != pVsh ||
+if( pVsh-GetRingContainer().size()  1 ||
 ( pFrm-GetDrawObjs()  pFrm-GetDrawObjs()-size() ) )
 {
 if( !pFrm-GetOfst() )
commit 6bb2f330daab558730c0a1a267ac6d09c746d5ef
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Fri Jan 23 23:09:40 2015 +0100

do not use manual iteration

Change-Id: Ia7afbea8872618d070dbdf6029cef3cec2425f2c

diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index ef1d456..80ba9ce16 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -601,7 +601,7 @@ void SwViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption 
*pOpt, const SwPrintD
 pSh-maVisArea = aSwRect;
 
 if ( pSh-GetViewOptions()-getBrowseMode() 
- pSh-GetNext() == pSh )
+ pSh-GetRingContainer().size() == 1 )
 {
 pSh-CheckBrowseView( false );
 pSh-GetLayout()-Lower()-InvalidateSize();
commit f5c6391b2e3ef703bc4d4efd691f79f1605d5283
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Fri Jan 23 23:07:01 2015 +0100

do not use manual iteration

Change-Id: I1911b1dec2acd89c104c2b226fb212b7deb40c3b

diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 31d0de4..6a951a1 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -360,9 +360,19 @@ SwViewShell::~SwViewShell()
 if ( mpDoc )
 {
 GetLayout()-DeRegisterShell( this );
-if(mpDoc-getIDocumentLayoutAccess().GetCurrentViewShell()==this)
-mpDoc-getIDocumentLayoutAccess().SetCurrentViewShell( 
this-GetNext()!=this ?
-this-GetNext() : nullptr );
+auto rLayoutAccess(mpDoc-getIDocumentLayoutAccess());
+if(rLayoutAccess.GetCurrentViewShell()==this)
+{
+rLayoutAccess.SetCurrentViewShell(nullptr);
+for(SwViewShell rShell : GetRingContainer())
+{
+if(rShell != this)
+{
+rLayoutAccess.SetCurrentViewShell(rShell);
+break;
+}
+}
+}
 }
 
 delete mpTmpRef;
commit 512f85f07dc1483ea3ab328597092ec3170fbeaa
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Fri Jan 23 23:06:26 2015 +0100

do not use manual iteration

Change-Id: