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 21 : 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();
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 SdPage* GetActualPage() SAL_OVERRIDE;
76 :
77 : /// inherited from sd::ViewShell
78 : virtual SdPage* getCurrentPage() const SAL_OVERRIDE;
79 :
80 : void ExecCtrl (SfxRequest& rRequest);
81 : void GetCtrlState (SfxItemSet &rSet);
82 : void FuSupport (SfxRequest& rRequest);
83 : void FuTemporary (SfxRequest& rRequest);
84 : void GetStatusBarState (SfxItemSet& rSet);
85 : void FuPermanent (SfxRequest& rRequest);
86 : void GetAttrState (SfxItemSet& rSet);
87 : static void ExecStatusBar (SfxRequest& rRequest);
88 : virtual void Command (const CommandEvent& rEvent, ::sd::Window* pWindow) SAL_OVERRIDE;
89 : void GetMenuState (SfxItemSet &rSet);
90 : void GetClipboardState (SfxItemSet &rSet);
91 :
92 : virtual void ReadFrameViewData (FrameView* pView) SAL_OVERRIDE;
93 : virtual void WriteFrameViewData() SAL_OVERRIDE;
94 :
95 : /** Set the zoom factor. The given value is clipped against an upper
96 : bound.
97 : @param nZoom
98 : An integer percent value, i.e. nZoom/100 is the actual zoom
99 : factor.
100 : */
101 : virtual void SetZoom (long int nZoom) SAL_OVERRIDE;
102 : virtual void SetZoomRect (const Rectangle& rZoomRect) SAL_OVERRIDE;
103 :
104 : /** This is a callback method used by the active window to delegate its
105 : Paint() call to. This view shell itself delegates it to the view.
106 : */
107 : virtual void Paint(const Rectangle& rRect, ::sd::Window* pWin) SAL_OVERRIDE;
108 :
109 : /** Place and size the controls and windows. You may want to call this
110 : method when something has changed that for instance affects the
111 : visibility state of the scroll bars.
112 : */
113 : virtual void ArrangeGUIElements() SAL_OVERRIDE;
114 :
115 : virtual void Activate (bool IsMDIActivate) SAL_OVERRIDE;
116 : virtual void Deactivate (bool IsMDIActivate) SAL_OVERRIDE;
117 :
118 : //===== Drag and Drop =====================================================
119 :
120 : void StartDrag (
121 : const Point& rDragPt,
122 : vcl::Window* pWindow );
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() 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() 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() const;
177 :
178 : /** Try to relocate all toplevel window elements to the given parent
179 : window.
180 : */
181 : virtual bool RelocateToParentWindow (vcl::Window* pParentWindow) SAL_OVERRIDE;
182 :
183 : protected:
184 :
185 : /** Override this method to handle a missing tool bar correctly.
186 : This is the case when the slide sorter is not the main view shell.
187 : */
188 : virtual ::svl::IUndoManager* ImpGetUndoManager() const SAL_OVERRIDE;
189 :
190 : private:
191 : ::boost::shared_ptr<SlideSorter> mpSlideSorter;
192 : bool mbIsArrangeGUIElementsPending;
193 :
194 : SlideSorterViewShell (
195 : SfxViewFrame* pFrame,
196 : ViewShellBase& rViewShellBase,
197 : vcl::Window* pParentWindow,
198 : FrameView* pFrameView);
199 : void Initialize();
200 :
201 : /** This method overwrites the one from our base class: We do our own
202 : scroll bar and the base class call is thus unnecessary. It simply
203 : calls UpdateScrollBars(false).
204 : */
205 : virtual void UpdateScrollBars() SAL_OVERRIDE;
206 : };
207 :
208 : typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection;
209 :
210 : } } // end of namespace ::sd::slidesorter
211 :
212 : #endif
213 :
214 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|