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