diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-07-27 20:15:17 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-07-29 18:45:04 +0200 |
commit | d458adeed0c34fae26fe7f3d6ecc9b75b431922f (patch) | |
tree | b594540ade488d97d14f93081161a3e77134db63 /sd | |
parent | c26f2fcf82d549a6475e9e55cdffde901190635b (diff) |
Simplify Sequence iterations in sd
Use range-based loops, STL and comphelper functions
Change-Id: If4b6d464fc393049dc8d7e5c3faf1cf66b6a369a
Reviewed-on: https://gerrit.libreoffice.org/76480
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'sd')
42 files changed, 442 insertions, 642 deletions
diff --git a/sd/source/core/CustomAnimationCloner.cxx b/sd/source/core/CustomAnimationCloner.cxx index 281ad7f7affe..4bad9c2328a2 100644 --- a/sd/source/core/CustomAnimationCloner.cxx +++ b/sd/source/core/CustomAnimationCloner.cxx @@ -224,12 +224,8 @@ namespace sd Sequence<Any> aSequence; rValue >>= aSequence; - const sal_Int32 nLength = aSequence.getLength(); - sal_Int32 nElement; - Any* pAny = aSequence.getArray(); - - for( nElement = 0; nElement < nLength; nElement++, pAny++ ) - *pAny = transformValue( *pAny ); + for( Any& rAny : aSequence ) + rAny = transformValue( rAny ); return makeAny( aSequence ); } diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 4054aa6686a0..f38e91f245cc 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -156,37 +156,33 @@ void CustomAnimationEffect::setNode( const css::uno::Reference< css::animations: mxAudio.clear(); Sequence< NamedValue > aUserData( mxNode->getUserData() ); - sal_Int32 nLength = aUserData.getLength(); - const NamedValue* p = aUserData.getConstArray(); - while( nLength-- ) + for( const NamedValue& rProp : aUserData ) { - if ( p->Name == "node-type" ) + if ( rProp.Name == "node-type" ) { - p->Value >>= mnNodeType; + rProp.Value >>= mnNodeType; } - else if ( p->Name == "preset-id" ) + else if ( rProp.Name == "preset-id" ) { - p->Value >>= maPresetId; + rProp.Value >>= maPresetId; } - else if ( p->Name == "preset-sub-type" ) + else if ( rProp.Name == "preset-sub-type" ) { - p->Value >>= maPresetSubType; + rProp.Value >>= maPresetSubType; } - else if ( p->Name == "preset-class" ) + else if ( rProp.Name == "preset-class" ) { - p->Value >>= mnPresetClass; + rProp.Value >>= mnPresetClass; } - else if ( p->Name == "preset-property" ) + else if ( rProp.Name == "preset-property" ) { - p->Value >>= maProperty; + rProp.Value >>= maProperty; } - else if ( p->Name == "group-id" ) + else if ( rProp.Name == "group-id" ) { - p->Value >>= mnGroupId; + rProp.Value >>= mnGroupId; } - - p++; } // get effect start time @@ -389,19 +385,12 @@ sal_Int32 CustomAnimationEffect::get_node_type( const Reference< XAnimationNode if( xNode.is() ) { Sequence< NamedValue > aUserData( xNode->getUserData() ); - sal_Int32 nLength = aUserData.getLength(); - if( nLength ) + if( aUserData.hasElements() ) { - const NamedValue* p = aUserData.getConstArray(); - while( nLength-- ) - { - if ( p->Name == "node-type" ) - { - p->Value >>= nNodeType; - break; - } - p++; - } + const NamedValue* pProp = std::find_if(aUserData.begin(), aUserData.end(), + [](const NamedValue& rProp) { return rProp.Name == "node-type"; }); + if (pProp != aUserData.end()) + pProp->Value >>= nNodeType; } } @@ -424,23 +413,18 @@ void CustomAnimationEffect::setPresetClass( sal_Int16 nPresetClass ) bool bFound = false; if( nLength ) { - NamedValue* p = aUserData.getArray(); - while( nLength-- ) + NamedValue* pProp = std::find_if(aUserData.begin(), aUserData.end(), + [](const NamedValue& rProp) { return rProp.Name == "preset-class"; }); + if (pProp != aUserData.end()) { - if ( p->Name == "preset-class" ) - { - p->Value <<= mnPresetClass; - bFound = true; - break; - } - p++; + pProp->Value <<= mnPresetClass; + bFound = true; } } - // no "node-type" entry inside user data, so add it + // no "preset-class" entry inside user data, so add it if( !bFound ) { - nLength = aUserData.getLength(); aUserData.realloc( nLength + 1); aUserData[nLength].Name = "preset-class"; aUserData[nLength].Value <<= mnPresetClass; @@ -465,23 +449,18 @@ void CustomAnimationEffect::setNodeType( sal_Int16 nNodeType ) bool bFound = false; if( nLength ) { - NamedValue* p = aUserData.getArray(); - while( nLength-- ) + NamedValue* pProp = std::find_if(aUserData.begin(), aUserData.end(), + [](const NamedValue& rProp) { return rProp.Name == "node-type"; }); + if (pProp != aUserData.end()) { - if ( p->Name == "node-type" ) - { - p->Value <<= mnNodeType; - bFound = true; - break; - } - p++; + pProp->Value <<= mnNodeType; + bFound = true; } } // no "node-type" entry inside user data, so add it if( !bFound ) { - nLength = aUserData.getLength(); aUserData.realloc( nLength + 1); aUserData[nLength].Name = "node-type"; aUserData[nLength].Value <<= mnNodeType; @@ -503,23 +482,18 @@ void CustomAnimationEffect::setGroupId( sal_Int32 nGroupId ) bool bFound = false; if( nLength ) { - NamedValue* p = aUserData.getArray(); - while( nLength-- ) + NamedValue* pProp = std::find_if(aUserData.begin(), aUserData.end(), + [](const NamedValue& rProp) { return rProp.Name == "group-id"; }); + if (pProp != aUserData.end()) { - if ( p->Name == "group-id" ) - { - p->Value <<= mnGroupId; - bFound = true; - break; - } - p++; + pProp->Value <<= mnGroupId; + bFound = true; } } - // no "node-type" entry inside user data, so add it + // no "group-id" entry inside user data, so add it if( !bFound ) { - nLength = aUserData.getLength(); aUserData.realloc( nLength + 1); aUserData[nLength].Name = "group-id"; aUserData[nLength].Value <<= mnGroupId; @@ -1666,21 +1640,11 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const CustomAnimationPres // first, filter all only ui relevant user data std::vector< NamedValue > aNewUserData; Sequence< NamedValue > aUserData( xNode->getUserData() ); - sal_Int32 nLength = aUserData.getLength(); - const NamedValue* p = aUserData.getConstArray(); - bool bFilter = false; - while( nLength-- ) - { - if( p->Name != "text-only" && p->Name != "preset-property" ) - { - aNewUserData.push_back( *p ); - bFilter = true; - } - p++; - } + std::copy_if(aUserData.begin(), aUserData.end(), std::back_inserter(aNewUserData), + [](const NamedValue& rProp) { return rProp.Name != "text-only" && rProp.Name != "preset-property"; }); - if( bFilter ) + if( !aNewUserData.empty() ) { aUserData = ::comphelper::containerToSequence( aNewUserData ); xNode->setUserData( aUserData ); @@ -2921,18 +2885,11 @@ void EffectSequenceHelper::processAfterEffect( const Reference< XAnimationNode > Reference< XAnimationNode > xMaster; Sequence< NamedValue > aUserData( xNode->getUserData() ); - sal_Int32 nLength = aUserData.getLength(); - const NamedValue* p = aUserData.getConstArray(); + const NamedValue* pProp = std::find_if(aUserData.begin(), aUserData.end(), + [](const NamedValue& rProp) { return rProp.Name == "master-element"; }); - while( nLength-- ) - { - if ( p->Name == "master-element" ) - { - p->Value >>= xMaster; - break; - } - p++; - } + if (pProp != aUserData.end()) + pProp->Value >>= xMaster; // only process if this is a valid after effect if( xMaster.is() ) diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx index 9ac326fe668c..bf8214d909b6 100644 --- a/sd/source/core/CustomAnimationPreset.cxx +++ b/sd/source/core/CustomAnimationPreset.cxx @@ -93,22 +93,18 @@ void implImportLabels( const Reference< XMultiServiceFactory >& xConfigProvider, { Reference< XNameAccess > xNameAccess; Sequence< OUString > aNames( xConfigAccess->getElementNames() ); - const OUString* p = aNames.getConstArray(); - sal_Int32 n = aNames.getLength(); - while(n--) + for(const OUString& rName : aNames) { - xConfigAccess->getByName( *p ) >>= xNameAccess; + xConfigAccess->getByName( rName ) >>= xNameAccess; if( xNameAccess.is() ) { OUString aUIName; xNameAccess->getByName( "Label" ) >>= aUIName; if( !aUIName.isEmpty() ) { - rStringMap[ *p ] = aUIName; + rStringMap[ rName ] = aUIName; } } - - p++; } } } @@ -132,22 +128,10 @@ CustomAnimationPreset::CustomAnimationPreset( const CustomAnimationEffectPtr& pE mfDuration = pEffect->getDuration(); maDefaultSubTyp = pEffect->getPresetSubType(); - mbIsTextOnly = false; - Sequence< NamedValue > aUserData( pEffect->getNode()->getUserData() ); - sal_Int32 nLength = aUserData.getLength(); - const NamedValue* p = aUserData.getConstArray(); - - while( nLength-- ) - { - if ( p->Name == "text-only" ) - { - mbIsTextOnly = true; - break; - } - p++; - } + mbIsTextOnly = std::any_of(aUserData.begin(), aUserData.end(), + [](const NamedValue& rProp) { return rProp.Name == "text-only"; }); } void CustomAnimationPreset::add( const CustomAnimationEffectPtr& pEffect ) @@ -311,9 +295,9 @@ void CustomAnimationPresets::importEffects() uno::Sequence< OUString > aFiles; xNameAccess->getByName( "EffectFiles" ) >>= aFiles; - for( sal_Int32 i=0; i<aFiles.getLength(); ++i ) + for( const auto& rFile : aFiles ) { - OUString aURL = comphelper::getExpandedUri(xContext, aFiles[i]); + OUString aURL = comphelper::getExpandedUri(xContext, rFile); mxRootNode = implImportEffects( xServiceFactory, aURL ); @@ -420,11 +404,9 @@ void CustomAnimationPresets::importPresets( const Reference< XMultiServiceFactor Reference< XNameAccess > xCategoryAccess; Sequence< OUString > aNames( xTypeAccess->getElementNames() ); - const OUString* p = aNames.getConstArray(); - sal_Int32 n = aNames.getLength(); - while(n--) + for(const OUString& rName : aNames) { - xTypeAccess->getByName( *p ) >>= xCategoryAccess; + xTypeAccess->getByName( rName ) >>= xCategoryAccess; if( xCategoryAccess.is() && xCategoryAccess->hasByName( "Label" ) && xCategoryAccess->hasByName( "Effects" ) ) { @@ -436,11 +418,9 @@ void CustomAnimationPresets::importPresets( const Reference< XMultiServiceFactor EffectDescriptorList aEffectsList; - const OUString* pEffectNames = aEffects.getConstArray(); - sal_Int32 nEffectCount = aEffects.getLength(); - while( nEffectCount-- ) + for( const OUString& rEffectName : aEffects ) { - CustomAnimationPresetPtr pEffect = getEffectDescriptor( *pEffectNames ); + CustomAnimationPresetPtr pEffect = getEffectDescriptor( rEffectName ); if( pEffect.get() ) { aEffectsList.push_back( pEffect ); @@ -448,16 +428,13 @@ void CustomAnimationPresets::importPresets( const Reference< XMultiServiceFactor #ifdef DEBUG else { - aMissedPresetIds += OUString(*pEffectNames); + aMissedPresetIds += OUString(rEffectName); aMissedPresetIds += "\n"; } #endif - pEffectNames++; } rPresetMap.push_back( std::make_shared<PresetCategory>( aLabel, aEffectsList ) ); } - - p++; } } } diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx index a654072132a4..b543d6dfd6c9 100644 --- a/sd/source/core/TransitionPreset.cxx +++ b/sd/source/core/TransitionPreset.cxx @@ -59,16 +59,10 @@ TransitionPreset::TransitionPreset( const css::uno::Reference< css::animations:: { // first locate preset id Sequence< NamedValue > aUserData( xNode->getUserData() ); - sal_Int32 nLength = aUserData.getLength(); - const NamedValue* p = aUserData.getConstArray(); - while( nLength-- ) - { - if ( p->Name == "preset-id" ) - { - p->Value >>= maPresetId; - break; - } - } + const NamedValue* pProp = std::find_if(aUserData.begin(), aUserData.end(), + [](const NamedValue& rProp) { return rProp.Name == "preset-id"; }); + if (pProp != aUserData.end()) + pProp->Value >>= maPresetId; // second, locate transition filter element Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY_THROW ); @@ -212,9 +206,9 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList ) uno::Sequence< OUString > aFiles; xNameAccess->getByName("TransitionFiles") >>= aFiles; - for( sal_Int32 i=0; i<aFiles.getLength(); ++i ) + for( const auto& rFile : aFiles ) { - OUString aURL = comphelper::getExpandedUri(xContext, aFiles[i]); + OUString aURL = comphelper::getExpandedUri(xContext, rFile); bRet |= importTransitionsFile( rList, xServiceFactory, diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index d2d7d4c713c2..775838653b68 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -1110,9 +1110,9 @@ void SdDrawDocument::InitLayoutVector() officecfg::Office::Impress::Misc::LayoutListFiles::get(xContext) ); OUString sFilename; - for( sal_Int32 i=0; i < aFiles.getLength(); ++i ) + for( const auto& rFile : aFiles ) { - sFilename = comphelper::getExpandedUri(xContext, aFiles[i]); + sFilename = comphelper::getExpandedUri(xContext, rFile); // load layout file into DOM Reference< XMultiServiceFactory > xServiceFactory( @@ -1149,9 +1149,9 @@ void SdDrawDocument::InitObjectVector() officecfg::Office::Impress::Misc::PresObjListFiles::get(xContext) ); OUString sFilename; - for( sal_Int32 i=0; i < aFiles.getLength(); ++i ) + for( const auto& rFile : aFiles ) { - sFilename = comphelper::getExpandedUri(xContext, aFiles[i]); + sFilename = comphelper::getExpandedUri(xContext, rFile); // load presentation object file into DOM Reference< XMultiServiceFactory > xServiceFactory( diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 4b9bdd5b9e8b..b4f566eb4c8b 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -542,14 +542,11 @@ void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool const & rSourcePool) Reference< XNameAccess> xSourceNames( xSourceTableStyle, UNO_QUERY_THROW ); Sequence< OUString > aStyleNames( xSourceNames->getElementNames() ); - OUString* pStyleNames( aStyleNames.getArray() ); Reference< XNameReplace > xTargetNames( xNewTableStyle, UNO_QUERY ); - sal_Int32 nNames = aStyleNames.getLength(); - while( nNames-- ) + for( const OUString& aName : aStyleNames ) { - const OUString aName( *pStyleNames++ ); Reference< XStyle > xSourceStyle( xSourceNames->getByName( aName ), UNO_QUERY ); Reference< XStyle > xTargetStyle; if( xSourceStyle.is() ) try diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 5089006b8e8b..33ea114eb4f7 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -306,14 +306,11 @@ bool SdStyleSheet::IsUsed() const if( pContainer ) { Sequence< Reference< XInterface > > aModifyListeners( pContainer->getElements() ); - Reference< XInterface > *p = aModifyListeners.getArray(); - sal_Int32 nCount = aModifyListeners.getLength(); - while( nCount-- && !bResult ) - { - Reference< XStyle > xStyle( *p++, UNO_QUERY ); - if( xStyle.is() ) - bResult = xStyle->isInUse(); - } + bResult = std::any_of(aModifyListeners.begin(), aModifyListeners.end(), + [](const Reference<XInterface>& rListener) { + Reference< XStyle > xStyle( rListener, UNO_QUERY ); + return xStyle.is() && xStyle->isInUse(); + }); } } return bResult; @@ -1248,13 +1245,11 @@ Sequence< PropertyState > SAL_CALL SdStyleSheet::getPropertyStates( const Sequen throwIfDisposed(); sal_Int32 nCount = aPropertyName.getLength(); - const OUString* pNames = aPropertyName.getConstArray(); Sequence< PropertyState > aPropertyStateSequence( nCount ); - PropertyState* pState = aPropertyStateSequence.getArray(); - while( nCount-- ) - *pState++ = getPropertyState( *pNames++ ); + std::transform(aPropertyName.begin(), aPropertyName.end(), aPropertyStateSequence.begin(), + [this](const OUString& rName) -> PropertyState { return getPropertyState(rName); }); return aPropertyStateSequence; } diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 73a6bfc9dfaa..2b2b886aa4b7 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/geometry/RealPoint2D.hpp> #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> +#include <comphelper/sequence.hxx> #include <tools/zcodec.hxx> #include <filter/msfilter/classids.hxx> #include <filter/msfilter/msoleexp.hxx> @@ -508,12 +509,10 @@ void PPTWriter::ImplCreateDocumentSummaryInformation() SvMemoryStream aHyperBlob; ImplCreateHyperBlob( aHyperBlob ); - uno::Sequence<sal_Int8> aHyperSeq(aHyperBlob.Tell()); + auto nHyperLength = static_cast<sal_Int32>(aHyperBlob.Tell()); const sal_Int8* pBlob( static_cast<const sal_Int8*>(aHyperBlob.GetData())); - for (sal_Int32 j = 0; j < aHyperSeq.getLength(); ++j) { - aHyperSeq[j] = pBlob[j]; - } + auto aHyperSeq = comphelper::arrayToSequence<sal_Int8>(pBlob, nHyperLength); if ( mnCnvrtFlags & 0x8000 ) { diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 23d66a559a07..b06d73b24ec2 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -1246,11 +1246,11 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u if ( nTextRulerAtomFlags & 4 ) { pRuleOut->WriteUInt16( nTabCount ); - for ( i = 0; i < nTabs; i++ ) + for ( const css::style::TabStop& rTabStop : pPara->maTabStop ) { - sal_uInt16 nPosition = static_cast<sal_uInt16>( ( pTabStop[ i ].Position / 4.40972 ) + nTextOfs ); + sal_uInt16 nPosition = static_cast<sal_uInt16>( ( rTabStop.Position / 4.40972 ) + nTextOfs ); sal_uInt16 nType; - switch ( pTabStop[ i ].Alignment ) + switch ( rTabStop.Alignment ) { case css::style::TabAlign_DECIMAL : nType = 3; break; case css::style::TabAlign_RIGHT : nType = 2; break; @@ -1258,7 +1258,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u case css::style::TabAlign_LEFT : default: nType = 0; - }; + } pRuleOut->WriteUInt16( nPosition ) .WriteUInt16( nType ); } diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx index ba66d67f71d1..efba0899de89 100644 --- a/sd/source/filter/eppt/pptexanimations.cxx +++ b/sd/source/filter/eppt/pptexanimations.cxx @@ -373,18 +373,11 @@ void AnimationExporter::processAfterEffectNodes( const Reference< XAnimationNode Reference< XAnimationNode > xMaster; Sequence< NamedValue > aUserData( xChildNode3->getUserData() ); - sal_Int32 nLength = aUserData.getLength(); - const NamedValue* p = aUserData.getConstArray(); - - while( nLength-- ) - { - if ( p->Name == "master-element" ) - { - p->Value >>= xMaster; - break; - } - p++; - } + const NamedValue* p = std::find_if(aUserData.begin(), aUserData.end(), + [](const NamedValue& rProp) { return rProp.Name == "master-element"; }); + + if (p != aUserData.end()) + p->Value >>= xMaster; AfterEffectNodePtr pAfterEffectNode( new AfterEffectNode( xChildNode3, xMaster ) ); maAfterEffectNodes.push_back( pAfterEffectNode ); @@ -749,19 +742,14 @@ bool AnimationExporter::GetNodeType( const Reference< XAnimationNode >& xNode, s { // trying to get the nodetype Sequence< NamedValue > aUserData = xNode->getUserData(); - if ( aUserData.hasElements() ) - { - const NamedValue* p = aUserData.getConstArray(); - sal_Int32 nLength = aUserData.getLength(); - while( nLength-- ) + for( const NamedValue& rProp : aUserData ) { - if ( p->Name == "node-type" ) + if ( rProp.Name == "node-type" ) { - if ( p->Value >>= nType ) - return true; + if ( rProp.Value >>= nType ) + return true; } } - } return false; } @@ -865,31 +853,28 @@ void AnimationExporter::GetUserData( const Sequence< NamedValue >& rUserData, co if ( !rUserData.hasElements() ) return; - const NamedValue* p = rUserData.getConstArray(); - sal_Int32 nLength = rUserData.getLength(); - while( nLength-- ) + for( const NamedValue& rProp : rUserData ) { - if ( p->Name == "node-type" ) + if ( rProp.Name == "node-type" ) { - pAny[ DFF_ANIM_NODE_TYPE ] = &(p->Value); + pAny[ DFF_ANIM_NODE_TYPE ] = &(rProp.Value); } - else if ( p->Name == "preset-class" ) + else if ( rProp.Name == "preset-class" ) { - pAny[ DFF_ANIM_PRESET_CLASS ] = &(p->Value); + pAny[ DFF_ANIM_PRESET_CLASS ] = &(rProp.Value); } - else if ( p->Name == "preset-id" ) + else if ( rProp.Name == "preset-id" ) { - pAny[ DFF_ANIM_PRESET_ID ] = &(p->Value); + pAny[ DFF_ANIM_PRESET_ID ] = &(rProp.Value); } - else if ( p->Name == "preset-sub-type" ) + else if ( rProp.Name == "preset-sub-type" ) { - pAny[ DFF_ANIM_PRESET_SUB_TYPE ] = &(p->Value); + pAny[ DFF_ANIM_PRESET_SUB_TYPE ] = &(rProp.Value); } - else if ( p->Name == "master-element" ) + else if ( rProp.Name == "master-element" ) { - pAny[ DFF_ANIM_AFTEREFFECT ] = &(p->Value); + pAny[ DFF_ANIM_AFTEREFFECT ] = &(rProp.Value); } - p++; } } diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx index 9c930d768bbc..f1872a5ce52e 100644 --- a/sd/source/filter/eppt/pptx-animations.cxx +++ b/sd/source/filter/eppt/pptx-animations.cxx @@ -731,9 +731,9 @@ void PPTXAnimationExport::WriteAnimationCondList(const Any& rAny, sal_Int32 nTok Sequence<Any> aCondSeq; if (rAny >>= aCondSeq) { - for (int i = 0; i < aCondSeq.getLength(); i++) + for (const auto& rCond : aCondSeq) { - Cond aCond(aCondSeq[i], bIsMainSeqChild); + Cond aCond(rCond, bIsMainSeqChild); if (aCond.isValid()) aList.push_back(aCond); } diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 3b858a6dc556..342f577f081c 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -794,32 +794,29 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1 mAny = aXIndexReplace->getByIndex( nNumberingDepth ); auto aPropertySequence = o3tl::doAccess<css::uno::Sequence<css::beans::PropertyValue>>(mAny); - const css::beans::PropertyValue* pPropValue = aPropertySequence->getConstArray(); - - sal_Int32 nPropertyCount = aPropertySequence->getLength(); - if ( nPropertyCount ) + if ( aPropertySequence->hasElements() ) { bExtendedParameters = true; nBulletRealSize = 100; nMappedNumType = 0; uno::Reference<graphic::XGraphic> xGraphic; - for ( sal_Int32 i = 0; i < nPropertyCount; i++ ) + for ( const css::beans::PropertyValue& rPropValue : *aPropertySequence ) { - OUString aPropName( pPropValue[ i ].Name ); + OUString aPropName( rPropValue.Name ); if ( aPropName == "NumberingType" ) - nNumberingType = static_cast<SvxNumType>(*o3tl::doAccess<sal_Int16>(pPropValue[i].Value)); + nNumberingType = static_cast<SvxNumType>(*o3tl::doAccess<sal_Int16>(rPropValue.Value)); else if ( aPropName == "Adjust" ) - nHorzAdjust = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value); + nHorzAdjust = *o3tl::doAccess<sal_Int16>(rPropValue.Value); else if ( aPropName == "BulletChar" ) { - OUString aString( *o3tl::doAccess<OUString>(pPropValue[i].Value) ); + OUString aString( *o3tl::doAccess<OUString>(rPropValue.Value) ); if ( !aString.isEmpty() ) cBulletId = aString[ 0 ]; } else if ( aPropName == "BulletFont" ) { - aFontDesc = *o3tl::doAccess<css::awt::FontDescriptor>(pPropValue[i].Value); + aFontDesc = *o3tl::doAccess<css::awt::FontDescriptor>(rPropValue.Value); // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font, // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used. @@ -831,12 +828,12 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1 } else if ( aPropName == "GraphicBitmap" ) { - auto xBitmap = pPropValue[i].Value.get<uno::Reference<awt::XBitmap>>(); + auto xBitmap = rPropValue.Value.get<uno::Reference<awt::XBitmap>>(); xGraphic.set(xBitmap, uno::UNO_QUERY); } else if ( aPropName == "GraphicSize" ) { - if (auto aSize = o3tl::tryAccess<css::awt::Size>(pPropValue[i].Value)) + if (auto aSize = o3tl::tryAccess<css::awt::Size>(rPropValue.Value)) { // don't cast awt::Size to Size as on 64-bits they are not the same. aBuGraSize.setWidth( aSize->Width ); @@ -844,28 +841,28 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1 } } else if ( aPropName == "StartWith" ) - nStartWith = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value); + nStartWith = *o3tl::doAccess<sal_Int16>(rPropValue.Value); else if ( aPropName == "LeftMargin" ) - nTextOfs = nTextOfs + static_cast< sal_Int16 >( *o3tl::doAccess<sal_Int32>(pPropValue[i].Value) / ( 2540.0 / 576 ) ); + nTextOfs = nTextOfs + static_cast< sal_Int16 >( *o3tl::doAccess<sal_Int32>(rPropValue.Value) / ( 2540.0 / 576 ) ); else if ( aPropName == "FirstLineOffset" ) - nBulletOfs += static_cast<sal_Int16>( *o3tl::doAccess<sal_Int32>(pPropValue[i].Value) / ( 2540.0 / 576 ) ); + nBulletOfs += static_cast<sal_Int16>( *o3tl::doAccess<sal_Int32>(rPropValue.Value) / ( 2540.0 / 576 ) ); else if ( aPropName == "BulletColor" ) { - sal_uInt32 nSOColor = *o3tl::doAccess<sal_uInt32>(pPropValue[i].Value); + sal_uInt32 nSOColor = *o3tl::doAccess<sal_uInt32>(rPropValue.Value); nBulletColor = nSOColor & 0xff00ff00; // green and hibyte nBulletColor |= static_cast<sal_uInt8>(nSOColor) << 16; // red nBulletColor |= static_cast<sal_uInt8>( nSOColor >> 16 ) | 0xfe000000; // blue } else if ( aPropName == "BulletRelSize" ) { - nBulletRealSize = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value); + nBulletRealSize = *o3tl::doAccess<sal_Int16>(rPropValue.Value); nParaFlags |= 0x40; nBulletFlags |= 8; } else if ( aPropName == "Prefix" ) - sPrefix = *o3tl::doAccess<OUString>(pPropValue[i].Value); + sPrefix = *o3tl::doAccess<OUString>(rPropValue.Value); else if ( aPropName == "Suffix" ) - sSuffix = *o3tl::doAccess<OUString>(pPropValue[i].Value); + sSuffix = *o3tl::doAccess<OUString>(rPropValue.Value); #ifdef DBG_UTIL else if ( ! ( ( aPropName == "SymbolTextDistance" ) diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index d9179514cccc..d16491dff288 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -242,30 +242,30 @@ bool SdGRFFilter::Export() OUString sShortName( rGraphicFilter.GetExportFormatShortName( nFilter ) ); bool bFilterNameFound = false; - sal_Int32 i, nCount; - for ( i = 0, nCount = aArgs.getLength(); i < nCount; i++ ) + for ( auto& rArg : aArgs ) { - OUString& rStr = aArgs[ i ].Name; + OUString& rStr = rArg.Name; if ( rStr == sFilterName ) { bFilterNameFound = true; - aArgs[ i ].Value <<= sShortName; + rArg.Value <<= sShortName; } else if ( rStr == "InteractionHandler" ) { uno::Reference< task::XInteractionHandler > xHdl; - if ( aArgs[ i ].Value >>= xHdl ) + if ( rArg.Value >>= xHdl ) { xInteractionHandler = new SdGRFFilter_ImplInteractionHdl( xHdl ); - aArgs[ i ].Value <<= xInteractionHandler; + rArg.Value <<= xInteractionHandler; } } } if ( !bFilterNameFound ) { - aArgs.realloc( ++nCount ); - aArgs[ i ].Name = sFilterName; - aArgs[ i ].Value <<= sShortName; + sal_Int32 nCount = aArgs.getLength(); + aArgs.realloc( nCount + 1 ); + aArgs[ nCount ].Name = sFilterName; + aArgs[ nCount ].Value <<= sShortName; } // take selection if needed diff --git a/sd/source/filter/html/HtmlOptionsDialog.cxx b/sd/source/filter/html/HtmlOptionsDialog.cxx index e58b140f1f0a..e0053e566503 100644 --- a/sd/source/filter/html/HtmlOptionsDialog.cxx +++ b/sd/source/filter/html/HtmlOptionsDialog.cxx @@ -120,12 +120,10 @@ Sequence< OUString > SAL_CALL SdHtmlOptionsDialog::getSupportedServiceNames() // XPropertyAccess Sequence< PropertyValue > SdHtmlOptionsDialog::getPropertyValues() { - sal_Int32 i, nCount; - for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) - { - if ( maMediaDescriptor[ i ].Name == "FilterData" ) - break; - } + auto pProp = std::find_if(maMediaDescriptor.begin(), maMediaDescriptor.end(), + [](const PropertyValue& rProp) { return rProp.Name == "FilterData"; }); + auto i = static_cast<sal_Int32>(std::distance(maMediaDescriptor.begin(), pProp)); + sal_Int32 nCount = maMediaDescriptor.getLength(); if ( i == nCount ) maMediaDescriptor.realloc( ++nCount ); @@ -139,15 +137,10 @@ void SdHtmlOptionsDialog::setPropertyValues( const Sequence< PropertyValue > & a { maMediaDescriptor = aProps; - sal_Int32 i, nCount; - for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) - { - if ( maMediaDescriptor[ i ].Name == "FilterData" ) - { - maMediaDescriptor[ i ].Value >>= maFilterDataSequence; - break; - } - } + auto pProp = std::find_if(maMediaDescriptor.begin(), maMediaDescriptor.end(), + [](const PropertyValue& rProp) { return rProp.Name == "FilterData"; }); + if (pProp != maMediaDescriptor.end()) + pProp->Value >>= maFilterDataSequence; } // XExecutableDialog diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index c5a197e1f1fb..a3ff6259e9ad 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -398,31 +398,29 @@ void HtmlExport::InitExportParameters( const Sequence< PropertyValue >& rParams { mbImpress = mpDoc->GetDocumentType() == DocumentType::Impress; - sal_Int32 nArgs = rParams.getLength(); - const PropertyValue* pParams = rParams.getConstArray(); OUString aStr; - while( nArgs-- ) + for( const PropertyValue& rParam : rParams ) { - if ( pParams->Name == "PublishMode" ) + if ( rParam.Name == "PublishMode" ) { sal_Int32 temp = 0; - pParams->Value >>= temp; + rParam.Value >>= temp; meMode = static_cast<HtmlPublishMode>(temp); } - else if ( pParams->Name == "IndexURL" ) + else if ( rParam.Name == "IndexURL" ) { - pParams->Value >>= aStr; + rParam.Value >>= aStr; maIndexUrl = aStr; } - else if ( pParams->Name == "Format" ) + else if ( rParam.Name == "Format" ) { sal_Int32 temp = 0; - pParams->Value >>= temp; + rParam.Value >>= temp; meFormat = static_cast<PublishingFormat>(temp); } - else if ( pParams->Name == "Compression" ) + else if ( rParam.Name == "Compression" ) { - pParams->Value >>= aStr; + rParam.Value >>= aStr; OUString aTmp( aStr ); if(!aTmp.isEmpty()) { @@ -430,138 +428,138 @@ void HtmlExport::InitExportParameters( const Sequence< PropertyValue >& rParams mnCompression = static_cast<sal_Int16>(aTmp.toInt32()); } } - else if ( pParams->Name == "Width" ) + else if ( rParam.Name == "Width" ) { sal_Int32 temp = 0; - pParams->Value >>= temp; + rParam.Value >>= temp; mnWidthPixel = static_cast<sal_uInt16>(temp); } - else if ( pParams->Name == "UseButtonSet" ) + else if ( rParam.Name == "UseButtonSet" ) { sal_Int32 temp = 0; - pParams->Value >>= temp; + rParam.Value >>= temp; mnButtonThema = static_cast<sal_Int16>(temp); } - else if ( pParams->Name == "IsExportNotes" ) + else if ( rParam.Name == "IsExportNotes" ) { if( mbImpress ) { bool temp = false; - pParams->Value >>= temp; + rParam.Value >>= temp; mbNotes = temp; } } - else if ( pParams->Name == "IsExportContentsPage" ) + else if ( rParam.Name == "IsExportContentsPage" ) { bool temp = false; - pParams->Value >>= temp; + rParam.Value >>= temp; mbContentsPage = temp; } - else if ( pParams->Name == "Author" ) + else if ( rParam.Name == "Author" ) { - pParams->Value >>= aStr; + rParam.Value >>= aStr; maAuthor = aStr; } - else if ( pParams->Name == "EMail" ) + else if ( rParam.Name == "EMail" ) { - pParams->Value >>= aStr; + rParam.Value >>= aStr; maEMail = aStr; } - else if ( pParams->Name == "HomepageURL" ) + else if ( rParam.Name == "HomepageURL" ) { - pParams->Value >>= aStr; + rParam.Value >>= aStr; maHomePage = aStr; } - else if ( pParams->Name == "UserText" ) + else if ( rParam.Name == "UserText" ) { - pParams->Value >>= aStr; + rParam.Value >>= aStr; maInfo = aStr; } - else if ( pParams->Name == "EnableDownload" ) + else if ( rParam.Name == "EnableDownload" ) { bool temp = false; - pParams->Value >>= temp; + rParam.Value >>= temp; mbDownload = temp; } - else if ( pParams->Name == "SlideSound" ) + else if ( rParam.Name == "SlideSound" ) { bool temp = true; - pParams->Value >>= temp; + rParam.Value >>= temp; mbSlideSound = temp; } - else if ( pParams->Name == "HiddenSlides" ) + else if ( rParam.Name == "HiddenSlides" ) { bool temp = true; - pParams->Value >>= temp; + rParam.Value >>= temp; mbHiddenSlides = temp; } - else if ( pParams->Name == "BackColor" ) + else if ( rParam.Name == "BackColor" ) { sal_Int32 temp = 0; - pParams->Value >>= temp; + rParam.Value >>= temp; maBackColor = Color(temp); mbUserAttr = true; } - else if ( pParams->Name == "TextColor" ) + else if ( rParam.Name == "TextColor" ) { sal_Int32 temp = 0; - pParams->Value >>= temp; + rParam.Value >>= temp; maTextColor = Color(temp); mbUserAttr = true; } - else if ( pParams->Name == "LinkColor" ) + else if ( rParam.Name == "LinkColor" ) { sal_Int32 temp = 0; - pParams->Value >>= temp; + rParam.Value >>= temp; maLinkColor = Color(temp); mbUserAttr = true; } - else if ( pParams->Name == "VLinkColor" ) + else if ( rParam.Name == "VLinkColor" ) { sal_Int32 temp = 0; - pParams->Value >>= temp; + rParam.Value >>= temp; maVLinkColor = Color(temp); mbUserAttr = true; } - else if ( pParams->Name == "ALinkColor" ) + else if ( rParam.Name == "ALinkColor" ) { sal_Int32 temp = 0; - pParams->Value >>= temp; + rParam.Value >>= temp; maALinkColor = Color(temp); mbUserAttr = true; } - else if ( pParams->Name == "IsUseDocumentColors" ) + else if ( rParam.Name == "IsUseDocumentColors" ) { bool temp = false; - pParams->Value >>= temp; + rParam.Value >>= temp; mbDocColors = temp; } - else if ( pParams->Name == "KioskSlideDuration" ) + else if ( rParam.Name == "KioskSlideDuration" ) { double temp = 0.0; - pParams->Value >>= temp; + rParam.Value >>= temp; mfSlideDuration = temp; mbAutoSlide = true; } - else if ( pParams->Name == "KioskEndless" ) + else if ( rParam.Name == "KioskEndless" ) { bool temp = false; - pParams->Value >>= temp; + rParam.Value >>= temp; mbEndless = temp; } - else if ( pParams->Name == "WebCastCGIURL" ) + else if ( rParam.Name == "WebCastCGIURL" ) { - pParams->Value >>= aStr; + rParam.Value >>= aStr; maCGIPath = aStr; } - else if ( pParams->Name == "WebCastTargetURL" ) + else if ( rParam.Name == "WebCastTargetURL" ) { - pParams->Value >>= aStr; + rParam.Value >>= aStr; maURLPath = aStr; } - else if ( pParams->Name == "WebCastScriptLanguage" ) + else if ( rParam.Name == "WebCastScriptLanguage" ) { - pParams->Value >>= aStr; + rParam.Value >>= aStr; if ( aStr == "asp" ) { meScript = SCRIPT_ASP; @@ -575,8 +573,6 @@ void HtmlExport::InitExportParameters( const Sequence< PropertyValue >& rParams { OSL_FAIL("Unknown property for html export detected!"); } - - pParams++; } if( meMode == PUBLISH_KIOSK ) diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx index b9eb1697375e..6967bde74689 100644 --- a/sd/source/filter/ppt/pptinanimations.cxx +++ b/sd/source/filter/ppt/pptinanimations.cxx @@ -530,12 +530,10 @@ bool AnimationImporter::convertAnimationNode( const Reference< XAnimationNode >& } Sequence< Any > aValues( xAnimate->getValues() ); - sal_Int32 nValues = aValues.getLength(); - if( nValues ) + if( aValues.hasElements() ) { - Any* p2 = aValues.getArray(); - while( nValues-- ) - oox::ppt::convertAnimationValue(eAttribute, *p2++); + for( Any& rValue : aValues ) + oox::ppt::convertAnimationValue(eAttribute, rValue); xAnimate->setValues( aValues ); } @@ -550,28 +548,27 @@ bool AnimationImporter::convertAnimationNode( const Reference< XAnimationNode >& // check for after-effect Sequence< NamedValue > aUserData( xNode->getUserData() ); - NamedValue* pValue = aUserData.getArray(); - NamedValue* pLastValue = pValue; - sal_Int32 nLength = aUserData.getLength(), nRemoved = 0; + NamedValue* pLastValue = aUserData.getArray(); + sal_Int32 nRemoved = 0; bool bAfterEffect = false; sal_Int32 nMasterRel = 0; - for( ; nLength--; pValue++ ) + for( const NamedValue& rValue : aUserData ) { - if ( pValue->Name == "after-effect" ) + if ( rValue.Name == "after-effect" ) { - pValue->Value >>= bAfterEffect; + rValue.Value >>= bAfterEffect; nRemoved++; } - else if ( pValue->Name == "master-rel" ) + else if ( rValue.Name == "master-rel" ) { - pValue->Value >>= nMasterRel; + rValue.Value >>= nMasterRel; nRemoved++; } else { if( nRemoved ) - *pLastValue = *pValue; + *pLastValue = rValue; pLastValue++; } } diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx index 34e69ef7d6e8..d75f0c2cd56f 100644 --- a/sd/source/ui/app/optsitem.cxx +++ b/sd/source/ui/app/optsitem.cxx @@ -134,7 +134,7 @@ void SdOptionsGeneric::Commit( SdOptionsItem& rCfgItem ) const const Sequence< OUString > aNames( GetPropertyNames() ); Sequence< Any > aValues( aNames.getLength() ); - if( aNames.hasElements() && ( aValues.getLength() == aNames.getLength() ) ) + if( aNames.hasElements() ) { if( WriteData( aValues.getArray() ) ) rCfgItem.PutProperties( aNames, aValues ); diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index c8234b9304b8..60d9a9d1c1f6 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -531,10 +531,10 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, FileHdl, weld::Button&, void) batch->commit(); } - for ( sal_Int32 i = 0; i < aFilesArr.getLength(); i++ ) + for ( const auto& rFile : aFilesArr ) { // Store full path, show filename only. Use INetURLObject to display spaces in filename correctly - INetURLObject aUrl(aFilesArr[i]); + INetURLObject aUrl(rFile); m_xImagesLst->append(aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE), aUrl.GetLastName(INetURLObject::DecodeMechanism::WithCharset), ""); } } diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 7e8bb51a0471..a99f1fcd2ef9 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -207,9 +207,8 @@ void SdTPAction::Construct() aVerbs = xObj->getSupportedVerbs(); } - for( sal_Int32 i=0; i<aVerbs.getLength(); i++ ) + for( const embed::VerbDescriptor& aVerb : aVerbs ) { - embed::VerbDescriptor aVerb = aVerbs[i]; if( aVerb.VerbAttributes & embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU ) { OUString aTmp( aVerb.VerbName ); diff --git a/sd/source/ui/framework/configuration/Configuration.cxx b/sd/source/ui/framework/configuration/Configuration.cxx index d303b2464156..3fc947c5c92a 100644 --- a/sd/source/ui/framework/configuration/Configuration.cxx +++ b/sd/source/ui/framework/configuration/Configuration.cxx @@ -290,29 +290,14 @@ bool AreConfigurationsEquivalent ( // When the number of resources differ then the configurations can not // be equivalent. - const sal_Int32 nCount (aResources1.getLength()); - const sal_Int32 nCount2 (aResources2.getLength()); - if (nCount != nCount2) - return false; - // Comparison of the two lists of resource ids relies on their // ordering. - for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex) - { - const Reference<XResourceId> xResource1 (aResources1[nIndex]); - const Reference<XResourceId> xResource2 (aResources2[nIndex]); - if (xResource1.is() && xResource2.is()) - { - if (xResource1->compareTo(xResource2) != 0) - return false; - } - else if (xResource1.is() != xResource2.is()) - { - return false; - } - } - - return true; + return std::equal(aResources1.begin(), aResources1.end(), aResources2.begin(), aResources2.end(), + [](const Reference<XResourceId>& a, const Reference<XResourceId>& b) { + if (a.is() && b.is()) + return a->compareTo(b) == 0; + return a.is() == b.is(); + }); } } } // end of namespace sd::framework diff --git a/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx b/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx index 9bd9e19efa76..c39adf26d126 100644 --- a/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationClassifier.cxx @@ -89,39 +89,31 @@ void ConfigurationClassifier::ClassifyResources ( ResourceIdVector& rS2minusS1, ResourceIdVector& rS1andS2) { - // Get arrays from the sequences for faster iteration. - const Reference<XResourceId>* aA1 = rS1.getConstArray(); - const Reference<XResourceId>* aA2 = rS2.getConstArray(); - sal_Int32 nL1 (rS1.getLength()); - sal_Int32 nL2 (rS2.getLength()); - // Find all elements in rS1 and place them in rS1minusS2 or rS1andS2 // depending on whether they are in rS2 or not. - for (sal_Int32 i=0; i<nL1; ++i) + for (const Reference<XResourceId>& rA1 : rS1) { - bool bFound (false); - for (sal_Int32 j=0; j<nL2 && !bFound; ++j) - if (aA1[i]->getResourceURL() == aA2[j]->getResourceURL()) - bFound = true; + bool bFound = std::any_of(rS2.begin(), rS2.end(), + [&rA1](const Reference<XResourceId>& rA2) { + return rA1->getResourceURL() == rA2->getResourceURL(); }); if (bFound) - rS1andS2.push_back(aA1[i]); + rS1andS2.push_back(rA1); else - rS1minusS2.push_back(aA1[i]); + rS1minusS2.push_back(rA1); } // Find all elements in rS2 that are not in rS1. The elements that are // in both rS1 and rS2 have been handled above and are therefore ignored // here. - for (sal_Int32 j=0; j<nL2; ++j) + for (const Reference<XResourceId>& rA2 : rS2) { - bool bFound (false); - for (sal_Int32 i=0; i<nL1 && !bFound; ++i) - if (aA2[j]->getResourceURL() == aA1[i]->getResourceURL()) - bFound = true; + bool bFound = std::any_of(rS1.begin(), rS1.end(), + [&rA2](const Reference<XResourceId>& rA1) { + return rA2->getResourceURL() == rA1->getResourceURL(); }); if ( ! bFound) - rS2minusS1.push_back(aA2[j]); + rS2minusS1.push_back(rA2); } } @@ -146,12 +138,11 @@ void ConfigurationClassifier::CopyResources ( SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": copying " << FrameworkHelper::ResourceIdToString(rxResource)); - const Reference<XResourceId>* aA = aBoundResources.getConstArray(); - for (sal_Int32 i=0; i<nL; ++i) + for (const Reference<XResourceId>& rBoundResource : aBoundResources) { - rTarget.push_back(aA[i]); + rTarget.push_back(rBoundResource); SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": copying " << - FrameworkHelper::ResourceIdToString(aA[i])); + FrameworkHelper::ResourceIdToString(rBoundResource)); } } } diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx index 9e8fb6fadeee..a78f18f1f2b1 100644 --- a/sd/source/ui/framework/configuration/ConfigurationController.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx @@ -259,17 +259,17 @@ void SAL_CALL ConfigurationController::requestResourceActivation ( rxResourceId->getResourceTypePrefix(), AnchorBindingMode_DIRECT)); - for (sal_Int32 nIndex=0; nIndex<aResourceList.getLength(); ++nIndex) + for (const auto& rResource : aResourceList) { // Do not request the deactivation of the resource for which // this method was called. Doing it would not change the // outcome but would result in unnecessary work. - if (rxResourceId->compareTo(aResourceList[nIndex]) == 0) + if (rxResourceId->compareTo(rResource) == 0) continue; // Request the deactivation of a resource and all resources // linked to it. - requestResourceDeactivation(aResourceList[nIndex]); + requestResourceDeactivation(rResource); } } @@ -299,13 +299,12 @@ void SAL_CALL ConfigurationController::requestResourceDeactivation ( rxResourceId, OUString(), AnchorBindingMode_DIRECT)); - const sal_Int32 nCount (aLinkedResources.getLength()); - for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex) + for (const auto& rLinkedResource : aLinkedResources) { // We do not add deactivation requests directly but call this // method recursively, so that when one time there are resources // linked to linked resources, these are handled correctly, too. - requestResourceDeactivation(aLinkedResources[nIndex]); + requestResourceDeactivation(rLinkedResource); } // Add a deactivation request for the specified resource. diff --git a/sd/source/ui/framework/configuration/ResourceId.cxx b/sd/source/ui/framework/configuration/ResourceId.cxx index 78090fe121ac..63144754cba4 100644 --- a/sd/source/ui/framework/configuration/ResourceId.cxx +++ b/sd/source/ui/framework/configuration/ResourceId.cxx @@ -96,8 +96,7 @@ ResourceId::ResourceId ( { maResourceURLs[0] = rsResourceURL; maResourceURLs[1] = rsFirstAnchorURL; - for (sal_Int32 nIndex=0; nIndex<rAnchorURLs.getLength(); ++nIndex) - maResourceURLs[nIndex+2] = rAnchorURLs[nIndex]; + std::copy(rAnchorURLs.begin(), rAnchorURLs.end(), std::next(maResourceURLs.begin(), 2)); ParseResourceURL(); } @@ -360,25 +359,21 @@ Reference<XResourceId> SAL_CALL void SAL_CALL ResourceId::initialize (const Sequence<Any>& aArguments) { - sal_uInt32 nCount (aArguments.getLength()); - for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex) + for (const auto& rArgument : aArguments) { OUString sResourceURL; - if (aArguments[nIndex] >>= sResourceURL) + if (rArgument >>= sResourceURL) maResourceURLs.push_back(sResourceURL); else { Reference<XResourceId> xAnchor; - if (aArguments[nIndex] >>= xAnchor) + if (rArgument >>= xAnchor) { if (xAnchor.is()) { maResourceURLs.push_back(xAnchor->getResourceURL()); Sequence<OUString> aAnchorURLs (xAnchor->getAnchorURLs()); - for (sal_Int32 nURLIndex=0; nURLIndex<aAnchorURLs.getLength(); ++nURLIndex) - { - maResourceURLs.push_back(aAnchorURLs[nURLIndex]); - } + std::copy(aAnchorURLs.begin(), aAnchorURLs.end(), std::back_inserter(maResourceURLs)); } } } diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index 2055867dfd36..95557819e8c7 100644 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -117,10 +117,9 @@ sal_Bool SAL_CALL ViewShellWrapper::select( const css::uno::Any& aSelection ) rSelector.DeselectAllPages(); Sequence<Reference<drawing::XDrawPage> > xPages; aSelection >>= xPages; - const sal_uInt32 nCount = xPages.getLength(); - for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex) + for (const auto& rPage : xPages) { - Reference<beans::XPropertySet> xSet (xPages[nIndex], UNO_QUERY); + Reference<beans::XPropertySet> xSet (rPage, UNO_QUERY); if (xSet.is()) { try diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index e3826d01c041..830be7136bba 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -753,10 +753,10 @@ OUString FrameworkHelper::ResourceIdToString (const Reference<XResourceId>& rxRe if (rxResourceId->hasAnchor()) { Sequence<OUString> aAnchorURLs (rxResourceId->getAnchorURLs()); - for (sal_Int32 nIndex=0; nIndex < aAnchorURLs.getLength(); ++nIndex) + for (const auto& rAnchorURL : aAnchorURLs) { sString.append(" | "); - sString.append(aAnchorURLs[nIndex]); + sString.append(rAnchorURL); } } } diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx index a4cc985595ff..d93db30203cf 100644 --- a/sd/source/ui/remotecontrol/Server.cxx +++ b/sd/source/ui/remotecontrol/Server.cxx @@ -20,6 +20,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/configuration.hxx> +#include <comphelper/sequence.hxx> #include <sal/log.hxx> #include <vcl/svapp.hxx> #include <osl/socket.hxx> @@ -147,11 +148,11 @@ void RemoteServer::execute() Reference< XNameAccess > const xConfig = officecfg::Office::Impress::Misc::AuthorisedRemotes::get(); Sequence< OUString > aNames = xConfig->getElementNames(); bool aFound = false; - for ( int i = 0; i < aNames.getLength(); i++ ) + for ( const auto& rName : aNames ) { - if ( aNames[i] == pClient->mName ) + if ( rName == pClient->mName ) { - Reference<XNameAccess> xSetItem( xConfig->getByName(aNames[i]), UNO_QUERY ); + Reference<XNameAccess> xSetItem( xConfig->getByName(rName), UNO_QUERY ); Any axPin(xSetItem->getByName("PIN")); OUString sPin; axPin >>= sPin; @@ -163,7 +164,6 @@ void RemoteServer::execute() break; } } - } // Pin not found so inform the client. if ( !aFound ) @@ -255,10 +255,9 @@ std::vector< std::shared_ptr< ClientInfo > > RemoteServer::getClients() // authorised AND connected client. Reference< XNameAccess > const xConfig = officecfg::Office::Impress::Misc::AuthorisedRemotes::get(); Sequence< OUString > aNames = xConfig->getElementNames(); - for ( int i = 0; i < aNames.getLength(); i++ ) - { - aClients.push_back( std::make_shared< ClientInfo > ( aNames[i], true ) ); - } + std::transform(aNames.begin(), aNames.end(), std::back_inserter(aClients), + [](const OUString& rName) -> std::shared_ptr<ClientInfo> { + return std::make_shared<ClientInfo>(rName, true); }); return aClients; } @@ -289,18 +288,10 @@ bool RemoteServer::connectClient( const std::shared_ptr< ClientInfo >& pClient, if (xChild.is()) { // Check whether the client is already saved - bool aSaved = false; Sequence< OUString > aNames = xConfig->getElementNames(); - for ( int i = 0; i < aNames.getLength(); i++ ) - { - if ( aNames[i] == apClient->mName ) - { - xConfig->replaceByName( apClient->mName, makeAny( xChild ) ); - aSaved = true; - break; - } - } - if ( !aSaved ) + if (comphelper::findValue(aNames, apClient->mName) != -1) + xConfig->replaceByName( apClient->mName, makeAny( xChild ) ); + else xConfig->insertByName( apClient->mName, makeAny( xChild ) ); aValue <<= apClient->mPin; xChild->replaceByName("PIN", aValue); diff --git a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx index 353bd6e2fe5a..f20e30dd4825 100644 --- a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx @@ -137,10 +137,10 @@ void RecentlyUsedMasterPages::LoadPersistentValues() Sequence<OUString> aKeys (xSet->getElementNames()); mvMasterPages.clear(); mvMasterPages.reserve(aKeys.getLength()); - for (int i=0; i<aKeys.getLength(); i++) + for (const auto& rKey : aKeys) { Reference<container::XNameAccess> xSetItem ( - xSet->getByName(aKeys[i]), UNO_QUERY); + xSet->getByName(rKey), UNO_QUERY); if (xSetItem.is()) { Any aURL (xSetItem->getByName(sURLMemberName)); @@ -195,9 +195,8 @@ void RecentlyUsedMasterPages::SavePersistentValues() // Clear the set. Sequence<OUString> aKeys (xSet->getElementNames()); - sal_Int32 i; - for (i=0; i<aKeys.getLength(); i++) - xSet->removeByName (aKeys[i]); + for (const auto& rKey : aKeys) + xSet->removeByName (rKey); // Fill it with the URLs of this object. const OUString sURLMemberName("URL"); diff --git a/sd/source/ui/slideshow/PaneHider.cxx b/sd/source/ui/slideshow/PaneHider.cxx index d4265dbbb80f..a8d12a0b3123 100644 --- a/sd/source/ui/slideshow/PaneHider.cxx +++ b/sd/source/ui/slideshow/PaneHider.cxx @@ -65,9 +65,8 @@ PaneHider::PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow) nullptr, framework::FrameworkHelper::msPaneURLPrefix, AnchorBindingMode_DIRECT)); - for (sal_Int32 nIndex=0; nIndex<aResources.getLength(); ++nIndex) + for (const Reference<XResourceId>& xPaneId : aResources) { - Reference<XResourceId> xPaneId (aResources[nIndex]); if ( xPaneId->getResourceURL() != FrameworkHelper::msCenterPaneURL ) { mxConfigurationController->requestResourceDeactivation(xPaneId); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index de9e191f8203..88a235965f5c 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -747,12 +747,10 @@ bool SlideshowImpl::startPreview( if (xServiceInfo.is()) { const Sequence<OUString> supportedServices( xServiceInfo->getSupportedServiceNames() ); - for ( sal_Int32 pos = supportedServices.getLength(); pos--; ) { - if ( supportedServices[pos] == "com.sun.star.drawing.MasterPage" ) { - OSL_FAIL("sd::SlideshowImpl::startPreview() " - "not allowed on master page!"); - return false; - } + if (comphelper::findValue(supportedServices, "com.sun.star.drawing.MasterPage") != -1) { + OSL_FAIL("sd::SlideshowImpl::startPreview() " + "not allowed on master page!"); + return false; } } @@ -1092,10 +1090,8 @@ bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProp } } - const sal_Int32 nCount = aProperties.getLength(); - sal_Int32 nIndex; - for( nIndex = 0; nIndex < nCount; nIndex++ ) - mxShow->setProperty( aProperties[nIndex] ); + for( const auto& rProp : aProperties ) + mxShow->setProperty( rProp ); mxShow->addView( mxView.get() ); @@ -3068,13 +3064,9 @@ PresentationSettingsEx::PresentationSettingsEx( PresentationSettings const & r ) void PresentationSettingsEx::SetArguments( const Sequence< PropertyValue >& rArguments ) { - sal_Int32 nArguments = rArguments.getLength(); - const PropertyValue* pValue = rArguments.getConstArray(); - - while( nArguments-- ) + for( const PropertyValue& rValue : rArguments ) { - SetPropertyValue( pValue->Name, pValue->Value ); - pValue++; + SetPropertyValue( rValue.Name, rValue.Value ); } } diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 3e6b665b5245..fa4f4a64d37d 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -377,14 +377,9 @@ void TableDesignWidget::updateControls() if( xNames.is() ) { Sequence< OUString > aNames( xNames->getElementNames() ); - for( sal_Int32 nIndex = 0; nIndex < aNames.getLength(); nIndex++ ) - { - if( aNames[nIndex] == sStyleName ) - { - nSelection = static_cast<sal_uInt16>(nIndex)+1; - break; - } - } + sal_Int32 nIndex = comphelper::findValue(aNames, sStyleName); + if (nIndex != -1) + nSelection = static_cast<sal_uInt16>(nIndex) + 1; } } } diff --git a/sd/source/ui/tools/ConfigurationAccess.cxx b/sd/source/ui/tools/ConfigurationAccess.cxx index dcee221eee52..12d3af927d9d 100644 --- a/sd/source/ui/tools/ConfigurationAccess.cxx +++ b/sd/source/ui/tools/ConfigurationAccess.cxx @@ -132,9 +132,8 @@ void ConfigurationAccess::ForAll ( ::std::vector<Any> aValues(rArguments.size()); Sequence<OUString> aKeys (rxContainer->getElementNames()); - for (sal_Int32 nItemIndex=0; nItemIndex < aKeys.getLength(); ++nItemIndex) + for (const OUString& rsKey : aKeys) { - const OUString& rsKey (aKeys[nItemIndex]); Reference<container::XNameAccess> xSetItem (rxContainer->getByName(rsKey), UNO_QUERY); if (xSetItem.is()) { diff --git a/sd/source/ui/unoidl/SdUnoSlideView.cxx b/sd/source/ui/unoidl/SdUnoSlideView.cxx index a2758fb90718..8df0ab9f2542 100644 --- a/sd/source/ui/unoidl/SdUnoSlideView.cxx +++ b/sd/source/ui/unoidl/SdUnoSlideView.cxx @@ -58,10 +58,9 @@ sal_Bool SAL_CALL SdUnoSlideView::select (const Any& aSelection) rSelector.DeselectAllPages(); Sequence<Reference<drawing::XDrawPage> > xPages; aSelection >>= xPages; - const sal_uInt32 nCount = xPages.getLength(); - for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex) + for (const auto& rPage : xPages) { - Reference<beans::XPropertySet> xSet (xPages[nIndex], UNO_QUERY); + Reference<beans::XPropertySet> xSet (rPage, UNO_QUERY); if (xSet.is()) { try diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 2b426a632380..53ca87c54ab1 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -310,15 +310,15 @@ uno::Sequence<beans::PropertyValue> { uno::Sequence<beans::PropertyValue> aRet( aConfigProps.getLength() ); int nRet = 0; - for( sal_Int32 i = 0; i < aConfigProps.getLength(); i++ ) + for( const auto& rConfigProp : aConfigProps ) { - XPropertyListType t = getTypeOfName( aConfigProps[i].Name ); + XPropertyListType t = getTypeOfName( rConfigProp.Name ); if (t == XPropertyListType::Unknown) - aRet[nRet++] = aConfigProps[i]; + aRet[nRet++] = rConfigProp; else { OUString aURL; - aConfigProps[i].Value >>= aURL; + rConfigProp.Value >>= aURL; LoadList( t, aURL, referer, xStorage ); } } diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index f414d6ec9246..c0f3bd5b1b76 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -368,7 +368,7 @@ uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::getTypes( ) { ::SolarMutexGuard aGuard; - if( maTypeSequence.getLength() == 0 ) + if( !maTypeSequence.hasElements() ) { uno::Sequence< uno::Type > aTypes( SfxBaseModel::getTypes() ); aTypes = comphelper::concatSequences(aTypes, @@ -1480,10 +1480,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( throw lang::DisposedException(); bool bExportNotesPages = false; - for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) + for( const auto& rOption : rxOptions ) { - if ( rxOptions[ nProperty ].Name == "ExportNotesPages" ) - rxOptions[ nProperty].Value >>= bExportNotesPages; + if ( rOption.Name == "ExportNotesPages" ) + rOption.Value >>= bExportNotesPages; } uno::Sequence< beans::PropertyValue > aRenderer; if (mpDocShell) @@ -1883,13 +1883,13 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r PageKind ePageKind = PageKind::Standard; bool bExportNotesPages = false; - for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) + for( const auto& rOption : rxOptions ) { - if ( rxOptions[ nProperty ].Name == "RenderDevice" ) - rxOptions[ nProperty ].Value >>= xRenderDevice; - else if ( rxOptions[ nProperty ].Name == "ExportNotesPages" ) + if ( rOption.Name == "RenderDevice" ) + rOption.Value >>= xRenderDevice; + else if ( rOption.Name == "ExportNotesPages" ) { - rxOptions[ nProperty].Value >>= bExportNotesPages; + rOption.Value >>= bExportNotesPages; if ( bExportNotesPages ) ePageKind = PageKind::Notes; } @@ -2449,9 +2449,8 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs if (DrawViewShell* pViewShell = GetViewShell()) { DrawView* pDrawView = pViewShell->GetDrawView(); - for (sal_Int32 i = 0; i < rArguments.getLength(); ++i) + for (const beans::PropertyValue& rValue : rArguments) { - const beans::PropertyValue& rValue = rArguments[i]; if (rValue.Name == ".uno:ShowBorderShadow" && rValue.Value.has<bool>()) pDrawView->SetPageShadowVisible(rValue.Value.get<bool>()); else if (rValue.Name == ".uno:Author" && rValue.Value.has<OUString>()) diff --git a/sd/source/ui/unoidl/unomodule.cxx b/sd/source/ui/unoidl/unomodule.cxx index 425f3d074d40..315d77d72309 100644 --- a/sd/source/ui/unoidl/unomodule.cxx +++ b/sd/source/ui/unoidl/unomodule.cxx @@ -83,12 +83,9 @@ uno::Sequence< uno::Reference< frame::XDispatch > > SAL_CALL SdUnoModule::queryD sal_Int32 nCount = seqDescripts.getLength(); uno::Sequence< uno::Reference< frame::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 frame::DispatchDescriptor& rDescr) -> uno::Reference<frame::XDispatch> { + return queryDispatch(rDescr.FeatureURL, rDescr.FrameName, rDescr.SearchFlags); }); return lDispatcher; } diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 4ee7abb1e749..2fd1f0fa9144 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -1129,7 +1129,6 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno throw lang::IllegalArgumentException(); FoundFlags nFound = FoundFlags::NONE; - const beans::PropertyValue* pProperties = aProperties.getConstArray(); OUString aStrEventType; presentation::ClickAction eClickAction = presentation::ClickAction_NONE; @@ -1142,85 +1141,83 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno OUString aStrLibrary; OUString aStrBookmark; - const sal_Int32 nCount = aProperties.getLength(); - sal_Int32 nIndex; - for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ ) + for( const beans::PropertyValue& rProperty : aProperties ) { - if( !( nFound & FoundFlags::EventType ) && pProperties->Name == gaStrEventType ) + if( !( nFound & FoundFlags::EventType ) && rProperty.Name == gaStrEventType ) { - if( pProperties->Value >>= aStrEventType ) + if( rProperty.Value >>= aStrEventType ) { nFound |= FoundFlags::EventType; continue; } } - else if( !( nFound & FoundFlags::ClickAction ) && pProperties->Name == gaStrClickAction ) + else if( !( nFound & FoundFlags::ClickAction ) && rProperty.Name == gaStrClickAction ) { - if( pProperties->Value >>= eClickAction ) + if( rProperty.Value >>= eClickAction ) { nFound |= FoundFlags::ClickAction; continue; } } - else if( !( nFound & FoundFlags::Macro ) && ( pProperties->Name == gaStrMacroName || pProperties->Name == gaStrScript ) ) + else if( !( nFound & FoundFlags::Macro ) && ( rProperty.Name == gaStrMacroName || rProperty.Name == gaStrScript ) ) { - if( pProperties->Value >>= aStrMacro ) + if( rProperty.Value >>= aStrMacro ) { nFound |= FoundFlags::Macro; continue; } } - else if( !( nFound & FoundFlags::Library ) && pProperties->Name == gaStrLibrary ) + else if( !( nFound & FoundFlags::Library ) && rProperty.Name == gaStrLibrary ) { - if( pProperties->Value >>= aStrLibrary ) + if( rProperty.Value >>= aStrLibrary ) { nFound |= FoundFlags::Library; continue; } } - else if( !( nFound & FoundFlags::Effect ) && pProperties->Name == gaStrEffect ) + else if( !( nFound & FoundFlags::Effect ) && rProperty.Name == gaStrEffect ) { - if( pProperties->Value >>= eEffect ) + if( rProperty.Value >>= eEffect ) { nFound |= FoundFlags::Effect; continue; } } - else if( !( nFound & FoundFlags::Bookmark ) && pProperties->Name == gaStrBookmark ) + else if( !( nFound & FoundFlags::Bookmark ) && rProperty.Name == gaStrBookmark ) { - if( pProperties->Value >>= aStrBookmark ) + if( rProperty.Value >>= aStrBookmark ) { nFound |= FoundFlags::Bookmark; continue; } } - else if( !( nFound & FoundFlags::Speed ) && pProperties->Name == gaStrSpeed ) + else if( !( nFound & FoundFlags::Speed ) && rProperty.Name == gaStrSpeed ) { - if( pProperties->Value >>= eSpeed ) + if( rProperty.Value >>= eSpeed ) { nFound |= FoundFlags::Speed; continue; } } - else if( !( nFound & FoundFlags::SoundUrl ) && pProperties->Name == gaStrSoundURL ) + else if( !( nFound & FoundFlags::SoundUrl ) && rProperty.Name == gaStrSoundURL ) { - if( pProperties->Value >>= aStrSoundURL ) + if( rProperty.Value >>= aStrSoundURL ) { nFound |= FoundFlags::SoundUrl; continue; } } - else if( !( nFound & FoundFlags::PlayFull ) && pProperties->Name == gaStrPlayFull ) + else if( !( nFound & FoundFlags::PlayFull ) && rProperty.Name == gaStrPlayFull ) { - if( pProperties->Value >>= bPlayFull ) + if( rProperty.Value >>= bPlayFull ) { nFound |= FoundFlags::PlayFull; continue; } } - else if( !( nFound & FoundFlags::Verb ) && pProperties->Name == gaStrVerb ) + else if( !( nFound & FoundFlags::Verb ) && rProperty.Name == gaStrVerb ) { - if( pProperties->Value >>= nVerb ) + if( rProperty.Value >>= nVerb ) { nFound |= FoundFlags::Verb; continue; diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index a5351af710dd..eaaef7cc7497 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -1328,24 +1328,22 @@ void SAL_CALL SdGenericDrawPage::setPropertyValues( const Sequence< OUString >& Sequence< Any > SAL_CALL SdGenericDrawPage::getPropertyValues( const Sequence< OUString >& aPropertyNames ) { - const OUString* pNames = aPropertyNames.getConstArray(); - sal_uInt32 nCount = aPropertyNames.getLength(); + sal_Int32 nCount = aPropertyNames.getLength(); Sequence< Any > aValues( nCount ); - Any* pValues = aValues.getArray(); - while( nCount-- ) - { - Any aValue; - try - { - aValue = getPropertyValue( *pNames++ ); - } - catch( beans::UnknownPropertyException& ) - { - // ignore for multi property set - // todo: optimize this! - } - *pValues++ = aValue; - } + std::transform(aPropertyNames.begin(), aPropertyNames.end(), aValues.begin(), + [this](const OUString& rName) -> Any { + Any aValue; + try + { + aValue = getPropertyValue(rName); + } + catch( beans::UnknownPropertyException& ) + { + // ignore for multi property set + // todo: optimize this! + } + return aValue; + }); return aValues; } @@ -2462,17 +2460,13 @@ void SdDrawPage::setBackground( const Any& rValue ) Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo() ); Sequence< beans::Property > aProperties( xDestSetInfo->getProperties() ); - sal_Int32 nCount = aProperties.getLength(); - beans::Property* pProp = aProperties.getArray(); - while( nCount-- ) + for( const beans::Property& rProp : aProperties ) { - const OUString aPropName( pProp->Name ); + const OUString aPropName( rProp.Name ); if( xSetInfo->hasPropertyByName( aPropName ) ) xDestSet->setPropertyValue( aPropName, xSet->getPropertyValue( aPropName ) ); - - pProp++; } pBackground->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet ); @@ -2834,16 +2828,12 @@ void SdMasterPage::setBackground( const Any& rValue ) Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo(), UNO_SET_THROW ); uno::Sequence< beans::Property> aProperties( xDestSetInfo->getProperties() ); - sal_Int32 nCount = aProperties.getLength(); - beans::Property* pProp = aProperties.getArray(); - while( nCount-- ) + for( const beans::Property& rProp : aProperties ) { - const OUString aPropName( pProp->Name ); + const OUString aPropName( rProp.Name ); if( xInputSetInfo->hasPropertyByName( aPropName ) ) xDestSet->setPropertyValue( aPropName, xInputSet->getPropertyValue( aPropName ) ); - - pProp++; } pBackground->fillItemSet( static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()), aSet ); diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index 459bdb42de71..1f379ed104e8 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -355,13 +355,11 @@ uno::Sequence< beans::PropertyState > SAL_CALL SdUnoPageBackground::getPropertyS SolarMutexGuard aGuard; sal_Int32 nCount = aPropertyName.getLength(); - const OUString* pNames = aPropertyName.getConstArray(); uno::Sequence< beans::PropertyState > aPropertyStateSequence( nCount ); - beans::PropertyState* pState = aPropertyStateSequence.getArray(); - while( nCount-- ) - *pState++ = getPropertyState( *pNames++ ); + std::transform(aPropertyName.begin(), aPropertyName.end(), aPropertyStateSequence.begin(), + [this](const OUString& rName) -> beans::PropertyState { return getPropertyState(rName); }); return aPropertyStateSequence; } diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 19bf110c4a73..9df208a77760 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -681,8 +681,8 @@ namespace { CreateChoice(STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES, SAL_N_ELEMENTS(STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES))); maSlidesPerPage.clear(); maSlidesPerPage.push_back(0); // first is using the default - for (sal_Int32 nIndex=1,nCount=aChoice.getLength(); nIndex<nCount; ++nIndex) - maSlidesPerPage.push_back(aChoice[nIndex].toInt32()); + std::transform(std::next(aChoice.begin()), aChoice.end(), std::back_inserter(maSlidesPerPage), + [](const OUString& rChoice) -> sal_Int32 { return rChoice.toInt32(); }); return aChoice; } }; diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 84ba981029a1..4a875076d561 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -883,36 +883,33 @@ OUString ViewShellBase::GetInitialViewShellType() // Search the properties for the one that tells us what page kind to // use. - for (sal_Int32 n=0; n<aProperties.getLength(); n++) + auto pProperty = std::find_if(aProperties.begin(), aProperties.end(), + [](const beans::PropertyValue& rProperty) { return rProperty.Name == sUNO_View_PageKind; }); + if (pProperty != aProperties.end()) { - const beans::PropertyValue& rProperty (aProperties[n]); - if (rProperty.Name == sUNO_View_PageKind) + sal_Int16 nPageKind = 0; + pProperty->Value >>= nPageKind; + switch (static_cast<PageKind>(nPageKind)) { - sal_Int16 nPageKind = 0; - rProperty.Value >>= nPageKind; - switch (static_cast<PageKind>(nPageKind)) - { - case PageKind::Standard: - sRequestedView = FrameworkHelper::msImpressViewURL; - break; + case PageKind::Standard: + sRequestedView = FrameworkHelper::msImpressViewURL; + break; - case PageKind::Handout: - sRequestedView = FrameworkHelper::msHandoutViewURL; - break; + case PageKind::Handout: + sRequestedView = FrameworkHelper::msHandoutViewURL; + break; - case PageKind::Notes: - sRequestedView = FrameworkHelper::msNotesViewURL; - break; + case PageKind::Notes: + sRequestedView = FrameworkHelper::msNotesViewURL; + break; - default: - // The page kind is invalid. This is probably an - // error by the caller. We use the standard type to - // keep things going. - SAL_WARN( "sd.view", "ViewShellBase::GetInitialViewShellType: invalid page kind"); - sRequestedView = FrameworkHelper::msImpressViewURL; - break; - } - break; + default: + // The page kind is invalid. This is probably an + // error by the caller. We use the standard type to + // keep things going. + SAL_WARN( "sd.view", "ViewShellBase::GetInitialViewShellType: invalid page kind"); + sRequestedView = FrameworkHelper::msImpressViewURL; + break; } } } diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 66512b0a777d..f534127aafcb 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -458,20 +458,18 @@ void DrawViewShell::ReadUserDataSequence ( const css::uno::Sequence < css::beans ViewShell::ReadUserDataSequence( rSequence ); - const sal_Int32 nLength = rSequence.getLength(); - const css::beans::PropertyValue *pValue = rSequence.getConstArray(); - for (sal_Int32 i = 0 ; i < nLength; i++, pValue++ ) + for (const css::beans::PropertyValue& rValue : rSequence) { - if ( pValue->Name == sUNO_View_ZoomOnPage ) + if ( rValue.Name == sUNO_View_ZoomOnPage ) { bool bZoomPage = false; - if( pValue->Value >>= bZoomPage ) + if( rValue.Value >>= bZoomPage ) { mbZoomOnPage = bZoomPage; } } // Fallback to common SdrModel processing - else GetDocSh()->GetDoc()->ReadUserDataSequenceValue(pValue); + else GetDocSh()->GetDoc()->ReadUserDataSequenceValue(&rValue); } // The parameter rSequence contains the config-items from diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index f05d5fc40214..a05d2bea5b44 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -554,49 +554,48 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr sal_Int32 aSnapGridWidthYNum = GetSnapGridWidthY().GetNumerator(); sal_Int32 aSnapGridWidthYDom = GetSnapGridWidthY().GetDenominator(); - const css::beans::PropertyValue *pValue = rSequence.getConstArray(); - for (sal_Int32 i = 0 ; i < nLength; i++, pValue++ ) + for (const css::beans::PropertyValue& rValue : rSequence) { - if ( pValue->Name == sUNO_View_ViewId ) + if ( rValue.Name == sUNO_View_ViewId ) { } - else if ( pValue->Name == sUNO_View_SnapLinesDrawing ) + else if ( rValue.Name == sUNO_View_SnapLinesDrawing ) { - if( pValue->Value >>= aString ) + if( rValue.Value >>= aString ) { SdrHelpLineList aHelpLines; createHelpLinesFromString( aString, aHelpLines ); SetStandardHelpLines( aHelpLines ); } } - else if ( pValue->Name == sUNO_View_SnapLinesNotes ) + else if ( rValue.Name == sUNO_View_SnapLinesNotes ) { - if( pValue->Value >>= aString ) + if( rValue.Value >>= aString ) { SdrHelpLineList aHelpLines; createHelpLinesFromString( aString, aHelpLines ); SetNotesHelpLines( aHelpLines ); } } - else if ( pValue->Name == sUNO_View_SnapLinesHandout ) + else if ( rValue.Name == sUNO_View_SnapLinesHandout ) { - if( pValue->Value >>= aString ) + if( rValue.Value >>= aString ) { SdrHelpLineList aHelpLines; createHelpLinesFromString( aString, aHelpLines ); SetHandoutHelpLines( aHelpLines ); } } - else if ( pValue->Name == sUNO_View_RulerIsVisible ) + else if ( rValue.Name == sUNO_View_RulerIsVisible ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetRuler( bBool ); } } - else if ( pValue->Name == sUNO_View_PageKind ) + else if ( rValue.Name == sUNO_View_PageKind ) { - if( pValue->Value >>= nInt16 ) + if( rValue.Value >>= nInt16 ) { SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) @@ -605,9 +604,9 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr SetPageKindOnLoad( static_cast<PageKind>(nInt16) ); } } - else if ( pValue->Name == sUNO_View_SelectedPage ) + else if ( rValue.Name == sUNO_View_SelectedPage ) { - if( pValue->Value >>= nInt16 ) + if( rValue.Value >>= nInt16 ) { SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) @@ -616,37 +615,37 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr SetSelectedPageOnLoad( static_cast<sal_uInt16>(nInt16) ); } } - else if ( pValue->Name == sUNO_View_IsLayerMode ) + else if ( rValue.Name == sUNO_View_IsLayerMode ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetLayerMode( bBool ); } } - else if ( pValue->Name == sUNO_View_IsDoubleClickTextEdit ) + else if ( rValue.Name == sUNO_View_IsDoubleClickTextEdit ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetDoubleClickTextEdit( bBool ); } } - else if ( pValue->Name == sUNO_View_IsClickChangeRotation ) + else if ( rValue.Name == sUNO_View_IsClickChangeRotation ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetClickChangeRotation( bBool ); } } - else if ( pValue->Name == sUNO_View_SlidesPerRow ) + else if ( rValue.Name == sUNO_View_SlidesPerRow ) { - if( pValue->Value >>= nInt16 ) + if( rValue.Value >>= nInt16 ) { SetSlidesPerRow( static_cast<sal_uInt16>(nInt16) ); } } - else if ( pValue->Name == sUNO_View_EditMode ) + else if ( rValue.Name == sUNO_View_EditMode ) { - if( pValue->Value >>= nInt32 ) + if( rValue.Value >>= nInt32 ) { SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) @@ -656,19 +655,19 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr // This one is kept for compatibility. Old value read from sUNO_View_EditModeStandard // is used. New value will be written into sUNO_View_EditMode. // Values from sUNO_View_EditModeNotes and sUNO_View_EditModeHangout will be ignored. - else if ( pValue->Name == sUNO_View_EditModeStandard ) + else if ( rValue.Name == sUNO_View_EditModeStandard ) { - if( pValue->Value >>= nInt32 ) + if( rValue.Value >>= nInt32 ) { SdDrawDocument* pDoc = dynamic_cast< SdDrawDocument* >( GetModel() ); if( pDoc && pDoc->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED == pDoc->GetDocSh()->GetCreateMode() ) ) SetViewShEditMode( static_cast<EditMode>(nInt32) ); } } - else if ( pValue->Name == sUNO_View_VisibleAreaTop ) + else if ( rValue.Name == sUNO_View_VisibleAreaTop ) { sal_Int32 nTop = 0; - if( pValue->Value >>= nTop ) + if( rValue.Value >>= nTop ) { ::tools::Rectangle aVisArea( GetVisArea() ); aVisArea.AdjustBottom(nTop - aVisArea.Top() ); @@ -676,10 +675,10 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr SetVisArea( aVisArea ); } } - else if ( pValue->Name == sUNO_View_VisibleAreaLeft ) + else if ( rValue.Name == sUNO_View_VisibleAreaLeft ) { sal_Int32 nLeft = 0; - if( pValue->Value >>= nLeft ) + if( rValue.Value >>= nLeft ) { ::tools::Rectangle aVisArea( GetVisArea() ); aVisArea.AdjustRight(nLeft - aVisArea.Left() ); @@ -687,20 +686,20 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr SetVisArea( aVisArea ); } } - else if ( pValue->Name == sUNO_View_VisibleAreaWidth ) + else if ( rValue.Name == sUNO_View_VisibleAreaWidth ) { sal_Int32 nWidth = 0; - if( pValue->Value >>= nWidth ) + if( rValue.Value >>= nWidth ) { ::tools::Rectangle aVisArea( GetVisArea() ); aVisArea.SetRight( aVisArea.Left() + nWidth - 1 ); SetVisArea( aVisArea ); } } - else if ( pValue->Name == sUNO_View_VisibleAreaHeight ) + else if ( rValue.Name == sUNO_View_VisibleAreaHeight ) { sal_Int32 nHeight = 0; - if( pValue->Value >>= nHeight ) + if( rValue.Value >>= nHeight ) { ::tools::Rectangle aVisArea( GetVisArea() ); aVisArea.SetBottom( nHeight + aVisArea.Top() - 1 ); @@ -708,183 +707,183 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr } } - else if ( pValue->Name == sUNO_View_GridIsVisible ) + else if ( rValue.Name == sUNO_View_GridIsVisible ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetGridVisible( bBool ); } } - else if ( pValue->Name == sUNO_View_IsSnapToGrid ) + else if ( rValue.Name == sUNO_View_IsSnapToGrid ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetGridSnap( bBool ); } } - else if ( pValue->Name == sUNO_View_GridIsFront ) + else if ( rValue.Name == sUNO_View_GridIsFront ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetGridFront( bBool ); } } - else if ( pValue->Name == sUNO_View_IsSnapToPageMargins ) + else if ( rValue.Name == sUNO_View_IsSnapToPageMargins ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetBordSnap( bBool ); } } - else if ( pValue->Name == sUNO_View_IsSnapToSnapLines ) + else if ( rValue.Name == sUNO_View_IsSnapToSnapLines ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetHlplSnap( bBool ); } } - else if ( pValue->Name == sUNO_View_IsSnapToObjectFrame ) + else if ( rValue.Name == sUNO_View_IsSnapToObjectFrame ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetOFrmSnap( bBool ); } } - else if ( pValue->Name == sUNO_View_IsSnapToObjectPoints ) + else if ( rValue.Name == sUNO_View_IsSnapToObjectPoints ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetOPntSnap( bBool ); } } - else if ( pValue->Name == sUNO_View_IsPlusHandlesAlwaysVisible ) + else if ( rValue.Name == sUNO_View_IsPlusHandlesAlwaysVisible ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetPlusHandlesAlwaysVisible( bBool ); } } - else if ( pValue->Name == sUNO_View_IsFrameDragSingles ) + else if ( rValue.Name == sUNO_View_IsFrameDragSingles ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetFrameDragSingles( bBool ); } } - else if ( pValue->Name == sUNO_View_EliminatePolyPointLimitAngle ) + else if ( rValue.Name == sUNO_View_EliminatePolyPointLimitAngle ) { - if( pValue->Value >>= nInt32 ) + if( rValue.Value >>= nInt32 ) { SetEliminatePolyPointLimitAngle( nInt32 ); } } - else if ( pValue->Name == sUNO_View_IsEliminatePolyPoints ) + else if ( rValue.Name == sUNO_View_IsEliminatePolyPoints ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetEliminatePolyPoints( bBool ); } } - else if ( pValue->Name == sUNO_View_ActiveLayer ) + else if ( rValue.Name == sUNO_View_ActiveLayer ) { - if( pValue->Value >>= aString ) + if( rValue.Value >>= aString ) { SetActiveLayer( aString ); } } - else if ( pValue->Name == sUNO_View_NoAttribs ) + else if ( rValue.Name == sUNO_View_NoAttribs ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetNoAttribs( bBool ); } } - else if ( pValue->Name == sUNO_View_NoColors ) + else if ( rValue.Name == sUNO_View_NoColors ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetNoColors( bBool ); } } - else if ( pValue->Name == sUNO_View_GridCoarseWidth ) + else if ( rValue.Name == sUNO_View_GridCoarseWidth ) { - if( pValue->Value >>= nInt32 ) + if( rValue.Value >>= nInt32 ) { const Size aCoarse( nInt32, GetGridCoarse().Height() ); SetGridCoarse( aCoarse ); } } - else if ( pValue->Name == sUNO_View_GridCoarseHeight ) + else if ( rValue.Name == sUNO_View_GridCoarseHeight ) { - if( pValue->Value >>= nInt32 ) + if( rValue.Value >>= nInt32 ) { const Size aCoarse( GetGridCoarse().Width(), nInt32 ); SetGridCoarse( aCoarse ); } } - else if ( pValue->Name == sUNO_View_GridFineWidth ) + else if ( rValue.Name == sUNO_View_GridFineWidth ) { - if( pValue->Value >>= nInt32 ) + if( rValue.Value >>= nInt32 ) { const Size aCoarse( nInt32, GetGridFine().Height() ); SetGridFine( aCoarse ); } } - else if ( pValue->Name == sUNO_View_GridFineHeight ) + else if ( rValue.Name == sUNO_View_GridFineHeight ) { - if( pValue->Value >>= nInt32 ) + if( rValue.Value >>= nInt32 ) { const Size aCoarse( GetGridFine().Width(), nInt32 ); SetGridFine( aCoarse ); } } - else if ( pValue->Name == sUNO_View_IsAngleSnapEnabled ) + else if ( rValue.Name == sUNO_View_IsAngleSnapEnabled ) { - if( pValue->Value >>= bBool ) + if( rValue.Value >>= bBool ) { SetAngleSnapEnabled( bBool ); } } - else if ( pValue->Name == sUNO_View_SnapAngle ) + else if ( rValue.Name == sUNO_View_SnapAngle ) { - if( pValue->Value >>= nInt32 ) + if( rValue.Value >>= nInt32 ) { SetSnapAngle( nInt32 ); } } - else if ( pValue->Name == sUNO_View_GridSnapWidthXNumerator ) + else if ( rValue.Name == sUNO_View_GridSnapWidthXNumerator ) { - pValue->Value >>= aSnapGridWidthXNum; + rValue.Value >>= aSnapGridWidthXNum; } - else if ( pValue->Name == sUNO_View_GridSnapWidthXDenominator ) + else if ( rValue.Name == sUNO_View_GridSnapWidthXDenominator ) { - pValue->Value >>= aSnapGridWidthXDom; + rValue.Value >>= aSnapGridWidthXDom; } - else if ( pValue->Name == sUNO_View_GridSnapWidthYNumerator ) + else if ( rValue.Name == sUNO_View_GridSnapWidthYNumerator ) { - pValue->Value >>= aSnapGridWidthYNum; + rValue.Value >>= aSnapGridWidthYNum; } - else if ( pValue->Name == sUNO_View_GridSnapWidthYDenominator ) + else if ( rValue.Name == sUNO_View_GridSnapWidthYDenominator ) { - pValue->Value >>= aSnapGridWidthYDom; + rValue.Value >>= aSnapGridWidthYDom; } - else if (!bImpress && pValue->Name == sUNO_View_VisibleLayers ) + else if (!bImpress && rValue.Name == sUNO_View_VisibleLayers ) { SdrLayerIDSet aSdrLayerIDSets; - aSdrLayerIDSets.PutValue( pValue->Value ); + aSdrLayerIDSets.PutValue( rValue.Value ); SetVisibleLayers( aSdrLayerIDSets ); } - else if (!bImpress && pValue->Name == sUNO_View_PrintableLayers ) + else if (!bImpress && rValue.Name == sUNO_View_PrintableLayers ) { SdrLayerIDSet aSdrLayerIDSets; - aSdrLayerIDSets.PutValue( pValue->Value ); + aSdrLayerIDSets.PutValue( rValue.Value ); SetPrintableLayers( aSdrLayerIDSets ); } - else if (!bImpress && pValue->Name == sUNO_View_LockedLayers ) + else if (!bImpress && rValue.Name == sUNO_View_LockedLayers ) { SdrLayerIDSet aSdrLayerIDSets; - aSdrLayerIDSets.PutValue( pValue->Value ); + aSdrLayerIDSets.PutValue( rValue.Value ); SetLockedLayers( aSdrLayerIDSets ); } } |