sw/inc/calc.hxx | 2 sw/inc/fesh.hxx | 2 sw/source/core/access/accdoc.cxx | 9 - sw/source/core/access/accmap.cxx | 184 ++++++++++++-------------- sw/source/core/access/accnotexthyperlink.cxx | 5 sw/source/core/access/accnotexthyperlink.hxx | 3 sw/source/core/access/accpara.cxx | 47 ++---- sw/source/core/access/accportions.cxx | 128 ++++++++---------- sw/source/core/access/accportions.hxx | 4 sw/source/core/access/accselectionhelper.cxx | 8 - sw/source/core/access/textmarkuphelper.cxx | 3 sw/source/core/bastyp/bparr.cxx | 2 sw/source/core/bastyp/calc.cxx | 17 +- sw/source/core/bastyp/init.cxx | 2 sw/source/core/bastyp/swcache.cxx | 4 sw/source/core/crsr/crstrvl.cxx | 8 - sw/source/core/crsr/findtxt.cxx | 6 sw/source/core/crsr/pam.cxx | 2 sw/source/core/crsr/swcrsr.cxx | 2 sw/source/core/crsr/trvlreg.cxx | 2 sw/source/core/crsr/viscrs.cxx | 6 sw/source/core/frmedt/feshview.cxx | 10 - sw/source/filter/writer/writer.cxx | 2 sw/source/filter/ww8/WW8TableInfo.cxx | 25 +-- sw/source/filter/ww8/attributeoutputbase.hxx | 2 sw/source/filter/ww8/docxattributeoutput.cxx | 15 -- sw/source/filter/ww8/docxtablestyleexport.cxx | 10 - sw/source/filter/ww8/docxtablestyleexport.hxx | 2 sw/source/filter/ww8/rtfattributeoutput.cxx | 7 sw/source/filter/ww8/wrtww8.cxx | 4 30 files changed, 245 insertions(+), 278 deletions(-)
New commits: commit 6304f5e8e23cd9c9afbeab87f20100498175d4e6 Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 19:24:03 2015 +0100 sal_uInt16 to size_type Change-Id: I89b35680d8df0efca814cec3d21cb2f78a64793b diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 599d9ba..68cbcff 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -665,7 +665,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const if( nSttIdx + 3 < nEndIdx ) { const SwSectionFmts& rFmts = GetDoc()->GetSections(); - for( sal_uInt16 n = rFmts.size(); n; ) + for( SwSectionFmts::size_type n = rFmts.size(); n; ) { const SwSectionFmt* pFmt = rFmts[ --n ]; if( pFmt->GetProtect().IsCntntProtected() ) diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index ce67b7e..898e04a 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -297,7 +297,7 @@ bool SwCursor::IsSelOvr( int eFlags ) } const SwSectionFmts& rFmts = pDoc->GetSections(); - for( sal_uInt16 n = 0; n < rFmts.size(); ++n ) + for( SwSectionFmts::size_type n = 0; n < rFmts.size(); ++n ) { const SwSectionFmt* pFmt = rFmts[n]; const SvxProtectItem& rProtect = pFmt->GetProtect(); diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx index 92f37ab..231d7ca 100644 --- a/sw/source/core/crsr/trvlreg.cxx +++ b/sw/source/core/crsr/trvlreg.cxx @@ -233,7 +233,7 @@ bool SwCursor::GotoRegion( const OUString& rName ) { bool bRet = false; const SwSectionFmts& rFmts = GetDoc()->GetSections(); - for( sal_uInt16 n = rFmts.size(); n; ) + for( SwSectionFmts::size_type n = rFmts.size(); n; ) { const SwSectionFmt* pFmt = rFmts[ --n ]; const SwNodeIndex* pIdx = 0; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 13bbd29..5873e93 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -261,7 +261,7 @@ void SwSelPaintRects::Show() // get new rects std::vector< basegfx::B2DRange > aNewRanges; - for(sal_uInt16 a(0); a < size(); a++) + for(size_type a = 0; a < size(); ++a) { const SwRect aNextRect((*this)[a]); const Rectangle aPntRect(aNextRect.SVRect()); @@ -419,7 +419,7 @@ void SwSelPaintRects::HighlightInputFld() void SwSelPaintRects::Invalidate( const SwRect& rRect ) { - sal_uInt16 nSz = size(); + size_type nSz = size(); if( !nSz ) return; @@ -598,7 +598,7 @@ short SwShellCrsr::MaxReplaceArived() "modules/swriter/ui/asksearchdialog.ui").Execute(); } - for( sal_uInt16 n = 0; n < aArr.size(); ++n ) + for( std::vector<sal_uInt16>::size_type n = 0; n < aArr.size(); ++n ) { for( nActCnt = aArr[n]; nActCnt--; ) pSh->StartAction(); commit dd9972f5f37063f5fe3eb5e011d2adc73f44d305 Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 18:50:32 2015 +0100 Remove unnecessary downcast Change-Id: I7511862ddf6ed672ba4f09ef6729fb1fa7c1d355 diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 0cd49a1..e73e4a8 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -505,8 +505,8 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt, } else { - nStart = (sal_uInt16)nProxyStart; - nEnd = (sal_uInt16)nProxyEnd; + nStart = nProxyStart; + nEnd = nProxyEnd; } nStart = nEnd; } commit 8c54f9ab597496f1af3d05e83b7be6f5a62c50a0 Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 17:57:11 2015 +0100 sal_uInt16 to size_type Change-Id: I44b9972a8c7c5033b031e75fe714412e20bd4ccc diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index a37abda..5f1e4f3 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -264,7 +264,7 @@ bool SwCrsrShell::GotoNextTOXBase( const OUString* pName ) const SwSectionFmts& rFmts = GetDoc()->GetSections(); SwCntntNode* pFnd = 0; - for( sal_uInt16 n = rFmts.size(); n; ) + for( SwSectionFmts::size_type n = rFmts.size(); n; ) { const SwSection* pSect = rFmts[ --n ]->GetSection(); if (TOX_CONTENT_SECTION == pSect->GetType()) @@ -315,7 +315,7 @@ bool SwCrsrShell::GotoPrevTOXBase( const OUString* pName ) const SwSectionFmts& rFmts = GetDoc()->GetSections(); SwCntntNode* pFnd = 0; - for( sal_uInt16 n = rFmts.size(); n; ) + for( SwSectionFmts::size_type n = rFmts.size(); n; ) { const SwSection* pSect = rFmts[ --n ]->GetSection(); if (TOX_CONTENT_SECTION == pSect->GetType()) @@ -2196,7 +2196,7 @@ bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext ) { const SwTxtNode* pTxtNd; const SwCharFmts* pFmts = GetDoc()->GetCharFmts(); - for( sal_uInt16 n = pFmts->size(); 1 < n; ) + for( SwCharFmts::size_type n = pFmts->size(); 1 < n; ) { SwIterator<SwTxtINetFmt,SwCharFmt> aIter(*(*pFmts)[--n]); @@ -2232,7 +2232,7 @@ bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext ) // then check all the Flys with a URL or imapge map { const SwFrmFmts* pFmts = GetDoc()->GetSpzFrmFmts(); - for( sal_uInt16 n = 0, nEnd = pFmts->size(); n < nEnd; ++n ) + for( SwFrmFmts::size_type n = 0, nEnd = pFmts->size(); n < nEnd; ++n ) { SwFlyFrmFmt* pFmt = static_cast<SwFlyFrmFmt*>((*pFmts)[ n ]); const SwFmtURL& rURLItem = pFmt->GetURL(); diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 8b1d6d1..0cd49a1 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -167,7 +167,7 @@ lcl_CleanStr(const SwTxtNode& rNd, sal_Int32 const nStart, sal_Int32& rEnd, } while ( true ); - for( sal_uInt16 i = aReplaced.size(); i; ) + for( std::vector<sal_Int32>::size_type i = aReplaced.size(); i; ) { const sal_Int32 nTmp = aReplaced[ --i ]; if (nTmp == buf.getLength() - 1) commit 3631518b9b74ceb476367021853fc9cd111f476e Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 16:57:55 2015 +0100 sal_uInt16 to size_t, remove unneeded downcast Change-Id: I48689ad3a974d5bc2386766b55045e4456a0d72c diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx index 176f4c4..aa0a415 100644 --- a/sw/source/core/bastyp/swcache.cxx +++ b/sw/source/core/bastyp/swcache.cxx @@ -95,7 +95,7 @@ SwCache::SwCache( const sal_uInt16 nInitSize , m_nDecreaseMax( 0 ) #endif { - m_aCacheObjects.reserve( (sal_uInt8)nInitSize ); + m_aCacheObjects.reserve( nInitSize ); } SwCache::~SwCache() @@ -304,7 +304,7 @@ void SwCache::DeleteObj( SwCacheObj *pObj ) // Shrink if possible.To do so we need enough free positions. // Unpleasent side effect: positions will be moved and the owner of // these might not find them afterwards - for ( sal_uInt16 i = 0; i < m_aCacheObjects.size(); ++i ) + for ( size_t i = 0; i < m_aCacheObjects.size(); ++i ) { SwCacheObj *pTmpObj = m_aCacheObjects[i]; if ( !pTmpObj ) commit 2ad35f36db9195c01fe4ccb428f6d9626fa5060c Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 16:27:32 2015 +0100 sal_uInt16 to size_t Change-Id: I3ed2eb3b75cd2588366648331a8f9906cf5e3d7b diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 6d5454f..dc3efad 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -825,7 +825,7 @@ void _FinitCore() delete[] SwAttrPool::pVersionMap6; delete[] SwAttrPool::pVersionMap7; - for ( sal_uInt16 i = 0; i < pGlobalOLEExcludeList->size(); ++i ) + for ( size_t i = 0; i < pGlobalOLEExcludeList->size(); ++i ) delete (*pGlobalOLEExcludeList)[i]; delete pGlobalOLEExcludeList; } commit c257db1401e2b356306aa38e528c37ccb1073cea Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 15:46:57 2015 +0100 sal_uInt16 to more proper types Change-Id: I5e4d1edd78b4c39c4624f72de0541b46ed4ec9b2 diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx index 007e537..fbb4c66 100644 --- a/sw/inc/calc.hxx +++ b/sw/inc/calc.hxx @@ -193,7 +193,7 @@ public: OUString GetStrResult( double, bool bRound = true ); SwCalcExp* VarInsert( const OUString& r ); - SwCalcExp* VarLook( const OUString &rStr, sal_uInt16 ins = 0 ); + SwCalcExp* VarLook( const OUString &rStr, bool bIns = false ); void VarChange( const OUString& rStr, const SwSbxValue& rValue ); void VarChange( const OUString& rStr, double ); SwHash** GetVarTable() { return VarTable; } diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 10c7d45..ece7083 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -196,7 +196,7 @@ SwHash* Find( const OUString& rStr, SwHash** ppTable, ii %= nTblSize; if( pPos ) - *pPos = (sal_uInt16)ii; + *pPos = static_cast<sal_uInt16>(ii); for( SwHash* pEntry = *(ppTable+ii); pEntry; pEntry = pEntry->pNext ) { @@ -430,11 +430,11 @@ OUString SwCalc::GetStrResult( double nValue, bool ) default : return RESOURCE->aCalc_Default; } - sal_uInt16 nDec = 15; + const sal_Int32 nDecPlaces = 15; OUString aRetStr( ::rtl::math::doubleToUString( nValue, rtl_math_StringFormat_Automatic, - nDec, + nDecPlaces, pLclData->getNumDecimalSep()[0], true )); return aRetStr; @@ -443,10 +443,10 @@ OUString SwCalc::GetStrResult( double nValue, bool ) SwCalcExp* SwCalc::VarInsert( const OUString &rStr ) { OUString aStr = pCharClass->lowercase( rStr ); - return VarLook( aStr, 1 ); + return VarLook( aStr, true ); } -SwCalcExp* SwCalc::VarLook( const OUString& rStr, sal_uInt16 ins ) +SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns ) { aErrExpr.nValue.SetVoidValue(false); @@ -515,7 +515,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, sal_uInt16 ins ) // At this point the "real" case variable has to be used OUString const sTmpName( ::ReplacePoint(rStr) ); - if( !ins ) + if( !bIns ) { #if HAVE_FEATURE_DBCONNECTIVITY SwDBManager *pMgr = rDoc.GetDBManager(); @@ -1171,15 +1171,14 @@ SwSbxValue SwCalc::Term() return left; } fVal = left.GetDouble(); - sal_uInt16 i; if( nDec >= 0) { - for (i = 0; i < (sal_uInt16) nDec; ++i ) + for (sal_Int32 i = 0; i < nDec; ++i ) fFac *= 10.0; } else { - for (i = 0; i < (sal_uInt16) -nDec; ++i ) + for (sal_Int32 i = 0; i < -nDec; ++i ) fFac /= 10.0; } commit 4931c9521d739e813a3cdea04e23e79cbff802cb Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 15:25:44 2015 +0100 nBlockGrowSize can be static Change-Id: Ifafa52019732b6c1d9681ea855c50bd88b59dbf5 diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx index 53fb2f5..64ddf75 100644 --- a/sw/source/core/bastyp/bparr.cxx +++ b/sw/source/core/bastyp/bparr.cxx @@ -24,7 +24,7 @@ /** Resize block management by this constant. As a result there are approx. 20 * MAXENTRY == 20000 entries available */ -const sal_uInt16 nBlockGrowSize = 20; +static const sal_uInt16 nBlockGrowSize = 20; #if OSL_DEBUG_LEVEL > 2 #define CHECKIDX( p, n, i, c ) CheckIdx( p, n, i, c ); commit f1d80220226919b55e4378fdb1dee3d511c094df Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 15:10:41 2015 +0100 sal_uInt16 to sal_Int32 / int Change-Id: I9cf47330a6463c90888b0caf822c3b70ae26371a diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index a54ed2d..ad91f4a 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -699,7 +699,6 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() SwPaM* pCaret = pCrsrShell->GetCrsr(); if (!pCurrTxtFrm->IsEmpty() && pCaret) { - sal_uInt16 nActPos = 0; if (pCurrTxtFrm->IsTxtFrm()) { const SwPosition* pPoint = NULL; @@ -711,7 +710,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() } else pPoint = pCaret->GetPoint(); - nActPos = pPoint->nContent.GetIndex(); + const sal_Int32 nActPos = pPoint->nContent.GetIndex(); nLineNum += pCurrTxtFrm->GetLineCount( nActPos ); } else//graphic, form, shape, etc. @@ -720,7 +719,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() Point aPt = pCrsrShell->_GetCrsr()->GetPtPos(); if( pCrsrShell->GetLayout()->GetCrsrOfst( pPoint, aPt/*,* &eTmpState*/ ) ) { - nActPos = pPoint->nContent.GetIndex(); + const sal_Int32 nActPos = pPoint->nContent.GetIndex(); nLineNum += pCurrTxtFrm->GetLineCount( nActPos ); } } @@ -740,7 +739,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() sAttrName = "column-number:"; sValue += sAttrName; - sal_uInt16 nCurrCol = 1; + int nCurrCol = 1; if(pCurrCol!=NULL) { //SwLayoutFrm* pParent = pCurrCol->GetUpper(); @@ -758,7 +757,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() while(pCol&&(pCol!=pCurrPageCol)) { pCol = pCol->GetNext(); - nCurrCol +=1; + ++nCurrCol; } } } commit c6182e08dbe7f8e10a2d00482f7f0f348a8f7c9e Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 12:24:01 2015 +0100 Some code reformat Change-Id: I4db67f3b2eec4631444a866fc468bd9050750e67 diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 3364704..40eebd5 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -79,8 +79,7 @@ using namespace ::sw::access; struct SwFrmFunc { - bool operator()( const SwFrm * p1, - const SwFrm * p2) const + bool operator()( const SwFrm * p1, const SwFrm * p2) const { return p1 < p2; } @@ -205,8 +204,7 @@ void SwDrawModellListener_Impl::Dispose() struct SwShapeFunc { - bool operator()( const SdrObject * p1, - const SdrObject * p2) const + bool operator()( const SdrObject * p1, const SdrObject * p2) const { return p1 < p2; } @@ -287,8 +285,7 @@ SwAccessibleObjShape_Impl if( rSize > 0 ) { - pShapes = - new SwAccessibleObjShape_Impl[rSize]; + pShapes = new SwAccessibleObjShape_Impl[rSize]; const_iterator aIter = maMap.cbegin(); const_iterator aEndIter = maMap.cend(); @@ -417,15 +414,13 @@ public: "wrong event constructor, CARET_OR_STATES only" ); } - SwAccessibleEvent_Impl( EventType eT, - const SwFrm *pParentFrm, - const SwAccessibleChild& rFrmOrObj, - const SwRect& rR ) : + SwAccessibleEvent_Impl( EventType eT, const SwFrm *pParentFrm, + const SwAccessibleChild& rFrmOrObj, const SwRect& rR ) : maOldBox( rR ), - maFrmOrObj( rFrmOrObj ), - meType( eT ), + maFrmOrObj( rFrmOrObj ), + meType( eT ), mnStates( 0 ), - mpParentFrm( pParentFrm ) + mpParentFrm( pParentFrm ) { OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType, "wrong event constructor, CHILD_POS_CHANGED only" ); @@ -1168,7 +1163,11 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() SwAccessibleChild pFrm( (*aIter).first ); const SwFrmFmt *pFrmFmt = (*aIter).first ? ::FindFrmFmt( (*aIter).first ) : nullptr; - if( !pFrmFmt ) { ++aIter; continue; } + if( !pFrmFmt ) + { + ++aIter; + continue; + } const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor(); const SwPosition *pPos = pAnchor.GetCntntAnchor(); @@ -1178,10 +1177,15 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() if(xAcc.is()) (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED ); - ++aIter; continue; + ++aIter; + continue; } - if( !pPos ) { ++aIter; continue; } + if( !pPos ) + { + ++aIter; + continue; + } if( pPos->nNode.GetNode().GetTxtNode() ) { int pIndex = pPos->nContent.GetIndex(); @@ -1650,14 +1654,14 @@ void SwAccessibleMap::DoInvalidateShapeFocus() */ SwAccessibleMap::SwAccessibleMap( SwViewShell *pSh ) : - mpFrmMap( nullptr ), - mpShapeMap( nullptr ), - mpShapes( nullptr ), - mpEvents( nullptr ), - mpEventMap( nullptr ), + mpFrmMap( nullptr ), + mpShapeMap( nullptr ), + mpShapes( nullptr ), + mpEvents( nullptr ), + mpEventMap( nullptr ), mpSelectedParas( nullptr ), mpVSh( pSh ), - mpPreview( nullptr ), + mpPreview( nullptr ), mnPara( 1 ), mbShapeSelected( false ), mpSeletedFrmMap(NULL) @@ -1683,9 +1687,8 @@ SwAccessibleMap::~SwAccessibleMap() if(xAcc.is()) { - SwAccessibleDocument *pAcc = - static_cast< SwAccessibleDocument * >( xAcc.get() ); - pAcc->Dispose( true ); + SwAccessibleDocument *pAcc = static_cast< SwAccessibleDocument * >( xAcc.get() ); + pAcc->Dispose( true ); } if( mpFrmMap ) { @@ -2229,8 +2232,7 @@ void SwAccessibleMap::RemoveContext( const SdrObject *pObj ) if( mpShapeMap ) { - SwAccessibleShapeMap_Impl::iterator aIter = - mpShapeMap->find( pObj ); + SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap->find( pObj ); if( aIter != mpShapeMap->end() ) { uno::Reference < XAccessible > xAcc( (*aIter).second ); @@ -2282,8 +2284,7 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, if( aIter != mpFrmMap->end() ) { uno::Reference < XAccessible > xAcc( (*aIter).second ); - xAccImpl = - static_cast< SwAccessibleContext *>( xAcc.get() ); + xAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() ); } } if( !xAccImpl.is() && mpFrmMap ) @@ -2305,8 +2306,7 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, } } } - if( !xParentAccImpl.is() && !aFrmOrObj.GetSwFrm() && - mpShapeMap ) + if( !xParentAccImpl.is() && !aFrmOrObj.GetSwFrm() && mpShapeMap ) { SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap->find( aFrmOrObj.GetDrawObject() ); @@ -2651,8 +2651,7 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm ) InvalidatePosOrSize(aFrmOrObj.GetSwFrm(), nullptr, nullptr, rcEmpty); } - aIter = - mpFrmMap->find( aFrmOrObj.GetSwFrm() ); + aIter = mpFrmMap->find( aFrmOrObj.GetSwFrm() ); if( aIter != mpFrmMap->end() ) { xAcc = (*aIter).second; @@ -2826,8 +2825,7 @@ void SwAccessibleMap::InvalidateFocus() if( xAcc.is() ) { - SwAccessibleContext *pAccImpl = - static_cast< SwAccessibleContext *>( xAcc.get() ); + SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() ); pAccImpl->InvalidateFocus(); } else @@ -2856,8 +2854,7 @@ void SwAccessibleMap::InvalidateStates( tAccessibleStates _nStates, aFrmOrObj = GetShell()->GetLayout(); uno::Reference< XAccessible > xAcc( GetContext( aFrmOrObj.GetSwFrm(), true ) ); - SwAccessibleContext *pAccImpl = - static_cast< SwAccessibleContext *>( xAcc.get() ); + SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() ); if( GetShell()->ActionPend() ) { SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES, @@ -3072,8 +3069,7 @@ void SwAccessibleMap::InvalidatePreviewSelection( sal_uInt16 nSelPage ) const SwPageFrm *pSelPage = mpPreview->GetSelPage(); if( pSelPage && mpFrmMap ) { - SwAccessibleContextMap_Impl::iterator aIter = - mpFrmMap->find( pSelPage ); + SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->find( pSelPage ); if( aIter != mpFrmMap->end() ) xAcc = (*aIter).second; } commit e3ccf113800d5ee98bcdefdec740032520b8ec43 Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 11:44:54 2015 +0100 Use nullptr Change-Id: Ifa5bda7ba3f4b208aa48f63a02c132bd7ef089d2 diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 58e48d0..3364704 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -200,7 +200,7 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/, void SwDrawModellListener_Impl::Dispose() { - mpDrawModel = 0; + mpDrawModel = nullptr; } struct SwShapeFunc @@ -254,8 +254,8 @@ public: const ::accessibility::AccessibleShapeTreeInfo& GetInfo() const { return maInfo; } SwAccessibleObjShape_Impl *Copy( size_t& rSize, - const SwFEShell *pFESh = 0, - SwAccessibleObjShape_Impl **pSelShape = 0 ) const; + const SwFEShell *pFESh = nullptr, + SwAccessibleObjShape_Impl **pSelShape = nullptr ) const; iterator begin() { return maMap.begin(); } iterator end() { return maMap.end(); } @@ -279,8 +279,8 @@ SwAccessibleObjShape_Impl size_t& rSize, const SwFEShell *pFESh, SwAccessibleObjShape_Impl **pSelStart ) const { - SwAccessibleObjShape_Impl *pShapes = 0; - SwAccessibleObjShape_Impl *pSelShape = 0; + SwAccessibleObjShape_Impl *pShapes = nullptr; + SwAccessibleObjShape_Impl *pSelShape = nullptr; size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; rSize = maMap.size(); @@ -353,7 +353,7 @@ public: const SwFrm* mpParentFrm; // The object that fires the event bool IsNoXaccParentFrm() const { - return CHILD_POS_CHANGED == meType && mpParentFrm != 0; + return CHILD_POS_CHANGED == meType && mpParentFrm != nullptr; } public: @@ -364,7 +364,7 @@ public: maFrmOrObj( rFrmOrObj ), meType( eT ), mnStates( 0 ), - mpParentFrm( 0 ) + mpParentFrm( nullptr ) {} SwAccessibleEvent_Impl( EventType eT, @@ -372,7 +372,7 @@ public: : maFrmOrObj( rFrmOrObj ), meType( eT ), mnStates( 0 ), - mpParentFrm( 0 ) + mpParentFrm( nullptr ) { OSL_ENSURE( SwAccessibleEvent_Impl::DISPOSE == meType, "wrong event constructor, DISPOSE only" ); @@ -381,7 +381,7 @@ public: SwAccessibleEvent_Impl( EventType eT ) : meType( eT ), mnStates( 0 ), - mpParentFrm( 0 ) + mpParentFrm( nullptr ) { OSL_ENSURE( SwAccessibleEvent_Impl::SHAPE_SELECTION == meType, "wrong event constructor, SHAPE_SELECTION only" ); @@ -396,7 +396,7 @@ public: maFrmOrObj( rFrmOrObj ), meType( eT ), mnStates( 0 ), - mpParentFrm( 0 ) + mpParentFrm( nullptr ) { OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType || SwAccessibleEvent_Impl::POS_CHANGED == meType, @@ -411,7 +411,7 @@ public: maFrmOrObj( rFrmOrObj ), meType( eT ), mnStates( _nStates ), - mpParentFrm( 0 ) + mpParentFrm( nullptr ) { OSL_ENSURE( SwAccessibleEvent_Impl::CARET_OR_STATES == meType, "wrong event constructor, CARET_OR_STATES only" ); @@ -709,7 +709,7 @@ public: }; SwAccPreviewData::SwAccPreviewData() : - mpSelPage( 0 ) + mpSelPage( nullptr ) { } @@ -809,7 +809,7 @@ void SwAccPreviewData::AdjustMapMode( MapMode& rMapMode, void SwAccPreviewData::DisposePage(const SwPageFrm *pPageFrm ) { if( mpSelPage == pPageFrm ) - mpSelPage = 0; + mpSelPage = nullptr; } // adjust logic page rectangle to its visible part @@ -882,7 +882,7 @@ static bool AreInSameTable( const uno::Reference< XAccessible >& rAcc, void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent ) { ::rtl::Reference < SwAccessibleContext > xAccImpl( rEvent.GetContext() ); - if (!xAccImpl.is() && rEvent.mpParentFrm != 0 ) + if (!xAccImpl.is() && rEvent.mpParentFrm != nullptr) { SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->find( rEvent.mpParentFrm ); @@ -1123,14 +1123,14 @@ void SwAccessibleMap::InvalidateShapeSelection() //3.find the paragraph objects and set the selected state. void SwAccessibleMap::InvalidateShapeInParaSelection() { - SwAccessibleObjShape_Impl *pShapes = 0; - SwAccessibleObjShape_Impl *pSelShape = 0; + SwAccessibleObjShape_Impl *pShapes = nullptr; + SwAccessibleObjShape_Impl *pSelShape = nullptr; size_t nShapes = 0; const SwViewShell *pVSh = GetShell(); const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ? - static_cast< const SwFEShell * >( pVSh ) : 0; - SwPaM* pCrsr = pFESh ? pFESh->GetCrsr( false /* ??? */ ) : NULL; + static_cast< const SwFEShell * >( pVSh ) : nullptr; + SwPaM* pCrsr = pFESh ? pFESh->GetCrsr( false /* ??? */ ) : nullptr; //const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; @@ -1167,7 +1167,7 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() bool bMarked = false; SwAccessibleChild pFrm( (*aIter).first ); - const SwFrmFmt *pFrmFmt = (*aIter).first ? ::FindFrmFmt( (*aIter).first ) : 0; + const SwFrmFmt *pFrmFmt = (*aIter).first ? ::FindFrmFmt( (*aIter).first ) : nullptr; if( !pFrmFmt ) { ++aIter; continue; } const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor(); const SwPosition *pPos = pAnchor.GetCntntAnchor(); @@ -1434,13 +1434,13 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() //Marge with DoInvalidateShapeFocus void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=false*/) { - SwAccessibleObjShape_Impl *pShapes = 0; - SwAccessibleObjShape_Impl *pSelShape = 0; + SwAccessibleObjShape_Impl *pShapes = nullptr; + SwAccessibleObjShape_Impl *pSelShape = nullptr; size_t nShapes = 0; const SwViewShell *pVSh = GetShell(); const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ? - static_cast< const SwFEShell * >( pVSh ) : 0; + static_cast< const SwFEShell * >( pVSh ) : nullptr; const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; //when InvalidateFocus Call this function ,and the current selected shape count is not 1 , @@ -1608,14 +1608,14 @@ void SwAccessibleMap::DoInvalidateShapeFocus() { const SwViewShell *pVSh = GetShell(); const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ? - static_cast< const SwFEShell * >( pVSh ) : 0; + static_cast< const SwFEShell * >( pVSh ) : nullptr; const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; if( nSelShapes != 1 ) return; - SwAccessibleObjShape_Impl *pShapes = 0; - SwAccessibleObjShape_Impl *pSelShape = 0; + SwAccessibleObjShape_Impl *pShapes = nullptr; + SwAccessibleObjShape_Impl *pSelShape = nullptr; size_t nShapes = 0; { @@ -1650,14 +1650,14 @@ void SwAccessibleMap::DoInvalidateShapeFocus() */ SwAccessibleMap::SwAccessibleMap( SwViewShell *pSh ) : - mpFrmMap( 0 ), - mpShapeMap( 0 ), - mpShapes( 0 ), - mpEvents( 0 ), - mpEventMap( 0 ), - mpSelectedParas( 0 ), + mpFrmMap( nullptr ), + mpShapeMap( nullptr ), + mpShapes( nullptr ), + mpEvents( nullptr ), + mpEventMap( nullptr ), + mpSelectedParas( nullptr ), mpVSh( pSh ), - mpPreview( 0 ), + mpPreview( nullptr ), mnPara( 1 ), mbShapeSelected( false ), mpSeletedFrmMap(NULL) @@ -1740,13 +1740,13 @@ SwAccessibleMap::~SwAccessibleMap() } #endif delete mpFrmMap; - mpFrmMap = 0; + mpFrmMap = nullptr; delete mpShapeMap; - mpShapeMap = 0; + mpShapeMap = nullptr; delete mpShapes; - mpShapes = 0; + mpShapes = nullptr; delete mpSelectedParas; - mpSelectedParas = 0; + mpSelectedParas = nullptr; } delete mpPreview; @@ -1774,9 +1774,9 @@ SwAccessibleMap::~SwAccessibleMap() } #endif delete mpEventMap; - mpEventMap = 0; + mpEventMap = nullptr; delete mpEvents; - mpEvents = 0; + mpEvents = nullptr; } mpVSh->GetLayout()->RemoveAccessibleShell(); delete mpSeletedFrmMap; @@ -1885,7 +1885,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrm *pFrm, if( !xAcc.is() && bCreate ) { - SwAccessibleContext *pAcc = 0; + SwAccessibleContext *pAcc = nullptr; switch( pFrm->GetType() ) { case FRM_TXT: @@ -2029,7 +2029,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( if( !xAcc.is() && bCreate ) { - ::accessibility::AccessibleShape *pAcc = 0; + ::accessibility::AccessibleShape *pAcc = nullptr; uno::Reference < drawing::XShape > xShape( const_cast< SdrObject * >( pObj )->getUnoShape(), uno::UNO_QUERY ); @@ -2217,7 +2217,7 @@ void SwAccessibleMap::RemoveContext( const SwFrm *pFrm ) if( mpFrmMap->empty() ) { delete mpFrmMap; - mpFrmMap = 0; + mpFrmMap = nullptr; } } } @@ -2243,7 +2243,7 @@ void SwAccessibleMap::RemoveContext( const SdrObject *pObj ) if( mpShapeMap && mpShapeMap->empty() ) { delete mpShapeMap; - mpShapeMap = 0; + mpShapeMap = nullptr; } } } @@ -2611,7 +2611,7 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm ) else if( pFESh->IsObjSelected() > 0 ) { bShapeSelected = true; - aFrmOrObj = static_cast<const SwFrm *>( 0 ); + aFrmOrObj = static_cast<const SwFrm *>( nullptr ); } } } @@ -2644,11 +2644,11 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm ) const SwTabFrm* pTabFrm = aFrmOrObj.GetSwFrm()->FindTabFrm(); if (pTabFrm) { - InvalidatePosOrSize(pTabFrm,0,0,rcEmpty); + InvalidatePosOrSize(pTabFrm, nullptr, nullptr, rcEmpty); } else { - InvalidatePosOrSize(aFrmOrObj.GetSwFrm(),0,0,rcEmpty); + InvalidatePosOrSize(aFrmOrObj.GetSwFrm(), nullptr, nullptr, rcEmpty); } aIter = @@ -3102,10 +3102,10 @@ void SwAccessibleMap::FireEvents() boost::bind(&SwAccessibleMap::FireEvent, this, _1)); delete mpEventMap; - mpEventMap = 0; + mpEventMap = nullptr; delete mpEvents; - mpEvents = 0; + mpEvents = nullptr; } } { @@ -3113,7 +3113,7 @@ void SwAccessibleMap::FireEvents() if( mpShapes ) { delete mpShapes; - mpShapes = 0; + mpShapes = nullptr; } } @@ -3209,7 +3209,7 @@ bool SwAccessibleMap::ReplaceChild ( const ::accessibility::AccessibleShapeTreeInfo& /*_rShapeTreeInfo*/ ) throw (uno::RuntimeException) { - const SdrObject *pObj = 0; + const SdrObject *pObj = nullptr; { osl::MutexGuard aGuard( maMutex ); if( mpShapeMap ) @@ -3237,8 +3237,8 @@ bool SwAccessibleMap::ReplaceChild ( // holds it. // Also get keep parent. uno::Reference < XAccessible > xParent( pCurrentChild->getAccessibleParent() ); - pCurrentChild = 0; // will be released by dispose - Dispose( 0, pObj, 0 ); + pCurrentChild = nullptr; // will be released by dispose + Dispose( nullptr, pObj, nullptr ); { osl::MutexGuard aGuard( maMutex ); @@ -3274,7 +3274,7 @@ bool SwAccessibleMap::ReplaceChild ( } SwRect aEmptyRect; - InvalidatePosOrSize( 0, pObj, 0, aEmptyRect ); + InvalidatePosOrSize( nullptr, pObj, nullptr, aEmptyRect ); return true; } @@ -3416,11 +3416,11 @@ SwAccessibleSelectedParas_Impl* SwAccessibleMap::_BuildSelectedParas() // no accessible contexts, no selection if ( !mpFrmMap ) { - return 0L; + return nullptr; } // get cursor as an instance of its base class <SwPaM> - SwPaM* pCrsr( 0L ); + SwPaM* pCrsr( nullptr ); { SwCrsrShell* pCrsrShell = dynamic_cast<SwCrsrShell*>(GetShell()); if ( pCrsrShell ) @@ -3438,10 +3438,10 @@ SwAccessibleSelectedParas_Impl* SwAccessibleMap::_BuildSelectedParas() // no cursor, no selection if ( !pCrsr ) { - return 0L; + return nullptr; } - SwAccessibleSelectedParas_Impl* pRetSelectedParas( 0L ); + SwAccessibleSelectedParas_Impl* pRetSelectedParas( nullptr ); // loop on all cursors SwPaM* pRingStart = pCrsr; commit 8c18bd380fc8d62ea341faed98deb38fe337f6fa Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 10:41:01 2015 +0100 SwAccessibleNoTextHyperlink::mnIndex is never read Change-Id: Id3554e4e068cdc5a59dac0bcea38f7ecdc91fc8d diff --git a/sw/source/core/access/accnotexthyperlink.cxx b/sw/source/core/access/accnotexthyperlink.cxx index 0130de9..4044c3e 100644 --- a/sw/source/core/access/accnotexthyperlink.cxx +++ b/sw/source/core/access/accnotexthyperlink.cxx @@ -37,10 +37,9 @@ using namespace css::lang; using namespace css::uno; using namespace css::accessibility; -SwAccessibleNoTextHyperlink::SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm *aFrm, sal_uInt16 nIndex) : +SwAccessibleNoTextHyperlink::SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm *aFrm ) : xFrame( p ), - mpFrm( aFrm ), - mnIndex(nIndex) + mpFrm( aFrm ) { } diff --git a/sw/source/core/access/accnotexthyperlink.hxx b/sw/source/core/access/accnotexthyperlink.hxx index 246f66a..fe7df6d 100644 --- a/sw/source/core/access/accnotexthyperlink.hxx +++ b/sw/source/core/access/accnotexthyperlink.hxx @@ -36,7 +36,6 @@ class SwAccessibleNoTextHyperlink : ::rtl::Reference< SwAccessibleNoTextFrame > xFrame; const SwFrm *mpFrm; - sal_uInt16 mnIndex; SwFrmFmt *GetFmt() { @@ -44,7 +43,7 @@ class SwAccessibleNoTextHyperlink : } public: - SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm* aFrm, sal_uInt16 nIndex = 0xFFFF ); + SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm* aFrm ); // XAccessibleAction virtual sal_Int32 SAL_CALL getAccessibleActionCount() commit 8fd1ab72392388903232ac9435e8fb7eb7166c8b Author: Matteo Casalin <[email protected]> Date: Wed Jan 7 10:14:05 2015 +0100 Avoid unneeded cast Change-Id: Ic37a6a788b91a7e436943e7e832dceae2258e848 diff --git a/sw/source/core/access/textmarkuphelper.cxx b/sw/source/core/access/textmarkuphelper.cxx index 3489cc8..2217f9d 100644 --- a/sw/source/core/access/textmarkuphelper.cxx +++ b/sw/source/core/access/textmarkuphelper.cxx @@ -183,8 +183,7 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const sal_Int32 nTextMarkupTyp const sal_uInt16 nTextMarkupCount = pTextMarkupList->Count(); for ( sal_uInt16 nTextMarkupIdx = 0; nTextMarkupIdx < nTextMarkupCount; ++nTextMarkupIdx ) { - const SwWrongArea* pTextMarkup = - pTextMarkupList->GetElement( static_cast<sal_uInt16>(nTextMarkupIdx) ); + const SwWrongArea* pTextMarkup = pTextMarkupList->GetElement( nTextMarkupIdx ); OSL_ENSURE( pTextMarkup, "<SwTextMarkupHelper::getTextMarkup(..)> - missing <SwWrongArea> instance" ); if ( pTextMarkup && commit c1dafdf6c645b0199a988ed467189e2b18794ce0 Author: Matteo Casalin <[email protected]> Date: Tue Jan 6 18:35:37 2015 +0100 sal_uInt16 to size_t Change-Id: Iaf133b811f4182d9cf73cc68c6d01afb1acf2a75 diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 079ef71..619013a 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -462,7 +462,7 @@ public: /// Set DragMode (e.g. Rotate), but do nothing when frame is selected. void SetDragMode( sal_uInt16 eSdrDragMode ); - sal_uInt16 IsObjSelected() const; ///< @return object count, but doesn't count the objects in groups. + size_t IsObjSelected() const; ///< @return object count, but doesn't count the objects in groups. bool IsObjSelected( const SdrObject& rObj ) const; bool IsObjSameLevelWithMarked(const SdrObject* pObj) const; const SdrMarkList* GetMarkList() const{ return _GetMarkList(); }; diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 2d3cf83..58e48d0 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -282,7 +282,7 @@ SwAccessibleObjShape_Impl SwAccessibleObjShape_Impl *pShapes = 0; SwAccessibleObjShape_Impl *pSelShape = 0; - sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; + size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; rSize = maMap.size(); if( rSize > 0 ) @@ -299,7 +299,7 @@ SwAccessibleObjShape_Impl { const SdrObject *pObj = (*aIter).first; uno::Reference < XAccessible > xAcc( (*aIter).second ); - if( nSelShapes && pFESh &&pFESh->IsObjSelected( *pObj ) ) + if( nSelShapes && pFESh && pFESh->IsObjSelected( *pObj ) ) { // selected objects are inserted from the back --pSelShape; @@ -1132,7 +1132,7 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() static_cast< const SwFEShell * >( pVSh ) : 0; SwPaM* pCrsr = pFESh ? pFESh->GetCrsr( false /* ??? */ ) : NULL; - //sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; + //const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; { osl::MutexGuard aGuard( maMutex ); @@ -1441,7 +1441,7 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=fa const SwViewShell *pVSh = GetShell(); const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ? static_cast< const SwFEShell * >( pVSh ) : 0; - sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; + const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; //when InvalidateFocus Call this function ,and the current selected shape count is not 1 , //return @@ -1609,7 +1609,7 @@ void SwAccessibleMap::DoInvalidateShapeFocus() const SwViewShell *pVSh = GetShell(); const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ? static_cast< const SwFEShell * >( pVSh ) : 0; - sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; + const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; if( nSelShapes != 1 ) return; diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx index a2a8bd3..af7553a 100644 --- a/sw/source/core/access/accselectionhelper.cxx +++ b/sw/source/core/access/accselectionhelper.cxx @@ -233,7 +233,7 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( ) } else { - sal_uInt16 nSelObjs = pFEShell->IsObjSelected(); + const size_t nSelObjs = pFEShell->IsObjSelected(); if( nSelObjs > 0 ) { ::std::list< SwAccessibleChild > aChildren; @@ -243,7 +243,7 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( ) aChildren.begin(); ::std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end(); - while( aIter != aEndIter && nCount < nSelObjs ) + while( aIter != aEndIter && static_cast<size_t>(nCount) < nSelObjs ) { const SwAccessibleChild& rChild = *aIter; if( rChild.GetDrawObject() && !rChild.GetSwFrm() && @@ -321,8 +321,8 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild( } else { - sal_uInt16 nSelObjs = pFEShell->IsObjSelected(); - if( 0 == nSelObjs || nSelectedChildIndex >= nSelObjs ) + const size_t nSelObjs = pFEShell->IsObjSelected(); + if( 0 == nSelObjs || static_cast<size_t>(nSelectedChildIndex) >= nSelObjs ) throwIndexOutOfBoundsException(); ::std::list< SwAccessibleChild > aChildren; diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index b1be489..9fc4cdc 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -911,12 +911,12 @@ void SwFEShell::SelectionToHell() ChangeOpaque( getIDocumentDrawModelAccess()->GetHellId() ); } -sal_uInt16 SwFEShell::IsObjSelected() const +size_t SwFEShell::IsObjSelected() const { if ( IsFrmSelected() || !Imp()->HasDrawView() ) return 0; - else - return sal_uInt16( Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() ); + + return Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount(); } bool SwFEShell::IsFrmSelected() const @@ -2372,8 +2372,8 @@ bool SwFEShell::SetObjAttr( const SfxItemSet& rSet ) bool SwFEShell::IsAlignPossible() const { - sal_uInt16 nCnt; - if ( 0 < (nCnt = IsObjSelected()) ) + const size_t nCnt = IsObjSelected(); + if ( 0 < nCnt ) { bool bRet = true; if ( nCnt == 1 ) commit 7b765053e3b3476de7017359c2e10bcd87c000b0 Author: Matteo Casalin <[email protected]> Date: Mon Jan 5 19:41:56 2015 +0100 Avoid temporary OUStrings Change-Id: I630a2dad683fae6d6327bcdb83c03aa3598670ab diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index a00fb45..8eadf58 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -121,8 +121,7 @@ void SwAccessiblePortionData::Text(sal_Int32 nLength, sal_uInt16 nType, sal_Int3 aPortionAttrs.push_back( nAttr ); // update buffer + nModelPosition - aBuffer.append( OUString( - pTxtNode->GetTxt().copy(nModelPosition, nLength)) ); + aBuffer.append( pTxtNode->GetTxt().copy(nModelPosition, nLength) ); nModelPosition += nLength; bLastIsSpecial = false; @@ -182,16 +181,16 @@ void SwAccessiblePortionData::Special( break; case POR_NUMBER: { - sDisplay = OUString( rText ) + " "; + sDisplay = rText + " "; break; } // #i111768# - apply patch from kstribley: // Include the control characters. case POR_CONTROLCHAR: - sDisplay = OUString( rText ) + OUString( pTxtNode->GetTxt()[nModelPosition] ); + sDisplay = rText + OUString( pTxtNode->GetTxt()[nModelPosition] ); break; default: - sDisplay = OUString( rText ); + sDisplay = rText; break; } commit eef31e9feeae240db68e86b71ab0c9ef0ac4e9fe Author: Matteo Casalin <[email protected]> Date: Mon Jan 5 18:48:01 2015 +0100 Cleanup whitespaces, remove unneeded local scopes Change-Id: I664d33c544bdb9685154a8dd433458e30d29f315 diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index 361b9e2..a00fb45 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -156,25 +156,21 @@ void SwAccessiblePortionData::Special( break; case POR_GRFNUM: case POR_BULLET: - break; + break; case POR_FLD: case POR_HIDDEN: case POR_COMBINED: case POR_ISOREF: - { - //When the filed content is empty, input a special character. - if (rText.isEmpty()) - sDisplay = OUString(sal_Unicode(0xfffc)); - else - sDisplay = rText; - aFieldPosition.push_back(aBuffer.getLength()); - aFieldPosition.push_back(aBuffer.getLength() + rText.getLength()); - break; - } + // When the filed content is empty, input a special character. + if (rText.isEmpty()) + sDisplay = OUString(sal_Unicode(0xfffc)); + else + sDisplay = rText; + aFieldPosition.push_back(aBuffer.getLength()); + aFieldPosition.push_back(aBuffer.getLength() + rText.getLength()); + break; case POR_FTNNUM: - { - break; - } + break; case POR_FTN: { sDisplay = rText; @@ -192,10 +188,8 @@ void SwAccessiblePortionData::Special( // #i111768# - apply patch from kstribley: // Include the control characters. case POR_CONTROLCHAR: - { sDisplay = OUString( rText ) + OUString( pTxtNode->GetTxt()[nModelPosition] ); break; - } default: sDisplay = OUString( rText ); break; @@ -302,7 +296,7 @@ bool SwAccessiblePortionData::IsGrayPortionType( sal_uInt16 nType ) const case POR_HIDDEN: bGray = !pViewOptions->IsPagePreview() && !pViewOptions->IsReadonly() && SwViewOption::IsFieldShadings(); - break; + break; case POR_TAB: bGray = pViewOptions->IsTab(); break; case POR_SOFTHYPH: bGray = pViewOptions->IsSoftHyph(); break; case POR_BLANK: bGray = pViewOptions->IsHardBlank(); break; @@ -493,47 +487,47 @@ void SwAccessiblePortionData::GetSentenceBoundary( if( pSentences == NULL ) { - OSL_ENSURE( g_pBreakIt != NULL, "We always need a break." ); - OSL_ENSURE( g_pBreakIt->GetBreakIter().is(), "No break-iterator." ); - if( g_pBreakIt->GetBreakIter().is() ) - { - pSentences = new Positions_t(); - pSentences->reserve(10); - - // use xBreak->endOfSentence to iterate over all words; store - // positions in pSentences - sal_Int32 nCurrent = 0; - sal_Int32 nLength = sAccessibleString.getLength(); - do - { - pSentences->push_back( nCurrent ); - - const sal_Int32 nModelPos = GetModelPosition( nCurrent ); - - sal_Int32 nNew = g_pBreakIt->GetBreakIter()->endOfSentence( - sAccessibleString, nCurrent, - g_pBreakIt->GetLocale(pTxtNode->GetLang(nModelPos)) ) + 1; - - if( (nNew < 0) && (nNew > nLength) ) - nNew = nLength; - else if (nNew <= nCurrent) - nNew = nCurrent + 1; // ensure forward progress - - nCurrent = nNew; - } - while (nCurrent < nLength); - - // finish with two terminators - pSentences->push_back( nLength ); - pSentences->push_back( nLength ); - } - else - { - // no break iterator -> empty word - rBound.startPos = 0; - rBound.endPos = 0; - return; - } + OSL_ENSURE( g_pBreakIt != NULL, "We always need a break." ); + OSL_ENSURE( g_pBreakIt->GetBreakIter().is(), "No break-iterator." ); + if( g_pBreakIt->GetBreakIter().is() ) + { + pSentences = new Positions_t(); + pSentences->reserve(10); + + // use xBreak->endOfSentence to iterate over all words; store + // positions in pSentences + sal_Int32 nCurrent = 0; + sal_Int32 nLength = sAccessibleString.getLength(); + do + { + pSentences->push_back( nCurrent ); + + const sal_Int32 nModelPos = GetModelPosition( nCurrent ); + + sal_Int32 nNew = g_pBreakIt->GetBreakIter()->endOfSentence( + sAccessibleString, nCurrent, + g_pBreakIt->GetLocale(pTxtNode->GetLang(nModelPos)) ) + 1; + + if( (nNew < 0) && (nNew > nLength) ) + nNew = nLength; + else if (nNew <= nCurrent) + nNew = nCurrent + 1; // ensure forward progress + + nCurrent = nNew; + } + while (nCurrent < nLength); + + // finish with two terminators + pSentences->push_back( nLength ); + pSentences->push_back( nLength ); + } + else + { + // no break iterator -> empty word + rBound.startPos = 0; + rBound.endPos = 0; + return; + } } FillBoundary( rBound, *pSentences, FindBreak( *pSentences, nPos ) ); @@ -679,7 +673,8 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( bool SwAccessiblePortionData::FillBoundaryIFDateField( com::sun::star::i18n::Boundary& rBound, const sal_Int32 nPos ) { - if( aFieldPosition.size() < 2 ) return false; + if( aFieldPosition.size() < 2 ) + return false; for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 ) { if( nPos < aFieldPosition[ i + 1 ] && nPos >= aFieldPosition[ i ] ) @@ -739,7 +734,7 @@ bool SwAccessiblePortionData::GetEditableRange( nStartPortion = nLastPortion + 1; } - for( size_t nPor = nStartPortion; nPor <= nLastPortion; nPor ++ ) + for( size_t nPor = nStartPortion; nPor <= nLastPortion; nPor++ ) { bIsEditable &= ! IsReadOnlyPortion( nPor ); } commit 6f1423892396a45834c5ae03e17bb0e1be833af6 Author: Matteo Casalin <[email protected]> Date: Mon Jan 5 17:53:28 2015 +0100 sal_uInt16 to sal_Int32 Change-Id: I86be484aa5ac87cab236d65eb7a1b351e215e57b diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index ca716bd..b16f06a 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -755,13 +755,13 @@ bool SwAccessibleParagraph::GetWordBoundary( if( g_pBreakIt->GetBreakIter().is() ) { // get locale for this position - sal_uInt16 nModelPos = GetPortionData().GetModelPosition( nPos ); + const sal_Int32 nModelPos = GetPortionData().GetModelPosition( nPos ); lang::Locale aLocale = g_pBreakIt->GetLocale( GetTxtNode()->GetLang( nModelPos ) ); // which type of word are we interested in? // (DICTIONARY_WORD includes punctuation, ANY_WORD doesn't.) - const sal_uInt16 nWordType = i18n::WordType::ANY_WORD; + const sal_Int16 nWordType = i18n::WordType::ANY_WORD; // get word boundary, as the Break-Iterator sees fit. rBound = g_pBreakIt->GetBreakIter()->getWordBoundary( @@ -842,12 +842,12 @@ bool SwAccessibleParagraph::GetGlyphBoundary( if( g_pBreakIt->GetBreakIter().is() ) { // get locale for this position - sal_uInt16 nModelPos = GetPortionData().GetModelPosition( nPos ); + const sal_Int32 nModelPos = GetPortionData().GetModelPosition( nPos ); lang::Locale aLocale = g_pBreakIt->GetLocale( GetTxtNode()->GetLang( nModelPos ) ); // get word boundary, as the Break-Iterator sees fit. - const sal_uInt16 nIterMode = i18n::CharacterIteratorMode::SKIPCELL; + const sal_Int16 nIterMode = i18n::CharacterIteratorMode::SKIPCELL; sal_Int32 nDone = 0; rBound.endPos = g_pBreakIt->GetBreakIter()->nextCharacters( rText, nPos, aLocale, nIterMode, 1, nDone ); @@ -1467,7 +1467,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) if (pField) { strTypeName = SwFieldType::GetTypeStr(pField->GetTypeId()); - sal_uInt16 nWhich = pField->GetTyp()->Which(); + const sal_uInt16 nWhich = pField->GetTyp()->Which(); rtl::OUString sEntry; sal_Int32 subType = 0; switch (nWhich) @@ -1477,8 +1477,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) break; case RES_GETREFFLD: { - sal_uInt16 nSub = pField->GetSubType(); - switch( nSub ) + switch( pField->GetSubType() ) { case REF_BOOKMARK: { @@ -1523,8 +1522,8 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) break; case RES_JUMPEDITFLD: { - sal_uInt16 nFormat= pField->GetFormat(); - sal_uInt16 nSize = aMgr.GetFormatCount(pField->GetTypeId(), false); + const sal_uInt16 nFormat= pField->GetFormat(); + const sal_uInt16 nSize = aMgr.GetFormatCount(pField->GetTypeId(), false); if (nFormat < nSize) { sEntry = aMgr.GetFormatStr(pField->GetTypeId(), nFormat); @@ -1584,7 +1583,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) { strTypeName = sEntry; sal_uInt32 nSize = aMgr.GetFormatCount(pField->GetTypeId(), false); - sal_uInt16 nExSub = pField->GetSubType() & 0xff00; + const sal_uInt16 nExSub = pField->GetSubType() & 0xff00; if (nSize > 0 && nExSub > 0) { //Get extra subtype string @@ -3734,7 +3733,7 @@ bool SwAccessibleParagraph::GetSelectionAtIndex( // selection starts in this node: // then check whether it's before or inside our part of // the paragraph, and if so, get the proper position - sal_uInt16 nCoreStart = pStart->nContent.GetIndex(); + const sal_Int32 nCoreStart = pStart->nContent.GetIndex(); if( nCoreStart < GetPortionData().GetFirstValidCorePosition() ) { @@ -3770,7 +3769,7 @@ bool SwAccessibleParagraph::GetSelectionAtIndex( // selection ends in this node: then select everything // before our part of the node - sal_uInt16 nCoreEnd = pEnd->nContent.GetIndex(); + const sal_Int32 nCoreEnd = pEnd->nContent.GetIndex(); if( nCoreEnd > GetPortionData().GetLastValidCorePosition() ) { diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index 1c4f8ad..361b9e2 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -508,7 +508,7 @@ void SwAccessiblePortionData::GetSentenceBoundary( { pSentences->push_back( nCurrent ); - sal_uInt16 nModelPos = GetModelPosition( nCurrent ); + const sal_Int32 nModelPos = GetModelPosition( nCurrent ); sal_Int32 nNew = g_pBreakIt->GetBreakIter()->endOfSentence( sAccessibleString, nCurrent, commit cbf3bdab91d6b6a41e59d7d02b4d3ebef68c5f5a Author: Matteo Casalin <[email protected]> Date: Mon Jan 5 16:39:24 2015 +0100 sal_uInt16 to sal_Int32 Change-Id: I2ab0eab053238b3c6db29b25a514e2b1b2ecd923 diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 00c3a94..ca716bd 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1375,20 +1375,14 @@ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > SwAccessiblePa SwSpecialPos aSpecialPos; SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() ); - sal_uInt16 nPos = 0; - /* #i12332# FillSpecialPos does not accept nIndex == GetString().getLength(). In that case nPos is set to the length of the string in the core. This way GetCharRect returns the rectangle for a cursor at the end of the paragraph. */ - if (bBehindText) - { - nPos = pNode->GetTxt().getLength(); - } - else - nPos = GetPortionData().FillSpecialPos - (nIndex, aSpecialPos, aMoveState.pSpecialPos ); + const sal_Int32 nPos = bBehindText + ? pNode->GetTxt().getLength() + : GetPortionData().FillSpecialPos(nIndex, aSpecialPos, aMoveState.pSpecialPos ); // call GetCharRect SwRect aCoreRect; @@ -2425,20 +2419,14 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds( SwSpecialPos aSpecialPos; SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() ); - sal_uInt16 nPos = 0; - /** #i12332# FillSpecialPos does not accept nIndex == GetString().getLength(). In that case nPos is set to the length of the string in the core. This way GetCharRect returns the rectangle for a cursor at the end of the paragraph. */ - if (bBehindText) - { - nPos = pNode->GetTxt().getLength(); - } - else - nPos = GetPortionData().FillSpecialPos - (nIndex, aSpecialPos, aMoveState.pSpecialPos ); + const sal_Int32 nPos = bBehindText + ? pNode->GetTxt().getLength() + : GetPortionData().FillSpecialPos(nIndex, aSpecialPos, aMoveState.pSpecialPos ); // call GetCharRect SwRect aCoreRect; diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index c997d9e..1c4f8ad 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -582,7 +582,7 @@ sal_Int32 SwAccessiblePortionData::GetAccessiblePosition( sal_Int32 nPos ) const return nRet; } -sal_uInt16 SwAccessiblePortionData::FillSpecialPos( +sal_Int32 SwAccessiblePortionData::FillSpecialPos( sal_Int32 nPos, SwSpecialPos& rPos, SwSpecialPos*& rpPos ) const @@ -674,7 +674,7 @@ sal_uInt16 SwAccessiblePortionData::FillSpecialPos( rPos.nLineOfst = nLineOffset; } - return static_cast<sal_uInt16>( nModelPos ); + return nModelPos; } bool SwAccessiblePortionData::FillBoundaryIFDateField( com::sun::star::i18n::Boundary& rBound, const sal_Int32 nPos ) diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx index e99cf8f..3db82a6 100644 --- a/sw/source/core/access/accportions.hxx +++ b/sw/source/core/access/accportions.hxx @@ -147,9 +147,9 @@ public: /// fill a SwSpecialPos structure, suitable for calling /// SwTxtFrm->GetCharRect - /// Returns the core position, and fills thr rpPos either with NULL or + /// Returns the core position, and fills rpPos either with NULL or /// with the &rPos, after putting the appropriate data into it. - sal_uInt16 FillSpecialPos( sal_Int32 nPos, + sal_Int32 FillSpecialPos( sal_Int32 nPos, SwSpecialPos& rPos, SwSpecialPos*& rpPos ) const; commit ea404ac36ac36def92b5df27e42645af9e0eda68 Author: Matteo Casalin <[email protected]> Date: Mon Jan 5 09:55:16 2015 +0100 Use more proper integer types and avoid unneeded downcasts Change-Id: Idcb8f5fd47ae4a7952f313a4402a980359c90a83 diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index 051a661..13efc75 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -201,11 +201,10 @@ GridColsPtr WW8TableNodeInfoInner::getGridColsOfRow(AttributeOutputBase & rBase, const SwFmtFrmSize &rSize = pFmt->GetFrmSize(); unsigned long nTblSz = static_cast<unsigned long>(rSize.GetWidth()); - sal_uInt32 nPageSize = 0; + long nPageSize = 0; bool bRelBoxSize = false; - rBase.GetTablePageSize - ( this, nPageSize, bRelBoxSize ); + rBase.GetTablePageSize( this, nPageSize, bRelBoxSize ); SwTwips nSz = 0; Widths::const_iterator aWidthsEnd = pWidths->end(); diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 1dffa63..3916eb3 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -647,7 +647,7 @@ public: void GetTablePageSize ( ww8::WW8TableNodeInfoInner * pTableTextNodeInfoInner, - sal_uInt32& rPageSize, bool& rRelBoxSize ); + long& rPageSize, bool& rRelBoxSize ); /// Exports the definition (image, size) of a single numbering picture bullet. virtual void BulletDefinition(int /*nId*/, const Graphic& /*rGraphic*/, Size /*aSize*/) {} diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 15b5dea..a1c9832 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2598,8 +2598,8 @@ static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, co pBorderLine->GetBorderLineStyle(), pBorderLine->GetWidth())); // The unit is the 8th of point sal_Int32 nWidth = sal_Int32( fConverted / 2.5 ); - sal_uInt16 nMinWidth = 2; - sal_uInt16 nMaxWidth = 96; + const sal_Int32 nMinWidth = 2; + const sal_Int32 nMaxWidth = 96; if ( nWidth > nMaxWidth ) nWidth = nMaxWidth; @@ -2939,7 +2939,7 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point void DocxAttributeOutput::InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { - sal_uInt32 nPageSize = 0; + long nPageSize = 0; bool bRelBoxSize = false; // Create the SwWriteTable instance to use col spans (and maybe other infos) @@ -2947,14 +2947,13 @@ void DocxAttributeOutput::InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t const SwTable* pTable = pTableTextNodeInfoInner->getTable( ); const SwFrmFmt *pFmt = pTable->GetFrmFmt( ); - SwTwips nTblSz = pFmt->GetFrmSize( ).GetWidth( ); + const sal_uInt32 nTblSz = static_cast<sal_uInt32>(pFmt->GetFrmSize( ).GetWidth( )); const SwHTMLTableLayout *pLayout = pTable->GetHTMLTableLayout(); if( pLayout && pLayout->IsExportable() ) m_pTableWrt = new SwWriteTable( pLayout ); else - m_pTableWrt = new SwWriteTable( pTable->GetTabLines(), (sal_uInt16)nPageSize, - (sal_uInt16)nTblSz, false); + m_pTableWrt = new SwWriteTable( pTable->GetTabLines(), nPageSize, nTblSz, false); } void DocxAttributeOutput::StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) @@ -3115,7 +3114,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t m_pSerializer->mark( aSeqOrder ); - sal_uInt32 nPageSize = 0; + long nPageSize = 0; const char* widthType = "dxa"; bool bRelBoxSize = false; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index d6e6115..3ae033e 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -844,7 +844,7 @@ void RtfAttributeOutput::TableRowEnd(sal_uInt32 /*nDepth*/) void RtfAttributeOutput::InitTableHelper(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) { - sal_uInt32 nPageSize = 0; + long nPageSize = 0; bool bRelBoxSize = false; // Create the SwWriteTable instance to use col spans @@ -852,14 +852,13 @@ void RtfAttributeOutput::InitTableHelper(ww8::WW8TableNodeInfoInner::Pointer_t p const SwTable* pTable = pTableTextNodeInfoInner->getTable(); const SwFrmFmt* pFmt = pTable->GetFrmFmt(); - SwTwips nTblSz = pFmt->GetFrmSize().GetWidth(); + const sal_uInt32 nTblSz = static_cast<sal_uInt32>(pFmt->GetFrmSize().GetWidth()); const SwHTMLTableLayout* pLayout = pTable->GetHTMLTableLayout(); if (pLayout && pLayout->IsExportable()) m_pTableWrt = new SwWriteTable(pLayout); else - m_pTableWrt = new SwWriteTable(pTable->GetTabLines(), (sal_uInt16)nPageSize, - (sal_uInt16)nTblSz, false); + m_pTableWrt = new SwWriteTable(pTable->GetTabLines(), nPageSize, nTblSz, false); } void RtfAttributeOutput::StartTable(ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index af41675..b724c24 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2330,9 +2330,9 @@ ww8::WidthsPtr AttributeOutputBase::GetColumnWidths( ww8::WW8TableNodeInfoInner: return pTableTextNodeInfoInner->getGridColsOfRow(*this, true); } -void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner * pTableTextNodeInfoInner, sal_uInt32& rPageSize, bool& rRelBoxSize ) +void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner * pTableTextNodeInfoInner, long& rPageSize, bool& rRelBoxSize ) { - sal_uInt32 nPageSize = 0; + long nPageSize = 0; const SwNode *pTxtNd = pTableTextNodeInfoInner->getNode( ); const SwTable *pTable = pTableTextNodeInfoInner->getTable( ); commit c5f72002d186f2d195361541b5f3a6b0299f0683 Author: Matteo Casalin <[email protected]> Date: Mon Jan 5 08:40:24 2015 +0100 Remove misleading comment and simplify boundary check Change-Id: I115bb1cd1be9c7c544508d1328248ebf3ad0d225 diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx index c88bf4b..04f3c92 100644 --- a/sw/source/filter/ww8/docxtablestyleexport.cxx +++ b/sw/source/filter/ww8/docxtablestyleexport.cxx @@ -118,11 +118,9 @@ void DocxTableStyleExport::TableStyles(sal_Int32 nCountStylesToWrite) } if (!aTableStyles.getLength()) return; - // HACK - // Ms Office seems to have an internal limitation of 4091 styles - // and refuses to load .docx with more, even though the spec seems to allow that; - // so simply if there are more styles, don't export those - nCountStylesToWrite = (nCountStylesToWrite > aTableStyles.getLength()) ? aTableStyles.getLength(): nCountStylesToWrite; + + if (nCountStylesToWrite > aTableStyles.getLength()) + nCountStylesToWrite = aTableStyles.getLength(); for (sal_Int32 i = 0; i < nCountStylesToWrite; ++i) { commit 8229d5af3f7bc67366d70343f083d369b7c15274 Author: Matteo Casalin <[email protected]> Date: Mon Jan 5 08:25:20 2015 +0100 sal_uInt16/sal_uInt32 to more proper integer types Change-Id: I07f9ae7f926d40a4a438e850832b6e9f09a1d1e3 diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index c928b9a..8b5b0ed 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -313,7 +313,7 @@ void Writer::PutNumFmtFontsInAttrPool() const vcl::Font* pDefFont = &numfunc::GetDefBulletFont(); bool bCheck = false; - for( sal_uInt16 nGet = rListTbl.size(); nGet; ) + for( size_t nGet = rListTbl.size(); nGet; ) if( pDoc->IsUsed( *(pRule = rListTbl[ --nGet ] ))) for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl ) if( SVX_NUM_CHAR_SPECIAL == (pFmt = &pRule->Get( nLvl ))->GetNumberingType() || diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index 97a5d40..051a661 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -235,21 +235,21 @@ WidthsPtr WW8TableNodeInfoInner::getColumnWidthsBasedOnAllRows() { const SwTable * pTable = getTable(); const SwTableLines& rTableLines = pTable->GetTabLines(); - sal_uInt16 nNumOfLines = rTableLines.size(); + const size_t nNumOfLines = rTableLines.size(); // Go over all the rows - and for each row - calculate where // there is a separator between columns WidthsPtr pSeparators(new Widths); - for ( sal_uInt32 nLineIndex = 0; nLineIndex < nNumOfLines; nLineIndex++) + for ( size_t nLineIndex = 0; nLineIndex < nNumOfLines; ++nLineIndex ) { const SwTableLine *pCurrentLine = rTableLines[nLineIndex]; const SwTableBoxes & rTabBoxes = pCurrentLine->GetTabBoxes(); - sal_uInt32 nBoxes = rTabBoxes.size(); + size_t nBoxes = rTabBoxes.size(); if ( nBoxes > MAXTABLECELLS ) nBoxes = MAXTABLECELLS; sal_uInt32 nSeparatorPosition = 0; - for (sal_uInt32 nBoxIndex = 0; nBoxIndex < nBoxes; nBoxIndex++) + for (size_t nBoxIndex = 0; nBoxIndex < nBoxes; ++nBoxIndex) { const SwFrmFmt* pBoxFmt = rTabBoxes[ nBoxIndex ]->GetFrmFmt(); const SwFmtFrmSize& rLSz = pBoxFmt->GetFrmSize(); @@ -641,11 +641,11 @@ void WW8TableInfo::processSwTable(const SwTable * pTable) { const SwTableLines & rLines = pTable->GetTabLines(); - for (sal_uInt16 n = 0; n < rLines.size(); n++) + for (size_t n = 0; n < rLines.size(); ++n) { const SwTableLine * pLine = rLines[n]; - pPrev = processTableLine(pTable, pLine, n, 1, pPrev); + pPrev = processTableLine(pTable, pLine, static_cast<sal_uInt32>(n), 1, pPrev); } } @@ -672,11 +672,11 @@ WW8TableInfo::processTableLine(const SwTable * pTable, WW8TableNodeInfo::Pointer_t pTextNodeInfo; - for (sal_uInt16 n = 0; n < rBoxes.size(); n++) + for (size_t n = 0; n < rBoxes.size(); ++n) { const SwTableBox * pBox = rBoxes[n]; - pPrev = processTableBox(pTable, pBox, nRow, n, nDepth, n == rBoxes.size() - 1, pPrev); + pPrev = processTableBox(pTable, pBox, nRow, static_cast<sal_uInt32>(n), nDepth, n == rBoxes.size() - 1, pPrev); } SAL_INFO( "sw.ww8", "</processTableLine>" ); @@ -700,12 +700,12 @@ WW8TableInfo::processTableBoxLines(const SwTableBox * pBox, if (!rLines.empty()) { - for (sal_uInt32 n = 0; n < rLines.size(); n++) + for (size_t n = 0; n < rLines.size(); ++n) { const SwTableLine * pLine = rLines[n]; const SwTableBoxes & rBoxes = pLine->GetTabBoxes(); - for (sal_uInt16 nBox = 0; nBox < rBoxes.size(); nBox++) + for (size_t nBox = 0; nBox < rBoxes.size(); ++nBox) pNodeInfo = processTableBoxLines(rBoxes[nBox], pTable, pBoxToSet, nRow, nCell, nDepth); } } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f44794a..15b5dea 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3994,7 +3994,7 @@ void DocxAttributeOutput::EndStyles( sal_uInt16 nNumberOfStyles ) // Ms Office seems to have an internal limitation of 4091 styles // and refuses to load .docx with more, even though the spec seems to allow that; // so simply if there are more styles, don't export those - sal_uInt16 nCountStylesToWrite = MSWORD_MAX_STYLES_LIMIT - nNumberOfStyles; + const sal_Int32 nCountStylesToWrite = MSWORD_MAX_STYLES_LIMIT - nNumberOfStyles; m_pTableStyleExport->TableStyles(nCountStylesToWrite); m_pSerializer->endElementNS( XML_w, XML_styles ); } diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx index 53194d1..c88bf4b 100644 --- a/sw/source/filter/ww8/docxtablestyleexport.cxx +++ b/sw/source/filter/ww8/docxtablestyleexport.cxx @@ -101,7 +101,7 @@ void DocxTableStyleExport::CnfStyle(uno::Sequence<beans::PropertyValue>& rAttrib m_pImpl->m_pSerializer->singleElementNS(XML_w, XML_cnfStyle, xAttributeList); } -void DocxTableStyleExport::TableStyles(sal_uInt16 nCountStylesToWrite) +void DocxTableStyleExport::TableStyles(sal_Int32 nCountStylesToWrite) { // Do we have table styles from InteropGrabBag available? uno::Reference<beans::XPropertySet> xPropertySet(m_pImpl->m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW); diff --git a/sw/source/filter/ww8/docxtablestyleexport.hxx b/sw/source/filter/ww8/docxtablestyleexport.hxx index 4b6e037..c43a9be 100644 --- a/sw/source/filter/ww8/docxtablestyleexport.hxx +++ b/sw/source/filter/ww8/docxtablestyleexport.hxx @@ -24,7 +24,7 @@ class DocxTableStyleExport struct Impl; boost::shared_ptr<Impl> m_pImpl; public: - void TableStyles(sal_uInt16 nCountStylesToWrite); + void TableStyles(sal_Int32 nCountStylesToWrite); /// Writes <w:rPr>...</w:rPr> based on grab-bagged character properties. void CharFormat(css::uno::Sequence<css::beans::PropertyValue>& rRPr); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
