summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2012-04-14 20:16:26 +0200
committerJan Holesovsky <kendy@suse.cz>2012-04-14 22:49:31 +0200
commit7316331b863cb5c850272f3ad4d85aadc3ed6551 (patch)
tree62d2fcdfdf7fe2f9d686cf445985c7e1ac11659f /sd
parent5b3a8606767929e349fd4034fbf8e2243c34cfc5 (diff)
Slidesorter: Copy'n'paste reduction.
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/slidesorter/view/SlsButtonBar.cxx55
1 files changed, 23 insertions, 32 deletions
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
index 919f8122cc0a..19529c0b79e4 100644
--- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
+++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
@@ -102,6 +102,9 @@ protected:
ButtonPosition mePosition;
private:
+ /// Compute the size of the are for the given button size.
+ // TODO this is supposed to be static, fix that
+ Size MinimumSize( Button::IconSize eSize, const ::std::vector<SharedButton>& rButtons );
void UpdateMinimumIconSizes(const ::std::vector<SharedButton>& rButtons);
};
@@ -752,47 +755,35 @@ void ButtonBar::BackgroundTheme::SetPreviewBoundingBox (const Rectangle& rPrevie
}
-
-
-void ButtonBar::BackgroundTheme::UpdateMinimumIconSizes (
- const ::std::vector<SharedButton>& rButtons)
+Size ButtonBar::BackgroundTheme::MinimumSize( Button::IconSize eSize,
+ const ::std::vector<SharedButton>& rButtons )
{
OSL_ASSERT(mpTheme);
- sal_Int32 nMaximumHeightLarge (0);
- sal_Int32 nMaximumHeightMedium (0);
- sal_Int32 nMaximumHeightSmall (0);
- const sal_Int32 nGap (mpTheme->GetIntegerValue(Theme::Integer_ButtonGap));
- const sal_Int32 nBorder (mpTheme->GetIntegerValue(Theme::Integer_ButtonBorder));
- sal_Int32 nTotalWidthLarge ((rButtons.size()-1) * nGap + 2*nBorder);
- sal_Int32 nTotalWidthMedium ((rButtons.size()-1) * nGap + 2*nBorder);
- sal_Int32 nTotalWidthSmall ((rButtons.size()-1) * nGap + 2*nBorder);
- for (sal_uInt32 nIndex=0; nIndex<rButtons.size(); ++nIndex)
+ int nMaximumHeight = 0;
+ const int nGap = mpTheme->GetIntegerValue(Theme::Integer_ButtonGap);
+ const int nBorder = mpTheme->GetIntegerValue(Theme::Integer_ButtonBorder);
+
+ int nTotalWidth = (rButtons.size()-1) * nGap + 2*nBorder;
+ for ( int nIndex = 0; nIndex < int( rButtons.size() ); ++nIndex )
{
// Update large size.
- Size aSize = rButtons[nIndex]->GetSize(Button::IconSize_Large);
- if (aSize.Height() > nMaximumHeightLarge)
- nMaximumHeightLarge = aSize.Height();
- nTotalWidthLarge += aSize.Width();
-
- // Update medium size.
- aSize = rButtons[nIndex]->GetSize(Button::IconSize_Medium);
- if (aSize.Height() > nMaximumHeightMedium)
- nMaximumHeightMedium = aSize.Height();
- nTotalWidthMedium += aSize.Width();
-
- // Update small size.
- aSize = rButtons[nIndex]->GetSize(Button::IconSize_Small);
- if (aSize.Height() > nMaximumHeightSmall)
- nMaximumHeightSmall = aSize.Height();
- nTotalWidthSmall += aSize.Width();
+ Size aSize( rButtons[nIndex]->GetSize(eSize) );
+ if ( aSize.Height() > nMaximumHeight )
+ nMaximumHeight = aSize.Height();
+ nTotalWidth += aSize.Width();
}
- maMinimumLargeButtonAreaSize = Size(nTotalWidthLarge, nMaximumHeightLarge+2*nBorder);
- maMinimumMediumButtonAreaSize = Size(nTotalWidthMedium, nMaximumHeightMedium+2*nBorder);
- maMinimumSmallButtonAreaSize = Size(nTotalWidthSmall, nMaximumHeightSmall+2*nBorder);
+ return Size( nTotalWidth, nMaximumHeight + 2*nBorder );
}
+void ButtonBar::BackgroundTheme::UpdateMinimumIconSizes (
+ const ::std::vector<SharedButton>& rButtons)
+{
+ maMinimumLargeButtonAreaSize = MinimumSize( Button::IconSize_Large, rButtons );
+ maMinimumMediumButtonAreaSize = MinimumSize( Button::IconSize_Medium, rButtons );
+ maMinimumSmallButtonAreaSize = MinimumSize( Button::IconSize_Small, rButtons );
+}
Button::IconSize ButtonBar::BackgroundTheme::GetIconSize (void) const