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 119 //===== Drag and Drop ===================================================== 120 121 virtual void StartDrag ( 122 const Point& rDragPt, 123 ::Window* pWindow ); 124 virtual void DragFinished ( 125 sal_Int8 nDropAction); 126 virtual sal_Int8 AcceptDrop ( 127 const AcceptDropEvent& rEvt, 128 DropTargetHelper& rTargetHelper, 129 ::sd::Window* pTargetWindow = NULL, 130 sal_uInt16 nPage = SDRPAGE_NOTFOUND, 131 sal_uInt16 nLayer = SDRPAGE_NOTFOUND ); 132 virtual sal_Int8 ExecuteDrop ( 133 const ExecuteDropEvent& rEvt, 134 DropTargetHelper& rTargetHelper, 135 ::sd::Window* pTargetWindow = NULL, 136 sal_uInt16 nPage = SDRPAGE_NOTFOUND, 137 sal_uInt16 nLayer = SDRPAGE_NOTFOUND); 138 139 typedef ::std::vector<SdPage*> PageSelection; 140 141 /** Return the set of selected pages. 142 */ 143 ::boost::shared_ptr<PageSelection> GetPageSelection (void) const; 144 145 void SetPageSelection (const ::boost::shared_ptr<PageSelection>& rSelection); 146 147 /** Add a listener that is called when the selection of the slide sorter 148 changes. 149 @param rListener 150 When this method is called multiple times for the same listener 151 the second and all following calls are ignored. Each listener 152 is added only once. 153 */ 154 void AddSelectionChangeListener (const Link& rListener); 155 156 /** Remove a listener that was called when the selection of the slide 157 sorter changes. 158 @param rListener 159 It is save to pass a listener that was not added are has been 160 removed previously. Such calls are ignored. 161 */ 162 void RemoveSelectionChangeListener (const Link& rListener); 163 164 virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void); 165 166 /** Create an accessible object representing the specified window. 167 @param pWindow 168 The returned object makes the document displayed in this window 169 accessible. 170 @return 171 Returns an <type>AccessibleSlideSorterView</type> object. 172 */ 173 virtual ::com::sun::star::uno::Reference< 174 ::com::sun::star::accessibility::XAccessible> 175 CreateAccessibleDocumentView (::sd::Window* pWindow); 176 177 SlideSorter& GetSlideSorter (void) const; 178 179 /** Try to relocate all toplevel window elements to the given parent 180 window. 181 */ 182 virtual bool RelocateToParentWindow (::Window* pParentWindow); 183 184 protected: 185 186 virtual SvBorder GetBorder (bool bOuterResize); 187 188 /** This method is overloaded to handle a missing tool bar correctly. 189 This is the case when the slide sorter is not the main view shell. 190 */ 191 virtual ::svl::IUndoManager* ImpGetUndoManager (void) const; 192 193 private: 194 ::boost::shared_ptr<SlideSorter> mpSlideSorter; 195 bool mbIsArrangeGUIElementsPending; 196 197 SlideSorterViewShell ( 198 SfxViewFrame* pFrame, 199 ViewShellBase& rViewShellBase, 200 ::Window* pParentWindow, 201 FrameView* pFrameView); 202 void Initialize (void); 203 204 /** This method overwrites the one from our base class: We do our own 205 scroll bar and the base class call is thus unnecessary. It simply 206 calls UpdateScrollBars(false). 207 */ 208 virtual void UpdateScrollBars (void); 209 }; 210 211 typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection; 212 213 } } // end of namespace ::sd::slidesorter 214 215 #endif 216