diff options
author | Andre Fischer <af@openoffice.org> | 2010-03-23 12:50:14 +0100 |
---|---|---|
committer | Andre Fischer <af@openoffice.org> | 2010-03-23 12:50:14 +0100 |
commit | f38cf1fdb8e23c4031b198214a29510046c05ecc (patch) | |
tree | 56c19820508d38c8accef58ac668413eba8c2210 /sd | |
parent | 8d603c86c1898ecf653e83c6538fab0c54e88036 (diff) |
renaissance1: #i107215# Improved button handling. Added debug design dialog.
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx | 19 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx | 17 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/inc/view/SlsTheme.hxx | 40 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/shell/SlideSorter.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/shell/SlsDebugDialog.cxx | 637 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/shell/SlsDebugDialog.hxx | 61 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/shell/makefile.mk | 3 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/view/SlideSorterView.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/view/SlsIcons.hrc | 11 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/view/SlsIcons.src | 26 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/view/SlsLayouter.cxx | 19 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx | 27 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx | 71 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/view/SlsTheme.cxx | 264 |
15 files changed, 1035 insertions, 173 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index 9ddfbf481b7e..79a64cc37404 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -1325,10 +1325,23 @@ SelectionFunction::EventDescriptor::EventDescriptor ( { mpHitPage = mpHitDescriptor->GetPage(); - mnButtonIndex - = rSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetButtonIndexAt( + if (mpHitDescriptor->HasState(model::PageDescriptor::ST_Excluded)) + { + if (rSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetBoundingBox( mpHitDescriptor, - maMouseModelPosition); + view::PageObjectLayouter::WideButton, + view::PageObjectLayouter::ModelCoordinateSystem).IsInside(maMouseModelPosition)) + { + mnButtonIndex = view::PageObjectLayouter::ShowHideButtonIndex; + } + } + else + { + mnButtonIndex + = rSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetButtonIndexAt( + mpHitDescriptor, + maMouseModelPosition); + } } } diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx index 99ceee121b42..09243029e2a4 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx @@ -80,7 +80,9 @@ public: // Indicator whether or not there is a slide transition associated // with this slide. TransitionEffectIndicator, - ButtonArea, + // Wide button placed without border at the bottom of the preview. + WideButton, + // Individual button. Specify nIndex when calling GetBoundingBox(). Button }; /** Two coordinate systems are supported. They differ only in @@ -91,7 +93,16 @@ public: */ enum CoordinateSystem { WindowCoordinateSystem, - ModelCoordinateSystem}; + ModelCoordinateSystem + }; + + enum ButtonIndex { + MinButtonIndex = 0, + StartShowButtonIndex = MinButtonIndex, + ShowHideButtonIndex = 1, + DuplicateButtonIndex = 2, + MaxButtonIndex = DuplicateButtonIndex + }; /** Return the bounding box of the page object or one of its graphical parts. @@ -148,7 +159,7 @@ private: Rectangle maPageNumberFrameBoundingBox; Rectangle maPreviewBoundingBox; Rectangle maTransitionEffectBoundingBox; - Rectangle maButtonAreaBoundingBox; + Rectangle maWideButtonBoundingBox; const Image maTransitionEffectIcon; const ::boost::shared_ptr<Font> mpPageNumberFont; diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx index c67777418fc2..e02c68e7967a 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx @@ -60,7 +60,7 @@ public: OutputDevice& rDevice, const model::SharedPageDescriptor& rpDescriptor); - void NotifyResize (void); + void NotifyResize (const bool bForce = false); /** Called when the theme changes, either because it is replaced with another or because the system colors have changed. So, even when @@ -84,6 +84,7 @@ private: Bitmap maSelectionBackground; Bitmap maFocusedSelectionBackground; Bitmap maMouseOverBackground; + ::rtl::OUString msUnhideString; void PaintBackground ( OutputDevice& rDevice, @@ -100,6 +101,9 @@ private: void PaintButtons ( OutputDevice& rDevice, const model::SharedPageDescriptor& rpDescriptor) const; + void PaintWideButton ( + OutputDevice& rDevice, + const model::SharedPageDescriptor& rpDescriptor) const; void PrepareBackgrounds (OutputDevice& rDevice); void PaintBorder ( OutputDevice& rDevice, diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx index 5b7241aaadc2..ba0a8a56bb3d 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx @@ -67,18 +67,18 @@ public: enum FontType { PageNumberFont, - PageCountFont + PageCountFont, + ButtonFont }; static ::boost::shared_ptr<Font> GetFont ( const FontType eType, const OutputDevice& rDevice); - static ColorData GetColorForVisualState (const model::VisualState::State eState); - enum ColorType { Background, PageBackground, ButtonBackground, + ButtonText, MouseOverColor, PageNumberBorder, PageNumberColor, @@ -86,6 +86,7 @@ public: PreviewBorder }; ColorData GetColor (const ColorType eType); + void SetColor (const ColorType eType, const ColorData aColorData); enum GradientColorType { NormalPage, @@ -97,11 +98,22 @@ public: Border1, Border2, Fill1, - Fill2 + Fill2, + Base }; ColorData GetGradientColor ( const GradientColorType eType, const GradientColorClass eClass); + sal_Int32 GetGradientOffset ( + const GradientColorType eType, + const GradientColorClass eClass); + void SetGradient ( + const GradientColorType eType, + const ColorData aBaseColor, + const sal_Int32 nFillStartOffset, + const sal_Int32 nFillEndOffset, + const sal_Int32 nBorderStartOffset, + const sal_Int32 nBorderEndOffset); enum IconType { @@ -111,14 +123,29 @@ public: }; BitmapEx GetIcon (const IconType eType); + enum IntegerValueType + { + ButtonCornerRadius, + ButtonMaxAlpha + }; + sal_Int32 GetIntegerValue (const IntegerValueType eType) const; + void SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValue); + private: class GradientDescriptor { public: + ColorData maBaseColor; + ColorData maFillColor1; ColorData maFillColor2; ColorData maBorderColor1; ColorData maBorderColor2; + + sal_Int32 mnFillOffset1; + sal_Int32 mnFillOffset2; + sal_Int32 mnBorderOffset1; + sal_Int32 mnBorderOffset2; }; ColorData maBackgroundColor; ColorData maPageBackgroundColor; @@ -129,6 +156,11 @@ private: BitmapEx maRawShadow; BitmapEx maRawInsertShadow; BitmapEx maHideSlideOverlay; + ::std::vector<ColorData> maColor; + sal_Int32 mnButtonCornerRadius; + sal_Int32 mnButtonMaxAlpha; + + GradientDescriptor& GetGradient (const GradientColorType eType); }; diff --git a/sd/source/ui/slidesorter/shell/SlideSorter.cxx b/sd/source/ui/slidesorter/shell/SlideSorter.cxx index d3fb4857ae64..13f1a0ce816e 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorter.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorter.cxx @@ -34,6 +34,7 @@ #include "SlideSorterChildWindow.hrc" #include "SlideSorterViewShell.hxx" +#include "SlsDebugDialog.hxx" #include "controller/SlideSorterController.hxx" #include "controller/SlsScrollBarManager.hxx" #include "controller/SlsProperties.hxx" @@ -219,6 +220,8 @@ void SlideSorter::Init (void) mbIsValid = true; } + + SlideSorterDebugDialog::ShowDebugDialog(*this); } diff --git a/sd/source/ui/slidesorter/shell/SlsDebugDialog.cxx b/sd/source/ui/slidesorter/shell/SlsDebugDialog.cxx new file mode 100644 index 000000000000..09b1cf60d265 --- /dev/null +++ b/sd/source/ui/slidesorter/shell/SlsDebugDialog.cxx @@ -0,0 +1,637 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: SlideSorterService.hxx,v $ + * + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef DEBUG + +#include "SlsDebugDialog.hxx" +#include "view/SlideSorterView.hxx" +#include "view/SlsTheme.hxx" +#include "view/SlsPageObjectPainter.hxx" + +#include <vcl/window.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/slider.hxx> +#include <boost/function.hpp> +#include <boost/bind.hpp> + +namespace css = ::com::sun::star; +using namespace ::sd::slidesorter::view; + +namespace sd { namespace slidesorter { + +//===== TextButton ============================================================ + +class TextButton : public PushButton +{ +public: + typedef ::boost::function<void(TextButton*)> Action; + + TextButton ( + ::Window* pParent, + const char* pText, + const Action& rAction) + : PushButton(pParent), + maAction(rAction) + { + SetText(::rtl::OUString::createFromAscii(pText)); + Show(); + } + + virtual void Click (void) + { + if (maAction) + maAction(this); + } + +private: + Action maAction; +}; + + + + +//===== ColorControl ========================================================== + +class ColorControl +{ +public: + typedef ::boost::function<ColorData(void)> ColorGetter; + typedef ::boost::function<void(ColorData)> ColorSetter; + typedef ::boost::function<void(void)> Updater; + ColorControl ( + ::Window* pParent, + const char* pTitle, + const Rectangle& rBoundingBox, + const ColorGetter& rGetter, + const ColorSetter& rSetter, + const Updater& rUpdater) + : maGetter(rGetter), + maSetter(rSetter), + maUpdater(rUpdater), + mpContainer(new ::Window(pParent, WB_BORDER)), + mpTitle(new FixedText(mpContainer)), + mpRedSlider(new Slider(mpContainer)), + mpGreenSlider(new Slider(mpContainer)), + mpBlueSlider(new Slider(mpContainer)), + mpTextValue(new FixedText(mpContainer)), + mpColorValue(new ::Window(mpContainer)) + { + const double nWidth (rBoundingBox.GetWidth()); + const double nLeft (0); + const double nTop (0); + const ColorData aStartColor (rGetter ? rGetter() : 0); + + mpContainer->SetPosSizePixel(rBoundingBox.TopLeft(), rBoundingBox.GetSize()); + mpContainer->Show(); + + mpTitle->SetText(::rtl::OUString::createFromAscii(pTitle)); + mpTitle->SetPosSizePixel(nLeft, nTop, nWidth,20); + mpTitle->Show(); + + mpRedSlider->SetPosSizePixel(nLeft, nTop+30, nWidth, 10); + mpRedSlider->SetRange(Range(0,255)); + mpRedSlider->Show(); + + mpGreenSlider->SetPosSizePixel(nLeft, nTop+40, nWidth, 10); + mpGreenSlider->SetRange(Range(0,255)); + mpGreenSlider->Show(); + + mpBlueSlider->SetPosSizePixel(nLeft, nTop+50, nWidth, 10); + mpBlueSlider->SetRange(Range(0,255)); + mpBlueSlider->Show(); + + SetColor(aStartColor); + + mpRedSlider->SetSlideHdl(LINK(this, ColorControl, UpdateColor)); + mpGreenSlider->SetSlideHdl(LINK(this, ColorControl, UpdateColor)); + mpBlueSlider->SetSlideHdl(LINK(this, ColorControl, UpdateColor)); + + mpTextValue->SetText(::rtl::OUString::createFromAscii("x000000")); + mpTextValue->SetPosSizePixel(nLeft, nTop+70, 150, 20); + mpTextValue->Show(); + + mpColorValue->SetPosSizePixel(nLeft + 150, nTop+70, nWidth - 160, 20); + mpColorValue->SetBackground(Wallpaper(Color(aStartColor))); + mpColorValue->Show(); + + UpdateDisplay(); + } + + void SetColor (const ColorData aColorData) + { + const Color aColor (aColorData); + mpRedSlider->SetThumbPos(aColor.GetRed()); + mpGreenSlider->SetThumbPos(aColor.GetGreen()); + mpBlueSlider->SetThumbPos(aColor.GetBlue()); + UpdateDisplay(); + } + + + ColorData GetColor (void) const + { + return Color( + mpRedSlider->GetThumbPos(), + mpGreenSlider->GetThumbPos(), + mpBlueSlider->GetThumbPos()).GetColor(); + } + + DECL_LINK(UpdateColor, void*); + +private: + ColorGetter maGetter; + ColorSetter maSetter; + Updater maUpdater; + ::Window* mpContainer; + FixedText* mpTitle; + Slider* mpRedSlider; + Slider* mpGreenSlider; + Slider* mpBlueSlider; + FixedText* mpTextValue; + ::Window* mpColorValue; + + Color UpdateDisplay (void) + { + const int nRed (mpRedSlider->GetThumbPos()); + const int nGreen (mpGreenSlider->GetThumbPos()); + const int nBlue (mpBlueSlider->GetThumbPos()); + + Color aColor (nRed, nGreen, nBlue); + mpColorValue->SetBackground(Wallpaper(aColor)); + mpColorValue->Invalidate(); + + const int nMaxLength(10); + char aBuffer[nMaxLength]; + snprintf(aBuffer, nMaxLength, "x%02x%02x%02x", nRed,nGreen,nBlue); + mpTextValue->SetText(::rtl::OUString::createFromAscii(aBuffer)); + + return aColor; + } + +}; + +IMPL_LINK(ColorControl, UpdateColor, void*, EMPTYARG) +{ + const Color aColor (UpdateDisplay()); + if (maSetter) + { + maSetter(aColor.GetColor()); + if (maUpdater) + maUpdater(); + } + + return 0; +} + + + + +//===== GradientControl ======================================================= + +class GradientControl +{ +public: + typedef ::boost::function<void(void)> Updater; + + GradientControl ( + ::Window* pParent, + const char* pTitle, + const Theme::GradientColorType eType, + const Rectangle& rBoundingBox, + SlideSorter& rSlideSorter) + : mpTheme(rSlideSorter.GetTheme()), + mrSlideSorter(rSlideSorter), + meType(eType), + mpContainer(new ::Window(pParent, WB_BORDER)), + mpColorControl(new ColorControl(mpContainer, "Base Color", + Rectangle(0,0, rBoundingBox.GetWidth()-4, 90), + ::boost::bind(&Theme::GetGradientColor, mpTheme, + ::boost::bind(&GradientControl::GetType, this), Theme::Base), + ::boost::bind(&GradientControl::SetBaseColor, this, _1), + ::boost::bind(&GradientControl::Update, this, (void*)0))), + mpFillOffset1Slider(new Slider(mpContainer)), + mpFillOffset1Text(new FixedText(mpContainer)), + mpFillOffset1Color(new ::Window(mpContainer)), + mpFillOffset2Slider(new Slider(mpContainer)), + mpFillOffset2Text(new FixedText(mpContainer)), + mpFillOffset2Color(new ::Window(mpContainer)), + mpBorderOffset1Slider(new Slider(mpContainer)), + mpBorderOffset1Text(new FixedText(mpContainer)), + mpBorderOffset1Color(new ::Window(mpContainer)), + mpBorderOffset2Slider(new Slider(mpContainer)), + mpBorderOffset2Text(new FixedText(mpContainer)), + mpBorderOffset2Color(new ::Window(mpContainer)) + { + const double nWidth (rBoundingBox.GetWidth()); + ::boost::shared_ptr<Theme> pTheme (mrSlideSorter.GetTheme()); + const ColorData aStartColor (pTheme->GetGradientColor(eType, Theme::Base)); + + mpContainer->SetPosSizePixel(rBoundingBox.TopLeft(), rBoundingBox.GetSize()); + mpContainer->Show(); + + Initialize(mpFillOffset1Slider, mpFillOffset1Text, mpFillOffset1Color, + mpTheme->GetGradientOffset(eType, Theme::Fill1), 100, nWidth); + Initialize(mpFillOffset2Slider, mpFillOffset2Text, mpFillOffset2Color, + mpTheme->GetGradientOffset(eType, Theme::Fill2), 120, nWidth); + Initialize(mpBorderOffset1Slider, mpBorderOffset1Text, mpBorderOffset1Color, + mpTheme->GetGradientOffset(eType, Theme::Border1), 140, nWidth); + Initialize(mpBorderOffset2Slider, mpBorderOffset2Text, mpBorderOffset2Color, + mpTheme->GetGradientOffset(eType, Theme::Border2), 160, nWidth); + + Update(0); + } + + void Initialize ( + Slider* pSlider, + FixedText* pText, + ::Window* pWindow, + const sal_Int32 nOffset, + const sal_Int32 nY, + const sal_Int32 nWidth) + { + pSlider->SetPosSizePixel(10,nY,nWidth/2,15); + pSlider->Show(); + pSlider->SetRange(Range(-100,+100)); + pSlider->SetThumbPos(nOffset); + pSlider->SetSlideHdl(LINK(this, GradientControl, Update)); + + pText->SetPosSizePixel(nWidth/2+10, nY, nWidth/2-60, 15); + pText->Show(); + + pWindow->SetPosSizePixel(nWidth-40, nY, 40, 15); + pWindow->Show(); + } + + void SetBaseColor (const ColorData aColor) + { + mpColorControl->SetColor(aColor); + } + + ::Window* GetContainer (void) + { + return mpContainer; + } + + Theme::GradientColorType GetType (void) const + { + return meType; + } + + void SetType (const Theme::GradientColorType eType) + { + meType = eType; + mpColorControl->SetColor(mpTheme->GetGradientColor(meType, Theme::Base)); + mpFillOffset1Slider->SetThumbPos(mpTheme->GetGradientOffset(meType, Theme::Fill1)); + mpFillOffset2Slider->SetThumbPos(mpTheme->GetGradientOffset(meType, Theme::Fill2)); + mpBorderOffset1Slider->SetThumbPos(mpTheme->GetGradientOffset(meType, Theme::Border1)); + mpBorderOffset2Slider->SetThumbPos(mpTheme->GetGradientOffset(meType, Theme::Border2)); + UpdateDisplay(); + } + +private: + ::boost::shared_ptr<view::Theme> mpTheme; + SlideSorter& mrSlideSorter; + Theme::GradientColorType meType; + ::Window* mpContainer; + ColorControl* mpColorControl; + Slider* mpFillOffset1Slider; + FixedText* mpFillOffset1Text; + ::Window* mpFillOffset1Color; + sal_Int32 mnFillOffset1; + Slider* mpFillOffset2Slider; + FixedText* mpFillOffset2Text; + ::Window* mpFillOffset2Color; + sal_Int32 mnFillOffset2; + Slider* mpBorderOffset1Slider; + FixedText* mpBorderOffset1Text; + ::Window* mpBorderOffset1Color; + sal_Int32 mnBorderOffset1; + Slider* mpBorderOffset2Slider; + FixedText* mpBorderOffset2Text; + ::Window* mpBorderOffset2Color; + sal_Int32 mnBorderOffset2; + + DECL_LINK(Update, void*); + + void UpdateDisplay (void) + { + const sal_Int32 nFillOffset1 (mpFillOffset1Slider->GetThumbPos()); + const sal_Int32 nFillOffset2 (mpFillOffset2Slider->GetThumbPos()); + const sal_Int32 nBorderOffset1 (mpBorderOffset1Slider->GetThumbPos()); + const sal_Int32 nBorderOffset2 (mpBorderOffset2Slider->GetThumbPos()); + + mpFillOffset1Text->SetText(::rtl::OUString::valueOf(nFillOffset1)); + mpFillOffset1Color->SetBackground(Wallpaper( + mpTheme->GetGradientColor(meType, Theme::Fill1))); + mpFillOffset1Color->Invalidate(); + + mpFillOffset2Text->SetText(::rtl::OUString::valueOf(nFillOffset2)); + mpFillOffset2Color->SetBackground(Wallpaper( + mpTheme->GetGradientColor(meType, Theme::Fill2))); + mpFillOffset2Color->Invalidate(); + + mpBorderOffset1Text->SetText(::rtl::OUString::valueOf(nBorderOffset1)); + mpBorderOffset1Color->SetBackground(Wallpaper( + mpTheme->GetGradientColor(meType, Theme::Border1))); + mpBorderOffset1Color->Invalidate(); + + mpBorderOffset2Text->SetText(::rtl::OUString::valueOf(nBorderOffset2)); + mpBorderOffset2Color->SetBackground(Wallpaper( + mpTheme->GetGradientColor(meType, Theme::Border2))); + mpBorderOffset2Color->Invalidate(); + + mrSlideSorter.GetView().GetPageObjectPainter()->NotifyResize(true); + mrSlideSorter.GetView().RequestRepaint(); + } +}; + + +IMPL_LINK(GradientControl, Update, void*, EMPTYARG) +{ + UpdateDisplay(); + + + mpTheme->SetGradient(meType, + mpColorControl->GetColor(), + mpFillOffset1Slider->GetThumbPos(), + mpFillOffset2Slider->GetThumbPos(), + mpBorderOffset1Slider->GetThumbPos(), + mpBorderOffset2Slider->GetThumbPos()); + + return 0; +} + + + + +//===== SliderControl ========================================================= + +class SliderControl +{ +public: + typedef ::boost::function<sal_Int32(void)> ValueGetter; + typedef ::boost::function<void(sal_Int32)> ValueSetter; + typedef ::boost::function<void(void)> Updater; + SliderControl ( + ::Window* pParent, + const char* pTitle, + const Rectangle& rBoundingBox, + const Range aRange, + const ValueGetter& rGetter, + const ValueSetter& rSetter, + const Updater& rUpdater) + : maGetter(rGetter), + maSetter(rSetter), + maUpdater(rUpdater), + mpContainer(new ::Window(pParent, WB_BORDER)), + mpTitle(new FixedText(mpContainer)), + mpSlider(new Slider(mpContainer)), + mpTextValue(new FixedText(mpContainer)) + { + const double nWidth (rBoundingBox.GetWidth()); + const double nLeft (0); + const double nTop (0); + const sal_Int32 nStartValue (maGetter ? maGetter() : 0); + + mpContainer->SetPosSizePixel(rBoundingBox.TopLeft(), rBoundingBox.GetSize()); + mpContainer->Show(); + + mpTitle->SetText(::rtl::OUString::createFromAscii(pTitle)); + mpTitle->SetPosSizePixel(nLeft, nTop, nWidth,20); + mpTitle->Show(); + + mpSlider->SetPosSizePixel(nLeft, nTop+30, nWidth, 10); + mpSlider->SetRange(aRange); + mpSlider->SetSlideHdl(LINK(this, SliderControl, UpdateValue)); + mpSlider->SetThumbPos(nStartValue); + mpSlider->Show(); + + mpTextValue->SetText(::rtl::OUString::valueOf(nStartValue)); + mpTextValue->SetPosSizePixel(nLeft, nTop+50, 150, 20); + mpTextValue->Show(); + + UpdateValue(0); + } + +private: + ValueGetter maGetter; + ValueSetter maSetter; + Updater maUpdater; + ::Window* mpContainer; + FixedText* mpTitle; + Slider* mpSlider; + FixedText* mpTextValue; + + DECL_LINK(UpdateValue, void*); +}; + +IMPL_LINK(SliderControl, UpdateValue, void*, EMPTYARG) +{ + const sal_Int32 nValue (mpSlider->GetThumbPos()); + + const sal_Int32 nMaxLength (30); + char aBuffer[nMaxLength]; + snprintf(aBuffer, nMaxLength, "%d %f", nValue, nValue/255.0); + mpTextValue->SetText(::rtl::OUString::createFromAscii(aBuffer)); + + if (maSetter) + { + maSetter(nValue); + if (maUpdater) + maUpdater(); + } + + return 0; +} + + + + +//===== ChoiceControl ========================================================= + +class ChoiceControl +{ +public: + typedef ::boost::function<Theme::GradientColorType(void)> ValueGetter; + typedef ::boost::function<void(Theme::GradientColorType)> ValueSetter; + ChoiceControl ( + ::Window* pParent, + const char* pTitle, + const Rectangle& rBoundingBox, + const char** aValues, + const int nValueCount, + GradientControl* pSubControl, + const ValueGetter& rGetter, + const ValueSetter& rSetter) + : maValues(), + maGetter(rGetter), + maSetter(rSetter), + mpContainer(new ::Window(pParent, WB_BORDER)), + mpComboBox(new ComboBox(mpContainer, WB_DROPDOWN)), + mpSubControl(pSubControl) + { + const double nWidth (rBoundingBox.GetWidth()); + const double nLeft (0); + const double nTop (0); + const sal_Int32 nStartValue (maGetter ? maGetter() : 0); + + mpContainer->SetPosSizePixel(rBoundingBox.TopLeft(), rBoundingBox.GetSize()); + mpContainer->Show(); + + mpComboBox->SetPosSizePixel(nLeft, nTop, nWidth-5, 20); + mpComboBox->ToggleDropDown(); + mpComboBox->SetSelectHdl(LINK(this, ChoiceControl, UpdateValue)); + mpComboBox->SetDoubleClickHdl(LINK(this, ChoiceControl, UpdateValue)); + for (int nIndex=0; nIndex<nValueCount; ++nIndex) + { + const USHORT nId ( + mpComboBox->InsertEntry(::rtl::OUString::createFromAscii(aValues[nIndex]))); + maValues[nId] = nIndex; + } + mpComboBox->Show(); + + mpSubControl->GetContainer()->SetParent(mpContainer); + mpSubControl->GetContainer()->SetPosSizePixel( + nLeft, nTop+20, nWidth, rBoundingBox.GetHeight()-20); + + UpdateValue(0); + } + +private: + ::std::map<USHORT, int> maValues; + ValueGetter maGetter; + ValueSetter maSetter; + ::Window* mpContainer; + ComboBox* mpComboBox; + GradientControl* mpSubControl; + + DECL_LINK(UpdateValue, void*); +}; + +IMPL_LINK(ChoiceControl, UpdateValue, void*, EMPTYARG) +{ + USHORT nId (mpComboBox->GetSelectEntryPos()); + const sal_Int32 nIndex (maValues[nId]); + const Theme::GradientColorType nValue ((Theme::GradientColorType)nIndex); + + if (maSetter) + maSetter(nValue); + + return 0; +} + + + + +//===== SlideSorterDebugDialog ================================================ + +void SlideSorterDebugDialog::ShowDebugDialog (SlideSorter& rSlideSorter) +{ + static const char* pText = getenv("SD_SHOW_DEBUG_DIALOG"); + if (pText!=NULL && pText[0]!='0') + { + new SlideSorterDebugDialog(rSlideSorter); + } +} + + + + +SlideSorterDebugDialog::SlideSorterDebugDialog (SlideSorter& rSlideSorter) + : mpTopLevelWindow(new WorkWindow(NULL, WB_STDWORK)) +{ + mpTopLevelWindow->SetSizePixel(Size(300,510)); + + { + Button* pButton = new TextButton( + mpTopLevelWindow, + "Close", + ::boost::bind(&WorkWindow::Close, mpTopLevelWindow)); + pButton->SetPosSizePixel(195,480,100,25); + + } + + ::boost::shared_ptr<view::Theme> pTheme(rSlideSorter.GetTheme()); + { + ColorControl* pControl = new ColorControl( + mpTopLevelWindow, + "Unhide Button Background", + Rectangle(10,10,290,110), + ::boost::bind(&view::Theme::GetColor, pTheme, view::Theme::ButtonBackground), + ::boost::bind(&view::Theme::SetColor, pTheme, view::Theme::ButtonBackground, _1), + ::boost::bind(&view::SlideSorterView::RequestRepaint, + ::boost::ref(rSlideSorter.GetView()))); + } + + { + SliderControl* pControl = new SliderControl( + mpTopLevelWindow, + "Max Button Alpha", + Rectangle(10,120,290,200), + Range(0,255), + ::boost::bind(&view::Theme::GetIntegerValue, pTheme, view::Theme::ButtonMaxAlpha), + ::boost::bind(&view::Theme::SetIntegerValue, pTheme, view::Theme::ButtonMaxAlpha, _1), + ::boost::bind(&view::SlideSorterView::RequestRepaint, + ::boost::ref(rSlideSorter.GetView()))); + } + + { + GradientControl* pControl = new GradientControl( + mpTopLevelWindow, + "Selection Page Gradient", + Theme::SelectedPage, + Rectangle(10,210,285,450), + rSlideSorter); + const char* aValues[] = { + "Normal", + "Selected", + "SelectedAndFocused", + "MouseOver" + }; + ChoiceControl* pChoiceControl = new ChoiceControl( + mpTopLevelWindow, + "Gradient", + Rectangle(10,210,290,470), + aValues, + 4, + pControl, + ::boost::bind(&GradientControl::GetType, pControl), + ::boost::bind(&GradientControl::SetType, pControl, _1)); + } + + mpTopLevelWindow->Show(true); +} + + +} } // end of namespace ::sd::slidesorter + +#endif diff --git a/sd/source/ui/slidesorter/shell/SlsDebugDialog.hxx b/sd/source/ui/slidesorter/shell/SlsDebugDialog.hxx new file mode 100644 index 000000000000..c2f2f8a6b6b2 --- /dev/null +++ b/sd/source/ui/slidesorter/shell/SlsDebugDialog.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: SlideSorterService.hxx,v $ + * + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SD_DEBUG_DIALOG_HXX +#define SD_DEBUG_DIALOG_HXX + +#ifdef DEBUG + +#include <boost/noncopyable.hpp> + +class WorkWindow; + +namespace sd { namespace slidesorter { + +class SlideSorter; + +class SlideSorterDebugDialog + : public ::boost::noncopyable +{ +public: + static void ShowDebugDialog (SlideSorter& rSlideSorter); + +private: + WorkWindow* mpTopLevelWindow; + + SlideSorterDebugDialog (SlideSorter& rSlideSorter); +}; + + +} } // end of namespace ::sd::slidesorter + +#endif +#endif diff --git a/sd/source/ui/slidesorter/shell/makefile.mk b/sd/source/ui/slidesorter/shell/makefile.mk index 95e159985b01..a36df664664a 100644 --- a/sd/source/ui/slidesorter/shell/makefile.mk +++ b/sd/source/ui/slidesorter/shell/makefile.mk @@ -49,7 +49,8 @@ PRJINC=..$/.. SLOFILES = \ $(SLO)$/SlideSorter.obj \ $(SLO)$/SlideSorterService.obj \ - $(SLO)$/SlideSorterViewShell.obj + $(SLO)$/SlideSorterViewShell.obj \ + $(SLO)$/SlsDebugDialog.obj EXCEPTIONSFILES= diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index e6d17c8a6e02..407e9a81fc06 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -970,7 +970,9 @@ bool SlideSorterView::SetState ( // Fade in or out the buttons. if (eState == PageDescriptor::ST_MouseOver) { - const double nEndAlpha (bStateValue ? 0.2 : 1.0); + const double nEndAlpha (bStateValue + ? mrSlideSorter.GetTheme()->GetIntegerValue(Theme::ButtonMaxAlpha)/255.0 + : 1.0); if (bAnimate) { const double nStartAlpha (pDescriptor->GetVisualState().GetButtonAlpha()); diff --git a/sd/source/ui/slidesorter/view/SlsIcons.hrc b/sd/source/ui/slidesorter/view/SlsIcons.hrc index 240321d77475..22b4b398955c 100644 --- a/sd/source/ui/slidesorter/view/SlsIcons.hrc +++ b/sd/source/ui/slidesorter/view/SlsIcons.hrc @@ -35,15 +35,14 @@ #define IMG_ICONS RID_SLIDESORTER_ICONS -#define IMAGE_INSERTION_INDICATOR_NORMAL 1 -#define IMAGE_INSERTION_INDICATOR_MASK 2 -#define IMAGE_INSERTION_INDICATOR_SELECT 3 -#define IMAGE_PRESENTATION 4 -#define IMAGE_SHOW_SLIDE 5 -#define IMAGE_NEW_SLIDE 6 +#define IMAGE_PRESENTATION 1 +#define IMAGE_SHOW_SLIDE 2 +#define IMAGE_NEW_SLIDE 3 #define IMAGE_SHADOW 10 #define IMAGE_INSERT_SHADOW 11 #define IMAGE_HIDE_SLIDE_OVERLAY 12 +#define STRING_UNHIDE 13 + #endif diff --git a/sd/source/ui/slidesorter/view/SlsIcons.src b/sd/source/ui/slidesorter/view/SlsIcons.src index d8a5ffadc3ef..4bee98eb0559 100644 --- a/sd/source/ui/slidesorter/view/SlsIcons.src +++ b/sd/source/ui/slidesorter/view/SlsIcons.src @@ -32,34 +32,19 @@ Resource IMG_ICONS { - Image IMAGE_INSERTION_INDICATOR_NORMAL - { - ImageBitmap = Bitmap { File = "moving_50.png" ; }; - }; - - Image IMAGE_INSERTION_INDICATOR_MASK - { - ImageBitmap = Bitmap { File = "moving_50_mask.png" ; }; - }; - - Image IMAGE_INSERTION_INDICATOR_SELECT - { - ImageBitmap = Bitmap { File = "moving_50_select.png" ; }; - }; - Image IMAGE_PRESENTATION { - ImageBitmap = Bitmap { File = "commandimagelist/lc_presentation.png" ; }; + ImageBitmap = Bitmap { File = "slide_sorter_command1.png" ; }; }; Image IMAGE_SHOW_SLIDE { - ImageBitmap = Bitmap { File = "commandimagelist/lc_showslide.png" ; }; + ImageBitmap = Bitmap { File = "slide_sorter_command2.png" ; }; }; Image IMAGE_NEW_SLIDE { - ImageBitmap = Bitmap { File = "commandimagelist/lc_insertpage.png" ; }; + ImageBitmap = Bitmap { File = "slide_sorter_command3.png" ; }; }; Image IMAGE_SHADOW @@ -76,4 +61,9 @@ Resource IMG_ICONS { ImageBitmap = Bitmap { File = "slide_sorter_hide_slide_overlay.png" ; }; }; + + String STRING_UNHIDE + { + Text [ en-US ] = "unhide" ; + }; }; diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx index cc43787972a8..612db3a06791 100644 --- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx +++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx @@ -195,12 +195,6 @@ public: Range GetValidHorizontalSizeRange (void) const; Range GetValidVerticalSizeRange (void) const; - Size CalculateTargetSize ( - const Size& rWindowSize, - const Size& rPreviewModelSize, - const bool bCalculateWidth, - const bool bCalculateHeight) const; - Rectangle GetPageObjectBox ( const sal_Int32 nIndex, const bool bIncludeBorderAndGap = false) const; @@ -226,6 +220,11 @@ protected: virtual Size CalculateTargetSize ( const Size& rWindowSize, const Size& rPreviewModelSize) const = 0; + Size GetTargetSize ( + const Size& rWindowSize, + const Size& rPreviewModelSize, + const bool bCalculateWidth, + const bool bCalculateHeight) const; void CalculateVerticalLogicalInsertPosition ( const Point& rModelPosition, InsertPosition& rPosition) const; @@ -1010,7 +1009,7 @@ Range Layouter::Implementation::GetValidVerticalSizeRange (void) const -Size Layouter::Implementation::CalculateTargetSize ( +Size Layouter::Implementation::GetTargetSize ( const Size& rWindowSize, const Size& rPreviewModelSize, const bool bCalculateWidth, @@ -1226,7 +1225,7 @@ Size HorizontalImplementation::CalculateTargetSize ( const Size& rWindowSize, const Size& rPreviewModelSize) const { - return Implementation::CalculateTargetSize(rWindowSize, rPreviewModelSize, false, true); + return Implementation::GetTargetSize(rWindowSize, rPreviewModelSize, false, true); } @@ -1304,7 +1303,7 @@ Size VerticalImplementation::CalculateTargetSize ( const Size& rWindowSize, const Size& rPreviewModelSize) const { - return Implementation::CalculateTargetSize(rWindowSize, rPreviewModelSize, true, false); + return Implementation::GetTargetSize(rWindowSize, rPreviewModelSize, true, false); } @@ -1378,7 +1377,7 @@ Size GridImplementation::CalculateTargetSize ( const Size& rWindowSize, const Size& rPreviewModelSize) const { - return Implementation::CalculateTargetSize(rWindowSize, rPreviewModelSize, true, true); + return Implementation::GetTargetSize(rWindowSize, rPreviewModelSize, true, true); } diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx index 61722bd25159..2baabd218fe4 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx @@ -64,7 +64,7 @@ PageObjectLayouter::PageObjectLayouter ( maPageNumberAreaBoundingBox(), maPreviewBoundingBox(), maTransitionEffectBoundingBox(), - maButtonAreaBoundingBox(), + maWideButtonBoundingBox(), maTransitionEffectIcon(IconCache::Instance().GetIcon(BMP_FADE_EFFECT_INDICATOR)), mpPageNumberFont(Theme::GetFont(Theme::PageNumberFont, *rpWindow)) { @@ -100,11 +100,14 @@ PageObjectLayouter::PageObjectLayouter ( maPreviewBoundingBox.Bottom() - aIconSize.Height()), aIconSize); - maButtonAreaBoundingBox = Rectangle( - 0, - maPageObjectBoundingBox.Bottom() - gaButtonSize.Height() - gnButtonGap, - maPageObjectBoundingBox.Right() - gnButtonGap, - maPageObjectBoundingBox.Bottom() - gnButtonGap); + // The wide "unhide" button is placed at the lower edge of the preview. + // Add 1 pixel at the sides to compensate for the missing border around + // the button. + maWideButtonBoundingBox = Rectangle( + maPreviewBoundingBox.Left() - 1, + maPreviewBoundingBox.Bottom() - gaButtonSize.Height() - 1, + maPreviewBoundingBox.Right() + 1, + maPreviewBoundingBox.Bottom() + 1); } @@ -225,16 +228,16 @@ Rectangle PageObjectLayouter::GetBoundingBox ( aBoundingBox = maTransitionEffectBoundingBox; break; - case ButtonArea: - aBoundingBox = maButtonAreaBoundingBox; + case WideButton: + aBoundingBox = maWideButtonBoundingBox; break; case Button: aBoundingBox = Rectangle( - maPageObjectBoundingBox.BottomRight() + maPreviewBoundingBox.BottomRight() - Point( - (nIndex+1)*(gaButtonSize.Width() + gnButtonGap), - gaButtonSize.Height() + gnButtonGap), + (nIndex+1)*gaButtonSize.Width() + nIndex*gnButtonGap, + gaButtonSize.Height()), gaButtonSize); break; } @@ -315,7 +318,7 @@ sal_Int32 PageObjectLayouter::GetButtonIndexAt ( const model::SharedPageDescriptor& rpPageDescriptor, const Point& rWindowLocation) { - if ( ! GetBoundingBox(rpPageDescriptor, ButtonArea, ModelCoordinateSystem) + if ( ! GetBoundingBox(rpPageDescriptor, Preview, ModelCoordinateSystem) .IsInside(rWindowLocation)) { return -1; diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx index ec0b274397b7..4bbe202d654c 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx @@ -153,13 +153,15 @@ PageObjectPainter::PageObjectPainter ( maNormalBackground(), maSelectionBackground(), maFocusedSelectionBackground(), - maMouseOverBackground() + maMouseOverBackground(), + msUnhideString() { LocalResource aResource (IMG_ICONS); maStartPresentationIcon = Image(SdResId(IMAGE_PRESENTATION)).GetBitmapEx(); maShowSlideIcon = Image(SdResId(IMAGE_SHOW_SLIDE)).GetBitmapEx(); maNewSlideIcon = Image(SdResId(IMAGE_NEW_SLIDE)).GetBitmapEx(); + msUnhideString = String(SdResId(STRING_UNHIDE)); mpShadowPainter.reset(new FramePainter(mpTheme->GetIcon(Theme::RawShadow))); } @@ -198,7 +200,10 @@ void PageObjectPainter::PaintPageObject ( PaintPreview(rDevice, rpDescriptor); PaintPageNumber(rDevice, rpDescriptor); PaintTransitionEffect(rDevice, rpDescriptor); - PaintButtons(rDevice, rpDescriptor); + if (rpDescriptor->HasState(model::PageDescriptor::ST_Excluded)) + PaintWideButton(rDevice, rpDescriptor); + else + PaintButtons(rDevice, rpDescriptor); rDevice.SetAntialiasing(nSavedAntialiasingMode); } @@ -206,9 +211,10 @@ void PageObjectPainter::PaintPageObject ( -void PageObjectPainter::NotifyResize (void) +void PageObjectPainter::NotifyResize (const bool bForce) { if ( ! mpPageObjectLayouter + || bForce || mpPageObjectLayouter->GetPageObjectSize() != maNewSlideIcon.GetSizePixel()) { maNormalBackground.SetEmpty(); @@ -334,6 +340,7 @@ void PageObjectPainter::PaintPageNumber ( rDevice.SetTextColor(Color(mpTheme->GetColor(Theme::PageNumberColor))); rDevice.DrawText(aBox, sPageNumber, TEXT_DRAW_RIGHT | TEXT_DRAW_VCENTER); +#if 0 if (rpDescriptor->GetVisualState().GetCurrentVisualState() == model::VisualState::VS_Excluded) { @@ -348,6 +355,7 @@ void PageObjectPainter::PaintPageNumber ( rDevice.DrawLine(aFrameBox.TopLeft(), aBox.BottomRight()); } +#endif } @@ -381,17 +389,12 @@ void PageObjectPainter::PaintButtons ( if (rpDescriptor->GetVisualState().GetButtonAlpha() >= 1) return; - const Rectangle aPreviewBox (mpPageObjectLayouter->GetBoundingBox( - rpDescriptor, - PageObjectLayouter::Preview, - PageObjectLayouter::ModelCoordinateSystem)); - const USHORT nSavedAntialiasingMode (rDevice.GetAntialiasing()); rDevice.SetAntialiasing(nSavedAntialiasingMode | ANTIALIASING_ENABLE_B2DDRAW); rDevice.SetLineColor(); - const double nCornerRadius(3); + const double nCornerRadius(mpTheme->GetIntegerValue(Theme::ButtonCornerRadius)); for (int nButtonIndex=0; nButtonIndex<3; ++nButtonIndex) { Color aButtonFillColor (mpTheme->GetColor(Theme::ButtonBackground)); @@ -459,6 +462,56 @@ void PageObjectPainter::PaintButtons ( +void PageObjectPainter::PaintWideButton ( + OutputDevice& rDevice, + const model::SharedPageDescriptor& rpDescriptor) const +{ + if (rpDescriptor->GetVisualState().GetButtonAlpha() >= 1) + return; + + const USHORT nSavedAntialiasingMode (rDevice.GetAntialiasing()); + rDevice.SetAntialiasing(nSavedAntialiasingMode | ANTIALIASING_ENABLE_B2DDRAW); + + // Determine background color. + Color aButtonFillColor (mpTheme->GetColor(Theme::ButtonBackground)); + switch (rpDescriptor->GetVisualState().GetButtonState(PageObjectLayouter::ShowHideButtonIndex)) + { + case model::VisualState::BS_Normal: + break; + + case model::VisualState::BS_MouseOver: + aButtonFillColor.IncreaseLuminance(50); + break; + + case model::VisualState::BS_Pressed: + aButtonFillColor.DecreaseLuminance(50); + break; + } + rDevice.SetFillColor(aButtonFillColor); + rDevice.SetLineColor(); + + const Rectangle aBox ( + mpPageObjectLayouter->GetBoundingBox( + rpDescriptor, + PageObjectLayouter::WideButton, + PageObjectLayouter::ModelCoordinateSystem)); + const double nCornerRadius(mpTheme->GetIntegerValue(Theme::ButtonCornerRadius)); + rDevice.DrawTransparent( + ::basegfx::B2DPolyPolygon( + ::basegfx::tools::createPolygonFromRect( + ::basegfx::B2DRectangle(aBox.Left(), aBox.Top(), aBox.Right(), aBox.Bottom()), + nCornerRadius/aBox.GetWidth(), + nCornerRadius/aBox.GetHeight())), + rpDescriptor->GetVisualState().GetButtonAlpha()); + + // Paint text over the button background. + rDevice.SetTextColor(mpTheme->GetColor(Theme::ButtonText)); + rDevice.DrawText(aBox, msUnhideString, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER); +} + + + + void PageObjectPainter::PrepareBackgrounds (OutputDevice& rDevice) { if (maNormalBackground.IsEmpty()) diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx index 14b79afea1ff..826aee152533 100644 --- a/sd/source/ui/slidesorter/view/SlsTheme.cxx +++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx @@ -69,8 +69,6 @@ const static ColorData BackgroundColorData = 0xffffff; const static ColorData gnMouseOverColor = 0x59000000 | StellaBlue; -const static double gnCornerRadius = 4.0; - ColorData ChangeLuminance (const ColorData aColorData, const int nValue) { @@ -93,7 +91,10 @@ Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties) maSelectedAndFocusedGradient(), maMouseOverGradient(), maRawShadow(), - maRawInsertShadow() + maRawInsertShadow(), + maColor(PreviewBorder+1), + mnButtonCornerRadius(3), + mnButtonMaxAlpha(255 * 20/100) { LocalResource aResource (IMG_ICONS); @@ -101,6 +102,17 @@ Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties) maRawInsertShadow = Image(SdResId(IMAGE_INSERT_SHADOW)).GetBitmapEx(); maHideSlideOverlay = Image(SdResId(IMAGE_HIDE_SLIDE_OVERLAY)).GetBitmapEx(); + maColor.resize(PreviewBorder+1); + maColor[Background] = maBackgroundColor; + maColor[PageBackground] = AirForceBlue; + maColor[ButtonBackground] = AirForceBlue; + maColor[ButtonText] = AntiqueWhite; + maColor[MouseOverColor] = gnMouseOverColor; + maColor[PageNumberBorder] = Azure; + maColor[PageNumberColor] = 0x0848a8f; + maColor[Selection] = StellaBlue; + maColor[PreviewBorder] = 0x949599; + Update(rpProperties); } @@ -112,23 +124,14 @@ void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpPropert maBackgroundColor = rpProperties->GetBackgroundColor().GetColor(); maPageBackgroundColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + maColor[Background] = maBackgroundColor; + #ifdef USE_SYSTEM_SELECTION_COLOR const ColorData aSelectionColor (rpProperties->GetSelectionColor().GetColor()); - maSelectedGradient.maFillColor1 = ChangeLuminance(aSelectionColor, +50); - maSelectedGradient.maFillColor2 = ChangeLuminance(aSelectionColor, -10); - maSelectedGradient.maBorderColor1 = ChangeLuminance(aSelectionColor, -10); - maSelectedGradient.maBorderColor2 = ChangeLuminance(aSelectionColor, -30); - - maSelectedAndFocusedGradient.maFillColor1 = ChangeLuminance(aSelectionColor, +30); - maSelectedAndFocusedGradient.maFillColor2 = ChangeLuminance(aSelectionColor, -30); - maSelectedAndFocusedGradient.maBorderColor1 = ChangeLuminance(aSelectionColor, -30); - maSelectedAndFocusedGradient.maBorderColor2 = ChangeLuminance(aSelectionColor, -50); - - maMouseOverGradient.maFillColor1 = ChangeLuminance(aSelectionColor, +90); - maMouseOverGradient.maFillColor2 = ChangeLuminance(aSelectionColor, +30); - maMouseOverGradient.maBorderColor1 = ChangeLuminance(aSelectionColor, +10); - maMouseOverGradient.maBorderColor2 = ChangeLuminance(aSelectionColor, +30); + SetGradient(SelectedPage, aSelectionColor, +50,-10, -10,-30); + SetGradient(SelectedAndFocusedPage, aSelectionColor, +30,-30, -30,-50); + SetGradient(MouseOverPage, aSelectionColor, +90,+30, +10,+30); #else @@ -148,10 +151,7 @@ void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpPropert maMouseOverGradient.maBorderColor2 = 0x0e85cd; #endif - maNormalGradient.maFillColor1 = maBackgroundColor; - maNormalGradient.maFillColor2 = maBackgroundColor; - maNormalGradient.maBorderColor1 = maBackgroundColor; - maNormalGradient.maBorderColor2 = maBackgroundColor; + SetGradient(NormalPage, maBackgroundColor, 0,0, 0,0); } @@ -175,8 +175,20 @@ void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpPropert pFont.reset(new Font(Application::GetSettings().GetStyleSettings().GetAppFont())); pFont->SetTransparent(TRUE); pFont->SetWeight(WEIGHT_NORMAL); - const Size aSize (pFont->GetSize()); - pFont->SetSize(Size(aSize.Width()*5/3, aSize.Height()*5/3)); + { + const Size aSize (pFont->GetSize()); + pFont->SetSize(Size(aSize.Width()*5/3, aSize.Height()*5/3)); + } + break; + + case ButtonFont: + pFont.reset(new Font(Application::GetSettings().GetStyleSettings().GetAppFont())); + pFont->SetTransparent(TRUE); + pFont->SetWeight(WEIGHT_BOLD); + { + const Size aSize (pFont->GetSize()); + pFont->SetSize(Size(aSize.Width()*4/3, aSize.Height()*4/3)); + } break; } @@ -196,116 +208,89 @@ void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpPropert -ColorData Theme::GetColorForVisualState (const model::VisualState::State eState) +ColorData Theme::GetColor (const ColorType eType) { - ColorData nColor; - switch (eState) - { - case model::VisualState::VS_Selected: - nColor = 0x80000000 | StellaBlue; - break; - - case model::VisualState::VS_Focused: - nColor = AndroidGreen; - break; + if (eType>=0 && eType<maColor.size()) + return maColor[eType]; + else + return 0; +} - case model::VisualState::VS_Current: - nColor = 0x80000000 | StellaBlue; - // aColor = mpProperties->GetSelectionColor(); - break; - case model::VisualState::VS_Excluded: - nColor = 0x88000000; - break; - case model::VisualState::VS_None: - default: - nColor = 0x80000000 | AntiqueWhite; - break; - } - return nColor; +void Theme::SetColor ( + const ColorType eType, + const ColorData aData) +{ + if (eType>=0 && eType<maColor.size()) + maColor[eType] = aData; } -ColorData Theme::GetColor (const ColorType eType) +ColorData Theme::GetGradientColor ( + const GradientColorType eType, + const GradientColorClass eClass) { - switch(eType) - { - case Background: - return maBackgroundColor; - - case PageBackground: + GradientDescriptor& rDescriptor (GetGradient(eType)); - case ButtonBackground: - return AirForceBlue; + switch (eClass) + { + case Border1: return rDescriptor.maBorderColor1; + case Border2: return rDescriptor.maBorderColor2; + case Fill1: return rDescriptor.maFillColor1; + case Fill2: return rDescriptor.maFillColor2; + default: OSL_ASSERT(false); // fall through + case Base: return rDescriptor.maBaseColor; + } +} - case MouseOverColor: - return gnMouseOverColor; - case PageNumberBorder: - return Azure; - case PageNumberColor: - return 0x0848a8f; - case Selection: - return StellaBlue; +sal_Int32 Theme::GetGradientOffset ( + const GradientColorType eType, + const GradientColorClass eClass) +{ + GradientDescriptor& rDescriptor (GetGradient(eType)); - case PreviewBorder: - return 0x949599; + switch (eClass) + { + case Border1: return rDescriptor.mnBorderOffset1; + case Border2: return rDescriptor.mnBorderOffset2; + case Fill1: return rDescriptor.mnFillOffset1; + case Fill2: return rDescriptor.mnFillOffset2; + default: OSL_ASSERT(false); // fall through + case Base: return 0; } - return 0; } -ColorData Theme::GetGradientColor ( +void Theme::SetGradient ( const GradientColorType eType, - const GradientColorClass eClass) + const ColorData aBaseColor, + const sal_Int32 nFillStartOffset, + const sal_Int32 nFillEndOffset, + const sal_Int32 nBorderStartOffset, + const sal_Int32 nBorderEndOffset) { - GradientDescriptor* pDescriptor = NULL; - switch(eType) - { - case NormalPage: - pDescriptor = &maNormalGradient; - break; + GradientDescriptor& rGradient (GetGradient(eType)); - case SelectedPage: - pDescriptor = &maSelectedGradient; - break; + rGradient.maBaseColor = aBaseColor; - case SelectedAndFocusedPage: - pDescriptor = &maSelectedAndFocusedGradient; - break; - - case MouseOverPage: - pDescriptor = &maMouseOverGradient; - break; - - default: - OSL_ASSERT(false); - break; - } + rGradient.maFillColor1 = ChangeLuminance(aBaseColor, nFillStartOffset); + rGradient.maFillColor2 = ChangeLuminance(aBaseColor, nFillEndOffset); + rGradient.maBorderColor1 = ChangeLuminance(aBaseColor, nBorderStartOffset); + rGradient.maBorderColor2 = ChangeLuminance(aBaseColor, nBorderEndOffset); - if (pDescriptor != NULL) - { - switch (eClass) - { - case Border1: return pDescriptor->maBorderColor1; - case Border2: return pDescriptor->maBorderColor2; - case Fill1: return pDescriptor->maFillColor1; - case Fill2: return pDescriptor->maFillColor2; - - default: - OSL_ASSERT(false); - break; - } - } - return 0; + rGradient.mnFillOffset1 = nFillStartOffset; + rGradient.mnFillOffset2 = nFillEndOffset; + rGradient.mnBorderOffset1 = nBorderStartOffset; + rGradient.mnBorderOffset2 = nBorderEndOffset; } @@ -329,4 +314,73 @@ BitmapEx Theme::GetIcon (const IconType eType) } } + + + +sal_Int32 Theme::GetIntegerValue (const IntegerValueType eType) const +{ + switch (eType) + { + case ButtonCornerRadius: + return mnButtonCornerRadius; + + case ButtonMaxAlpha: + return mnButtonMaxAlpha; + + default: + return 0; + } +} + + + + +void Theme::SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValue) +{ + switch (eType) + { + case ButtonCornerRadius: + mnButtonCornerRadius = nValue; + break; + + case ButtonMaxAlpha: + mnButtonMaxAlpha = nValue; + break; + + default: + break; + } +} + + + + +Theme::GradientDescriptor& Theme::GetGradient (const GradientColorType eType) +{ + switch(eType) + { + default: + OSL_ASSERT(false); + // fall through + + case NormalPage: + return maNormalGradient; + break; + + case SelectedPage: + return maSelectedGradient; + break; + + case SelectedAndFocusedPage: + return maSelectedAndFocusedGradient; + break; + + case MouseOverPage: + return maMouseOverGradient; + break; + } +} + + + } } } // end of namespace ::sd::slidesorter::view |