[Libreoffice-commits] core.git: 16 commits - sw/inc sw/source
Matteo Casalin
matteo.casalin at yahoo.com
Sun May 3 13:32:58 PDT 2015
sw/inc/docufld.hxx | 2
sw/inc/edimp.hxx | 7 -
sw/source/core/edit/edattr.cxx | 2
sw/source/core/edit/ednumber.cxx | 22 ++--
sw/source/core/edit/edsect.cxx | 11 --
sw/source/core/edit/edtox.cxx | 10 -
sw/source/core/fields/authfld.cxx | 161 ++++++++++++-------------------
sw/source/core/fields/cellfml.cxx | 2
sw/source/core/fields/dbfld.cxx | 2
sw/source/core/fields/docufld.cxx | 16 +--
sw/source/core/fields/expfld.cxx | 26 ++---
sw/source/core/fields/reffld.cxx | 13 --
sw/source/core/frmedt/fecopy.cxx | 37 +++----
sw/source/core/frmedt/fefly1.cxx | 18 +--
sw/source/core/frmedt/feshview.cxx | 18 +--
sw/source/core/frmedt/tblsel.cxx | 41 ++++---
sw/source/core/unocore/unocrsrhelper.cxx | 4
sw/source/core/unocore/unoobj.cxx | 2
18 files changed, 179 insertions(+), 215 deletions(-)
New commits:
commit c4a8c34812e3b47ed96395ea0328b658949466fe
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 3 22:28:13 2015 +0200
Use range-based for loops, better integer types and avoid some casts
Change-Id: Ife8bb0bb1d20655c0526aad1d4921713c961eb7a
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 472be01..95fe266a 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -86,6 +86,7 @@ struct _CmpLPt
typedef o3tl::sorted_vector<_CmpLPt> _MergePos;
+
struct _Sort_CellFrm
{
const SwCellFrm* pFrm;
@@ -206,7 +207,7 @@ void GetTblSel( const SwCursor& rCrsr, SwSelBoxes& rBoxes,
for( ; nSttPos <= nEndPos; ++nSttPos )
{
pLine = rLines[ nSttPos ];
- for( sal_uInt16 n = pLine->GetTabBoxes().size(); n ; )
+ for( auto n = pLine->GetTabBoxes().size(); n ; )
{
SwTableBox* pBox = pLine->GetTabBoxes()[ --n ];
// check for cell protection??
@@ -466,10 +467,12 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd )
::MakeSelUnions( aUnions, pStart, pEnd, nsSwTblSearchType::TBLSEARCH_NO_UNION_CORRECT );
// find boxes for each entry and emit
- for( i = 0; i < aUnions.size() && bTblIsValid &&
- bValidChartSel; ++i )
+ for( auto & rSelUnion : aUnions )
{
- SwSelUnion *pUnion = &aUnions[i];
+ if (!bTblIsValid || !bValidChartSel)
+ break;
+
+ SwSelUnion *pUnion = &rSelUnion;
const SwTabFrm *pTable = pUnion->GetTable();
SWRECTFN( pTable )
@@ -879,9 +882,9 @@ bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam )
nEndIdx = rBox.GetSttNd()->EndOfSectionIndex(),
nIdx;
- for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
+ for( auto pFmt : rFmts )
{
- const SwFmtAnchor& rAnchor = rFmts[n]->GetAnchor();
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
const SwPosition* pAPos = rAnchor.GetCntntAnchor();
if (pAPos &&
((FLY_AT_PARA == rAnchor.GetAnchorId()) ||
@@ -934,11 +937,11 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
SWRECTFN( pStart->GetUpper() )
- for ( sal_uInt16 i = 0; i < aUnions.size(); ++i )
+ for ( auto & rSelUnion : aUnions )
{
- const SwTabFrm *pTabFrm = aUnions[i].GetTable();
+ const SwTabFrm *pTabFrm = rSelUnion.GetTable();
- SwRect &rUnion = aUnions[i].GetUnion();
+ SwRect &rUnion = rSelUnion.GetUnion();
// Skip any repeated headlines in the follow:
const SwLayoutFrm* pRow = pTabFrm->IsFollow() ?
@@ -1272,7 +1275,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
aPosArr[ 0 ].Y() ) :
0;
- for( sal_uInt16 n = 0; n < aPosArr.size(); ++n )
+ for( _MergePos::size_type n = 0; n < aPosArr.size(); ++n )
{
const _CmpLPt& rPt = aPosArr[ n ];
if( bCalcWidth )
@@ -1329,9 +1332,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
SwPaM aPam( aInsPos );
- for( sal_uInt16 n = 0; n < aPosArr.size(); ++n )
+ for( const auto &rPt : aPosArr )
{
- const _CmpLPt& rPt = aPosArr[ n ];
aPam.GetPoint()->nNode.Assign( *rPt.pSelBox->GetSttNd()->
EndOfSectionNode(), -1 );
SwCntntNode* pCNd = aPam.GetCntntNode();
@@ -1537,7 +1539,7 @@ static void lcl_FindStartEndRow( const SwLayoutFrm *&rpStart,
aEndArr.push_front( pTmp );
}
- for( sal_uInt16 n = 0; n < aEndArr.size() && n < aSttArr.size(); ++n )
+ for( std::deque<const SwLayoutFrm *>::size_type n = 0; n < aEndArr.size() && n < aSttArr.size(); ++n )
if( aSttArr[ n ] != aEndArr[ n ] )
{
// first unequal line or box - all odds are
@@ -1973,10 +1975,9 @@ bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv,
::MakeSelUnions( aUnions, pStart, pEnd, eSearchType );
// now search boxes for each entry and emit
- for ( sal_uInt16 i = 0; i < aUnions.size(); ++i )
+ for ( auto rSelUnion : aUnions )
{
- SwSelUnion *pUnion = &aUnions[i];
- const SwTabFrm *pTable = pUnion->GetTable();
+ const SwTabFrm *pTable = rSelUnion.GetTable();
// Skip any repeated headlines in the follow:
const SwLayoutFrm* pRow = pTable->IsFollow() ?
@@ -1985,14 +1986,14 @@ bool CheckSplitCells( const SwCursor& rCrsr, sal_uInt16 nDiv,
while ( pRow )
{
- if ( pRow->Frm().IsOver( pUnion->GetUnion() ) )
+ if ( pRow->Frm().IsOver( rSelUnion.GetUnion() ) )
{
const SwLayoutFrm *pCell = pRow->FirstCell();
while ( pCell && pRow->IsAnLower( pCell ) )
{
OSL_ENSURE( pCell->IsCellFrm(), "Frame without cell" );
- if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) )
+ if( ::IsFrmInTblSel( rSelUnion.GetUnion(), pCell ) )
{
if( (pCell->Frm().*fnRect->fnGetWidth)() < nMinValue )
return false;
@@ -2369,8 +2370,8 @@ void _FndBox::MakeFrms( SwTable &rTable )
// ???? or is this the last Follow of the table ????
pUpperFrm = pTable;
- for ( i = nStPos; (sal_uInt16)i <= nEndPos; ++i )
- ::lcl_InsertRow( *rTable.GetTabLines()[static_cast<sal_uInt16>(i)],
+ for ( sal_uInt16 j = nStPos; j <= nEndPos; ++j )
+ ::lcl_InsertRow( *rTable.GetTabLines()[j],
static_cast<SwLayoutFrm*>(pUpperFrm), pSibling );
if ( pUpperFrm->IsTabFrm() )
static_cast<SwTabFrm*>(pUpperFrm)->SetCalcLowers();
commit 0f88c2a7511b5db700751a5574078e51c4013d53
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 3 21:15:53 2015 +0200
Use auto and constify
Change-Id: Ib871b2c8bb5696bc7c31413548362410f0d35187
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 249f718..0e5b31d 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1028,7 +1028,7 @@ bool SwFEShell::IsObjSelectable( const Point& rPt )
{
SdrObject* pObj;
SdrPageView* pPV;
- sal_uInt16 nOld = pDView->GetHitTolerancePixel();
+ const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
bRet = pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMARKABLE );
@@ -1045,7 +1045,7 @@ SdrObject* SwFEShell::GetObjAt( const Point& rPt )
if( pDView )
{
SdrPageView* pPV;
- sal_uInt16 nOld = pDView->GetHitTolerancePixel();
+ const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
pDView->PickObj( rPt, pDView->getHitTolLog(), pRet, pPV, SdrSearchOptions::PICKMARKABLE );
@@ -1065,7 +1065,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
{
SdrObject* pObj;
SdrPageView* pPV;
- sal_uInt16 nOld(pDrawView->GetHitTolerancePixel());
+ const auto nOld(pDrawView->GetHitTolerancePixel());
pDrawView->SetHitTolerancePixel(pDrawView->GetMarkHdlSizePixel()/2);
bRet = pDrawView->PickObj(rPt, pDrawView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMARKABLE);
@@ -2513,7 +2513,7 @@ SwChainRet SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource,
SdrObject* pObj;
SdrPageView* pPView;
SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
- const sal_uInt16 nOld = pDView->GetHitTolerancePixel();
+ const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 0 );
if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SdrSearchOptions::PICKMARKABLE ) &&
pObj->ISA(SwVirtFlyDrawObj) )
@@ -2546,7 +2546,7 @@ SwChainRet SwFEShell::Chain( SwFrmFmt &rSource, const Point &rPt )
SdrObject* pObj;
SdrPageView* pPView;
SwDrawView *pDView = (SwDrawView*)Imp()->GetDrawView();
- const sal_uInt16 nOld = pDView->GetHitTolerancePixel();
+ const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 0 );
pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SdrSearchOptions::PICKMARKABLE );
pDView->SetHitTolerancePixel( nOld );
commit 3a9a754db00586e57021a2fd2202f0957d906d06
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 3 19:58:38 2015 +0200
Expand macro that is used just once
Change-Id: I93078315c6113bbde630ab8a2cb6c11668c9d041
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 9ba3d34..249f718 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -90,9 +90,6 @@
using namespace com::sun::star;
-// tolerance limit of Drawing-SS
-#define MINMOVE ((sal_uInt16)GetOut()->PixelToLogic(Size(Imp()->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width())
-
SwFlyFrm *GetFlyFromMarked( const SdrMarkList *pLst, SwViewShell *pSh )
{
if ( !pLst )
@@ -201,7 +198,10 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 nFlag, SdrObject *pObj )
}
else
{
- pDView->MarkObj( rPt, MINMOVE, bAddSelect, bEnterGroup );
+ // tolerance limit of Drawing-SS
+ const auto nHdlSizePixel = Imp()->GetDrawView()->GetMarkHdlSizePixel();
+ const short nMinMove = static_cast<short>(GetOut()->PixelToLogic(Size(nHdlSizePixel/2, 0)).Width());
+ pDView->MarkObj( rPt, nMinMove, bAddSelect, bEnterGroup );
}
const bool bRet = 0 != rMrkList.GetMarkCount();
commit c647fff0dbeb2bdcc6b79456988b1c514c79d8d8
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 3 19:22:22 2015 +0200
Use auto and range-based for loops
Change-Id: I5fecd9cfb64fee9d18e4491e6219c1b90e64ea7c
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index f6f1caa..72aa28d 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -907,9 +907,8 @@ void SwFEShell::GetPageObjs( std::vector<SwFrmFmt*>& rFillArr )
{
rFillArr.clear();
- for( sal_uInt16 n = 0; n < mpDoc->GetSpzFrmFmts()->size(); ++n )
+ for( auto pFmt : *mpDoc->GetSpzFrmFmts() )
{
- SwFrmFmt* pFmt = (*mpDoc->GetSpzFrmFmts())[n];
if (FLY_AT_PAGE == pFmt->GetAnchor().GetAnchorId())
{
rFillArr.push_back( pFmt );
@@ -929,9 +928,8 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrmFmt*>& rFillArr, int nOffse
SwRootFrm* pTmpRootFrm = GetLayout();
sal_uInt16 nMaxPage = pTmpRootFrm->GetPageNum();
bool bTmpAssert = false;
- for( sal_uInt16 n = 0; n < rFillArr.size(); ++n )
+ for( auto pFmt : rFillArr )
{
- SwFrmFmt* pFmt = rFillArr[n];
if( mpDoc->GetSpzFrmFmts()->Contains( pFmt ))
{
// FlyFmt is still valid, therefore process
@@ -1394,17 +1392,15 @@ SwFrmFmt* SwFEShell::WizzardGetFly()
// do not search the Fly via the layout. Now we can delete a frame
// without a valid layout. ( e.g. for the wizards )
SwFrmFmts& rSpzArr = *mpDoc->GetSpzFrmFmts();
- sal_uInt16 nCnt = rSpzArr.size();
- if( nCnt )
+ if( !rSpzArr.empty() )
{
SwNodeIndex& rCrsrNd = GetCrsr()->GetPoint()->nNode;
if( rCrsrNd.GetIndex() > mpDoc->GetNodes().GetEndOfExtras().GetIndex() )
// Cursor is in the body area!
return 0;
- for( sal_uInt16 n = 0; n < nCnt; ++n )
+ for( auto pFmt : rSpzArr )
{
- SwFrmFmt* pFmt = rSpzArr[ n ];
const SwNodeIndex* pIdx = pFmt->GetCntnt( false ).GetCntntIdx();
SwStartNode* pSttNd;
if( pIdx &&
@@ -1470,7 +1466,7 @@ const SwFrmFmt* SwFEShell::IsURLGrfAtPos( const Point& rPt, OUString* pURL,
const SwFrmFmt* pRet = 0;
SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
- sal_uInt16 nOld = pDView->GetHitTolerancePixel();
+ const auto nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 2 );
if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV,SdrSearchOptions::PICKMACRO ) &&
@@ -1579,7 +1575,7 @@ const SwFrmFmt* SwFEShell::GetFmtFromObj( const Point& rPt, SwRect** pRectToFill
SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
- sal_uInt16 nOld = pDView->GetHitTolerancePixel();
+ const auto nOld = pDView->GetHitTolerancePixel();
// tolerance for Drawing-SS
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
@@ -1703,7 +1699,7 @@ ObjCntType SwFEShell::GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const
SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
- sal_uInt16 nOld = pDView->GetHitTolerancePixel();
+ const auto nOld = pDView->GetHitTolerancePixel();
// tolerance for Drawing-SS
pDView->SetHitTolerancePixel( pDView->GetMarkHdlSizePixel()/2 );
commit 9eb61489ee03486a7147acdf923eaf5e3f355183
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 3 19:04:23 2015 +0200
Use range-based for loops
Change-Id: I02dbe522c61804e5868b350e99ab02f691f36b0b
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index c1a1831..4618a33 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -102,9 +102,9 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpTxt )
}
// also delete surrounding FlyFrames if any
- for( sal_uInt16 n = 0; n < pClpDoc->GetSpzFrmFmts()->size(); ++n )
+ for( auto pFmt : *pClpDoc->GetSpzFrmFmts() )
{
- SwFlyFrmFmt* pFly = static_cast<SwFlyFrmFmt*>((*pClpDoc->GetSpzFrmFmts())[n]);
+ SwFlyFrmFmt* pFly = static_cast<SwFlyFrmFmt*>(pFmt);
pClpDoc->getIDocumentLayoutAccess().DelLayoutFmt( pFly );
}
pClpDoc->GetDocumentFieldsManager().GCFieldTypes(); // delete the FieldTypes
@@ -891,16 +891,15 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
MakeDrawView();
std::set<const SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pClpDoc);
- for ( sal_uInt16 i = 0; i < pClpDoc->GetSpzFrmFmts()->size(); ++i )
+ for ( auto pCpyFmt : *pClpDoc->GetSpzFrmFmts() )
{
bool bInsWithFmt = true;
- const SwFrmFmt& rCpyFmt = *(*pClpDoc->GetSpzFrmFmts())[i];
if( Imp()->GetDrawView()->IsGroupEntered() &&
- RES_DRAWFRMFMT == rCpyFmt.Which() &&
- (FLY_AS_CHAR != rCpyFmt.GetAnchor().GetAnchorId()) )
+ RES_DRAWFRMFMT == pCpyFmt->Which() &&
+ (FLY_AS_CHAR != pCpyFmt->GetAnchor().GetAnchorId()) )
{
- const SdrObject* pSdrObj = rCpyFmt.FindSdrObject();
+ const SdrObject* pSdrObj = pCpyFmt->FindSdrObject();
if( pSdrObj )
{
SdrObject* pNew = GetDoc()->CloneSdrObj( *pSdrObj,
@@ -945,23 +944,23 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
if( bInsWithFmt )
{
- SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
+ SwFmtAnchor aAnchor( pCpyFmt->GetAnchor() );
if ((FLY_AT_PARA == aAnchor.GetAnchorId()) ||
(FLY_AT_CHAR == aAnchor.GetAnchorId()) ||
(FLY_AS_CHAR == aAnchor.GetAnchorId()))
{
SwPosition* pPos = rPaM.GetPoint();
// allow shapes (no controls) in header/footer
- if( RES_DRAWFRMFMT == rCpyFmt.Which() &&
+ if( RES_DRAWFRMFMT == pCpyFmt->Which() &&
GetDoc()->IsInHeaderFooter( pPos->nNode ) )
{
- const SdrObject *pCpyObj = rCpyFmt.FindSdrObject();
+ const SdrObject *pCpyObj = pCpyFmt->FindSdrObject();
if (pCpyObj && CheckControlLayer(pCpyObj))
continue;
}
// Ignore TextBoxes, they are already handled in sw::DocumentLayoutManager::CopyLayoutFmt().
- if (aTextBoxes.find(&rCpyFmt) != aTextBoxes.end())
+ if (aTextBoxes.find(pCpyFmt) != aTextBoxes.end())
continue;
aAnchor.SetAnchor( pPos );
@@ -977,7 +976,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
0, aPt, *this, aAnchor, aPt, false );
}
- SwFrmFmt * pNew = GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
+ SwFrmFmt * pNew = GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( *pCpyFmt, aAnchor, true, true );
if( pNew )
{
@@ -1087,14 +1086,13 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
if( !Imp()->GetDrawView() )
MakeDrawView();
- for ( sal_uInt16 i = 0; i < pClpDoc->GetSpzFrmFmts()->size(); ++i )
+ for ( auto pCpyFmt : *pClpDoc->GetSpzFrmFmts() )
{
- const SwFrmFmt& rCpyFmt = *(*pClpDoc->GetSpzFrmFmts())[i];
- SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
+ SwFmtAnchor aAnchor( pCpyFmt->GetAnchor() );
if ( FLY_AT_PAGE != aAnchor.GetAnchorId() )
continue;
aAnchor.SetPageNum( aAnchor.GetPageNum() + nStartPageNumber - 1 );
- GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
+ GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( *pCpyFmt, aAnchor, true, true );
}
}
}
@@ -1187,10 +1185,9 @@ bool SwFEShell::PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt1
if( !rToFill.Imp()->GetDrawView() )
rToFill.MakeDrawView();
- for ( sal_uInt16 i = 0; i < GetDoc()->GetSpzFrmFmts()->size(); ++i )
+ for ( auto pCpyFmt : *GetDoc()->GetSpzFrmFmts() )
{
- const SwFrmFmt& rCpyFmt = *(*GetDoc()->GetSpzFrmFmts())[i];
- SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
+ SwFmtAnchor aAnchor( pCpyFmt->GetAnchor() );
if ((FLY_AT_PAGE == aAnchor.GetAnchorId()) &&
aAnchor.GetPageNum() >= nStartPage && aAnchor.GetPageNum() <= nEndPage)
{
@@ -1198,7 +1195,7 @@ bool SwFEShell::PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt1
}
else
continue;
- rToFill.GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
+ rToFill.GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( *pCpyFmt, aAnchor, true, true );
}
}
GetDoc()->getIDocumentFieldsAccess().UnlockExpFlds();
commit e5d2f06f29e599617e927409382ff32c4cda62ca
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 3 18:50:45 2015 +0200
Use auto and range-based for loops
Change-Id: I8d18fd9fc0296a9ff54c048698e8c10c77277c42
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index d2ce47c..94d5521 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -896,10 +896,8 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
case REF_FOOTNOTE:
case REF_ENDNOTE:
{
- sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().size();
- SwTxtFtn* pFtnIdx;
- for( n = 0; n < nFtnCnt; ++n )
- if( nSeqNo == (pFtnIdx = pDoc->GetFtnIdxs()[ n ])->GetSeqRefNo() )
+ for( auto pFtnIdx : pDoc->GetFtnIdxs() )
+ if( nSeqNo == pFtnIdx->GetSeqRefNo() )
{
SwNodeIndex* pIdx = pFtnIdx->GetStartNode();
if( pIdx )
@@ -975,7 +973,7 @@ void _RefIdsMap::GetFieldIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds)
/// @param[in,out] rIds The list of IDs found in the document.
void _RefIdsMap::GetNoteIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds)
{
- for( sal_uInt16 n = rDoc.GetFtnIdxs().size(); n; )
+ for( auto n = rDoc.GetFtnIdxs().size(); n; )
rIds.insert( rDoc.GetFtnIdxs()[ --n ]->GetSeqRefNo() );
}
@@ -1021,9 +1019,8 @@ void _RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, bool bField )
AddId( GetFirstUnusedId(aIds), *pIt );
// Change the footnotes/endnotes in the source doc to the new ID
- for (sal_uInt16 i = 0, nCnt = rDoc.GetFtnIdxs().size(); i < nCnt; ++i)
+ for ( const auto pFtnIdx : rDoc.GetFtnIdxs() )
{
- SwTxtFtn *const pFtnIdx = rDoc.GetFtnIdxs()[i];
sal_uInt16 const n = pFtnIdx->GetSeqRefNo();
pFtnIdx->SetSeqNo(sequencedIds[n]);
}
@@ -1110,7 +1107,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc )
case REF_SEQUENCEFLD:
{
_RefIdsMap* pMap = 0;
- for( sal_uInt16 n = aFldMap.size(); n; )
+ for( auto n = aFldMap.size(); n; )
{
if( aFldMap[ --n ].GetName()==rRefFld.GetSetRefName() )
{
commit 53e3ab398cc24a23993c5ef64871541877c4fb97
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 3 18:37:19 2015 +0200
Reduce scope, use more proper types and check downcast
Change-Id: I016351fed029e99b7c56cf8fc22c4a835fea4d0c
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index adb54ec..602b830 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -539,8 +539,6 @@ sal_uInt16 SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld )
std::vector<sal_uInt16> aArr;
- sal_uInt16 n;
-
// check if number is already used and if a new one needs to be created
SwIterator<SwFmtFld,SwFieldType> aIter( *this );
for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() )
@@ -558,6 +556,8 @@ sal_uInt16 SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld )
sal_uInt16 nNum = rFld.GetSeqNumber();
if( USHRT_MAX != nNum )
{
+ std::vector<sal_uInt16>::size_type n {0};
+
for( n = 0; n < aArr.size(); ++n )
if( aArr[ n ] >= nNum )
break;
@@ -567,7 +567,9 @@ sal_uInt16 SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld )
}
// flagged all numbers, so determine the right number
- n = aArr.size();
+ sal_uInt16 n = aArr.size();
+ OSL_ENSURE( n == aArr.size(), "Array is too big for using a sal_uInt16 index" );
+
if ( n > 0 && aArr[ n-1 ] != n-1 )
{
for( n = 0; n < aArr.size(); ++n )
commit fd755f88573c04a322b53414c9fded4f7435c9b5
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 3 18:31:15 2015 +0200
Scan sorted array for a gap only if there could be one
Change-Id: Ifd3c50e2cca98ef3ce7e03d92434b4128e488d02
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 97774cf..adb54ec 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -567,9 +567,13 @@ sal_uInt16 SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld )
}
// flagged all numbers, so determine the right number
- for( n = 0; n < aArr.size(); ++n )
- if( n != aArr[ n ] )
- break;
+ n = aArr.size();
+ if ( n > 0 && aArr[ n-1 ] != n-1 )
+ {
+ for( n = 0; n < aArr.size(); ++n )
+ if( n != aArr[ n ] )
+ break;
+ }
rFld.SetSeqNumber( n );
return n;
commit e2a394d7d6f5961ab9c3da983f5f1390225ff6d6
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 3 18:09:34 2015 +0200
Reduce checks in loop
Change-Id: Ic4650f083ce501b75cbefd2711fcfe348e1d61ea
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 28f222c..97774cf 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -559,12 +559,10 @@ sal_uInt16 SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld )
if( USHRT_MAX != nNum )
{
for( n = 0; n < aArr.size(); ++n )
- if( aArr[ n ] > nNum )
- return nNum; // no -> use it
- else if( aArr[ n ] == nNum )
- break; // yes -> create new
+ if( aArr[ n ] >= nNum )
+ break;
- if( n == aArr.size() )
+ if( n == aArr.size() || aArr[ n ] > nNum )
return nNum; // no -> use it
}
commit cf8ae83b87ff0861ab9f2e67035d9daa98881604
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Thu Apr 30 07:47:37 2015 +0200
SwRefPageGetFieldType::MakeSetList can return bool
Change-Id: I79965d94e077345357952e7bded4b7e5b4c51c85
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index d9f8294..4129d33 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -605,7 +605,7 @@ protected:
public:
SwRefPageGetFieldType( SwDoc* pDoc );
virtual SwFieldType* Copy() const SAL_OVERRIDE;
- sal_uInt16 MakeSetList( _SetGetExpFlds& rTmpLst );
+ bool MakeSetList( _SetGetExpFlds& rTmpLst );
SwDoc* GetDoc() const { return pDoc; }
};
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index a75c57d..78e71c6 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -701,7 +701,7 @@ const SwTable* SwTableFormula::FindTable( SwDoc& rDoc, const OUString& rNm ) con
{
const SwFrmFmts& rTblFmts = *rDoc.GetTblFrmFmts();
const SwTable* pTmpTbl = 0, *pRet = 0;
- for( sal_uInt16 nFmtCnt = rTblFmts.size(); nFmtCnt; )
+ for( auto nFmtCnt = rTblFmts.size(); nFmtCnt; )
{
SwFrmFmt* pFmt = rTblFmts[ --nFmtCnt ];
// if we are called from Sw3Writer, a number is dependent on the format name
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index d2587c4..0fb8f39 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2075,7 +2075,7 @@ void SwRefPageGetFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem*
NotifyClients( pOld, pNew );
}
-sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst )
+bool SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst )
{
SwIterator<SwFmtFld,SwFieldType> aIter(*pDoc->getIDocumentFieldsAccess().GetSysFldType( RES_REFPAGESETFLD));
for ( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
@@ -2118,7 +2118,7 @@ sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst )
}
}
- return rTmpLst.size();
+ return !rTmpLst.empty();
}
void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld,
commit a5295aad5cee7c14693a00164ff457a06a63b35b
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Thu Apr 30 07:33:38 2015 +0200
sal_uInt16 to (const) short
Change-Id: I058d8cb7f55359b99962d38d0eb424206fa90593
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 798ceab..d2587c4 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2150,7 +2150,7 @@ void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld,
const SwCntntFrm* pFrm = pTxtNode->getLayoutFrm( pTxtNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false );
const SwCntntFrm* pRefFrm = pRefTxtFld->GetTxtNode().getLayoutFrm( pRefTxtFld->GetTxtNode().GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, 0, false );
const SwPageFrm* pPgFrm = 0;
- sal_uInt16 nDiff = ( pFrm && pRefFrm )
+ const short nDiff = ( pFrm && pRefFrm )
? (pPgFrm = pFrm->FindPageFrm())->GetPhyPageNum() -
pRefFrm->FindPageFrm()->GetPhyPageNum() + 1
: 1;
@@ -2160,7 +2160,7 @@ void SwRefPageGetFieldType::UpdateField( SwTxtFld* pTxtFld,
? (sal_uInt32)SVX_NUM_ARABIC
: pPgFrm->GetPageDesc()->GetNumType().GetNumberingType() )
: pGetFld->GetFormat();
- short nPageNum = static_cast<short>(std::max(0, pSetFld->GetOffset() + (short)nDiff));
+ const short nPageNum = std::max<short>(0, pSetFld->GetOffset() + nDiff);
pGetFld->SetText( FormatNumber( nPageNum, nTmpFmt ) );
}
}
@@ -2235,14 +2235,14 @@ void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm,
{
// determine the correct offset
const SwPageFrm* pPgFrm = pFrm->FindPageFrm();
- sal_uInt16 nDiff = pPgFrm->GetPhyPageNum() -
+ const short nDiff = pPgFrm->GetPhyPageNum() -
pRefFrm->FindPageFrm()->GetPhyPageNum() + 1;
SwRefPageGetField* pGetFld = const_cast<SwRefPageGetField*>(static_cast<const SwRefPageGetField*>(pFld->GetFmtFld().GetField()));
sal_uInt32 nTmpFmt = SVX_NUM_PAGEDESC == pGetFld->GetFormat()
? pPgFrm->GetPageDesc()->GetNumType().GetNumberingType()
: pGetFld->GetFormat();
- short nPageNum = static_cast<short>(std::max(0, pSetFld->GetOffset() + (short)nDiff ));
+ const short nPageNum = std::max<short>(0, pSetFld->GetOffset() + nDiff);
pGetFld->SetText( FormatNumber( nPageNum, nTmpFmt ) );
}
}
commit 2e87da7e81f942519f57955d79f63f3c727fbe0c
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Tue Apr 28 00:03:33 2015 +0200
Avoid possible downcasts and rely on implicit type conversions
Change-Id: I5f4dcdeaaad9959780d270410686a93dc727b05d
diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx
index ae66fb9..631efa7 100644
--- a/sw/source/core/fields/dbfld.cxx
+++ b/sw/source/core/fields/dbfld.cxx
@@ -816,7 +816,7 @@ OUString SwDBSetNumberField::Expand() const
{
if(0 !=(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE) || nNumber == 0)
return OUString();
- return FormatNumber((sal_uInt16)nNumber, GetFormat());
+ return FormatNumber(nNumber, GetFormat());
}
void SwDBSetNumberField::Evaluate(SwDoc* pDoc)
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 2a1001d..798ceab 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -124,7 +124,7 @@ OUString SwPageNumberFieldType::Expand( sal_uInt32 nFmt, short nOff,
if( SVX_NUM_CHAR_SPECIAL == nTmpFmt )
return rUserStr;
- return FormatNumber( (sal_uInt16)nTmp, nTmpFmt );
+ return FormatNumber( nTmp, nTmpFmt );
}
SwFieldType* SwPageNumberFieldType::Copy() const
@@ -749,7 +749,7 @@ OUString SwDocStatFieldType::Expand(sal_uInt16 nSubType, sal_uInt32 nFmt) const
}
if( nVal <= SHRT_MAX )
- return FormatNumber( (sal_uInt16)nVal, nFmt );
+ return FormatNumber( nVal, nFmt );
return OUString::number( nVal );
}
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 94b99af..28f222c 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -858,7 +858,7 @@ void SwSetExpField::SetValue( const double& rAny )
SwValueField::SetValue(rAny);
if( IsSequenceFld() )
- sExpand = FormatNumber( (sal_uInt32)GetValue(), GetFormat() );
+ sExpand = FormatNumber( GetValue(), GetFormat() );
else
sExpand = static_cast<SwValueFieldType*>(GetTyp())->ExpandValue( rAny,
GetFormat(), GetLanguage());
commit 51e8b2b5781e596c9b6943833e4c182bff2bc1e1
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Apr 26 18:13:33 2015 +0200
Use more proper integer types and range-based for loops
Change-Id: I4b15809b6ef7896213253fb211adbbfaef8ef084
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 84fa319..2671f08 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -49,13 +49,13 @@ using namespace ::com::sun::star::lang;
SwAuthEntry::SwAuthEntry(const SwAuthEntry& rCopy)
: nRefCount(0)
{
- for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ for(int i = 0; i < AUTH_FIELD_END; ++i)
aAuthFields[i] = rCopy.aAuthFields[i];
}
bool SwAuthEntry::operator==(const SwAuthEntry& rComp)
{
- for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ for(int i = 0; i < AUTH_FIELD_END; ++i)
if(aAuthFields[i] != rComp.aAuthFields[i])
return false;
return true;
@@ -85,7 +85,7 @@ SwFieldType* SwAuthorityFieldType::Copy() const
void SwAuthorityFieldType::RemoveField(sal_IntPtr nHandle)
{
- for(sal_uInt16 j = 0; j < m_DataArr.size(); j++)
+ for(SwAuthDataArr::size_type j = 0; j < m_DataArr.size(); ++j)
{
SwAuthEntry* pTemp = &m_DataArr[j];
sal_IntPtr nRet = reinterpret_cast<sal_IntPtr>((void*)pTemp);
@@ -108,18 +108,17 @@ sal_IntPtr SwAuthorityFieldType::AddField(const OUString& rFieldContents)
{
sal_IntPtr nRet = 0;
SwAuthEntry* pEntry = new SwAuthEntry;
- for( sal_uInt16 i = 0; i < AUTH_FIELD_END; ++i )
- pEntry->SetAuthorField( (ToxAuthorityField)i,
+ for( sal_Int32 i = 0; i < AUTH_FIELD_END; ++i )
+ pEntry->SetAuthorField( static_cast<ToxAuthorityField>(i),
rFieldContents.getToken( i, TOX_STYLE_DELIMITER ));
- for(sal_uInt16 j = 0; j < m_DataArr.size(); j++)
+ for(auto &rTemp : m_DataArr)
{
- SwAuthEntry* pTemp = &m_DataArr[j];
- if(*pTemp == *pEntry)
+ if(rTemp == *pEntry)
{
delete pEntry;
- nRet = reinterpret_cast<sal_IntPtr>((void*)pTemp);
- pTemp->AddRef();
+ nRet = reinterpret_cast<sal_IntPtr>((void*)&rTemp);
+ rTemp.AddRef();
return nRet;
}
}
@@ -135,13 +134,12 @@ sal_IntPtr SwAuthorityFieldType::AddField(const OUString& rFieldContents)
bool SwAuthorityFieldType::AddField(sal_IntPtr nHandle)
{
- for( sal_uInt16 j = 0; j < m_DataArr.size(); j++ )
+ for(auto &rTemp : m_DataArr)
{
- SwAuthEntry* pTemp = &m_DataArr[j];
- sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)pTemp);
+ sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)&rTemp);
if( nTmp == nHandle )
{
- pTemp->AddRef();
+ rTemp.AddRef();
//re-generate positions of the fields
DelSequenceArray();
return true;
@@ -153,13 +151,12 @@ bool SwAuthorityFieldType::AddField(sal_IntPtr nHandle)
const SwAuthEntry* SwAuthorityFieldType::GetEntryByHandle(sal_IntPtr nHandle) const
{
- for(sal_uInt16 j = 0; j < m_DataArr.size(); j++)
+ for(auto &rTemp : m_DataArr)
{
- const SwAuthEntry* pTemp = &m_DataArr[j];
- sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)pTemp);
+ sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)&rTemp);
if( nTmp == nHandle )
{
- return pTemp;
+ return &rTemp;
}
}
OSL_FAIL( "invalid Handle" );
@@ -169,22 +166,20 @@ const SwAuthEntry* SwAuthorityFieldType::GetEntryByHandle(sal_IntPtr nHandle) c
void SwAuthorityFieldType::GetAllEntryIdentifiers(
std::vector<OUString>& rToFill )const
{
- for(sal_uInt16 j = 0; j < m_DataArr.size(); j++)
+ for(const auto &rTemp : m_DataArr)
{
- const SwAuthEntry* pTemp = &m_DataArr[j];
- rToFill.push_back(pTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER));
+ rToFill.push_back(rTemp.GetAuthorField(AUTH_FIELD_IDENTIFIER));
}
}
const SwAuthEntry* SwAuthorityFieldType::GetEntryByIdentifier(
const OUString& rIdentifier)const
{
- for( sal_uInt16 j = 0; j < m_DataArr.size(); ++j )
+ for(const auto &rTemp : m_DataArr)
{
- const SwAuthEntry* pTemp = &m_DataArr[j];
- if( rIdentifier == pTemp->GetAuthorField( AUTH_FIELD_IDENTIFIER ))
+ if( rIdentifier == rTemp.GetAuthorField( AUTH_FIELD_IDENTIFIER ))
{
- return pTemp;
+ return &rTemp;
}
}
return nullptr;
@@ -192,14 +187,13 @@ const SwAuthEntry* SwAuthorityFieldType::GetEntryByIdentifier(
bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
{
- for( sal_uInt16 j = 0; j < m_DataArr.size(); ++j )
+ for(auto &rTemp : m_DataArr)
{
- SwAuthEntry* pTemp = &m_DataArr[j];
- if(pTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER) ==
+ if(rTemp.GetAuthorField(AUTH_FIELD_IDENTIFIER) ==
pNewEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER))
{
- for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
- pTemp->SetAuthorField((ToxAuthorityField) i,
+ for(int i = 0; i < AUTH_FIELD_END; ++i)
+ rTemp.SetAuthorField((ToxAuthorityField) i,
pNewEntry->GetAuthorField((ToxAuthorityField)i));
return true;
}
@@ -210,8 +204,7 @@ bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
/// appends a new entry (if new) and returns the array position
sal_uInt16 SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert )
{
- sal_uInt16 nRet = 0;
- for( nRet = 0; nRet < m_DataArr.size(); ++nRet )
+ for( SwAuthDataArr::size_type nRet = 0; nRet < m_DataArr.size(); ++nRet )
{
SwAuthEntry* pTemp = &m_DataArr[ nRet ];
if( *pTemp == rInsert )
@@ -280,7 +273,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
SwTOXAuthority* pNew = new SwTOXAuthority( *pTxtNode,
*pFmtFld, aIntl );
- for(short i = 0; i < (short)aSortArr.size(); ++i)
+ for(SwTOXSortTabBases::size_type i = 0; i < aSortArr.size(); ++i)
{
SwTOXSortTabBase* pOld = aSortArr[i];
if(*pOld == *pNew)
@@ -300,22 +293,23 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
//if it still exists - insert at the correct position
if(pNew)
{
- short j;
+ SwTOXSortTabBases::size_type j {0};
- for( j = 0; j < (short)aSortArr.size(); ++j)
+ while(j < aSortArr.size())
{
SwTOXSortTabBase* pOld = aSortArr[j];
if(*pNew < *pOld)
break;
+ ++j;
}
aSortArr.insert(aSortArr.begin() + j, pNew);
}
}
}
- for(sal_uInt16 i = 0; i < aSortArr.size(); i++)
+ for(const auto *pBase : aSortArr)
{
- const SwTOXSortTabBase& rBase = *aSortArr[i];
+ const SwTOXSortTabBase& rBase = *pBase;
SwFmtFld& rFmtFld = const_cast<SwTOXAuthority&>(static_cast<const SwTOXAuthority&>(rBase)).GetFldFmt();
SwAuthorityField* pAFld = static_cast<SwAuthorityField*>(rFmtFld.GetField());
m_SequArr.push_back(pAFld->GetHandle());
@@ -325,7 +319,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
aSortArr.clear();
}
//find nHandle
- for(sal_uInt16 i = 0; i < m_SequArr.size(); ++i)
+ for(std::vector<sal_IntPtr>::size_type i = 0; i < m_SequArr.size(); ++i)
{
if(m_SequArr[i] == nHandle)
{
@@ -372,7 +366,7 @@ bool SwAuthorityFieldType::QueryValue( Any& rVal, sal_uInt16 nWhichId ) const
{
Sequence<PropertyValues> aRet(m_SortKeyArr.size());
PropertyValues* pValues = aRet.getArray();
- for(sal_uInt16 i = 0; i < m_SortKeyArr.size(); i++)
+ for(SortKeyArr::size_type i = 0; i < m_SortKeyArr.size(); ++i)
{
const SwTOXSortKey* pKey = &m_SortKeyArr[i];
pValues[i].realloc(2);
@@ -639,7 +633,7 @@ bool SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const
return false;
Sequence <PropertyValue> aRet(AUTH_FIELD_END);
PropertyValue* pValues = aRet.getArray();
- for(sal_Int16 i = 0; i < AUTH_FIELD_END; i++)
+ for(int i = 0; i < AUTH_FIELD_END; ++i)
{
pValues[i].Name = OUString::createFromAscii(aFieldNames[i]);
const OUString sField = pAuthEntry->GetAuthorField((ToxAuthorityField) i);
@@ -653,9 +647,9 @@ bool SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const
return false;
}
-static sal_Int16 lcl_Find(const OUString& rFieldName)
+static sal_Int32 lcl_Find(const OUString& rFieldName)
{
- for(sal_Int16 i = 0; i < AUTH_FIELD_END; i++)
+ for(sal_Int32 i = 0; i < AUTH_FIELD_END; ++i)
if(rFieldName.equalsAscii(aFieldNames[i]))
return i;
return -1;
@@ -676,7 +670,7 @@ bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ )
const PropertyValue* pParam = aParam.getConstArray();
for(sal_Int32 i = 0; i < aParam.getLength(); i++)
{
- sal_Int16 nFound = lcl_Find(pParam[i].Name);
+ const sal_Int32 nFound = lcl_Find(pParam[i].Name);
if(nFound >= 0)
{
OUString sContent;
commit fe62722b132a3f6328a40545c1ea0addc95e24dd
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Apr 26 15:45:39 2015 +0200
Simplify by early bail-out
Change-Id: Ie6ea9fbd2da826292bf35a71a27d8872db5e3ac5
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index bb17fbe..84fa319 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -85,18 +85,12 @@ SwFieldType* SwAuthorityFieldType::Copy() const
void SwAuthorityFieldType::RemoveField(sal_IntPtr nHandle)
{
-#if OSL_DEBUG_LEVEL > 0
- bool bRemoved = false;
-#endif
for(sal_uInt16 j = 0; j < m_DataArr.size(); j++)
{
SwAuthEntry* pTemp = &m_DataArr[j];
sal_IntPtr nRet = reinterpret_cast<sal_IntPtr>((void*)pTemp);
if(nRet == nHandle)
{
-#if OSL_DEBUG_LEVEL > 0
- bRemoved = true;
-#endif
pTemp->RemoveRef();
if(!pTemp->GetRefCount())
{
@@ -104,12 +98,10 @@ void SwAuthorityFieldType::RemoveField(sal_IntPtr nHandle)
//re-generate positions of the fields
DelSequenceArray();
}
- break;
+ return;
}
}
-#if OSL_DEBUG_LEVEL > 0
- OSL_ENSURE(bRemoved, "Field unknown" );
-#endif
+ OSL_FAIL("Field unknown" );
}
sal_IntPtr SwAuthorityFieldType::AddField(const OUString& rFieldContents)
@@ -120,63 +112,58 @@ sal_IntPtr SwAuthorityFieldType::AddField(const OUString& rFieldContents)
pEntry->SetAuthorField( (ToxAuthorityField)i,
rFieldContents.getToken( i, TOX_STYLE_DELIMITER ));
- for(sal_uInt16 j = 0; j < m_DataArr.size() && pEntry; j++)
+ for(sal_uInt16 j = 0; j < m_DataArr.size(); j++)
{
SwAuthEntry* pTemp = &m_DataArr[j];
if(*pTemp == *pEntry)
{
- DELETEZ(pEntry);
+ delete pEntry;
nRet = reinterpret_cast<sal_IntPtr>((void*)pTemp);
pTemp->AddRef();
+ return nRet;
}
}
+
//if it is a new Entry - insert
- if(pEntry)
- {
- nRet = reinterpret_cast<sal_IntPtr>((void*)pEntry);
- pEntry->AddRef();
- m_DataArr.push_back(pEntry);
- //re-generate positions of the fields
- DelSequenceArray();
- }
+ nRet = reinterpret_cast<sal_IntPtr>((void*)pEntry);
+ pEntry->AddRef();
+ m_DataArr.push_back(pEntry);
+ //re-generate positions of the fields
+ DelSequenceArray();
return nRet;
}
bool SwAuthorityFieldType::AddField(sal_IntPtr nHandle)
{
- bool bRet = false;
for( sal_uInt16 j = 0; j < m_DataArr.size(); j++ )
{
SwAuthEntry* pTemp = &m_DataArr[j];
sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)pTemp);
if( nTmp == nHandle )
{
- bRet = true;
pTemp->AddRef();
//re-generate positions of the fields
DelSequenceArray();
- break;
+ return true;
}
}
- OSL_ENSURE(bRet, "::AddField(sal_IntPtr) failed");
- return bRet;
+ OSL_FAIL("SwAuthorityFieldType::AddField(sal_IntPtr) failed");
+ return false;
}
const SwAuthEntry* SwAuthorityFieldType::GetEntryByHandle(sal_IntPtr nHandle) const
{
- const SwAuthEntry* pRet = 0;
for(sal_uInt16 j = 0; j < m_DataArr.size(); j++)
{
const SwAuthEntry* pTemp = &m_DataArr[j];
sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>((void*)pTemp);
if( nTmp == nHandle )
{
- pRet = pTemp;
- break;
+ return pTemp;
}
}
- OSL_ENSURE( pRet, "invalid Handle" );
- return pRet;
+ OSL_FAIL( "invalid Handle" );
+ return nullptr;
}
void SwAuthorityFieldType::GetAllEntryIdentifiers(
@@ -192,22 +179,19 @@ void SwAuthorityFieldType::GetAllEntryIdentifiers(
const SwAuthEntry* SwAuthorityFieldType::GetEntryByIdentifier(
const OUString& rIdentifier)const
{
- const SwAuthEntry* pRet = 0;
for( sal_uInt16 j = 0; j < m_DataArr.size(); ++j )
{
const SwAuthEntry* pTemp = &m_DataArr[j];
if( rIdentifier == pTemp->GetAuthorField( AUTH_FIELD_IDENTIFIER ))
{
- pRet = pTemp;
- break;
+ return pTemp;
}
}
- return pRet;
+ return nullptr;
}
bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
{
- bool bChanged = false;
for( sal_uInt16 j = 0; j < m_DataArr.size(); ++j )
{
SwAuthEntry* pTemp = &m_DataArr[j];
@@ -217,11 +201,10 @@ bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
pTemp->SetAuthorField((ToxAuthorityField) i,
pNewEntry->GetAuthorField((ToxAuthorityField)i));
- bChanged = true;
- break;
+ return true;
}
}
- return bChanged;
+ return false;
}
/// appends a new entry (if new) and returns the array position
@@ -233,27 +216,24 @@ sal_uInt16 SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert )
SwAuthEntry* pTemp = &m_DataArr[ nRet ];
if( *pTemp == rInsert )
{
- break;
//ref count unchanged
+ return nRet;
}
}
//if it is a new Entry - insert
- if( nRet == m_DataArr.size() )
- m_DataArr.push_back( new SwAuthEntry( rInsert ) );
-
- return nRet;
+ m_DataArr.push_back( new SwAuthEntry( rInsert ) );
+ return m_DataArr.size()-1;
}
sal_IntPtr SwAuthorityFieldType::GetHandle(sal_uInt16 nPos)
{
- sal_IntPtr nRet = 0;
if( nPos < m_DataArr.size() )
{
SwAuthEntry* pTemp = &m_DataArr[nPos];
- nRet = reinterpret_cast<sal_IntPtr>((void*)pTemp);
+ return reinterpret_cast<sal_IntPtr>((void*)pTemp);
}
- return nRet;
+ return 0;
}
sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
@@ -345,19 +325,17 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
aSortArr.clear();
}
//find nHandle
- sal_uInt16 nRet = 0;
for(sal_uInt16 i = 0; i < m_SequArr.size(); ++i)
{
if(m_SequArr[i] == nHandle)
{
- nRet = i + 1;
- break;
+ return i + 1;
}
}
#if OSL_DEBUG_LEVEL > 0
- OSL_ENSURE(bCurrentFieldWithoutTextNode || nRet, "Handle not found");
+ OSL_ENSURE(bCurrentFieldWithoutTextNode, "Handle not found");
#endif
- return nRet;
+ return 0;
}
bool SwAuthorityFieldType::QueryValue( Any& rVal, sal_uInt16 nWhichId ) const
@@ -503,11 +481,10 @@ sal_uInt16 SwAuthorityFieldType::GetSortKeyCount() const
const SwTOXSortKey* SwAuthorityFieldType::GetSortKey(sal_uInt16 nIdx) const
{
- const SwTOXSortKey* pRet = 0;
if(m_SortKeyArr.size() > nIdx)
- pRet = &m_SortKeyArr[nIdx];
- OSL_ENSURE(pRet, "Sort key not found");
- return pRet;
+ return &m_SortKeyArr[nIdx];
+ OSL_FAIL("Sort key not found");
+ return nullptr;
}
void SwAuthorityFieldType::SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey aKeys[])
commit 358bd7bc83265efc69d275216ff714811bfa3b5e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Apr 26 13:12:37 2015 +0200
Use auto and range-based for loops
Change-Id: I400bce4479eb0ab8105384f88a379c3ea90b9f66
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 79704d6..dc046d3 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -118,26 +118,23 @@ sal_uInt16 SwEditShell::GetSectionFmtCount() const
bool SwEditShell::IsAnySectionInDoc( bool bChkReadOnly, bool bChkHidden, bool bChkTOX ) const
{
const SwSectionFmts& rFmts = GetDoc()->GetSections();
- sal_uInt16 nCnt = rFmts.size();
- sal_uInt16 n;
- for( n = 0; n < nCnt; ++n )
+ for( const SwSectionFmt* pFmt : rFmts )
{
SectionType eTmpType;
- const SwSectionFmt* pFmt = rFmts[ n ];
if( pFmt->IsInNodesArr() &&
(bChkTOX ||
( (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
&& TOX_HEADER_SECTION != eTmpType ) ) )
{
- const SwSection& rSect = *rFmts[ n ]->GetSection();
+ const SwSection& rSect = *pFmt->GetSection();
if( (!bChkReadOnly && !bChkHidden ) ||
(bChkReadOnly && rSect.IsProtectFlag() ) ||
(bChkHidden && rSect.IsHiddenFlag() ) )
- break;
+ return true;
}
}
- return n != nCnt;
+ return false;
}
sal_uInt16 SwEditShell::GetSectionFmtPos( const SwSectionFmt& rFmt ) const
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 0fe3c0a..fdc6253 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -225,7 +225,7 @@ sal_uInt16 SwEditShell::GetTOXCount() const
{
const SwSectionFmts& rFmts = GetDoc()->GetSections();
sal_uInt16 nRet = 0;
- for( sal_uInt16 n = rFmts.size(); n; )
+ for( auto n = rFmts.size(); n; )
{
const SwSection* pSect = rFmts[ --n ]->GetSection();
if( TOX_CONTENT_SECTION == pSect->GetType() &&
@@ -238,9 +238,10 @@ sal_uInt16 SwEditShell::GetTOXCount() const
const SwTOXBase* SwEditShell::GetTOX( sal_uInt16 nPos ) const
{
const SwSectionFmts& rFmts = GetDoc()->GetSections();
- for( sal_uInt16 n = 0, nCnt = 0; n < rFmts.size(); ++n )
+ sal_uInt16 nCnt {0};
+ for( const SwSectionFmt *pFmt : rFmts )
{
- const SwSection* pSect = rFmts[ n ]->GetSection();
+ const SwSection* pSect = pFmt->GetSection();
if( TOX_CONTENT_SECTION == pSect->GetType() &&
pSect->GetFmt()->GetSectionNode() &&
nCnt++ == nPos )
@@ -292,9 +293,8 @@ void SwEditShell::ApplyAutoMark()
SwTOXMarks aMarks;
SwTOXMark::InsertTOXMarks( aMarks, *pTOXType );
- for( sal_uInt16 nMark=0; nMark<aMarks.size(); nMark++ )
+ for( SwTOXMark* pMark : aMarks )
{
- SwTOXMark* pMark = aMarks[nMark];
if(pMark->IsAutoGenerated() && pMark->GetTxtTOXMark())
// mba: test iteration; objects are deleted in iteration
DeleteTOXMark(pMark);
commit 9fbb74b5b688eb51bf3b849e56841a00b836628c
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Thu Apr 23 07:46:57 2015 +0200
sal_uInt16 to size_type
Change-Id: Ib6715c5b61c718302b910a19ef557960e0f7aa93
diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx
index 63ef3d0..f43e857 100644
--- a/sw/inc/edimp.hxx
+++ b/sw/inc/edimp.hxx
@@ -45,13 +45,14 @@ class SwPamRanges : private _SwPamRanges
{
public:
SwPamRanges( const SwPaM& rRing );
+ using _SwPamRanges::size_type;
void Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 );
- SwPaM& SetPam( sal_uInt16 nArrPos, SwPaM& rPam );
+ SwPaM& SetPam( size_type nArrPos, SwPaM& rPam );
- sal_uInt16 Count() const
+ size_type Count() const
{ return _SwPamRanges::size(); }
- SwPamRange operator[]( sal_uInt16 nPos ) const
+ SwPamRange operator[]( size_type nPos ) const
{ return _SwPamRanges::operator[](nPos); }
};
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index fe78210..19b1074 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -529,7 +529,7 @@ void SwEditShell::MoveLeftMargin( bool bRight, bool bModulus )
{
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
GetDoc()->MoveLeftMargin( aRangeArr.SetPam( n, aPam ),
bRight, bModulus );
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index c4e1ab4..0617ef2 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -41,7 +41,7 @@ void SwPamRanges::Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 )
{ aRg.nStart = aRg.nEnd; aRg.nEnd = rIdx1.GetIndex(); }
_SwPamRanges::const_iterator it = lower_bound(aRg); //search Insert Position
- sal_uInt16 nPos = it - begin();
+ size_type nPos = it - begin();
if (!empty() && (it != end()) && (*it) == aRg)
{
// is the one in the Array smaller?
@@ -95,7 +95,7 @@ void SwPamRanges::Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 )
_SwPamRanges::insert( aRg );
}
-SwPaM& SwPamRanges::SetPam( sal_uInt16 nArrPos, SwPaM& rPam )
+SwPaM& SwPamRanges::SetPam( size_type nArrPos, SwPaM& rPam )
{
OSL_ASSERT( nArrPos < Count() );
const SwPamRange& rTmp = (*this)[ nArrPos ];
@@ -136,7 +136,7 @@ bool SwEditShell::NoNum()
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
bRet = bRet && GetDoc()->NoNum( aRangeArr.SetPam( n, aPam ));
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
@@ -155,7 +155,7 @@ bool SwEditShell::SelectionHasNumber() const
if (!bResult && pTxtNd && pTxtNd->Len()==0 && !pTxtNd->GetNumRule()) {
SwPamRanges aRangeArr( *GetCrsr() );
SwPaM aPam( *GetCrsr()->GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
{
aRangeArr.SetPam( n, aPam );
{
@@ -201,7 +201,7 @@ bool SwEditShell::SelectionHasBullet() const
if (!bResult && pTxtNd && pTxtNd->Len()==0 && !pTxtNd->GetNumRule()) {
SwPamRanges aRangeArr( *GetCrsr() );
SwPaM aPam( *GetCrsr()->GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
{
aRangeArr.SetPam( n, aPam );
{
@@ -281,7 +281,7 @@ void SwEditShell::DelNumRules()
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
{
GetDoc()->DelNumRules( aRangeArr.SetPam( n, aPam ) );
}
@@ -314,7 +314,7 @@ bool SwEditShell::NumUpDown( bool bDown )
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
bRet = bRet && GetDoc()->NumUpDown( aRangeArr.SetPam( n, aPam ), bDown );
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
@@ -535,7 +535,7 @@ bool SwEditShell::OutlineUpDown( short nOffset )
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
bRet = bRet && GetDoc()->OutlineUpDown(
aRangeArr.SetPam( n, aPam ), nOffset );
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
@@ -745,7 +745,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
OUString sContinuedListId(rContinuedListId);
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
{
aRangeArr.SetPam( n, aPam );
OUString sListId = GetDoc()->SetNumRule( aPam, rRule,
@@ -804,7 +804,7 @@ void SwEditShell::SetNumRuleStart( bool bFlag, SwPaM* pPaM )
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
GetDoc()->SetNumRuleStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), bFlag );
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
@@ -831,7 +831,7 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt, SwPaM* pPaM )
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
GetDoc()->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), nStt );
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 47d9dce..b33e0f1 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -837,7 +837,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( rPam );
SwPaM aPam( *rPam.GetPoint() );
- for ( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for ( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
{
// no start of a new list
pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
@@ -927,7 +927,7 @@ void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPa
pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( rPam );
SwPaM aPam( *rPam.GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 86b35a4..c1259a4 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -354,7 +354,7 @@ lcl_SetNodeNumStart(SwPaM & rCrsr, uno::Any const& rValue)
pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( rCrsr );
SwPaM aPam( *rCrsr.GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for( SwPamRanges::size_type n = 0; n < aRangeArr.Count(); ++n )
{
pDoc->SetNumRuleStart(*aRangeArr.SetPam( n, aPam ).GetPoint());
pDoc->SetNodeNumStart(*aRangeArr.SetPam( n, aPam ).GetPoint(),
More information about the Libreoffice-commits
mailing list