[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source
Katarina Behrens
Katarina.Behrens at cib.de
Sun May 3 14:36:59 PDT 2015
sw/inc/IDocumentFieldsAccess.hxx | 2 -
sw/inc/doc.hxx | 6 ++--
sw/inc/docary.hxx | 6 ++--
sw/inc/editsh.hxx | 10 +++----
sw/source/core/doc/DocumentFieldsManager.cxx | 4 +--
sw/source/core/doc/doc.cxx | 2 -
sw/source/core/doc/docfmt.cxx | 12 ++++-----
sw/source/core/docnode/ndsect.cxx | 4 +--
sw/source/core/edit/edsect.cxx | 10 +++----
sw/source/core/fields/dbfld.cxx | 4 +--
sw/source/core/inc/DocumentFieldsManager.hxx | 2 -
sw/source/core/tox/tox.cxx | 2 -
sw/source/core/undo/rolbck.cxx | 15 ++++-------
sw/source/core/undo/unattr.cxx | 22 ++++++++---------
sw/source/core/undo/undobj1.cxx | 4 +--
sw/source/core/undo/unfmco.cxx | 5 +--
sw/source/core/undo/untbl.cxx | 6 ++--
sw/source/core/undo/untblk.cxx | 6 ++--
sw/source/core/unocore/unosect.cxx | 4 +--
sw/source/filter/basflt/shellio.cxx | 2 -
sw/source/filter/ww8/wrtw8esh.cxx | 2 -
sw/source/filter/ww8/wrtw8num.cxx | 2 -
sw/source/ui/dialog/uiregionsw.cxx | 34 +++++++++++++--------------
sw/source/ui/frmdlg/column.cxx | 2 -
sw/source/uibase/dbui/dbmgr.cxx | 4 +--
sw/source/uibase/inc/regionsw.hxx | 2 -
26 files changed, 85 insertions(+), 89 deletions(-)
New commits:
commit 98436c4b53639d86f261ac630c46d32e3c7b8e28
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Sun May 3 23:25:52 2015 +0200
tdf#89783: Adjust to new GetPos retval (size_t vs. sal_uInt16)
Some of the usages of GetPos were just misusing it to find out
whether a vector contains given element -- use Contains() in those
cases
This patch is partially based on work of Christoph Lutz
Conflicts:
sw/source/filter/ww8/wrtw8esh.cxx
sw/source/filter/ww8/wrtw8num.cxx
Change-Id: I40bedba905e7577ba23f69acee178e0ea7cc1521
diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx
index f0859a3..36c0129 100644
--- a/sw/inc/IDocumentFieldsAccess.hxx
+++ b/sw/inc/IDocumentFieldsAccess.hxx
@@ -54,7 +54,7 @@ namespace com { namespace sun { namespace star { namespace uno { class Any; } }
virtual SwFieldType* GetFldType(sal_uInt16 nResId, const OUString& rName, bool bDbFieldMatching) const = 0;
- virtual void RemoveFldType(sal_uInt16 nFld) = 0;
+ virtual void RemoveFldType(size_t nFld) = 0;
virtual void UpdateFlds( SfxPoolItem* pNewHt, bool bCloseDB) = 0;
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index c935ede..2dab95b 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -826,7 +826,7 @@ public:
SwCharFmt *MakeCharFmt(const OUString &rFmtName, SwCharFmt *pDerivedFrom,
bool bBroadcast = false,
bool bAuto = true );
- void DelCharFmt(sal_uInt16 nFmt, bool bBroadcast = false);
+ void DelCharFmt(size_t nFmt, bool bBroadcast = false);
void DelCharFmt(SwCharFmt* pFmt, bool bBroadcast = false);
SwCharFmt* FindCharFmtByName( const OUString& rName ) const
{ return static_cast<SwCharFmt*>(FindFmtByName( (SwFmtsBase&)*mpCharFmtTbl, rName )); }
@@ -844,7 +844,7 @@ public:
SwConditionTxtFmtColl* MakeCondTxtFmtColl( const OUString &rFmtName,
SwTxtFmtColl *pDerivedFrom,
bool bBroadcast = false);
- void DelTxtFmtColl(sal_uInt16 nFmt, bool bBroadcast = false);
+ void DelTxtFmtColl(size_t nFmt, bool bBroadcast = false);
void DelTxtFmtColl( SwTxtFmtColl* pColl, bool bBroadcast = false );
/** Add 4th optional parameter <bResetListAttrs>.
'side effect' of <SetTxtFmtColl> with <bReset = true> is that the hard
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index e1746a2..847a96b 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -290,13 +290,13 @@ SwFieldType* DocumentFieldsManager::GetFldType(
}
/// Remove field type
-void DocumentFieldsManager::RemoveFldType(sal_uInt16 nFld)
+void DocumentFieldsManager::RemoveFldType(size_t nFld)
{
OSL_ENSURE( INIT_FLDTYPES <= nFld, "don't remove InitFlds" );
/*
* Dependent fields present -> ErrRaise
*/
- sal_uInt16 nSize = mpFldTypes->size();
+ size_t nSize = mpFldTypes->size();
if(nFld < nSize)
{
SwFieldType* pTmp = (*mpFldTypes)[nFld];
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 08bb056..1dbcb13 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -667,7 +667,7 @@ const SfxPoolItem& SwDoc::GetDefault( sal_uInt16 nFmtHint ) const
}
/// Delete the formats
-void SwDoc::DelCharFmt(sal_uInt16 nFmt, bool bBroadcast)
+void SwDoc::DelCharFmt(size_t nFmt, bool bBroadcast)
{
SwCharFmt * pDel = (*mpCharFmtTbl)[nFmt];
@@ -691,8 +691,8 @@ void SwDoc::DelCharFmt(sal_uInt16 nFmt, bool bBroadcast)
void SwDoc::DelCharFmt( SwCharFmt *pFmt, bool bBroadcast )
{
- sal_uInt16 nFmt = mpCharFmtTbl->GetPos( pFmt );
- OSL_ENSURE( USHRT_MAX != nFmt, "Fmt not found," );
+ size_t nFmt = mpCharFmtTbl->GetPos( pFmt );
+ OSL_ENSURE( SIZE_MAX != nFmt, "Fmt not found," );
DelCharFmt( nFmt, bBroadcast );
}
@@ -952,7 +952,7 @@ SwGrfFmtColl* SwDoc::MakeGrfFmtColl( const OUString &rFmtName,
return pFmtColl;
}
-void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, bool bBroadcast)
+void SwDoc::DelTxtFmtColl(size_t nFmtColl, bool bBroadcast)
{
OSL_ENSURE( nFmtColl, "Remove fuer Coll 0." );
@@ -991,8 +991,8 @@ void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, bool bBroadcast)
void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, bool bBroadcast )
{
- sal_uInt16 nFmt = mpTxtFmtCollTbl->GetPos( pColl );
- OSL_ENSURE( USHRT_MAX != nFmt, "Collection not found," );
+ size_t nFmt = mpTxtFmtCollTbl->GetPos( pColl );
+ OSL_ENSURE( SIZE_MAX != nFmt, "Collection not found," );
DelTxtFmtColl( nFmt, bBroadcast );
}
diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx
index 631efa7..a971af3 100644
--- a/sw/source/core/fields/dbfld.cxx
+++ b/sw/source/core/fields/dbfld.cxx
@@ -89,9 +89,9 @@ void SwDBFieldType::ReleaseRef()
if (--nRefCnt <= 0)
{
- sal_uInt16 nPos = GetDoc()->getIDocumentFieldsAccess().GetFldTypes()->GetPos(this);
+ size_t nPos = GetDoc()->getIDocumentFieldsAccess().GetFldTypes()->GetPos(this);
- if (nPos != USHRT_MAX)
+ if (nPos != SIZE_MAX)
{
GetDoc()->getIDocumentFieldsAccess().RemoveFldType(nPos);
delete this;
diff --git a/sw/source/core/inc/DocumentFieldsManager.hxx b/sw/source/core/inc/DocumentFieldsManager.hxx
index c29a4d9..010481d 100644
--- a/sw/source/core/inc/DocumentFieldsManager.hxx
+++ b/sw/source/core/inc/DocumentFieldsManager.hxx
@@ -40,7 +40,7 @@ public:
virtual SwFieldType *InsertFldType(const SwFieldType &) SAL_OVERRIDE;
virtual SwFieldType *GetSysFldType( const sal_uInt16 eWhich ) const SAL_OVERRIDE;
virtual SwFieldType* GetFldType(sal_uInt16 nResId, const OUString& rName, bool bDbFieldMatching) const SAL_OVERRIDE;
- virtual void RemoveFldType(sal_uInt16 nFld) SAL_OVERRIDE;
+ virtual void RemoveFldType(size_t nFld) SAL_OVERRIDE;
virtual void UpdateFlds( SfxPoolItem* pNewHt, bool bCloseDB) SAL_OVERRIDE;
virtual void InsDeletedFldType(SwFieldType &) SAL_OVERRIDE;
virtual bool PutValueToField(const SwPosition & rPos, const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich) SAL_OVERRIDE;
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index dd9bc11..14417ca 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -461,7 +461,7 @@ SwTOXBase& SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& rSource )
{
maMSTOCExpression = rSource.maMSTOCExpression;
SwTOXType* pType = const_cast<SwTOXType*>(rSource.GetTOXType());
- if( pDoc && USHRT_MAX == pDoc->GetTOXTypes().GetPos( pType ))
+ if( pDoc && !pDoc->GetTOXTypes().Contains( pType ))
{
// type not in pDoc, so create it now
const SwTOXTypes& rTypes = pDoc->GetTOXTypes();
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 1c1a7fc..60e5111 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -522,14 +522,12 @@ void SwHistoryChangeFmtColl::SetInDoc( SwDoc* pDoc, bool )
{
if ( ND_TEXTNODE == m_nNodeType )
{
- if ( USHRT_MAX != pDoc->GetTxtFmtColls()->GetPos(
- static_cast<SwTxtFmtColl * const>(m_pColl) ))
+ if (pDoc->GetTxtFmtColls()->Contains( static_cast<SwTxtFmtColl * const>(m_pColl) ))
{
pCntntNd->ChgFmtColl( m_pColl );
}
}
- else if ( USHRT_MAX != pDoc->GetGrfFmtColls()->GetPos(
- static_cast<SwGrfFmtColl * const>(m_pColl) ))
+ else if (pDoc->GetGrfFmtColls()->Contains( static_cast<SwGrfFmtColl * const>(m_pColl) ))
{
pCntntNd->ChgFmtColl( m_pColl );
}
@@ -873,8 +871,7 @@ void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool )
{
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
- const sal_uInt16 nPos = pDoc->GetSpzFrmFmts()->GetPos( &m_rFmt );
- if ( USHRT_MAX != nPos ) // Format does still exist
+ if ( pDoc->GetSpzFrmFmts()->Contains( &m_rFmt ) ) // Format does still exist
{
SwFmtAnchor aTmp( m_rFmt.GetAnchor() );
@@ -912,12 +909,12 @@ SwHistoryChangeFlyChain::SwHistoryChangeFlyChain( SwFlyFrmFmt& rFmt,
void SwHistoryChangeFlyChain::SetInDoc( SwDoc* pDoc, bool )
{
- if ( USHRT_MAX != pDoc->GetSpzFrmFmts()->GetPos( m_pFlyFmt ) )
+ if (pDoc->GetSpzFrmFmts()->Contains( m_pFlyFmt ) )
{
SwFmtChain aChain;
if ( m_pPrevFmt &&
- USHRT_MAX != pDoc->GetSpzFrmFmts()->GetPos( m_pPrevFmt ) )
+ pDoc->GetSpzFrmFmts()->Contains( m_pPrevFmt ) )
{
aChain.SetPrev( m_pPrevFmt );
SwFmtChain aTmp( m_pPrevFmt->GetChain() );
@@ -926,7 +923,7 @@ void SwHistoryChangeFlyChain::SetInDoc( SwDoc* pDoc, bool )
}
if ( m_pNextFmt &&
- USHRT_MAX != pDoc->GetSpzFrmFmts()->GetPos( m_pNextFmt ) )
+ pDoc->GetSpzFrmFmts()->Contains( m_pNextFmt ) )
{
aChain.SetNext( m_pNextFmt );
SwFmtChain aTmp( m_pNextFmt->GetChain() );
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 458d1a8..eac70f8 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -233,20 +233,20 @@ bool SwUndoFmtAttr::IsFmtInDoc( SwDoc* pDoc )
{
// search for the Format in the Document; if it does not exist any more,
// the attribute is not restored!
- sal_uInt16 nPos = USHRT_MAX;
+ bool bFound = false;
switch ( m_nFmtWhich )
{
case RES_TXTFMTCOLL:
- nPos = pDoc->GetTxtFmtColls()->GetPos( m_pFmt );
+ bFound = pDoc->GetTxtFmtColls()->Contains( m_pFmt );
break;
case RES_GRFFMTCOLL:
- nPos = pDoc->GetGrfFmtColls()->GetPos(
+ bFound = pDoc->GetGrfFmtColls()->Contains(
static_cast<const SwGrfFmtColl*>(m_pFmt) );
break;
case RES_CHRFMT:
- nPos = pDoc->GetCharFmts()->GetPos( m_pFmt );
+ bFound = pDoc->GetCharFmts()->Contains( m_pFmt );
break;
case RES_FRMFMT:
@@ -257,14 +257,14 @@ bool SwUndoFmtAttr::IsFmtInDoc( SwDoc* pDoc )
{
m_pFmt =
static_cast<SwTableNode*>(pNd)->GetTable().GetFrmFmt();
- nPos = 0;
+ bFound = true;
break;
}
else if ( pNd->IsSectionNode() )
{
m_pFmt =
static_cast<SwSectionNode*>(pNd)->GetSection().GetFmt();
- nPos = 0;
+ bFound = true;
break;
}
else if ( pNd->IsStartNode() && (SwTableBoxStartNode ==
@@ -278,7 +278,7 @@ bool SwUndoFmtAttr::IsFmtInDoc( SwDoc* pDoc )
if ( pBox )
{
m_pFmt = pBox->GetFrmFmt();
- nPos = 0;
+ bFound = true;
break;
}
}
@@ -287,15 +287,15 @@ bool SwUndoFmtAttr::IsFmtInDoc( SwDoc* pDoc )
// no break!
case RES_DRAWFRMFMT:
case RES_FLYFRMFMT:
- nPos = pDoc->GetSpzFrmFmts()->GetPos( m_pFmt );
- if ( USHRT_MAX == nPos )
+ bFound = pDoc->GetSpzFrmFmts()->Contains( m_pFmt );
+ if ( !bFound )
{
- nPos = pDoc->GetFrmFmts()->GetPos( m_pFmt );
+ bFound = pDoc->GetFrmFmts()->Contains( m_pFmt );
}
break;
}
- if ( USHRT_MAX == nPos )
+ if ( !bFound )
{
// Format does not exist; reset
m_pFmt = 0;
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 0ef2e5f6..9977593 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -537,7 +537,7 @@ void SwUndoSetFlyFmt::UndoImpl(::sw::UndoRedoContext & rContext)
SwDoc & rDoc = rContext.GetDoc();
// Is the new Format still existent?
- if( USHRT_MAX != rDoc.GetFrmFmts()->GetPos( pOldFmt ) )
+ if( rDoc.GetFrmFmts()->Contains( pOldFmt ) )
{
if( bAnchorChgd )
pFrmFmt->DelFrms();
@@ -610,7 +610,7 @@ void SwUndoSetFlyFmt::RedoImpl(::sw::UndoRedoContext & rContext)
SwDoc & rDoc = rContext.GetDoc();
// Is the new Format still existent?
- if( USHRT_MAX != rDoc.GetFrmFmts()->GetPos( pNewFmt ) )
+ if( rDoc.GetFrmFmts()->Contains( pNewFmt ) )
{
if( bAnchorChgd )
diff --git a/sw/source/core/undo/unfmco.cxx b/sw/source/core/undo/unfmco.cxx
index dd73605..458b400 100644
--- a/sw/source/core/undo/unfmco.cxx
+++ b/sw/source/core/undo/unfmco.cxx
@@ -72,10 +72,9 @@ void SwUndoFmtColl::DoSetFmtColl(SwDoc & rDoc, SwPaM & rPaM)
{
// Only one TextFrmColl can be applied to a section, thus request only in
// this array.
- sal_uInt16 const nPos = rDoc.GetTxtFmtColls()->GetPos(
- static_cast<SwTxtFmtColl*>(pFmtColl) );
+
// does the format still exist?
- if( USHRT_MAX != nPos )
+ if( rDoc.GetTxtFmtColls()->Contains(static_cast<SwTxtFmtColl*>(pFmtColl)) )
{
rDoc.SetTxtFmtColl(rPaM, static_cast<SwTxtFmtColl*>(pFmtColl), mbReset,
mbResetListAttrs);
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 48d39db..fe957e5 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -889,8 +889,8 @@ _SaveTable::~_SaveTable()
sal_uInt16 _SaveTable::AddFmt( SwFrmFmt* pFmt, bool bIsLine )
{
- sal_uInt16 nRet = aFrmFmts.GetPos( pFmt );
- if( USHRT_MAX == nRet )
+ size_t nRet = aFrmFmts.GetPos( pFmt );
+ if( SIZE_MAX == nRet )
{
// Create copy of ItemSet
std::shared_ptr<SfxItemSet> pSet( new SfxItemSet( *pFmt->GetAttrSet().GetPool(),
@@ -917,7 +917,7 @@ sal_uInt16 _SaveTable::AddFmt( SwFrmFmt* pFmt, bool bIsLine )
aSets.push_back( pSet );
aFrmFmts.insert( aFrmFmts.begin() + nRet, pFmt );
}
- return nRet;
+ return static_cast<sal_uInt16>(nRet);
}
void _SaveTable::RestoreAttr( SwTable& rTbl, bool bMdfyBox )
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 7490dae..126e2eb 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -229,7 +229,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
pTxtNode->ResetAllAttr();
- if( USHRT_MAX != pDoc->GetTxtFmtColls()->GetPos( pTxtFmtColl ))
+ if( pDoc->GetTxtFmtColls()->Contains( pTxtFmtColl ))
pTxtFmtColl = static_cast<SwTxtFmtColl*>(pTxtNode->ChgFmtColl( pTxtFmtColl )) ;
pHistory->SetTmpEnd( nSetPos );
@@ -268,7 +268,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
pPam->Exchange();
}
- if( USHRT_MAX != pDoc->GetTxtFmtColls()->GetPos( pTxtFmtColl ))
+ if( pDoc->GetTxtFmtColls()->Contains( pTxtFmtColl ))
{
SwTxtNode* pTxtNd = pPam->GetMark()->nNode.GetNode().GetTxtNode();
if( pTxtNd )
@@ -276,7 +276,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
}
pTxtFmtColl = pSavTxtFmtColl;
- if( pLastNdColl && USHRT_MAX != pDoc->GetTxtFmtColls()->GetPos( pLastNdColl ) &&
+ if( pLastNdColl && pDoc->GetTxtFmtColls()->Contains( pLastNdColl ) &&
pPam->GetPoint()->nNode != pPam->GetMark()->nNode )
{
SwTxtNode* pTxtNd = pPam->GetPoint()->nNode.GetNode().GetTxtNode();
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index fcec807..a1c9376 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -224,7 +224,7 @@ sal_uLong SwReader::Read( const Reader& rOptions )
{
SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[ n ];
const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
- if( USHRT_MAX == aFlyFrmArr.GetPos( pFrmFmt) )
+ if( !aFlyFrmArr.Contains( pFrmFmt) )
{
SwPosition const*const pFrameAnchor(
rAnchor.GetCntntAnchor());
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 77b8271..682eb68 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1007,7 +1007,7 @@ sal_uInt32 WW8Export::GetSdrOrdNum( const SwFrmFmt& rFmt ) const
{
// no Layout for this format, then recalc the ordnum
SwFrmFmt* pFmt = const_cast<SwFrmFmt*>(&rFmt);
- nOrdNum = m_pDoc->GetSpzFrmFmts()->GetPos( pFmt );
+ nOrdNum = static_cast<sal_uInt32>(m_pDoc->GetSpzFrmFmts()->GetPos( pFmt ));
const SwDrawModel* pModel = m_pDoc->getIDocumentDrawModelAccess().GetDrawModel();
if( pModel )
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 5a59b0b..c9185fd 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -100,7 +100,7 @@ sal_uInt16 MSWordExportBase::GetId( const SwNumRule& rNumRule )
}
}
SwNumRule* p = const_cast<SwNumRule*>(&rNumRule);
- sal_uInt16 nRet = m_pUsedNumTbl->GetPos(p);
+ sal_uInt16 nRet = static_cast<sal_uInt16>(m_pUsedNumTbl->GetPos(p));
// Is this list now duplicated into a new list which we should use
// #i77812# - perform 'deep' search in duplication map
commit bc9d02b0ca6244b46c9e2c59b7cc3618eb0f0148
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
Date: Mon Apr 6 12:23:09 2015 +0300
tdf#89783: sal_uInt16 replacement by size_t: sections
These replacements allow LO to load, save and mail merge documents having
more than 65536 sections in total.
Change-Id: I0e70889b1edc6e472a39f1f2638ac3c70a0d7058
Signed-off-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 6daed2f..c935ede 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1375,7 +1375,7 @@ public:
const SwSectionFmts& GetSections() const { return *mpSectionFmtTbl; }
SwSectionFmt *MakeSectionFmt( SwSectionFmt *pDerivedFrom );
void DelSectionFmt( SwSectionFmt *pFmt, bool bDelNodes = false );
- void UpdateSection(sal_uInt16 const nSect, SwSectionData &,
+ void UpdateSection(size_t const nSect, SwSectionData &,
SfxItemSet const*const = 0, bool const bPreventLinkUpdate = false);
OUString GetUniqueSectionName( const OUString* pChkStr = 0 ) const;
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 93590f6..386bf51 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -99,10 +99,10 @@ public:
this->erase( begin() + aStartIdx, begin() + aEndIdx);
}
- sal_uInt16 GetPos(Value const& p) const
+ size_t GetPos(Value const& p) const
{
const_iterator const it = std::find(begin(), end(), p);
- return it == end() ? USHRT_MAX : it - begin();
+ return it == end() ? SIZE_MAX : it - begin();
}
bool Contains(Value const& p) const
@@ -126,7 +126,7 @@ public:
virtual Value GetFmt(size_t idx) const SAL_OVERRIDE
{ return std::vector<Value>::operator[](idx); }
- inline sal_uInt16 GetPos(const SwFmt *p) const
+ inline size_t GetPos(const SwFmt *p) const
{ return SwVectorModifyBase<Value>::GetPos( static_cast<Value>( const_cast<SwFmt*>( p ) ) ); }
inline bool Contains(const SwFmt *p) const {
Value p2 = dynamic_cast<Value>(const_cast<SwFmt*>(p));
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 4e3ca7e..cca79a1 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -820,11 +820,11 @@ public:
and not an inner one. */
SwSection* GetAnySection( bool bOutOfTab = false, const Point* pPt = 0 );
- sal_uInt16 GetSectionFmtCount() const;
- sal_uInt16 GetSectionFmtPos( const SwSectionFmt& ) const;
- const SwSectionFmt& GetSectionFmt(sal_uInt16 nFmt) const;
- void DelSectionFmt( sal_uInt16 nFmt );
- void UpdateSection(sal_uInt16 const nSect, SwSectionData &,
+ size_t GetSectionFmtCount() const;
+ size_t GetSectionFmtPos(const SwSectionFmt&) const;
+ const SwSectionFmt& GetSectionFmt(size_t nFmt) const;
+ void DelSectionFmt( size_t nFmt);
+ void UpdateSection( size_t const nSect, SwSectionData &,
SfxItemSet const*const = 0);
bool IsAnySectionInDoc( bool bChkReadOnly = false,
bool bChkHidden = false,
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 65a476a..eaf0410 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1378,7 +1378,7 @@ bool SwDoc::RemoveInvisibleContent()
SwSectionData aSectionData( *pSect );
aSectionData.SetCondition( OUString() );
aSectionData.SetHidden( false );
- UpdateSection( static_cast<sal_uInt16>(n), aSectionData );
+ UpdateSection( n, aSectionData );
}
}
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 1504807..9bb5888 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -606,8 +606,8 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, bool bDelNodes )
getIDocumentState().SetModified();
}
-void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData,
- SfxItemSet const*const pAttr, bool const bPreventLinkUpdate)
+void SwDoc::UpdateSection( size_t const nPos, SwSectionData & rNewData,
+ SfxItemSet const*const pAttr, bool const bPreventLinkUpdate )
{
SwSectionFmt* pFmt = (*mpSectionFmtTbl)[ nPos ];
SwSection* pSection = pFmt->GetSection();
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index dc046d3..028a6f2 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -110,7 +110,7 @@ SwSection* SwEditShell::GetAnySection( bool bOutOfTab, const Point* pPt )
return NULL;
}
-sal_uInt16 SwEditShell::GetSectionFmtCount() const
+size_t SwEditShell::GetSectionFmtCount() const
{
return GetDoc()->GetSections().size();
}
@@ -137,18 +137,18 @@ bool SwEditShell::IsAnySectionInDoc( bool bChkReadOnly, bool bChkHidden, bool bC
return false;
}
-sal_uInt16 SwEditShell::GetSectionFmtPos( const SwSectionFmt& rFmt ) const
+size_t SwEditShell::GetSectionFmtPos( const SwSectionFmt& rFmt ) const
{
SwSectionFmt* pFmt = const_cast<SwSectionFmt*>(&rFmt);
return GetDoc()->GetSections().GetPos( pFmt );
}
-const SwSectionFmt& SwEditShell::GetSectionFmt( sal_uInt16 nFmt ) const
+const SwSectionFmt& SwEditShell::GetSectionFmt(size_t nFmt) const
{
return *GetDoc()->GetSections()[ nFmt ];
}
-void SwEditShell::DelSectionFmt( sal_uInt16 nFmt )
+void SwEditShell::DelSectionFmt(size_t nFmt)
{
StartAllAction();
GetDoc()->DelSectionFmt( GetDoc()->GetSections()[ nFmt ] );
@@ -157,7 +157,7 @@ void SwEditShell::DelSectionFmt( sal_uInt16 nFmt )
EndAllAction();
}
-void SwEditShell::UpdateSection(sal_uInt16 const nSect,
+void SwEditShell::UpdateSection(size_t const nSect,
SwSectionData & rNewData, SfxItemSet const*const pAttr)
{
StartAllAction();
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index a55cd80..2a4de5c 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1682,7 +1682,7 @@ throw (uno::RuntimeException, std::exception)
aSection.SetSectionName(rName);
const SwSectionFmts& rFmts = pFmt->GetDoc()->GetSections();
- sal_uInt16 nApplyPos = USHRT_MAX;
+ size_t nApplyPos = SIZE_MAX;
for( size_t i = 0; i < rFmts.size(); ++i )
{
if(rFmts[i]->GetSection() == pSect)
@@ -1694,7 +1694,7 @@ throw (uno::RuntimeException, std::exception)
throw uno::RuntimeException();
}
}
- if(nApplyPos != USHRT_MAX)
+ if (nApplyPos != SIZE_MAX)
{
{
UnoActionContext aContext(pFmt->GetDoc());
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index d72739d..2281069 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -73,8 +73,8 @@ static void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAva
{
if( !pNewFmt )
{
- const sal_uInt16 nCount = rSh.GetSectionFmtCount();
- for(sal_uInt16 i=0;i<nCount;i++)
+ const size_t nCount = rSh.GetSectionFmtCount();
+ for (size_t i = 0; i<nCount; i++)
{
SectionType eTmpType;
const SwSectionFmt* pFmt = &rSh.GetSectionFmt(i);
@@ -142,7 +142,7 @@ private:
SwFmtNoBalancedColumns m_Balance;
SvxFrameDirectionItem m_FrmDirItem;
SvxLRSpaceItem m_LRSpaceItem;
- sal_uInt16 m_nArrPos;
+ size_t m_nArrPos;
// shows, if maybe textcontent is in the region
bool m_bContent : 1;
// for multiselection, mark at first, then work with TreeListBox!
@@ -150,7 +150,7 @@ private:
uno::Sequence<sal_Int8> m_TempPasswd;
public:
- SectRepr(sal_uInt16 nPos, SwSection& rSect);
+ SectRepr(size_t nPos, SwSection& rSect);
bool operator< (const SectRepr& rSectRef) const
{ return m_nArrPos < rSectRef.GetArrPos(); }
@@ -164,7 +164,7 @@ public:
SvxFrameDirectionItem& GetFrmDir() { return m_FrmDirItem; }
SvxLRSpaceItem& GetLRSpace() { return m_LRSpaceItem; }
- sal_uInt16 GetArrPos() const { return m_nArrPos; }
+ size_t GetArrPos() const { return m_nArrPos; }
OUString GetFile() const;
OUString GetSubRegion() const;
void SetFile(OUString const& rFile);
@@ -182,7 +182,7 @@ public:
{ m_TempPasswd = rPasswd; }
};
-SectRepr::SectRepr( sal_uInt16 nPos, SwSection& rSect )
+SectRepr::SectRepr( size_t nPos, SwSection& rSect )
: m_SectionData( rSect )
, m_Brush( RES_BACKGROUND )
, m_FrmDirItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR )
@@ -443,8 +443,8 @@ void SwEditRegionDlg::RecurseList( const SwSectionFmt* pFmt, SvTreeListEntry* pE
SvTreeListEntry* pSelEntry = 0;
if (!pFmt)
{
- const sal_uInt16 nCount=rSh.GetSectionFmtCount();
- for ( sal_uInt16 n=0; n < nCount; n++ )
+ const size_t nCount=rSh.GetSectionFmtCount();
+ for ( size_t n = 0; n < nCount; n++ )
{
SectionType eTmpType;
if( !( pFmt = &rSh.GetSectionFmt(n))->GetParent() &&
@@ -503,15 +503,15 @@ void SwEditRegionDlg::RecurseList( const SwSectionFmt* pFmt, SvTreeListEntry* pE
}
}
-sal_uInt16 SwEditRegionDlg::FindArrPos(const SwSectionFmt* pFmt )
+size_t SwEditRegionDlg::FindArrPos(const SwSectionFmt* pFmt )
{
- const sal_uInt16 nCount=rSh.GetSectionFmtCount();
- for (sal_uInt16 i=0;i<nCount;i++)
- if (pFmt==&rSh.GetSectionFmt(i))
+ const size_t nCount=rSh.GetSectionFmtCount();
+ for ( size_t i = 0; i < nCount; i++ )
+ if ( pFmt == &rSh.GetSectionFmt(i) )
return i;
OSL_FAIL("SectionFormat not on the list" );
- return USHRT_MAX;
+ return SIZE_MAX;
}
SwEditRegionDlg::~SwEditRegionDlg( )
@@ -784,8 +784,8 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl)
{
pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
}
- sal_uInt16 nNewPos = rDocFmts.GetPos( pFmt );
- if( USHRT_MAX != nNewPos )
+ size_t nNewPos = rDocFmts.GetPos(pFmt);
+ if ( SIZE_MAX != nNewPos )
{
boost::scoped_ptr<SfxItemSet> pSet(pFmt->GetAttrSet().Clone( false ));
if( pFmt->GetCol() != pRepr->GetCol() )
@@ -819,8 +819,8 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl)
for (SectReprArr::reverse_iterator aI = aSectReprArr.rbegin(), aEnd = aSectReprArr.rend(); aI != aEnd; ++aI)
{
SwSectionFmt* pFmt = aOrigArray[ aI->GetArrPos() ];
- const sal_uInt16 nNewPos = rDocFmts.GetPos( pFmt );
- if( USHRT_MAX != nNewPos )
+ const size_t nNewPos = rDocFmts.GetPos( pFmt );
+ if( SIZE_MAX != nNewPos )
rSh.DelSectionFmt( nNewPos );
}
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index c4b915a..ff77810 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -332,7 +332,7 @@ IMPL_LINK_NOARG(SwColumnDlg, OkHdl)
{
const SwSection* pCurrSection = rWrtShell.GetCurrSection();
const SwSectionFmt* pFmt = pCurrSection->GetFmt();
- const sal_uInt16 nNewPos = rWrtShell.GetSectionFmtPos( *pFmt );
+ const size_t nNewPos = rWrtShell.GetSectionFmtPos( *pFmt );
SwSectionData aData(*pCurrSection);
rWrtShell.UpdateSection( nNewPos, aData, pSectionSet );
}
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index a9b95cf..d315405 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -782,8 +782,8 @@ static void lcl_CopyFollowPageDesc(
static void lcl_RemoveSectionLinks( SwWrtShell& rWorkShell )
{
//reset all links of the sections of synchronized labels
- sal_uInt16 nSections = rWorkShell.GetSectionFmtCount();
- for( sal_uInt16 nSection = 0; nSection < nSections; ++nSection )
+ size_t nSections = rWorkShell.GetSectionFmtCount();
+ for (size_t nSection = 0; nSection < nSections; ++nSection)
{
SwSectionData aSectionData( *rWorkShell.GetSectionFmt( nSection ).GetSection() );
if( aSectionData.GetType() == FILE_LINK_SECTION )
diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx
index 633362531..91dcb6f 100644
--- a/sw/source/uibase/inc/regionsw.hxx
+++ b/sw/source/uibase/inc/regionsw.hxx
@@ -103,7 +103,7 @@ class SwEditRegionDlg : public SfxModalDialog
Image BuildBitmap(bool bProtect, bool bHidden);
void RecurseList( const SwSectionFmt* pFmt, SvTreeListEntry* pEntry);
- sal_uInt16 FindArrPos(const SwSectionFmt* pFmt);
+ size_t FindArrPos(const SwSectionFmt* pFmt);
DECL_LINK( GetFirstEntryHdl, SvTreeListBox * );
DECL_LINK( DeselectHdl, SvTreeListBox * );
More information about the Libreoffice-commits
mailing list