summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/accessibility/AccessibleControlShape.cxx8
-rw-r--r--svx/source/accessibility/AccessibleShape.cxx34
-rw-r--r--svx/source/accessibility/lookupcolorname.cxx6
-rw-r--r--svx/source/core/graphichelper.cxx18
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx26
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx8
-rw-r--r--svx/source/dialog/SvxNumOptionsTabPageHelper.cxx8
-rw-r--r--svx/source/dialog/charmap.cxx10
-rw-r--r--svx/source/dialog/langbox.cxx22
-rw-r--r--svx/source/dialog/rubydialog.cxx26
-rw-r--r--svx/source/dialog/srchdlg.cxx12
-rw-r--r--svx/source/fmcomp/dbaexchange.cxx6
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx30
-rw-r--r--svx/source/fmcomp/fmgridif.cxx31
-rw-r--r--svx/source/fmcomp/gridcell.cxx34
-rw-r--r--svx/source/fmcomp/gridctrl.cxx6
-rw-r--r--svx/source/form/dataaccessdescriptor.cxx17
-rw-r--r--svx/source/form/datanavi.cxx51
-rw-r--r--svx/source/form/filtnav.cxx14
-rw-r--r--svx/source/form/fmdmod.cxx6
-rw-r--r--svx/source/form/fmexch.cxx10
-rw-r--r--svx/source/form/fmshimp.cxx63
-rw-r--r--svx/source/form/fmsrcimp.cxx17
-rw-r--r--svx/source/form/fmtextcontrolshell.cxx9
-rw-r--r--svx/source/form/formcontrolfactory.cxx14
-rw-r--r--svx/source/form/formcontroller.cxx127
-rw-r--r--svx/source/form/formdispatchinterceptor.cxx9
-rw-r--r--svx/source/form/tabwin.cxx10
-rw-r--r--svx/source/gallery2/galbrws2.cxx8
-rw-r--r--svx/source/items/customshapeitem.cxx30
-rw-r--r--svx/source/items/galleryitem.cxx24
-rw-r--r--svx/source/items/viewlayoutitem.cxx10
-rw-r--r--svx/source/items/zoomslideritem.cxx18
-rw-r--r--svx/source/sidebar/nbdtmg.cxx32
-rw-r--r--svx/source/smarttags/SmartTagMgr.cxx12
-rw-r--r--svx/source/stbctrls/zoomsliderctrl.cxx3
-rw-r--r--svx/source/table/accessiblecell.cxx16
-rw-r--r--svx/source/table/cell.cxx46
-rw-r--r--svx/source/table/propertyset.cxx15
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx5
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx6
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx5
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx124
-rw-r--r--svx/source/unodraw/unomod.cxx20
-rw-r--r--svx/source/unodraw/unoshape.cxx15
-rw-r--r--svx/source/unogallery/unogalthemeprovider.cxx9
-rw-r--r--svx/source/xml/xmlxtexp.cxx9
-rw-r--r--svx/source/xoutdev/xattr.cxx30
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx14
49 files changed, 422 insertions, 661 deletions
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx
index 09dd1fb887bb..8b7de6c3a3bd 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -809,13 +809,11 @@ void AccessibleControlShape::initializeComposedState()
aInnerStates = xInnerStates->getStates();
// look which one are to be propagated to the composed context
- const sal_Int16* pStates = aInnerStates.getConstArray();
- const sal_Int16* pStatesEnd = pStates + aInnerStates.getLength();
- for ( ; pStates != pStatesEnd; ++pStates )
+ for ( const sal_Int16 nState : aInnerStates )
{
- if ( isComposedState( *pStates ) && !pComposedStates->contains( *pStates ) )
+ if ( isComposedState( nState ) && !pComposedStates->contains( nState ) )
{
- pComposedStates->AddState( *pStates );
+ pComposedStates->AddState( nState );
}
}
}
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 5eb3bbfd5698..bac37417d92a 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -438,16 +438,11 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
if (rState.is())
{
css::uno::Sequence<short> aStates = rState->getStates();
- int count = aStates.getLength();
- for( int iIndex = 0;iIndex < count;iIndex++ )
+ if (std::find(aStates.begin(), aStates.end(), AccessibleStateType::EDITABLE) != aStates.end())
{
- if( aStates[iIndex] == AccessibleStateType::EDITABLE )
- {
- pStateSet->AddState (AccessibleStateType::EDITABLE);
- pStateSet->AddState (AccessibleStateType::RESIZABLE);
- pStateSet->AddState (AccessibleStateType::MOVEABLE);
- break;
- }
+ pStateSet->AddState (AccessibleStateType::EDITABLE);
+ pStateSet->AddState (AccessibleStateType::RESIZABLE);
+ pStateSet->AddState (AccessibleStateType::MOVEABLE);
}
}
}
@@ -813,13 +808,7 @@ sal_Bool SAL_CALL AccessibleShape::isAccessibleChildSelected( sal_Int32 nChildIn
return false;
uno::Sequence<short> aStates = pRState->getStates();
- int nCount = aStates.getLength();
- for( int i = 0; i < nCount; i++ )
- {
- if(aStates[i] == AccessibleStateType::SELECTED)
- return true;
- }
- return false;
+ return std::find(aStates.begin(), aStates.end(), AccessibleStateType::SELECTED) != aStates.end();
}
}
@@ -928,16 +917,17 @@ uno::Sequence<uno::Type> SAL_CALL
// ... and merge them all into one list.
sal_Int32 nTypeCount (aTypeList.getLength()),
nComponentTypeCount (aComponentTypeList.getLength());
- int i;
aTypeList.realloc (nTypeCount + nComponentTypeCount + 3);
- for (i=0; i<nComponentTypeCount; i++)
- aTypeList[nTypeCount + i] = aComponentTypeList[i];
+ std::copy(aComponentTypeList.begin(), aComponentTypeList.end(),
+ std::next(aTypeList.begin(), nTypeCount));
+
+ int i = nTypeCount + nComponentTypeCount;
- aTypeList[nTypeCount + i++ ] = aLangEventListenerType;
- aTypeList[nTypeCount + i++ ] = aDocumentEventListenerType;
- aTypeList[nTypeCount + i ] = aUnoTunnelType;
+ aTypeList[ i++ ] = aLangEventListenerType;
+ aTypeList[ i++ ] = aDocumentEventListenerType;
+ aTypeList[ i ] = aUnoTunnelType;
return aTypeList;
}
diff --git a/svx/source/accessibility/lookupcolorname.cxx b/svx/source/accessibility/lookupcolorname.cxx
index d7e8b55db0a4..c33cb9b3be23 100644
--- a/svx/source/accessibility/lookupcolorname.cxx
+++ b/svx/source/accessibility/lookupcolorname.cxx
@@ -78,15 +78,15 @@ ColorNameMap::ColorNameMap() {
// Fill the map to convert from numerical color values to names.
if (xNA.is())
- for (long int i=0; i<aNames.getLength(); i++)
+ for (const auto& rName : aNames)
{
// Get the numerical value for the i-th color name.
try
{
- css::uno::Any aColor = xNA->getByName(aNames[i]);
+ css::uno::Any aColor = xNA->getByName(rName);
long nColor = 0;
aColor >>= nColor;
- map_[nColor] = aNames[i];
+ map_[nColor] = rName;
}
catch (css::uno::RuntimeException const&)
{
diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx
index 3898057d36d9..3d12a2c9e1c7 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -150,12 +150,11 @@ bool lcl_ExecuteFilterDialog( const Sequence< PropertyValue >& rPropsForDialog,
{
bStatus = true;
Sequence< PropertyValue > aPropsFromDialog = xFilterProperties->getPropertyValues();
- const sal_Int32 nPropsLen = aPropsFromDialog.getLength();
- for ( sal_Int32 nInd = 0; nInd < nPropsLen; ++nInd )
+ for ( const auto& rProp : aPropsFromDialog )
{
- if (aPropsFromDialog[nInd].Name == "FilterData")
+ if (rProp.Name == "FilterData")
{
- aPropsFromDialog[nInd].Value >>= rFilterData;
+ rProp.Value >>= rFilterData;
}
}
}
@@ -300,16 +299,15 @@ OUString GraphicHelper::ExportGraphic(weld::Window* pParent, const Graphic& rGra
sal_Int32 nWidth = 0;
sal_Int32 nHeight = 0;
- sal_Int32 nLen = aFilterData.getLength();
- for (sal_Int32 i = 0; i < nLen; ++i)
+ for (const auto& rProp : aFilterData)
{
- if (aFilterData[i].Name == "PixelWidth")
+ if (rProp.Name == "PixelWidth")
{
- aFilterData[i].Value >>= nWidth;
+ rProp.Value >>= nWidth;
}
- else if (aFilterData[i].Name == "PixelHeight")
+ else if (rProp.Name == "PixelHeight")
{
- aFilterData[i].Value >>= nHeight;
+ rProp.Value >>= nHeight;
}
}
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index b2effd4649f5..7f16a469d91b 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -444,14 +444,11 @@ bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle(
EnhancedCustomShape2d::Handle& rDestinationHandle )
{
bool bRetValue = false;
- sal_uInt32 i, nProperties = rHandleProperties.getLength();
- if ( nProperties )
+ if ( rHandleProperties.hasElements() )
{
rDestinationHandle.nFlags = HandleFlags::NONE;
- for ( i = 0; i < nProperties; i++ )
+ for ( const css::beans::PropertyValue& rPropVal : rHandleProperties )
{
- const css::beans::PropertyValue& rPropVal = rHandleProperties[ i ];
-
if ( rPropVal.Name == "Position" )
{
if ( rPropVal.Value >>= rDestinationHandle.aPosition )
@@ -806,13 +803,13 @@ EnhancedCustomShape2d::EnhancedCustomShape2d(SdrObjCustomShape& rSdrObjCustomSha
break;
}
- sal_Int32 i, nLength = seqEquations.getLength();
+ sal_Int32 nLength = seqEquations.getLength();
if ( nLength )
{
vNodesSharedPtr.resize( nLength );
vEquationResults.resize( nLength );
- for ( i = 0; i < seqEquations.getLength(); i++ )
+ for ( sal_Int32 i = 0; i < nLength; i++ )
{
vEquationResults[ i ].bReady = false;
try
@@ -2039,15 +2036,12 @@ void EnhancedCustomShape2d::CreateSubPath(
SetPathSize( nIndex );
- sal_Int32 nCoordSize = seqCoordinates.getLength();
sal_Int32 nSegInfoSize = seqSegments.getLength();
if ( !nSegInfoSize )
{
- const EnhancedCustomShapeParameterPair* pTmp = seqCoordinates.getArray();
-
- for ( sal_Int32 nPtNum(0); nPtNum < nCoordSize; nPtNum++ )
+ for ( const EnhancedCustomShapeParameterPair& rCoordinate : seqCoordinates )
{
- const Point aTempPoint(GetPoint( *pTmp++, true, true ));
+ const Point aTempPoint(GetPoint( rCoordinate, true, true ));
aNewB2DPolygon.append(basegfx::B2DPoint(aTempPoint.X(), aTempPoint.Y()));
}
@@ -2055,6 +2049,7 @@ void EnhancedCustomShape2d::CreateSubPath(
}
else
{
+ sal_Int32 nCoordSize = seqCoordinates.getLength();
for ( ;rSegmentInd < nSegInfoSize; )
{
sal_Int16 nCommand = seqSegments[ rSegmentInd ].Command;
@@ -2998,14 +2993,13 @@ SdrObject* EnhancedCustomShape2d::CreateObject( bool bLineGeometryNeededOnly )
void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj )
{
- if ( pObj && seqGluePoints.hasElements() )
+ if ( pObj )
{
- sal_uInt32 i, nCount = seqGluePoints.getLength();
- for ( i = 0; i < nCount; i++ )
+ for ( const auto& rGluePoint : seqGluePoints )
{
SdrGluePoint aGluePoint;
- aGluePoint.SetPos( GetPoint( seqGluePoints[ i ], true, true ) );
+ aGluePoint.SetPos( GetPoint( rGluePoint, true, true ) );
aGluePoint.SetPercent( false );
aGluePoint.SetAlign( SdrAlign::VERT_TOP | SdrAlign::HORZ_LEFT );
aGluePoint.SetEscDir( SdrEscapeDirection::SMART );
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 094e353ce350..31cda0abcabd 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -117,16 +117,14 @@ void SAL_CALL EnhancedCustomShapeEngine::release() throw()
// XInitialization
void SAL_CALL EnhancedCustomShapeEngine::initialize( const Sequence< Any >& aArguments )
{
- sal_Int32 i;
Sequence< beans::PropertyValue > aParameter;
- for ( i = 0; i < aArguments.getLength(); i++ )
+ for ( const auto& rArgument : aArguments )
{
- if ( aArguments[ i ] >>= aParameter )
+ if ( rArgument >>= aParameter )
break;
}
- for ( i = 0; i < aParameter.getLength(); i++ )
+ for ( const beans::PropertyValue& rProp : aParameter )
{
- const beans::PropertyValue& rProp = aParameter[ i ];
if ( rProp.Name == "CustomShape" )
rProp.Value >>= mxShape;
else if ( rProp.Name == "ForceGroupWithText" )
diff --git a/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx b/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx
index 044663638358..6f506ae9a7c4 100644
--- a/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx
+++ b/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx
@@ -55,10 +55,8 @@ void SvxNumOptionsTabPageHelper::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 n
if(xInfo.is())
{
Sequence<sal_Int16> aTypes = xInfo->getSupportedNumberingTypes( );
- const sal_Int16* pTypes = aTypes.getConstArray();
- for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ for(const sal_Int16 nCurrent : aTypes)
{
- sal_Int16 nCurrent = pTypes[nType];
if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
{
bool bInsert = true;
@@ -110,10 +108,8 @@ void SvxNumOptionsTabPageHelper::GetI18nNumbering(weld::ComboBox& rFmtLB, sal_uI
if(xInfo.is())
{
Sequence<sal_Int16> aTypes = xInfo->getSupportedNumberingTypes( );
- const sal_Int16* pTypes = aTypes.getConstArray();
- for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ for(const sal_Int16 nCurrent : aTypes)
{
- sal_Int16 nCurrent = pTypes[nType];
if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
{
bool bInsert = true;
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 718213bafb2e..f53bc4bd6901 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -205,17 +205,11 @@ void SvxShowCharSet::getFavCharacterList()
maFavCharFontList.clear();
//retrieve recent character list
css::uno::Sequence< OUString > rFavCharList( officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterList::get() );
- for (int i = 0; i < rFavCharList.getLength(); ++i)
- {
- maFavCharList.push_back(rFavCharList[i]);
- }
+ comphelper::sequenceToContainer(maFavCharList, rFavCharList);
//retrieve recent character font list
css::uno::Sequence< OUString > rFavCharFontList( officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::get() );
- for (int i = 0; i < rFavCharFontList.getLength(); ++i)
- {
- maFavCharFontList.push_back(rFavCharFontList[i]);
- }
+ comphelper::sequenceToContainer(maFavCharFontList, rFavCharFontList);
}
bool SvxShowCharSet::isFavChar(const OUString& sTitle, const OUString& rFont)
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index b99311029a92..8fca2a6a29f9 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -75,16 +75,14 @@ OUString GetDicInfoStr( const OUString& rName, const LanguageType nLang, bool bN
static std::vector< LanguageType > lcl_LocaleSeqToLangSeq( Sequence< css::lang::Locale > const &rSeq )
{
- const css::lang::Locale *pLocale = rSeq.getConstArray();
sal_Int32 nCount = rSeq.getLength();
std::vector< LanguageType > aLangs;
aLangs.reserve(nCount);
- for (sal_Int32 i = 0; i < nCount; ++i)
- {
- aLangs.push_back( LanguageTag::convertToLanguageType( pLocale[i] ) );
- }
+ std::transform(rSeq.begin(), rSeq.end(), std::back_inserter(aLangs),
+ [](const css::lang::Locale& rLocale) -> LanguageType {
+ return LanguageTag::convertToLanguageType(rLocale); });
return aLangs;
}
@@ -92,18 +90,8 @@ static std::vector< LanguageType > lcl_LocaleSeqToLangSeq( Sequence< css::lang::
static bool lcl_SeqHasLang( const Sequence< sal_Int16 > & rLangSeq, sal_Int16 nLang )
{
- sal_Int32 i = -1;
- sal_Int32 nLen = rLangSeq.getLength();
- if (nLen)
- {
- const sal_Int16 *pLang = rLangSeq.getConstArray();
- for (i = 0; i < nLen; ++i)
- {
- if (nLang == pLang[i])
- break;
- }
- }
- return i >= 0 && i < nLen;
+ return rLangSeq.hasElements()
+ && std::find(rLangSeq.begin(), rLangSeq.end(), nLang) != rLangSeq.end();
}
extern "C" SAL_DLLPUBLIC_EXPORT void makeSvxLanguageBox(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap)
diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx
index 5f0a6e54a8ac..94fddca18f8a 100644
--- a/svx/source/dialog/rubydialog.cxx
+++ b/svx/source/dialog/rubydialog.cxx
@@ -370,13 +370,12 @@ void SvxRubyDialog::SetRubyText(sal_Int32 nPos, weld::Entry& rLeft, weld::Entry&
if (bEnable)
{
const Sequence<PropertyValue> aProps = aRubyValues.getConstArray()[nPos];
- const PropertyValue* pProps = aProps.getConstArray();
- for (sal_Int32 nProp = 0; nProp < aProps.getLength(); nProp++)
+ for (const PropertyValue& rProp : aProps)
{
- if (pProps[nProp].Name == cRubyBaseText)
- pProps[nProp].Value >>= sLeft;
- else if (pProps[nProp].Name == cRubyText)
- pProps[nProp].Value >>= sRight;
+ if (rProp.Name == cRubyBaseText)
+ rProp.Value >>= sLeft;
+ else if (rProp.Name == cRubyText)
+ rProp.Value >>= sRight;
}
}
else if (!nPos)
@@ -434,30 +433,29 @@ void SvxRubyDialog::Update()
for (sal_Int32 nRuby = 0; nRuby < nLen; nRuby++)
{
const Sequence<PropertyValue> &rProps = aRubyValues.getConstArray()[nRuby];
- const PropertyValue* pProps = rProps.getConstArray();
- for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ for (const PropertyValue& rProp : rProps)
{
- if (nAdjust > -2 && pProps[nProp].Name == cRubyAdjust)
+ if (nAdjust > -2 && rProp.Name == cRubyAdjust)
{
sal_Int16 nTmp = sal_Int16();
- pProps[nProp].Value >>= nTmp;
+ rProp.Value >>= nTmp;
if (!nRuby)
nAdjust = nTmp;
else if(nAdjust != nTmp)
nAdjust = -2;
}
- if (nPosition > -2 && pProps[nProp].Name == cRubyPosition )
+ if (nPosition > -2 && rProp.Name == cRubyPosition )
{
sal_Int16 nTmp = sal_Int16();
- pProps[nProp].Value >>= nTmp;
+ rProp.Value >>= nTmp;
if (!nRuby)
nPosition = nTmp;
else if(nPosition != nTmp)
nPosition = -2;
}
- if (bCharStyleEqual && pProps[nProp].Name == cRubyCharStyleName)
+ if (bCharStyleEqual && rProp.Name == cRubyCharStyleName)
{
- pProps[nProp].Value >>= sTmp;
+ rProp.Value >>= sTmp;
if (!nRuby)
sCharStyleName = sTmp;
else if (sCharStyleName != sTmp)
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 48dbc88ad860..0aa6b26e1819 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -2313,12 +2313,12 @@ void SvxSearchDialog::SetDocWin(vcl::Window* pDocWin)
if (nLen)
{
uno::Sequence<uno::Reference<uno::XInterface>> aSequence(nLen);
- for (sal_Int32 i = 0; i < nLen; ++i)
- {
- uno::Reference < css::accessibility::XAccessible > xAcc;
- aAnySeq[i] >>= xAcc;
- aSequence[i] = xAcc;
- }
+ std::transform(aAnySeq.begin(), aAnySeq.end(), aSequence.begin(),
+ [](const uno::Any& rAny) -> uno::Reference < css::accessibility::XAccessible > {
+ uno::Reference < css::accessibility::XAccessible > xAcc;
+ rAny >>= xAcc;
+ return xAcc;
+ });
m_xDialog->add_extra_accessible_relation(css::accessibility::AccessibleRelation(css::accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence));
}
}
diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx
index 0de9e674169a..563043b305fb 100644
--- a/svx/source/fmcomp/dbaexchange.cxx
+++ b/svx/source/fmcomp/dbaexchange.cxx
@@ -484,12 +484,10 @@ namespace svx
const sal_Unicode cSeparator(11);
const OUString sSeparator(&cSeparator, 1);
- const Any* pSelRows = _rSelRows.getConstArray();
- const Any* pSelRowsEnd = pSelRows + _rSelRows.getLength();
- for ( ; pSelRows < pSelRowsEnd; ++pSelRows )
+ for ( const Any& rSelRow : _rSelRows )
{
sal_Int32 nSelectedRow( 0 );
- OSL_VERIFY( *pSelRows >>= nSelectedRow );
+ OSL_VERIFY( rSelRow >>= nSelectedRow );
m_sCompatibleObjectDescription += OUString::number(nSelectedRow);
m_sCompatibleObjectDescription += sSeparator;
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 757a9142ae57..221060d1abd3 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -1261,13 +1261,8 @@ void FmGridControl::DeleteSelectedRows()
SetUpdateMode( true );
// how many rows are deleted?
- sal_Int32 nDeletedRows = 0;
- const sal_Int32* pSuccess = aDeletedRows.getConstArray();
- for (sal_Int32 i = 0; i < aDeletedRows.getLength(); i++)
- {
- if (pSuccess[i])
- ++nDeletedRows;
- }
+ sal_Int32 nDeletedRows = static_cast<sal_Int32>(std::count_if(aDeletedRows.begin(), aDeletedRows.end(),
+ [](const sal_Int32 nRow) { return nRow != 0; }));
// have rows been deleted?
if (nDeletedRows)
@@ -1314,13 +1309,11 @@ void FmGridControl::DeleteSelectedRows()
// not all the rows where deleted, so move to the first row which remained in the resultset
else
{
- for (sal_Int32 i = 0; i < aDeletedRows.getLength(); i++)
+ auto pRow = std::find(aDeletedRows.begin(), aDeletedRows.end(), 0);
+ if (pRow != aDeletedRows.end())
{
- if (!pSuccess[i])
- {
- getDataSource()->moveToBookmark(aBookmarks.getConstArray()[i]);
- break;
- }
+ auto i = static_cast<sal_Int32>(std::distance(aDeletedRows.begin(), pRow));
+ getDataSource()->moveToBookmark(aBookmarks[i]);
}
}
}
@@ -1353,11 +1346,11 @@ void FmGridControl::DeleteSelectedRows()
else
{
// select the remaining rows
- for (sal_Int32 i = 0; i < aDeletedRows.getLength(); i++)
+ for (const sal_Int32 nSuccess : aDeletedRows)
{
try
{
- if (!pSuccess[i])
+ if (!nSuccess)
{
m_pSeekCursor->moveToBookmark(m_pDataCursor->getBookmark());
SetSeekPos(m_pSeekCursor->getRow() - 1);
@@ -1775,18 +1768,15 @@ bool FmGridControl::selectBookmarks(const Sequence< Any >& _rBookmarks)
return false;
}
- const Any* pBookmark = _rBookmarks.getConstArray();
- const Any* pBookmarkEnd = pBookmark + _rBookmarks.getLength();
-
SetNoSelection();
bool bAllSuccessfull = true;
try
{
- for (; pBookmark != pBookmarkEnd; ++pBookmark)
+ for (const Any& rBookmark : _rBookmarks)
{
// move the seek cursor to the row given
- if (m_pSeekCursor->moveToBookmark(*pBookmark))
+ if (m_pSeekCursor->moveToBookmark(rBookmark))
SelectRow( m_pSeekCursor->getRow() - 1);
else
bAllSuccessfull = false;
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index e270576298c0..a1cfd03bb854 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -2348,13 +2348,7 @@ css::uno::Sequence<OUString> FmXGridPeer::getSupportedModes()
sal_Bool FmXGridPeer::supportsMode(const OUString& Mode)
{
css::uno::Sequence<OUString> aModes(getSupportedModes());
- const OUString* pModes = aModes.getConstArray();
- for (sal_Int32 i = aModes.getLength(); i > 0; )
- {
- if (pModes[--i] == Mode)
- return true;
- }
- return false;
+ return comphelper::findValue(aModes, Mode) != -1;
}
@@ -2518,24 +2512,21 @@ void FmXGridPeer::statusChanged(const css::frame::FeatureStateEvent& Event)
DBG_ASSERT(m_pDispatchers, "FmXGridPeer::statusChanged : invalid call !");
Sequence< css::util::URL>& aUrls = getSupportedURLs();
- const css::util::URL* pUrls = aUrls.getConstArray();
const std::vector<DbGridControlNavigationBarState>& aSlots = getSupportedGridSlots();
- sal_Int32 i;
- for (i=0; i<aUrls.getLength(); ++i, ++pUrls)
+ auto pUrl = std::find_if(aUrls.begin(), aUrls.end(),
+ [&Event](const css::util::URL& rUrl) { return rUrl.Main == Event.FeatureURL.Main; });
+ if (pUrl != aUrls.end())
{
- if (pUrls->Main == Event.FeatureURL.Main)
- {
- DBG_ASSERT(m_pDispatchers[i] == Event.Source, "FmXGridPeer::statusChanged : the event source is a little bit suspect !");
- m_pStateCache[i] = Event.IsEnabled;
- VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
- if (aSlots[i] != DbGridControlNavigationBarState::Undo)
- pGrid->GetNavigationBar().InvalidateState(aSlots[i]);
- break;
- }
+ auto i = static_cast<sal_uInt32>(std::distance(aUrls.begin(), pUrl));
+ DBG_ASSERT(m_pDispatchers[i] == Event.Source, "FmXGridPeer::statusChanged : the event source is a little bit suspect !");
+ m_pStateCache[i] = Event.IsEnabled;
+ VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
+ if (aSlots[i] != DbGridControlNavigationBarState::Undo)
+ pGrid->GetNavigationBar().InvalidateState(aSlots[i]);
}
- DBG_ASSERT(i<aUrls.getLength(), "FmXGridPeer::statusChanged : got a call for an unknown url !");
+ DBG_ASSERT(pUrl != aUrls.end(), "FmXGridPeer::statusChanged : got a call for an unknown url !");
}
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 622a22c4682a..5904a892904a 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2425,10 +2425,8 @@ void DbComboBox::SetList(const Any& rItems)
css::uno::Sequence<OUString> aTest;
if (rItems >>= aTest)
{
- const OUString* pStrings = aTest.getConstArray();
- sal_Int32 nItems = aTest.getLength();
- for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
- pField->InsertEntry(*pStrings);
+ for (const OUString& rString : aTest)
+ pField->InsertEntry(rString);
// tell the grid control that this controller is invalid and has to be re-initialized
invalidatedController();
@@ -2546,12 +2544,10 @@ void DbListBox::SetList(const Any& rItems)
css::uno::Sequence<OUString> aTest;
if (rItems >>= aTest)
{
- const OUString* pStrings = aTest.getConstArray();
- sal_Int32 nItems = aTest.getLength();
- if (nItems)
+ if (aTest.hasElements())
{
- for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
- pField->InsertEntry(*pStrings);
+ for (const OUString& rString : aTest)
+ pField->InsertEntry(rString);
m_rColumn.getModel()->getPropertyValue(FM_PROP_VALUE_SEQ) >>= m_aValueList;
m_bBound = m_aValueList.hasElements();
@@ -2707,21 +2703,19 @@ void DbFilterField::SetList(const Any& rItems, bool bComboBox)
{
css::uno::Sequence<OUString> aTest;
rItems >>= aTest;
- const OUString* pStrings = aTest.getConstArray();
- sal_Int32 nItems = aTest.getLength();
- if (nItems)
+ if (aTest.hasElements())
{
if (bComboBox)
{
ComboBox* pField = static_cast<ComboBox*>(m_pWindow.get());
- for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
- pField->InsertEntry(*pStrings);
+ for (const OUString& rString : aTest)
+ pField->InsertEntry(rString);
}
else
{
ListBox* pField = static_cast<ListBox*>(m_pWindow.get());
- for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
- pField->InsertEntry(*pStrings);
+ for (const OUString& rString : aTest)
+ pField->InsertEntry(rString);
m_rColumn.getModel()->getPropertyValue(FM_PROP_VALUE_SEQ) >>= m_aValueList;
}
@@ -4103,9 +4097,9 @@ void SAL_CALL FmXListBoxCell::addItems(const css::uno::Sequence<OUString>& aItem
if (m_pBox)
{
sal_uInt16 nP = nPos;
- for ( sal_Int32 n = 0; n < aItems.getLength(); n++ )
+ for ( const auto& rItem : aItems )
{
- m_pBox->InsertEntry( aItems.getConstArray()[n], nP );
+ m_pBox->InsertEntry( rItem, nP );
if ( nPos != -1 ) // Not if 0xFFFF, because LIST_APPEND
nP++;
}
@@ -4431,9 +4425,9 @@ void SAL_CALL FmXComboBoxCell::addItems( const Sequence< OUString >& Items, sal_
if ( m_pComboBox )
{
sal_uInt16 nP = Pos;
- for ( sal_Int32 n = 0; n < Items.getLength(); n++ )
+ for ( const auto& rItem : Items )
{
- m_pComboBox->InsertEntry( Items.getConstArray()[n], nP );
+ m_pComboBox->InsertEntry( rItem, nP );
if ( Pos != -1 )
nP++;
}
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index d621b0f0a622..ba1e06a712a8 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -113,11 +113,9 @@ private:
::DbGridControl::GrantControlAccess aAccess;
CursorWrapper* pSeek = m_pControl->GetSeekCursor(aAccess);
const DbGridRowRef& rSeekRow = m_pControl->GetSeekRow(aAccess);
- const Any* pIter = i_aEvt.Bookmarks.getConstArray();
- const Any* pEnd = pIter + i_aEvt.Bookmarks.getLength();
- for(;pIter != pEnd;++pIter)
+ for(const Any& rBookmark : i_aEvt.Bookmarks)
{
- pSeek->moveToBookmark(*pIter);
+ pSeek->moveToBookmark(rBookmark);
// get the data
rSeekRow->SetState(pSeek, true);
sal_Int32 nSeekPos = pSeek->getRow() - 1;
diff --git a/svx/source/form/dataaccessdescriptor.cxx b/svx/source/form/dataaccessdescriptor.cxx
index 33c4fee2902d..361be0c11ce7 100644
--- a/svx/source/form/dataaccessdescriptor.cxx
+++ b/svx/source/form/dataaccessdescriptor.cxx
@@ -97,15 +97,13 @@ namespace svx
bool bValidPropsOnly = true;
// loop through the sequence, and fill our m_aValues
- const PropertyValue* pValues = _rValues.getConstArray();
- const PropertyValue* pValuesEnd = pValues + _rValues.getLength();
- for (;pValues != pValuesEnd; ++pValues)
+ for (const PropertyValue& rValue : _rValues)
{
- MapString2PropertyEntry::const_iterator aPropPos = rProperties.find( pValues->Name );
+ MapString2PropertyEntry::const_iterator aPropPos = rProperties.find( rValue.Name );
if ( aPropPos != rProperties.end() )
{
DataAccessDescriptorProperty eProperty = aPropPos->second;
- m_aValues[eProperty] = pValues->Value;
+ m_aValues[eProperty] = rValue.Value;
}
else
// unknown property
@@ -136,16 +134,15 @@ namespace svx
// build a PropertyValue sequence with the current values
Sequence< Property > aProperties = xPropInfo->getProperties();
- const Property* pProperty = aProperties.getConstArray();
- const Property* pPropertyEnd = pProperty + aProperties.getLength();
Sequence< PropertyValue > aValues(aProperties.getLength());
PropertyValue* pValues = aValues.getArray();
- for (;pProperty != pPropertyEnd; ++pProperty, ++pValues)
+ for (const Property& rProperty : aProperties)
{
- pValues->Name = pProperty->Name;
- pValues->Value = _rxValues->getPropertyValue(pProperty->Name);
+ pValues->Name = rProperty.Name;
+ pValues->Value = _rxValues->getPropertyValue(rProperty.Name);
+ ++pValues;
}
bool bValidPropsOnly = buildFrom(aValues);
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index c214352e1ea4..d0af70020036 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -1231,14 +1231,12 @@ namespace svxform
OUString sInstModel = PN_INSTANCE_MODEL;
OUString sInstName = PN_INSTANCE_ID;
OUString sInstURL = PN_INSTANCE_URL;
- const PropertyValue* pProps = _xPropSeq.getConstArray();
- const PropertyValue* pPropsEnd = pProps + _xPropSeq.getLength();
- for ( ; pProps != pPropsEnd; ++pProps )
+ for ( const PropertyValue& rProp : _xPropSeq )
{
- if ( sInstModel == pProps->Name )
+ if ( sInstModel == rProp.Name )
{
Reference< css::xml::dom::XNode > xRoot;
- if ( pProps->Value >>= xRoot )
+ if ( rProp.Value >>= xRoot )
{
try
{
@@ -1260,9 +1258,9 @@ namespace svxform
}
}
}
- else if ( sInstName == pProps->Name && ( pProps->Value >>= sTemp ) )
+ else if ( sInstName == rProp.Name && ( rProp.Value >>= sTemp ) )
m_sInstanceName = sRet = sTemp;
- else if ( sInstURL == pProps->Name && ( pProps->Value >>= sTemp ) )
+ else if ( sInstURL == rProp.Name && ( rProp.Value >>= sTemp ) )
m_sInstanceURL = sTemp;
}
@@ -1906,11 +1904,9 @@ namespace svxform
{
m_xDataContainer = xContainer;
Sequence< OUString > aNameList = m_xDataContainer->getElementNames();
- sal_Int32 i, nCount = aNameList.getLength();
- OUString* pNames = aNameList.getArray();
- for ( i = 0; i < nCount; ++i )
+ for ( const OUString& rName : aNameList )
{
- Any aAny = m_xDataContainer->getByName( pNames[i] );
+ Any aAny = m_xDataContainer->getByName( rName );
Reference< css::xforms::XModel > xFormsModel;
if ( aAny >>= xFormsModel )
m_pModelsBox->InsertEntry( xFormsModel->getID() );
@@ -2047,16 +2043,10 @@ namespace svxform
void DataNavigatorWindow::CreateInstancePage( const Sequence< PropertyValue >& _xPropSeq )
{
OUString sInstName;
- const PropertyValue* pProps = _xPropSeq.getConstArray();
- const PropertyValue* pPropsEnd = pProps + _xPropSeq.getLength();
- for ( ; pProps != pPropsEnd; ++pProps )
- {
- if ( PN_INSTANCE_ID == pProps->Name )
- {
- pProps->Value >>= sInstName;
- break;
- }
- }
+ auto pProp = std::find_if(_xPropSeq.begin(), _xPropSeq.end(),
+ [](const PropertyValue& rProp) { return PN_INSTANCE_ID == rProp.Name; });
+ if (pProp != _xPropSeq.end())
+ pProp->Value >>= sInstName;
sal_uInt16 nPageId = GetNewPageId();
if ( sInstName.isEmpty() )
@@ -2418,12 +2408,10 @@ namespace svxform
{
// get property names & infos, and iterate over target properties
Sequence< Property > aProperties = xTo->getPropertySetInfo()->getProperties();
- sal_Int32 nProperties = aProperties.getLength();
- const Property* pProperties = aProperties.getConstArray();
Reference< XPropertySetInfo > xFromInfo = xFrom->getPropertySetInfo();
- for ( sal_Int32 i = 0; i < nProperties; ++i )
+ for ( const Property& rProperty : aProperties )
{
- const OUString& rName = pProperties[i].Name;
+ const OUString& rName = rProperty.Name;
// if both set have the property, copy the value
// (catch and ignore exceptions, if any)
@@ -2684,10 +2672,8 @@ namespace svxform
if ( xDataTypes.is() )
{
Sequence< OUString > aNameList = xDataTypes->getElementNames();
- sal_Int32 i, nCount = aNameList.getLength();
- OUString* pNames = aNameList.getArray();
- for ( i = 0; i < nCount; ++i )
- m_xDataTypeLB->append_text(pNames[i]);
+ for ( const OUString& rName : aNameList )
+ m_xDataTypeLB->append_text(rName);
}
if ( m_xTempBinding.is() )
@@ -2975,14 +2961,11 @@ namespace svxform
{
int nRow = 0;
Sequence< OUString > aAllNames = m_rNamespaces->getElementNames();
- const OUString* pAllNames = aAllNames.getConstArray();
- const OUString* pAllNamesEnd = pAllNames + aAllNames.getLength();
- for ( ; pAllNames != pAllNamesEnd; ++pAllNames )
+ for ( const OUString& sPrefix : aAllNames )
{
- OUString sURL;
- OUString sPrefix = *pAllNames;
if ( m_rNamespaces->hasByName( sPrefix ) )
{
+ OUString sURL;
Any aAny = m_rNamespaces->getByName( sPrefix );
if (aAny >>= sURL)
{
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 1fbe04e3b55c..dc406e6bd9ea 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -564,23 +564,21 @@ void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, FmPar
Insert( pFormItem->GetChildren().end(), std::unique_ptr<FmFilterData>(pFilterItems) );
const Sequence< OUString >& rDisjunction( conjunctionTerm );
- for ( const OUString* pDisjunctiveTerm = rDisjunction.getConstArray();
- pDisjunctiveTerm != rDisjunction.getConstArray() + rDisjunction.getLength();
- ++pDisjunctiveTerm
- )
+ sal_Int32 nComponentIndex = -1;
+ for ( const OUString& rDisjunctiveTerm : rDisjunction )
{
- if ( pDisjunctiveTerm->isEmpty() )
+ ++nComponentIndex;
+
+ if ( rDisjunctiveTerm.isEmpty() )
// no condition for this particular component in this particular conjunction term
continue;
- const sal_Int32 nComponentIndex = pDisjunctiveTerm - rDisjunction.getConstArray();
-
// determine the display name of the control
const Reference< XControl > xFilterControl( xFilterController->getFilterComponent( nComponentIndex ) );
const OUString sDisplayName( lcl_getLabelName_nothrow( xFilterControl ) );
// insert a new entry
- std::unique_ptr<FmFilterItem> pANDCondition(new FmFilterItem( pFilterItems, sDisplayName, *pDisjunctiveTerm, nComponentIndex ));
+ std::unique_ptr<FmFilterItem> pANDCondition(new FmFilterItem( pFilterItems, sDisplayName, rDisjunctiveTerm, nComponentIndex ));
Insert( pFilterItems->GetChildren().end(), std::move(pANDCondition) );
}
diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx
index 849d21b25871..6f34a16d4d5f 100644
--- a/svx/source/form/fmdmod.cxx
+++ b/svx/source/form/fmdmod.cxx
@@ -23,6 +23,7 @@
#include <fmobj.hxx>
#include <svx/unoshape.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <svx/fmglob.hxx>
@@ -81,10 +82,7 @@ using namespace ::svxform;
static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList);
- ::com::sun::star::uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount );
- OUString* pStrings = aSeq.getArray();
- for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
- pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
+ auto aSeq( comphelper::arrayToSequence< OUString >(aSvxComponentServiceNameList, nSvxComponentServiceNameListCount) );
::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
return concatServiceNames( aParentSeq, aSeq );
diff --git a/svx/source/form/fmexch.cxx b/svx/source/form/fmexch.cxx
index ad3c2e8427f7..139aeb4ffeb6 100644
--- a/svx/source/form/fmexch.cxx
+++ b/svx/source/form/fmexch.cxx
@@ -250,15 +250,11 @@ namespace svxform
ListBoxEntrySet aEmpty;
m_aSelectedEntries.swap( aEmpty );
- sal_Int32 nControls = m_aControlPaths.getLength();
- const css::uno::Sequence<sal_uInt32>* pPaths = m_aControlPaths.getConstArray();
- for (sal_Int32 i=0; i<nControls; ++i)
+ for (const css::uno::Sequence<sal_uInt32>& rPaths : m_aControlPaths)
{
- sal_Int32 nThisPatLength = pPaths[i].getLength();
- const sal_uInt32* pThisPath = pPaths[i].getConstArray();
SvTreeListEntry* pSearch = pRoot;
- for (sal_Int32 j=0; j<nThisPatLength; ++j)
- pSearch = pTreeBox->GetEntry(pSearch, pThisPath[j]);
+ for (const sal_uInt32 nThisPath : rPaths)
+ pSearch = pTreeBox->GetEntry(pSearch, nThisPath);
m_aSelectedEntries.insert( pSearch );
}
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 6ee16148076a..cd0474fd5fad 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -83,6 +83,7 @@
#include <comphelper/evtmethodhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/property.hxx>
+#include <comphelper/sequence.hxx>
#include <comphelper/solarmutex.hxx>
#include <comphelper/string.hxx>
#include <comphelper/types.hxx>
@@ -398,44 +399,31 @@ namespace
Sequence< ScriptEventDescriptor> aTransferable(nMaxNewLen);
ScriptEventDescriptor* pTransferable = aTransferable.getArray();
- const ScriptEventDescriptor* pCurrent = rTransferIfAvailable.getConstArray();
- sal_Int32 i,j,k;
- for (i=0; i<rTransferIfAvailable.getLength(); ++i, ++pCurrent)
+ for (const ScriptEventDescriptor& rCurrent : rTransferIfAvailable)
{
// search the model/control idl classes for the event described by pCurrent
- for ( Sequence< Type>* pCurrentArray = &aModelListeners;
- pCurrentArray;
- pCurrentArray = (pCurrentArray == &aModelListeners) ? &aControlListeners : nullptr
- )
+ for (Sequence< Type>* pCurrentArray : { &aModelListeners, &aControlListeners })
{
- const Type* pCurrentListeners = pCurrentArray->getConstArray();
- for (j=0; j<pCurrentArray->getLength(); ++j, ++pCurrentListeners)
+ for (const Type& rCurrentListener : *pCurrentArray)
{
- OUString aListener = (*pCurrentListeners).getTypeName();
+ OUString aListener = rCurrentListener.getTypeName();
if (!aListener.isEmpty())
aListener = aListener.copy(aListener.lastIndexOf('.')+1);
- if (aListener == pCurrent->ListenerType)
+ if (aListener == rCurrent.ListenerType)
// the current ScriptEventDescriptor doesn't match the current listeners class
continue;
// now check the methods
- Sequence< OUString> aMethodsNames = ::comphelper::getEventMethodsForType(*pCurrentListeners);
+ Sequence< OUString> aMethodsNames = ::comphelper::getEventMethodsForType(rCurrentListener);
- const OUString* pMethodsNames = aMethodsNames.getConstArray();
- for (k=0; k<aMethodsNames.getLength(); ++k, ++pMethodsNames)
+ if (comphelper::findValue(aMethodsNames, rCurrent.EventMethod) != -1)
{
- if ((*pMethodsNames) != pCurrent->EventMethod)
- // the current ScriptEventDescriptor doesn't match the current listeners current method
- continue;
-
// we can transfer the script event : the model (control) supports it
- *pTransferable = *pCurrent;
+ *pTransferable = rCurrent;
++pTransferable;
break;
}
- if (k<aMethodsNames.getLength())
- break;
}
}
}
@@ -1213,18 +1201,12 @@ bool FmXFormShell::executeControlConversionSlot_Lock(const Reference<XFormCompon
Reference<XControlContainer> xControlContainer(getControlContainerForView_Lock());
Sequence< Reference< XControl> > aControls( xControlContainer->getControls() );
- const Reference< XControl>* pControls = aControls.getConstArray();
- sal_uInt32 nLen = aControls.getLength();
Reference< XControl> xControl;
- for (sal_uInt32 i=0 ; i<nLen; ++i)
- {
- if (pControls[i]->getModel() == xNewModel)
- {
- xControl = pControls[i];
- break;
- }
- }
+ auto pControl = std::find_if(aControls.begin(), aControls.end(),
+ [&xNewModel](const Reference< XControl>& rControl) { return rControl->getModel() == xNewModel; });
+ if (pControl != aControls.end())
+ xControl = *pControl;
TransferEventScripts(xNewModel, xControl, aOldScripts);
}
@@ -3358,27 +3340,26 @@ void FmXFormShell::CreateExternalView_Lock()
Reference< XPropertySetInfo> xControlModelInfo( xCurrentModelSet->getPropertySetInfo());
DBG_ASSERT(xControlModelInfo.is(), "FmXFormShell::CreateExternalView : the control model has no property info ! This will crash !");
aProps = xControlModelInfo->getProperties();
- const Property* pProps = aProps.getConstArray();
// realloc the control description sequence
sal_Int32 nExistentDescs = pColumnProps - aColumnProps.getArray();
aColumnProps.realloc(nExistentDescs + aProps.getLength());
pColumnProps = aColumnProps.getArray() + nExistentDescs;
- for (sal_Int32 i=0; i<aProps.getLength(); ++i, ++pProps)
+ for (const Property& rProp : aProps)
{
- if (pProps->Name == FM_PROP_LABEL)
+ if (rProp.Name == FM_PROP_LABEL)
// already set
continue;
- if (pProps->Name == FM_PROP_DEFAULTCONTROL)
+ if (rProp.Name == FM_PROP_DEFAULTCONTROL)
// allow the column's own "default control"
continue;
- if (pProps->Attributes & PropertyAttribute::READONLY)
+ if (rProp.Attributes & PropertyAttribute::READONLY)
// assume that properties which are readonly for the control are ro for the column to be created, too
continue;
- pColumnProps->Name = pProps->Name;
- pColumnProps->Value = xCurrentModelSet->getPropertyValue(pProps->Name);
+ pColumnProps->Name = rProp.Name;
+ pColumnProps->Value = xCurrentModelSet->getPropertyValue(rProp.Name);
++pColumnProps;
}
aColumnProps.realloc(pColumnProps - aColumnProps.getArray());
@@ -3530,10 +3511,8 @@ void FmXFormShell::Notify( const css::uno::Sequence< OUString >& _rPropertyNames
if (impl_checkDisposed_Lock())
return;
- const OUString* pSearch = _rPropertyNames.getConstArray();
- const OUString* pSearchTil = pSearch + _rPropertyNames.getLength();
- for (;pSearch < pSearchTil; ++pSearch)
- if (*pSearch == "FormControlPilotsEnabled")
+ for (const OUString& rName : _rPropertyNames)
+ if (rName == "FormControlPilotsEnabled")
{
implAdjustConfigCache_Lock();
InvalidateSlot_Lock(SID_FM_USE_WIZARDS, true);
diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx
index ae1803c9d85b..96e993b6527c 100644
--- a/svx/source/form/fmsrcimp.cxx
+++ b/svx/source/form/fmsrcimp.cxx
@@ -688,8 +688,6 @@ void FmSearchEngine::Init(const OUString& sVisibleFields)
DBG_ASSERT(xSupplyCols.is(), "FmSearchEngine::Init : invalid cursor (no columns supplier) !");
Reference< css::container::XNameAccess > xAllFieldNames = xSupplyCols->getColumns();
Sequence< OUString > seqFieldNames = xAllFieldNames->getElementNames();
- OUString* pFieldNames = seqFieldNames.getArray();
-
OUString sCurrentField;
sal_Int32 nIndex = 0;
@@ -699,16 +697,11 @@ void FmSearchEngine::Init(const OUString& sVisibleFields)
// search in the field collection
sal_Int32 nFoundIndex = -1;
- for (sal_Int32 j=0; j<seqFieldNames.getLength(); ++j, ++pFieldNames)
- {
- if ( 0 == m_aStringCompare.compareString( *pFieldNames, sCurrentField ) )
- {
- nFoundIndex = j;
- break;
- }
- }
- // set the field selection back to the first
- pFieldNames = seqFieldNames.getArray();
+ auto pFieldName = std::find_if(seqFieldNames.begin(), seqFieldNames.end(),
+ [this, &sCurrentField](const OUString& rFieldName) {
+ return 0 == m_aStringCompare.compareString( rFieldName, sCurrentField ); });
+ if (pFieldName != seqFieldNames.end())
+ nFoundIndex = static_cast<sal_Int32>(std::distance(seqFieldNames.begin(), pFieldName));
DBG_ASSERT(nFoundIndex != -1, "FmSearchEngine::Init : Invalid field name were given !");
m_arrFieldMapping.push_back(nFoundIndex);
}
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index 0076a59b36e5..15d36a0e82f3 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -1075,12 +1075,9 @@ namespace svx
m_aControlObservers.resize( 0 );
m_aControlObservers.reserve( aControls.getLength() );
- const Reference< css::awt::XControl >* pControls = aControls.getConstArray();
- const Reference< css::awt::XControl >* pControlsEnd = pControls + aControls.getLength();
- for ( ; pControls != pControlsEnd; ++pControls )
- {
- m_aControlObservers.push_back( FocusListenerAdapter( new FmFocusListenerAdapter( *pControls, this ) ) );
- }
+ std::transform(aControls.begin(), aControls.end(), std::back_inserter(m_aControlObservers),
+ [this](const Reference< css::awt::XControl >& rControl) -> FocusListenerAdapter {
+ return FocusListenerAdapter( new FmFocusListenerAdapter( rControl, this ) ); });
}
catch( const Exception& )
{
diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx
index f0fc654b504b..5f7cbedef8f4 100644
--- a/svx/source/form/formcontrolfactory.cxx
+++ b/svx/source/form/formcontrolfactory.cxx
@@ -525,16 +525,10 @@ namespace svxform
// has a setting for the preferred line end format
bool bDosLineEnds = false;
Sequence< PropertyValue > aInfo = lcl_getDataSourceIndirectProperties( _rxModel, m_pData->m_xContext );
- const PropertyValue* pInfo = aInfo.getConstArray();
- const PropertyValue* pInfoEnd = pInfo + aInfo.getLength();
- for ( ; pInfo != pInfoEnd; ++pInfo )
- {
- if ( pInfo->Name == "PreferDosLikeLineEnds" )
- {
- pInfo->Value >>= bDosLineEnds;
- break;
- }
- }
+ const PropertyValue* pInfo = std::find_if(aInfo.begin(), aInfo.end(),
+ [](const PropertyValue& rInfo) { return rInfo.Name == "PreferDosLikeLineEnds"; });
+ if (pInfo != aInfo.end())
+ pInfo->Value >>= bDosLineEnds;
sal_Int16 nLineEndFormat = bDosLineEnds ? LineEndFormat::CARRIAGE_RETURN_LINE_FEED : LineEndFormat::LINE_FEED;
_rxModel->setPropertyValue( FM_PROP_LINEENDFORMAT, makeAny( nLineEndFormat ) );
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index c1d71eaed344..1dc951452899 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -1273,16 +1273,13 @@ bool FormController::replaceControl( const Reference< XControl >& _rxExistentCon
{
// look up the ID of _rxExistentControl
Sequence< sal_Int32 > aIdentifiers( xContainer->getIdentifiers() );
- const sal_Int32* pIdentifiers = aIdentifiers.getConstArray();
- const sal_Int32* pIdentifiersEnd = aIdentifiers.getConstArray() + aIdentifiers.getLength();
- for ( ; pIdentifiers != pIdentifiersEnd; ++pIdentifiers )
- {
- Reference< XControl > xCheck( xContainer->getByIdentifier( *pIdentifiers ), UNO_QUERY );
- if ( xCheck == _rxExistentControl )
- break;
- }
- DBG_ASSERT( pIdentifiers != pIdentifiersEnd, "FormController::replaceControl: did not find the control in the container!" );
- if ( pIdentifiers != pIdentifiersEnd )
+ const sal_Int32* pIdentifiers = std::find_if(aIdentifiers.begin(), aIdentifiers.end(),
+ [&xContainer, &_rxExistentControl](const sal_Int32 nId) {
+ Reference< XControl > xCheck( xContainer->getByIdentifier( nId ), UNO_QUERY );
+ return xCheck == _rxExistentControl;
+ });
+ DBG_ASSERT( pIdentifiers != aIdentifiers.end(), "FormController::replaceControl: did not find the control in the container!" );
+ if ( pIdentifiers != aIdentifiers.end() )
{
bool bReplacedWasActive = ( m_xActiveControl.get() == _rxExistentControl.get() );
bool bReplacedWasCurrent = ( m_xCurrentControl.get() == _rxExistentControl.get() );
@@ -1988,10 +1985,8 @@ void FormController::setContainer(const Reference< XControlContainer > & xContai
m_aFilterComponents.clear();
// collecting the controls
- const Reference< XControl >* pControls = m_aControls.getConstArray();
- const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
- while ( pControls != pControlsEnd )
- implControlRemoved( *pControls++, true );
+ for ( const Reference< XControl >& rControl : m_aControls )
+ implControlRemoved( rControl, true );
// make database-specific things
if (m_bDBConnection && isListeningForChanges())
@@ -2007,7 +2002,6 @@ void FormController::setContainer(const Reference< XControlContainer > & xContai
if (xContainer.is() && xTabModel.is())
{
Sequence< Reference< XControlModel > > aModels = xTabModel->getControlModels();
- const Reference< XControlModel > * pModels = aModels.getConstArray();
Sequence< Reference< XControl > > aAllControls = xContainer->getControls();
sal_Int32 nCount = aModels.getLength();
@@ -2015,10 +2009,10 @@ void FormController::setContainer(const Reference< XControlContainer > & xContai
Reference< XControl > * pControls = m_aControls.getArray();
// collecting the controls
- sal_Int32 i, j;
- for (i = 0, j = 0; i < nCount; ++i, ++pModels )
+ sal_Int32 j = 0;
+ for (const Reference< XControlModel >& rModel : aModels )
{
- Reference< XControl > xControl = findControl( aAllControls, *pModels, false, true );
+ Reference< XControl > xControl = findControl( aAllControls, rModel, false, true );
if ( xControl.is() )
{
pControls[j++] = xControl;
@@ -2027,7 +2021,7 @@ void FormController::setContainer(const Reference< XControlContainer > & xContai
}
// not every model had an associated control
- if (j != i)
+ if (j != nCount)
m_aControls.realloc(j);
// listen at the container
@@ -2073,7 +2067,6 @@ Sequence< Reference< XControl > > FormController::getControls()
return m_aControls;
Sequence< Reference< XControlModel > > aControlModels = xModel->getControlModels();
- const Reference< XControlModel > * pModels = aControlModels.getConstArray();
sal_Int32 nModels = aControlModels.getLength();
Sequence< Reference< XControl > > aNewControls(nModels);
@@ -2083,9 +2076,9 @@ Sequence< Reference< XControl > > FormController::getControls()
// rearrange the controls according to the tab order sequence
sal_Int32 j = 0;
- for (sal_Int32 i = 0; i < nModels; ++i, ++pModels )
+ for ( const Reference< XControlModel >& rModel : aControlModels )
{
- xControl = findControl( m_aControls, *pModels, true, true );
+ xControl = findControl( m_aControls, rModel, true, true );
if ( xControl.is() )
pControls[j++] = xControl;
}
@@ -2182,10 +2175,8 @@ void FormController::setLocks()
{
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
// lock/unlock all controls connected to a data source
- const Reference< XControl >* pControls = m_aControls.getConstArray();
- const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
- while ( pControls != pControlsEnd )
- setControlLock( *pControls++ );
+ for ( const Reference< XControl >& rControl : m_aControls )
+ setControlLock( rControl );
}
@@ -2322,10 +2313,8 @@ void FormController::startListening()
m_bModified = false;
// now register at bound fields
- const Reference< XControl >* pControls = m_aControls.getConstArray();
- const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
- while ( pControls != pControlsEnd )
- startControlModifyListening( *pControls++ );
+ for ( const Reference< XControl >& rControl : m_aControls )
+ startControlModifyListening( rControl );
}
@@ -2335,10 +2324,8 @@ void FormController::stopListening()
m_bModified = false;
// now register at bound fields
- const Reference< XControl >* pControls = m_aControls.getConstArray();
- const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
- while ( pControls != pControlsEnd )
- stopControlModifyListening( *pControls++ );
+ for ( const Reference< XControl >& rControl : m_aControls )
+ stopControlModifyListening( rControl );
}
@@ -2347,23 +2334,20 @@ Reference< XControl > FormController::findControl(Sequence< Reference< XControl
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
DBG_ASSERT( xCtrlModel.is(), "findControl - which ?!" );
- Reference< XControl >* pControls = _rControls.getArray();
- Reference< XControlModel > xModel;
- for ( sal_Int32 i = 0, nCount = _rControls.getLength(); i < nCount; ++i, ++pControls )
+ Reference< XControl >* pControls = std::find_if(_rControls.begin(), _rControls.end(),
+ [&xCtrlModel](const Reference< XControl >& rControl) {
+ return rControl.is() && rControl->getModel().get() == xCtrlModel.get(); });
+ if (pControls != _rControls.end())
{
- if ( pControls->is() )
+ Reference< XControl > xControl( *pControls );
+ if ( _bRemove )
{
- xModel = (*pControls)->getModel();
- if ( xModel.get() == xCtrlModel.get() )
- {
- Reference< XControl > xControl( *pControls );
- if ( _bRemove )
- ::comphelper::removeElementAt( _rControls, i );
- else if ( _bOverWrite )
- pControls->clear();
- return xControl;
- }
+ auto i = static_cast<sal_Int32>(std::distance(_rControls.begin(), pControls));
+ ::comphelper::removeElementAt( _rControls, i );
}
+ else if ( _bOverWrite )
+ pControls->clear();
+ return xControl;
}
return Reference< XControl > ();
}
@@ -2479,15 +2463,12 @@ void FormController::insertControl(const Reference< XControl > & xControl)
void FormController::removeControl(const Reference< XControl > & xControl)
{
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
- const Reference< XControl >* pControls = m_aControls.getConstArray();
- const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
- while ( pControls != pControlsEnd )
+ auto pControl = std::find_if(m_aControls.begin(), m_aControls.end(),
+ [&xControl](const Reference< XControl >& rControl) { return xControl.get() == rControl.get(); });
+ if (pControl != m_aControls.end())
{
- if ( xControl.get() == (*pControls++).get() )
- {
- ::comphelper::removeElementAt( m_aControls, pControls - m_aControls.getConstArray() - 1 );
- break;
- }
+ auto nIndex = static_cast<sal_Int32>(std::distance(m_aControls.begin(), pControl));
+ ::comphelper::removeElementAt( m_aControls, nIndex );
}
FilterComponents::iterator componentPos = ::std::find( m_aFilterComponents.begin(), m_aFilterComponents.end(), xControl );
@@ -2654,11 +2635,9 @@ void FormController::unload()
void FormController::removeBoundFieldListener()
{
- const Reference< XControl >* pControls = m_aControls.getConstArray();
- const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
- while ( pControls != pControlsEnd )
+ for ( const Reference< XControl >& rControl : m_aControls )
{
- Reference< XPropertySet > xProp( *pControls++, UNO_QUERY );
+ Reference< XPropertySet > xProp( rControl, UNO_QUERY );
if ( xProp.is() )
xProp->removePropertyChangeListener( FM_PROP_BOUNDFIELD, this );
}
@@ -3064,14 +3043,12 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
"svx.form", "FormController::setFilter: wrong cast of decimal separator to sal_Char!");
// retrieving the filter
- const Sequence < PropertyValue >* pRow = aFilterRows.getConstArray();
- for (sal_Int32 i = 0, nLen = aFilterRows.getLength(); i < nLen; ++i)
+ for (const Sequence < PropertyValue >& rRow : aFilterRows)
{
FmFilterRow aRow;
// search a field for the given name
- const PropertyValue* pRefValues = pRow[i].getConstArray();
- for (sal_Int32 j = 0, nLen1 = pRow[i].getLength(); j < nLen1; j++)
+ for (const PropertyValue& rRefValue : rRow)
{
// look for the text component
Reference< XPropertySet > xField;
@@ -3081,15 +3058,15 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
OUString aRealName;
// first look with the given name
- if (xQueryColumns->hasByName(pRefValues[j].Name))
+ if (xQueryColumns->hasByName(rRefValue.Name))
{
- xQueryColumns->getByName(pRefValues[j].Name) >>= xSet;
+ xQueryColumns->getByName(rRefValue.Name) >>= xSet;
// get the RealName
xSet->getPropertyValue("RealName") >>= aRealName;
// compare the condition field name and the RealName
- if (aCompare(aRealName, pRefValues[j].Name))
+ if (aCompare(aRealName, rRefValue.Name))
xField = xSet;
}
if (!xField.is())
@@ -3100,7 +3077,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
{
xColumnsByIndex->getByIndex(n) >>= xSet;
xSet->getPropertyValue("RealName") >>= aRealName;
- if (aCompare(aRealName, pRefValues[j].Name))
+ if (aCompare(aRealName, rRefValue.Name))
{
// get the column by its alias
xField = xSet;
@@ -3130,18 +3107,18 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
OString aVal = m_pParser->getContext().getIntlKeywordAscii(IParseContext::InternationalKeyCode::And);
aCompText += OUString(aVal.getStr(),aVal.getLength(),RTL_TEXTENCODING_ASCII_US);
aCompText += " ";
- aCompText += ::comphelper::getString(pRefValues[j].Value);
+ aCompText += ::comphelper::getString(rRefValue.Value);
aRow[rFieldInfo.xText] = aCompText;
}
else
{
OUString sPredicate,sErrorMsg;
- pRefValues[j].Value >>= sPredicate;
+ rRefValue.Value >>= sPredicate;
std::shared_ptr< OSQLParseNode > pParseNode = predicateTree(sErrorMsg, sPredicate, xFormatter, xField);
if ( pParseNode != nullptr )
{
OUString sCriteria;
- switch (pRefValues[j].Handle)
+ switch (rRefValue.Handle)
{
case css::sdb::SQLFilterOperator::EQUAL:
sCriteria += "=";
@@ -3482,13 +3459,7 @@ sal_Bool SAL_CALL FormController::supportsMode(const OUString& Mode)
impl_checkDisposed_throw();
Sequence< OUString > aModes(getSupportedModes());
- const OUString* pModes = aModes.getConstArray();
- for (sal_Int32 i = aModes.getLength(); i > 0; )
- {
- if (pModes[--i] == Mode)
- return true;
- }
- return false;
+ return comphelper::findValue(aModes, Mode) != -1;
}
diff --git a/svx/source/form/formdispatchinterceptor.cxx b/svx/source/form/formdispatchinterceptor.cxx
index e5d1d9de826a..85f33b8e87d7 100644
--- a/svx/source/form/formdispatchinterceptor.cxx
+++ b/svx/source/form/formdispatchinterceptor.cxx
@@ -91,12 +91,9 @@ namespace svxform
{
::osl::MutexGuard aGuard( *m_pMutex );
Sequence< Reference< XDispatch> > aReturn(aDescripts.getLength());
- Reference< XDispatch>* pReturn = aReturn.getArray();
- const DispatchDescriptor* pDescripts = aDescripts.getConstArray();
- for (sal_Int32 i=0; i<aDescripts.getLength(); ++i, ++pReturn, ++pDescripts)
- {
- *pReturn = queryDispatch(pDescripts->FeatureURL, pDescripts->FrameName, pDescripts->SearchFlags);
- }
+ std::transform(aDescripts.begin(), aDescripts.end(), aReturn.begin(),
+ [this](const DispatchDescriptor& rDescript) -> Reference< XDispatch> {
+ return queryDispatch(rDescript.FeatureURL, rDescript.FrameName, rDescript.SearchFlags); });
return aReturn;
}
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index 5620c9ffdea5..fd8fe32c4628 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -90,18 +90,16 @@ struct ColumnInfo
static void lcl_addToList( SvTreeListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns )
{
uno::Sequence< OUString > aEntries = i_xColumns->getElementNames();
- const OUString* pEntries = aEntries.getConstArray();
- sal_Int32 nEntries = aEntries.getLength();
- for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
+ for ( const OUString& rEntry : aEntries )
{
- uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(rEntry),UNO_QUERY_THROW);
OUString sLabel;
if ( xColumn->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) )
xColumn->getPropertyValue(FM_PROP_LABEL) >>= sLabel;
if ( !sLabel.isEmpty() )
- _rListBox.InsertEntry( sLabel, nullptr, false, TREELIST_APPEND, new ColumnInfo(*pEntries) );
+ _rListBox.InsertEntry( sLabel, nullptr, false, TREELIST_APPEND, new ColumnInfo(rEntry) );
else
- _rListBox.InsertEntry( *pEntries, nullptr, false, TREELIST_APPEND, new ColumnInfo(*pEntries) );
+ _rListBox.InsertEntry( rEntry, nullptr, false, TREELIST_APPEND, new ColumnInfo(rEntry) );
}
}
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 02e1fa525e4f..f35d4b5c535c 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -193,11 +193,11 @@ void SAL_CALL GalleryThemePopup::statusChanged(
}
else if ( ( rEvent.State >>= sItems ) && sItems.hasElements() )
{
- const OUString *pStr = sItems.getConstArray();
- const OUString *pEnd = pStr + sItems.getLength();
- for ( sal_uInt16 nId = 1; pStr != pEnd; pStr++, nId++ )
+ sal_uInt16 nId = 1;
+ for ( const OUString& rStr : sItems )
{
- mpBackgroundPopup->InsertItem( nId, *pStr );
+ mpBackgroundPopup->InsertItem( nId, rStr );
+ nId++;
}
}
}
diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx
index 4e69d4c207cc..095aa6cec868 100644
--- a/svx/source/items/customshapeitem.cxx
+++ b/svx/source/items/customshapeitem.cxx
@@ -226,9 +226,9 @@ void SdrCustomShapeGeometryItem::ClearPropertyValue( const OUString& rPropName )
{
PropertyHashMap::iterator aHashIter2( aPropHashMap.find( aPropSeq[ nLength - 1 ].Name ) );
(*aHashIter2).second = nIndex;
- aPropSeq[ (*aHashIter).second ] = aPropSeq[ aPropSeq.getLength() - 1 ];
+ aPropSeq[ nIndex ] = aPropSeq[ nLength - 1 ];
}
- aPropSeq.realloc( aPropSeq.getLength() - 1 );
+ aPropSeq.realloc( nLength - 1 );
}
aPropHashMap.erase( aHashIter ); // removing property from hashmap
}
@@ -276,24 +276,22 @@ bool SdrCustomShapeGeometryItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMe
{
if ( ! ( rVal >>= aPropSeq ) )
return false;
- else
+
+ for (sal_Int32 i = 0; i < aPropSeq.getLength(); ++i)
{
- for (sal_Int32 i = 0; i < aPropSeq.getLength(); ++i)
+ const auto& rName = aPropSeq[i].Name;
+ bool isDuplicated = std::any_of(std::next(aPropSeq.begin(), i + 1), aPropSeq.end(),
+ [&rName](const css::beans::PropertyValue& rProp) { return rProp.Name == rName; });
+ if (isDuplicated)
{
- for (sal_Int32 j = i+1; j < aPropSeq.getLength(); ++j)
- {
- if (aPropSeq[i].Name == aPropSeq[j].Name)
- {
- assert(false); // serious bug: duplicate xml attribute exported
- OUString const name(aPropSeq[i].Name);
- aPropSeq.realloc(0);
- throw uno::RuntimeException(
- "CustomShapeGeometry has duplicate property " + name);
- }
- }
+ assert(false); // serious bug: duplicate xml attribute exported
+ OUString const name(aPropSeq[i].Name);
+ aPropSeq.realloc(0);
+ throw uno::RuntimeException(
+ "CustomShapeGeometry has duplicate property " + name);
}
- return true;
}
+ return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/galleryitem.cxx b/svx/source/items/galleryitem.cxx
index 57edacf907e1..56d1de655c34 100644
--- a/svx/source/items/galleryitem.cxx
+++ b/svx/source/items/galleryitem.cxx
@@ -80,33 +80,31 @@ bool SvxGalleryItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /* nMemberId
css::uno::Reference< css::lang::XComponent > xDrawing;
css::uno::Reference< css::graphic::XGraphic > xGraphic;
- const css::beans::PropertyValue *pProp = aSeq.getConstArray();
- const css::beans::PropertyValue *pEnd = pProp + aSeq.getLength();
- for ( ; pProp != pEnd; pProp++ )
+ for ( const css::beans::PropertyValue& rProp : aSeq )
{
- if ( pProp->Name == SVXGALLERYITEM_TYPE )
+ if ( rProp.Name == SVXGALLERYITEM_TYPE )
{
- bAllConverted &= ( pProp->Value >>= nType );
+ bAllConverted &= ( rProp.Value >>= nType );
++nConverted;
}
- else if ( pProp->Name == SVXGALLERYITEM_URL )
+ else if ( rProp.Name == SVXGALLERYITEM_URL )
{
- bAllConverted &= ( pProp->Value >>= aURL );
+ bAllConverted &= ( rProp.Value >>= aURL );
++nConverted;
}
- else if ( pProp->Name == SVXGALLERYITEM_FILTER )
+ else if ( rProp.Name == SVXGALLERYITEM_FILTER )
{
- bAllConverted &= ( pProp->Value >>= aFilterName );
+ bAllConverted &= ( rProp.Value >>= aFilterName );
++nConverted;
}
- else if ( pProp->Name == SVXGALLERYITEM_DRAWING )
+ else if ( rProp.Name == SVXGALLERYITEM_DRAWING )
{
- bAllConverted &= ( pProp->Value >>= xDrawing );
+ bAllConverted &= ( rProp.Value >>= xDrawing );
++nConverted;
}
- else if ( pProp->Name == SVXGALLERYITEM_GRAPHIC )
+ else if ( rProp.Name == SVXGALLERYITEM_GRAPHIC )
{
- bAllConverted &= ( pProp->Value >>= xGraphic );
+ bAllConverted &= ( rProp.Value >>= xGraphic );
++nConverted;
}
}
diff --git a/svx/source/items/viewlayoutitem.cxx b/svx/source/items/viewlayoutitem.cxx
index 6578a1cea898..0d4f714f6104 100644
--- a/svx/source/items/viewlayoutitem.cxx
+++ b/svx/source/items/viewlayoutitem.cxx
@@ -113,16 +113,16 @@ bool SvxViewLayoutItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId
bool bBookMode = false;
bool bAllConverted( true );
sal_Int16 nConvertedCount( 0 );
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ for ( const auto& rProp : aSeq )
{
- if ( aSeq[i].Name == VIEWLAYOUT_PARAM_COLUMNS )
+ if ( rProp.Name == VIEWLAYOUT_PARAM_COLUMNS )
{
- bAllConverted &= ( aSeq[i].Value >>= nColumns );
+ bAllConverted &= ( rProp.Value >>= nColumns );
++nConvertedCount;
}
- else if ( aSeq[i].Name == VIEWLAYOUT_PARAM_BOOKMODE )
+ else if ( rProp.Name == VIEWLAYOUT_PARAM_BOOKMODE )
{
- bAllConverted &= ( aSeq[i].Value >>= bBookMode );
+ bAllConverted &= ( rProp.Value >>= bBookMode );
++nConvertedCount;
}
}
diff --git a/svx/source/items/zoomslideritem.cxx b/svx/source/items/zoomslideritem.cxx
index 67e40294c448..faeeb67a7bb4 100644
--- a/svx/source/items/zoomslideritem.cxx
+++ b/svx/source/items/zoomslideritem.cxx
@@ -121,26 +121,26 @@ bool SvxZoomSliderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId
sal_Int16 nConvertedCount( 0 );
sal_Int32 nMinZoom( 0 ), nMaxZoom( 0 );
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ for ( const auto& rProp : aSeq )
{
- if ( aSeq[i].Name == ZOOMSLIDER_PARAM_CURRENTZOOM )
+ if ( rProp.Name == ZOOMSLIDER_PARAM_CURRENTZOOM )
{
- bAllConverted &= ( aSeq[i].Value >>= nCurrentZoom );
+ bAllConverted &= ( rProp.Value >>= nCurrentZoom );
++nConvertedCount;
}
- else if ( aSeq[i].Name == ZOOMSLIDER_PARAM_SNAPPINGPOINTS )
+ else if ( rProp.Name == ZOOMSLIDER_PARAM_SNAPPINGPOINTS )
{
- bAllConverted &= ( aSeq[i].Value >>= aValues );
+ bAllConverted &= ( rProp.Value >>= aValues );
++nConvertedCount;
}
- else if( aSeq[i].Name == ZOOMSLIDER_PARAM_MINZOOM )
+ else if( rProp.Name == ZOOMSLIDER_PARAM_MINZOOM )
{
- bAllConverted &= ( aSeq[i].Value >>= nMinZoom );
+ bAllConverted &= ( rProp.Value >>= nMinZoom );
++nConvertedCount;
}
- else if( aSeq[i].Name == ZOOMSLIDER_PARAM_MAXZOOM )
+ else if( rProp.Name == ZOOMSLIDER_PARAM_MAXZOOM )
{
- bAllConverted &= ( aSeq[i].Value >>= nMaxZoom );
+ bAllConverted &= ( rProp.Value >>= nMaxZoom );
++nConvertedCount;
}
}
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 9b36547ae5b1..082bb29d81e7 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -97,26 +97,25 @@ const sal_Unicode aDefaultBulletTypes[] =
NumSettings_Impl* lcl_CreateNumberingSettingsPtr(const Sequence<PropertyValue>& rLevelProps)
{
- const PropertyValue* pValues = rLevelProps.getConstArray();
NumSettings_Impl* pNew = new NumSettings_Impl;
- for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++)
+ for(const PropertyValue& rValue : rLevelProps)
{
- if(pValues[j].Name == "NumberingType")
+ if(rValue.Name == "NumberingType")
{
sal_Int16 nTmp;
- if (pValues[j].Value >>= nTmp)
+ if (rValue.Value >>= nTmp)
pNew->nNumberType = static_cast<SvxNumType>(nTmp);
}
- else if(pValues[j].Name == "Prefix")
- pValues[j].Value >>= pNew->sPrefix;
- else if(pValues[j].Name == "Suffix")
- pValues[j].Value >>= pNew->sSuffix;
- else if(pValues[j].Name == "ParentNumbering")
- pValues[j].Value >>= pNew->nParentNumbering;
- else if(pValues[j].Name == "BulletChar")
- pValues[j].Value >>= pNew->sBulletChar;
- else if(pValues[j].Name == "BulletFontName")
- pValues[j].Value >>= pNew->sBulletFont;
+ else if(rValue.Name == "Prefix")
+ rValue.Value >>= pNew->sPrefix;
+ else if(rValue.Name == "Suffix")
+ rValue.Value >>= pNew->sSuffix;
+ else if(rValue.Name == "ParentNumbering")
+ rValue.Value >>= pNew->nParentNumbering;
+ else if(rValue.Name == "BulletChar")
+ rValue.Value >>= pNew->sBulletChar;
+ else if(rValue.Name == "BulletFontName")
+ rValue.Value >>= pNew->sBulletFont;
}
const sal_Unicode cLocalPrefix = pNew->sPrefix.getLength() ? pNew->sPrefix[0] : 0;
const sal_Unicode cLocalSuffix = pNew->sSuffix.getLength() ? pNew->sSuffix[0] : 0;
@@ -597,9 +596,8 @@ void OutlineTypeMgr::Init()
10, false,
SvxNumRuleType::NUMBERING, SvxNumberFormat::LABEL_ALIGNMENT);
- for(sal_Int32 nItem = 0;
- nItem < aOutlineAccess.getLength() && nItem < DEFAULT_NUM_VALUSET_COUNT;
- nItem++ )
+ auto nSize = std::min<sal_Int32>(aOutlineAccess.getLength(), DEFAULT_NUM_VALUSET_COUNT);
+ for(sal_Int32 nItem = 0; nItem < nSize; nItem++ )
{
pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl;
OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ];
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx
index 2c95e074205b..be65e6d0fff7 100644
--- a/svx/source/smarttags/SmartTagMgr.cxx
+++ b/svx/source/smarttags/SmartTagMgr.cxx
@@ -299,15 +299,13 @@ void SmartTagMgr::changesOccurred( const util::ChangesEvent& rEvent )
{
SolarMutexGuard aGuard;
- const util::ElementChange* pElementChanges = rEvent.Changes.getConstArray();
- const sal_Int32 nNumberOfChanges = rEvent.Changes.getLength();
bool bExcludedTypes = false;
bool bRecognize = false;
- for( sal_Int32 i = 0; i < nNumberOfChanges; ++i)
+ for( const util::ElementChange& rElementChange : rEvent.Changes)
{
OUString sTemp;
- pElementChanges[i].Accessor >>= sTemp;
+ rElementChange.Accessor >>= sTemp;
if ( sTemp == "ExcludedSmartTagTypes" )
bExcludedTypes = true;
@@ -433,10 +431,8 @@ void SmartTagMgr::ReadConfiguration( bool bExcludedTypes, bool bRecognize )
Sequence< OUString > aValues;
aAny >>= aValues;
- const sal_Int32 nValues = aValues.getLength();
-
- for ( sal_Int32 nI = 0; nI < nValues; ++nI )
- maDisabledSmartTagTypes.insert( aValues[nI] );
+ for ( const auto& rValue : aValues )
+ maDisabledSmartTagTypes.insert( rValue );
}
if ( bRecognize )
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index 1c973028dde2..57c89097e427 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -196,9 +196,8 @@ void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eStat
// get all snapping points:
std::set< sal_uInt16 > aTmpSnappingPoints;
- for ( sal_Int32 j = 0; j < rSnappingPoints.getLength(); ++j )
+ for ( const sal_Int32 nSnappingPoint : rSnappingPoints )
{
- const sal_Int32 nSnappingPoint = rSnappingPoints[j];
aTmpSnappingPoints.insert( static_cast<sal_uInt16>(nSnappingPoint) );
}
diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx
index b513aee214dd..9762801c5224 100644
--- a/svx/source/table/accessiblecell.cxx
+++ b/svx/source/table/accessiblecell.cxx
@@ -230,18 +230,14 @@ Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet()
{
css::uno::Reference<XAccessibleStateSet> rState =
xTempAccContext->getAccessibleStateSet();
- if( rState.is() ) {
+ if( rState.is() )
+ {
css::uno::Sequence<short> aStates = rState->getStates();
- int count = aStates.getLength();
- for( int iIndex = 0;iIndex < count;iIndex++ )
+ if (std::find(aStates.begin(), aStates.end(), AccessibleStateType::EDITABLE) != aStates.end())
{
- if( aStates[iIndex] == AccessibleStateType::EDITABLE )
- {
- pStateSet->AddState (AccessibleStateType::EDITABLE);
- pStateSet->AddState (AccessibleStateType::RESIZABLE);
- pStateSet->AddState (AccessibleStateType::MOVEABLE);
- break;
- }
+ pStateSet->AddState (AccessibleStateType::EDITABLE);
+ pStateSet->AddState (AccessibleStateType::RESIZABLE);
+ pStateSet->AddState (AccessibleStateType::MOVEABLE);
}
}
}
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 10b5a9d073a3..c81b56818989 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -1325,16 +1325,14 @@ Sequence< Any > SAL_CALL Cell::getPropertyValues( const Sequence< OUString >& aP
throw DisposedException();
const sal_Int32 nCount = aPropertyNames.getLength();
- const OUString* pNames = aPropertyNames.getConstArray();
-
Sequence< Any > aRet( nCount );
Any* pValue = aRet.getArray();
- for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
+ for( const OUString& rName : aPropertyNames )
{
try
{
- *pValue = getPropertyValue( *pNames );
+ *pValue = getPropertyValue( rName );
}
catch( UnknownPropertyException& )
{
@@ -1344,6 +1342,7 @@ Sequence< Any > SAL_CALL Cell::getPropertyValues( const Sequence< OUString >& aP
{
OSL_FAIL( "svx::Cell::getPropertyValues(), Exception caught!" );
}
+ pValue++;
}
return aRet;
@@ -1479,23 +1478,19 @@ Sequence< PropertyState > SAL_CALL Cell::getPropertyStates( const Sequence< OUSt
throw DisposedException();
const sal_Int32 nCount = aPropertyName.getLength();
-
Sequence< PropertyState > aRet( nCount );
- const OUString* pNames = aPropertyName.getConstArray();
- PropertyState* pState = aRet.getArray();
-
- for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pState++ )
- {
- try
- {
- *pState = getPropertyState( *pNames );
- }
- catch( Exception& )
- {
- *pState = PropertyState_AMBIGUOUS_VALUE;
- }
- }
+ std::transform(aPropertyName.begin(), aPropertyName.end(), aRet.begin(),
+ [this](const OUString& rName) -> PropertyState {
+ try
+ {
+ return getPropertyState( rName );
+ }
+ catch( Exception& )
+ {
+ return PropertyState_AMBIGUOUS_VALUE;
+ }
+ });
return aRet;
}
@@ -1615,11 +1610,8 @@ void SAL_CALL Cell::setAllPropertiesToDefault()
void SAL_CALL Cell::setPropertiesToDefault( const Sequence< OUString >& aPropertyNames )
{
- sal_Int32 nCount = aPropertyNames.getLength();
- const OUString* pName = aPropertyNames.getConstArray();
-
- while(nCount--)
- setPropertyToDefault( *pName++ );
+ for(const OUString& rName : aPropertyNames)
+ setPropertyToDefault( rName );
}
@@ -1627,11 +1619,9 @@ Sequence< Any > SAL_CALL Cell::getPropertyDefaults( const Sequence< OUString >&
{
sal_Int32 nCount = aPropertyNames.getLength();
Sequence< Any > aDefaults( nCount );
- Any* pDefaults = aDefaults.getArray();
- const OUString* pName = aPropertyNames.getConstArray();
- while(nCount--)
- *pDefaults++ = getPropertyDefault( *pName++ );
+ std::transform(aPropertyNames.begin(), aPropertyNames.end(), aDefaults.begin(),
+ [this](const OUString& rName) -> Any { return getPropertyDefault(rName); });
return aDefaults;
}
diff --git a/svx/source/table/propertyset.cxx b/svx/source/table/propertyset.cxx
index ea707762eead..5a59e40143f1 100644
--- a/svx/source/table/propertyset.cxx
+++ b/svx/source/table/propertyset.cxx
@@ -146,15 +146,13 @@ void SAL_CALL FastPropertySet::removeVetoableChangeListener( const OUString&, co
void SAL_CALL FastPropertySet::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues )
{
- const OUString* pPropertyNames = aPropertyNames.getConstArray();
- const Any* pValues = aValues.getConstArray();
- sal_Int32 nCount = aPropertyNames.getLength();
- if( nCount != aValues.getLength() )
+ if( aPropertyNames.getLength() != aValues.getLength() )
throw IllegalArgumentException();
- while( nCount-- )
+ const Any* pValues = aValues.getConstArray();
+ for( const OUString& rPropertyName : aPropertyNames )
{
- const Property* pProperty = mxInfo->hasProperty( *pPropertyNames++ );
+ const Property* pProperty = mxInfo->hasProperty( rPropertyName );
if( pProperty ) try
{
setFastPropertyValue( pProperty->Handle, *pValues );
@@ -172,11 +170,10 @@ Sequence< Any > SAL_CALL FastPropertySet::getPropertyValues( const Sequence< OUS
sal_Int32 nCount = aPropertyNames.getLength();
Sequence< Any > aValues( nCount );
- const OUString* pPropertyNames = aPropertyNames.getConstArray();
Any* pValues = aValues.getArray();
- while( nCount-- )
+ for( const OUString& rPropertyName : aPropertyNames )
{
- const Property* pProperty = mxInfo->hasProperty( *pPropertyNames++ );
+ const Property* pProperty = mxInfo->hasProperty( rPropertyName );
if( pProperty ) try
{
*pValues = getFastPropertyValue( pProperty->Handle );
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 0b3b80b5449d..0d948d66fdf9 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -1401,8 +1401,9 @@ css::uno::Sequence < css::uno::Reference< css::frame::XDispatch > > SAL_CALL Fin
sal_Int32 nCount = seqDescripts.getLength();
css::uno::Sequence < css::uno::Reference < XDispatch > > lDispatcher( nCount );
- for( sal_Int32 i=0; i<nCount; ++i )
- lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags );
+ std::transform(seqDescripts.begin(), seqDescripts.end(), lDispatcher.begin(),
+ [this](const css::frame::DispatchDescriptor& rDescript) -> css::uno::Reference < XDispatch > {
+ return queryDispatch( rDescript.FeatureURL, rDescript.FrameName, rDescript.SearchFlags ); });
return lDispatcher;
}
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
index 8e476a550609..b0046aeeca9d 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -121,16 +121,14 @@ void DictionaryList::refillFromDictionary( sal_Int32 nTextConversionOptions )
return;
Sequence< OUString > aLeftList( m_xDictionary->getConversionEntries( linguistic2::ConversionDirection_FROM_LEFT ) );
- sal_Int32 nCount = aLeftList.getLength();
Reference< linguistic2::XConversionPropertyType > xPropertyType( m_xDictionary, uno::UNO_QUERY );
- OUString aLeft, aRight;
+ OUString aRight;
sal_Int16 nConversionPropertyType;
- for(sal_Int32 nN=0; nN<nCount; nN++)
+ for(const OUString& aLeft : aLeftList)
{
- aLeft = aLeftList[nN];
Sequence< OUString > aRightList( m_xDictionary->getConversions(
aLeft, 0, aLeft.getLength()
, linguistic2::ConversionDirection_FROM_LEFT, nTextConversionOptions ) );
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
index 004f5957f9d4..d4231e33174e 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -94,11 +94,10 @@ void SAL_CALL ChineseTranslation_UnoDialog::initialize( const uno::Sequence< uno
if( m_bDisposed || m_bInDispose )
return;
- const uno::Any* pArguments = aArguments.getConstArray();
- for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
+ for(const uno::Any& rArgument : aArguments)
{
beans::PropertyValue aProperty;
- if(*pArguments >>= aProperty)
+ if(rArgument >>= aProperty)
{
if( aProperty.Name == "ParentWindow" )
{
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index d979523e6d1b..455fc4fadf40 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -450,109 +450,105 @@ VclPtr<VirtualDevice> GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntP
void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& aDescriptor, ExportSettings& rSettings )
{
- sal_Int32 nArgs = aDescriptor.getLength();
- const PropertyValue* pValues = aDescriptor.getConstArray();
- while( nArgs-- )
+ for( const PropertyValue& rValue : aDescriptor )
{
- if ( pValues->Name == "FilterName" )
+ if ( rValue.Name == "FilterName" )
{
- pValues->Value >>= rSettings.maFilterName;
+ rValue.Value >>= rSettings.maFilterName;
}
- else if ( pValues->Name == "MediaType" )
+ else if ( rValue.Name == "MediaType" )
{
- pValues->Value >>= rSettings.maMediaType;
+ rValue.Value >>= rSettings.maMediaType;
}
- else if ( pValues->Name == "URL" )
+ else if ( rValue.Name == "URL" )
{
- if( !( pValues->Value >>= rSettings.maURL ) )
+ if( !( rValue.Value >>= rSettings.maURL ) )
{
- pValues->Value >>= rSettings.maURL.Complete;
+ rValue.Value >>= rSettings.maURL.Complete;
}
}
- else if ( pValues->Name == "OutputStream" )
+ else if ( rValue.Name == "OutputStream" )
{
- pValues->Value >>= rSettings.mxOutputStream;
+ rValue.Value >>= rSettings.mxOutputStream;
}
- else if ( pValues->Name == "GraphicRenderer" )
+ else if ( rValue.Name == "GraphicRenderer" )
{
- pValues->Value >>= rSettings.mxGraphicRenderer;
+ rValue.Value >>= rSettings.mxGraphicRenderer;
}
- else if ( pValues->Name == "StatusIndicator" )
+ else if ( rValue.Name == "StatusIndicator" )
{
- pValues->Value >>= rSettings.mxStatusIndicator;
+ rValue.Value >>= rSettings.mxStatusIndicator;
}
- else if ( pValues->Name == "InteractionHandler" )
+ else if ( rValue.Name == "InteractionHandler" )
{
- pValues->Value >>= rSettings.mxInteractionHandler;
+ rValue.Value >>= rSettings.mxInteractionHandler;
}
- else if( pValues->Name == "Width" ) // for compatibility reasons, deprecated
+ else if( rValue.Name == "Width" ) // for compatibility reasons, deprecated
{
- pValues->Value >>= rSettings.mnWidth;
+ rValue.Value >>= rSettings.mnWidth;
}
- else if( pValues->Name == "Height" ) // for compatibility reasons, deprecated
+ else if( rValue.Name == "Height" ) // for compatibility reasons, deprecated
{
- pValues->Value >>= rSettings.mnHeight;
+ rValue.Value >>= rSettings.mnHeight;
}
- else if( pValues->Name == "ExportOnlyBackground" ) // for compatibility reasons, deprecated
+ else if( rValue.Name == "ExportOnlyBackground" ) // for compatibility reasons, deprecated
{
- pValues->Value >>= rSettings.mbExportOnlyBackground;
+ rValue.Value >>= rSettings.mbExportOnlyBackground;
}
- else if ( pValues->Name == "FilterData" )
+ else if ( rValue.Name == "FilterData" )
{
- pValues->Value >>= rSettings.maFilterData;
+ rValue.Value >>= rSettings.maFilterData;
- sal_Int32 nFilterArgs = rSettings.maFilterData.getLength();
- PropertyValue* pDataValues = rSettings.maFilterData.getArray();
- while( nFilterArgs-- )
+ for( PropertyValue& rDataValue : rSettings.maFilterData )
{
- if ( pDataValues->Name == "Translucent" )
+ if ( rDataValue.Name == "Translucent" )
{
- if ( !( pDataValues->Value >>= rSettings.mbTranslucent ) ) // SJ: TODO: The GIF Transparency is stored as int32 in
+ if ( !( rDataValue.Value >>= rSettings.mbTranslucent ) ) // SJ: TODO: The GIF Transparency is stored as int32 in
{ // configuration files, this has to be changed to boolean
sal_Int32 nTranslucent = 0;
- if ( pDataValues->Value >>= nTranslucent )
+ if ( rDataValue.Value >>= nTranslucent )
rSettings.mbTranslucent = nTranslucent != 0;
}
}
- else if ( pDataValues->Name == "PixelWidth" )
+ else if ( rDataValue.Name == "PixelWidth" )
{
- pDataValues->Value >>= rSettings.mnWidth;
+ rDataValue.Value >>= rSettings.mnWidth;
}
- else if ( pDataValues->Name == "PixelHeight" )
+ else if ( rDataValue.Name == "PixelHeight" )
{
- pDataValues->Value >>= rSettings.mnHeight;
+ rDataValue.Value >>= rSettings.mnHeight;
}
- else if( pDataValues->Name == "Width" ) // for compatibility reasons, deprecated
+ else if( rDataValue.Name == "Width" ) // for compatibility reasons, deprecated
{
- pDataValues->Value >>= rSettings.mnWidth;
- pDataValues->Name = "PixelWidth";
+ rDataValue.Value >>= rSettings.mnWidth;
+ rDataValue.Name = "PixelWidth";
}
- else if( pDataValues->Name == "Height" ) // for compatibility reasons, deprecated
+ else if( rDataValue.Name == "Height" ) // for compatibility reasons, deprecated
{
- pDataValues->Value >>= rSettings.mnHeight;
- pDataValues->Name = "PixelHeight";
+ rDataValue.Value >>= rSettings.mnHeight;
+ rDataValue.Name = "PixelHeight";
}
- else if ( pDataValues->Name == "ExportOnlyBackground" )
+ else if ( rDataValue.Name == "ExportOnlyBackground" )
{
- pDataValues->Value >>= rSettings.mbExportOnlyBackground;
+ rDataValue.Value >>= rSettings.mbExportOnlyBackground;
}
- else if ( pDataValues->Name == "HighContrast" )
+ else if ( rDataValue.Name == "HighContrast" )
{
- pDataValues->Value >>= rSettings.mbUseHighContrast;
+ rDataValue.Value >>= rSettings.mbUseHighContrast;
}
- else if ( pDataValues->Name == "PageNumber" )
+ else if ( rDataValue.Name == "PageNumber" )
{
- pDataValues->Value >>= mnPageNumber;
+ rDataValue.Value >>= mnPageNumber;
}
- else if ( pDataValues->Name == "ScrollText" )
+ else if ( rDataValue.Name == "ScrollText" )
{
// #110496# Read flag solitary scroll text metafile
- pDataValues->Value >>= rSettings.mbScrollText;
+ rDataValue.Value >>= rSettings.mbScrollText;
}
- else if ( pDataValues->Name == "CurrentPage" )
+ else if ( rDataValue.Name == "CurrentPage" )
{
Reference< XDrawPage > xPage;
- pDataValues->Value >>= xPage;
+ rDataValue.Value >>= xPage;
if( xPage.is() )
{
SvxDrawPage* pUnoPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>( xPage );
@@ -560,42 +556,38 @@ void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& aDescripto
mpCurrentPage = pUnoPage->GetSdrPage();
}
}
- else if ( pDataValues->Name == "ScaleXNumerator" )
+ else if ( rDataValue.Name == "ScaleXNumerator" )
{
sal_Int32 nVal = 1;
- if( pDataValues->Value >>= nVal )
+ if( rDataValue.Value >>= nVal )
rSettings.maScaleX = Fraction( nVal, rSettings.maScaleX.GetDenominator() );
}
- else if ( pDataValues->Name == "ScaleXDenominator" )
+ else if ( rDataValue.Name == "ScaleXDenominator" )
{
sal_Int32 nVal = 1;
- if( pDataValues->Value >>= nVal )
+ if( rDataValue.Value >>= nVal )
rSettings.maScaleX = Fraction( rSettings.maScaleX.GetNumerator(), nVal );
}
- else if ( pDataValues->Name == "ScaleYNumerator" )
+ else if ( rDataValue.Name == "ScaleYNumerator" )
{
sal_Int32 nVal = 1;
- if( pDataValues->Value >>= nVal )
+ if( rDataValue.Value >>= nVal )
rSettings.maScaleY = Fraction( nVal, rSettings.maScaleY.GetDenominator() );
}
- else if ( pDataValues->Name == "ScaleYDenominator" )
+ else if ( rDataValue.Name == "ScaleYDenominator" )
{
sal_Int32 nVal = 1;
- if( pDataValues->Value >>= nVal )
+ if( rDataValue.Value >>= nVal )
rSettings.maScaleY = Fraction( rSettings.maScaleY.GetNumerator(), nVal );
}
- else if (pDataValues->Name == "AntiAliasing")
+ else if (rDataValue.Name == "AntiAliasing")
{
bool bAntiAliasing;
- if (pDataValues->Value >>= bAntiAliasing)
+ if (rDataValue.Value >>= bAntiAliasing)
rSettings.meAntiAliasing = bAntiAliasing ? TRISTATE_TRUE : TRISTATE_FALSE;
}
-
- pDataValues++;
}
}
-
- pValues++;
}
// putting the StatusIndicator that we got from the MediaDescriptor into our local FilterData copy
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index c318442d279d..4df6688e4523 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -224,25 +224,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoDrawMSFactory::getAvailableServiceNames
uno::Sequence< OUString > SvxUnoDrawMSFactory::concatServiceNames( uno::Sequence< OUString >& rServices1, uno::Sequence< OUString >& rServices2 ) throw()
{
- const sal_Int32 nLen1 = rServices1.getLength();
- const sal_Int32 nLen2 = rServices2.getLength();
-
- uno::Sequence< OUString > aSeq( nLen1+nLen2 );
- OUString* pStrings = aSeq.getArray();
-
- sal_Int32 nIdx;
- OUString* pStringDst = pStrings;
- const OUString* pStringSrc = rServices1.getArray();
-
- for( nIdx = 0; nIdx < nLen1; nIdx++ )
- *pStringDst++ = *pStringSrc++;
-
- pStringSrc = rServices2.getArray();
-
- for( nIdx = 0; nIdx < nLen2; nIdx++ )
- *pStringDst++ = *pStringSrc++;
-
- return aSeq;
+ return comphelper::concatSequences(rServices1, rServices2);
}
SdrModel& SvxUnoDrawingModel::getSdrModelFromUnoModel() const
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 5fa3200ceb9d..586e0df35e9d 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -2938,13 +2938,10 @@ bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProp
uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
{
const sal_Int32 nCount = aPropertyName.getLength();
- const OUString* pNames = aPropertyName.getConstArray();
-
uno::Sequence< beans::PropertyState > aRet( nCount );
- beans::PropertyState* pState = aRet.getArray();
- for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
- pState[nIdx] = getPropertyState( pNames[nIdx] );
+ std::transform(aPropertyName.begin(), aPropertyName.end(), aRet.begin(),
+ [this](const OUString& rName) -> beans::PropertyState { return getPropertyState(rName); });
return aRet;
}
@@ -3049,8 +3046,8 @@ void SvxShape::setAllPropertiesToDefault()
void SvxShape::setPropertiesToDefault(
const uno::Sequence<OUString>& aPropertyNames )
{
- for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
- setPropertyToDefault( aPropertyNames[pos] );
+ for ( const auto& rPropertyName : aPropertyNames )
+ setPropertyToDefault( rPropertyName );
}
uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
@@ -3058,8 +3055,8 @@ uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
{
::std::vector<uno::Any> ret;
ret.reserve(aPropertyNames.getLength());
- for (sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos)
- ret.push_back( getPropertyDefault( aPropertyNames[pos] ) );
+ std::transform(aPropertyNames.begin(), aPropertyNames.end(), std::back_inserter(ret),
+ [this](const OUString& rName) -> uno::Any { return getPropertyDefault(rName); });
return uno::Sequence<uno::Any>( ret.data(), ret.size() );
}
diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx
index d044c347336a..c55adb55b356 100644
--- a/svx/source/unogallery/unogalthemeprovider.cxx
+++ b/svx/source/unogallery/unogalthemeprovider.cxx
@@ -122,18 +122,15 @@ uno::Sequence< sal_Int8 > SAL_CALL GalleryThemeProvider::getImplementationId()
void SAL_CALL GalleryThemeProvider::initialize( const uno::Sequence< uno::Any >& rArguments )
{
uno::Sequence< beans::PropertyValue > aParams;
- sal_Int32 i;
- for( i = 0; i < rArguments.getLength(); ++i )
+ for( const auto& rArgument : rArguments )
{
- if( rArguments[ i ] >>= aParams )
+ if( rArgument >>= aParams )
break;
}
- for( i = 0; i < aParams.getLength(); ++i )
+ for( const beans::PropertyValue& rProp : aParams )
{
- const beans::PropertyValue& rProp = aParams[ i ];
-
if ( rProp.Name == "ProvideHiddenThemes" )
rProp.Value >>= mbHiddenThemes;
}
diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx
index 40dfb6cfdd9c..70c1805bd58f 100644
--- a/svx/source/xml/xmlxtexp.cxx
+++ b/svx/source/xml/xmlxtexp.cxx
@@ -378,15 +378,12 @@ bool SvxXMLXTableExportComponent::exportTable() throw()
SvXMLElementExport aElem( *this, XML_NAMESPACE_OOO, pEleName, true, true );
Sequence< OUString > aNames = mxTable->getElementNames();
- const sal_Int32 nCount = aNames.getLength();
- const OUString* pNames = aNames.getConstArray();
Any aAny;
- sal_Int32 nIndex;
- for( nIndex = 0; nIndex < nCount; nIndex++, pNames++ )
+ for( const OUString& rName : aNames )
{
- aAny = mxTable->getByName( *pNames );
- pExporter->exportEntry( *pNames, aAny );
+ aAny = mxTable->getByName( rName );
+ pExporter->exportEntry( rName, aAny );
}
bRet = true;
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 7c273143e6ad..9c4727447c3f 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -742,13 +742,13 @@ bool XLineDashItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
css::drawing::LineDash aLineDash;
OUString aName;
bool bLineDash( false );
- for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
+ for ( const auto& rProp : aPropSeq )
{
- if ( aPropSeq[n].Name == "Name" )
- aPropSeq[n].Value >>= aName;
- else if ( aPropSeq[n].Name == "LineDash" )
+ if ( rProp.Name == "Name" )
+ rProp.Value >>= aName;
+ else if ( rProp.Name == "LineDash" )
{
- if ( aPropSeq[n].Value >>= aLineDash )
+ if ( rProp.Value >>= aLineDash )
bLineDash = true;
}
}
@@ -2105,13 +2105,13 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId
css::awt::Gradient aGradient2;
OUString aName;
bool bGradient( false );
- for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
+ for ( const auto& rProp : aPropSeq )
{
- if ( aPropSeq[n].Name == "Name" )
- aPropSeq[n].Value >>= aName;
- else if ( aPropSeq[n].Name == "FillGradient" )
+ if ( rProp.Name == "Name" )
+ rProp.Value >>= aName;
+ else if ( rProp.Name == "FillGradient" )
{
- if ( aPropSeq[n].Value >>= aGradient2 )
+ if ( rProp.Value >>= aGradient2 )
bGradient = true;
}
}
@@ -2498,13 +2498,13 @@ bool XFillHatchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
css::drawing::Hatch aUnoHatch;
OUString aName;
bool bHatch( false );
- for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
+ for ( const auto& rProp : aPropSeq )
{
- if ( aPropSeq[n].Name == "Name" )
- aPropSeq[n].Value >>= aName;
- else if ( aPropSeq[n].Name == "FillHatch" )
+ if ( rProp.Name == "Name" )
+ rProp.Value >>= aName;
+ else if ( rProp.Name == "FillHatch" )
{
- if ( aPropSeq[n].Value >>= aUnoHatch )
+ if ( rProp.Value >>= aUnoHatch )
bHatch = true;
}
}
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 49e589542b50..bb284e903e36 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -265,14 +265,14 @@ bool XFillBitmapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
uno::Sequence< beans::PropertyValue > aPropSeq;
if( rVal >>= aPropSeq )
{
- for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
+ for ( const auto& rProp : aPropSeq )
{
- if ( aPropSeq[n].Name == "Name" )
- bSetName = (aPropSeq[n].Value >>= aName);
- else if ( aPropSeq[n].Name == "Bitmap" )
- bSetBitmap = (aPropSeq[n].Value >>= xBmp);
- else if ( aPropSeq[n].Name == "FillBitmapURL" )
- bSetURL = (aPropSeq[n].Value >>= aURL);
+ if ( rProp.Name == "Name" )
+ bSetName = (rProp.Value >>= aName);
+ else if ( rProp.Name == "Bitmap" )
+ bSetBitmap = (rProp.Value >>= xBmp);
+ else if ( rProp.Name == "FillBitmapURL" )
+ bSetURL = (rProp.Value >>= aURL);
}
}
}