[Libreoffice-commits] core.git: 13 commits - include/sfx2 include/svl include/svtools include/svx include/vcl sc/inc sc/source sd/source svx/source sw/inc sw/source
Matteo Casalin
matteo.casalin at yahoo.com
Sat May 24 13:09:41 PDT 2014
include/sfx2/frame.hxx | 1
include/svl/brdcst.hxx | 2
include/svl/ctloptions.hxx | 2
include/svl/languageoptions.hxx | 2
include/svtools/accessibilityoptions.hxx | 1
include/svtools/colorcfg.hxx | 2
include/svx/svdviter.hxx | 2
include/vcl/textdata.hxx | 1
sc/inc/textuno.hxx | 1
sc/source/ui/inc/AccessibleText.hxx | 1
sd/source/core/stlpool.cxx | 13 +--
sd/source/core/stlsheet.cxx | 25 ++----
svx/source/svdraw/svdmark.cxx | 4 -
svx/source/svdraw/svdviter.cxx | 4 -
sw/inc/postithelper.hxx | 2
sw/source/core/unocore/unosect.cxx | 108 +++++++++++------------------
sw/source/core/unocore/unosett.cxx | 112 ++++++++++++++++--------------
sw/source/core/unocore/unosrch.cxx | 13 +--
sw/source/core/unocore/unostyle.cxx | 114 ++++++++++++++-----------------
19 files changed, 188 insertions(+), 222 deletions(-)
New commits:
commit 5ea67ff9ca1a522a6b72ac51cae5b5a6165d5c81
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat May 24 22:07:09 2014 +0200
Fix loop test and evaluate token count just once
Change-Id: I354cbb729eed9b78c4af3d684513c3338be4f532
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 48a6685..f371092 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -710,7 +710,8 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
pSectionData->SetType(FILE_LINK_SECTION);
}
OUString sSectLink(pSectionData->GetLinkFileName());
- while (3 < comphelper::string::getTokenCount(sSectLink, sfx2::cTokenSeparator))
+ for (sal_Int32 i = comphelper::string::getTokenCount(sSectLink, sfx2::cTokenSeparator);
+ i < 3; ++i)
{
sSectLink += OUString(sfx2::cTokenSeparator);
}
commit 6055922e82885b424ac9dcd158092df0ba4b5bd1
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat May 24 11:31:32 2014 +0200
OUString: constify, avoid temporaries and buffers
Change-Id: I0bbfbb7785b4b8553d7472da15726538040af22e
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 8871567..48a6685 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -138,8 +138,7 @@ public:
SwSectionFmt & GetSectionFmtOrThrow() const {
SwSectionFmt *const pFmt( GetSectionFmt() );
if (!pFmt) {
- throw uno::RuntimeException(OUString(
- "SwXTextSection: disposed or invalid"), 0);
+ throw uno::RuntimeException("SwXTextSection: disposed or invalid", 0);
}
return *pFmt;
}
@@ -334,12 +333,11 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
SwSectionData aSect(eType, pDoc->GetUniqueSectionName(&m_pImpl->m_sName));
aSect.SetCondition(m_pImpl->m_pProps->m_sCondition);
- OUStringBuffer sLinkNameBuf(m_pImpl->m_pProps->m_sLinkFileName);
- sLinkNameBuf.append(sfx2::cTokenSeparator);
- sLinkNameBuf.append(m_pImpl->m_pProps->m_sSectionFilter);
- sLinkNameBuf.append(sfx2::cTokenSeparator);
- sLinkNameBuf.append(m_pImpl->m_pProps->m_sSectionRegion);
- aSect.SetLinkFileName(sLinkNameBuf.makeStringAndClear());
+ aSect.SetLinkFileName(m_pImpl->m_pProps->m_sLinkFileName +
+ OUString(sfx2::cTokenSeparator) +
+ m_pImpl->m_pProps->m_sSectionFilter +
+ OUString(sfx2::cTokenSeparator) +
+ m_pImpl->m_pProps->m_sSectionRegion);
aSect.SetHidden(m_pImpl->m_pProps->m_bHidden);
aSect.SetProtectFlag(m_pImpl->m_pProps->m_bProtect);
@@ -582,15 +580,13 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
if (!pEntry)
{
throw beans::UnknownPropertyException(
- OUString("Unknown property: ")
- + pPropertyNames[nProperty],
+ "Unknown property: " + pPropertyNames[nProperty],
static_cast<cppu::OWeakObject *>(& m_rThis));
}
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
throw beans::PropertyVetoException(
- OUString("Property is read-only: ")
- + pPropertyNames[nProperty],
+ "Property is read-only: " + pPropertyNames[nProperty],
static_cast<cppu::OWeakObject *>(& m_rThis));
}
switch (pEntry->nWID)
@@ -619,16 +615,13 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
{
if (!m_pProps->m_bDDE)
{
- OUStringBuffer buf;
- buf.append(sfx2::cTokenSeparator);
- buf.append(sfx2::cTokenSeparator);
- m_pProps->m_sLinkFileName = buf.makeStringAndClear();
+ m_pProps->m_sLinkFileName =
+ OUString(sfx2::cTokenSeparator) + OUString(sfx2::cTokenSeparator);
m_pProps->m_bDDE = true;
}
- OUString sLinkFileName(m_pProps->m_sLinkFileName);
- sLinkFileName = comphelper::string::setToken(sLinkFileName,
+ m_pProps->m_sLinkFileName = comphelper::string::setToken(
+ m_pProps->m_sLinkFileName,
pEntry->nWID - WID_SECT_DDE_TYPE, sfx2::cTokenSeparator, sTmp);
- m_pProps->m_sLinkFileName = sLinkFileName;
}
else
{
@@ -683,22 +676,15 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
{
pSectionData->SetType(FILE_LINK_SECTION);
}
- OUStringBuffer sFileNameBuf;
- if (!aLink.FileURL.isEmpty())
- {
- sFileNameBuf.append( URIHelper::SmartRel2Abs(
- pFmt->GetDoc()->GetDocShell()->GetMedium()
- ->GetURLObject(),
- aLink.FileURL, URIHelper::GetMaybeFileHdl()));
- }
- sFileNameBuf.append(sfx2::cTokenSeparator);
- sFileNameBuf.append(aLink.FilterName);
- sFileNameBuf.append(sfx2::cTokenSeparator);
- sFileNameBuf.append(
- pSectionData->GetLinkFileName().getToken(2,
- sfx2::cTokenSeparator));
+ const OUString sTmp(!aLink.FileURL.isEmpty()
+ ? URIHelper::SmartRel2Abs(
+ pFmt->GetDoc()->GetDocShell()->GetMedium()->GetURLObject(),
+ aLink.FileURL, URIHelper::GetMaybeFileHdl())
+ : OUString());
const OUString sFileName(
- sFileNameBuf.makeStringAndClear());
+ sTmp + OUString(sfx2::cTokenSeparator) +
+ aLink.FilterName + OUString(sfx2::cTokenSeparator) +
+ pSectionData->GetLinkFileName().getToken(2, sfx2::cTokenSeparator));
pSectionData->SetLinkFileName(sFileName);
if (sFileName.getLength() < 3)
{
@@ -984,17 +970,16 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
if (!pEntry)
{
throw beans::UnknownPropertyException(
- OUString("Unknown property: ")
- + pPropertyNames[nProperty],
+ "Unknown property: " + pPropertyNames[nProperty],
static_cast<cppu::OWeakObject *>(& m_rThis));
}
switch(pEntry->nWID)
{
case WID_SECT_CONDITION:
{
- OUString uTmp( (m_bIsDescriptor)
+ const OUString uTmp( (m_bIsDescriptor)
? m_pProps->m_sCondition
- : OUString(pSect->GetCondition()));
+ : pSect->GetCondition());
pRet[nProperty] <<= uTmp;
}
break;
@@ -1014,10 +999,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
{
sRet = pSect->GetLinkFileName();
}
- sal_Int32 nDummy(0);
- sRet = sRet.getToken(pEntry->nWID - WID_SECT_DDE_TYPE,
- sfx2::cTokenSeparator, nDummy);
- pRet[nProperty] <<= sRet;
+ pRet[nProperty] <<= sRet.getToken(pEntry->nWID - WID_SECT_DDE_TYPE,
+ sfx2::cTokenSeparator);
}
break;
case WID_SECT_DDE_AUTOUPDATE:
@@ -1044,7 +1027,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
}
else if (FILE_LINK_SECTION == pSect->GetType())
{
- OUString sRet( pSect->GetLinkFileName() );
+ const OUString sRet( pSect->GetLinkFileName() );
sal_Int32 nIndex(0);
aLink.FileURL =
sRet.getToken(0, sfx2::cTokenSeparator, nIndex);
@@ -1101,8 +1084,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
{
if (pFmt)
{
- pRet[nProperty] <<=
- OUString(pFmt->GetSection()->GetSectionName());
+ pRet[nProperty] <<= pFmt->GetSection()->GetSectionName();
}
}
break;
@@ -1408,8 +1390,8 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
if (!pEntry)
{
throw beans::UnknownPropertyException(
- OUString("Unknown property: ")
- + pNames[i], static_cast< cppu::OWeakObject* >(this));
+ "Unknown property: " + pNames[i],
+ static_cast< cppu::OWeakObject* >(this));
}
switch (pEntry->nWID)
{
@@ -1484,14 +1466,13 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
if (!pEntry)
{
throw beans::UnknownPropertyException(
- OUString("Unknown property: ")
- + rPropertyName, static_cast< cppu::OWeakObject* >(this));
+ "Unknown property: " + rPropertyName,
+ static_cast< cppu::OWeakObject* >(this));
}
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
- throw uno::RuntimeException(OUString(
- "setPropertyToDefault: property is read-only: ")
- + rPropertyName,
+ throw uno::RuntimeException(
+ "Property is read-only: " + rPropertyName,
static_cast<cppu::OWeakObject *>(this));
}
@@ -1627,8 +1608,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
if (!pEntry)
{
throw beans::UnknownPropertyException(
- OUString("Unknown property: ")
- + rPropertyName,
+ "Unknown property: " + rPropertyName,
static_cast<cppu::OWeakObject *>(this));
}
@@ -1707,8 +1687,7 @@ throw (uno::RuntimeException, std::exception)
{
SwSection *const pSect = pFmt->GetSection();
SwSectionData aSection(*pSect);
- OUString sNewName(rName);
- aSection.SetSectionName(sNewName);
+ aSection.SetSectionName(rName);
const SwSectionFmts& rFmts = pFmt->GetDoc()->GetSections();
sal_uInt16 nApplyPos = USHRT_MAX;
@@ -1718,7 +1697,7 @@ throw (uno::RuntimeException, std::exception)
{
nApplyPos = i;
}
- else if (sNewName == rFmts[i]->GetSection()->GetSectionName())
+ else if (rName == rFmts[i]->GetSection()->GetSectionName())
{
throw uno::RuntimeException();
}
commit 5490dea958b656cc3f837238fd9b27eef13a0c3a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat May 24 00:26:34 2014 +0200
sal_uInt16 to size_t
Change-Id: Ia2e6b067884bcbab680925b8613dd5a73d1fc3fb
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 4d403a7..8871567 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -250,7 +250,7 @@ SwXTextSection::getChildSections() throw (uno::RuntimeException, std::exception)
rSectionFmt.GetChildSections(aChildren, SORTSECT_NOT, false);
uno::Sequence<uno::Reference<text::XTextSection> > aSeq(aChildren.size());
uno::Reference< text::XTextSection > * pArray = aSeq.getArray();
- for (sal_uInt16 i = 0; i < aChildren.size(); i++)
+ for (size_t i = 0; i < aChildren.size(); ++i)
{
SwSectionFmt *const pChild = aChildren[i]->GetFmt();
pArray[i] = CreateXTextSection(pChild);
@@ -318,9 +318,9 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
GetChildSections(aSectionsArr);
// and search for current header section
- const sal_uInt16 nCount = aSectionsArr.size();
+ const size_t nCount = aSectionsArr.size();
bool bHeaderPresent = false;
- for(sal_uInt16 i = 0; i < nCount; i++)
+ for(size_t i = 0; i < nCount; ++i)
{
if (aSectionsArr[i]->GetType() == TOX_HEADER_SECTION)
bHeaderPresent = true;
@@ -520,7 +520,7 @@ lcl_UpdateSection(SwSectionFmt *const pFmt,
SwDoc *const pDoc = pFmt->GetDoc();
SwSectionFmts const& rFmts = pDoc->GetSections();
UnoActionContext aContext(pDoc);
- for (sal_uInt16 i = 0; i < rFmts.size(); i++)
+ for (size_t i = 0; i < rFmts.size(); ++i)
{
if (rFmts[i]->GetSection()->GetSectionName()
== rSection.GetSectionName())
@@ -1152,7 +1152,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
}
const SwRedlineTbl& rRedTbl =
pFmt->GetDoc()->GetRedlineTbl();
- for (sal_uInt16 nRed = 0; nRed < rRedTbl.size(); nRed++)
+ for (size_t nRed = 0; nRed < rRedTbl.size(); ++nRed)
{
const SwRangeRedline* pRedline = rRedTbl[nRed];
SwNode const*const pRedPointNode = pRedline->GetNode(true);
@@ -1712,7 +1712,7 @@ throw (uno::RuntimeException, std::exception)
const SwSectionFmts& rFmts = pFmt->GetDoc()->GetSections();
sal_uInt16 nApplyPos = USHRT_MAX;
- for( sal_uInt16 i = 0; i < rFmts.size(); i++ )
+ for( size_t i = 0; i < rFmts.size(); ++i )
{
if(rFmts[i]->GetSection() == pSect)
{
commit 554d7bf0d1fe6a0019074a4f68c3205449bf9b7f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Fri May 23 23:36:07 2014 +0200
OUString: constify and avoid temporaries
Change-Id: I20f049ba275225b6429b630dbff07d0eba5522a3
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index e249db8..29d50f9 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -453,12 +453,12 @@ uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName)
{
case WID_PREFIX:
{
- aRet <<= OUString(rFtnInfo.GetPrefix());
+ aRet <<= rFtnInfo.GetPrefix();
}
break;
case WID_SUFFIX:
{
- aRet <<= OUString(rFtnInfo.GetSuffix());
+ aRet <<= rFtnInfo.GetSuffix();
}
break;
case WID_NUMBERING_TYPE :
@@ -544,10 +544,10 @@ uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName)
}
break;
case WID_END_NOTICE :
- aRet <<= OUString(rFtnInfo.aQuoVadis);
+ aRet <<= rFtnInfo.aQuoVadis;
break;
case WID_BEGIN_NOTICE :
- aRet <<= OUString(rFtnInfo.aErgoSum);
+ aRet <<= rFtnInfo.aErgoSum;
break;
}
}
@@ -1575,7 +1575,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
static PropValData* lcl_FindProperty(const char* cName, PropValDataArr& rPropertyValues)
{
- OUString sCmp = OUString::createFromAscii(cName);
+ const OUString sCmp = OUString::createFromAscii(cName);
for(size_t i = 0; i < rPropertyValues.size(); ++i)
{
PropValData* pTemp = rPropertyValues[i];
@@ -1959,7 +1959,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
{
aFmt.SetBulletChar(aChar.toChar());
}
- else if(aChar.getLength() == 0)
+ else if(aChar.isEmpty())
{
// If w:lvlText's value is null - set bullet char to zero
aFmt.SetBulletChar(sal_Unicode(0x0));
@@ -2224,7 +2224,7 @@ Any SwXNumberingRules::getPropertyValue( const OUString& rPropertyName )
aRet.setValue(&bVal, ::getBooleanCppuType());
}
else if(rPropertyName == UNO_NAME_NAME)
- aRet <<= OUString(pRule->GetName());
+ aRet <<= pRule->GetName();
else if(rPropertyName == UNO_NAME_IS_ABSOLUTE_MARGINS)
{
sal_Bool bVal = pRule->IsAbsSpaces();
@@ -2272,15 +2272,16 @@ void SwXNumberingRules::removeVetoableChangeListener(
OUString SwXNumberingRules::getName() throw( RuntimeException, std::exception )
{
- OUString aString;
if(pNumRule)
{
+ OUString aString;
SwStyleNameMapper::FillProgName(pNumRule->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, true );
return aString;
}
// consider chapter numbering <SwXNumberingRules>
if ( pDocShell )
{
+ OUString aString;
SwStyleNameMapper::FillProgName( pDocShell->GetDoc()->GetOutlineNumRule()->GetName(),
aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, true );
return aString;
commit a2724474fb5b3a4918074c30640c3353354d012f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Fri May 23 22:54:59 2014 +0200
Use more proper integer types, constify, avoid unneeded conversions
Change-Id: Iaa20e4ecfa0120a443c7079aa6738b8b48c572b1
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 958f510..e249db8 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -210,7 +210,7 @@ static SwCharFmt* lcl_getCharFmt(SwDoc* pDoc, const uno::Any& aValue)
}
if(!pRet)
{
- sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
if(USHRT_MAX != nId)
pRet = pDoc->GetCharFmtFromPool( nId );
}
@@ -226,7 +226,7 @@ static SwTxtFmtColl* lcl_GetParaStyle(SwDoc* pDoc, const uno::Any& aValue)
SwTxtFmtColl* pRet = pDoc->FindTxtFmtCollByName( sParaStyle );
if( !pRet )
{
- sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
if( USHRT_MAX != nId )
pRet = pDoc->GetTxtCollFromPool( nId );
}
@@ -236,7 +236,7 @@ static SwTxtFmtColl* lcl_GetParaStyle(SwDoc* pDoc, const uno::Any& aValue)
static SwPageDesc* lcl_GetPageDesc(SwDoc* pDoc, const uno::Any& aValue)
{
SwPageDesc* pRet = 0;
- sal_uInt16 nCount = pDoc->GetPageDescCnt();
+ const sal_uInt16 nCount = pDoc->GetPageDescCnt();
OUString uTmp;
aValue >>= uTmp;
OUString sPageDesc;
@@ -252,7 +252,7 @@ static SwPageDesc* lcl_GetPageDesc(SwDoc* pDoc, const uno::Any& aValue)
}
if(!pRet)
{
- sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
+ const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
if(USHRT_MAX != nId)
pRet = pDoc->GetPageDescFromPool( nId );
}
@@ -1146,11 +1146,9 @@ SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc) :
m_pPropertySet(GetNumberingRulesSet()),
bOwnNumRuleCreated(true)
{
- sal_uInt16 i;
-
// first organize the document - it is dependent on the set character formats
// if no format is set, it should work as well
- for( i = 0; i < MAXLEVEL; i++)
+ for( sal_uInt16 i = 0; i < MAXLEVEL; ++i)
{
SwNumFmt rFmt(pNumRule->Get(i));
SwCharFmt* pCharFmt = rFmt.GetCharFmt();
@@ -1162,7 +1160,7 @@ SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc) :
}
if(pDoc)
pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
- for(i = 0; i < MAXLEVEL; i++)
+ for(sal_uInt16 i = 0; i < MAXLEVEL; ++i)
{
m_sNewCharStyleNames[i] = aInvalidStyle;
m_sNewBulletFontNames[i] = aInvalidStyle;
@@ -1189,7 +1187,7 @@ SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) :
rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
m_sCreatedNumRuleName = rDoc.GetUniqueNumRuleName();
#if OSL_DEBUG_LEVEL > 1
- sal_uInt16 nIndex =
+ const sal_uInt16 nIndex =
#endif
rDoc.MakeNumRule( m_sCreatedNumRuleName, 0, false,
// #i89178#
@@ -1232,7 +1230,7 @@ void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElemen
rProperties, nIndex);
// set character format if needed
const SwCharFmts* pFmts = pDocShell->GetDoc()->GetCharFmts();
- sal_uInt16 nChCount = pFmts->size();
+ const size_t nChCount = pFmts->size();
for(sal_uInt16 i = 0; i < MAXLEVEL;i++)
{
SwNumFmt aFmt(aNumRule.Get( i ));
@@ -1241,7 +1239,7 @@ void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElemen
(!aFmt.GetCharFmt() || aFmt.GetCharFmt()->GetName()!= m_sNewCharStyleNames[i]))
{
SwCharFmt* pCharFmt = 0;
- for(sal_uInt16 j = 0; j< nChCount; j++)
+ for(size_t j = 0; j< nChCount; ++j)
{
SwCharFmt* pTmp = (*pFmts)[j];
if(pTmp->GetName() == m_sNewCharStyleNames[i])
@@ -1339,7 +1337,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
//adjust
SvxAdjust eAdj = rFmt.GetNumAdjust();
- sal_Int16 nINT16 = aSvxToUnoAdjust[(sal_uInt16)eAdj];
+ sal_Int16 nINT16 = aSvxToUnoAdjust[eAdj];
PropValData* pData = new PropValData((void*)&nINT16, "Adjust", ::cppu::UnoType<sal_Int16>::get() );
aPropertyValues.push_back(pData);
@@ -1364,10 +1362,10 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
if(pCharFmt)
CharStyleName = pCharFmt->GetName();
//egal ob ein Style vorhanden ist oder nicht ueberschreibt der Array-Eintrag diesen String
- if (!m_sNewCharStyleNames[(sal_uInt16)nIndex].isEmpty() &&
- !SwXNumberingRules::isInvalidStyle(m_sNewCharStyleNames[(sal_uInt16)nIndex]))
+ if (!m_sNewCharStyleNames[nIndex].isEmpty() &&
+ !SwXNumberingRules::isInvalidStyle(m_sNewCharStyleNames[nIndex]))
{
- CharStyleName = m_sNewCharStyleNames[(sal_uInt16)nIndex];
+ CharStyleName = m_sNewCharStyleNames[nIndex];
}
aUString = OUString();
@@ -1530,8 +1528,8 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
// template name
OUString sValue(SW_RES(STR_POOLCOLL_HEADLINE1 + nIndex));
const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
- const sal_uInt16 nCount = pColls->size();
- for(sal_uInt16 i = 0; i < nCount;++i)
+ const size_t nCount = pColls->size();
+ for(size_t i = 0; i < nCount; ++i)
{
SwTxtFmtColl &rTxtColl = *pColls->operator[](i);
if(rTxtColl.IsDefault())
@@ -1562,7 +1560,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
uno::Sequence<beans::PropertyValue> aSeq(aPropertyValues.size());
beans::PropertyValue* pArray = aSeq.getArray();
- for(sal_uInt16 i = 0; i < aPropertyValues.size(); i++)
+ for(size_t i = 0; i < aPropertyValues.size(); ++i)
{
pData = aPropertyValues[i];
pArray[i].Value = pData->aVal;
@@ -1578,7 +1576,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
static PropValData* lcl_FindProperty(const char* cName, PropValDataArr& rPropertyValues)
{
OUString sCmp = OUString::createFromAscii(cName);
- for(sal_uInt16 i = 0; i < rPropertyValues.size(); i++)
+ for(size_t i = 0; i < rPropertyValues.size(); ++i)
{
PropValData* pTemp = rPropertyValues[i];
if(sCmp == pTemp->sPropName)
@@ -1629,23 +1627,30 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
"BulletRelSize", // 25
"BulletColor" // 26
};
- const sal_uInt16 NotInChapterFirst = 16;
- const sal_uInt16 NotInChapterLast = 23;
- const sal_uInt16 InChapterFirst = 24;
- const sal_uInt16 InChapterLast = 24;
+
+ enum {
+ NotInChapterFirst = 16,
+ NotInChapterLast = 23,
+ InChapterFirst = 24,
+ InChapterLast = 24
+ };
const beans::PropertyValue* pPropArray = rProperties.getConstArray();
PropValDataArr aPropertyValues;
bool bExcept = false;
- for(int i = 0; i < rProperties.getLength() && !bExcept; i++)
+ for(sal_Int32 i = 0; i < rProperties.getLength() && !bExcept; i++)
{
const beans::PropertyValue& rProp = pPropArray[i];
bExcept = true;
- for(sal_uInt16 j = 0; j < SAL_N_ELEMENTS( aNumPropertyNames ); j++)
+ for(size_t j = 0; j < SAL_N_ELEMENTS( aNumPropertyNames ); j++)
{
- if (pDocShell && j >= NotInChapterFirst && j <= NotInChapterLast)
+ if (pDocShell &&
+ j >= static_cast<size_t>(NotInChapterFirst) &&
+ j <= static_cast<size_t>(NotInChapterLast))
continue;
- if (!pDocShell && j >= InChapterFirst && j <= InChapterLast)
+ if (!pDocShell &&
+ j >= static_cast<size_t>(InChapterFirst) &&
+ j <= static_cast<size_t>(InChapterLast))
continue;
if (rProp.Name.equalsAscii(aNumPropertyNames[j]))
{
@@ -1667,7 +1672,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
SwFmtVertOrient* pSetVOrient = 0;
bool bCharStyleNameSet = false;
- for(sal_uInt16 i = 0; i < SAL_N_ELEMENTS( aNumPropertyNames ) && !bExcept && !bWrongArg; i++)
+ for(size_t i = 0; i < SAL_N_ELEMENTS( aNumPropertyNames ) && !bExcept && !bWrongArg; ++i)
{
PropValData* pData = lcl_FindProperty(aNumPropertyNames[i], aPropertyValues);
if(!pData)
@@ -1719,19 +1724,19 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
SwStyleNameMapper::FillUIName( uTmp, sCharFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true );
if (sCharFmtName == UNO_NAME_CHARACTER_FORMAT_NONE)
{
- m_sNewCharStyleNames[(sal_uInt16)nIndex] = aInvalidStyle;
+ m_sNewCharStyleNames[nIndex] = aInvalidStyle;
aFmt.SetCharFmt(0);
}
else if(pDocShell || pDoc)
{
SwDoc* pLocalDoc = pDoc ? pDoc : pDocShell->GetDoc();
const SwCharFmts* pFmts = pLocalDoc->GetCharFmts();
- sal_uInt16 nChCount = pFmts->size();
+ const size_t nChCount = pFmts->size();
SwCharFmt* pCharFmt = 0;
if (!sCharFmtName.isEmpty())
{
- for(sal_uInt16 j = 0; j< nChCount; j++)
+ for(size_t j = 0; j< nChCount; ++j)
{
SwCharFmt* pTmp = (*pFmts)[j];
if(pTmp->GetName() == sCharFmtName)
@@ -1755,10 +1760,10 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
// #i51842#
// If the character format has been found its name should not be in the
// char style names array
- m_sNewCharStyleNames[(sal_uInt16)nIndex] = OUString();
+ m_sNewCharStyleNames[nIndex] = OUString();
}
else
- m_sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName;
+ m_sNewCharStyleNames[nIndex] = sCharFmtName;
}
break;
case 5: //"StartWith",
@@ -1773,7 +1778,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
sal_Int32 nValue = 0;
pData->aVal >>= nValue;
// #i23727# nValue can be negative
- aFmt.SetAbsLSpace((sal_uInt16) convertMm100ToTwip(nValue));
+ aFmt.SetAbsLSpace((short) convertMm100ToTwip(nValue));
}
break;
case 7: //UNO_NAME_SYMBOL_TEXT_DISTANCE,
@@ -1781,7 +1786,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
sal_Int32 nValue = 0;
pData->aVal >>= nValue;
if(nValue >= 0)
- aFmt.SetCharTextDistance((sal_uInt16) convertMm100ToTwip(nValue));
+ aFmt.SetCharTextDistance((short) convertMm100ToTwip(nValue));
else
bWrongArg = true;
}
@@ -1885,8 +1890,8 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
OUString sStyleName;
SwStyleNameMapper::FillUIName(uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true );
const SwTxtFmtColls* pColls = pDoc->GetTxtFmtColls();
- const sal_uInt16 nCount = pColls->size();
- for(sal_uInt16 k = 0; k < nCount; ++k)
+ const size_t nCount = pColls->size();
+ for(size_t k = 0; k < nCount; ++k)
{
SwTxtFmtColl &rTxtColl = *((*pColls)[k]);
if ( rTxtColl.GetName() == sStyleName )
@@ -1942,7 +1947,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
aFmt.SetBulletFont(&aFont);
}
else
- m_sNewBulletFontNames[(sal_uInt16)nIndex] = sBulletFontName;
+ m_sNewBulletFontNames[nIndex] = sBulletFontName;
}
break;
case 19: //"BulletChar",
@@ -2046,8 +2051,8 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
OUString sStyleName;
SwStyleNameMapper::FillUIName(uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true );
const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
- const sal_uInt16 nCount = pColls->size();
- for(sal_uInt16 k = 0; k < nCount; ++k)
+ const size_t nCount = pColls->size();
+ for(size_t k = 0; k < nCount; ++k)
{
SwTxtFmtColl &rTxtColl = *((*pColls)[k]);
if(rTxtColl.IsDefault())
@@ -2096,13 +2101,13 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
aFmt.SetGraphicBrush( pSetBrush, pSetSize, text::VertOrientation::NONE == eOrient ? 0 : &eOrient );
}
}
- if((!bCharStyleNameSet || m_sNewCharStyleNames[(sal_uInt16)nIndex].isEmpty()) &&
+ if((!bCharStyleNameSet || m_sNewCharStyleNames[nIndex].isEmpty()) &&
aFmt.GetNumberingType() == NumberingType::BITMAP && !aFmt.GetCharFmt()
- && !SwXNumberingRules::isInvalidStyle(m_sNewCharStyleNames[(sal_uInt16)nIndex]))
+ && !SwXNumberingRules::isInvalidStyle(m_sNewCharStyleNames[nIndex]))
{
OUString tmp;
SwStyleNameMapper::FillProgName(RES_POOLCHR_BUL_LEVEL, tmp);
- m_sNewCharStyleNames[static_cast<sal_uInt16>(nIndex)] = tmp;
+ m_sNewCharStyleNames[nIndex] = tmp;
}
delete pSetBrush;
delete pSetSize;
@@ -2370,7 +2375,7 @@ SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) :
bIsAutomaticWidth(rFmtCol.IsOrtho()),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS))
{
- sal_uInt16 nItemGutterWidth = rFmtCol.GetGutterWidth();
+ const sal_uInt16 nItemGutterWidth = rFmtCol.GetGutterWidth();
nAutoDistance = bIsAutomaticWidth ?
USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : (sal_Int32)nItemGutterWidth
: 0;
@@ -2378,7 +2383,7 @@ SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) :
TextColumn* pColumns = aTextColumns.getArray();
const SwColumns& rCols = rFmtCol.GetColumns();
- for(sal_uInt16 i = 0; i < aTextColumns.getLength(); i++)
+ for(sal_Int32 i = 0; i < aTextColumns.getLength(); ++i)
{
const SwColumn* pCol = &rCols[i];
commit 73339dc7d55daace15337f9999dc788739b51961
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Wed May 21 22:14:02 2014 +0200
Avoid temporary OUStrings
Change-Id: I8792fce9571ac749cec93a615d6c65bf2e086aea
diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx
index c85b2dd..1c6dbf4 100644
--- a/sw/source/core/unocore/unosrch.cxx
+++ b/sw/source/core/unocore/unosrch.cxx
@@ -581,7 +581,7 @@ void SwXTextSearch::setPropertyValue(const OUString& rPropertyName, const uno::A
};
}
else
- throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
}
uno::Any SwXTextSearch::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
@@ -617,7 +617,7 @@ SET_UINT16:
};
}
else
- throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
return aRet;
}
commit ae8485045ff19444b67cd259efebe64718777bf7
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Wed May 21 22:05:20 2014 +0200
sal_uInt16 to sal_uInt32 + some const
Change-Id: I12b04ab7ce15a9a30db6e4dafd64a31f4fca8a88
diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx
index d466f4a..c85b2dd 100644
--- a/sw/source/core/unocore/unosrch.cxx
+++ b/sw/source/core/unocore/unosrch.cxx
@@ -74,19 +74,18 @@ void SwSearchProperties_Impl::SetProperties(const uno::Sequence< beans::Prope
throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException )
{
const beans::PropertyValue* pProps = aSearchAttribs.getConstArray();
- sal_uInt32 i;
//delete all existing values
- for( i = 0; i < nArrLen; i++)
+ for(sal_uInt32 i = 0; i < nArrLen; ++i)
{
delete pValueArr[i];
pValueArr[i] = 0;
}
- sal_uInt32 nLen = aSearchAttribs.getLength();
- for(i = 0; i < nLen; i++)
+ const sal_uInt32 nLen = aSearchAttribs.getLength();
+ for(sal_uInt32 i = 0; i < nLen; ++i)
{
- sal_uInt16 nIndex = 0;
+ sal_uInt32 nIndex = 0;
PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
while(pProps[i].Name != aIt->sName)
{
commit e775953f9b4569d8ec589cbe1403898db7f54497
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Wed May 21 21:27:42 2014 +0200
OUString: avoid temporaries + equalsAscii to ==
Change-Id: I9d6eda7f9b047b3d96c80c8dfc8c51b54ee04405
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index ed79f3d..bf2230f 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -242,15 +242,15 @@ uno::Any SAL_CALL SwXStyleFamilies::getByName(const OUString& Name)
uno::Any aRet;
if(!IsValid())
throw uno::RuntimeException();
- if(Name.equalsAscii("CharacterStyles") )
+ if(Name=="CharacterStyles" )
aRet = getByIndex(0);
- else if(Name.equalsAscii("ParagraphStyles") )
+ else if(Name=="ParagraphStyles" )
aRet = getByIndex(1);
- else if(Name.equalsAscii("FrameStyles") )
+ else if(Name=="FrameStyles" )
aRet = getByIndex(3);
- else if(Name.equalsAscii("PageStyles") )
+ else if(Name=="PageStyles" )
aRet = getByIndex(2);
- else if(Name.equalsAscii("NumberingStyles") )
+ else if(Name=="NumberingStyles" )
aRet = getByIndex(4);
else
throw container::NoSuchElementException();
@@ -271,11 +271,11 @@ uno::Sequence< OUString > SwXStyleFamilies::getElementNames(void) throw( uno::Ru
sal_Bool SwXStyleFamilies::hasByName(const OUString& Name) throw( uno::RuntimeException, std::exception )
{
- if( Name.equalsAscii("CharacterStyles") ||
- Name.equalsAscii("ParagraphStyles") ||
- Name.equalsAscii("FrameStyles") ||
- Name.equalsAscii("PageStyles") ||
- Name.equalsAscii("NumberingStyles") )
+ if( Name=="CharacterStyles" ||
+ Name=="ParagraphStyles" ||
+ Name=="FrameStyles" ||
+ Name=="PageStyles" ||
+ Name=="NumberingStyles" )
return sal_True;
else
return sal_False;
@@ -995,7 +995,7 @@ uno::Any SAL_CALL SwXStyleFamily::getPropertyValue( const OUString& sPropertyNam
}
else
{
- throw beans::UnknownPropertyException( OUString("unknown property: ") + sPropertyName, static_cast<OWeakObject *>(this) );
+ throw beans::UnknownPropertyException( "unknown property: " + sPropertyName, static_cast<OWeakObject *>(this) );
}
return aRet;
@@ -1627,8 +1627,7 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
{
for(sal_uInt16 i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i)
{
- const OUString aFmtName(SW_RES(i));
- if(aFmtName == rStyleName)
+ if(SW_RESSTR(i) == rStyleName)
{
pOldPageDesc = rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) );
break;
@@ -2177,8 +2176,8 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
{
OUString sNewNumberingRuleName;
aValue >>= sNewNumberingRuleName;
- OUString sTmp( sNewNumberingRuleName );
- if ( sNewNumberingRuleName.getLength() == 0 || sTmp != pDoc->GetOutlineNumRule()->GetName() )
+ if ( sNewNumberingRuleName.isEmpty() ||
+ sNewNumberingRuleName != pDoc->GetOutlineNumRule()->GetName() )
{
rBase.mxNewBase->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();
}
@@ -2234,7 +2233,7 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl(
if(!pEntry ||
(!bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS))
- throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
if(aBaseImpl.mxNewBase.is())
@@ -2415,8 +2414,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
}
case FN_UNO_DISPLAY_NAME:
{
- OUString sName(rBase.mxNewBase->GetDisplayName());
- aRet <<= sName;
+ aRet <<= rBase.mxNewBase->GetDisplayName();
bDone = true;
break;
@@ -2630,7 +2628,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl(
const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp]);
if(!pEntry ||
(!bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS))
- throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
if(pBasePool)
{
if(!pBase)
@@ -2957,7 +2955,7 @@ void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >&
{
const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] );
if( !pEntry )
- throw beans::UnknownPropertyException ( OUString( "Property is unknown: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException ( "Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
if ( pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES )
throw uno::RuntimeException ("Cannot reset: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY )
@@ -3120,7 +3118,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq
{
const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[i] );
if ( !pEntry )
- throw beans::UnknownPropertyException ( OUString( "Unknown property: " ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException ( "Unknown property: " + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
if (pEntry->nWID >= RES_UNKNOWNATR_END)
{
@@ -3275,7 +3273,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
{
const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] );
if (!pEntry)
- throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
@@ -3511,7 +3509,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl(
{
const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] );
if (!pEntry)
- throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
if(GetBasePool())
{
commit f0aaae929377bce4bef285256f62ac55254cac9d
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Thu May 15 00:05:47 2014 +0200
sal_uInt16 to more proper types and constify
Change-Id: Ia510ac7d5b38dc6f3910a6e965f1cc154ad41f27
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index d936e94..ed79f3d 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -95,12 +95,12 @@
#define TYPE_LRSPACE 5
#define TYPE_BOX 6
-const unsigned short aStyleByIndex[] =
+const sal_uInt16 aStyleByIndex[] =
{
SFX_STYLE_FAMILY_CHAR,
SFX_STYLE_FAMILY_PARA,
- SFX_STYLE_FAMILY_PAGE ,
- SFX_STYLE_FAMILY_FRAME ,
+ SFX_STYLE_FAMILY_PAGE,
+ SFX_STYLE_FAMILY_FRAME,
SFX_STYLE_FAMILY_PSEUDO
};
@@ -296,7 +296,7 @@ uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex)
if(IsValid())
{
uno::Reference< container::XNameContainer > aRef;
- sal_uInt16 nType = aStyleByIndex[nIndex];
+ const sal_uInt16 nType = aStyleByIndex[nIndex];
switch( nType )
{
case SFX_STYLE_FAMILY_CHAR:
@@ -481,8 +481,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc,
sal_uInt16 nBaseCount = RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN +
RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN;
nIndex = nIndex - nBaseCount;
- const sal_uInt16 nArrLen = rDoc.GetCharFmts()->size();
- for( sal_uInt16 i = 0; i < nArrLen; i++ )
+ const size_t nArrLen = rDoc.GetCharFmts()->size();
+ for( size_t i = 0; i < nArrLen; ++i )
{
SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
@@ -514,8 +514,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc,
RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN;
nIndex = nIndex - nBaseCount;
- const sal_uInt16 nArrLen = rDoc.GetTxtFmtColls()->size();
- for ( sal_uInt16 i = 0; i < nArrLen; i++ )
+ const size_t nArrLen = rDoc.GetTxtFmtColls()->size();
+ for ( size_t i = 0; i < nArrLen; ++i )
{
SwTxtFmtColl * pColl = (*rDoc.GetTxtFmtColls())[i];
if ( pColl->IsDefault() )
@@ -537,8 +537,8 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc,
{
sal_uInt16 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN;
nIndex = nIndex - nBaseCount;
- const sal_uInt16 nArrLen = rDoc.GetFrmFmts()->size();
- for( sal_uInt16 i = 0; i < nArrLen; i++ )
+ const size_t nArrLen = rDoc.GetFrmFmts()->size();
+ for( size_t i = 0; i < nArrLen; ++i )
{
SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
if(pFmt->IsDefault() || pFmt->IsAuto())
@@ -583,7 +583,7 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc,
sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN;
nIndex = nIndex - nBaseCount;
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 ];
if( rRule.IsAutoRule() )
@@ -791,7 +791,7 @@ uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::Runt
if(pBasePool)
{
SfxStyleSheetIteratorPtr pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL);
- sal_uInt16 nCount = pIterator->Count();
+ const sal_uInt16 nCount = pIterator->Count();
aRet.realloc(nCount);
OUString* pArray = aRet.getArray();
OUString aString;
@@ -1080,7 +1080,7 @@ SwStyleProperties_Impl::SwStyleProperties_Impl(const SfxItemPropertyMap& rMap) :
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;
}
@@ -1108,7 +1108,7 @@ bool SwStyleProperties_Impl::SetProperty(const OUString& rName, uno::Any aVal)
bool SwStyleProperties_Impl::ClearProperty( const OUString& rName )
{
bool bRet = false;
- sal_uInt16 nPos = 0;
+ sal_uInt32 nPos = 0;
PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
while( aIt != aPropertyEntries.end() )
{
@@ -1127,7 +1127,7 @@ bool SwStyleProperties_Impl::ClearProperty( const OUString& rName )
void SwStyleProperties_Impl::ClearAllProperties( )
{
- for ( sal_uInt16 i = 0; i < nArrLen; i++ )
+ for ( sal_uInt32 i = 0; i < nArrLen; i++ )
{
delete pAnyArr[i];
pAnyArr[ i ] = 0;
@@ -1137,7 +1137,7 @@ void SwStyleProperties_Impl::ClearAllProperties( )
bool SwStyleProperties_Impl::GetProperty(const OUString& rName, uno::Any*& rpAny )
{
bool bRet = false;
- sal_uInt16 nPos = 0;
+ sal_uInt32 nPos = 0;
PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
while( aIt != aPropertyEntries.end() )
{
@@ -1613,9 +1613,8 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
{
if(!pOldPageDesc)
{
- sal_uInt16 i;
- sal_uInt16 nPDescCount = rDoc.GetPageDescCnt();
- for(i = 0; i < nPDescCount; i++)
+ const sal_uInt16 nPDescCount = rDoc.GetPageDescCnt();
+ for(sal_uInt16 i = 0; i < nPDescCount; ++i)
{
const SwPageDesc& rDesc = rDoc.GetPageDesc( i );
if(rDesc.GetName() == rStyleName)
@@ -1626,7 +1625,7 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
}
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));
if(aFmtName == rStyleName)
@@ -1841,7 +1840,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
SwNumRule aSetRule(*pSwXRules->GetNumRule());
const SwCharFmts* pFmts = pDoc->GetCharFmts();
- sal_uInt16 nChCount = pFmts->size();
+ const size_t nChCount = pFmts->size();
for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
{
@@ -1855,7 +1854,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
{
SwCharFmt* pCharFmt = 0;
- for(sal_uInt16 j = 0; j< nChCount; j++)
+ for(size_t j = 0; j< nChCount; ++j)
{
SwCharFmt* pTmp = (*pFmts)[j];
if(pTmp->GetName() == pCharStyleNames[i])
@@ -1994,11 +1993,11 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
OSL_ENSURE(COND_COMMAND_COUNT == 28,
"invalid size of comman count?");
const beans::NamedValue *pSeq = aSeq.getConstArray();
- sal_Int32 nLen = aSeq.getLength();
+ const sal_Int32 nLen = aSeq.getLength();
bool bFailed = false;
SwCondCollItem aCondItem;
- for(sal_uInt16 i = 0; i < nLen; i++)
+ for(sal_Int32 i = 0; i < nLen; ++i)
{
OUString aTmp;
if ((pSeq[i].Value >>= aTmp))
@@ -2218,7 +2217,7 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl(
SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName);
if(pBasePool)
{
- sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
+ const sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
pBasePool->SetSearchMask(eFamily);
SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
pBasePool->SetSearchMask(eFamily, nSaveMask );
@@ -2456,7 +2455,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
}
case FN_UNO_CATEGORY:
{
- sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId();
+ const sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId();
short nRet = -1;
switch ( COLL_GET_RANGE_BITS & nPoolId )
@@ -2636,7 +2635,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl(
{
if(!pBase)
{
- sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
+ const sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
pBase = pBasePool->Find(m_sStyleName);
pBasePool->SetSearchMask(eFamily, nSaveMask );
@@ -2847,7 +2846,7 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates(
else if(SFX_STYLE_FAMILY_PAGE == eFamily &&
(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");
const SvxSetItem* pSetItem;
if(SFX_ITEM_SET == aSet.GetItemState(
@@ -3261,7 +3260,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName());
if(GetBasePool())
{
- sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
+ const sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
GetBasePool()->SetSearchMask(GetFamily());
SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName());
GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
@@ -3518,7 +3517,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl(
{
if(!pBase)
{
- sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
+ const sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
GetBasePool()->SetSearchMask(GetFamily(), SFXSTYLEBIT_ALL );
pBase = GetBasePool()->Find(GetStyleName());
GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
@@ -4110,7 +4109,7 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( )
static uno::Reference< beans::XPropertySetInfo > xRubyRef;
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();
}
xRet = xRubyRef;
@@ -4121,7 +4120,7 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( )
static uno::Reference< beans::XPropertySetInfo > xParaRef;
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();
}
xRet = xParaRef;
commit 352158b811df825233cc10eb4fa20f2611cfaeed
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Wed May 14 08:33:54 2014 +0200
Remove unused headers
Change-Id: I67cb5bf14114f9892d2680b7688092cafd9644f1
diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index 1641bd5..d626455 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -57,7 +57,6 @@ namespace com
#include <comphelper/namedvaluecollection.hxx>
#include <rtl/ustring.hxx>
-#include <svl/brdcst.hxx>
#include <svl/poolitem.hxx>
#include <tools/ref.hxx>
#include <vector>
diff --git a/include/svl/ctloptions.hxx b/include/svl/ctloptions.hxx
index b8d503e..d20a4f6 100644
--- a/include/svl/ctloptions.hxx
+++ b/include/svl/ctloptions.hxx
@@ -21,8 +21,6 @@
#include <svl/svldllapi.h>
#include <sal/types.h>
-#include <svl/brdcst.hxx>
-#include <svl/lstner.hxx>
#include <unotools/options.hxx>
class SvtCTLOptions_Impl;
diff --git a/include/svl/languageoptions.hxx b/include/svl/languageoptions.hxx
index 17d8767..428e5ca 100644
--- a/include/svl/languageoptions.hxx
+++ b/include/svl/languageoptions.hxx
@@ -21,8 +21,6 @@
#include <svl/svldllapi.h>
#include <sal/types.h>
-#include <svl/brdcst.hxx>
-#include <svl/lstner.hxx>
#include <unotools/configitem.hxx>
#include <unotools/options.hxx>
#include <i18nlangtag/lang.h>
diff --git a/include/svtools/accessibilityoptions.hxx b/include/svtools/accessibilityoptions.hxx
index cd2cae4..5600008 100644
--- a/include/svtools/accessibilityoptions.hxx
+++ b/include/svtools/accessibilityoptions.hxx
@@ -21,7 +21,6 @@
#include <svtools/svtdllapi.h>
#include <unotools/configitem.hxx>
-#include <svl/brdcst.hxx>
#include <svl/lstner.hxx>
#include <unotools/options.hxx>
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
index 8e79226..00f8293 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -23,8 +23,6 @@
#include <rtl/ustring.hxx>
#include <tools/color.hxx>
#include <com/sun/star/uno/Sequence.h>
-#include <svl/brdcst.hxx>
-#include <svl/lstner.hxx>
#include <unotools/options.hxx>
diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx
index 8fbc62f..d918aec 100644
--- a/include/vcl/textdata.hxx
+++ b/include/vcl/textdata.hxx
@@ -21,7 +21,6 @@
#define INCLUDED_VCL_TEXTDATA_HXX
#include <rtl/ustring.hxx>
-#include <svl/brdcst.hxx>
#include <svl/smplhint.hxx>
#include <vcl/dllapi.h>
diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index 9de4988..e516a96 100644
--- a/sc/inc/textuno.hxx
+++ b/sc/inc/textuno.hxx
@@ -23,7 +23,6 @@
#include "global.hxx"
#include "address.hxx"
#include <editeng/unotext.hxx>
-#include <svl/brdcst.hxx>
#include <svl/lstner.hxx>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/sheet/XHeaderFooterContent.hpp>
diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx
index d655e7e..2658cd5 100644
--- a/sc/source/ui/inc/AccessibleText.hxx
+++ b/sc/source/ui/inc/AccessibleText.hxx
@@ -24,6 +24,7 @@
#include "global.hxx"
#include "viewdata.hxx"
#include <editeng/svxenum.hxx>
+#include <svl/brdcst.hxx>
#include <memory>
diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
index 837d447..10bc05f 100644
--- a/sw/inc/postithelper.hxx
+++ b/sw/inc/postithelper.hxx
@@ -25,8 +25,8 @@
#include <vector>
#include <vcl/window.hxx>
#include <SidebarWindowsTypes.hxx>
-#include <svl/brdcst.hxx>
+class SfxBroadcaster;
class SwTxtFld;
class SwRootFrm;
class SwPostItMgr;
commit 852787151b7a5bee7095fa018dbd49148bc71271
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 11 21:02:57 2014 +0200
Reduce scope
Change-Id: Ie73f3d0f67435d66e8cb3bb2edeb9507bc420c85
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 1316b2c..d936e94 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1035,10 +1035,9 @@ void SwXStyleFamily::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
SwXStyle* SwXStyleFamily::_FindStyle(const OUString& rStyleName)const
{
const size_t nLCount = pBasePool->GetListenerCount();
- SfxListener* pListener = 0;
for( size_t i = 0; i < nLCount; ++i)
{
- pListener = pBasePool->GetListener( i );
+ SfxListener* pListener = pBasePool->GetListener( i );
SwXStyle* pTempStyle = dynamic_cast<SwXStyle*>( pListener );
if(pTempStyle && pTempStyle->GetFamily() == eFamily && pTempStyle->GetStyleName() == rStyleName)
{
commit 957ad07e6be28565105d958dfda8858ec7bb9d6a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 11 20:57:50 2014 +0200
Remove redundant checks
Change-Id: I4357e425e0459c9cc8873eba8a8ed1c5a34e9327
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index b7e39d1..0c7fff4 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -1444,15 +1444,12 @@ SdStyleSheetVector SdStyleSheetPool::CreateChildList( SdStyleSheet* pSheet )
SdStyleSheetVector aResult;
const size_t nListenerCount = pSheet->GetListenerCount();
- if (nListenerCount > 0)
+ for (size_t n = 0; n < nListenerCount; ++n)
{
- for (size_t n = 0; n < nListenerCount; ++n)
+ SdStyleSheet* pChild = dynamic_cast< SdStyleSheet* >( pSheet->GetListener(n) );
+ if(pChild && pChild->GetParent() == pSheet->GetName())
{
- SdStyleSheet* pChild = dynamic_cast< SdStyleSheet* >( pSheet->GetListener(n) );
- if(pChild && pChild->GetParent() == pSheet->GetName())
- {
- aResult.push_back( SdStyleSheetRef( pChild ) );
- }
+ aResult.push_back( SdStyleSheetRef( pChild ) );
}
}
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index a978de4..1838b5a 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -330,20 +330,17 @@ bool SdStyleSheet::IsUsed() const
bool bResult = false;
const size_t nListenerCount = GetListenerCount();
- if (nListenerCount > 0)
+ for (size_t n = 0; n < nListenerCount; ++n)
{
- for (size_t n = 0; n < nListenerCount; ++n)
- {
- SfxListener* pListener = GetListener(n);
- if( pListener == this )
- continue;
-
- const svl::StyleSheetUser* const pUser(dynamic_cast<svl::StyleSheetUser*>(pListener));
- if (pUser)
- bResult = pUser->isUsedByModel();
- if (bResult)
- break;
- }
+ SfxListener* pListener = GetListener(n);
+ if( pListener == this )
+ continue;
+
+ const svl::StyleSheetUser* const pUser(dynamic_cast<svl::StyleSheetUser*>(pListener));
+ if (pUser)
+ bResult = pUser->isUsedByModel();
+ if (bResult)
+ break;
}
if( !bResult )
commit f4166f967b68d8ec37ac6163de5a1ea82d0fc76b
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun May 11 20:13:19 2014 +0200
sal_uInt16 to size_t
Change-Id: I46d85e82376a3135408ab77ad31b76a5edbe9ce7
diff --git a/include/svl/brdcst.hxx b/include/svl/brdcst.hxx
index 646b270..8fd62b9 100644
--- a/include/svl/brdcst.hxx
+++ b/include/svl/brdcst.hxx
@@ -57,7 +57,7 @@ public:
{
return m_Listeners.size();
}
- SfxListener* GetListener( sal_uInt16 nNo ) const
+ SfxListener* GetListener( size_t nNo ) const
{
return m_Listeners[nNo];
}
diff --git a/include/svx/svdviter.hxx b/include/svx/svdviter.hxx
index a5cf004..4dfb927 100644
--- a/include/svx/svdviter.hxx
+++ b/include/svx/svdviter.hxx
@@ -68,7 +68,7 @@ class SVX_DLLPUBLIC SdrViewIter
const SdrObject* mpObject;
SdrView* mpAktView;
- sal_uInt32 mnListenerNum;
+ size_t mnListenerNum;
sal_uInt32 mnPageViewNum;
sal_uInt32 mnOutDevNum;
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 84e970a..b7e39d1 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -1443,10 +1443,10 @@ SdStyleSheetVector SdStyleSheetPool::CreateChildList( SdStyleSheet* pSheet )
{
SdStyleSheetVector aResult;
- sal_uInt16 nListenerCount = pSheet->GetListenerCount();
+ const size_t nListenerCount = pSheet->GetListenerCount();
if (nListenerCount > 0)
{
- for (sal_uInt16 n = 0; n < nListenerCount; n++)
+ for (size_t n = 0; n < nListenerCount; ++n)
{
SdStyleSheet* pChild = dynamic_cast< SdStyleSheet* >( pSheet->GetListener(n) );
if(pChild && pChild->GetParent() == pSheet->GetName())
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index f01d3ae..a978de4 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -329,10 +329,10 @@ bool SdStyleSheet::IsUsed() const
{
bool bResult = false;
- sal_uInt16 nListenerCount = GetListenerCount();
+ const size_t nListenerCount = GetListenerCount();
if (nListenerCount > 0)
{
- for (sal_uInt16 n = 0; n < nListenerCount; n++)
+ for (size_t n = 0; n < nListenerCount; ++n)
{
SfxListener* pListener = GetListener(n);
if( pListener == this )
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index 1d588b0..698ee8d 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -877,9 +877,9 @@ namespace sdr
if(pBC)
{
- sal_uInt16 nLstAnz(pBC->GetListenerCount());
+ const size_t nLstAnz(pBC->GetListenerCount());
- for(sal_uInt16 nl(0); nl < nLstAnz; nl++)
+ for(size_t nl=0; nl < nLstAnz; ++nl)
{
SfxListener* pLst = pBC->GetListener(nl);
SdrEdgeObj* pEdge = PTR_CAST(SdrEdgeObj, pLst);
diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx
index 52c44a1..2401504 100644
--- a/svx/source/svdraw/svdviter.cxx
+++ b/svx/source/svdraw/svdviter.cxx
@@ -141,11 +141,11 @@ SdrView* SdrViewIter::ImpFindView()
{
if(mpModel)
{
- sal_uInt32 nLsAnz(mpModel->GetListenerCount());
+ const size_t nLsAnz(mpModel->GetListenerCount());
while(mnListenerNum < nLsAnz)
{
- SfxListener* pLs = mpModel->GetListener((sal_uInt16)mnListenerNum);
+ SfxListener* pLs = mpModel->GetListener(mnListenerNum);
mpAktView = PTR_CAST(SdrView, pLs);
if(mpAktView)
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 5359ada..1316b2c 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1034,9 +1034,9 @@ void SwXStyleFamily::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
SwXStyle* SwXStyleFamily::_FindStyle(const OUString& rStyleName)const
{
- sal_uInt16 nLCount = pBasePool->GetListenerCount();
+ const size_t nLCount = pBasePool->GetListenerCount();
SfxListener* pListener = 0;
- for( sal_uInt16 i = 0; i < nLCount; i++)
+ for( size_t i = 0; i < nLCount; ++i)
{
pListener = pBasePool->GetListener( i );
SwXStyle* pTempStyle = dynamic_cast<SwXStyle*>( pListener );
More information about the Libreoffice-commits
mailing list