summaryrefslogtreecommitdiff
path: root/sfx2/source/sidebar
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-02-07 21:47:10 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-08 07:23:18 +0100
commitd761be572b6a49dff64db47bbdda309e7b984f95 (patch)
tree16e859e0492caa55c2d85e13b7c7e20e837746df /sfx2/source/sidebar
parent7daa249981e0d0b69f4f7564bfb6bc643f375039 (diff)
Use for-range loops in sfx2 (part2)
Change-Id: Ie13b5836eff2e9b5dfec4bb95935de9560ab4be0 Reviewed-on: https://gerrit.libreoffice.org/49393 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/sidebar')
-rw-r--r--sfx2/source/sidebar/Deck.cxx4
-rw-r--r--sfx2/source/sidebar/FocusManager.cxx36
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx149
-rw-r--r--sfx2/source/sidebar/SidebarToolBox.cxx6
-rw-r--r--sfx2/source/sidebar/TabBar.cxx76
-rw-r--r--sfx2/source/sidebar/UnoDeck.cxx24
-rw-r--r--sfx2/source/sidebar/UnoPanel.cxx37
7 files changed, 135 insertions, 197 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index f1396cb38bea..ff736a4896a5 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -320,9 +320,9 @@ void Deck::ScrollContainerWindow::Paint(vcl::RenderContext& rRenderContext, cons
const sal_Int32 nLeft(0);
const sal_Int32 nRight(GetSizePixel().Width() - 1);
const sfx2::sidebar::Paint& rHorizontalBorderPaint(Theme::GetPaint(Theme::Paint_HorizontalBorder));
- for (std::vector<sal_Int32>::const_iterator iY(maSeparators.begin()); iY != maSeparators.end(); ++iY)
+ for (auto const& separator : maSeparators)
{
- DrawHelper::DrawHorizontalLine(rRenderContext, nLeft, nRight, *iY,
+ DrawHelper::DrawHorizontalLine(rRenderContext, nLeft, nRight, separator,
nSeparatorHeight, rHorizontalBorderPaint);
}
}
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index 2f9730958252..78cb149ba0bf 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -67,16 +67,16 @@ void FocusManager::ClearPanels()
{
std::vector<VclPtr<Panel> > aPanels;
aPanels.swap(maPanels);
- for (auto iPanel(aPanels.begin()),iEnd(aPanels.end()); iPanel != iEnd; ++iPanel)
+ for (auto const& panel : aPanels)
{
- UnregisterWindow(**iPanel);
- if ((*iPanel)->GetTitleBar())
+ UnregisterWindow(*panel);
+ if (panel->GetTitleBar())
{
- UnregisterWindow(*(*iPanel)->GetTitleBar());
- UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+ UnregisterWindow(*panel->GetTitleBar());
+ UnregisterWindow(panel->GetTitleBar()->GetToolBox());
}
- (*iPanel)->RemoveChildEventListener(LINK(this, FocusManager, ChildEventListener));
+ panel->RemoveChildEventListener(LINK(this, FocusManager, ChildEventListener));
}
}
@@ -84,9 +84,9 @@ void FocusManager::ClearButtons()
{
std::vector<VclPtr<Button> > aButtons;
aButtons.swap(maButtons);
- for (auto iButton = aButtons.begin(); iButton != aButtons.end(); ++iButton)
+ for (auto const& button : aButtons)
{
- UnregisterWindow(**iButton);
+ UnregisterWindow(*button);
}
}
@@ -109,29 +109,29 @@ void FocusManager::SetDeckTitle (DeckTitleBar* pDeckTitleBar)
void FocusManager::SetPanels (const SharedPanelContainer& rPanels)
{
ClearPanels();
- for (auto iPanel = rPanels.begin(); iPanel != rPanels.end(); ++iPanel)
+ for (auto const& panel : rPanels)
{
- RegisterWindow(**iPanel);
- if ((*iPanel)->GetTitleBar())
+ RegisterWindow(*panel);
+ if (panel->GetTitleBar())
{
- RegisterWindow(*(*iPanel)->GetTitleBar());
- RegisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
+ RegisterWindow(*panel->GetTitleBar());
+ RegisterWindow(panel->GetTitleBar()->GetToolBox());
}
// Register also as child event listener at the panel.
- (*iPanel)->AddChildEventListener(LINK(this, FocusManager, ChildEventListener));
+ panel->AddChildEventListener(LINK(this, FocusManager, ChildEventListener));
- maPanels.emplace_back(iPanel->get());
+ maPanels.emplace_back(panel.get());
}
}
void FocusManager::SetButtons (const ::std::vector<Button*>& rButtons)
{
ClearButtons();
- for (auto iButton = rButtons.begin(); iButton != rButtons.end(); ++iButton)
+ for (auto const& button : rButtons)
{
- RegisterWindow(**iButton);
- maButtons.emplace_back(*iButton);
+ RegisterWindow(*button);
+ maButtons.emplace_back(button);
}
}
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index ead0ce7d7f11..7f77303833b6 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -60,31 +60,30 @@ css::uno::Sequence<OUString> BuildContextList (const ContextList& rContextList)
{
const ::std::vector<ContextList::Entry>& entries = rContextList.GetEntries();
- css::uno::Sequence<OUString> result(entries.size());
- long i = 0;
-
- for (::std::vector<ContextList::Entry>::const_iterator iEntry(entries.begin()), iEnd(entries.end());
- iEntry!=iEnd; ++iEntry)
- {
- OUString appName = iEntry->maContext.msApplication;
- OUString contextName = iEntry->maContext.msContext;
- OUString menuCommand = iEntry->msMenuCommand;
-
- OUString visibility;
- if (iEntry->mbIsInitiallyVisible)
- visibility = "visible";
- else
- visibility = "hidden";
+ css::uno::Sequence<OUString> result(entries.size());
+ long i = 0;
- OUString element = appName + ", " + contextName +", " + visibility;
+ for (auto const& entry : entries)
+ {
+ OUString appName = entry.maContext.msApplication;
+ OUString contextName = entry.maContext.msContext;
+ OUString menuCommand = entry.msMenuCommand;
- if (!menuCommand.isEmpty())
- element += ", "+menuCommand;
+ OUString visibility;
+ if (entry.mbIsInitiallyVisible)
+ visibility = "visible";
+ else
+ visibility = "hidden";
- result[i] = element;
+ OUString element = appName + ", " + contextName +", " + visibility;
- i++;
- }
+ if (!menuCommand.isEmpty())
+ element += ", "+menuCommand;
+
+ result[i] = element;
+
+ ++i;
+ }
return result;
@@ -109,12 +108,9 @@ ResourceManager::~ResourceManager()
void ResourceManager::InitDeckContext(const Context& rContext)
{
- DeckContainer::iterator iDeck;
- for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+ for (auto const& deck : maDecks)
{
- std::shared_ptr<DeckDescriptor>& rDeck = *iDeck;
-
- const ContextList::Entry* pMatchingEntry = rDeck->maContextList.GetMatch(rContext);
+ const ContextList::Entry* pMatchingEntry = deck->maContextList.GetMatch(rContext);
bool bIsEnabled;
if (pMatchingEntry)
@@ -122,22 +118,18 @@ void ResourceManager::InitDeckContext(const Context& rContext)
else
bIsEnabled = false;
- rDeck->mbIsEnabled = bIsEnabled;
+ deck->mbIsEnabled = bIsEnabled;
}
}
std::shared_ptr<DeckDescriptor> ResourceManager::ImplGetDeckDescriptor(const OUString& rsDeckId) const
{
- DeckContainer::const_iterator iDeck;
-
- for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+ for (auto const& deck : maDecks)
{
- const std::shared_ptr<DeckDescriptor>& rDeck = *iDeck;
-
- if (rDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
+ if (deck->mbExperimental && !maMiscOptions.IsExperimentalMode())
continue;
- if (rDeck->msId == rsDeckId)
- return rDeck;
+ if (deck->msId == rsDeckId)
+ return deck;
}
return nullptr;
}
@@ -149,13 +141,10 @@ std::shared_ptr<DeckDescriptor> ResourceManager::GetDeckDescriptor(const OUStrin
std::shared_ptr<PanelDescriptor> ResourceManager::ImplGetPanelDescriptor(const OUString& rsPanelId) const
{
- PanelContainer::const_iterator iPanel;
- for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
+ for (auto const& panel : maPanels)
{
- const std::shared_ptr<PanelDescriptor>& rPanel = *iPanel;
-
- if (rPanel->msId == rsPanelId)
- return rPanel;
+ if (panel->msId == rsPanelId)
+ return panel;
}
return nullptr;
}
@@ -174,15 +163,12 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch
ReadLegacyAddons(rxController);
std::multimap<sal_Int32,DeckContextDescriptor> aOrderedIds;
- DeckContainer::const_iterator iDeck;
- for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+ for (auto const& deck : maDecks)
{
- const std::shared_ptr<DeckDescriptor>& rDeck = *iDeck;
-
- if (rDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
+ if (deck->mbExperimental && !maMiscOptions.IsExperimentalMode())
continue;
- const DeckDescriptor& rDeckDescriptor (*rDeck);
+ const DeckDescriptor& rDeckDescriptor (*deck);
if (rDeckDescriptor.maContextList.GetMatch(rContext) == nullptr)
continue;
@@ -196,10 +182,9 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch
aOrderedIds.emplace(rDeckDescriptor.mnOrderIndex, aDeckContextDescriptor);
}
- std::multimap<sal_Int32,DeckContextDescriptor>::const_iterator iId;
- for (iId = aOrderedIds.begin(); iId != aOrderedIds.end(); ++iId)
+ for (auto const& orderId : aOrderedIds)
{
- rDecks.push_back(iId->second);
+ rDecks.push_back(orderId.second);
}
return rDecks;
@@ -215,11 +200,9 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc
ReadLegacyAddons(rxController);
std::multimap<sal_Int32, PanelContextDescriptor> aOrderedIds;
- PanelContainer::const_iterator iPanel;
- for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
+ for (auto const& panel : maPanels)
{
- const std::shared_ptr<PanelDescriptor>& rPanel = *iPanel;
- const PanelDescriptor& rPanelDescriptor (*rPanel);
+ const PanelDescriptor& rPanelDescriptor (*panel);
if (rPanelDescriptor.mbExperimental && !maMiscOptions.IsExperimentalMode())
continue;
if ( rPanelDescriptor.msDeckId != sDeckId )
@@ -237,10 +220,9 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc
aOrderedIds.emplace(rPanelDescriptor.mnOrderIndex, aPanelContextDescriptor);
}
- std::multimap<sal_Int32,PanelContextDescriptor>::const_iterator iId;
- for (iId = aOrderedIds.begin(); iId != aOrderedIds.end(); ++iId)
+ for (auto const& orderId : aOrderedIds)
{
- rPanelIds.push_back(iId->second);
+ rPanelIds.push_back(orderId.second);
}
return rPanelIds;
@@ -298,15 +280,12 @@ void ResourceManager::ReadDeckList()
void ResourceManager::SaveDecksSettings(const Context& rContext)
{
- DeckContainer::const_iterator iDeck;
- for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
+ for (auto const& deck : maDecks)
{
- const std::shared_ptr<DeckDescriptor>& rDeck = *iDeck;
-
- const ContextList::Entry* pMatchingEntry = rDeck->maContextList.GetMatch(rContext);
+ const ContextList::Entry* pMatchingEntry = deck->maContextList.GetMatch(rContext);
if (pMatchingEntry)
{
- std::shared_ptr<DeckDescriptor> xDeckDesc = GetDeckDescriptor(rDeck->msId);
+ std::shared_ptr<DeckDescriptor> xDeckDesc = GetDeckDescriptor(deck->msId);
if (xDeckDesc)
SaveDeckSettings(xDeckDesc.get());
}
@@ -369,11 +348,9 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc)
SharedPanelContainer rPanels = pDeckDesc->mpDeck->GetPanels();
bChanged = false;
- for ( SharedPanelContainer::iterator iPanel(rPanels.begin()), iEnd(rPanels.end());
- iPanel!=iEnd; ++iPanel)
+ for (auto const& panel : rPanels)
{
- VclPtr<Panel> const & aPanel = *iPanel;
- OUString panelId = aPanel->GetId();
+ OUString panelId = panel->GetId();
std::shared_ptr<PanelDescriptor> xPanelDesc = GetPanelDescriptor(panelId);
::uno::Sequence< OUString > sPanelContextList = BuildContextList(xPanelDesc->maContextList);
@@ -617,14 +594,13 @@ void ResourceManager::ReadContextList (
// Add context descriptors.
- std::vector<vcl::EnumContext::Application>::const_iterator iApplication;
- for (iApplication = aApplications.begin(); iApplication != aApplications.end(); ++iApplication)
+ for (auto const& application : aApplications)
{
- if (*iApplication != vcl::EnumContext::Application::NONE)
+ if (application != vcl::EnumContext::Application::NONE)
{
rContextList.AddContextDescription(
Context(
- vcl::EnumContext::GetApplicationName(*iApplication),
+ vcl::EnumContext::GetApplicationName(application),
vcl::EnumContext::GetContextName(eContext)),
bIsInitiallyVisible,
sMenuCommand);
@@ -710,14 +686,11 @@ void ResourceManager::StorePanelExpansionState (
const bool bExpansionState,
const Context& rContext)
{
- PanelContainer::iterator iPanel;
- for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
+ for (auto const& panel : maPanels)
{
- const std::shared_ptr<PanelDescriptor>& rPanel = *iPanel;
-
- if (rPanel->msId == rsPanelId)
+ if (panel->msId == rsPanelId)
{
- ContextList::Entry* pEntry(rPanel->maContextList.GetMatch(rContext));
+ ContextList::Entry* pEntry(panel->maContextList.GetMatch(rContext));
if (pEntry != nullptr)
pEntry->mbIsInitiallyVisible = bExpansionState;
}
@@ -775,10 +748,9 @@ bool ResourceManager::IsDeckEnabled (
GetMatchingPanels(aPanelContextDescriptors, rContext, rsDeckId, rxController);
- PanelContextDescriptorContainer::const_iterator iPanel;
- for (iPanel = aPanelContextDescriptors.begin(); iPanel != aPanelContextDescriptors.end(); ++iPanel)
+ for (auto const& panelContextDescriptor : aPanelContextDescriptors)
{
- if (iPanel->mbShowForReadOnlyDocuments)
+ if (panelContextDescriptor.mbShowForReadOnlyDocuments)
return true;
}
return false;
@@ -786,18 +758,16 @@ bool ResourceManager::IsDeckEnabled (
void ResourceManager::UpdateModel(const css::uno::Reference<css::frame::XModel>& xModel)
{
- for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr)
+ for (auto const& deck : maDecks)
{
- std::shared_ptr<DeckDescriptor>& rDeck = *itr;
-
- if (!rDeck->mpDeck)
+ if (!deck->mpDeck)
continue;
- const SharedPanelContainer& rContainer = rDeck->mpDeck->GetPanels();
+ const SharedPanelContainer& rContainer = deck->mpDeck->GetPanels();
- for (SharedPanelContainer::const_iterator it = rContainer.begin(); it != rContainer.end(); ++it)
+ for (auto const& elem : rContainer)
{
- css::uno::Reference<css::ui::XUpdateModel> xPanel((*it)->GetPanelComponent(), css::uno::UNO_QUERY);
+ css::uno::Reference<css::ui::XUpdateModel> xPanel(elem->GetPanelComponent(), css::uno::UNO_QUERY);
if (xPanel.is()) // tdf#108814 interface is optional
{
xPanel->updateModel(xModel);
@@ -808,10 +778,9 @@ void ResourceManager::UpdateModel(const css::uno::Reference<css::frame::XModel>&
void ResourceManager::disposeDecks()
{
- for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr)
+ for (auto const& deck : maDecks)
{
- std::shared_ptr<DeckDescriptor>& rDeck = *itr;
- rDeck->mpDeck.disposeAndClear();
+ deck->mpDeck.disposeAndClear();
}
}
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index 44d8afcfe7c7..ba44d821371e 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -79,11 +79,9 @@ void SidebarToolBox::dispose()
ControllerContainer aControllers;
aControllers.swap(maControllers);
- for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
- iController!=iEnd;
- ++iController)
+ for (auto const& controller : aControllers)
{
- Reference<lang::XComponent> xComponent(iController->second, UNO_QUERY);
+ Reference<lang::XComponent> xComponent(controller.second, UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
}
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index b8b97872e09f..ccb6c6e27a61 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -77,11 +77,8 @@ TabBar::~TabBar()
void TabBar::dispose()
{
- for(ItemContainer::iterator
- iItem(maItems.begin()), iEnd(maItems.end());
- iItem!=iEnd;
- ++iItem)
- iItem->mpButton.disposeAndClear();
+ for (auto & item : maItems)
+ item.mpButton.disposeAndClear();
maItems.clear();
mpMenuButton.disposeAndClear();
vcl::Window::dispose();
@@ -108,18 +105,17 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe
{
// Remove the current buttons.
{
- for(ItemContainer::iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+ for (auto & item : maItems)
{
- iItem->mpButton.disposeAndClear();
+ item.mpButton.disposeAndClear();
}
maItems.clear();
}
maItems.resize(rDecks.size());
sal_Int32 nIndex (0);
- for (ResourceManager::DeckContextDescriptorContainer::const_iterator
- iDeck(rDecks.begin()); iDeck != rDecks.end(); ++iDeck)
+ for (auto const& deck : rDecks)
{
- std::shared_ptr<DeckDescriptor> xDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId);
+ std::shared_ptr<DeckDescriptor> xDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId);
if (xDescriptor == nullptr)
{
OSL_ASSERT(xDescriptor!=nullptr);
@@ -135,7 +131,7 @@ void TabBar::SetDecks(const ResourceManager::DeckContextDescriptorContainer& rDe
rItem.mbIsHidden = ! xDescriptor->mbIsEnabled;
rItem.mbIsHiddenByDefault = rItem.mbIsHidden; // the default is the state while creating
- rItem.mpButton->Enable(iDeck->mbIsEnabled);
+ rItem.mpButton->Enable(deck.mbIsEnabled);
}
UpdateButtonIcons();
@@ -147,17 +143,14 @@ void TabBar::UpdateButtonIcons()
Image aImage = Theme::GetImage(Theme::Image_TabBarMenu);
mpMenuButton->SetModeImage(aImage);
- for(ItemContainer::const_iterator
- iItem(maItems.begin()), iEnd(maItems.end());
- iItem!=iEnd;
- ++iItem)
+ for (auto const& item : maItems)
{
- std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId);
+ std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(item.msDeckId);
if (xDeckDescriptor)
{
aImage = GetItemImage(*xDeckDescriptor);
- iItem->mpButton->SetModeImage(aImage);
+ item.mpButton->SetModeImage(aImage);
}
}
@@ -189,15 +182,12 @@ void TabBar::Layout()
}
// Place the deck selection buttons.
- for(ItemContainer::const_iterator
- iItem(maItems.begin()), iEnd(maItems.end());
- iItem!=iEnd;
- ++iItem)
+ for (auto const& item : maItems)
{
- Button& rButton (*iItem->mpButton);
- rButton.Show( ! iItem->mbIsHidden);
+ Button& rButton (*item.mpButton);
+ rButton.Show( ! item.mbIsHidden);
- if (iItem->mbIsHidden)
+ if (item.mbIsHidden)
continue;
// Place and size the icon.
@@ -213,22 +203,20 @@ void TabBar::Layout()
void TabBar::HighlightDeck (const OUString& rsDeckId)
{
- for (ItemContainer::iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+ for (auto const& item : maItems)
{
- if (iItem->msDeckId == rsDeckId)
- iItem->mpButton->Check();
+ if (item.msDeckId == rsDeckId)
+ item.mpButton->Check();
else
- iItem->mpButton->Check(false);
+ item.mpButton->Check(false);
}
}
void TabBar::RemoveDeckHighlight ()
{
- for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
- iItem!=iEnd;
- ++iItem)
+ for (auto const& item : maItems)
{
- iItem->mpButton->Check(false);
+ item.mpButton->Check(false);
}
}
@@ -341,16 +329,16 @@ void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
void TabBar::RestoreHideFlags()
{
bool bNeedsLayout(false);
- for (ItemContainer::iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+ for (auto & item : maItems)
{
- if (iItem->mbIsHidden != iItem->mbIsHiddenByDefault)
+ if (item.mbIsHidden != item.mbIsHiddenByDefault)
{
- iItem->mbIsHidden = iItem->mbIsHiddenByDefault;
+ item.mbIsHidden = item.mbIsHiddenByDefault;
bNeedsLayout = true;
- std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId);
+ std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(item.msDeckId);
if (xDeckDescriptor)
- xDeckDescriptor->mbIsEnabled = ! iItem->mbIsHidden;
+ xDeckDescriptor->mbIsEnabled = ! item.mbIsHidden;
}
}
@@ -364,9 +352,9 @@ void TabBar::UpdateFocusManager(FocusManager& rFocusManager)
aButtons.reserve(maItems.size()+1);
aButtons.push_back(mpMenuButton.get());
- for (ItemContainer::const_iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+ for (auto const& item : maItems)
{
- aButtons.push_back(iItem->mpButton.get());
+ aButtons.push_back(item.mpButton.get());
}
rFocusManager.SetButtons(aButtons);
}
@@ -378,18 +366,18 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked, Button*, void)
std::vector<DeckMenuData> aMenuData;
- for (ItemContainer::const_iterator iItem(maItems.begin()); iItem != maItems.end(); ++iItem)
+ for (auto const& item : maItems)
{
- std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(iItem->msDeckId);
+ std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(item.msDeckId);
if (xDeckDescriptor)
{
DeckMenuData aData;
aData.msDisplayName = xDeckDescriptor->msTitle;
aData.msDeckId = xDeckDescriptor->msId;
- aData.mbIsCurrentDeck = iItem->mpButton->IsChecked();
- aData.mbIsActive = !iItem->mbIsHidden;
- aData.mbIsEnabled = iItem->mpButton->IsEnabled();
+ aData.mbIsCurrentDeck = item.mpButton->IsChecked();
+ aData.mbIsActive = !item.mbIsHidden;
+ aData.mbIsEnabled = item.mpButton->IsEnabled();
aMenuData.push_back(aData);
}
diff --git a/sfx2/source/sidebar/UnoDeck.cxx b/sfx2/source/sidebar/UnoDeck.cxx
index a87dcb7194d8..1bcc0d8f7e86 100644
--- a/sfx2/source/sidebar/UnoDeck.cxx
+++ b/sfx2/source/sidebar/UnoDeck.cxx
@@ -192,10 +192,9 @@ void SAL_CALL SfxUnoDeck::moveUp()
sal_Int32 curOrderIndex = getOrderIndex();
sal_Int32 previousIndex = GetMinOrderIndex(aDecks);
- ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
- for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+ for (auto const& deck : aDecks)
{
- sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId)->mnOrderIndex;
if( index < curOrderIndex && index > previousIndex)
previousIndex = index;
}
@@ -224,11 +223,9 @@ void SAL_CALL SfxUnoDeck::moveDown()
sal_Int32 curOrderIndex = getOrderIndex();
sal_Int32 nextIndex = GetMaxOrderIndex(aDecks);
-
- ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
- for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+ for (auto const& deck : aDecks)
{
- sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId)->mnOrderIndex;
if( index > curOrderIndex && index < nextIndex)
nextIndex = index;
}
@@ -255,9 +252,9 @@ sal_Int32 SfxUnoDeck::GetMinOrderIndex(ResourceManager::DeckContextDescriptorCon
iDeck = aDecks.begin();
sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
- for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+ for (auto const& deck : aDecks)
{
- sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId)->mnOrderIndex;
if(minIndex > index)
minIndex = index;
}
@@ -268,14 +265,11 @@ sal_Int32 SfxUnoDeck::GetMaxOrderIndex(ResourceManager::DeckContextDescriptorCon
{
SidebarController* pSidebarController = getSidebarController();
- ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck;
-
- iDeck = aDecks.begin();
- sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+ sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetDeckDescriptor(aDecks.begin()->msId)->mnOrderIndex;
- for (iDeck = aDecks.begin(); iDeck != aDecks.end(); ++iDeck)
+ for (auto const& deck : aDecks)
{
- sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(iDeck->msId)->mnOrderIndex;
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetDeckDescriptor(deck.msId)->mnOrderIndex;
if(maxIndex < index)
maxIndex = index;
}
diff --git a/sfx2/source/sidebar/UnoPanel.cxx b/sfx2/source/sidebar/UnoPanel.cxx
index a382fe133b4c..f4f022ca74c0 100644
--- a/sfx2/source/sidebar/UnoPanel.cxx
+++ b/sfx2/source/sidebar/UnoPanel.cxx
@@ -93,13 +93,10 @@ void SAL_CALL SfxUnoPanel::expand( const sal_Bool bCollapseOther )
if (bCollapseOther)
{
SharedPanelContainer aPanels = mpDeck->GetPanels();
- for ( SharedPanelContainer::iterator iPanel(aPanels.begin()), iEnd(aPanels.end());
- iPanel!=iEnd; ++iPanel)
+ for (auto const& panel : aPanels)
{
- VclPtr<Panel> const & aPanel = *iPanel;
-
- if (! aPanel->HasIdPredicate(mPanelId))
- aPanel->SetExpanded(false);
+ if (! panel->HasIdPredicate(mPanelId))
+ panel->SetExpanded(false);
}
}
@@ -206,10 +203,9 @@ void SAL_CALL SfxUnoPanel::moveUp()
sal_Int32 curOrderIndex = getOrderIndex();
sal_Int32 previousIndex = GetMinOrderIndex(aPanels);
- ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel;
- for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+ for (auto const& panel : aPanels)
{
- sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(panel.msId)->mnOrderIndex;
if( index < curOrderIndex && index > previousIndex)
previousIndex = index;
}
@@ -238,10 +234,9 @@ void SAL_CALL SfxUnoPanel::moveDown()
sal_Int32 curOrderIndex = getOrderIndex();
sal_Int32 nextIndex = GetMaxOrderIndex(aPanels);
- ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel;
- for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+ for (auto const& panel : aPanels)
{
- sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(panel.msId)->mnOrderIndex;
if( index > curOrderIndex && index < nextIndex)
nextIndex = index;
}
@@ -263,14 +258,11 @@ sal_Int32 SfxUnoPanel::GetMinOrderIndex(ResourceManager::PanelContextDescriptorC
{
SidebarController* pSidebarController = getSidebarController();
- ResourceManager::PanelContextDescriptorContainer::iterator iPanel;
-
- iPanel = aPanels.begin();
- sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ sal_Int32 minIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(aPanels.begin()->msId)->mnOrderIndex;
- for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+ for (auto const& panel : aPanels)
{
- sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(panel.msId)->mnOrderIndex;
if(minIndex > index)
minIndex = index;
}
@@ -281,14 +273,11 @@ sal_Int32 SfxUnoPanel::GetMaxOrderIndex(ResourceManager::PanelContextDescriptorC
{
SidebarController* pSidebarController = getSidebarController();
- ResourceManager::PanelContextDescriptorContainer::iterator iPanel;
-
- iPanel = aPanels.begin();
- sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ sal_Int32 maxIndex = pSidebarController->GetResourceManager()->GetPanelDescriptor(aPanels.begin()->msId)->mnOrderIndex;
- for (iPanel = aPanels.begin(); iPanel != aPanels.end(); ++iPanel)
+ for (auto const& panel : aPanels)
{
- sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(iPanel->msId)->mnOrderIndex;
+ sal_Int32 index = pSidebarController->GetResourceManager()->GetPanelDescriptor(panel.msId)->mnOrderIndex;
if(maxIndex < index)
maxIndex = index;
}