summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2012-04-14 20:36:22 +0200
committerJan Holesovsky <kendy@suse.cz>2012-04-14 22:49:31 +0200
commitb80ca48354bfba707d7e3b0b0c05a33038014572 (patch)
tree4ab33377c1dbfa6961f7fc5d3d8c7a140424e7b8 /sd
parent7316331b863cb5c850272f3ad4d85aadc3ed6551 (diff)
Slidesorter: Reduce some overengineering.
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx1
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsTheme.hxx31
-rw-r--r--sd/source/ui/slidesorter/view/SlsButtonBar.cxx23
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayouter.cxx5
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx3
-rw-r--r--sd/source/ui/slidesorter/view/SlsTheme.cxx31
-rw-r--r--sd/source/ui/slidesorter/view/SlsToolTip.cxx2
7 files changed, 25 insertions, 71 deletions
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
index bfb5f91b1544..04d59212d694 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
@@ -54,7 +54,6 @@ public:
area has to be, how many digits to except for the largest page number.
*/
PageObjectLayouter(
- const ::boost::shared_ptr<Theme>& rpTheme,
const Size& rPageObjectWindowSize,
const Size& rPreviewModelSize,
const SharedSdWindow& rpWindow,
diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
index a14863f48ecd..11dd0fb5f89f 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
@@ -46,6 +46,18 @@ class Properties;
namespace sd { namespace slidesorter { namespace view {
+const int Theme_ButtonCornerRadius = 3;
+const int Theme_ButtonMaxAlpha = 0;
+const int Theme_ButtonBarMaxAlpha = 0;
+const int Theme_ButtonPaintType = 1;
+const int Theme_ButtonBorder = 4;
+const int Theme_ButtonGap = 0;
+const int Theme_ButtonFadeInDelay = 800;
+const int Theme_ButtonFadeInDuration = 100;
+const int Theme_ButtonFadeOutDelay = 0;
+const int Theme_ButtonFadeOutDuration = 100;
+const int Theme_ToolTipDelay = 1000;
+const int Theme_FocusIndicatorWidth = 3;
/** Collection of colors and styles that are used to paint the slide sorter
view.
@@ -156,24 +168,6 @@ public:
};
const BitmapEx& GetIcon (const IconType eType);
- enum IntegerValueType
- {
- Integer_ButtonCornerRadius,
- Integer_ButtonMaxAlpha,
- Integer_ButtonBarMaxAlpha,
- Integer_ButtonPaintType,
- Integer_ButtonBorder,
- Integer_ButtonGap,
- Integer_ButtonFadeInDelay,
- Integer_ButtonFadeInDuration,
- Integer_ButtonFadeOutDelay,
- Integer_ButtonFadeOutDuration,
- Integer_ToolTipDelay,
- Integer_FocusIndicatorWidth,
- _IntegerValueType_Size_
- };
- sal_Int32 GetIntegerValue (const IntegerValueType eType) const;
-
enum StringType
{
String_Unhide,
@@ -212,7 +206,6 @@ private:
::std::vector<GradientDescriptor> maGradients;
::std::vector<BitmapEx> maIcons;
::std::vector<ColorData> maColor;
- ::std::vector<sal_Int32> maIntegerValues;
::std::vector<rtl::OUString> maStrings;
GradientDescriptor& GetGradient (const GradientColorType eType);
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
index 19529c0b79e4..3814c32680f2 100644
--- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
+++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
@@ -103,8 +103,7 @@ protected:
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 );
+ static Size MinimumSize( Button::IconSize eSize, const ::std::vector<SharedButton>& rButtons );
void UpdateMinimumIconSizes(const ::std::vector<SharedButton>& rButtons);
};
@@ -496,8 +495,8 @@ void ButtonBar::LayoutButtons (const Size aPageObjectSize)
bool ButtonBar::LayoutButtons (void)
{
- const sal_Int32 nGap (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonGap));
- const sal_Int32 nBorder (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonBorder));
+ const sal_Int32 nGap = Theme_ButtonGap;
+ const sal_Int32 nBorder = Theme_ButtonBorder;
const Button::IconSize eIconSize (mpBackgroundTheme->GetIconSize());
@@ -534,7 +533,7 @@ bool ButtonBar::LayoutButtons (void)
mpBackgroundTheme->Layout();
maButtonBoundingBox = mpBackgroundTheme->GetButtonArea();
maBackgroundLocation = mpBackgroundTheme->GetBackgroundLocation();
- if (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonPaintType) == 1)
+ if (Theme_ButtonPaintType == 1)
{
// Center the buttons.
maButtonBoundingBox.Left() += (maButtonBoundingBox.GetWidth() - nRegularTotalWidth)/2;
@@ -684,12 +683,8 @@ void ButtonBar::StartFadeAnimation (
// buttons are already showing. Fade out is faster than fade in.
const double nDelay (nCurrentButtonBarAlpha>0 && nCurrentButtonBarAlpha<1
? 0
- : (mrSlideSorter.GetTheme()->GetIntegerValue(bFadeIn
- ? Theme::Integer_ButtonFadeInDelay
- : Theme::Integer_ButtonFadeOutDelay)));
- const double nDuration (mrSlideSorter.GetTheme()->GetIntegerValue(bFadeIn
- ? Theme::Integer_ButtonFadeInDuration
- : Theme::Integer_ButtonFadeOutDuration));
+ : (bFadeIn ? Theme_ButtonFadeInDelay : Theme_ButtonFadeOutDelay));
+ const double nDuration (bFadeIn ? Theme_ButtonFadeInDuration : Theme_ButtonFadeOutDuration);
pDescriptor->GetVisualState().SetButtonAlphaAnimationId(
mrSlideSorter.GetController().GetAnimator()->AddAnimation(
::boost::bind(
@@ -758,11 +753,9 @@ void ButtonBar::BackgroundTheme::SetPreviewBoundingBox (const Rectangle& rPrevie
Size ButtonBar::BackgroundTheme::MinimumSize( Button::IconSize eSize,
const ::std::vector<SharedButton>& rButtons )
{
- OSL_ASSERT(mpTheme);
-
int nMaximumHeight = 0;
- const int nGap = mpTheme->GetIntegerValue(Theme::Integer_ButtonGap);
- const int nBorder = mpTheme->GetIntegerValue(Theme::Integer_ButtonBorder);
+ const int nGap = Theme_ButtonGap;
+ const int nBorder = Theme_ButtonBorder;
int nTotalWidth = (rButtons.size()-1) * nGap + 2*nBorder;
for ( int nIndex = 0; nIndex < int( rButtons.size() ); ++nIndex )
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index 3543c3608dab..e034d9137a92 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -502,8 +502,8 @@ Layouter::Implementation::Implementation (
mnRightBorder(5),
mnTopBorder(5),
mnBottomBorder(5),
- mnVerticalGap (10 - 2*rpTheme->GetIntegerValue(Theme::Integer_FocusIndicatorWidth)),
- mnHorizontalGap(10 - 2*rpTheme->GetIntegerValue(Theme::Integer_FocusIndicatorWidth)),
+ mnVerticalGap (10 - 2*Theme_FocusIndicatorWidth),
+ mnHorizontalGap(10 - 2*Theme_FocusIndicatorWidth),
maMinimalSize(132,98),
maPreferredSize(200,150),
maMaximalSize(300,200),
@@ -600,7 +600,6 @@ bool Layouter::Implementation::Rearrange (
mpPageObjectLayouter.reset(
new PageObjectLayouter(
- mpTheme,
CalculateTargetSize(rWindowSize, rPreviewModelSize),
rPreviewModelSize,
mpWindow,
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
index c04257a0fca1..4c6ff762a8c7 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
@@ -46,7 +46,6 @@ const static sal_Int32 gnInfoAreaMinWidth = 26;
}
PageObjectLayouter::PageObjectLayouter (
- const ::boost::shared_ptr<Theme>& rpTheme,
const Size& rPageObjectWindowSize,
const Size& rPageSize,
const SharedSdWindow& rpWindow,
@@ -64,7 +63,7 @@ PageObjectLayouter::PageObjectLayouter (
const Size aPageNumberAreaSize (GetPageNumberAreaSize(nPageCount));
const int nMaximumBorderWidth (gnOuterBorderWidth);
- const int nFocusIndicatorWidth (rpTheme->GetIntegerValue(Theme::Integer_FocusIndicatorWidth));
+ const int nFocusIndicatorWidth (Theme_FocusIndicatorWidth);
maPreviewBoundingBox = CalculatePreviewBoundingBox(
maPageObjectSize,
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
index ab0c6f5af1e8..5cb33b54243a 100644
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -78,8 +78,7 @@ Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties)
maPageBackgroundColor(COL_WHITE),
maGradients(),
maIcons(),
- maColor(),
- maIntegerValues()
+ maColor()
{
{
LocalResource aResource (RID_SLIDESORTER_ICONS);
@@ -103,20 +102,6 @@ Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties)
maColor[Color_PageNumberBrightBackground] = 0x333333;
maColor[Color_PageNumberDarkBackground] = 0xcccccc;
maColor[Color_PreviewBorder] = 0x949599;
-
- maIntegerValues.resize(_IntegerValueType_Size_);
- maIntegerValues[Integer_ButtonCornerRadius] = 3;
- maIntegerValues[Integer_ButtonMaxAlpha] = 0;
- maIntegerValues[Integer_ButtonBarMaxAlpha] = 0;
- maIntegerValues[Integer_ButtonPaintType] = 1;
- maIntegerValues[Integer_ButtonBorder] = 4;
- maIntegerValues[Integer_ButtonGap] = 0;
- maIntegerValues[Integer_ButtonFadeInDelay] = 800;
- maIntegerValues[Integer_ButtonFadeInDuration] = 100;
- maIntegerValues[Integer_ButtonFadeOutDelay] = 0;
- maIntegerValues[Integer_ButtonFadeOutDuration] = 100;
- maIntegerValues[Integer_ToolTipDelay] = 1000;
- maIntegerValues[Integer_FocusIndicatorWidth] = 3;
}
Update(rpProperties);
@@ -380,20 +365,6 @@ const BitmapEx& Theme::GetIcon (const IconType eType)
-sal_Int32 Theme::GetIntegerValue (const IntegerValueType eType) const
-{
- if (eType>=0 && size_t(eType)<maIntegerValues.size())
- return maIntegerValues[eType];
- else
- {
- OSL_ASSERT(eType>=0 && size_t(eType)<maIntegerValues.size());
- return 0;
- }
-}
-
-
-
-
::rtl::OUString Theme::GetString (const StringType eType) const
{
if (eType>=0 && size_t(eType)<maStrings.size())
diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
index 4c7a6184709d..217d9290264f 100644
--- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx
+++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
@@ -47,7 +47,7 @@ ToolTip::ToolTip (SlideSorter& rSlideSorter)
mnHelpWindowHandle(0),
maTimer()
{
- maTimer.SetTimeout(rSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ToolTipDelay));
+ maTimer.SetTimeout(Theme_ToolTipDelay);
maTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger));
}