diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-07-20 17:39:59 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-07-22 23:50:42 +0200 |
commit | 05dda9a913122a7d9f5715868824c487da0d2534 (patch) | |
tree | 5bc78828fd6ac530718d3eed581b5c1c3395cc9c /sw/source/core | |
parent | c5fc11de967b3bfeda5ae63746364468baa26981 (diff) |
SwpHintsArray/SwpHints and related: sal_uInt16 to size_t
Change-Id: I9a7674109b05683287e12cbce6bc417b40ca5084
Diffstat (limited to 'sw/source/core')
38 files changed, 161 insertions, 157 deletions
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx index 0b8bb183fd0e..c9713cb13d5b 100644 --- a/sw/source/core/access/acchyperlink.cxx +++ b/sw/source/core/access/acchyperlink.cxx @@ -34,7 +34,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using ::com::sun::star::lang::IndexOutOfBoundsException; -SwAccessibleHyperlink::SwAccessibleHyperlink( sal_uInt16 nHPos, +SwAccessibleHyperlink::SwAccessibleHyperlink( size_t nHPos, SwAccessibleParagraph *p, sal_Int32 nStt, sal_Int32 nEnd ) : nHintPos( nHPos ), xPara( p ), diff --git a/sw/source/core/access/acchyperlink.hxx b/sw/source/core/access/acchyperlink.hxx index c7e62e896734..2c68c77080e2 100644 --- a/sw/source/core/access/acchyperlink.hxx +++ b/sw/source/core/access/acchyperlink.hxx @@ -34,12 +34,12 @@ class SwAccessibleHyperlink : { friend class SwAccessibleParagraph; friend class SwAccessibleHyperTextData; - sal_uInt16 nHintPos; + size_t nHintPos; ::rtl::Reference< SwAccessibleParagraph > xPara; sal_Int32 nStartIdx; sal_Int32 nEndIdx; - SwAccessibleHyperlink( sal_uInt16 nHintPos, + SwAccessibleHyperlink( size_t nHintPos, SwAccessibleParagraph *p, sal_Int32 nStt, sal_Int32 nEnd ); diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index a48455662e4e..3ac13e295f5a 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1452,8 +1452,8 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) const SwpHints* pSwpHints = GetTxtNode()->GetpSwpHints(); if (pSwpHints) { - const sal_uInt16 nSize = pSwpHints->Count(); - for( sal_uInt16 i = 0; i < nSize; ++i ) + const size_t nSize = pSwpHints->Count(); + for( size_t i = 0; i < nSize; ++i ) { const SwTxtAttr* pHt = (*pSwpHints)[i]; if ( ( pHt->Which() == RES_TXTATR_FIELD @@ -3104,12 +3104,12 @@ class SwHyperlinkIter_Impl const SwpHints *pHints; sal_Int32 nStt; sal_Int32 nEnd; - sal_uInt16 nPos; + size_t nPos; public: SwHyperlinkIter_Impl( const SwTxtFrm *pTxtFrm ); const SwTxtAttr *next(); - sal_uInt16 getCurrHintPos() const { return nPos-1; } + size_t getCurrHintPos() const { return nPos-1; } sal_Int32 startIdx() const { return nStt; } sal_Int32 endIdx() const { return nEnd; } diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index a8449fbebdb0..ea9ceb0e609e 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -163,7 +163,7 @@ SwCallLink::~SwCallLink() { const SwpHints &rHts = ((SwTxtNode*)pCNd)->GetSwpHints(); - for( sal_uInt16 n = 0; n < rHts.Count(); n++ ) + for( size_t n = 0; n < rHts.Count(); ++n ) { const SwTxtAttr* pHt = rHts[ n ]; const sal_Int32 *pEnd = pHt->End(); diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 6fcef4ac0344..90c1713f716a 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1515,7 +1515,7 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, POOLATTR_END - 1 ); if( pTxtNd->GetpSwpHints() ) { - for( sal_uInt16 i = 0; i < pTxtNd->GetSwpHints().Count(); ++i ) + for( size_t i = 0; i < pTxtNd->GetSwpHints().Count(); ++i ) { const SwTxtAttr* pHt = pTxtNd->GetSwpHints()[i]; const sal_Int32 nAttrStart = pHt->GetStart(); diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 21aa5317d4fe..82e9904ad684 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -706,7 +706,7 @@ static int lcl_SearchForward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, const SwpHints& rHtArr = rTxtNd.GetSwpHints(); const SwTxtAttr* pAttr; - sal_uInt16 nPos = 0; + size_t nPos = 0; // if everything is already there then check with which it will be ended if( rCmpArr.Found() ) @@ -780,7 +780,7 @@ static int lcl_SearchBackward( const SwTxtNode& rTxtNd, SwAttrCheckArr& rCmpArr, const SwpHints& rHtArr = rTxtNd.GetSwpHints(); const SwTxtAttr* pAttr; - sal_uInt16 nPos = rHtArr.Count(); + size_t nPos = rHtArr.Count(); sal_Int32 nSttPos; // if everything is already there then check with which it will be ended diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index e6af7316df28..9f329fce4021 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -54,7 +54,7 @@ lcl_CleanStr(const SwTxtNode& rNd, sal_Int32 const nStart, sal_Int32& rEnd, const SwpHints *pHts = rNd.GetpSwpHints(); - sal_uInt16 n = 0; + size_t n = 0; sal_Int32 nSoftHyphen = nStart; sal_Int32 nHintStart = -1; bool bNewHint = true; @@ -182,12 +182,12 @@ lcl_CleanStr(const SwTxtNode& rNd, sal_Int32 const nStart, sal_Int32& rEnd, } // skip all non SwPostIts inside the array -sal_Int32 GetPostIt(sal_Int32 aCount,const SwpHints *pHts) +size_t GetPostIt(sal_Int32 aCount,const SwpHints *pHts) { - sal_Int32 aIndex = 0; + size_t aIndex = 0; while (aCount) { - for (sal_Int32 i = 0; i < pHts->Count(); i++ ) + for (size_t i = 0; i < pHts->Count(); ++i ) { aIndex++; const SwTxtAttr* pTxtAttr = (*pHts)[i]; @@ -200,7 +200,7 @@ sal_Int32 GetPostIt(sal_Int32 aCount,const SwpHints *pHts) } } // throw away all following non postits - for( sal_Int32 i = aIndex; i < pHts->Count(); i++ ) + for( size_t i = aIndex; i < pHts->Count(); ++i ) { const SwTxtAttr* pTxtAttr = (*pHts)[i]; if ( pTxtAttr->Which() == RES_TXTATR_ANNOTATION ) @@ -264,7 +264,7 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te std::swap(nStart, nEnd); } - for( sal_Int32 i = 0; i < pHts->Count(); i++ ) + for( size_t i = 0; i < pHts->Count(); ++i ) { const SwTxtAttr* pTxtAttr = (*pHts)[i]; if ( pTxtAttr->Which()==RES_TXTATR_ANNOTATION ) diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 824ac667cb41..d094df7d8f78 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -321,7 +321,7 @@ static const OUString lcl_dbg_out(const SwpHints & rHints) { OUString aStr("[ SwpHints\n"); - for (sal_uInt16 i = 0; i < rHints.Count(); i++) + for (size_t i = 0; i < rHints.Count(); ++i) { aStr += " "; aStr += lcl_dbg_out(*rHints[i]); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index df6bc19bafc6..3288259f3462 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -2170,8 +2170,9 @@ bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLong nLen ) // update chapter fields b = true; else if( pTNd->GetpSwpHints() && pTNd->GetSwpHints().Count() ) - for( sal_uInt16 n = 0, nEnd = pTNd->GetSwpHints().Count(); - n < nEnd; ++n ) + { + const size_t nEnd = pTNd->GetSwpHints().Count(); + for( size_t n = 0 ; n < nEnd; ++n ) { const SwTxtAttr* pAttr = pTNd->GetSwpHints()[ n ]; if ( pAttr->Which() == RES_TXTATR_FIELD ) @@ -2180,6 +2181,7 @@ bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLong nLen ) break; } } + } if( b ) break; diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx index 7d5c58069b68..e32a1b8f95ff 100644 --- a/sw/source/core/doc/docruby.cxx +++ b/sw/source/core/doc/docruby.cxx @@ -205,14 +205,14 @@ bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_uInt // search the start // look where a ruby attribute starts - sal_uInt16 nHtIdx = USHRT_MAX; const SwpHints* pHts = pTNd->GetpSwpHints(); const SwTxtAttr* pAttr = 0; if( pHts ) { - const SwTxtAttr* pHt; - for( nHtIdx = 0; nHtIdx < pHts->Count(); ++nHtIdx ) - if( RES_TXTATR_CJK_RUBY == ( pHt = (*pHts)[ nHtIdx ])->Which() && + for( size_t nHtIdx = 0; nHtIdx < pHts->Count(); ++nHtIdx ) + { + const SwTxtAttr* pHt = (*pHts)[ nHtIdx ]; + if( RES_TXTATR_CJK_RUBY == pHt->Which() && *pHt->GetAnyEnd() > nStart ) { if( pHt->GetStart() < nEnd ) @@ -226,6 +226,7 @@ bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_uInt } break; } + } } if( !bHasMark && nStart && ( !pAttr || nStart != pAttr->GetStart()) ) diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 10302c2de442..9a4d68324393 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -113,15 +113,15 @@ sal_uInt16 SwDoc::GetCurTOXMark( const SwPosition& rPos, return 0; const SwpHints & rHts = *pTxtNd->GetpSwpHints(); - const SwTxtAttr* pHt; sal_Int32 nSttIdx; const sal_Int32 *pEndIdx; const sal_Int32 nAktPos = rPos.nContent.GetIndex(); - for( sal_uInt16 n = 0; n < rHts.Count(); ++n ) + for( size_t n = 0; n < rHts.Count(); ++n ) { - if( RES_TXTATR_TOXMARK != (pHt = rHts[n])->Which() ) + const SwTxtAttr* pHt = rHts[n]; + if( RES_TXTATR_TOXMARK != pHt->Which() ) continue; if( ( nSttIdx = pHt->GetStart() ) < nAktPos ) { @@ -1694,7 +1694,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, SwCharFmt* pPageNoCharFmt = 0; SwpHints* pHints = pNd->GetpSwpHints(); if(pHints) - for(sal_uInt16 nHintIdx = 0; nHintIdx < pHints->GetStartCount(); nHintIdx++) + for(size_t nHintIdx = 0; nHintIdx < pHints->GetStartCount(); ++nHintIdx) { SwTxtAttr* pAttr = pHints->GetStart(nHintIdx); const sal_Int32 nTmpEnd = pAttr->End() ? *pAttr->End() : 0; diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 7c1983324caf..159cdcd2e375 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -712,7 +712,7 @@ void SwTxtNode::dumpAsXml( xmlTextWriterPtr w ) { writer.startElement("hints"); SwpHints& rHints = GetSwpHints(); - for (sal_uInt16 i = 0; i < rHints.Count(); ++i) + for (size_t i = 0; i < rHints.Count(); ++i) { writer.startElement("hint"); SwTxtAttr* pHint = rHints.GetTextHint(i); diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 7b5aa36fb93f..0479332d86a0 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -257,7 +257,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz, { bool const bToUndo = !pDestDoc && GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds); - for( sal_uInt16 i = pHts->Count(); i; ) + for( size_t i = pHts->Count(); i; ) { sal_uInt16 nDelMsg = 0; SwTxtAttr * const pAttr = pHts->GetTextHint( --i ); diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index dfcf6be3c246..916a22c7aa50 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -483,12 +483,11 @@ void SwDontExpandItem::RestoreDontExpandItems( const SwPosition& rPos ) if( pTxtNd->GetpSwpHints() && pTxtNd->GetpSwpHints()->Count() ) { - const sal_uInt16 nSize = pTxtNd->GetpSwpHints()->Count(); - sal_uInt16 n; + const size_t nSize = pTxtNd->GetpSwpHints()->Count(); sal_Int32 nAttrStart; const sal_Int32* pAttrEnd; - for( n = 0; n < nSize; ++n ) + for( size_t n = 0; n < nSize; ++n ) { SwTxtAttr* pHt = pTxtNd->GetpSwpHints()->GetTextHint( n ); nAttrStart = pHt->GetStart(); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 4f4fcb12fdce..3c8ea5d52b85 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1298,9 +1298,11 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < 0 != ( pHts = pTNd->GetpSwpHints() )) { // search for a sequence field: - const SfxPoolItem* pItem; - for( sal_uInt16 n = 0, nEnd = pHts->Count(); n < nEnd; ++n ) - if( RES_TXTATR_FIELD == ( pItem = &(*pHts)[ n ]->GetAttr())->Which() + const size_t nEnd = pHts->Count(); + for( size_t n = 0; n < nEnd; ++n ) + { + const SfxPoolItem* pItem = &(*pHts)[ n ]->GetAttr(); + if( RES_TXTATR_FIELD == pItem->Which() && TYP_SEQFLD == ((SwFmtFld*)pItem)->GetField()->GetTypeId() ) { // sequence field found @@ -1324,6 +1326,7 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < pFmt->GetDoc()->SetAttr( aFrmSz, *pFmt ); break; } + } } // set the new Size at the fly themself diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 36c5a4e9bb3e..9e1e655ab643 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -2468,7 +2468,7 @@ sal_uLong SwTableBox::IsValidNumTxtNd( bool bCheckAttr ) const if( pHts ) { sal_Int32 nNextSetField = 0; - for( sal_uInt16 n = 0; n < pHts->Count(); ++n ) + for( size_t n = 0; n < pHts->Count(); ++n ) { const SwTxtAttr* pAttr = (*pHts)[ n ]; if( RES_TXTATR_NOEND_BEGIN <= pAttr->Which() ) diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 29c3f3ca8852..9796be72215b 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -612,7 +612,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm() { SwFtnBossFrm *pFtnBoss = 0; SwFtnBossFrm *pEndBoss = 0; - for ( sal_uInt16 i = 0; i < pHints->Count(); ++i ) + for ( size_t i = 0; i < pHints->Count(); ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; if( RES_TXTATR_FTN==pHt->Which() && pHt->GetStart()>=nStart ) @@ -705,7 +705,7 @@ SwCntntFrm *SwTxtFrm::SplitFrm( const sal_Int32 nTxtPos ) { SwFtnBossFrm *pFtnBoss = 0; SwFtnBossFrm *pEndBoss = 0; - for ( sal_uInt16 i = 0; i < pHints->Count(); ++i ) + for ( size_t i = 0; i < pHints->Count(); ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; if( RES_TXTATR_FTN==pHt->Which() && pHt->GetStart()>=nTxtPos ) diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 53fff6802fda..c808f43049f3 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -140,7 +140,9 @@ bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFo aAttrHandler.Reset(); aAttrHandler.ResetFont( *pFnt ); - nStartIndex = nEndIndex = nPos = nChgCnt = 0; + nStartIndex = 0; + nEndIndex = 0; + nPos = nChgCnt = 0; if( nPropFont ) pFnt->SetProportion( nPropFont ); if( pRedln ) @@ -242,7 +244,9 @@ bool SwAttrIter::Seek( const sal_Int32 nNewPos ) if( nPropFont ) pFnt->SetProportion( nPropFont ); - nStartIndex = nEndIndex = nPos = 0; + nStartIndex = 0; + nEndIndex = 0; + nPos = 0; nChgCnt = 0; // Attention! @@ -275,7 +279,7 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const if( pHints ) { // are there attribute starts left? - for (sal_uInt16 i = nStartIndex; i < pHints->GetStartCount(); ++i) + for (size_t i = nStartIndex; i < pHints->GetStartCount(); ++i) { SwTxtAttr *const pAttr(pHints->GetStart(i)); if (!pAttr->IsFormatIgnoreStart()) @@ -285,7 +289,7 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const } } // are there attribute ends left? - for (sal_uInt16 i = nEndIndex; i < pHints->GetEndCount(); ++i) + for (size_t i = nEndIndex; i < pHints->GetEndCount(); ++i) { SwTxtAttr *const pAttr(pHints->GetEnd(i)); if (!pAttr->IsFormatIgnoreEnd()) diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx index c1592a305781..8e0323d6f60e 100644 --- a/sw/source/core/text/itratr.hxx +++ b/sw/source/core/text/itratr.hxx @@ -50,7 +50,9 @@ private: OutputDevice *pLastOut; MSHORT nChgCnt; SwRedlineItr *pRedln; - sal_Int32 nStartIndex, nEndIndex, nPos; + size_t nStartIndex; + size_t nEndIndex; + sal_Int32 nPos; sal_uInt8 nPropFont; const void* aMagicNo[ SW_SCRIPTS ]; MSHORT aFntIdx[ SW_SCRIPTS ]; diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx index 9eda3f9860ad..ba15c19a2acf 100644 --- a/sw/source/core/text/itrform2.hxx +++ b/sw/source/core/text/itrform2.hxx @@ -44,7 +44,7 @@ class SwTxtFormatter : public SwTxtPainter bool bChanges : 1; // Flag for calculating the repaint rectangle bool bTruncLines : 1; // Flag for extending the repaint rect, if needed bool bUnclipped : 1; // Flag whether repaint is larger than the fixed line height - sal_uInt16 m_nHintEndIndex; // HACK for TryNewNoLengthPortion + size_t m_nHintEndIndex; // HACK for TryNewNoLengthPortion SwLinePortion* m_pFirstOfBorderMerge; // The first text portion of a joined border (during portion bulding) SwLinePortion *NewPortion( SwTxtFormatInfo &rInf ); diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 5c34b7535ca1..5679010627f9 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -494,7 +494,7 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor, if( HasHints() ) { - for ( MSHORT nTmp = 0; nTmp < pHints->GetStartCount(); ++nTmp ) + for ( size_t nTmp = 0; nTmp < pHints->GetStartCount(); ++nTmp ) { SwTxtAttr* const pTxtAttr = pHints->GetStart( nTmp ); diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx index ac2f7dc5d6fd..d417d336f834 100644 --- a/sw/source/core/text/itrtxt.cxx +++ b/sw/source/core/text/itrtxt.cxx @@ -345,7 +345,7 @@ void SwTxtIter::TruncLines( bool bNoteFollow ) SwpHints* pTmpHints = GetTxtFrm()->GetTxtNode()->GetpSwpHints(); // examine hints in range nEnd - (nEnd + nRangeChar) - for( sal_uInt16 i = 0; i < pTmpHints->Count(); i++ ) + for( size_t i = 0; i < pTmpHints->Count(); ++i ) { const SwTxtAttr* pHt = pTmpHints->GetTextHint( i ); if( RES_TXTATR_FLYCNT == pHt->Which() ) diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index 46d88b41dabb..9423539437d7 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -185,7 +185,7 @@ sal_Int32 SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch ) if( !pHints ) return COMPLETE_STRING; SwTxtAttr* pFound = NULL; - for ( sal_uInt16 i = 0; i < pHints->Count(); i++) + for ( size_t i = 0; i < pHints->Count(); ++i ) { SwTxtAttr *pHt = pHints->GetTextHint( i ); if( RES_TXTATR_FLYCNT == pHt->Which() ) diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 133b7414333e..0a650df04a0f 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -2072,11 +2072,9 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTxtNode& rNode, MultiSelecti if( pHints ) { - MSHORT nTmp = 0; - - while( nTmp < pHints->GetStartCount() ) + for( size_t nTmp = 0; nTmp < pHints->GetStartCount(); ++nTmp ) { - const SwTxtAttr* pTxtAttr = pHints->GetStart( nTmp++ ); + const SwTxtAttr* pTxtAttr = pHints->GetStart( nTmp ); const SvxCharHiddenItem* pHiddenItem = static_cast<const SvxCharHiddenItem*>( CharFmt::GetItem( *pTxtAttr, RES_CHRATR_HIDDEN ) ); if( pHiddenItem ) diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index a4239b9ac745..51fc583ddf3f 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -857,11 +857,10 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( sal_Int32 &rPos, const SwTxtAttr *pRuby = NULL; bool bTwo = false; bool bRot = false; - sal_uInt16 n2Lines = USHRT_MAX; - sal_uInt16 nRotate = USHRT_MAX; - sal_uInt16 nCount = pHints ? pHints->Count() : 0; - sal_uInt16 i; - for( i = 0; i < nCount; ++i ) + size_t n2Lines = SAL_MAX_SIZE; + size_t nRotate = SAL_MAX_SIZE; + const size_t nCount = pHints ? pHints->Count() : 0; + for( size_t i = 0; i < nCount; ++i ) { const SwTxtAttr *pTmp = (*pHints)[i]; sal_Int32 nStart = pTmp->GetStart(); @@ -938,7 +937,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( sal_Int32 &rPos, // n2Lines is the index of the last 2-line-attribute, which contains // the actual position. - i = 0; + // At this moment we know that at position rPos the "winner"-attribute // causes a 2-line-portion. The end of the attribute is the end of the // portion, if there's no interrupting attribute. @@ -953,9 +952,9 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( sal_Int32 &rPos, // In the following loop rPos is the critical position and it will be // evaluated, if at rPos starts a interrupting or a maintaining // continuity attribute. - while( i < nCount ) + for( size_t i = 0; i < nCount; ++i ) { - const SwTxtAttr *pTmp = (*pHints)[i++]; + const SwTxtAttr *pTmp = (*pHints)[i]; if( *pTmp->GetAnyEnd() <= rPos ) continue; if( rPos < pTmp->GetStart() ) @@ -1029,13 +1028,11 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( sal_Int32 &rPos, // aEnd-stack, which could interrupts the winning rotation attribute. bool bOn = pItem; aEnd.push_front( GetTxt().getLength() ); - // n2Lines is the index of the last 2-line-attribute, which contains - // the actual position. - i = 0; + sal_Int32 n2Start = rPos; - while( i < nCount ) + for( size_t i = 0; i < nCount; ++i ) { - const SwTxtAttr *pTmp = (*pHints)[i++]; + const SwTxtAttr *pTmp = (*pHints)[i]; if( *pTmp->GetAnyEnd() <= n2Start ) continue; if( n2Start < pTmp->GetStart() ) @@ -1105,10 +1102,9 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( sal_Int32 &rPos, pRet->pAttr = NULL; aEnd.push_front( GetTxt().getLength() ); } - i = 0; - while( i < nCount ) + for( size_t i = 0; i < nCount; ++i ) { - const SwTxtAttr *pTmp = (*pHints)[i++]; + const SwTxtAttr *pTmp = (*pHints)[i]; if( *pTmp->GetAnyEnd() <= rPos ) continue; if( rPos < pTmp->GetStart() ) diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index d04227f6b370..9b13c2b0a99a 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -413,7 +413,7 @@ static void checkApplyParagraphMarkFormatToNumbering( SwFont* pNumFnt, SwTxtForm return; if( SwpHints* hints = node->GetpSwpHints()) { - for( int i = 0; i < hints->Count(); ++i ) + for( size_t i = 0; i < hints->Count(); ++i ) { SwTxtAttr* hint = hints->GetTextHint( i ); // Formatting for the paragraph mark is set to apply only to the (non-existent) extra character diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 2f746477f453..48649953dedf 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -436,9 +436,9 @@ void SwTxtFrm::HideFootnotes( sal_Int32 nStart, sal_Int32 nEnd ) const SwpHints *pHints = GetTxtNode()->GetpSwpHints(); if( pHints ) { - const sal_uInt16 nSize = pHints->Count(); + const size_t nSize = pHints->Count(); SwPageFrm *pPage = 0; - for ( sal_uInt16 i = 0; i < nSize; ++i ) + for ( size_t i = 0; i < nSize; ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; if ( pHt->Which() == RES_TXTATR_FTN ) @@ -1562,28 +1562,26 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid, SwpHints *pHints = GetTxtNode()->GetpSwpHints(); if( pHints ) { - const sal_uInt16 nSize = pHints->Count(); + const size_t nSize = pHints->Count(); const sal_Int32 nEnd = GetFollow() ? GetFollow()->GetOfst() : COMPLETE_STRING; - for ( sal_uInt16 i = 0; i < nSize; ++i ) + for ( size_t i = 0; i < nSize; ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; const sal_Int32 nStart = pHt->GetStart(); if( nStart >= GetOfst() ) { if( nStart >= nEnd ) - i = nSize; // induce end of the loop - else - { + break; + // 4029: wenn wir zurueckfliessen und eine Ftn besitzen, so // fliesst die Ftn in jedem Fall auch mit. Damit sie nicht im // Weg steht, schicken wir uns ein ADJUST_FRM. // pVoid != 0 bedeutet MoveBwd() - const MSHORT nWhich = pHt->Which(); - if( RES_TXTATR_FIELD == nWhich || - (HasFtn() && pVoid && RES_TXTATR_FTN == nWhich)) - InvalidateRange( SwCharRange( nStart, 1 ), 1 ); - } + const MSHORT nWhich = pHt->Which(); + if( RES_TXTATR_FIELD == nWhich || + (HasFtn() && pVoid && RES_TXTATR_FTN == nWhich)) + InvalidateRange( SwCharRange( nStart, 1 ), 1 ); } } } diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 868bce76a316..528c3e974d20 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -89,7 +89,7 @@ void SwTxtFrm::CalcFtnFlag() if( !pHints ) return; - const sal_uInt16 nSize = pHints->Count(); + const size_t nSize = pHints->Count(); #ifdef DBG_UTIL const sal_Int32 nEnd = nStop != COMPLETE_STRING ? nStop @@ -98,7 +98,7 @@ void SwTxtFrm::CalcFtnFlag() const sal_Int32 nEnd = GetFollow() ? GetFollow()->GetOfst() : COMPLETE_STRING; #endif - for ( sal_uInt16 i = 0; i < nSize; ++i ) + for ( size_t i = 0; i < nSize; ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; if ( pHt->Which() == RES_TXTATR_FTN ) @@ -391,7 +391,7 @@ void SwTxtFrm::RemoveFtn( const sal_Int32 nStart, const sal_Int32 nLen ) return; bool bRollBack = nLen != COMPLETE_STRING; - sal_uInt16 nSize = pHints->Count(); + const size_t nSize = pHints->Count(); sal_Int32 nEnd; SwTxtFrm* pSource; if( bRollBack ) @@ -415,7 +415,7 @@ void SwTxtFrm::RemoveFtn( const sal_Int32 nStart, const sal_Int32 nLen ) SwFtnBossFrm *pEndBoss = 0; bool bFtnEndDoc = FTNPOS_CHAPTER == GetNode()->GetDoc()->GetFtnInfo().ePos; - for ( sal_uInt16 i = nSize; i; ) + for ( size_t i = nSize; i; ) { SwTxtAttr *pHt = pHints->GetTextHint(--i); if ( RES_TXTATR_FTN != pHt->Which() ) diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx index a02b5c7624d3..9c83b4abc56e 100644 --- a/sw/source/core/tox/ToxTextGenerator.cxx +++ b/sw/source/core/tox/ToxTextGenerator.cxx @@ -301,7 +301,7 @@ ToxTextGenerator::HandleTextToken(const SwTOXSortTabBase& source, SwAttrPool& po return result; } const SwpHints& hints = pSrc->GetSwpHints(); - for (sal_uInt16 i = 0; i < hints.Count(); ++i) { + for (size_t i = 0; i < hints.Count(); ++i) { const SwTxtAttr* hint = hints[i]; boost::shared_ptr<SfxItemSet> attributesToClone = CollectAttributesForTox(*hint, pool); if (attributesToClone->Count() <= 0) { diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx index 63223e64e6d7..68a7cbb8b76e 100644 --- a/sw/source/core/txtnode/modeltoviewhelper.cxx +++ b/sw/source/core/txtnode/modeltoviewhelper.cxx @@ -128,7 +128,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode) //first the normal fields, get their position in the node and what the text they expand //to is const SwpHints* pSwpHints2 = rNode.GetpSwpHints(); - for ( sal_uInt16 i = 0; pSwpHints2 && i < pSwpHints2->Count(); ++i ) + for ( size_t i = 0; pSwpHints2 && i < pSwpHints2->Count(); ++i ) { const SwTxtAttr* pAttr = (*pSwpHints2)[i]; if (pAttr->HasDummyChar()) diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx index ed72103c7ac5..25160398831d 100644 --- a/sw/source/core/txtnode/ndhints.cxx +++ b/sw/source/core/txtnode/ndhints.cxx @@ -113,7 +113,7 @@ void SwpHintsArray::Insert( const SwTxtAttr *pHt ) m_HintEnds .insert( const_cast<SwTxtAttr*>(pHt) ); } -void SwpHintsArray::DeleteAtPos( const sal_uInt16 nPos ) +void SwpHintsArray::DeleteAtPos( const size_t nPos ) { // optimization: nPos is the position in the Starts array SwTxtAttr *pHt = m_HintStarts[ nPos ]; @@ -126,7 +126,7 @@ void SwpHintsArray::DeleteAtPos( const sal_uInt16 nPos ) (void) done; // unused in NDEBUG } -sal_uInt16 SwpHintsArray::GetPos( const SwTxtAttr *pHt ) const +size_t SwpHintsArray::GetPos( const SwTxtAttr *pHt ) const { // DO NOT use find() here! // if called from SwTxtNode::InsertItem, pHt has already been deleted, @@ -138,7 +138,7 @@ sal_uInt16 SwpHintsArray::GetPos( const SwTxtAttr *pHt ) const return i; } } - return USHRT_MAX; + return SAL_MAX_SIZE; } #ifdef DBG_UTIL @@ -164,7 +164,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const std::set<SwTxtAttr const*> RsidOnlyAutoFmts; if (bPortionsMerged) { - for (sal_uInt16 i = 0; i < Count(); ++i) + for (size_t i = 0; i < Count(); ++i) { SwTxtAttr const*const pHint(m_HintStarts[i]); if (RES_TXTATR_AUTOFMT == pHint->Which()) @@ -179,7 +179,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const } } - for( sal_uInt16 i = 0; i < Count(); ++i ) + for( size_t i = 0; i < Count(); ++i ) { // --- Start-Kontrolle --- @@ -291,7 +291,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const if (bNeedContinuation || bForbidContinuation) { bool bFound(false); - for (sal_uInt16 j = i + 1; j < Count(); ++j) + for (size_t j = i + 1; j < Count(); ++j) { SwTxtAttr *const pOther(m_HintStarts[j]); if (pOther->GetStart() > *pHt->End()) @@ -337,7 +337,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const // 9) nesting portion check if (pHtThis->IsNesting()) { - for ( sal_uInt16 j = 0; j < Count(); ++j ) + for ( size_t j = 0; j < Count(); ++j ) { SwTxtAttr const * const pOther( m_HintStarts[j] ); if ( pOther->IsNesting() && (i != j) ) diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 63405066aed9..2b6c32de2b22 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -243,7 +243,7 @@ SwTxtNode::~SwTxtNode() SwpHints* pTmpHints = m_pSwpHints; m_pSwpHints = 0; - for( sal_uInt16 j = pTmpHints->Count(); j; ) + for( size_t j = pTmpHints->Count(); j; ) { // first remove the attribute from the array otherwise // if would delete itself @@ -298,7 +298,7 @@ static void lcl_ChangeFtnRef( SwTxtNode &rNode ) // of node <rNode> in order to invalidate position of its first content. // Thus, in its <MakeAll()> it will checked its position relative to its reference. SwFtnFrm* pFirstFtnOfNode = 0; - for( sal_uInt16 j = pSwpHints->Count(); j; ) + for( size_t j = pSwpHints->Count(); j; ) { pHt = pSwpHints->GetTextHint(--j); if (RES_TXTATR_FTN == pHt->Which()) @@ -451,7 +451,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos ) // Attribute loeschen if ( HasHints() ) { - for ( sal_uInt16 j = m_pSwpHints->Count(); j; ) + for ( size_t j = m_pSwpHints->Count(); j; ) { SwTxtAttr* const pHt = m_pSwpHints->GetTextHint( --j ); if ( RES_TXTATR_FLYCNT == pHt ->Which() ) @@ -539,7 +539,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos ) // Attribute loeschen if ( HasHints() ) { - for ( sal_uInt16 j = m_pSwpHints->Count(); j; ) + for ( size_t j = m_pSwpHints->Count(); j; ) { SwTxtAttr* const pHt = m_pSwpHints->GetTextHint( --j ); const sal_Int32* const pEnd = pHt->GetEnd(); @@ -596,7 +596,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos ) void SwTxtNode::MoveTxtAttr_To_AttrSet() { OSL_ENSURE( m_pSwpHints, "MoveTxtAttr_To_AttrSet without SwpHints?" ); - for ( sal_uInt16 i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i ) + for ( size_t i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i ) { SwTxtAttr *pHt = m_pSwpHints->GetTextHint(i); @@ -849,7 +849,7 @@ void SwTxtNode::Update( if ( bNegative ) { const sal_Int32 nChangeEnd = nChangePos + nChangeLen; - for ( sal_uInt16 n = 0; n < m_pSwpHints->Count(); ++n ) + for ( size_t n = 0; n < m_pSwpHints->Count(); ++n ) { bool bTxtAttrChanged = false; bool bStartOfTxtAttrChanged = false; @@ -909,7 +909,7 @@ void SwTxtNode::Update( bool aDontExp[ coArrSz ]; memset( &aDontExp, 0, coArrSz * sizeof(bool) ); - for ( sal_uInt16 n = 0; n < m_pSwpHints->Count(); ++n ) + for ( size_t n = 0; n < m_pSwpHints->Count(); ++n ) { bool bTxtAttrChanged = false; SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(n); @@ -1169,8 +1169,8 @@ bool SwTxtNode::DontExpandFmt( const SwIndex& rIdx, bool bFlag, bool bRet = false; if ( HasHints() ) { - const sal_uInt16 nEndCnt = m_pSwpHints->GetEndCount(); - sal_uInt16 nPos = nEndCnt; + const size_t nEndCnt = m_pSwpHints->GetEndCount(); + size_t nPos = nEndCnt; while( nPos ) { SwTxtAttr *pTmp = m_pSwpHints->GetEnd( --nPos ); @@ -1212,7 +1212,7 @@ lcl_GetTxtAttrs( sal_Int32 const nIndex, RES_TXTATR const nWhich, enum SwTxtNode::GetTxtAttrMode const eMode) { - sal_uInt16 const nSize = (pSwpHints) ? pSwpHints->Count() : 0; + size_t const nSize = (pSwpHints) ? pSwpHints->Count() : 0; sal_Int32 nPreviousIndex(0); // index of last hint with nWhich bool (*pMatchFunc)(sal_Int32, sal_Int32, sal_Int32)=0; switch (eMode) @@ -1223,7 +1223,7 @@ lcl_GetTxtAttrs( default: assert(false); } - for( sal_uInt16 i = 0; i < nSize; ++i ) + for( size_t i = 0; i < nSize; ++i ) { SwTxtAttr *const pHint = pSwpHints->GetTextHint(i); sal_Int32 const nHintStart = pHint->GetStart(); @@ -1404,7 +1404,7 @@ void lcl_CopyHint( case RES_TXTATR_TOXMARK : if( pOtherDoc && pDest && pDest->GetpSwpHints() - && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) ) + && SAL_MAX_SIZE != pDest->GetpSwpHints()->GetPos( pNewHt ) ) { // Beim Kopieren von TOXMarks(Client) in andere Dokumente // muss der Verzeichnis (Modify) ausgetauscht werden @@ -1416,7 +1416,7 @@ void lcl_CopyHint( // Wenn wir es mit einer Zeichenvorlage zu tun haben, // muessen wir natuerlich auch die Formate kopieren. if( pDest && pDest->GetpSwpHints() - && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) ) + && SAL_MAX_SIZE != pDest->GetpSwpHints()->GetPos( pNewHt ) ) { SwCharFmt* pFmt = static_cast<SwCharFmt*>(pHt->GetCharFmt().GetCharFmt()); @@ -1434,7 +1434,7 @@ void lcl_CopyHint( // Wenn wir es mit benutzerdefinierten INet-Zeichenvorlagen // zu tun haben, muessen wir natuerlich auch die Formate kopieren. if( pOtherDoc && pDest && pDest->GetpSwpHints() - && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) ) + && SAL_MAX_SIZE != pDest->GetpSwpHints()->GetPos( pNewHt ) ) { const SwDoc* const pDoc = static_cast<const SwTxtINetFmt*>(pHt) ->GetTxtNode().GetDoc(); @@ -1487,7 +1487,7 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const sal_Int32 nTxtStartIdx, SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc()) ? pDest->GetDoc() : 0; - for ( sal_uInt16 i = 0; i < m_pSwpHints->Count(); i++ ) + for ( size_t i = 0; i < m_pSwpHints->Count(); ++i ) { SwTxtAttr *const pHt = m_pSwpHints->GetTextHint(i); sal_Int32 const nAttrStartIdx = pHt->GetStart(); @@ -1656,7 +1656,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, // 2. Attribute kopieren // durch das Attribute-Array, bis der Anfang des Geltungsbereiches // des Attributs hinter dem zu kopierenden Bereich liegt - const sal_uInt16 nSize = m_pSwpHints ? m_pSwpHints->Count() : 0; + const size_t nSize = m_pSwpHints ? m_pSwpHints->Count() : 0; // wird in sich selbst kopiert, dann kann beim Einfuegen ein // Attribut geloescht werden. Darum erst ins Tmp-Array kopieren und @@ -1668,7 +1668,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, sal_Int32 nDeletedDummyChars(0); //Achtung: kann ungueltig sein!! - for (sal_uInt16 n = 0; ( n < nSize ); ++n) + for (size_t n = 0; n < nSize; ++n) { const sal_Int32 nAttrStartIdx = (*m_pSwpHints)[n]->GetStart(); if (!( nAttrStartIdx < nEnd)) @@ -1853,7 +1853,7 @@ OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx, if ( HasHints() ) { bool bMergePortionsNeeded(false); - for ( sal_uInt16 i = 0; i < m_pSwpHints->Count() && + for ( size_t i = 0; i < m_pSwpHints->Count() && rIdx >= (*m_pSwpHints)[i]->GetStart(); ++i ) { SwTxtAttr * const pHt = m_pSwpHints->GetTextHint( i ); @@ -1887,7 +1887,7 @@ OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx, && (*pEndIdx == pHt->GetStart()) ) { pHt->GetStart() = pHt->GetStart() - nLen; - const sal_uInt16 nAktLen = m_pSwpHints->Count(); + const size_t nAktLen = m_pSwpHints->Count(); m_pSwpHints->DeleteAtPos(i); InsertHint( pHt/* AUTOSTYLES:, nsSetAttrMode::SETATTR_NOHINTADJUST*/ ); if ( nAktLen > m_pSwpHints->Count() && i ) @@ -2005,7 +2005,7 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart, // 2. Attribute verschieben // durch das Attribute-Array, bis der Anfang des Geltungsbereiches // des Attributs hinter dem zu verschiebenden Bereich liegt - sal_uInt16 nAttrCnt = 0; + size_t nAttrCnt = 0; while ( m_pSwpHints && nAttrCnt < m_pSwpHints->Count() ) { SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(nAttrCnt); @@ -2157,7 +2157,7 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart, // durch das Attribute-Array, bis der Anfang des Geltungsbereiches // des Attributs hinter dem zu verschiebenden Bereich liegt bool bMergePortionsNeeded(false); - sal_uInt16 nAttrCnt = 0; + size_t nAttrCnt = 0; while ( m_pSwpHints && (nAttrCnt < m_pSwpHints->Count()) ) { SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(nAttrCnt); @@ -2315,7 +2315,7 @@ void SwTxtNode::EraseText(const SwIndex &rIdx, const sal_Int32 nCount, * die im Bereich liegen und nicht am Ende des Bereiches liegen */ - for ( sal_uInt16 i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i ) + for ( size_t i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i ) { SwTxtAttr *pHt = m_pSwpHints->GetTextHint(i); @@ -2411,7 +2411,7 @@ void SwTxtNode::GCAttr() const bool bAll = nMin != 0; // Bei leeren Absaetzen werden nur die // INet-Formate entfernt. - for ( sal_uInt16 i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i ) + for ( size_t i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i ) { SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(i); @@ -2702,7 +2702,7 @@ SwTxtAttr * SwTxtNode::GetTxtAttrForCharAt( { if ( HasHints() ) { - for ( sal_uInt16 i = 0; i < m_pSwpHints->Count(); ++i ) + for ( size_t i = 0; i < m_pSwpHints->Count(); ++i ) { SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(i); const sal_Int32 nStartPos = pHint->GetStart(); @@ -3183,7 +3183,7 @@ bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx, if ( HasHints() ) { sal_Int32 nInsPos = nDestStt - nIdx; - for ( sal_uInt16 i = 0; i < m_pSwpHints->Count(); i++ ) + for ( size_t i = 0; i < m_pSwpHints->Count(); ++i ) { const SwTxtAttr* pHt = (*m_pSwpHints)[i]; const sal_Int32 nAttrStartIdx = pHt->GetStart(); diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index d48a6093bdec..de339d3c6f66 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -372,7 +372,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) SplitNew.push_back(& rNewHint); // pass 1: split the inserted hint into fragments if necessary - for ( sal_uInt16 i = 0; i < GetEndCount(); ++i ) + for ( size_t i = 0; i < GetEndCount(); ++i ) { SwTxtAttr * const pOther = GetEnd(i); @@ -480,7 +480,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) InsertNesting( **itOther ); if (!bRemoveOverlap) { - if ( USHRT_MAX == Count() ) + if ( SAL_MAX_SIZE-1 == Count() ) { OSL_FAIL("hints array full :-("); return false; @@ -499,7 +499,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) InsertNesting( **itOther ); if (!bRemoveOverlap) { - if ( USHRT_MAX == Count() ) + if ( SAL_MAX_SIZE-1 == Count() ) { OSL_FAIL("hints array full :-("); return false; @@ -517,7 +517,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) } } - if ( USHRT_MAX - SplitNew.size() <= Count() ) + if ( SAL_MAX_SIZE-1 - Count() <= SplitNew.size() ) { OSL_FAIL("hints array full :-("); return false; @@ -598,7 +598,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, if ( !bNoLengthAttribute ) // nothing to do for no length attributes { - for ( sal_uInt16 i = 0; i < Count(); ++i ) + for ( size_t i = 0; i < Count(); ++i ) { SwTxtAttr* pOther = GetTextHint(i); @@ -663,7 +663,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, if ( !bNoLengthAttribute ) // nothing to do for no length attributes { - for ( sal_uInt16 i = 0; i < Count(); ++i ) + for ( size_t i = 0; i < Count(); ++i ) { const SwTxtAttr* pOther = GetTextHint(i); @@ -695,7 +695,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, aInsDelHints.clear(); // Get all hints that are in [nPorStart, nPorEnd[: - for ( sal_uInt16 i = 0; i < Count(); ++i ) + for ( size_t i = 0; i < Count(); ++i ) { SwTxtAttr *pOther = GetTextHint(i); @@ -1229,7 +1229,7 @@ SwTxtAttr* SwTxtNode::InsertItem( // N.B.: also check that the hint is actually in the hints array, // because hints of certain types may be merged after successful // insertion, and thus destroyed! - if (!bSuccess || ( USHRT_MAX == m_pSwpHints->GetPos( pNew ) )) + if (!bSuccess || ( SAL_MAX_SIZE == m_pSwpHints->GetPos( pNew ) )) { return 0; } @@ -1682,7 +1682,7 @@ void SwTxtNode::DeleteAttributes( if ( !HasHints() ) return; - for ( sal_uInt16 nPos = 0; m_pSwpHints && nPos < m_pSwpHints->Count(); nPos++ ) + for ( size_t nPos = 0; m_pSwpHints && nPos < m_pSwpHints->Count(); ++nPos ) { SwTxtAttr * const pTxtHt = m_pSwpHints->GetTextHint( nPos ); const sal_Int32 nHintStart = pTxtHt->GetStart(); @@ -1861,7 +1861,7 @@ bool SwTxtNode::SetAttr( bool bHasCharFmts = false; if ( HasHints() ) { - for ( sal_uInt16 n = 0; n < m_pSwpHints->Count(); ++n ) + for ( size_t n = 0; n < m_pSwpHints->Count(); ++n ) { if ( (*m_pSwpHints)[ n ]->IsCharFmtAttr() ) { @@ -2092,11 +2092,11 @@ bool SwTxtNode::GetAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd, } } - const sal_uInt16 nSize = m_pSwpHints->Count(); + const size_t nSize = m_pSwpHints->Count(); if( nStt == nEnd ) // kein Bereich: { - for (sal_uInt16 n = 0; n < nSize; ++n) + for (size_t n = 0; n < nSize; ++n) { const SwTxtAttr* pHt = (*m_pSwpHints)[n]; const sal_Int32 nAttrStart = pHt->GetStart(); @@ -2123,7 +2123,7 @@ bool SwTxtNode::GetAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd, const sal_uInt16 coArrSz = static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) - static_cast<sal_uInt16>(RES_CHRATR_BEGIN); - for (sal_uInt16 n = 0; n < nSize; ++n) + for (size_t n = 0; n < nSize; ++n) { const SwTxtAttr* pHt = (*m_pSwpHints)[n]; const sal_Int32 nAttrStart = pHt->GetStart(); @@ -2347,7 +2347,7 @@ lcl_CollectHintSpans(const SwpHints& i_rHints, const sal_Int32 nLength, { sal_Int32 nLastEnd(0); - for (sal_uInt16 i(0); i != i_rHints.Count(); ++i) + for (size_t i = 0; i < i_rHints.Count(); ++i) { const SwTxtAttr* const pHint(i_rHints[i]); const sal_uInt16 nWhich(pHint->Which()); @@ -2567,11 +2567,11 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd ) void SwpHints::CalcFlags() { m_bDDEFields = m_bFootnote = false; - const sal_uInt16 nSize = Count(); - const SwTxtAttr* pAttr; - for( sal_uInt16 nPos = 0; nPos < nSize; ++nPos ) + const size_t nSize = Count(); + for( size_t nPos = 0; nPos < nSize; ++nPos ) { - switch( ( pAttr = (*this)[ nPos ])->Which() ) + const SwTxtAttr* pAttr = (*this)[ nPos ]; + switch( pAttr->Which() ) { case RES_TXTATR_FTN: m_bFootnote = true; @@ -2598,10 +2598,10 @@ bool SwpHints::CalcHiddenParaField() m_bCalcHiddenParaField = false; bool bOldHasHiddenParaField = m_bHasHiddenParaField; bool bNewHasHiddenParaField = false; - const sal_uInt16 nSize = Count(); + const size_t nSize = Count(); const SwTxtAttr *pTxtHt; - for( sal_uInt16 nPos = 0; nPos < nSize; ++nPos ) + for( size_t nPos = 0; nPos < nSize; ++nPos ) { pTxtHt = (*this)[ nPos ]; const sal_uInt16 nWhich = pTxtHt->Which(); @@ -2648,7 +2648,7 @@ bool SwpHints::MergePortions( SwTxtNode& rNode ) int nKey = 0; // get portions by start position: - for ( sal_uInt16 i = 0; i < Count(); ++i ) + for ( size_t i = 0; i < Count(); ++i ) { SwTxtAttr *pHt = GetTextHint( i ); if ( RES_TXTATR_CHARFMT != pHt->Which() && @@ -2838,7 +2838,7 @@ bool SwpHints::MergePortions( SwTxtNode& rNode ) SwTxtAttr *const p2 = aIter2->second.first; nNewPortionEnd = *p2->GetEnd(); - const sal_uInt16 nCountBeforeDelete = Count(); + const size_t nCountBeforeDelete = Count(); Delete( p2 ); // robust: check if deletion actually took place before destroying attribute: @@ -2910,7 +2910,7 @@ static void lcl_CheckSortNumber( const SwpHints& rHints, SwTxtCharFmt& rNewCharF const sal_Int32 nHtEnd = *rNewCharFmt.GetEnd(); sal_uInt16 nSortNumber = 0; - for ( sal_uInt16 i = 0; i < rHints.Count(); ++i ) + for ( size_t i = 0; i < rHints.Count(); ++i ) { const SwTxtAttr* pOtherHt = rHints[i]; @@ -2947,7 +2947,7 @@ bool SwpHints::TryInsertHint( SwTxtNode &rNode, const SetAttrMode nMode ) { - if ( USHRT_MAX == Count() ) // we're sorry, this flight is overbooked... + if ( SAL_MAX_SIZE-1 == Count() ) // we're sorry, this flight is overbooked... { OSL_FAIL("hints array full :-("); return false; @@ -3100,7 +3100,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* pTmpHt; sal_Int32 *pTmpHtEnd; sal_Int32 *pTmpHintEnd; - for( sal_uInt16 n = 0, nEnd = Count(); n < nEnd; ++n ) + for( size_t n = 0, nEnd = Count(); n < nEnd; ++n ) { if (RES_TXTATR_REFMARK == (pTmpHt = GetTextHint(n))->Which() && pHint->GetAttr() == pTmpHt->GetAttr() && @@ -3277,7 +3277,7 @@ bool SwpHints::TryInsertHint( return true; } -void SwpHints::DeleteAtPos( const sal_uInt16 nPos ) +void SwpHints::DeleteAtPos( const size_t nPos ) { SwTxtAttr *pHint = GetTextHint(nPos); // ChainDelete( pHint ); @@ -3315,9 +3315,9 @@ void SwpHints::DeleteAtPos( const sal_uInt16 nPos ) void SwpHints::Delete( SwTxtAttr* pTxtHt ) { // Attr 2.0: SwpHintsArr::Delete( pTxtHt ); - const sal_uInt16 nPos = GetStartOf( pTxtHt ); - OSL_ENSURE( USHRT_MAX != nPos, "Attribut nicht im Attribut-Array!" ); - if( USHRT_MAX != nPos ) + const size_t nPos = GetStartOf( pTxtHt ); + OSL_ENSURE( SAL_MAX_SIZE != nPos, "Attribut nicht im Attribut-Array!" ); + if( SAL_MAX_SIZE != nPos ) DeleteAtPos( nPos ); } @@ -3325,7 +3325,7 @@ void SwTxtNode::ClearSwpHintsArr( bool bDelFields ) { if ( HasHints() ) { - sal_uInt16 nPos = 0; + size_t nPos = 0; while ( nPos < m_pSwpHints->Count() ) { SwTxtAttr* pDel = m_pSwpHints->GetTextHint( nPos ); @@ -3374,7 +3374,8 @@ sal_uInt16 SwTxtNode::GetLang( const sal_Int32 nBegin, const sal_Int32 nLen, if ( HasHints() ) { const sal_Int32 nEnd = nBegin + nLen; - for ( sal_uInt16 i = 0, nSize = m_pSwpHints->Count(); i < nSize; ++i ) + const size_t nSize = m_pSwpHints->Count(); + for ( size_t i = 0; i < nSize; ++i ) { // ist der Attribut-Anfang schon groesser als der Idx ? const SwTxtAttr *pHt = m_pSwpHints->operator[](i); diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx index 7a5d7c61f4ab..ae43b262a864 100644 --- a/sw/source/core/txtnode/txatritr.cxx +++ b/sw/source/core/txtnode/txatritr.cxx @@ -97,7 +97,7 @@ SwTxtAttrIterator::SwTxtAttrIterator( const SwTxtNode& rTNd, sal_uInt16 nWhchId, sal_Int32 nStt, bool bUseGetWhichOfScript ) : aSIter( rTNd.GetTxt(), nStt ), rTxtNd( rTNd ), - pParaItem( 0 ), nChgPos( nStt ), nAttrPos( 0 ), nWhichId( nWhchId ), + pParaItem( 0 ), nAttrPos( 0 ), nChgPos( nStt ), nWhichId( nWhchId ), bIsUseGetWhichOfScript( bUseGetWhichOfScript ) { SearchNextChg(); @@ -123,7 +123,7 @@ bool SwTxtAttrIterator::Next() if( !aStack.empty() ) { - sal_uInt16 nSavePos = nAttrPos; + const size_t nSavePos = nAttrPos; SearchNextChg(); if( !aStack.empty() ) { diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 441ca5e85528..71def8c09203 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -415,7 +415,7 @@ void SwTxtNode::RstTxtAttr( //std::vector< const SwTxtAttr* > aNewAttributes; // iterate over attribute array until start of attribute is behind deletion range - sal_uInt16 i = 0; + size_t i = 0; sal_Int32 nAttrStart; SwTxtAttr *pHt = NULL; while ( (i < m_pSwpHints->Count()) diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 002a988cef37..96a229ff231e 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -1251,7 +1251,7 @@ void SwHistory::CopyAttr( // copy all attributes of the TextNode in the area from nStart to nEnd SwTxtAttr* pHt; const sal_Int32 * pEndIdx; - for( sal_uInt16 n = 0; n < pHts->Count(); n++ ) + for( size_t n = 0; n < pHts->Count(); ++n ) { // nAttrStt must even be set when !pEndIdx pHt = pHts->GetTextHint(n); diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 25234e086d21..0f11fad92743 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -673,7 +673,7 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry } Sequence< OUString> aCharStyles; SwpHints* pHints = pTxtNode->GetpSwpHints(); - for(sal_uInt16 nAttr = 0; nAttr < pHints->GetStartCount(); nAttr++ ) + for( size_t nAttr = 0; nAttr < pHints->GetStartCount(); ++nAttr ) { SwTxtAttr* pAttr = pHints->GetStart( nAttr ); if(pAttr->Which() != RES_TXTATR_CHARFMT) diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index f05ccfb86c9f..24c61442acba 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -697,7 +697,7 @@ lcl_ExportHints( Reference<XTextRange> xRef; SwDoc* pDoc = pUnoCrsr->GetDoc(); //search for special text attributes - first some ends - sal_uInt16 nEndIndex = 0; + size_t nEndIndex = 0; sal_uInt16 nNextEnd = 0; while(nEndIndex < pHints->GetEndCount() && (!pHints->GetEnd(nEndIndex)->GetEnd() || @@ -780,7 +780,7 @@ lcl_ExportHints( } // then some starts - sal_uInt16 nStartIndex = 0; + size_t nStartIndex = 0; sal_uInt16 nNextStart = 0; while(nStartIndex < pHints->GetStartCount() && nCurrentIndex >= (nNextStart = pHints->GetStart(nStartIndex)->GetStart())) |