Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SD_SOURCE_UI_INC_SLIDESORTERVIEWSHELL_HXX
21 : #define INCLUDED_SD_SOURCE_UI_INC_SLIDESORTERVIEWSHELL_HXX
22 :
23 : #include "ViewShell.hxx"
24 : #include "glob.hxx"
25 : #include <sfx2/shell.hxx>
26 : #include <sfx2/viewfac.hxx>
27 : #include <boost/shared_ptr.hpp>
28 : #include <vector>
29 :
30 : namespace sd { namespace slidesorter { namespace controller {
31 : class SlotManager;
32 : } } }
33 :
34 : namespace sd { namespace slidesorter {
35 :
36 : class SlideSorter;
37 :
38 : class SlideSorterViewShell
39 : : public ViewShell
40 : {
41 : friend class controller::SlotManager;
42 :
43 : public:
44 : TYPEINFO_OVERRIDE();
45 36 : SFX_DECL_INTERFACE(SD_IF_SDSLIDESORTERVIEWSHELL)
46 :
47 : private:
48 : /// SfxInterface initializer.
49 : static void InitInterface_Impl();
50 :
51 : public:
52 : static ::boost::shared_ptr<SlideSorterViewShell> Create(
53 : SfxViewFrame* pFrame,
54 : ViewShellBase& rViewShellBase,
55 : ::vcl::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) SAL_OVERRIDE;
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) SAL_OVERRIDE;
78 :
79 : /// inherited from sd::ViewShell
80 : virtual SdPage* getCurrentPage() const SAL_OVERRIDE;
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) SAL_OVERRIDE;
91 : virtual void GetMenuState (SfxItemSet &rSet);
92 : virtual void GetClipboardState (SfxItemSet &rSet);
93 :
94 : virtual void ReadFrameViewData (FrameView* pView) SAL_OVERRIDE;
95 : virtual void WriteFrameViewData (void) SAL_OVERRIDE;
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) SAL_OVERRIDE;
104 : virtual void SetZoomRect (const Rectangle& rZoomRect) SAL_OVERRIDE;
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) SAL_OVERRIDE;
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) SAL_OVERRIDE;
116 :
117 : virtual void Activate (bool IsMDIActivate) SAL_OVERRIDE;
118 : virtual void Deactivate (bool IsMDIActivate) SAL_OVERRIDE;
119 :
120 : //===== Drag and Drop =====================================================
121 :
122 : virtual void StartDrag (
123 : const Point& rDragPt,
124 : ::vcl::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 ) SAL_OVERRIDE;
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) SAL_OVERRIDE;
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) SAL_OVERRIDE;
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) SAL_OVERRIDE;
177 : // handle SlideSorterView specially because AccessibleSlideSorterView doesn't inherit from AccessibleDocumentViewBase
178 : virtual void SwitchViewFireFocus( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc ) SAL_OVERRIDE;
179 :
180 : SlideSorter& GetSlideSorter (void) const;
181 :
182 : /** Try to relocate all toplevel window elements to the given parent
183 : window.
184 : */
185 : virtual bool RelocateToParentWindow (::vcl::Window* pParentWindow) SAL_OVERRIDE;
186 :
187 : protected:
188 :
189 : virtual SvBorder GetBorder (bool bOuterResize);
190 :
191 : /** This method is overloaded to handle a missing tool bar correctly.
192 : This is the case when the slide sorter is not the main view shell.
193 : */
194 : virtual ::svl::IUndoManager* ImpGetUndoManager (void) const SAL_OVERRIDE;
195 :
196 : private:
197 : ::boost::shared_ptr<SlideSorter> mpSlideSorter;
198 : bool mbIsArrangeGUIElementsPending;
199 :
200 : SlideSorterViewShell (
201 : SfxViewFrame* pFrame,
202 : ViewShellBase& rViewShellBase,
203 : vcl::Window* pParentWindow,
204 : FrameView* pFrameView);
205 : void Initialize (void);
206 :
207 : /** This method overwrites the one from our base class: We do our own
208 : scroll bar and the base class call is thus unnecessary. It simply
209 : calls UpdateScrollBars(false).
210 : */
211 : virtual void UpdateScrollBars (void) SAL_OVERRIDE;
212 : };
213 :
214 : typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection;
215 :
216 : } } // end of namespace ::sd::slidesorter
217 :
218 : #endif
219 :
220 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|