1c45d927aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5c45d927aSAndrew Rist * distributed with this work for additional information 6c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8c45d927aSAndrew Rist * "License"); you may not use this file except in compliance 9c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at 10c45d927aSAndrew Rist * 11c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12c45d927aSAndrew Rist * 13c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14c45d927aSAndrew Rist * software distributed under the License is distributed on an 15c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16c45d927aSAndrew Rist * KIND, either express or implied. See the License for the 17c45d927aSAndrew Rist * specific language governing permissions and limitations 18c45d927aSAndrew Rist * under the License. 19c45d927aSAndrew Rist * 20c45d927aSAndrew Rist *************************************************************/ 21c45d927aSAndrew Rist 22c45d927aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SD_SLIDESORTER_SLIDE_SORTER_VIEW_SHELL_HXX 25cdf0e10cSrcweir #define SD_SLIDESORTER_SLIDE_SORTER_VIEW_SHELL_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "ViewShell.hxx" 28cdf0e10cSrcweir #include "glob.hxx" 29cdf0e10cSrcweir #include <sfx2/shell.hxx> 30cdf0e10cSrcweir #include <sfx2/viewfac.hxx> 31cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 32cdf0e10cSrcweir #include <vector> 33cdf0e10cSrcweir 34cdf0e10cSrcweir namespace sd { namespace slidesorter { namespace controller { 35cdf0e10cSrcweir class SlotManager; 36cdf0e10cSrcweir } } } 37cdf0e10cSrcweir 38cdf0e10cSrcweir 39cdf0e10cSrcweir namespace sd { namespace slidesorter { 40cdf0e10cSrcweir 41cdf0e10cSrcweir class SlideSorter; 42cdf0e10cSrcweir 43cdf0e10cSrcweir class SlideSorterViewShell 44cdf0e10cSrcweir : public ViewShell 45cdf0e10cSrcweir { 46cdf0e10cSrcweir friend class controller::SlotManager; 47cdf0e10cSrcweir 48cdf0e10cSrcweir public: 49cdf0e10cSrcweir TYPEINFO(); 50cdf0e10cSrcweir SFX_DECL_INTERFACE(SD_IF_SDSLIDESORTERVIEWSHELL) 51cdf0e10cSrcweir 52cdf0e10cSrcweir static ::boost::shared_ptr<SlideSorterViewShell> Create( 53cdf0e10cSrcweir SfxViewFrame* pFrame, 54cdf0e10cSrcweir ViewShellBase& rViewShellBase, 55cdf0e10cSrcweir ::Window* pParentWindow, 56cdf0e10cSrcweir FrameView* pFrameView, 57cdf0e10cSrcweir const bool bIsCenterPane); 58cdf0e10cSrcweir 59cdf0e10cSrcweir virtual ~SlideSorterViewShell (void); 60cdf0e10cSrcweir 61cdf0e10cSrcweir /** Late initialization that has to be called after a new instance has 62cdf0e10cSrcweir completed its construction. 63cdf0e10cSrcweir */ 64cdf0e10cSrcweir virtual void Init (bool bIsMainViewShell); 65cdf0e10cSrcweir 66cdf0e10cSrcweir /** Return a slide sorter that is currently displayed in one of the 67cdf0e10cSrcweir panes that belong to the given ViewShellBase object. 68cdf0e10cSrcweir When there is only one slide sorter visible then that one is 69cdf0e10cSrcweir returned. When two (or more) are visible then the one in the center 70cdf0e10cSrcweir pane is returned. When no slidesorter is visible then NULL is 71cdf0e10cSrcweir returned. 72cdf0e10cSrcweir */ 73cdf0e10cSrcweir static SlideSorterViewShell* GetSlideSorter (ViewShellBase& rBase); 74cdf0e10cSrcweir 75cdf0e10cSrcweir virtual void GetFocus (void); 76cdf0e10cSrcweir virtual void LoseFocus (void); 77cdf0e10cSrcweir virtual SdPage* GetActualPage (void); 78cdf0e10cSrcweir 79cdf0e10cSrcweir /// inherited from sd::ViewShell 80cdf0e10cSrcweir virtual SdPage* getCurrentPage() const; 81cdf0e10cSrcweir 82cdf0e10cSrcweir void ExecCtrl (SfxRequest& rRequest); 83cdf0e10cSrcweir virtual void GetCtrlState (SfxItemSet &rSet); 84cdf0e10cSrcweir virtual void FuSupport (SfxRequest& rRequest); 85cdf0e10cSrcweir virtual void FuTemporary (SfxRequest& rRequest); 86cdf0e10cSrcweir virtual void GetStatusBarState (SfxItemSet& rSet); 87cdf0e10cSrcweir virtual void FuPermanent (SfxRequest& rRequest); 88cdf0e10cSrcweir void GetAttrState (SfxItemSet& rSet); 89cdf0e10cSrcweir void ExecStatusBar (SfxRequest& rRequest); 90cdf0e10cSrcweir virtual void Command (const CommandEvent& rEvent, ::sd::Window* pWindow); 91cdf0e10cSrcweir virtual void GetMenuState (SfxItemSet &rSet); 92cdf0e10cSrcweir virtual void GetClipboardState (SfxItemSet &rSet); 93cdf0e10cSrcweir 94cdf0e10cSrcweir virtual void ReadFrameViewData (FrameView* pView); 95cdf0e10cSrcweir virtual void WriteFrameViewData (void); 96cdf0e10cSrcweir 97cdf0e10cSrcweir /** Set the zoom factor. The given value is clipped against an upper 98cdf0e10cSrcweir bound. 99cdf0e10cSrcweir @param nZoom 100cdf0e10cSrcweir An integer percent value, i.e. nZoom/100 is the actual zoom 101cdf0e10cSrcweir factor. 102cdf0e10cSrcweir */ 103cdf0e10cSrcweir virtual void SetZoom (long int nZoom); 104cdf0e10cSrcweir virtual void SetZoomRect (const Rectangle& rZoomRect); 105cdf0e10cSrcweir 106cdf0e10cSrcweir /** This is a callback method used by the active window to delegate its 107cdf0e10cSrcweir Paint() call to. This view shell itself delegates it to the view. 108cdf0e10cSrcweir */ 109cdf0e10cSrcweir virtual void Paint(const Rectangle& rRect, ::sd::Window* pWin); 110cdf0e10cSrcweir 111cdf0e10cSrcweir /** Place and size the controls and windows. You may want to call this 112cdf0e10cSrcweir method when something has changed that for instance affects the 113cdf0e10cSrcweir visibility state of the scroll bars. 114cdf0e10cSrcweir */ 115cdf0e10cSrcweir virtual void ArrangeGUIElements (void); 116cdf0e10cSrcweir 117cdf0e10cSrcweir virtual void Activate (sal_Bool IsMDIActivate); 118f120fe41SAndre Fischer virtual void Deactivate (sal_Bool IsMDIActivate); 119cdf0e10cSrcweir 120cdf0e10cSrcweir //===== Drag and Drop ===================================================== 121cdf0e10cSrcweir 122cdf0e10cSrcweir virtual void StartDrag ( 123cdf0e10cSrcweir const Point& rDragPt, 124cdf0e10cSrcweir ::Window* pWindow ); 125cdf0e10cSrcweir virtual void DragFinished ( 126cdf0e10cSrcweir sal_Int8 nDropAction); 127cdf0e10cSrcweir virtual sal_Int8 AcceptDrop ( 128cdf0e10cSrcweir const AcceptDropEvent& rEvt, 129cdf0e10cSrcweir DropTargetHelper& rTargetHelper, 130cdf0e10cSrcweir ::sd::Window* pTargetWindow = NULL, 131cdf0e10cSrcweir sal_uInt16 nPage = SDRPAGE_NOTFOUND, 132cdf0e10cSrcweir sal_uInt16 nLayer = SDRPAGE_NOTFOUND ); 133cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop ( 134cdf0e10cSrcweir const ExecuteDropEvent& rEvt, 135cdf0e10cSrcweir DropTargetHelper& rTargetHelper, 136cdf0e10cSrcweir ::sd::Window* pTargetWindow = NULL, 137cdf0e10cSrcweir sal_uInt16 nPage = SDRPAGE_NOTFOUND, 138cdf0e10cSrcweir sal_uInt16 nLayer = SDRPAGE_NOTFOUND); 139cdf0e10cSrcweir 140cdf0e10cSrcweir typedef ::std::vector<SdPage*> PageSelection; 141cdf0e10cSrcweir 142cdf0e10cSrcweir /** Return the set of selected pages. 143cdf0e10cSrcweir */ 144cdf0e10cSrcweir ::boost::shared_ptr<PageSelection> GetPageSelection (void) const; 145cdf0e10cSrcweir 146cdf0e10cSrcweir void SetPageSelection (const ::boost::shared_ptr<PageSelection>& rSelection); 147cdf0e10cSrcweir 148cdf0e10cSrcweir /** Add a listener that is called when the selection of the slide sorter 149cdf0e10cSrcweir changes. 150cdf0e10cSrcweir @param rListener 151cdf0e10cSrcweir When this method is called multiple times for the same listener 152cdf0e10cSrcweir the second and all following calls are ignored. Each listener 153cdf0e10cSrcweir is added only once. 154cdf0e10cSrcweir */ 155cdf0e10cSrcweir void AddSelectionChangeListener (const Link& rListener); 156cdf0e10cSrcweir 157cdf0e10cSrcweir /** Remove a listener that was called when the selection of the slide 158cdf0e10cSrcweir sorter changes. 159cdf0e10cSrcweir @param rListener 160cdf0e10cSrcweir It is save to pass a listener that was not added are has been 161cdf0e10cSrcweir removed previously. Such calls are ignored. 162cdf0e10cSrcweir */ 163cdf0e10cSrcweir void RemoveSelectionChangeListener (const Link& rListener); 164cdf0e10cSrcweir 165cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void); 166cdf0e10cSrcweir 167cdf0e10cSrcweir /** Create an accessible object representing the specified window. 168cdf0e10cSrcweir @param pWindow 169cdf0e10cSrcweir The returned object makes the document displayed in this window 170cdf0e10cSrcweir accessible. 171cdf0e10cSrcweir @return 172cdf0e10cSrcweir Returns an <type>AccessibleSlideSorterView</type> object. 173cdf0e10cSrcweir */ 174cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 175cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible> 176cdf0e10cSrcweir CreateAccessibleDocumentView (::sd::Window* pWindow); 177*0deba7fbSSteve Yin // handle SlideSorterView specially because AccessibleSlideSorterView doesn't inherit from AccessibleDocumentViewBase 178*0deba7fbSSteve Yin virtual void SwitchViewFireFocus( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc ); 179cdf0e10cSrcweir 180cdf0e10cSrcweir SlideSorter& GetSlideSorter (void) const; 181cdf0e10cSrcweir 182cdf0e10cSrcweir /** Try to relocate all toplevel window elements to the given parent 183cdf0e10cSrcweir window. 184cdf0e10cSrcweir */ 185cdf0e10cSrcweir virtual bool RelocateToParentWindow (::Window* pParentWindow); 186cdf0e10cSrcweir 187cdf0e10cSrcweir protected: 188cdf0e10cSrcweir 189cdf0e10cSrcweir virtual SvBorder GetBorder (bool bOuterResize); 190cdf0e10cSrcweir 191cdf0e10cSrcweir /** This method is overloaded to handle a missing tool bar correctly. 192cdf0e10cSrcweir This is the case when the slide sorter is not the main view shell. 193cdf0e10cSrcweir */ 194cdf0e10cSrcweir virtual ::svl::IUndoManager* ImpGetUndoManager (void) const; 195cdf0e10cSrcweir 196cdf0e10cSrcweir private: 197cdf0e10cSrcweir ::boost::shared_ptr<SlideSorter> mpSlideSorter; 198cdf0e10cSrcweir bool mbIsArrangeGUIElementsPending; 199cdf0e10cSrcweir 200cdf0e10cSrcweir SlideSorterViewShell ( 201cdf0e10cSrcweir SfxViewFrame* pFrame, 202cdf0e10cSrcweir ViewShellBase& rViewShellBase, 203cdf0e10cSrcweir ::Window* pParentWindow, 204cdf0e10cSrcweir FrameView* pFrameView); 205cdf0e10cSrcweir void Initialize (void); 206cdf0e10cSrcweir 207cdf0e10cSrcweir /** This method overwrites the one from our base class: We do our own 208cdf0e10cSrcweir scroll bar and the base class call is thus unnecessary. It simply 209cdf0e10cSrcweir calls UpdateScrollBars(false). 210cdf0e10cSrcweir */ 211cdf0e10cSrcweir virtual void UpdateScrollBars (void); 212cdf0e10cSrcweir }; 213cdf0e10cSrcweir 214cdf0e10cSrcweir typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection; 215cdf0e10cSrcweir 216cdf0e10cSrcweir } } // end of namespace ::sd::slidesorter 217cdf0e10cSrcweir 218cdf0e10cSrcweir #endif 219