summaryrefslogtreecommitdiff
path: root/reportdesign/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign/source/ui')
-rw-r--r--reportdesign/source/ui/dlg/CondFormat.cxx25
-rw-r--r--reportdesign/source/ui/dlg/Condition.cxx9
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.cxx13
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx87
-rw-r--r--reportdesign/source/ui/misc/RptUndo.cxx10
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx26
-rw-r--r--reportdesign/source/ui/report/DesignView.cxx7
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx59
-rw-r--r--reportdesign/source/ui/report/ReportControllerObserver.cxx5
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx67
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx247
11 files changed, 220 insertions, 335 deletions
diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx
index 9a67ebdd747b..0fa1180884ba 100644
--- a/reportdesign/source/ui/dlg/CondFormat.cxx
+++ b/reportdesign/source/ui/dlg/CondFormat.cxx
@@ -133,9 +133,9 @@ namespace rptui
void ConditionalFormattingDialog::dispose()
{
- for (auto i = m_aConditions.begin(); i != m_aConditions.end(); ++i)
+ for (auto& rxCondition : m_aConditions)
{
- i->disposeAndClear();
+ rxCondition.disposeAndClear();
}
m_aConditions.clear();
@@ -148,12 +148,10 @@ namespace rptui
void ConditionalFormattingDialog::impl_updateConditionIndicies()
{
sal_Int32 nIndex = 0;
- for ( Conditions::const_iterator cond = m_aConditions.begin();
- cond != m_aConditions.end();
- ++cond, ++nIndex
- )
+ for (const auto& rxCondition : m_aConditions)
{
- (*cond)->setConditionIndex( nIndex, impl_getConditionCount() );
+ rxCondition->setConditionIndex( nIndex, impl_getConditionCount() );
+ ++nIndex;
}
}
@@ -549,15 +547,10 @@ namespace rptui
size_t ConditionalFormattingDialog::impl_getFocusedConditionIndex( sal_Int32 _nFallBackIfNone ) const
{
- size_t nIndex( 0 );
- for ( Conditions::const_iterator cond = m_aConditions.begin();
- cond != m_aConditions.end();
- ++cond, ++nIndex
- )
- {
- if ( (*cond)->HasChildPathFocus() )
- return nIndex;
- }
+ auto cond = std::find_if(m_aConditions.begin(), m_aConditions.end(),
+ [](const VclPtr<Condition>& rxCondition) { return rxCondition->HasChildPathFocus(); });
+ if (cond != m_aConditions.end())
+ return static_cast<size_t>(std::distance(m_aConditions.begin(), cond));
return _nFallBackIfNone;
}
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index 48f2a5c3c26c..796f891d21f9 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -338,15 +338,12 @@ void Condition::impl_setCondition( const OUString& _rConditionFormula )
const OUString sUnprefixedFieldContent( aFieldContentFormula.getBracketedFieldOrExpression() );
// check whether one of the Field Value Expression Factories recognizes the expression
- for ( ConditionalExpressions::const_iterator exp = m_aConditionalExpressions.begin();
- exp != m_aConditionalExpressions.end();
- ++exp
- )
+ for (const auto& [rOperation, rxConditionalExpression] : m_aConditionalExpressions)
{
- if ( exp->second->matchExpression( sExpression, sUnprefixedFieldContent, sLHS, sRHS ) )
+ if ( rxConditionalExpression->matchExpression( sExpression, sUnprefixedFieldContent, sLHS, sRHS ) )
{
eType = eFieldValueComparison;
- eOperation = exp->first;
+ eOperation = rOperation;
break;
}
}
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index e933b6218752..a12479660ad5 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -503,15 +503,10 @@ OUString OFieldExpressionControl::GetCellText( long nRow, sal_uInt16 /*nColId*/
uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
OUString sExpression = xGroup->getExpression();
- for(::std::vector<ColumnInfo>::const_iterator aIter = m_aColumnInfo.begin(); aIter != m_aColumnInfo.end();++aIter)
- {
- if ( aIter->sColumnName == sExpression )
- {
- if ( !aIter->sLabel.isEmpty() )
- sExpression = aIter->sLabel;
- break;
- }
- }
+ auto aIter = std::find_if(m_aColumnInfo.begin(), m_aColumnInfo.end(),
+ [&sExpression](const ColumnInfo& rColumnInfo) { return rColumnInfo.sColumnName == sExpression; });
+ if (aIter != m_aColumnInfo.end() && !aIter->sLabel.isEmpty())
+ sExpression = aIter->sLabel;
sText = sExpression;
}
catch (const uno::Exception&)
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index a5178650f7a8..746c9de1a3f8 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -1885,27 +1885,26 @@ bool GeometryHandler::impl_isDefaultFunction_nothrow( const uno::Reference< repo
i18nutil::SearchOptions2 aSearchOptions;
aSearchOptions.AlgorithmType2 = util::SearchAlgorithms2::REGEXP;
aSearchOptions.searchFlag = 0x00000100;
- ::std::vector< DefaultFunction >::const_iterator aIter = m_aDefaultFunctions.begin();
- ::std::vector< DefaultFunction >::const_iterator aDeEnd = m_aDefaultFunctions.end();
- for (; aIter != aDeEnd; ++aIter)
+ auto aIter = std::find_if(m_aDefaultFunctions.begin(), m_aDefaultFunctions.end(),
+ [&aSearchOptions, &sFormula](const DefaultFunction& rDefaultFunction) {
+ aSearchOptions.searchString = rDefaultFunction.m_sSearchString;
+ utl::TextSearch aTextSearch( aSearchOptions);
+ sal_Int32 start = 0;
+ sal_Int32 end = sFormula.getLength();
+ return aTextSearch.SearchForward(sFormula, &start, &end) && start == 0 && end == sFormula.getLength();
+ });
+ if (aIter != m_aDefaultFunctions.end()) // default function found
{
- aSearchOptions.searchString = aIter->m_sSearchString;
- utl::TextSearch aTextSearch( aSearchOptions);
sal_Int32 start = 0;
sal_Int32 end = sFormula.getLength();
- if (aTextSearch.SearchForward(sFormula, &start, &end) && start == 0 && end == sFormula.getLength()) // default function found
- {
- aSearchOptions.searchString = "\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]";
- utl::TextSearch aDataSearch( aSearchOptions);
- (void)aDataSearch.SearchForward(sFormula, &start, &end);
- ++start;
- _rDataField = sFormula.copy(start,end-start-1);
- _rsDefaultFunctionName = aIter->m_sName;
- break;
- }
+ aSearchOptions.searchString = "\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]";
+ utl::TextSearch aDataSearch( aSearchOptions);
+ (void)aDataSearch.SearchForward(sFormula, &start, &end);
+ ++start;
+ _rDataField = sFormula.copy(start,end-start-1);
+ _rsDefaultFunctionName = aIter->m_sName;
+ bDefaultFunction = true;
}
-
- bDefaultFunction = aIter != aDeEnd;
}
catch(uno::Exception&)
{
@@ -1959,41 +1958,37 @@ void GeometryHandler::createDefaultFunction(::osl::ResettableMutexGuard& _aGuard
OUString sNamePostfix;
const uno::Reference< report::XFunctionsSupplier> xFunctionsSupplier = fillScope_throw(sNamePostfix);
- ::std::vector< DefaultFunction >::const_iterator aIter = m_aDefaultFunctions.begin();
- ::std::vector< DefaultFunction >::const_iterator aDeEnd = m_aDefaultFunctions.end();
- for (; aIter != aDeEnd; ++aIter)
+ auto aIter = std::find_if(m_aDefaultFunctions.begin(), m_aDefaultFunctions.end(),
+ [&_sFunction](const DefaultFunction& rDefaultFunction) { return rDefaultFunction.m_sName == _sFunction; });
+ if (aIter != m_aDefaultFunctions.end())
{
- if ( aIter->m_sName == _sFunction )
- {
- const OUString sFunctionName( _sFunction + _sDataField + sNamePostfix);
- const OUString sQuotedFunctionName(lcl_getQuotedFunctionName(sFunctionName));
+ const OUString sFunctionName( _sFunction + _sDataField + sNamePostfix);
+ const OUString sQuotedFunctionName(lcl_getQuotedFunctionName(sFunctionName));
- beans::PropertyChangeEvent aEvent;
- aEvent.PropertyName = PROPERTY_SCOPE;
- aEvent.OldValue <<= m_sScope;
+ beans::PropertyChangeEvent aEvent;
+ aEvent.PropertyName = PROPERTY_SCOPE;
+ aEvent.OldValue <<= m_sScope;
- ::std::pair<TFunctions::const_iterator,TFunctions::const_iterator> aFind = m_aFunctionNames.equal_range(sQuotedFunctionName);
- while ( aFind.first != aFind.second )
+ ::std::pair<TFunctions::const_iterator,TFunctions::const_iterator> aFind = m_aFunctionNames.equal_range(sQuotedFunctionName);
+ while ( aFind.first != aFind.second )
+ {
+ if ( xFunctionsSupplier == aFind.first->second.second )
{
- if ( xFunctionsSupplier == aFind.first->second.second )
- {
- m_xFunction = aFind.first->second.first;
- OUString sTemp;
- isDefaultFunction(sQuotedFunctionName,sTemp,uno::Reference< report::XFunctionsSupplier>(),true); // implicitly sets the m_sScope
- break;
- }
- ++(aFind.first);
+ m_xFunction = aFind.first->second.first;
+ OUString sTemp;
+ isDefaultFunction(sQuotedFunctionName,sTemp,uno::Reference< report::XFunctionsSupplier>(),true); // implicitly sets the m_sScope
+ break;
}
- if ( aFind.first == aFind.second )
- impl_createFunction(sFunctionName,_sDataField,*aIter);
-
- OBlocker aBlocker(m_bIn);
- m_xReportComponent->setPropertyValue(PROPERTY_DATAFIELD,uno::makeAny( impl_convertToFormula( uno::makeAny(sQuotedFunctionName) )));
- aEvent.NewValue <<= m_sScope;
- _aGuard.clear();
- m_aPropertyListeners.notify( aEvent, &beans::XPropertyChangeListener::propertyChange );
- break;
+ ++(aFind.first);
}
+ if ( aFind.first == aFind.second )
+ impl_createFunction(sFunctionName,_sDataField,*aIter);
+
+ OBlocker aBlocker(m_bIn);
+ m_xReportComponent->setPropertyValue(PROPERTY_DATAFIELD,uno::makeAny( impl_convertToFormula( uno::makeAny(sQuotedFunctionName) )));
+ aEvent.NewValue <<= m_sScope;
+ _aGuard.clear();
+ m_aPropertyListeners.notify( aEvent, &beans::XPropertyChangeListener::propertyChange );
}
}
catch(uno::Exception&)
diff --git a/reportdesign/source/ui/misc/RptUndo.cxx b/reportdesign/source/ui/misc/RptUndo.cxx
index dc8b823d0f24..3bfd9d22ca80 100644
--- a/reportdesign/source/ui/misc/RptUndo.cxx
+++ b/reportdesign/source/ui/misc/RptUndo.cxx
@@ -94,13 +94,11 @@ namespace
{
if ( _xSection.is() )
{
- ::std::vector< ::std::pair< OUString ,uno::Any> >::const_iterator aIter = _aValues.begin();
- ::std::vector< ::std::pair< OUString ,uno::Any> >::const_iterator aEnd = _aValues.end();
- for (; aIter != aEnd; ++aIter)
+ for (const auto& [rPropName, rValue] : _aValues)
{
try
{
- _xSection->setPropertyValue(aIter->first,aIter->second);
+ _xSection->setPropertyValue(rPropName, rValue);
}
catch(const uno::Exception&)
{
@@ -128,10 +126,8 @@ OSectionUndo::~OSectionUndo()
if ( !m_bInserted )
{
OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv();
- ::std::vector< uno::Reference< drawing::XShape> >::const_iterator aEnd = m_aControls.end();
- for (::std::vector< uno::Reference< drawing::XShape> >::const_iterator aIter = m_aControls.begin(); aIter != aEnd; ++aIter)
+ for (uno::Reference<drawing::XShape>& xShape : m_aControls)
{
- uno::Reference< drawing::XShape> xShape = *aIter;
rEnv.RemoveElement(xShape);
#if OSL_DEBUG_LEVEL > 0
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 63e1a2469604..51e847c74135 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -265,21 +265,19 @@ namespace
SvxUnoPropertyMapProvider aMap;
const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap();
PropertyEntryVector_t aPropVector = rPropertyMap.getPropertyEntries();
- PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
- while( aIt != aPropVector.end() )
+ for (const auto& rProp : aPropVector)
{
- if ( xInfo->hasPropertyByName(aIt->sName) )
+ if ( xInfo->hasPropertyByName(rProp.sName) )
{
- const SfxPoolItem* pItem = _rItemSet.GetItem(aIt->nWID);
+ const SfxPoolItem* pItem = _rItemSet.GetItem(rProp.nWID);
if ( pItem )
{
::std::unique_ptr<SfxPoolItem> pClone(pItem->Clone());
- pClone->PutValue(_xShape->getPropertyValue(aIt->sName), aIt->nMemberId);
- pClone->SetWhich(aIt->nWID);
+ pClone->PutValue(_xShape->getPropertyValue(rProp.sName), rProp.nMemberId);
+ pClone->SetWhich(rProp.nWID);
_rItemSet.Put(*pClone);
}
}
- ++aIt;
}
}
@@ -289,21 +287,20 @@ namespace
SvxUnoPropertyMapProvider aMap;
const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap();
PropertyEntryVector_t aPropVector = rPropertyMap.getPropertyEntries();
- PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
- while( aIt != aPropVector.end() )
+ for (const auto& rProp : aPropVector)
{
- if ( SfxItemState::SET == _rItemSet.GetItemState(aIt->nWID) && xInfo->hasPropertyByName(aIt->sName) )
+ if ( SfxItemState::SET == _rItemSet.GetItemState(rProp.nWID) && xInfo->hasPropertyByName(rProp.sName) )
{
- if ( ( aIt->nFlags & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY )
+ if ( ( rProp.nFlags & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY )
{
- const SfxPoolItem* pItem = _rItemSet.GetItem(aIt->nWID);
+ const SfxPoolItem* pItem = _rItemSet.GetItem(rProp.nWID);
if ( pItem )
{
uno::Any aValue;
- pItem->QueryValue(aValue,aIt->nMemberId);
+ pItem->QueryValue(aValue,rProp.nMemberId);
try
{
- _xShape->setPropertyValue(aIt->sName, aValue);
+ _xShape->setPropertyValue(rProp.sName, aValue);
}
catch(uno::Exception&)
{ // shapes have a bug so we ignore this one.
@@ -311,7 +308,6 @@ namespace
}
}
}
- ++aIt;
}
}
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index b46a44d10cf9..de49c0361817 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -627,11 +627,12 @@ uno::Any ODesignView::getCurrentlyShownProperty() const
pSectionWindow->getReportSection().fillControlModelSelection(aSelection);
if ( !aSelection.empty() )
{
- ::std::vector< uno::Reference< uno::XInterface > >::const_iterator aIter = aSelection.begin();
uno::Sequence< uno::Reference< report::XReportComponent > > aSeq(aSelection.size());
- for(sal_Int32 i = 0; i < aSeq.getLength(); ++i,++aIter)
+ sal_Int32 i = 0;
+ for(const auto& rxInterface : aSelection)
{
- aSeq[i].set(*aIter,uno::UNO_QUERY);
+ aSeq[i].set(rxInterface,uno::UNO_QUERY);
+ ++i;
}
aRet <<= aSeq;
}
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 5cbef2d2be07..283daad8d253 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -888,13 +888,11 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const
{
::std::vector< uno::Reference< uno::XInterface > > aSelection;
getDesignView()->fillControlModelSelection(aSelection);
- ::std::vector< uno::Reference< uno::XInterface > >::const_iterator aIter = aSelection.begin();
- for(; aIter != aSelection.end()
- && !uno::Reference< report::XFixedLine >(*aIter,uno::UNO_QUERY).is()
- && !uno::Reference< report::XImageControl >(*aIter,uno::UNO_QUERY).is()
- && uno::Reference< report::XReportControlFormat >(*aIter,uno::UNO_QUERY).is() ;++aIter)
- ;
- aReturn.bEnabled = !aSelection.empty() && aIter == aSelection.end();
+ aReturn.bEnabled = !aSelection.empty()
+ && std::all_of(aSelection.begin(), aSelection.end(), [](const uno::Reference<uno::XInterface>& rxInterface) {
+ return !uno::Reference<report::XFixedLine>(rxInterface, uno::UNO_QUERY).is()
+ && !uno::Reference<report::XImageControl>(rxInterface, uno::UNO_QUERY).is()
+ && uno::Reference<report::XReportControlFormat>(rxInterface, uno::UNO_QUERY).is(); });
}
break;
case SID_CONDITIONALFORMATTING:
@@ -1437,10 +1435,9 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
const OUString sUndoAction(RptResId(RID_STR_UNDO_CHANGEFONT));
UndoContext aUndoContext( getUndoManager(), sUndoAction );
- ::std::vector< uno::Reference< uno::XInterface > >::const_iterator aIter = aControlsFormats.begin();
- for(; aIter != aControlsFormats.end();++aIter)
+ for (const auto& rxControlFormat : aControlsFormats)
{
- uno::Reference< report::XReportControlFormat> xReportControlFormat(*aIter,uno::UNO_QUERY);
+ uno::Reference< report::XReportControlFormat> xReportControlFormat(rxControlFormat,uno::UNO_QUERY);
lcl_setFontWPU_nothrow(xReportControlFormat,_nId);
}
}
@@ -1514,10 +1511,9 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
const OUString sUndoAction( RptResId( RID_STR_UNDO_CHANGEFONT ) );
UndoContext aUndoContext( getUndoManager(), sUndoAction );
- ::std::vector< uno::Reference< uno::XInterface > >::const_iterator aIter = aControlsFormats.begin();
- for(; aIter != aControlsFormats.end();++aIter)
+ for (const auto& rxControlFormat : aControlsFormats)
{
- uno::Reference< report::XReportControlFormat > xFormat( *aIter, uno::UNO_QUERY );
+ uno::Reference< report::XReportControlFormat > xFormat( rxControlFormat, uno::UNO_QUERY );
if ( !xFormat.is() )
continue;
@@ -2722,12 +2718,13 @@ uno::Any SAL_CALL OReportController::getViewData()
{
uno::Sequence<beans::PropertyValue> aCollapsedSections(aCollapsedPositions.size());
beans::PropertyValue* pCollapsedIter = aCollapsedSections.getArray();
- ::std::vector<sal_uInt16>::const_iterator aIter = aCollapsedPositions.begin();
- ::std::vector<sal_uInt16>::const_iterator aEnd = aCollapsedPositions.end();
- for (sal_Int32 i = 1; aIter != aEnd ; ++aIter,++pCollapsedIter,++i)
+ sal_Int32 i = 1;
+ for (const auto& rPos : aCollapsedPositions)
{
pCollapsedIter->Name = PROPERTY_SECTION + OUString::number(i);
- pCollapsedIter->Value <<= static_cast<sal_Int32>(*aIter);
+ pCollapsedIter->Value <<= static_cast<sal_Int32>(rPos);
+ ++pCollapsedIter;
+ ++i;
}
aViewData.put( "CollapsedSections", aCollapsedSections );
@@ -2763,19 +2760,16 @@ void SAL_CALL OReportController::restoreViewData(const uno::Any& i_data)
::comphelper::NamedValueCollection aCommandProperties( aViewData.get( "CommandProperties" ) );
const ::std::vector< OUString > aCommandNames( aCommandProperties.getNames() );
- for ( ::std::vector< OUString >::const_iterator commandName = aCommandNames.begin();
- commandName != aCommandNames.end();
- ++commandName
- )
+ for ( const auto& rCommandName : aCommandNames )
{
- const Any& rCommandValue = aCommandProperties.get( *commandName );
+ const Any& rCommandValue = aCommandProperties.get( rCommandName );
if ( !rCommandValue.hasValue() )
continue;
if ( getView() )
{
util::URL aCommand;
- aCommand.Complete = ".uno:" + *commandName;
+ aCommand.Complete = ".uno:" + rCommandName;
Sequence< PropertyValue > aCommandArgs(1);
aCommandArgs[0].Name = "Value";
@@ -2785,19 +2779,19 @@ void SAL_CALL OReportController::restoreViewData(const uno::Any& i_data)
}
else
{
- if ( *commandName == "ShowRuler" )
+ if ( rCommandName == "ShowRuler" )
OSL_VERIFY( rCommandValue >>= m_bShowRuler );
- else if ( *commandName == "HelplinesMove" )
+ else if ( rCommandName == "HelplinesMove" )
OSL_VERIFY( rCommandValue >>= m_bHelplinesMove );
- else if ( *commandName == "GridVisible" )
+ else if ( rCommandName == "GridVisible" )
OSL_VERIFY( rCommandValue >>= m_bGridVisible );
- else if ( *commandName == "GridUse" )
+ else if ( rCommandName == "GridUse" )
OSL_VERIFY( rCommandValue >>= m_bGridUse );
- else if ( *commandName == "ControlProperties" )
+ else if ( rCommandName == "ControlProperties" )
OSL_VERIFY( rCommandValue >>= m_bShowProperties );
- else if ( *commandName == "LastPropertyBrowserPage" )
+ else if ( rCommandName == "LastPropertyBrowserPage" )
OSL_VERIFY( rCommandValue >>= m_sLastActivePage );
- else if ( *commandName == "SplitPosition" )
+ else if ( rCommandName == "SplitPosition" )
OSL_VERIFY( rCommandValue >>= m_nSplitPos );
}
}
@@ -4154,14 +4148,13 @@ bool OReportController::impl_setPropertyAtControls_throw(const char* pUndoResId,
::std::vector< uno::Reference< uno::XInterface > > aSelection;
uno::Reference< awt::XWindow> xWindow;
lcl_getReportControlFormat( _aArgs, getDesignView(), xWindow, aSelection );
- ::std::vector< uno::Reference< uno::XInterface > >::const_iterator aIter = aSelection.begin();
const OUString sUndoAction = RptResId( pUndoResId );
UndoContext aUndoContext( getUndoManager(), sUndoAction );
- for(; aIter != aSelection.end();++aIter)
+ for (const auto& rxInterface : aSelection)
{
- const uno::Reference< beans::XPropertySet > xControlModel(*aIter,uno::UNO_QUERY);
+ const uno::Reference< beans::XPropertySet > xControlModel(rxInterface,uno::UNO_QUERY);
if ( xControlModel.is() )
// tdf#117795: some elements may have not some property
// eg class "OFixedLine" doesn't have property "CharFontName"
diff --git a/reportdesign/source/ui/report/ReportControllerObserver.cxx b/reportdesign/source/ui/report/ReportControllerObserver.cxx
index d56d55b0a427..abcf21bb9771 100644
--- a/reportdesign/source/ui/report/ReportControllerObserver.cxx
+++ b/reportdesign/source/ui/report/ReportControllerObserver.cxx
@@ -94,11 +94,8 @@ public:
// send all Section Objects a 'tingle'
// maybe they need a change in format, color, etc
- ::std::vector< uno::Reference< container::XChild > >::const_iterator aIter = m_pImpl->m_aSections.begin();
- ::std::vector< uno::Reference< container::XChild > >::const_iterator aEnd = m_pImpl->m_aSections.end();
- for (;aIter != aEnd; ++aIter)
+ for (const uno::Reference<container::XChild>& xChild : m_pImpl->m_aSections)
{
- const uno::Reference<container::XChild> xChild (*aIter);
if (xChild.is())
{
uno::Reference<report::XSection> xSection(xChild, uno::UNO_QUERY);
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index 2362d97e5232..9e49938e5484 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -588,47 +588,44 @@ void OReportSection::createDefault(const OUString& _sType,SdrObject* _pObj)
std::vector< OUString > aObjList;
if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
{
- std::vector< OUString >::const_iterator aIter = aObjList.begin();
- std::vector< OUString >::const_iterator aEnd = aObjList.end();
- for (sal_uInt32 i=0 ; aIter != aEnd; ++aIter,++i)
+ auto aIter = std::find_if(aObjList.begin(), aObjList.end(),
+ [&_sType](const OUString& rObj) { return rObj.equalsIgnoreAsciiCase(_sType); });
+ if (aIter != aObjList.end())
{
- if ( aIter->equalsIgnoreAsciiCase( _sType ) )
+ auto i = static_cast<sal_uInt32>(std::distance(aObjList.begin(), aIter));
+ OReportModel aReportModel(nullptr);
+ SfxItemPool& rPool = aReportModel.GetItemPool();
+ rPool.FreezeIdRanges();
+ if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aReportModel ) )
{
- OReportModel aReportModel(nullptr);
- SfxItemPool& rPool = aReportModel.GetItemPool();
- rPool.FreezeIdRanges();
- if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aReportModel ) )
+ const SdrObject* pSourceObj = aReportModel.GetPage( 0 )->GetObj( 0 );
+ if( pSourceObj )
{
- const SdrObject* pSourceObj = aReportModel.GetPage( 0 )->GetObj( 0 );
- if( pSourceObj )
- {
- const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
- SfxItemSet aDest(
- _pObj->getSdrModelFromSdrObject().GetItemPool(),
- svl::Items<
- // Ranges from SdrAttrObj:
- SDRATTR_START, SDRATTR_SHADOW_LAST,
- SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
+ SfxItemSet aDest(
+ _pObj->getSdrModelFromSdrObject().GetItemPool(),
+ svl::Items<
+ // Ranges from SdrAttrObj:
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION,
SDRATTR_TEXTDIRECTION,
- SDRATTR_TEXTDIRECTION,
- // Graphic attributes, 3D properties,
- // CustomShape properties:
- SDRATTR_GRAF_FIRST,
- SDRATTR_CUSTOMSHAPE_LAST,
- // Range from SdrTextObj:
- EE_ITEMS_START, EE_ITEMS_END>{});
- aDest.Set( rSource );
- _pObj->SetMergedItemSet( aDest );
- sal_Int32 nAngle = pSourceObj->GetRotateAngle();
- if ( nAngle )
- {
- double a = nAngle * F_PI18000;
- _pObj->NbcRotate( _pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) );
- }
- bAttributesAppliedFromGallery = true;
+ // Graphic attributes, 3D properties,
+ // CustomShape properties:
+ SDRATTR_GRAF_FIRST,
+ SDRATTR_CUSTOMSHAPE_LAST,
+ // Range from SdrTextObj:
+ EE_ITEMS_START, EE_ITEMS_END>{});
+ aDest.Set( rSource );
+ _pObj->SetMergedItemSet( aDest );
+ sal_Int32 nAngle = pSourceObj->GetRotateAngle();
+ if ( nAngle )
+ {
+ double a = nAngle * F_PI18000;
+ _pObj->NbcRotate( _pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) );
}
+ bAttributesAppliedFromGallery = true;
}
- break;
}
}
}
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 77fed84faa28..19bc83444787 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -185,8 +185,8 @@ OViewsWindow::~OViewsWindow()
void OViewsWindow::dispose()
{
m_aColorConfig.RemoveListener(this);
- for (auto i = m_aSections.begin(); i != m_aSections.end(); ++i)
- i->disposeAndClear();
+ for (auto& rxSection : m_aSections)
+ rxSection.disposeAndClear();
m_aSections.clear();
m_pParent.clear();
vcl::Window::dispose();
@@ -323,14 +323,8 @@ void OViewsWindow::toggleGrid(bool _bVisible)
sal_Int32 OViewsWindow::getTotalHeight() const
{
- sal_Int32 nHeight = 0;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (;aIter != aEnd ; ++aIter)
- {
- nHeight += (*aIter)->GetSizePixel().Height();
- }
- return nHeight;
+ return std::accumulate(m_aSections.begin(), m_aSections.end(), sal_Int32(0),
+ [](const sal_Int32 nHeight, const VclPtr<OSectionWindow>& rxSection) { return nHeight + rxSection->GetSizePixel().Height(); });
}
sal_uInt16 OViewsWindow::getSectionCount() const
@@ -340,10 +334,8 @@ sal_uInt16 OViewsWindow::getSectionCount() const
void OViewsWindow::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType )
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (;aIter != aEnd ; ++aIter)
- (*aIter)->getReportSection().getSectionView().SetCurrentObj( eObj, SdrInventor::ReportDesign );
+ for (const auto& rxSection : m_aSections)
+ rxSection->getReportSection().getSectionView().SetCurrentObj( eObj, SdrInventor::ReportDesign );
m_sShapeType = _sShapeType;
}
@@ -359,11 +351,8 @@ void OViewsWindow::SetMode( DlgEdMode eNewMode )
bool OViewsWindow::HasSelection() const
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (;aIter != aEnd && !(*aIter)->getReportSection().getSectionView().AreObjectsMarked(); ++aIter)
- ;
- return aIter != aEnd;
+ return std::any_of(m_aSections.begin(), m_aSections.end(),
+ [](const VclPtr<OSectionWindow>& rxSection) { return rxSection->getReportSection().getSectionView().AreObjectsMarked(); });
}
void OViewsWindow::Delete()
@@ -507,14 +496,12 @@ void OViewsWindow::unmarkAllObjects(OSectionView const * _pSectionView)
if ( !m_bInUnmark )
{
m_bInUnmark = true;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd ; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- if ( &(*aIter)->getReportSection().getSectionView() != _pSectionView )
+ if ( &rxSection->getReportSection().getSectionView() != _pSectionView )
{
- (*aIter)->getReportSection().deactivateOle();
- (*aIter)->getReportSection().getSectionView().UnmarkAllObj();
+ rxSection->getReportSection().deactivateOle();
+ rxSection->getReportSection().getSectionView().UnmarkAllObj();
}
}
m_bInUnmark = false;
@@ -554,21 +541,17 @@ void OViewsWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
if ( rMEvt.IsLeft() )
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (;aIter != aEnd ; ++aIter)
+ auto aIter = std::find_if(m_aSections.begin(), m_aSections.end(),
+ [](const VclPtr<OSectionWindow>& rxSection) { return rxSection->getReportSection().getSectionView().AreObjectsMarked(); });
+ if (aIter != m_aSections.end())
{
- if ( (*aIter)->getReportSection().getSectionView().AreObjectsMarked() )
- {
- (*aIter)->getReportSection().MouseButtonUp(rMEvt);
- break;
- }
+ (*aIter)->getReportSection().MouseButtonUp(rMEvt);
}
// remove special insert mode
- for (aIter = m_aSections.begin();aIter != aEnd ; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- (*aIter)->getReportSection().getPage()->resetSpecialMode();
+ rxSection->getReportSection().getPage()->resetSpecialMode();
}
}
}
@@ -576,13 +559,11 @@ void OViewsWindow::MouseButtonUp( const MouseEvent& rMEvt )
bool OViewsWindow::handleKeyEvent(const KeyEvent& _rEvent)
{
bool bRet = false;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (;aIter != aEnd ; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- if ( (*aIter)->getStartMarker().isMarked() )
+ if ( rxSection->getStartMarker().isMarked() )
{
- bRet = (*aIter)->getReportSection().handleKeyEvent(_rEvent);
+ bRet = rxSection->getReportSection().handleKeyEvent(_rEvent);
}
}
return bRet;
@@ -605,17 +586,15 @@ void OViewsWindow::setMarked(OSectionView const * _pSectionView, bool _bMark)
void OViewsWindow::setMarked(const uno::Reference< report::XSection>& _xSection, bool _bMark)
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd ; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- if ( (*aIter)->getReportSection().getSection() != _xSection )
+ if ( rxSection->getReportSection().getSection() != _xSection )
{
- (*aIter)->setMarked(false);
+ rxSection->setMarked(false);
}
- else if ( (*aIter)->getStartMarker().isMarked() != _bMark )
+ else if ( rxSection->getStartMarker().isMarked() != _bMark )
{
- (*aIter)->setMarked(_bMark);
+ rxSection->setMarked(_bMark);
}
}
}
@@ -650,11 +629,9 @@ void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XRepor
void OViewsWindow::collectRectangles(TRectangleMap& _rSortRectangles)
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (aIter = m_aSections.begin();aIter != aEnd ; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OSectionView& rView = (*aIter)->getReportSection().getSectionView();
+ OSectionView& rView = rxSection->getReportSection().getSectionView();
if ( rView.AreObjectsMarked() )
{
rView.SortMarkedObjects();
@@ -673,11 +650,8 @@ void OViewsWindow::collectRectangles(TRectangleMap& _rSortRectangles)
void OViewsWindow::collectBoundResizeRect(const TRectangleMap& _rSortRectangles, ControlModification _nControlModification,bool _bAlignAtSection, tools::Rectangle& _rBound, tools::Rectangle& _rResize)
{
bool bOnlyOnce = false;
- TRectangleMap::const_iterator aRectIter = _rSortRectangles.begin();
- TRectangleMap::const_iterator aRectEnd = _rSortRectangles.end();
- for (;aRectIter != aRectEnd ; ++aRectIter)
+ for (const auto& [aObjRect, rObjViewPair] : _rSortRectangles)
{
- tools::Rectangle aObjRect = aRectIter->first;
if ( _rResize.IsEmpty() )
_rResize = aObjRect;
switch(_nControlModification)
@@ -702,7 +676,7 @@ void OViewsWindow::collectBoundResizeRect(const TRectangleMap& _rSortRectangles,
}
SdrObjTransformInfoRec aInfo;
- const SdrObject* pObj = aRectIter->second.first;
+ const SdrObject* pObj = rObjViewPair.first;
pObj->TakeObjInfo(aInfo);
bool bHasFixed = !aInfo.bMoveAllowed || pObj->IsMoveProtect();
if ( bHasFixed )
@@ -714,7 +688,7 @@ void OViewsWindow::collectBoundResizeRect(const TRectangleMap& _rSortRectangles,
if ( ! bOnlyOnce )
{
bOnlyOnce = true;
- OReportSection* pReportSection = aRectIter->second.second->getReportSection();
+ OReportSection* pReportSection = rObjViewPair.second->getReportSection();
const uno::Reference< report::XSection>& xSection = pReportSection->getSection();
try
{
@@ -728,7 +702,7 @@ void OViewsWindow::collectBoundResizeRect(const TRectangleMap& _rSortRectangles,
}
else
{
- _rBound.Union(aRectIter->second.second->GetMarkedObjRect());
+ _rBound.Union(rObjViewPair.second->GetMarkedObjRect());
}
}
}
@@ -901,37 +875,24 @@ void OViewsWindow::createDefault()
void OViewsWindow::setGridSnap(bool bOn)
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd ; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- (*aIter)->getReportSection().getSectionView().SetGridSnap(bOn);
- (*aIter)->getReportSection().Invalidate();
+ rxSection->getReportSection().getSectionView().SetGridSnap(bOn);
+ rxSection->getReportSection().Invalidate();
}
}
void OViewsWindow::setDragStripes(bool bOn)
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd ; ++aIter)
- (*aIter)->getReportSection().getSectionView().SetDragStripes(bOn);
+ for (const auto& rxSection : m_aSections)
+ rxSection->getReportSection().getSectionView().SetDragStripes(bOn);
}
sal_uInt16 OViewsWindow::getPosition(const OSectionWindow* _pSectionWindow) const
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- sal_uInt16 nPosition = 0;
- for (; aIter != aEnd ; ++aIter)
- {
- if ( _pSectionWindow == (*aIter).get() )
- {
- break;
- }
- ++nPosition;
- }
- return nPosition;
+ auto aIter = std::find_if(m_aSections.begin(), m_aSections.end(),
+ [&_pSectionWindow](const VclPtr<OSectionWindow>& rxSection) { return _pSectionWindow == rxSection.get(); });
+ return static_cast<sal_uInt16>(std::distance(m_aSections.begin(), aIter));
}
OSectionWindow* OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const
@@ -1003,13 +964,11 @@ void OViewsWindow::BrkAction()
void OViewsWindow::BegDragObj_createInvisibleObjectAtPosition(const tools::Rectangle& _aRect, const OSectionView& _rSection)
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
Point aNewPos(0,0);
- for (; aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
rReportSection.getPage()->setSpecialMode();
OSectionView& rView = rReportSection.getSectionView();
@@ -1042,11 +1001,9 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi
// Calculate the absolute clickpoint in the views
Point aAbsolutePnt = _aPnt;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
OSectionView* pView = &rReportSection.getSectionView();
if (pView == _pSection)
break;
@@ -1066,9 +1023,9 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi
int nViewCount = 0;
Point aNewObjPos(0,0);
Point aLeftTop = Point(SAL_MAX_INT32, SAL_MAX_INT32);
- for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
OSectionView& rView = rReportSection.getSectionView();
@@ -1114,9 +1071,9 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi
const short nDrgLog = static_cast<short>(PixelToLogic(Size(3,0)).Width());
nViewCount = 0;
- for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
SdrHdl* pHdl = _pHdl;
if ( pHdl )
@@ -1149,12 +1106,10 @@ void OViewsWindow::BegMarkObj(const Point& _aPnt,const OSectionView* _pSection)
bool bAdd = true;
Point aNewPos = _aPnt;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
long nLastSectionHeight = 0;
- for (; aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
if ( &rReportSection.getSectionView() == _pSection )
{
bAdd = false;
@@ -1177,15 +1132,11 @@ void OViewsWindow::BegMarkObj(const Point& _aPnt,const OSectionView* _pSection)
OSectionView* OViewsWindow::getSectionRelativeToPosition(const OSectionView* _pSection,Point& _rPnt)
{
OSectionView* pSection = nullptr;
- sal_Int32 nCount = 0;
TSectionsMap::const_iterator aIter = m_aSections.begin();
const TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd ; ++aIter,++nCount)
- {
- OReportSection& rReportSection = (*aIter)->getReportSection();
- if ( &rReportSection.getSectionView() == _pSection)
- break;
- }
+ aIter = std::find_if(aIter, aEnd, [&_pSection](const VclPtr<OSectionWindow>& rxSection) {
+ return &rxSection->getReportSection().getSectionView() == _pSection; });
+ sal_Int32 nCount = static_cast<sal_Int32>(std::distance(m_aSections.cbegin(), aIter));
OSL_ENSURE(aIter != aEnd,"This can never happen!");
if ( _rPnt.Y() < 0 )
{
@@ -1225,12 +1176,9 @@ OSectionView* OViewsWindow::getSectionRelativeToPosition(const OSectionView* _pS
void OViewsWindow::EndDragObj_removeInvisibleObjects()
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
-
- for (; aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
rReportSection.getPage()->resetSpecialMode();
}
}
@@ -1252,11 +1200,9 @@ void OViewsWindow::EndDragObj(bool _bControlKeyPressed, const OSectionView* _pSe
aNewPos -= m_aDragDelta;
uno::Sequence< beans::NamedValue > aAllreadyCopiedObjects;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- const TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
if ( pInSection != &rReportSection.getSectionView() )
{
rReportSection.getSectionView().BrkAction();
@@ -1358,26 +1304,23 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection, b
aHdlPos = pHdl->GetPos();
}
- TSectionsMap::const_iterator aIter;
- TSectionsMap::const_iterator aEnd = m_aSections.end();
-
- for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
if ( &rReportSection.getSectionView() == _pSection )
break;
- const long nSectionHeight = (*aIter)->PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
+ const long nSectionHeight = rxSection->PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
aCurrentSectionPos.AdjustY(nSectionHeight );
}
aRealMousePos += aCurrentSectionPos;
// If control key is pressed the work area is limited to the section with the current selection.
Point aPosForWorkArea(0,0);
- for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
OSectionView& rView = rReportSection.getSectionView();
- const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height();
+ const long nSectionHeight = rxSection->PixelToLogic(rxSection->GetOutputSizePixel()).Height();
if (_bControlKeySet)
{
@@ -1396,46 +1339,35 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection, b
}
- for (aIter = m_aSections.begin(); aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
SdrHdl* pCurrentHdl = rReportSection.getSectionView().GetDragHdl();
if ( pCurrentHdl && aRealMousePos.Y() > 0 )
aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos;
rReportSection.getSectionView().MovAction ( aRealMousePos );
- const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height();
+ const long nSectionHeight = rxSection->PixelToLogic(rxSection->GetOutputSizePixel()).Height();
aRealMousePos.AdjustY( -nSectionHeight );
}
}
bool OViewsWindow::IsAction() const
{
- bool bAction = false;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; !bAction && aIter != aEnd; ++aIter)
- bAction = (*aIter)->getReportSection().getSectionView().IsAction();
- return bAction;
+ return std::any_of(m_aSections.begin(), m_aSections.end(),
+ [](const VclPtr<OSectionWindow>& rxSection) { return rxSection->getReportSection().getSectionView().IsAction(); });
}
bool OViewsWindow::IsDragObj() const
{
- bool bAction = false;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; !bAction && aIter != aEnd; ++aIter)
- bAction = (*aIter)->getReportSection().getSectionView().IsAction();
- return bAction;
+ return std::any_of(m_aSections.begin(), m_aSections.end(),
+ [](const VclPtr<OSectionWindow>& rxSection) { return rxSection->getReportSection().getSectionView().IsAction(); });
}
sal_uInt32 OViewsWindow::getMarkedObjectCount() const
{
- sal_uInt32 nCount = 0;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd; ++aIter)
- nCount += static_cast<sal_uInt32>((*aIter)->getReportSection().getSectionView().GetMarkedObjectCount());
- return nCount;
+ return std::accumulate(m_aSections.begin(), m_aSections.end(), sal_uInt32(0),
+ [](const sal_uInt32 nCount, const VclPtr<OSectionWindow>& rxSection) {
+ return nCount + static_cast<sal_uInt32>(rxSection->getReportSection().getSectionView().GetMarkedObjectCount()); });
}
void OViewsWindow::handleKey(const vcl::KeyCode& _rCode)
@@ -1450,11 +1382,10 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode)
rScrollBar.DoScrollAction(( nCode == KEY_RIGHT || nCode == KEY_UP ) ? ScrollType::LineUp : ScrollType::LineDown );
return;
}
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd; ++aIter)
+
+ for (const auto& rxSection : m_aSections)
{
- OReportSection& rReportSection = (*aIter)->getReportSection();
+ OReportSection& rReportSection = rxSection->getReportSection();
long nX = 0;
long nY = 0;
@@ -1665,12 +1596,12 @@ void OViewsWindow::stopScrollTimer()
void OViewsWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (sal_uInt16 i = 0;aIter != aEnd ; ++aIter,++i)
+ sal_uInt16 i = 0;
+ for (const auto& rxSection : m_aSections)
{
- if ( (*aIter)->getStartMarker().isCollapsed() )
+ if ( rxSection->getStartMarker().isCollapsed() )
_rCollapsedPositions.push_back(i);
+ ++i;
}
}
@@ -1700,11 +1631,9 @@ void OViewsWindow::zoom(const Fraction& _aZoom)
setZoomFactor(_aZoom,*this);
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (;aIter != aEnd ; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- (*aIter)->zoom(_aZoom);
+ rxSection->zoom(_aZoom);
}
Resize();
@@ -1732,21 +1661,17 @@ void OViewsWindow::scrollChildren(const Point& _aThumbPos)
Scroll(0, -( aOld.Y() + aPosY.Y()),ScrollFlags::Children);
}
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (;aIter != aEnd ; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- (*aIter)->scrollChildren(aPos.X());
+ rxSection->scrollChildren(aPos.X());
}
}
void OViewsWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const
{
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for(;aIter != aEnd; ++aIter)
+ for (const auto& rxSection : m_aSections)
{
- (*aIter)->getReportSection().fillControlModelSelection(_rSelection);
+ rxSection->getReportSection().fillControlModelSelection(_rSelection);
}
}