[Libreoffice-commits] .: 6 commits - sd/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Sat Apr 14 13:50:06 PDT 2012
sd/source/ui/slidesorter/controller/SlsClipboard.cxx | 11
sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx | 49 +---
sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx | 1
sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx | 1
sd/source/ui/slidesorter/inc/view/SlsTheme.hxx | 51 +---
sd/source/ui/slidesorter/view/SlsButtonBar.cxx | 141 ++++--------
sd/source/ui/slidesorter/view/SlsLayouter.cxx | 5
sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx | 3
sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx | 1
sd/source/ui/slidesorter/view/SlsTheme.cxx | 66 -----
sd/source/ui/slidesorter/view/SlsToolTip.cxx | 2
11 files changed, 90 insertions(+), 241 deletions(-)
New commits:
commit 227113bbf16f2feda4d3e41bb9aff7dc100ede17
Author: Jan Holesovsky <kendy at suse.cz>
Date: Sat Apr 14 21:46:14 2012 +0200
Slidesorter: Kill more useless cruft.
diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
index afdf133..ec3ea1d 100644
--- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -35,6 +35,7 @@
#include "model/SlsPageDescriptor.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
#include "view/SlideSorterView.hxx"
+#include "view/SlsResource.hrc"
#include "view/SlsTheme.hxx"
#include "controller/SlideSorterController.hxx"
#include "controller/SlsInsertionIndicatorHandler.hxx"
@@ -120,17 +121,16 @@ class Clipboard::UndoContext
public:
UndoContext (
SdDrawDocument* pDocument,
- const ::boost::shared_ptr<ViewShell>& rpMainViewShell,
- const ::boost::shared_ptr<view::Theme>& rpTheme)
+ const ::boost::shared_ptr<ViewShell>& rpMainViewShell)
: mpDocument(pDocument),
mpMainViewShell(rpMainViewShell)
{
if (mpDocument!=NULL && mpDocument->IsUndoEnabled())
{
if (mpMainViewShell && mpMainViewShell->GetShellType() == ViewShell::ST_DRAW)
- mpDocument->BegUndo(rpTheme->GetString(view::Theme::String_DragAndDropPages));
+ mpDocument->BegUndo(String(SdResId(STRING_DRAG_AND_DROP_PAGES)));
else
- mpDocument->BegUndo(rpTheme->GetString(view::Theme::String_DragAndDropSlides));
+ mpDocument->BegUndo(String(SdResId(STRING_DRAG_AND_DROP_SLIDES)));
}
}
@@ -714,8 +714,7 @@ sal_Int8 Clipboard::ExecuteDrop (
// Handle a general drop operation.
mpUndoContext.reset(new UndoContext (
mrSlideSorter.GetModel().GetDocument(),
- mrSlideSorter.GetViewShell()->GetViewShellBase().GetMainViewShell(),
- mrSlideSorter.GetTheme()));
+ mrSlideSorter.GetViewShell()->GetViewShellBase().GetMainViewShell()));
mpSelectionObserverContext.reset(new SelectionObserver::Context(mrSlideSorter));
HandlePageDrop(*pDragTransferable);
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
index 51c7157..ca45f8b 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
@@ -96,7 +96,6 @@ private:
Bitmap maMouseOverBackground;
Bitmap maMouseOverFocusedBackground;
Bitmap maMouseOverSelectedAndFocusedBackground;
- ::rtl::OUString msUnhideString;
ButtonBar& mrButtonBar;
Size maSize;
diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
index 7e00ef3..2d60385 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
@@ -164,19 +164,6 @@ public:
};
const BitmapEx& GetIcon (const IconType eType);
- enum StringType
- {
- String_Unhide,
- String_DragAndDropPages,
- String_DragAndDropSlides,
- String_Command1,
- String_Command2,
- String_Command2B,
- String_Command3,
- _StringType_Size_
- };
- ::rtl::OUString GetString (const StringType eType) const;
-
private:
bool mbIsHighContrastMode;
class GradientDescriptor
@@ -202,7 +189,6 @@ private:
::std::vector<GradientDescriptor> maGradients;
::std::vector<BitmapEx> maIcons;
::std::vector<ColorData> maColor;
- ::std::vector<rtl::OUString> maStrings;
GradientDescriptor& GetGradient (const GradientColorType eType);
/** Guarded initialization of the specified icon in the maIcons
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
index afe64c9..28c5a26 100644
--- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
+++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
@@ -30,6 +30,7 @@
#include "view/SlsButtonBar.hxx"
#include "SlideSorter.hxx"
+#include "SlsResource.hxx"
#include "model/SlsPageDescriptor.hxx"
#include "model/SlideSorterModel.hxx"
#include "view/SlsTheme.hxx"
@@ -1070,7 +1071,7 @@ UnhideButton::UnhideButton (SlideSorter& rSlideSorter)
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BMediumHover),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BSmall),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BSmallHover),
- rSlideSorter.GetTheme()->GetString(Theme::String_Command2B))
+ String(SdResId(STRING_COMMAND2_B)))
{
}
@@ -1102,7 +1103,7 @@ StartShowButton::StartShowButton (SlideSorter& rSlideSorter)
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1MediumHover),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Small),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1SmallHover),
- rSlideSorter.GetTheme()->GetString(Theme::String_Command1))
+ String(SdResId(STRING_COMMAND1)))
{
}
@@ -1168,7 +1169,7 @@ HideButton::HideButton (SlideSorter& rSlideSorter)
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2MediumHover),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Small),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2SmallHover),
- rSlideSorter.GetTheme()->GetString(Theme::String_Command2))
+ String(SdResId(STRING_COMMAND2_A)))
{
}
@@ -1200,7 +1201,7 @@ DuplicateButton::DuplicateButton (SlideSorter& rSlideSorter)
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3MediumHover),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Small),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3SmallHover),
- rSlideSorter.GetTheme()->GetString(Theme::String_Command3))
+ String(SdResId(STRING_COMMAND3)))
{
}
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index 430cbac..2cd8f70 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -67,7 +67,6 @@ PageObjectPainter::PageObjectPainter (
maFocusedSelectionBackground(),
maMouseOverBackground(),
maMouseOverFocusedBackground(),
- msUnhideString(mpTheme->GetString(Theme::String_Unhide)),
mrButtonBar(rSlideSorter.GetView().GetButtonBar()),
maSize()
{
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
index efd93a5..c6b2bc5 100644
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -83,14 +83,6 @@ Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties)
{
LocalResource aResource (RID_SLIDESORTER_ICONS);
- maStrings.resize(_StringType_Size_);
- maStrings[String_DragAndDropPages] = String(SdResId(STRING_DRAG_AND_DROP_PAGES));
- maStrings[String_DragAndDropSlides] = String(SdResId(STRING_DRAG_AND_DROP_SLIDES));
- maStrings[String_Command1] = String(SdResId(STRING_COMMAND1));
- maStrings[String_Command2] = String(SdResId(STRING_COMMAND2_A));
- maStrings[String_Command2B] = String(SdResId(STRING_COMMAND2_B));
- maStrings[String_Command3] = String(SdResId(STRING_COMMAND3));
-
maColor.resize(_ColorType_Size_);
maColor[Color_Background] = maBackgroundColor;
maColor[Color_PageNumberDefault] = 0x0808080;
@@ -352,20 +344,6 @@ const BitmapEx& Theme::GetIcon (const IconType eType)
-::rtl::OUString Theme::GetString (const StringType eType) const
-{
- if (eType>=0 && size_t(eType)<maStrings.size())
- return maStrings[eType];
- else
- {
- OSL_ASSERT(eType>=0 && size_t(eType)<maStrings.size());
- return ::rtl::OUString();
- }
-}
-
-
-
-
Theme::GradientDescriptor& Theme::GetGradient (const GradientColorType eType)
{
if (eType>=0 && size_t(eType)<maGradients.size())
commit cecde99da64ff3de1cc8066aa9612e67f3db60e0
Author: Jan Holesovsky <kendy at suse.cz>
Date: Sat Apr 14 21:02:53 2012 +0200
Slidesorter: Kill useless ImageButton abstraction.
diff --git a/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx
index afa7781..a6a3482 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx
@@ -188,6 +188,12 @@ class Button
public:
Button (
SlideSorter& rSlideSorter,
+ const BitmapEx& rLargeIcon,
+ const BitmapEx& rLargeHoverIcon,
+ const BitmapEx& rMediumIcon,
+ const BitmapEx& rMediumHoverIcon,
+ const BitmapEx& rSmallIcon,
+ const BitmapEx& rSmallHoverIcon,
const ::rtl::OUString& rsHelpText);
virtual ~Button (void);
@@ -201,12 +207,12 @@ public:
*/
bool SetState (const State eState);
- virtual void Place (const Rectangle aButtonBarBox) = 0;
+ virtual void Place (const Rectangle aButtonBarBox);
virtual void Paint (
OutputDevice& rDevice,
const Point aOffset,
const double nAlpha,
- const ::boost::shared_ptr<Theme>& rpTheme) const = 0;
+ const ::boost::shared_ptr<Theme>& rpTheme) const;
virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor) = 0;
/** Return the bounding box of the layouted button.
@@ -215,8 +221,8 @@ public:
/** Return the minimum size required to completely paint the
button.
*/
- virtual Size GetSize (void) const = 0;
- virtual Size GetSize (const IconSize eIconSize) const = 0;
+ virtual Size GetSize (void) const;
+ virtual Size GetSize (const IconSize eIconSize) const;
::rtl::OUString GetHelpText (void) const;
bool IsDown (void) const;
void SetActiveState (const bool bIsActive);
@@ -234,33 +240,7 @@ protected:
// Buttons that lie (partly) outside the button bar are deactivated.
bool mbIsActive;
IconSize meIconSize;
-};
-
-
-class ImageButton : public Button
-{
-public:
- ImageButton (
- SlideSorter& rSlideSorter,
- const BitmapEx& rLargeIcon,
- const BitmapEx& rLargeHoverIcon,
- const BitmapEx& rMediumIcon,
- const BitmapEx& rMediumHoverIcon,
- const BitmapEx& rSmallIcon,
- const BitmapEx& rSmallHoverIcon,
- const ::rtl::OUString& rsHelpText);
-
- virtual void Place (const Rectangle aButtonBarBox);
- virtual void Paint (
- OutputDevice& rDevice,
- const Point aOffset,
- const double nAlpha,
- const ::boost::shared_ptr<Theme>& rpTheme) const;
- virtual Size GetSize (void) const;
- virtual Size GetSize (const IconSize eIconSize) const;
-
-private:
const BitmapEx maLargeIcon;
const BitmapEx maLargeHoverIcon;
const BitmapEx maMediumIcon;
@@ -270,7 +250,8 @@ private:
};
-class UnhideButton : public ImageButton
+
+class UnhideButton : public Button
{
public:
UnhideButton (SlideSorter& rSlideSorter);
@@ -280,7 +261,7 @@ protected:
};
-class StartShowButton : public ImageButton
+class StartShowButton : public Button
{
public:
StartShowButton (SlideSorter& rSlideSorter);
@@ -291,7 +272,7 @@ protected:
};
-class HideButton : public ImageButton
+class HideButton : public Button
{
public:
HideButton (SlideSorter& rSlideSorter);
@@ -301,7 +282,7 @@ protected:
};
-class DuplicateButton : public ImageButton
+class DuplicateButton : public Button
{
public:
DuplicateButton (SlideSorter& rSlideSorter);
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
index 3814c32..afe64c9 100644
--- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
+++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
@@ -857,19 +857,29 @@ void ButtonBar::BackgroundTheme::Layout (void)
Button::Button (
SlideSorter& rSlideSorter,
+ const BitmapEx& rLargeIcon,
+ const BitmapEx& rLargeHoverIcon,
+ const BitmapEx& rMediumIcon,
+ const BitmapEx& rMediumHoverIcon,
+ const BitmapEx& rSmallIcon,
+ const BitmapEx& rSmallHoverIcon,
const ::rtl::OUString& rsHelpText)
: mrSlideSorter(rSlideSorter),
meState(State_Normal),
maBoundingBox(),
msHelpText(rsHelpText),
mbIsActive(false),
- meIconSize(IconSize_Large)
+ meIconSize(IconSize_Large),
+ maLargeIcon(rLargeIcon),
+ maLargeHoverIcon(rLargeHoverIcon.IsEmpty() ? rLargeIcon : rLargeHoverIcon),
+ maMediumIcon(rMediumIcon),
+ maMediumHoverIcon(rMediumHoverIcon.IsEmpty() ? rMediumIcon : rMediumHoverIcon),
+ maSmallIcon(rSmallIcon),
+ maSmallHoverIcon(rSmallHoverIcon.IsEmpty() ? rSmallIcon : rSmallHoverIcon)
{
}
-
-
Button::~Button (void)
{
}
@@ -951,33 +961,7 @@ bool Button::IsEnabled (void) const
}
-
-
-//===== ImageButon ============================================================
-
-ImageButton::ImageButton (
- SlideSorter& rSlideSorter,
- const BitmapEx& rLargeIcon,
- const BitmapEx& rLargeHoverIcon,
- const BitmapEx& rMediumIcon,
- const BitmapEx& rMediumHoverIcon,
- const BitmapEx& rSmallIcon,
- const BitmapEx& rSmallHoverIcon,
- const ::rtl::OUString& rsHelpText)
- : Button(rSlideSorter, rsHelpText),
- maLargeIcon(rLargeIcon),
- maLargeHoverIcon(rLargeHoverIcon.IsEmpty() ? rLargeIcon : rLargeHoverIcon),
- maMediumIcon(rMediumIcon),
- maMediumHoverIcon(rMediumHoverIcon.IsEmpty() ? rMediumIcon : rMediumHoverIcon),
- maSmallIcon(rSmallIcon),
- maSmallHoverIcon(rSmallHoverIcon.IsEmpty() ? rSmallIcon : rSmallHoverIcon)
-{
-}
-
-
-
-
-void ImageButton::Place (const Rectangle aButtonBarBox)
+void Button::Place (const Rectangle aButtonBarBox)
{
const sal_Int32 nWidth (GetSize().Width());
maBoundingBox = Rectangle(
@@ -989,9 +973,7 @@ void ImageButton::Place (const Rectangle aButtonBarBox)
}
-
-
-void ImageButton::Paint (
+void Button::Paint (
OutputDevice& rDevice,
const Point aOffset,
const double nAlpha,
@@ -1052,17 +1034,13 @@ void ImageButton::Paint (
}
-
-
-Size ImageButton::GetSize (void) const
+Size Button::GetSize (void) const
{
return GetSize(meIconSize);
}
-
-
-Size ImageButton::GetSize (const Button::IconSize eIconSize) const
+Size Button::GetSize (const Button::IconSize eIconSize) const
{
switch (eIconSize)
{
@@ -1084,7 +1062,7 @@ Size ImageButton::GetSize (const Button::IconSize eIconSize) const
//===== UnhideButton ==========================================================
UnhideButton::UnhideButton (SlideSorter& rSlideSorter)
- : ImageButton(
+ : Button(
rSlideSorter,
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BLarge),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BLargeHover),
@@ -1116,7 +1094,7 @@ void UnhideButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor
//===== StartSlideShowButton ==================================================
StartShowButton::StartShowButton (SlideSorter& rSlideSorter)
- : ImageButton(
+ : Button(
rSlideSorter,
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Large),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1LargeHover),
@@ -1182,7 +1160,7 @@ void StartShowButton::ProcessClick (const model::SharedPageDescriptor& rpDescrip
//===== HideButton ============================================================
HideButton::HideButton (SlideSorter& rSlideSorter)
- : ImageButton(
+ : Button(
rSlideSorter,
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Large),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2LargeHover),
@@ -1214,7 +1192,7 @@ void HideButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
//===== DuplicateButton =======================================================
DuplicateButton::DuplicateButton (SlideSorter& rSlideSorter)
- : ImageButton(
+ : Button(
rSlideSorter,
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Large),
rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3LargeHover),
commit af77ec0d7ed0a40a1efe9a380b2bab74c02d9fec
Author: Jan Holesovsky <kendy at suse.cz>
Date: Sat Apr 14 20:47:33 2012 +0200
Slidesorter: Kill more.
diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
index df80822..7e00ef3 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
@@ -85,9 +85,6 @@ public:
enum ColorType {
Color_Background,
- Color_ButtonBackground,
- Color_ButtonText,
- Color_ButtonTextHover,
Color_PageNumberDefault,
Color_PageNumberHover,
Color_PageNumberHighContrast,
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
index 6390d90..efd93a5 100644
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -93,9 +93,6 @@ Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties)
maColor.resize(_ColorType_Size_);
maColor[Color_Background] = maBackgroundColor;
- maColor[Color_ButtonBackground] = Black;
- maColor[Color_ButtonText] = 0xc0c0c0;
- maColor[Color_ButtonTextHover] = White;
maColor[Color_PageNumberDefault] = 0x0808080;
maColor[Color_PageNumberHover] = 0x4c4c4c;
maColor[Color_PageNumberHighContrast] = White;
commit 389218f922471f184daa7429561e78ee5db214e5
Author: Jan Holesovsky <kendy at suse.cz>
Date: Sat Apr 14 20:39:08 2012 +0200
Slidesorter: Font_Button unused.
diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
index 11dd0fb..df80822 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
@@ -77,8 +77,7 @@ public:
enum FontType {
Font_PageNumber,
- Font_PageCount,
- Font_Button
+ Font_PageCount
};
static ::boost::shared_ptr<Font> GetFont (
const FontType eType,
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
index 5cb33b5..6390d90 100644
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -258,16 +258,6 @@ void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpPropert
pFont->SetSize(Size(aSize.Width()*5/3, aSize.Height()*5/3));
}
break;
-
- case Font_Button:
- pFont.reset(new Font(Application::GetSettings().GetStyleSettings().GetAppFont()));
- pFont->SetTransparent(sal_True);
- pFont->SetWeight(WEIGHT_BOLD);
- {
- const Size aSize (pFont->GetSize());
- pFont->SetSize(Size(aSize.Width()*4/3, aSize.Height()*4/3));
- }
- break;
}
if (pFont)
commit b80ca48354bfba707d7e3b0b0c05a33038014572
Author: Jan Holesovsky <kendy at suse.cz>
Date: Sat Apr 14 20:36:22 2012 +0200
Slidesorter: Reduce some overengineering.
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
index bfb5f91..04d5921 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 a14863f..11dd0fb 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 19529c0..3814c32 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 3543c36..e034d91 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 c04257a..4c6ff76 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 ab0c6f5..5cb33b5 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 4c7a618..217d929 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));
}
commit 7316331b863cb5c850272f3ad4d85aadc3ed6551
Author: Jan Holesovsky <kendy at suse.cz>
Date: Sat Apr 14 20:16:26 2012 +0200
Slidesorter: Copy'n'paste reduction.
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
index 919f812..19529c0 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
More information about the Libreoffice-commits
mailing list