diff options
Diffstat (limited to 'sd/source/ui/slidesorter/inc/view')
15 files changed, 2421 insertions, 0 deletions
diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx new file mode 100644 index 000000000000..f28287b15a0e --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx @@ -0,0 +1,301 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_SLIDE_SORTER_VIEW_HXX +#define SD_SLIDESORTER_SLIDE_SORTER_VIEW_HXX + +#include "SlideSorter.hxx" +#include "model/SlsPageDescriptor.hxx" +#include "model/SlsSharedPageDescriptor.hxx" +#include "view/SlsLayouter.hxx" +#include "view/SlsILayerPainter.hxx" + +#include "View.hxx" +#include <sfx2/viewfrm.hxx> +#include "pres.hxx" +#include <tools/gen.hxx> +#include <svx/svdmodel.hxx> +#include <vcl/region.hxx> +#include <vcl/outdev.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <memory> +#include <boost/shared_ptr.hpp> +#include <boost/noncopyable.hpp> + +class Point; + +namespace sd { namespace slidesorter { namespace controller { +class SlideSorterController; +class Properties; +} } } + +namespace sd { namespace slidesorter { namespace cache { +class PageCache; +} } } + +namespace sd { namespace slidesorter { namespace model { +class SlideSorterModel; +} } } + +namespace sd { namespace slidesorter { namespace view { + +class ButtonBar; +class LayeredDevice; +class Layouter; +class PageObjectPainter; +class SelectionPainter; +class ToolTip; + + +class SlideSorterView + : public sd::View, + public ::boost::noncopyable +{ +public: + TYPEINFO (); + + /** Create a new view for the slide sorter. + @param rViewShell + This reference is simply passed to the base class and not used + by this class. + + */ + SlideSorterView (SlideSorter& rSlideSorter); + void Init (void); + + virtual ~SlideSorterView (void); + void Dispose (void); + + /** Set the general way of layouting the page objects. Note that this + method does not trigger any repaints or layouts. + */ + bool SetOrientation (const Layouter::Orientation eOrientation); + Layouter::Orientation GetOrientation (void) const; + + void RequestRepaint (void); + void RequestRepaint (const model::SharedPageDescriptor& rDescriptor); + void RequestRepaint (const Rectangle& rRepaintBox); + void RequestRepaint (const Region& rRepaintRegion); + + Rectangle GetModelArea (void); + + /** Return the index of the page that is rendered at the given position. + @param rPosition + The position is expected to be in pixel coordinates. + @return + The returned index is -1 when there is no page object at the + given position. + */ + sal_Int32 GetPageIndexAtPoint (const Point& rPosition) const; + + view::Layouter& GetLayouter (void); + + virtual void ModelHasChanged (void); + + void LocalModelHasChanged(void); + + /** This method is typically called before a model change takes place. + All references to model data are released. PostModelChange() has to + be called to complete the handling of the model change. When the + calls to Pre- and PostModelChange() are very close to each other you + may call HandleModelChange() instead. + */ + void PreModelChange (void); + + /** This method is typically called after a model change took place. + References to model data are re-allocated. Call this method only + after PreModelChange() has been called. + */ + void PostModelChange (void); + + /** This method is a convenience function that simply calls + PreModelChange() and then PostModelChange(). + */ + void HandleModelChange (void); + + void HandleDrawModeChange (void); + + virtual void Resize (void); + virtual void CompleteRedraw ( + OutputDevice* pDevice, + const Region& rPaintArea, + sdr::contact::ViewObjectContactRedirector* pRedirector = NULL); + void Paint (OutputDevice& rDevice, const Rectangle& rRepaintArea); + + virtual void ConfigurationChanged ( + utl::ConfigurationBroadcaster* pBroadcaster, + sal_uInt32 nHint); + + void HandleDataChangeEvent (void); + + void Layout (void); + /** This tells the view that it has to re-determine the visibility of + the page objects before painting them the next time. + */ + void InvalidatePageObjectVisibilities (void); + + /** Return the window to which this view renders its output. + */ + // ::boost::shared_ptr<sd::Window> GetWindow (void) const; + + ::boost::shared_ptr<cache::PageCache> GetPreviewCache (void); + + /** Set the bounding box of the insertion marker in model coordinates. + + It will be painted as a dark rectangle that fills the given box. + */ + void SetInsertionMarker (const Rectangle& rBBox); + + /** Specify whether the insertion marker will be painted or not. + */ + void SetInsertionMarkerVisibility (bool bVisible); + + /** Set the size and position of the selection rectangle. + + It will be painted as a dashed rectangle. + */ + void SetSelectionRectangle (const Rectangle& rBox); + + /** Specify whether the selection rectangle will be painted or not. + */ + void SetSelectionRectangleVisibility (bool bVisible); + + /** Return the range of currently visible page objects including the + first and last one in that range. + @return + The returned pair of page object indices is empty when the + second index is lower than the first. + */ + Pair GetVisiblePageRange (void); + + /** Add a shape to the page. Typically used from inside + PostModelChange(). + */ + // void AddSdrObject (SdrObject& rObject); + + /** Add a listener that is called when the set of visible slides. + @param rListener + When this method is called multiple times for the same listener + the second and all following calls are ignored. Each listener + is added only once. + */ + void AddVisibilityChangeListener (const Link& rListener); + + /** Remove a listener that is called when the set of visible slides changes. + @param rListener + It is save to pass a listener that was not added or has been + removed previously. Such calls are ignored. + */ + void RemoveVisibilityChangeListener (const Link& rListener); + + /** The page under the mouse is not highlighted in some contexts. Call + this method on context changes. + */ + void UpdatePageUnderMouse (bool bAnimate); + void UpdatePageUnderMouse ( + const Point& rMousePosition, + const bool bIsMouseButtonDown, + const bool bAnimate = true); + void UpdatePageUnderMouse ( + const model::SharedPageDescriptor& rpDescriptor, + const Point& rMousePosition, + const bool bIsMouseButtonDown, + const bool bAnimate = true); + void SetPageUnderMouse ( + const model::SharedPageDescriptor& rpDescriptor, + const bool bAnimate = true); + + bool SetState ( + const model::SharedPageDescriptor& rpDescriptor, + const model::PageDescriptor::State eState, + const bool bStateValue, + const bool bAnimate = true); + + void UpdateOrientation (void); + + ::boost::shared_ptr<PageObjectPainter> GetPageObjectPainter (void); + ::boost::shared_ptr<LayeredDevice> GetLayeredDevice (void) const; + + class DrawLock + { + public: + DrawLock (view::SlideSorterView& rView, const SharedSdWindow& rpWindow); + DrawLock (SlideSorter& rSlideSorter); + ~DrawLock (void); + /** When the DrawLock is disposed then it will not request a repaint + on destruction. + */ + void Dispose (void); + private: + view::SlideSorterView& mrView; + SharedSdWindow mpWindow; + }; + + ButtonBar& GetButtonBar (void) const; + ToolTip& GetToolTip (void) const; + +protected: + virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint); + +private: + SlideSorter& mrSlideSorter; + model::SlideSorterModel& mrModel; + bool mbIsDisposed; + ::std::auto_ptr<Layouter> mpLayouter; + bool mbPageObjectVisibilitiesValid; + ::boost::shared_ptr<cache::PageCache> mpPreviewCache; + ::boost::shared_ptr<LayeredDevice> mpLayeredDevice; + Range maVisiblePageRange; + bool mbModelChangedWhileModifyEnabled; + Size maPreviewSize; + bool mbPreciousFlagUpdatePending; + Layouter::Orientation meOrientation; + ::boost::shared_ptr<controller::Properties> mpProperties; + model::SharedPageDescriptor mpPageUnderMouse; + sal_Int32 mnButtonUnderMouse; + ::boost::shared_ptr<PageObjectPainter> mpPageObjectPainter; + ::boost::shared_ptr<SelectionPainter> mpSelectionPainter; + Region maRedrawRegion; + SharedILayerPainter mpBackgroundPainter; + ::boost::scoped_ptr<ButtonBar> mpButtonBar; + ::boost::scoped_ptr<ToolTip> mpToolTip; + bool mbIsRearrangePending; + ::std::vector<Link> maVisibilityChangeListeners; + + /** Determine the visibility of all page objects. + */ + void DeterminePageObjectVisibilities (void); + + void UpdatePreciousFlags (void); + void RequestRearrange (void); + void Rearrange (void); +}; + + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx new file mode 100644 index 000000000000..460c915f8a56 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx @@ -0,0 +1,362 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_VIEW_BUTTON_BAR_HXX +#define SD_SLIDESORTER_VIEW_BUTTON_BAR_HXX + +#include "model/SlsSharedPageDescriptor.hxx" +#include <tools/gen.hxx> +#include <rtl/ustring.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/bmpacc.hxx> +#include <boost/scoped_ptr.hpp> + +namespace sd { namespace slidesorter { +class SlideSorter; +} } + + +namespace sd { namespace slidesorter { namespace view { + +class Theme; + +class Button; +typedef ::boost::shared_ptr<Button> SharedButton; + +/** This is a container of buttons and a coordinating controller. + The last means that it receives mouse events and forwards them to + the right button. +*/ +class ButtonBar +{ +public: + ButtonBar (SlideSorter& rSlideSorter); + ~ButtonBar (void); + + void ProcessButtonDownEvent ( + const model::SharedPageDescriptor& rpDescriptor, + const Point aMouseModelLocation); + void ProcessButtonUpEvent ( + const model::SharedPageDescriptor& rpDescriptor, + const Point aMouseModelLocation); + void ProcessMouseMotionEvent ( + const model::SharedPageDescriptor& rpDescriptor, + const Point aMouseModelLocation, + const bool bIsMouseButtonDown); + + void ResetPage (void); + + /** Return the number of buttons that are to be displayed in page + objects which the mouse hovers over. + @param bIsExcluded + When this flag is <TRUE/> then return the number of + buttons that is to be displayed for pages that are + excluded from the slide show. + */ + sal_Int32 GetButtonCount (const bool bIsExcluded) const; + + /** Return the specified button. + @param nIndex + Valid values lie in the range [0,GetButtonCount()). + @param bIsExcluded + When this flag is <TRUE/> then return a button that is to + be displayed for pages that are excluded from the slide + show. + @return + Returns an empty pointer when the given index is not valid. + */ + ::boost::shared_ptr<Button> GetButton ( + const bool bIsExcluded, + const sal_Int32 nIndex) const; + + bool IsMouseOverBar (void) const; + + /** Paint the specified page object. When this is not the same as the + one under the mouse (mpDescriptor) then the buttons are all + painted in their normal state. + */ + void Paint ( + OutputDevice& rDevice, + const model::SharedPageDescriptor& rpPageDescriptor); + + bool IsMouseOverButton (void) const; + + void RequestLayout (void); + + /** Return the help text for the button under the mouse. + @return + When the mouse is not over a button then an empty string + is returned. + */ + ::rtl::OUString GetButtonHelpText (void) const; + + /** Request the button bar to be shown. + @param bAnimate + This flag controls whether to just show the button bar (<FALSE/>) + or to fade it in smoothly (<TRUE/>.) + */ + void RequestFadeIn ( + const model::SharedPageDescriptor& rpDescriptor, + const bool bAnimate); + + /** Request the button bar to be hidden. + @param bAnimate + This flag controls whether to just hide the button bar (<FALSE/>) + or to fade it out smoothly (<TRUE/>.) + */ + void RequestFadeOut ( + const model::SharedPageDescriptor& rpDescriptor, + const bool bAnimate); + + /** Return whether the button bar is visible for the givn descriptor (or + being faded in.) + */ + bool IsVisible (const model::SharedPageDescriptor& rpDescriptor); + + void HandleDataChangeEvent (void); + + class BackgroundTheme; + + /** While at least one Lock object exists the button bar will not be + displayed. Used, e.g. during a mouse multiselection to avoid + confusing and unhelpfull visual signals. + */ + class Lock + { + public: + Lock (SlideSorter& rSlideSorter); + ~Lock (void); + private: + ButtonBar& mrButtonBar; + }; + +private: + SlideSorter& mrSlideSorter; + Size maPageObjectSize; + Rectangle maButtonBoundingBox; + Point maBackgroundLocation; + model::SharedPageDescriptor mpDescriptor; + bool mbIsExcluded; + boost::shared_ptr<Button> mpButtonUnderMouse; + // The button on which the mouse button was pressed. + boost::shared_ptr<Button> mpDownButton; + ::std::vector<SharedButton> maRegularButtons; + ::std::vector<SharedButton> maExcludedButtons; + BitmapEx maNormalBackground; + BitmapEx maButtonDownBackground; + bool mbIsMouseOverBar; + ::boost::scoped_ptr<BackgroundTheme> mpBackgroundTheme; + int mnLockCount; + + /** Remember the specified page. If it differs from mpDescriptor then + the buttons are placed anew. + @return + The returned flag indicates wether the mpDescriptor member + is set to a new value. + */ + bool SetPage (const model::SharedPageDescriptor& rpDescriptor); + SharedButton GetButtonAt (const Point aModelLocation); + bool SetButtonUnderMouse (const SharedButton& rButton = SharedButton()); + void PaintButtonBackground ( + OutputDevice& rDevice, + const model::SharedPageDescriptor& rpPageDescriptor, + const Point aOffset); + void LayoutButtons (const Size aPageModelSize); + bool LayoutButtons (void); + BitmapEx CreateBackground ( + const OutputDevice& rTemplateDevice, + const bool bIsButtonDown) const; + bool IsMouseOverBar (const Point aModelLocation) const; + void StartFadeAnimation ( + const model::SharedPageDescriptor& rpDescriptor, + const double nTargetAlpha, + const bool bFadeIn); + + void AcquireLock (void); + void ReleaseLock (void); +}; + + + + +class Button +{ +public: + Button ( + SlideSorter& rSlideSorter, + const ::rtl::OUString& rsHelpText); + virtual ~Button (void); + + enum State { State_Normal, State_Hover, State_Down }; + enum IconSize { IconSize_Large, IconSize_Medium, IconSize_Small }; + + /** Set a new state. + @return + When the new state is different from the old state + then <TRUE/> is returned. + */ + bool SetState (const State eState); + State GetState (void) const; + + virtual void Place (const Rectangle aButtonBarBox) = 0; + virtual void Paint ( + OutputDevice& rDevice, + const Point aOffset, + const double nAlpha, + const ::boost::shared_ptr<Theme>& rpTheme) const = 0; + virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor) = 0; + + /** Return the bounding box of the layouted button. + */ + Rectangle GetBoundingBox (void) const; + /** Return the minimum size required to completely paint the + button. + */ + virtual Size GetSize (void) const = 0; + virtual Size GetSize (const IconSize eIconSize) const = 0; + ::rtl::OUString GetHelpText (void) const; + bool IsDown (void) const; + void SetActiveState (const bool bIsActive); + bool IsActive (void) const; + void SetIconSize (const IconSize eIconSize); + IconSize GetIconSize (void) const; + /** By default a button is always enabled. Override to change this. + */ + virtual bool IsEnabled (void) const; + +protected: + SlideSorter& mrSlideSorter; + State meState; + Rectangle maBoundingBox; + const ::rtl::OUString msHelpText; + // Buttons that lie (partly) outside the button bar are deactivated. + bool mbIsActive; + IconSize meIconSize; +}; + + + +class TextButton : public Button +{ +public: + TextButton ( + SlideSorter& rSlideSorter, + const ::rtl::OUString& rsText, + 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 ::rtl::OUString msText; +}; + + + +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; + const BitmapEx maMediumHoverIcon; + const BitmapEx maSmallIcon; + const BitmapEx maSmallHoverIcon; +}; + + +class UnhideButton : public ImageButton +{ +public: + UnhideButton (SlideSorter& rSlideSorter); + +protected: + virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor); +}; + + +class StartShowButton : public ImageButton +{ +public: + StartShowButton (SlideSorter& rSlideSorter); + virtual bool IsEnabled (void) const; + +protected: + virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor); +}; + + +class HideButton : public ImageButton +{ +public: + HideButton (SlideSorter& rSlideSorter); + +protected: + virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor); +}; + + +class DuplicateButton : public ImageButton +{ +public: + DuplicateButton (SlideSorter& rSlideSorter); + virtual bool IsEnabled (void) const; + +protected: + virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor); +}; + + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsFontProvider.hxx b/sd/source/ui/slidesorter/inc/view/SlsFontProvider.hxx new file mode 100644 index 000000000000..2b71c0e50152 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsFontProvider.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_VIEW_FONT_PROVIDER_HXX +#define SD_SLIDESORTER_VIEW_FONT_PROVIDER_HXX + +#include "tools/SdGlobalResourceContainer.hxx" + +#include <boost/shared_ptr.hpp> +#include <vcl/mapmod.hxx> + +class Font; +class OutputDevice; +class VclWindowEvent; + +namespace sd { namespace slidesorter { namespace view { + +/** This simple singleton class provides fonts that are scaled so that they + have a fixed height on the given device regardless of its map mode. +*/ +class FontProvider + : public SdGlobalResource +{ +public: + typedef ::boost::shared_ptr<Font> SharedFontPointer; + + /** Return the single instance of this class. Throws a RuntimeException + when no instance can be created. + */ + static FontProvider& Instance (void); + + /** Return a font that is scaled according to the current map mode of + the given device. Repeated calls with a device, not necessarily the + same device, with the same map mode will return the same font. The + first call with a different map mode will release the old font and + create a new one that is correctly scaled. + */ + SharedFontPointer GetFont (const OutputDevice& rDevice); + + /** Call this method to tell an object to release its currently used + font. The next call to GetFont() will then create a new one. + Typically called after a DataChange event when for instance a system + font has been modified. + */ + void Invalidate (void); + +private: + static FontProvider* mpInstance; + + /** The font that was created by a previous call to GetFont(). It is + replaced by another one only when GetFont() is called with a device + with a different map mode or by a call to Invalidate(). + */ + SharedFontPointer maFont; + /** The mape mode for which maFont was created. + */ + MapMode maMapMode; + + FontProvider (void); + virtual ~FontProvider (void); + + // Copy constructor is not implemented. + FontProvider (const FontProvider&); + // Assignment operator is not implemented. + FontProvider& operator= (const FontProvider&); +}; + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx new file mode 100644 index 000000000000..853890ee5894 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_VIEW_LAYER_PAINTER_HXX +#define SD_SLIDESORTER_VIEW_LAYER_PAINTER_HXX + +#include <boost/shared_ptr.hpp> +#include <sal/types.h> + +class OutputDevice; +class Rectangle; + +namespace sd { namespace slidesorter { namespace view { + +class ILayerInvalidator +{ +public: + virtual void Invalidate (const Rectangle& rInvalidationBox) = 0; +}; +typedef ::boost::shared_ptr<ILayerInvalidator> SharedILayerInvalidator; + +class ILayerPainter +{ +public: + virtual void SetLayerInvalidator ( + const SharedILayerInvalidator& rpInvalidator) = 0; + virtual void Paint ( + OutputDevice& rDevice, + const Rectangle& rRepaintArea) = 0; +}; +typedef ::boost::shared_ptr<ILayerPainter> SharedILayerPainter; + + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx b/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx new file mode 100644 index 000000000000..cfd789818408 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_VIEW_INSERT_ANIMATOR_HXX +#define SD_SLIDESORTER_VIEW_INSERT_ANIMATOR_HXX + +#include "controller/SlsAnimator.hxx" +#include <boost/scoped_ptr.hpp> +#include <boost/noncopyable.hpp> + +namespace sd { namespace slidesorter { namespace view { + +class InsertPosition; + + +/** Animate the positions of page objects to make room at the insert + position while a move or copy operation takes place. +*/ +class InsertAnimator + : private ::boost::noncopyable +{ +public: + InsertAnimator (SlideSorter& rSlideSorter); + + /** Set the position at which we have to make room for the display of an + icon. + */ + void SetInsertPosition (const InsertPosition& rInsertPosition); + + enum ResetMode { RM_Normal, RM_AbortAnimations }; + /** Restore the normal position of all page objects. + @param eMode + This flag controls wether to start an animation that ends in the + normal positions of all slides (AM_Animated) or to restore the + normal positions immediately (AM_Immediate). + */ + void Reset (const controller::Animator::AnimationMode eMode); + +private: + class Implementation; + ::boost::shared_ptr<Implementation> mpImplementation; +}; + + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx new file mode 100644 index 000000000000..a9a640d978cf --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_INSERTION_INDICATOR_OVERLAY_HXX +#define SD_SLIDESORTER_INSERTION_INDICATOR_OVERLAY_HXX + +#include "model/SlsSharedPageDescriptor.hxx" +#include "view/SlsILayerPainter.hxx" +#include "controller/SlsTransferable.hxx" + +#include <tools/gen.hxx> +#include <vcl/bitmapex.hxx> +#include <boost/scoped_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> +#include <vector> + +class OutputDevice; +class SdPage; + +namespace sd { namespace slidesorter { +class SlideSorter; +} } + +namespace sd { namespace slidesorter { namespace model { +class PageEnumeration; +} } } + +namespace sd { namespace slidesorter { namespace controller { +class Transferable; +} } } + +namespace sd { namespace slidesorter { namespace view { + +class FramePainter; +class LayeredDevice; + +/** The insertion indicator is painted as a vertical or horizonal bar + in the space between slides. +*/ +class InsertionIndicatorOverlay + : public ILayerPainter, + public ::boost::enable_shared_from_this<InsertionIndicatorOverlay> +{ +public: + InsertionIndicatorOverlay (SlideSorter& rSlideSorter); + virtual ~InsertionIndicatorOverlay (void); + + virtual void SetLayerInvalidator (const SharedILayerInvalidator& rpInvalidator); + + void Create (const controller::Transferable* pTransferable); + + /** Given a position in model coordinates this method calculates the + insertion marker both as an index in the document and as a location + used for drawing the insertion indicator. + */ + void SetLocation (const Point& rPosition); + + Size GetSize (void) const; + + virtual void Paint ( + OutputDevice& rDevice, + const Rectangle& rRepaintArea); + + bool IsVisible (void) const; + void Hide (void); + void Show (void); + + Rectangle GetBoundingBox (void) const; + +private: + SlideSorter& mrSlideSorter; + bool mbIsVisible; + const sal_Int32 mnLayerIndex; + SharedILayerInvalidator mpLayerInvalidator; + // Center of the insertion indicator. + Point maLocation; + BitmapEx maIcon; + Point maIconOffset; + ::boost::scoped_ptr<FramePainter> mpShadowPainter; + + void SetPositionAndSize (const Rectangle& rBoundingBox); + void SelectRepresentatives ( + model::PageEnumeration& rSelection, + ::std::vector<model::SharedPageDescriptor>& rDescriptors) const; + Point PaintRepresentatives ( + OutputDevice& rContent, + const Size aPreviewSize, + const sal_Int32 nOffset, + const ::std::vector<controller::Transferable::Representative>& rPages) const; + void PaintPageCount ( + OutputDevice& rDevice, + const sal_Int32 nSelectionCount, + const Size aPreviewSize, + const Point aFirstPageOffset) const; + /** Setup the insertion indicator by creating the icon. It consists of + scaled down previews of some of the selected pages. + */ + void Create ( + const ::std::vector<controller::Transferable::Representative>& rPages, + const sal_Int32 nSelectionCount); +}; + + + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx new file mode 100644 index 000000000000..4d19e41e881b --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx @@ -0,0 +1,296 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_VIEW_LAYOUTER_HXX +#define SD_SLIDESORTER_VIEW_LAYOUTER_HXX + +#include "SlideSorter.hxx" +#include "view/SlsPageObjectLayouter.hxx" +#include "view/SlsTheme.hxx" +#include <sal/types.h> +#include <tools/fract.hxx> +#include <vcl/mapmod.hxx> +#include <vector> +#include <utility> + + +class MapMode; +class OutputDevice; +class Size; + +namespace sd { namespace slidesorter { namespace view { + +class InsertPosition; + + + +/** Calculate the size and position of page objects displayed by a slide + sorter. The layouter takes into account various input values: + 1.) Size of the window in which the slide sorter is displayed. + 2.) Desired and minimal and maximal widths of page objects. + 3.) Minimal and maximal number of columns. + 4.) Vertical and horizontal gaps between objects in adjacent columns. + 5.) Borders arround every page object. + 6.) Vertical and horizontal borders between enclosing page and outer + page objects. + From these it calculates various output values: + 1.) The width of page objects. + 2.) The number of columns. + 3.) The size of the enclosing page. + + <p>Sizes and lengths are all in pixel except where explicitly stated + otherwise.</p> + + <p>The GetIndex... methods may return indices that are larger than or + equal to (zero based) the number of pages. This is so because the + number of pages is not known to the class instances. Indices are + calculated with reference to the general grid layout of page + objects.</p> +*/ +class Layouter +{ +public: + enum Orientation { HORIZONTAL, VERTICAL, GRID }; + + Layouter ( + const SharedSdWindow& rpWindow, + const ::boost::shared_ptr<Theme>& rpTheme); + ~Layouter (void); + + ::boost::shared_ptr<PageObjectLayouter> GetPageObjectLayouter (void) const; + /** Set the horizontal and vertical borders in pixel coordinates between + the enclosing window and page objects. The borders may be painted + larger then the given values when the space for the insertion marker + is not sufficient. + @param nLeftBorder + Use a negative value to indicate that the left border size + shall not be modified. A value of 10 is the default. + @param nRightBorder + Use a negative value to indicate that the right border size + shall not be modified. A value of 10 is the default. + @param nTopBorder + Use a negative value to indicate that the top border size + shall not be modified. A value of 10 is the default. + @param nBottomBorder + Use a negative value to indicate that the bottom border size + shall not be modified. A value of 10 is the default. + */ + void SetBorders (sal_Int32 nLeftBorder, sal_Int32 nRightBorder, + sal_Int32 nTopBorder, sal_Int32 nBottomBorder); + + /** Set the interval of valid column counts. When nMinimalColumnCount + <= nMaximalColumnCount is not fullfilled then the call is ignored. + @param nMinimalColumnCount + The default value is 1. The question whether higher values make + any sense is left to the caller. + @param nMaximalColumnCount + The default value is 5. + */ + void SetColumnCount (sal_Int32 nMinimalColumnCount, + sal_Int32 nMaximalColumnCount); + + /** Central method of this class. It takes the input values and + calculates the output values. Both given sizes must not be 0 in any + dimension or the call is ignored. + @param eOrientation + This defines the generaly layout and specifies whether there may + be more than one row or more than one column. + @param rWindowSize + The size of the window in pixels that the slide sorter is + displayed in. This can differ from the size of mpWindow during + detection of whether or not the scroll bars should be visible. + @param rPreviewModelSize + Size of each page in model coordinates. + @param rpWindow + The map mode of this window is adapted to the new layout of the + page objects. + @return + The return value indicates whether the Get... methods can be + used to obtain valid values (<TRUE/>). + */ + bool Rearrange ( + const Orientation eOrientation, + const Size& rWindowSize, + const Size& rPreviewModelSize, + const sal_uInt32 nPageCount); + + /** Change the zoom factor. This does not change the general layout + (number of columns). + */ + void _SetZoom (double nZoomFactor); + void _SetZoom (Fraction nZoomFactor); + + /** Return the number of columns. + */ + sal_Int32 GetColumnCount (void) const; + + sal_Int32 GetRowCount (void) const; + + sal_Int32 GetRow (const sal_Int32 nIndex) const; + + sal_Int32 GetColumn (const sal_Int32 nIndex) const; + + sal_Int32 GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const; + + /** Return the scale factor that can be set at the map mode of the + output window. + */ + Fraction GetScaleFactor (void) const; + + Size GetPageObjectSize (void) const; + + /** Return the bounding box in window coordinates of the nIndex-th page + object. + */ + Rectangle GetPageObjectBox ( + const sal_Int32 nIndex, + const bool bIncludeBorderAndGap = false) const; + + /** Return the bounding box in model coordinates of the page that + contains the given amount of page objects. + */ + Rectangle GetTotalBoundingBox (void) const; + + /** Return the index of the first fully or partially visible page + object. This takes into account only the vertical dimension. + @return + The second index may be larger than the number of existing + page objects. + */ + Range GetRangeOfVisiblePageObjects (const Rectangle& rVisibleArea) const; + + /** Return the index of the page object that is rendered at the given + point. + @param rPosition + The position is expected to be in model coordinates relative to + the page origin. + @param bIncludePageBorders + When <TRUE/> then include the page borders into the calculation, + i.e. when a point lies in the border of a page object but not on + the actual page area the index of that page is returned; + otherwise -1 would be returned to indicate that no page object + has been hit. + @param bClampToValidRange + When <TRUE/> then values outside the valid range [0,mnPageCount) + are mapped to 0 (when smaller than 0) or mnPageCount-1 when + equal to or larger than mnPageCount. + When <FALSE/> then -1 is returned for values outside the valid range. + @return + The returned index may be larger than the number of existing + page objects. + */ + sal_Int32 GetIndexAtPoint ( + const Point& rModelPosition, + const bool bIncludePageBorders = false, + const bool bClampToValidRange = true) const; + + /** Return an object that describes the logical and visual properties of + where to do an insert operation when the user would release the the + mouse button at the given position after a drag operation and of + where and how to display an insertion indicator. + @param rModelPosition + The position in the model coordinate system for which to + determine the insertion page index. The position does not have + to be over a page object to return a valid value. + @param rIndicatorSize + The size of the insertion indicator. This size is used to adapt + the location when at the left or right of a row or at the top or + bottom of a column. + @param rModel + The model is used to get access to the selection states of the + pages. This in turn is used to determine the visual bounding + boxes. + */ + InsertPosition GetInsertPosition ( + const Point& rModelPosition, + const Size& rIndicatorSize, + model::SlideSorterModel& rModel) const; + + Range GetValidHorizontalSizeRange (void) const; + Range GetValidVerticalSizeRange (void) const; + + class Implementation; + +private: + ::boost::scoped_ptr<Implementation> mpImplementation; + SharedSdWindow mpWindow; +}; + + + + + +/** Collect all values concerning the logical and visual properties of the + insertion position that is used for drag-and-drop and copy-and-past. +*/ +class InsertPosition +{ +public: + InsertPosition (void); + InsertPosition& operator= (const InsertPosition& rInsertPosition); + bool operator== (const InsertPosition& rInsertPosition) const; + bool operator!= (const InsertPosition& rInsertPosition) const; + + void SetLogicalPosition ( + const sal_Int32 nRow, + const sal_Int32 nColumn, + const sal_Int32 nIndex, + const bool bIsAtRunStart, + const bool bIsAtRunEnd, + const bool bIsExtraSpaceNeeded); + void SetGeometricalPosition( + const Point aLocation, + const Point aLeadingOffset, + const Point aTrailingOffset); + + sal_Int32 GetRow (void) const { return mnRow; } + sal_Int32 GetColumn (void) const { return mnColumn; } + sal_Int32 GetIndex (void) const { return mnIndex; } + Point GetLocation (void) const { return maLocation; } + Point GetLeadingOffset (void) const { return maLeadingOffset; } + Point GetTrailingOffset (void) const { return maTrailingOffset; } + bool IsAtRunStart (void) const { return mbIsAtRunStart; } + bool IsAtRunEnd (void) const { return mbIsAtRunEnd; } + bool IsExtraSpaceNeeded (void) const { return mbIsExtraSpaceNeeded; } + +private: + sal_Int32 mnRow; + sal_Int32 mnColumn; + sal_Int32 mnIndex; + bool mbIsAtRunStart : 1; + bool mbIsAtRunEnd : 1; + bool mbIsExtraSpaceNeeded : 1; + Point maLocation; + Point maLeadingOffset; + Point maTrailingOffset; +}; + + + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx new file mode 100644 index 000000000000..0f4ede6216c1 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_PAGE_OBJECT_HXX +#define SD_SLIDESORTER_PAGE_OBJECT_HXX + +#include "model/SlsSharedPageDescriptor.hxx" + +#include <svx/svdopage.hxx> + +namespace sd { namespace slidesorter { namespace view { + + +/** This sub class of the SdrPageObject exists to create the view contact + and indirectly to create view-object-contact objects. +*/ +class PageObject + : public SdrPageObj +{ +public: + PageObject ( + const Rectangle& rRect, + SdrPage* pPage, + const model::SharedPageDescriptor& rpDescriptor); + + virtual ~PageObject (void); + + model::SharedPageDescriptor GetDescriptor (void) const; + +private: + model::SharedPageDescriptor mpDescriptor; + +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +}; + + + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx new file mode 100644 index 000000000000..8e61a8b1b47c --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_PAGE_OBJECT_LAYOUTER_HXX +#define SD_SLIDESORTER_PAGE_OBJECT_LAYOUTER_HXX + +#include "SlideSorter.hxx" +#include "model/SlsSharedPageDescriptor.hxx" +#include "tools/gen.hxx" +#include <vcl/image.hxx> + +namespace sd { namespace slidesorter { namespace view { + + +/** In contrast to the Layouter that places page objects in the view, the + PageObjectLayouter places the parts of individual page objects like page + number area, borders, preview. +*/ +class PageObjectLayouter +{ +public: + /** Create a new PageObjectLayouter object. + @param rPageObjectSize + In general either the width or the height will be 0 in order to + signal that this size component has to be calculated from the other. + This calculation will make the preview as large as possible. + @param nPageCount + The page count is used to determine how wide the page number + 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, + const sal_Int32 nPageCount); + ~PageObjectLayouter(void); + + enum Part { + // The focus indicator is painted outside the actual page object. + FocusIndicator, + // This is the outer bounding box that includes the preview, page + // number, title. + PageObject, + // Bounding box of the actual preview. + Preview, + // Bounding box of the mouse indicator indicator frame. + MouseOverIndicator, + // Bounding box of the page number. + PageNumber, + // Bounding box of the pane name. + Name, + // Indicator whether or not there is a slide transition associated + // with this slide. + TransitionEffectIndicator + }; + /** Two coordinate systems are supported. They differ only in + translation not in scale. Both relate to pixel values in the window. + A position in the model coordinate system does not change when the window content is + scrolled up or down. In the window coordinate system (relative + to the top left point of the window)scrolling leads to different values. + */ + enum CoordinateSystem { + WindowCoordinateSystem, + ModelCoordinateSystem + }; + + /** Return the bounding box of the page object or one of its graphical + parts. + @param rWindow + This device is used to translate between model and window + coordinates. + @param rpPageDescriptor + The page for which to calculate the bounding box. This may be + NULL. When it is NULL then a generic bounding box is calculated + for the location (0,0). + @param ePart + The part of the page object for which to return the bounding + box. + @param eCoodinateSystem + The bounding box can be returned in model and in pixel + (window) coordinates. + */ + Rectangle GetBoundingBox ( + const model::SharedPageDescriptor& rpPageDescriptor, + const Part ePart, + const CoordinateSystem eCoordinateSystem); + Rectangle GetBoundingBox ( + const Point& rPageObjectLocation, + const Part ePart, + const CoordinateSystem eCoordinateSystem); + Size GetSize ( + const Part ePart, + const CoordinateSystem eCoordinateSystem); + + Image GetTransitionEffectIcon (void) const; + +private: + SharedSdWindow mpWindow; + Size maPageObjectSize; + double mnModelToWindowScale; + Rectangle maFocusIndicatorBoundingBox; + Rectangle maPageObjectBoundingBox; + Rectangle maPageNumberAreaBoundingBox; + Rectangle maPreviewBoundingBox; + Rectangle maTransitionEffectBoundingBox; + const Image maTransitionEffectIcon; + const ::boost::shared_ptr<Font> mpPageNumberFont; + + Size GetPageNumberAreaSize (const int nPageCount); + Rectangle CalculatePreviewBoundingBox ( + Size& rPageObjectSize, + const Size& rPreviewModelSize, + const sal_Int32 nPageNumberAreaWidth, + const sal_Int32 nFocusIndicatorWidth); +}; + + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx new file mode 100644 index 000000000000..e4e28a2e38b2 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_PAGE_OBJECT_PAINTER_HEADER +#define SD_SLIDESORTER_PAGE_OBJECT_PAINTER_HEADER + +#include "SlideSorter.hxx" +#include "model/SlsPageDescriptor.hxx" +#include "view/SlsLayouter.hxx" +#include "view/SlsTheme.hxx" +#include <boost/scoped_ptr.hpp> + +namespace sd { namespace slidesorter { namespace cache { +class PageCache; +} } } + +namespace sd { namespace slidesorter { namespace view { + +class ButtonBar; +class Layouter; +class PageObjectLayouter; +class FramePainter; + +class PageObjectPainter +{ +public: + PageObjectPainter (const SlideSorter& rSlideSorter); + ~PageObjectPainter (void); + + void PaintPageObject ( + OutputDevice& rDevice, + const model::SharedPageDescriptor& rpDescriptor); + + 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 + the given theme is the same object as the one already in use by this + painter everything that depends on the theme is updated. + */ + void SetTheme (const ::boost::shared_ptr<view::Theme>& rpTheme); + + /** Return a preview bitmap for the given page descriptor. When the + page is excluded from the show then the preview is marked + accordingly. + @rpDescriptor + Defines the page for which to return the preview. + @pReferenceDevice + When not <NULL/> then this reference device is used to created a + compatible bitmap. + @return + The returned bitmap may have a different size then the preview area. + */ + Bitmap GetPreviewBitmap ( + const model::SharedPageDescriptor& rpDescriptor, + const OutputDevice* pReferenceDevice) const; + +private: + const Layouter& mrLayouter; + ::boost::shared_ptr<PageObjectLayouter> mpPageObjectLayouter; + ::boost::shared_ptr<cache::PageCache> mpCache; + ::boost::shared_ptr<controller::Properties> mpProperties; + ::boost::shared_ptr<view::Theme> mpTheme; + ::boost::shared_ptr<Font> mpPageNumberFont; + ::boost::scoped_ptr<FramePainter> mpShadowPainter; + ::boost::scoped_ptr<FramePainter> mpFocusBorderPainter; + Bitmap maNormalBackground; + Bitmap maSelectionBackground; + Bitmap maFocusedSelectionBackground; + Bitmap maFocusedBackground; + Bitmap maMouseOverBackground; + Bitmap maMouseOverFocusedBackground; + Bitmap maMouseOverSelectedAndFocusedBackground; + ::rtl::OUString msUnhideString; + ButtonBar& mrButtonBar; + + void PaintBackground ( + OutputDevice& rDevice, + const model::SharedPageDescriptor& rpDescriptor); + void PaintPreview ( + OutputDevice& rDevice, + const model::SharedPageDescriptor& rpDescriptor) const; + void PaintPageNumber ( + OutputDevice& rDevice, + const model::SharedPageDescriptor& rpDescriptor) const; + void PaintTransitionEffect ( + OutputDevice& rDevice, + const model::SharedPageDescriptor& rpDescriptor) const; + void PaintBorder ( + OutputDevice& rDevice, + const Theme::GradientColorType eColorType, + const Rectangle& rBox) const; + Bitmap& GetBackgroundForState ( + const model::SharedPageDescriptor& rpDescriptor, + const OutputDevice& rTemplateDevice); + Bitmap& GetBackground( + Bitmap& rBackground, + Theme::GradientColorType eType, + const OutputDevice& rTemplateDevice, + const bool bHasFocusBorder); + Bitmap CreateBackgroundBitmap( + const OutputDevice& rReferenceDevice, + const Theme::GradientColorType eType, + const bool bHasFocusBorder) const; + Bitmap CreateMarkedPreview( + const Size& rSize, + const Bitmap& rPreview, + const BitmapEx& rOverlay, + const OutputDevice* pReferenceDevice) const; +}; + +} } } // end of namespace sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewContact.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewContact.hxx new file mode 100755 index 000000000000..31899d3b3e44 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewContact.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_PAGE_OBJECT_VIEW_CONTACT_HXX +#define SD_SLIDESORTER_PAGE_OBJECT_VIEW_CONTACT_HXX + +#include "model/SlsSharedPageDescriptor.hxx" +#include <svx/sdtakitm.hxx> +#include <svx/sdr/contact/viewcontactofpageobj.hxx> + +class SdrPageObj; + +namespace sdr {namespace contact { +class ViewObjectContact; +class ObjectContact; +} } + +namespace sd { namespace slidesorter { namespace view { + +/** Details: + This class has to provide the bounding box but can not determine it + fully because it has no access to the output device. It therefore + retrieves some of the necessary data, the border, from the + PageDescriptor which acts here as persistent storage. +*/ +class PageObjectViewContact + : public ::sdr::contact::ViewContactOfPageObj +{ +public: + PageObjectViewContact ( + SdrPageObj& rPageObj, + const model::SharedPageDescriptor& rpDescriptor); + ~PageObjectViewContact (void); + + /** Create a ViewObjectContact object that buffers its output in a + bitmap. + @return + Ownership of the new object passes to the caller. + */ + virtual ::sdr::contact::ViewObjectContact& + CreateObjectSpecificViewObjectContact( + ::sdr::contact::ObjectContact& rObjectContact); + + const SdrPage* GetPage (void) const; + + SdrPageObj& GetPageObject (void) const; + + virtual void ActionChanged (void); + +protected: + // create graphical visualisation data + virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const; + +private: + /** This flag is set to <TRUE/> when the destructor is called to + indicate that further calls made to it must not call outside. + */ + bool mbInDestructor; + + model::SharedPageDescriptor mpDescriptor; +}; + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx new file mode 100755 index 000000000000..7e884fc54797 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx @@ -0,0 +1,225 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_PAGE_OBJECT_VIEW_OBJECT_CONTACT_HXX +#define SD_SLIDESORTER_PAGE_OBJECT_VIEW_OBJECT_CONTACT_HXX + +#include <svx/sdr/contact/viewobjectcontactofpageobj.hxx> +#include "model/SlsSharedPageDescriptor.hxx" +#include <svx/sdr/contact/viewobjectcontact.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/image.hxx> +#include <sfx2/viewfrm.hxx> +#include <memory> +#include <boost/shared_ptr.hpp> + +class SdrPage; + +namespace sdr { namespace contact { +class DisplayInfo; +} } + +namespace sd { namespace slidesorter { namespace cache { +class PageCache; +} } } + +namespace sd { namespace slidesorter { namespace controller { +class Properties; +} } } + +namespace sd { namespace slidesorter { namespace view { + +class SlideSorterView; + +/** This object-view-contact of page objects maintains a preview bitmap for + the page to speed up redraws of the same. It does so by colaborating + with a cache of bitmaps (see ../cache). +*/ + +// needs to be derived from ViewObjectContactOfPageObj, else the calls to parent implementations +// would use ViewObjectContact and thus not enable e.g. the correct primitive creation +// for view-independent printer output +// changed: ViewObjectContact -> ViewObjectContactOfPageObj + +class PageObjectViewObjectContact : public ::sdr::contact::ViewObjectContactOfPageObj +{ +public: + /** Create a new view-object-contact object for the given contact + objects of both model and view. + @param pCache + The caller should provide a pointer to a preview cache, if + available. If given then the cache is used to control when to + create a preview and to store it. If NULL is given then the + preview is created every time when requested. + */ + PageObjectViewObjectContact ( + ::sdr::contact::ObjectContact& rObjectContact, + ::sdr::contact::ViewContact& rViewContact, + const ::boost::shared_ptr<cache::PageCache>& rpCache, + const ::boost::shared_ptr<controller::Properties>& rpProperties); + virtual ~PageObjectViewObjectContact (void); + + /** This method is primarily for releasing the current preview cache (by + providing a NULL pointer.) + */ + void SetCache (const ::boost::shared_ptr<cache::PageCache>& rpCache); + + /** Return the page that is painted by this object. + */ + const SdrPage* GetPage (void) const; + + /** This fallback method is called when no preview cache is available. + It creates a preview for the page. + */ + BitmapEx CreatePreview (const sdr::contact::DisplayInfo& rDisplayInfo); + + /** Return the page descriptor of the slide sorter model that is + associated with the same page object as this contact object is. + */ + model::SharedPageDescriptor GetPageDescriptor (void) const; + + /** Return the border widths in the screen coordinate system of the + border arround the page object. The border contains frames for + selection, focus, the page name and number, and the indicator for + the page transition. + @param pDevice + The output device is used to convert pixel coordinates into + model coordinates. When NULL is given then the device dependent + part is not re-calculated but taken from an earlier calculation + or from the default values. + @param nPageCount + The total number of pages is used to determine the width of the + box that contains the page number. + */ + static SvBorder CalculatePageModelBorder ( + OutputDevice* pDevice, + int nPageCount); + + /** Calculate the size of the page number area so that all page numbers + including the given number fit in. Because this is device dependent + we need the device as parameter. The result is returned and stored + in maPageNumberAreaPixelSize so that it can be used later without + access to the device or page count. + */ + static Size CalculatePageNumberAreaModelSize ( + OutputDevice* pDevice, + int nPageCount); + + /** Paint a mouse over effect. + @param bVisible + When bVisible is <FALSE/> then paint the area of the mouse over + effect in the background color, i.e. erase it. + */ + drawinglayer::primitive2d::Primitive2DSequence createMouseOverEffectPrimitive2DSequence(); + + enum BoundingBoxType { + // This is the outer bounding box that includes the preview, page + // number, title. + PageObjectBoundingBox, + // Bounding box of the actual preview. + PreviewBoundingBox, + // Bounding box of the mouse indicator indicator frame. + MouseOverIndicatorBoundingBox, + // Bounding box of the focus indicator frame. + FocusIndicatorBoundingBox, + // Bounding box of the selection indicator frame. + SelectionIndicatorBoundingBox, + // Bounding box of the page number. + PageNumberBoundingBox, + // Bounding box of the pane name. + NameBoundingBox, + FadeEffectIndicatorBoundingBox + }; + enum CoordinateSystem { ModelCoordinateSystem, PixelCoordinateSystem }; + + /** Return the bounding box of the page object or one of its graphical + parts. + @param rDevice + This device is used to translate between model and window + coordinates. + @param eType + The part of the page object for which to return the bounding + box. + @param eCoodinateSystem + The bounding box can be returned in model and in pixel + (window) coordinates. + */ + Rectangle GetBoundingBox ( + OutputDevice& rDevice, + BoundingBoxType eType, + CoordinateSystem eCoordinateSystem) const; + + // create the graphical visualisation data + virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const sdr::contact::DisplayInfo& rDisplayInfo) const; + + // access to the current page content primitive vector which may be used for visualisation + const drawinglayer::primitive2d::Primitive2DSequence& getCurrentPageContents() const { return mxCurrentPageContents; } + + virtual void ActionChanged (void); + +private: + /// Gap between border of page object and inside of selection rectangle. + static const sal_Int32 mnSelectionIndicatorOffset; + /// Thickness of the selection rectangle. + static const sal_Int32 mnSelectionIndicatorThickness; + /// Gap between border of page object and inside of focus rectangle. + static const sal_Int32 mnFocusIndicatorOffset; + /// Size of width and height of the fade effect indicator in pixels. + static const sal_Int32 mnFadeEffectIndicatorSize; + static const sal_Int32 mnFadeEffectIndicatorOffset; + /// Gap between border of page object and number rectangle. + static const sal_Int32 mnPageNumberOffset; + /// Offset and thickness of the mouse over effect rectangle. + static const sal_Int32 mnMouseOverEffectOffset; + static const sal_Int32 mnMouseOverEffectThickness; + + /** This flag is set to <TRUE/> when the destructor is called to + indicate that further calls made to it must not call outside. + */ + bool mbInDestructor; + + /// The primitive sequence of the page contents, completely scaled + /// and prepared for painiting + drawinglayer::primitive2d::Primitive2DSequence mxCurrentPageContents; + + ::boost::shared_ptr<cache::PageCache> mpCache; + + ::boost::shared_ptr<controller::Properties> mpProperties; + + BitmapEx GetPreview ( + const sdr::contact::DisplayInfo& rDisplayInfo, + const Rectangle& rNewSizePixel); + + /** Return the bounding box of where the page number is painted (when it + is painted). + */ + Rectangle GetPageNumberArea (OutputDevice& rDevice) const; +}; + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsResource.hrc b/sd/source/ui/slidesorter/inc/view/SlsResource.hrc new file mode 100644 index 000000000000..2b85a37d35dc --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsResource.hrc @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_ICONS_HRC +#define SD_SLIDESORTER_ICONS_HRC + +#include "glob.hrc" + +#define IMAGE_COMMAND1_LARGE 1 +#define IMAGE_COMMAND1_LARGE_HOVER 2 +#define IMAGE_COMMAND1_MEDIUM 3 +#define IMAGE_COMMAND1_MEDIUM_HOVER 4 +#define IMAGE_COMMAND1_SMALL 5 +#define IMAGE_COMMAND1_SMALL_HOVER 6 + +#define IMAGE_COMMAND1_LARGE_HC 7 +#define IMAGE_COMMAND1_LARGE_HOVER_HC 8 +#define IMAGE_COMMAND1_MEDIUM_HC 9 +#define IMAGE_COMMAND1_MEDIUM_HOVER_HC 10 +#define IMAGE_COMMAND1_SMALL_HC 11 +#define IMAGE_COMMAND1_SMALL_HOVER_HC 12 + + +#define IMAGE_COMMAND2_LARGE 20 +#define IMAGE_COMMAND2_LARGE_HOVER 21 +#define IMAGE_COMMAND2_MEDIUM 22 +#define IMAGE_COMMAND2_MEDIUM_HOVER 23 +#define IMAGE_COMMAND2_SMALL 24 +#define IMAGE_COMMAND2_SMALL_HOVER 25 + +#define IMAGE_COMMAND2_LARGE_HC 26 +#define IMAGE_COMMAND2_LARGE_HOVER_HC 27 +#define IMAGE_COMMAND2_MEDIUM_HC 28 +#define IMAGE_COMMAND2_MEDIUM_HOVER_HC 29 +#define IMAGE_COMMAND2_SMALL_HC 30 +#define IMAGE_COMMAND2_SMALL_HOVER_HC 31 + +#define IMAGE_COMMAND2B_LARGE 40 +#define IMAGE_COMMAND2B_LARGE_HOVER 41 +#define IMAGE_COMMAND2B_MEDIUM 42 +#define IMAGE_COMMAND2B_MEDIUM_HOVER 43 +#define IMAGE_COMMAND2B_SMALL 44 +#define IMAGE_COMMAND2B_SMALL_HOVER 45 + +#define IMAGE_COMMAND2B_LARGE_HC 46 +#define IMAGE_COMMAND2B_LARGE_HOVER_HC 47 +#define IMAGE_COMMAND2B_MEDIUM_HC 48 +#define IMAGE_COMMAND2B_MEDIUM_HOVER_HC 49 +#define IMAGE_COMMAND2B_SMALL_HC 50 +#define IMAGE_COMMAND2B_SMALL_HOVER_HC 51 + + +#define IMAGE_COMMAND3_LARGE 60 +#define IMAGE_COMMAND3_LARGE_HOVER 61 +#define IMAGE_COMMAND3_MEDIUM 62 +#define IMAGE_COMMAND3_MEDIUM_HOVER 63 +#define IMAGE_COMMAND3_SMALL 64 +#define IMAGE_COMMAND3_SMALL_HOVER 65 + +#define IMAGE_COMMAND3_LARGE_HC 66 +#define IMAGE_COMMAND3_LARGE_HOVER_HC 67 +#define IMAGE_COMMAND3_MEDIUM_HC 68 +#define IMAGE_COMMAND3_MEDIUM_HOVER_HC 69 +#define IMAGE_COMMAND3_SMALL_HC 70 +#define IMAGE_COMMAND3_SMALL_HOVER_HC 71 + +#define IMAGE_BUTTONBAR_LARGE 80 +#define IMAGE_BUTTONBAR_LARGE_HC 81 +#define IMAGE_BUTTONBAR_MEDIUM 82 +#define IMAGE_BUTTONBAR_MEDIUM_HC 83 +#define IMAGE_BUTTONBAR_SMALL 84 +#define IMAGE_BUTTONBAR_SMALL_HC 85 + +#define IMAGE_SHADOW 90 +#define IMAGE_INSERT_SHADOW 91 +#define IMAGE_HIDE_SLIDE_OVERLAY 92 +#define IMAGE_FOCUS_BORDER 93 + +#define STRING_DRAG_AND_DROP_PAGES 101 +#define STRING_DRAG_AND_DROP_SLIDES 102 + +#define STRING_COMMAND1 110 +#define STRING_COMMAND2_A 111 +#define STRING_COMMAND2_B 112 +#define STRING_COMMAND3 113 + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx new file mode 100644 index 000000000000..0781d8ea3519 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx @@ -0,0 +1,236 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_VIEW_THEME_HXX +#define SD_SLIDESORTER_VIEW_THEME_HXX + +#include "model/SlsVisualState.hxx" + +#include <vcl/bitmapex.hxx> +#include <vcl/font.hxx> +#include <vcl/gradient.hxx> +#include <tools/color.hxx> + +#include <boost/shared_ptr.hpp> +#include <boost/weak_ptr.hpp> + + +namespace sd { namespace slidesorter { namespace controller { +class Properties; +} } } + +namespace sd { namespace slidesorter { namespace view { + + +/** Collection of colors and styles that are used to paint the slide sorter + view. +*/ +class Theme +{ +public: + Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties); + + /** Call this method to update some colors as response to a change of + a system color change. + */ + void Update ( + const ::boost::shared_ptr<controller::Properties>& rpProperties); + + // BitmapEx GetInsertIndicatorIcon (void) const; + + enum FontType { + Font_PageNumber, + Font_PageCount, + Font_Button + }; + static ::boost::shared_ptr<Font> GetFont ( + const FontType eType, + const OutputDevice& rDevice); + + enum ColorType { + Color_Background, + Color_ButtonBackground, + Color_ButtonText, + Color_ButtonTextHover, + Color_PageNumberDefault, + Color_PageNumberHover, + Color_PageNumberHighContrast, + Color_PageNumberBrightBackground, + Color_PageNumberDarkBackground, + Color_Selection, + Color_PreviewBorder, + Color_PageCountFontColor, + _ColorType_Size_ + }; + ColorData GetColor (const ColorType eType); + void SetColor (const ColorType eType, const ColorData aColorData); + + enum GradientColorType { + Gradient_NormalPage, + Gradient_SelectedPage, + Gradient_SelectedAndFocusedPage, + Gradient_MouseOverPage, + Gradient_MouseOverSelectedAndFocusedPage, + Gradient_FocusedPage, + Gradient_ButtonBackground, + _GradientColorType_Size_ + }; + enum GradientColorClass { + Border1, + Border2, + Fill1, + 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 nSaturationOverride, + const sal_Int32 nBrightnessOverride, + const sal_Int32 nFillStartOffset, + const sal_Int32 nFillEndOffset, + const sal_Int32 nBorderStartOffset, + const sal_Int32 nBorderEndOffset); + sal_Int32 GetGradientSaturationOverride (const GradientColorType eType); + sal_Int32 GetGradientBrightnessOverride (const GradientColorType eType); + void SetGradientSaturationOverride (const GradientColorType eType, const sal_Int32 nValue); + void SetGradientBrightnessOverride (const GradientColorType eType, const sal_Int32 nValue); + + enum IconType + { + Icon_RawShadow, + Icon_RawInsertShadow, + Icon_HideSlideOverlay, + Icon_FocusBorder, + Icon_ButtonBarLarge, + Icon_ButtonBarMedium, + Icon_ButtonBarSmall, + Icon_Command1Large, + Icon_Command1LargeHover, + Icon_Command1Medium, + Icon_Command1MediumHover, + Icon_Command1Small, + Icon_Command1SmallHover, + Icon_Command2Large, + Icon_Command2LargeHover, + Icon_Command2Medium, + Icon_Command2MediumHover, + Icon_Command2Small, + Icon_Command2SmallHover, + Icon_Command2BLarge, + Icon_Command2BLargeHover, + Icon_Command2BMedium, + Icon_Command2BMediumHover, + Icon_Command2BSmall, + Icon_Command2BSmallHover, + Icon_Command3Large, + Icon_Command3LargeHover, + Icon_Command3Medium, + Icon_Command3MediumHover, + Icon_Command3Small, + Icon_Command3SmallHover, + _IconType_Size_ + }; + 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; + void SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValue); + + 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 + { + public: + ColorData maBaseColor; + + sal_Int32 mnSaturationOverride; + sal_Int32 mnBrightnessOverride; + + ColorData maFillColor1; + ColorData maFillColor2; + ColorData maBorderColor1; + ColorData maBorderColor2; + + sal_Int32 mnFillOffset1; + sal_Int32 mnFillOffset2; + sal_Int32 mnBorderOffset1; + sal_Int32 mnBorderOffset2; + }; + ColorData maBackgroundColor; + ColorData maPageBackgroundColor; + ::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); + /** Guarded initialization of the specified icon in the maIcons + container. Call only while a LocalResource object is active. + */ + void InitializeIcon (const IconType eType, sal_uInt16 nResourceId); +}; + + +} } } // end of namespace ::sd::slidesorter::view + +#endif diff --git a/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx b/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx new file mode 100644 index 000000000000..48a4c7c3d272 --- /dev/null +++ b/sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SLIDESORTER_VIEW_TOOL_TIP_HXX +#define SD_SLIDESORTER_VIEW_TOOL_TIP_HXX + +#include "SlideSorter.hxx" +#include "model/SlsSharedPageDescriptor.hxx" + +namespace sd { namespace slidesorter { namespace view { + +/** Manage the display of tool tips. The tool tip text changes when the + mouse is moved from slide to slide or from button to button. + After the mouse enters a slide the first display of the tool tip is + delayed for a short time in order to not draw attention from the slide + or its button bar. +*/ +class ToolTip +{ +public: + ToolTip (SlideSorter& rSlideSorter); + ~ToolTip (void); + + /** Set a new page. This modifies the default help text. After a page + change a timer is started to delay the display of the tool tip for + the new page. + @param rpPage + When this is empty then the tool tip is hidden. + */ + void SetPage (const model::SharedPageDescriptor& rpPage); + + /** Set and show the default help text. + */ + void ShowDefaultHelpText (const ::rtl::OUString& rsHelpText); + + /** Show a previously set default help text. + */ + void ShowDefaultHelpText (void); + + /** Show a temporary help text. + */ + void ShowHelpText (const ::rtl::OUString& rsHelpText); + + /** Hide the tool tip. + @return + Returns whether the tool tip was visible at the time this method + was called. + */ + bool Hide (void); + +private: + SlideSorter& mrSlideSorter; + model::SharedPageDescriptor mpDescriptor; + ::rtl::OUString msDefaultHelpText; + ::rtl::OUString msCurrentHelpText; + sal_uLong mnHelpWindowHandle; + Timer maTimer; + + /** Request to show the tool tip. + @param bForce + When <TRUE/> then the tool tip is show right away. Otherwise it + is shown after a short delay. + */ + void Show (const bool bForce); + void DoShow (void); + + DECL_LINK(DelayTrigger, void*); +}; + + +} } } // end of namespace ::sd::slidesorter::view + +#endif |