summaryrefslogtreecommitdiff
path: root/sfx2/source/sidebar/DeckLayouter.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/sidebar/DeckLayouter.cxx')
-rw-r--r--sfx2/source/sidebar/DeckLayouter.cxx73
1 files changed, 29 insertions, 44 deletions
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 2b7f7df382b5..3d40cd13a59e 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -155,13 +155,10 @@ tools::Rectangle LayoutPanels (
sal_Int32 nTotalPreferredHeight (0);
sal_Int32 nTotalMinimumHeight (0);
- for(::std::vector<LayoutItem>::const_iterator iItem(rLayoutItems.begin()),
- iEnd(rLayoutItems.end());
- iItem!=iEnd;
- ++iItem)
+ for (const auto& rItem : rLayoutItems)
{
- nTotalMinimumHeight += iItem->maLayoutSize.Minimum;
- nTotalPreferredHeight += iItem->maLayoutSize.Preferred;
+ nTotalMinimumHeight += rItem.maLayoutSize.Minimum;
+ nTotalPreferredHeight += rItem.maLayoutSize.Preferred;
}
if (nTotalMinimumHeight > nAvailableHeight
@@ -343,36 +340,32 @@ void GetRequestedSizes (
const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
- ::std::vector<LayoutItem>::const_iterator iEnd(rLayoutItems.end());
-
- for(::std::vector<LayoutItem>::iterator iItem(rLayoutItems.begin());
- iItem!=iEnd;
- ++iItem)
+ for (auto& rItem : rLayoutItems)
{
ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0));
- if (iItem->mpPanel != nullptr)
+ if (rItem.mpPanel != nullptr)
{
if (rLayoutItems.size() == 1
- && iItem->mpPanel->IsTitleBarOptional())
+ && rItem.mpPanel->IsTitleBarOptional())
{
// There is only one panel and its title bar is
// optional => hide it.
rAvailableHeight -= nDeckSeparatorHeight;
- iItem->mbShowTitleBar = false;
+ rItem.mbShowTitleBar = false;
}
else
{
// Show the title bar and a separator above and below
// the title bar.
- const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * iItem->mpPanel->GetDPIScaleFactor());
+ const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * rItem.mpPanel->GetDPIScaleFactor());
rAvailableHeight -= nPanelTitleBarHeight;
rAvailableHeight -= nDeckSeparatorHeight;
}
- if (iItem->mpPanel->IsExpanded())
+ if (rItem.mpPanel->IsExpanded())
{
- Reference<ui::XSidebarPanel> xPanel (iItem->mpPanel->GetPanelComponent());
+ Reference<ui::XSidebarPanel> xPanel (rItem.mpPanel->GetPanelComponent());
if (xPanel.is())
{
aLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth());
@@ -385,7 +378,7 @@ void GetRequestedSizes (
aLayoutSize = ui::LayoutSize(MinimalPanelHeight, -1, 0);
}
}
- iItem->maLayoutSize = aLayoutSize;
+ rItem.maLayoutSize = aLayoutSize;
}
}
@@ -405,25 +398,21 @@ void DistributeHeights (
sal_Int32 nTotalWeight (0);
sal_Int32 nNoMaximumCount (0);
- ::std::vector<LayoutItem>::const_iterator iEnd(rLayoutItems.end());
-
- for(::std::vector<LayoutItem>::iterator iItem(rLayoutItems.begin());
- iItem!=iEnd;
- ++iItem)
+ for (auto& rItem : rLayoutItems)
{
- if (iItem->maLayoutSize.Maximum == 0)
+ if (rItem.maLayoutSize.Maximum == 0)
continue;
- if (iItem->maLayoutSize.Maximum < 0)
+ if (rItem.maLayoutSize.Maximum < 0)
++nNoMaximumCount;
const sal_Int32 nBaseHeight (
bMinimumHeightIsBase
- ? iItem->maLayoutSize.Minimum
- : iItem->maLayoutSize.Preferred);
+ ? rItem.maLayoutSize.Minimum
+ : rItem.maLayoutSize.Preferred);
if (nBaseHeight < nContainerHeight)
{
- iItem->mnWeight = nContainerHeight - nBaseHeight;
- nTotalWeight += iItem->mnWeight;
+ rItem.mnWeight = nContainerHeight - nBaseHeight;
+ nTotalWeight += rItem.mnWeight;
}
}
@@ -431,21 +420,19 @@ void DistributeHeights (
return;
// First pass of height distribution.
- for(::std::vector<LayoutItem>::iterator iItem(rLayoutItems.begin());
- iItem!=iEnd;
- ++iItem)
+ for (auto& rItem : rLayoutItems)
{
const sal_Int32 nBaseHeight (
bMinimumHeightIsBase
- ? iItem->maLayoutSize.Minimum
- : iItem->maLayoutSize.Preferred);
- sal_Int32 nDistributedHeight (iItem->mnWeight * nHeightToDistribute / nTotalWeight);
- if (nBaseHeight+nDistributedHeight > iItem->maLayoutSize.Maximum
- && iItem->maLayoutSize.Maximum >= 0)
+ ? rItem.maLayoutSize.Minimum
+ : rItem.maLayoutSize.Preferred);
+ sal_Int32 nDistributedHeight (rItem.mnWeight * nHeightToDistribute / nTotalWeight);
+ if (nBaseHeight+nDistributedHeight > rItem.maLayoutSize.Maximum
+ && rItem.maLayoutSize.Maximum >= 0)
{
- nDistributedHeight = ::std::max<sal_Int32>(0,iItem->maLayoutSize.Maximum - nBaseHeight);
+ nDistributedHeight = ::std::max<sal_Int32>(0, rItem.maLayoutSize.Maximum - nBaseHeight);
}
- iItem->mnDistributedHeight = nDistributedHeight;
+ rItem.mnDistributedHeight = nDistributedHeight;
nRemainingHeightToDistribute -= nDistributedHeight;
}
@@ -467,13 +454,11 @@ void DistributeHeights (
sal_Int32 nAdditionalHeightForFirstPanel (nRemainingHeightToDistribute
- nNoMaximumCount*nAdditionalHeightPerPanel);
- for(::std::vector<LayoutItem>::iterator iItem(rLayoutItems.begin());
- iItem!=iEnd;
- ++iItem)
+ for (auto& rItem : rLayoutItems)
{
- if (iItem->maLayoutSize.Maximum < 0)
+ if (rItem.maLayoutSize.Maximum < 0)
{
- iItem->mnDistributedHeight += nAdditionalHeightPerPanel + nAdditionalHeightForFirstPanel;
+ rItem.mnDistributedHeight += nAdditionalHeightPerPanel + nAdditionalHeightForFirstPanel;
nRemainingHeightToDistribute -= nAdditionalHeightPerPanel + nAdditionalHeightForFirstPanel;
}
}