merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / inc / SlideSorterViewShell.hxx
blob385929c3a3380caff2d4cb56304c20be017b55fb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlideSorterViewShell.hxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_SLIDESORTER_SLIDE_SORTER_VIEW_SHELL_HXX
32 #define SD_SLIDESORTER_SLIDE_SORTER_VIEW_SHELL_HXX
34 #include "ViewShell.hxx"
35 #include "glob.hxx"
36 #include <sfx2/shell.hxx>
37 #include <sfx2/viewfac.hxx>
38 #include <boost/shared_ptr.hpp>
39 #include <vector>
41 namespace sd { namespace slidesorter { namespace controller {
42 class SlotManager;
43 } } }
46 namespace sd { namespace slidesorter {
48 class SlideSorter;
50 class SlideSorterViewShell
51 : public ViewShell
53 friend class controller::SlotManager;
55 public:
56 TYPEINFO();
57 SFX_DECL_INTERFACE(SD_IF_SDSLIDESORTERVIEWSHELL)
59 static SfxShell* CreateInstance (
60 sal_Int32 nId,
61 SfxShell* pParent,
62 void* pUserData,
63 ViewShellBase& rBase);
65 static ::boost::shared_ptr<SlideSorterViewShell> Create(
66 SfxViewFrame* pFrame,
67 ViewShellBase& rViewShellBase,
68 ::Window* pParentWindow,
69 FrameView* pFrameView);
71 virtual ~SlideSorterViewShell (void);
73 /** Late initialization that has to be called after a new instance has
74 completed its construction.
76 virtual void Init (bool bIsMainViewShell);
78 /** Return a slide sorter that is currently displayed in one of the
79 panes that belong to the given ViewShellBase object.
80 When there is only one slide sorter visible then that one is
81 returned. When two (or more) are visible then the one in the center
82 pane is returned. When no slidesorter is visible then NULL is
83 returned.
85 static SlideSorterViewShell* GetSlideSorter (ViewShellBase& rBase);
87 virtual void GetFocus (void);
88 virtual void LoseFocus (void);
89 virtual SdPage* GetActualPage (void);
91 /// inherited from sd::ViewShell
92 virtual SdPage* getCurrentPage() const;
94 void ExecCtrl (SfxRequest& rRequest);
95 virtual void GetCtrlState (SfxItemSet &rSet);
96 virtual void FuSupport (SfxRequest& rRequest);
97 virtual void FuTemporary (SfxRequest& rRequest);
98 virtual void GetStatusBarState (SfxItemSet& rSet);
99 virtual void FuPermanent (SfxRequest& rRequest);
100 void GetAttrState (SfxItemSet& rSet);
101 void ExecStatusBar (SfxRequest& rRequest);
102 virtual void Command (const CommandEvent& rEvent, ::sd::Window* pWindow);
103 virtual void GetMenuState (SfxItemSet &rSet);
104 virtual void GetClipboardState (SfxItemSet &rSet);
106 virtual void ReadFrameViewData (FrameView* pView);
107 virtual void WriteFrameViewData (void);
109 /** Set the zoom factor. The given value is clipped against an upper
110 bound.
111 @param nZoom
112 An integer percent value, i.e. nZoom/100 is the actual zoom
113 factor.
115 virtual void SetZoom (long int nZoom);
116 virtual void SetZoomRect (const Rectangle& rZoomRect);
118 /// forward VCLs PrePaint window event to DrawingLayer
119 virtual void PrePaint();
121 /** This is a callback method used by the active window to delegate its
122 Paint() call to. This view shell itself delegates it to the view.
124 virtual void Paint(const Rectangle& rRect, ::sd::Window* pWin);
126 /** Place and size the controls and windows. You may want to call this
127 method when something has changed that for instance affects the
128 visibility state of the scroll bars.
130 virtual void ArrangeGUIElements (void);
132 //===== Drag and Drop =====================================================
134 virtual void StartDrag (
135 const Point& rDragPt,
136 ::Window* pWindow );
137 virtual void DragFinished (
138 sal_Int8 nDropAction);
139 virtual sal_Int8 AcceptDrop (
140 const AcceptDropEvent& rEvt,
141 DropTargetHelper& rTargetHelper,
142 ::sd::Window* pTargetWindow = NULL,
143 USHORT nPage = SDRPAGE_NOTFOUND,
144 USHORT nLayer = SDRPAGE_NOTFOUND );
145 virtual sal_Int8 ExecuteDrop (
146 const ExecuteDropEvent& rEvt,
147 DropTargetHelper& rTargetHelper,
148 ::sd::Window* pTargetWindow = NULL,
149 USHORT nPage = SDRPAGE_NOTFOUND,
150 USHORT nLayer = SDRPAGE_NOTFOUND);
152 typedef ::std::vector<SdPage*> PageSelection;
154 /** Return the set of selected pages.
156 ::boost::shared_ptr<PageSelection> GetPageSelection (void) const;
158 void SetPageSelection (const ::boost::shared_ptr<PageSelection>& rSelection);
160 /** Add a listener that is called when the selection of the slide sorter
161 changes.
162 @param rListener
163 When this method is called multiple times for the same listener
164 the second and all following calls are ignored. Each listener
165 is added only once.
167 void AddSelectionChangeListener (const Link& rListener);
169 /** Remove a listener that was called when the selection of the slide
170 sorter changes.
171 @param rListener
172 It is save to pass a listener that was not added are has been
173 removed previously. Such calls are ignored.
175 void RemoveSelectionChangeListener (const Link& rListener);
177 virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
179 /** Create an accessible object representing the specified window.
180 @param pWindow
181 The returned object makes the document displayed in this window
182 accessible.
183 @return
184 Returns an <type>AccessibleSlideSorterView</type> object.
186 virtual ::com::sun::star::uno::Reference<
187 ::com::sun::star::accessibility::XAccessible>
188 CreateAccessibleDocumentView (::sd::Window* pWindow);
190 SlideSorter& GetSlideSorter (void) const;
192 /** Try to relocate all toplevel window elements to the given parent
193 window.
195 virtual bool RelocateToParentWindow (::Window* pParentWindow);
197 protected:
199 virtual SvBorder GetBorder (bool bOuterResize);
201 /** This method is overloaded to handle a missing tool bar correctly.
202 This is the case when the slide sorter is not the main view shell.
204 virtual SfxUndoManager* ImpGetUndoManager (void) const;
206 private:
207 ::boost::shared_ptr<SlideSorter> mpSlideSorter;
209 SlideSorterViewShell (
210 SfxViewFrame* pFrame,
211 ViewShellBase& rViewShellBase,
212 ::Window* pParentWindow,
213 FrameView* pFrameView);
214 void Initialize (void);
216 /** This method overwrites the one from our base class: We do our own
217 scroll bar and the base class call is thus unnecessary. It simply
218 calls UpdateScrollBars(false).
220 virtual void UpdateScrollBars (void);
223 typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection;
225 } } // end of namespace ::sd::slidesorter
227 #endif