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 :
35 : namespace sd { namespace slidesorter {
36 :
37 : class SlideSorter;
38 :
39 : class SlideSorterViewShell
40 : : public ViewShell
41 : {
42 : friend class controller::SlotManager;
43 :
44 : public:
45 : TYPEINFO_OVERRIDE();
46 0 : SFX_DECL_INTERFACE(SD_IF_SDSLIDESORTERVIEWSHELL)
47 :
48 : static ::boost::shared_ptr<SlideSorterViewShell> Create(
49 : SfxViewFrame* pFrame,
50 : ViewShellBase& rViewShellBase,
51 : ::Window* pParentWindow,
52 : FrameView* pFrameView,
53 : const bool bIsCenterPane);
54 :
55 : virtual ~SlideSorterViewShell (void);
56 :
57 : /** Late initialization that has to be called after a new instance has
58 : completed its construction.
59 : */
60 : virtual void Init (bool bIsMainViewShell) SAL_OVERRIDE;
61 :
62 : /** Return a slide sorter that is currently displayed in one of the
63 : panes that belong to the given ViewShellBase object.
64 : When there is only one slide sorter visible then that one is
65 : returned. When two (or more) are visible then the one in the center
66 : pane is returned. When no slidesorter is visible then NULL is
67 : returned.
68 : */
69 : static SlideSorterViewShell* GetSlideSorter (ViewShellBase& rBase);
70 :
71 : virtual void GetFocus (void);
72 : virtual void LoseFocus (void);
73 : virtual SdPage* GetActualPage (void) SAL_OVERRIDE;
74 :
75 : /// inherited from sd::ViewShell
76 : virtual SdPage* getCurrentPage() const SAL_OVERRIDE;
77 :
78 : void ExecCtrl (SfxRequest& rRequest);
79 : virtual void GetCtrlState (SfxItemSet &rSet);
80 : virtual void FuSupport (SfxRequest& rRequest);
81 : virtual void FuTemporary (SfxRequest& rRequest);
82 : virtual void GetStatusBarState (SfxItemSet& rSet);
83 : virtual void FuPermanent (SfxRequest& rRequest);
84 : void GetAttrState (SfxItemSet& rSet);
85 : void ExecStatusBar (SfxRequest& rRequest);
86 : virtual void Command (const CommandEvent& rEvent, ::sd::Window* pWindow) SAL_OVERRIDE;
87 : virtual void GetMenuState (SfxItemSet &rSet);
88 : virtual void GetClipboardState (SfxItemSet &rSet);
89 :
90 : virtual void ReadFrameViewData (FrameView* pView) SAL_OVERRIDE;
91 : virtual void WriteFrameViewData (void) SAL_OVERRIDE;
92 :
93 : /** Set the zoom factor. The given value is clipped against an upper
94 : bound.
95 : @param nZoom
96 : An integer percent value, i.e. nZoom/100 is the actual zoom
97 : factor.
98 : */
99 : virtual void SetZoom (long int nZoom) SAL_OVERRIDE;
100 : virtual void SetZoomRect (const Rectangle& rZoomRect) SAL_OVERRIDE;
101 :
102 : /** This is a callback method used by the active window to delegate its
103 : Paint() call to. This view shell itself delegates it to the view.
104 : */
105 : virtual void Paint(const Rectangle& rRect, ::sd::Window* pWin) SAL_OVERRIDE;
106 :
107 : /** Place and size the controls and windows. You may want to call this
108 : method when something has changed that for instance affects the
109 : visibility state of the scroll bars.
110 : */
111 : virtual void ArrangeGUIElements (void) SAL_OVERRIDE;
112 :
113 : virtual void Activate (bool IsMDIActivate) SAL_OVERRIDE;
114 : virtual void Deactivate (bool IsMDIActivate) SAL_OVERRIDE;
115 :
116 : //===== Drag and Drop =====================================================
117 :
118 : virtual void StartDrag (
119 : const Point& rDragPt,
120 : ::Window* pWindow );
121 : virtual void DragFinished (
122 : sal_Int8 nDropAction);
123 : virtual sal_Int8 AcceptDrop (
124 : const AcceptDropEvent& rEvt,
125 : DropTargetHelper& rTargetHelper,
126 : ::sd::Window* pTargetWindow = NULL,
127 : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
128 : sal_uInt16 nLayer = SDRPAGE_NOTFOUND ) SAL_OVERRIDE;
129 : virtual sal_Int8 ExecuteDrop (
130 : const ExecuteDropEvent& rEvt,
131 : DropTargetHelper& rTargetHelper,
132 : ::sd::Window* pTargetWindow = NULL,
133 : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
134 : sal_uInt16 nLayer = SDRPAGE_NOTFOUND) SAL_OVERRIDE;
135 :
136 : typedef ::std::vector<SdPage*> PageSelection;
137 :
138 : /** Return the set of selected pages.
139 : */
140 : ::boost::shared_ptr<PageSelection> GetPageSelection (void) const;
141 :
142 : void SetPageSelection (const ::boost::shared_ptr<PageSelection>& rSelection);
143 :
144 : /** Add a listener that is called when the selection of the slide sorter
145 : changes.
146 : @param rListener
147 : When this method is called multiple times for the same listener
148 : the second and all following calls are ignored. Each listener
149 : is added only once.
150 : */
151 : void AddSelectionChangeListener (const Link& rListener);
152 :
153 : /** Remove a listener that was called when the selection of the slide
154 : sorter changes.
155 : @param rListener
156 : It is save to pass a listener that was not added are has been
157 : removed previously. Such calls are ignored.
158 : */
159 : void RemoveSelectionChangeListener (const Link& rListener);
160 :
161 : virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void) SAL_OVERRIDE;
162 :
163 : /** Create an accessible object representing the specified window.
164 : @param pWindow
165 : The returned object makes the document displayed in this window
166 : accessible.
167 : @return
168 : Returns an <type>AccessibleSlideSorterView</type> object.
169 : */
170 : virtual ::com::sun::star::uno::Reference<
171 : ::com::sun::star::accessibility::XAccessible>
172 : CreateAccessibleDocumentView (::sd::Window* pWindow) SAL_OVERRIDE;
173 : // handle SlideSorterView specially because AccessibleSlideSorterView doesn't inherit from AccessibleDocumentViewBase
174 : virtual void SwitchViewFireFocus( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc ) SAL_OVERRIDE;
175 :
176 : SlideSorter& GetSlideSorter (void) const;
177 :
178 : /** Try to relocate all toplevel window elements to the given parent
179 : window.
180 : */
181 : virtual bool RelocateToParentWindow (::Window* pParentWindow) SAL_OVERRIDE;
182 :
183 : protected:
184 :
185 : virtual SvBorder GetBorder (bool bOuterResize);
186 :
187 : /** This method is overloaded to handle a missing tool bar correctly.
188 : This is the case when the slide sorter is not the main view shell.
189 : */
190 : virtual ::svl::IUndoManager* ImpGetUndoManager (void) const SAL_OVERRIDE;
191 :
192 : private:
193 : ::boost::shared_ptr<SlideSorter> mpSlideSorter;
194 : bool mbIsArrangeGUIElementsPending;
195 :
196 : SlideSorterViewShell (
197 : SfxViewFrame* pFrame,
198 : ViewShellBase& rViewShellBase,
199 : ::Window* pParentWindow,
200 : FrameView* pFrameView);
201 : void Initialize (void);
202 :
203 : /** This method overwrites the one from our base class: We do our own
204 : scroll bar and the base class call is thus unnecessary. It simply
205 : calls UpdateScrollBars(false).
206 : */
207 : virtual void UpdateScrollBars (void) SAL_OVERRIDE;
208 : };
209 :
210 : typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection;
211 :
212 : } } // end of namespace ::sd::slidesorter
213 :
214 : #endif
215 :
216 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|