Kaydet (Commit) f0aaae92 authored tarafından Matteo Casalin's avatar Matteo Casalin

sal_uInt16 to more proper types and constify

Change-Id: Ia510ac7d5b38dc6f3910a6e965f1cc154ad41f27
üst 352158b8
...@@ -95,12 +95,12 @@ ...@@ -95,12 +95,12 @@
#define TYPE_LRSPACE 5 #define TYPE_LRSPACE 5
#define TYPE_BOX 6 #define TYPE_BOX 6
const unsigned short aStyleByIndex[] = const sal_uInt16 aStyleByIndex[] =
{ {
SFX_STYLE_FAMILY_CHAR, SFX_STYLE_FAMILY_CHAR,
SFX_STYLE_FAMILY_PARA, SFX_STYLE_FAMILY_PARA,
SFX_STYLE_FAMILY_PAGE , SFX_STYLE_FAMILY_PAGE,
SFX_STYLE_FAMILY_FRAME , SFX_STYLE_FAMILY_FRAME,
SFX_STYLE_FAMILY_PSEUDO SFX_STYLE_FAMILY_PSEUDO
}; };
...@@ -296,7 +296,7 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex) ...@@ -296,7 +296,7 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex)
if(IsValid()) if(IsValid())
{ {
uno::Reference< container::XNameContainer > aRef; uno::Reference< container::XNameContainer > aRef;
sal_uInt16 nType = aStyleByIndex[nIndex]; const sal_uInt16 nType = aStyleByIndex[nIndex];
switch( nType ) switch( nType )
{ {
case SFX_STYLE_FAMILY_CHAR: case SFX_STYLE_FAMILY_CHAR:
...@@ -481,8 +481,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc, ...@@ -481,8 +481,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc,
sal_uInt16 nBaseCount = RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN + sal_uInt16 nBaseCount = RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN +
RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN; RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN;
nIndex = nIndex - nBaseCount; nIndex = nIndex - nBaseCount;
const sal_uInt16 nArrLen = rDoc.GetCharFmts()->size(); const size_t nArrLen = rDoc.GetCharFmts()->size();
for( sal_uInt16 i = 0; i < nArrLen; i++ ) for( size_t i = 0; i < nArrLen; ++i )
{ {
SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ]; SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() ) if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
...@@ -514,8 +514,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc, ...@@ -514,8 +514,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc,
RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN + RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN; RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN;
nIndex = nIndex - nBaseCount; nIndex = nIndex - nBaseCount;
const sal_uInt16 nArrLen = rDoc.GetTxtFmtColls()->size(); const size_t nArrLen = rDoc.GetTxtFmtColls()->size();
for ( sal_uInt16 i = 0; i < nArrLen; i++ ) for ( size_t i = 0; i < nArrLen; ++i )
{ {
SwTxtFmtColl * pColl = (*rDoc.GetTxtFmtColls())[i]; SwTxtFmtColl * pColl = (*rDoc.GetTxtFmtColls())[i];
if ( pColl->IsDefault() ) if ( pColl->IsDefault() )
...@@ -537,8 +537,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc, ...@@ -537,8 +537,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc,
{ {
sal_uInt16 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN; sal_uInt16 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN;
nIndex = nIndex - nBaseCount; nIndex = nIndex - nBaseCount;
const sal_uInt16 nArrLen = rDoc.GetFrmFmts()->size(); const size_t nArrLen = rDoc.GetFrmFmts()->size();
for( sal_uInt16 i = 0; i < nArrLen; i++ ) for( size_t i = 0; i < nArrLen; ++i )
{ {
SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ]; SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
if(pFmt->IsDefault() || pFmt->IsAuto()) if(pFmt->IsDefault() || pFmt->IsAuto())
...@@ -583,7 +583,7 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc, ...@@ -583,7 +583,7 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc,
sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN; sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN;
nIndex = nIndex - nBaseCount; nIndex = nIndex - nBaseCount;
const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl(); const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl();
for(sal_uInt16 i = 0; i < rNumTbl.size(); ++i) for(size_t i = 0; i < rNumTbl.size(); ++i)
{ {
const SwNumRule& rRule = *rNumTbl[ i ]; const SwNumRule& rRule = *rNumTbl[ i ];
if( rRule.IsAutoRule() ) if( rRule.IsAutoRule() )
...@@ -791,7 +791,7 @@ uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::Runt ...@@ -791,7 +791,7 @@ uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::Runt
if(pBasePool) if(pBasePool)
{ {
SfxStyleSheetIteratorPtr pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL); SfxStyleSheetIteratorPtr pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL);
sal_uInt16 nCount = pIterator->Count(); const sal_uInt16 nCount = pIterator->Count();
aRet.realloc(nCount); aRet.realloc(nCount);
OUString* pArray = aRet.getArray(); OUString* pArray = aRet.getArray();
OUString aString; OUString aString;
...@@ -1080,7 +1080,7 @@ SwStyleProperties_Impl::SwStyleProperties_Impl(const SfxItemPropertyMap& rMap) : ...@@ -1080,7 +1080,7 @@ SwStyleProperties_Impl::SwStyleProperties_Impl(const SfxItemPropertyMap& rMap) :
SwStyleProperties_Impl::~SwStyleProperties_Impl() SwStyleProperties_Impl::~SwStyleProperties_Impl()
{ {
for ( sal_uInt16 i =0 ; i < nArrLen; i++ ) for ( sal_uInt32 i =0 ; i < nArrLen; i++ )
delete pAnyArr[i]; delete pAnyArr[i];
delete[] pAnyArr; delete[] pAnyArr;
} }
...@@ -1108,7 +1108,7 @@ bool SwStyleProperties_Impl::SetProperty(const OUString& rName, uno::Any aVal) ...@@ -1108,7 +1108,7 @@ bool SwStyleProperties_Impl::SetProperty(const OUString& rName, uno::Any aVal)
bool SwStyleProperties_Impl::ClearProperty( const OUString& rName ) bool SwStyleProperties_Impl::ClearProperty( const OUString& rName )
{ {
bool bRet = false; bool bRet = false;
sal_uInt16 nPos = 0; sal_uInt32 nPos = 0;
PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
while( aIt != aPropertyEntries.end() ) while( aIt != aPropertyEntries.end() )
{ {
...@@ -1127,7 +1127,7 @@ bool SwStyleProperties_Impl::ClearProperty( const OUString& rName ) ...@@ -1127,7 +1127,7 @@ bool SwStyleProperties_Impl::ClearProperty( const OUString& rName )
void SwStyleProperties_Impl::ClearAllProperties( ) void SwStyleProperties_Impl::ClearAllProperties( )
{ {
for ( sal_uInt16 i = 0; i < nArrLen; i++ ) for ( sal_uInt32 i = 0; i < nArrLen; i++ )
{ {
delete pAnyArr[i]; delete pAnyArr[i];
pAnyArr[ i ] = 0; pAnyArr[ i ] = 0;
...@@ -1137,7 +1137,7 @@ void SwStyleProperties_Impl::ClearAllProperties( ) ...@@ -1137,7 +1137,7 @@ void SwStyleProperties_Impl::ClearAllProperties( )
bool SwStyleProperties_Impl::GetProperty(const OUString& rName, uno::Any*& rpAny ) bool SwStyleProperties_Impl::GetProperty(const OUString& rName, uno::Any*& rpAny )
{ {
bool bRet = false; bool bRet = false;
sal_uInt16 nPos = 0; sal_uInt32 nPos = 0;
PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
while( aIt != aPropertyEntries.end() ) while( aIt != aPropertyEntries.end() )
{ {
...@@ -1613,9 +1613,8 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc() ...@@ -1613,9 +1613,8 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
{ {
if(!pOldPageDesc) if(!pOldPageDesc)
{ {
sal_uInt16 i; const sal_uInt16 nPDescCount = rDoc.GetPageDescCnt();
sal_uInt16 nPDescCount = rDoc.GetPageDescCnt(); for(sal_uInt16 i = 0; i < nPDescCount; ++i)
for(i = 0; i < nPDescCount; i++)
{ {
const SwPageDesc& rDesc = rDoc.GetPageDesc( i ); const SwPageDesc& rDesc = rDoc.GetPageDesc( i );
if(rDesc.GetName() == rStyleName) if(rDesc.GetName() == rStyleName)
...@@ -1626,7 +1625,7 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc() ...@@ -1626,7 +1625,7 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
} }
if(!pOldPageDesc) if(!pOldPageDesc)
{ {
for(i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i) for(sal_uInt16 i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i)
{ {
const OUString aFmtName(SW_RES(i)); const OUString aFmtName(SW_RES(i));
if(aFmtName == rStyleName) if(aFmtName == rStyleName)
...@@ -1841,7 +1840,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, ...@@ -1841,7 +1840,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
SwNumRule aSetRule(*pSwXRules->GetNumRule()); SwNumRule aSetRule(*pSwXRules->GetNumRule());
const SwCharFmts* pFmts = pDoc->GetCharFmts(); const SwCharFmts* pFmts = pDoc->GetCharFmts();
sal_uInt16 nChCount = pFmts->size(); const size_t nChCount = pFmts->size();
for(sal_uInt16 i = 0; i < MAXLEVEL; i++) for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
{ {
...@@ -1855,7 +1854,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, ...@@ -1855,7 +1854,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
{ {
SwCharFmt* pCharFmt = 0; SwCharFmt* pCharFmt = 0;
for(sal_uInt16 j = 0; j< nChCount; j++) for(size_t j = 0; j< nChCount; ++j)
{ {
SwCharFmt* pTmp = (*pFmts)[j]; SwCharFmt* pTmp = (*pFmts)[j];
if(pTmp->GetName() == pCharStyleNames[i]) if(pTmp->GetName() == pCharStyleNames[i])
...@@ -1994,11 +1993,11 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, ...@@ -1994,11 +1993,11 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
OSL_ENSURE(COND_COMMAND_COUNT == 28, OSL_ENSURE(COND_COMMAND_COUNT == 28,
"invalid size of comman count?"); "invalid size of comman count?");
const beans::NamedValue *pSeq = aSeq.getConstArray(); const beans::NamedValue *pSeq = aSeq.getConstArray();
sal_Int32 nLen = aSeq.getLength(); const sal_Int32 nLen = aSeq.getLength();
bool bFailed = false; bool bFailed = false;
SwCondCollItem aCondItem; SwCondCollItem aCondItem;
for(sal_uInt16 i = 0; i < nLen; i++) for(sal_Int32 i = 0; i < nLen; ++i)
{ {
OUString aTmp; OUString aTmp;
if ((pSeq[i].Value >>= aTmp)) if ((pSeq[i].Value >>= aTmp))
...@@ -2218,7 +2217,7 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl( ...@@ -2218,7 +2217,7 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl(
SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName); SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName);
if(pBasePool) if(pBasePool)
{ {
sal_uInt16 nSaveMask = pBasePool->GetSearchMask(); const sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
pBasePool->SetSearchMask(eFamily); pBasePool->SetSearchMask(eFamily);
SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName); SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
pBasePool->SetSearchMask(eFamily, nSaveMask ); pBasePool->SetSearchMask(eFamily, nSaveMask );
...@@ -2456,7 +2455,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, ...@@ -2456,7 +2455,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
} }
case FN_UNO_CATEGORY: case FN_UNO_CATEGORY:
{ {
sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId(); const sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId();
short nRet = -1; short nRet = -1;
switch ( COLL_GET_RANGE_BITS & nPoolId ) switch ( COLL_GET_RANGE_BITS & nPoolId )
...@@ -2636,7 +2635,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( ...@@ -2636,7 +2635,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl(
{ {
if(!pBase) if(!pBase)
{ {
sal_uInt16 nSaveMask = pBasePool->GetSearchMask(); const sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL ); pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
pBase = pBasePool->Find(m_sStyleName); pBase = pBasePool->Find(m_sStyleName);
pBasePool->SetSearchMask(eFamily, nSaveMask ); pBasePool->SetSearchMask(eFamily, nSaveMask );
...@@ -2847,7 +2846,7 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( ...@@ -2847,7 +2846,7 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates(
else if(SFX_STYLE_FAMILY_PAGE == eFamily && else if(SFX_STYLE_FAMILY_PAGE == eFamily &&
(sPropName.startsWith("Header") || sPropName.startsWith("Footer"))) (sPropName.startsWith("Header") || sPropName.startsWith("Footer")))
{ {
sal_uInt16 nResId = lcl_ConvertFNToRES(pEntry->nWID); const sal_uInt16 nResId = lcl_ConvertFNToRES(pEntry->nWID);
bool bFooter = sPropName.startsWith("Footer"); bool bFooter = sPropName.startsWith("Footer");
const SvxSetItem* pSetItem; const SvxSetItem* pSetItem;
if(SFX_ITEM_SET == aSet.GetItemState( if(SFX_ITEM_SET == aSet.GetItemState(
...@@ -3261,7 +3260,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( ...@@ -3261,7 +3260,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName()); SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName());
if(GetBasePool()) if(GetBasePool())
{ {
sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask(); const sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
GetBasePool()->SetSearchMask(GetFamily()); GetBasePool()->SetSearchMask(GetFamily());
SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName()); SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName());
GetBasePool()->SetSearchMask(GetFamily(), nSaveMask ); GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
...@@ -3518,7 +3517,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( ...@@ -3518,7 +3517,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl(
{ {
if(!pBase) if(!pBase)
{ {
sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask(); const sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
GetBasePool()->SetSearchMask(GetFamily(), SFXSTYLEBIT_ALL ); GetBasePool()->SetSearchMask(GetFamily(), SFXSTYLEBIT_ALL );
pBase = GetBasePool()->Find(GetStyleName()); pBase = GetBasePool()->Find(GetStyleName());
GetBasePool()->SetSearchMask(GetFamily(), nSaveMask ); GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
...@@ -4110,7 +4109,7 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( ) ...@@ -4110,7 +4109,7 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( )
static uno::Reference< beans::XPropertySetInfo > xRubyRef; static uno::Reference< beans::XPropertySetInfo > xRubyRef;
if(!xRubyRef.is()) if(!xRubyRef.is())
{ {
sal_uInt16 nMapId = PROPERTY_MAP_RUBY_AUTO_STYLE; const sal_uInt16 nMapId = PROPERTY_MAP_RUBY_AUTO_STYLE;
xRubyRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo(); xRubyRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo();
} }
xRet = xRubyRef; xRet = xRubyRef;
...@@ -4121,7 +4120,7 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( ) ...@@ -4121,7 +4120,7 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( )
static uno::Reference< beans::XPropertySetInfo > xParaRef; static uno::Reference< beans::XPropertySetInfo > xParaRef;
if(!xParaRef.is()) if(!xParaRef.is())
{ {
sal_uInt16 nMapId = PROPERTY_MAP_PARA_AUTO_STYLE; const sal_uInt16 nMapId = PROPERTY_MAP_PARA_AUTO_STYLE;
xParaRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo(); xParaRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo();
} }
xRet = xParaRef; xRet = xParaRef;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment