bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / inc / SlideSorterViewShell.hxx
blob43f94f4d60cd0c8d746525b706dab18c1aaaef1c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_INC_SLIDESORTERVIEWSHELL_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_SLIDESORTERVIEWSHELL_HXX
23 #include "ViewShell.hxx"
24 #include <glob.hxx>
25 #include <sfx2/shell.hxx>
26 #include <sddllapi.h>
27 #include <memory>
28 #include <vector>
30 namespace sd { namespace slidesorter { namespace controller {
31 class SlotManager;
32 } } }
34 namespace sd { namespace slidesorter {
36 class SlideSorter;
38 class SAL_DLLPUBLIC_RTTI SlideSorterViewShell
39 : public ViewShell
41 friend class controller::SlotManager;
43 public:
44 SFX_DECL_INTERFACE(SD_IF_SDSLIDESORTERVIEWSHELL)
46 private:
47 /// SfxInterface initializer.
48 static void InitInterface_Impl();
50 public:
51 static std::shared_ptr<SlideSorterViewShell> Create(
52 SfxViewFrame* pFrame,
53 ViewShellBase& rViewShellBase,
54 vcl::Window* pParentWindow,
55 FrameView* pFrameView);
57 virtual ~SlideSorterViewShell() override;
59 /** Late initialization that has to be called after a new instance has
60 completed its construction.
62 virtual void Init (bool bIsMainViewShell) override;
64 /** Return a slide sorter that is currently displayed in one of the
65 panes that belong to the given ViewShellBase object.
66 When there is only one slide sorter visible then that one is
67 returned. When two (or more) are visible then the one in the center
68 pane is returned. When no slidesorter is visible then NULL is
69 returned.
71 // Exported for unit test
72 SD_DLLPUBLIC static SlideSorterViewShell* GetSlideSorter(ViewShellBase& rBase);
74 virtual SdPage* GetActualPage() override;
76 /// inherited from sd::ViewShell
77 virtual SdPage* getCurrentPage() const override;
79 void ExecCtrl (SfxRequest& rRequest);
80 void GetCtrlState (SfxItemSet &rSet);
81 void FuSupport (SfxRequest& rRequest);
82 void FuTemporary (SfxRequest& rRequest);
83 void GetStatusBarState (SfxItemSet& rSet);
84 void FuPermanent (SfxRequest& rRequest);
85 void GetAttrState (SfxItemSet& rSet);
86 static void ExecStatusBar (SfxRequest& rRequest);
87 virtual void Command (const CommandEvent& rEvent, ::sd::Window* pWindow) override;
88 void GetMenuState (SfxItemSet &rSet);
89 void GetClipboardState (SfxItemSet &rSet);
91 virtual void ReadFrameViewData (FrameView* pView) override;
92 virtual void WriteFrameViewData() override;
94 /** Set the zoom factor. The given value is clipped against an upper
95 bound.
96 @param nZoom
97 An integer percent value, i.e. nZoom/100 is the actual zoom
98 factor.
100 virtual void SetZoom (long int nZoom) override;
101 virtual void SetZoomRect (const ::tools::Rectangle& rZoomRect) override;
103 /** This is a callback method used by the active window to delegate its
104 Paint() call to. This view shell itself delegates it to the view.
106 virtual void Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin) override;
108 /** Place and size the controls and windows. You may want to call this
109 method when something has changed that for instance affects the
110 visibility state of the scroll bars.
112 virtual void ArrangeGUIElements() override;
114 virtual void Activate (bool IsMDIActivate) override;
115 virtual void Deactivate (bool IsMDIActivate) override;
117 /** Move slides up and down. Mainly uno commands. */
118 void ExecMovePageUp (SfxRequest& rReq);
119 void GetStateMovePageUp (SfxItemSet& rSet);
121 void ExecMovePageDown (SfxRequest& rReq);
122 void GetStateMovePageDown (SfxItemSet& rSet);
124 void ExecMovePageFirst (SfxRequest& rReq);
125 void GetStateMovePageFirst (SfxItemSet& rSet);
127 void ExecMovePageLast (SfxRequest& rReq);
128 void GetStateMovePageLast (SfxItemSet& rSet);
131 //===== Drag and Drop =====================================================
133 void StartDrag (
134 const Point& rDragPt,
135 vcl::Window* pWindow );
136 virtual sal_Int8 AcceptDrop (
137 const AcceptDropEvent& rEvt,
138 DropTargetHelper& rTargetHelper,
139 ::sd::Window* pTargetWindow,
140 sal_uInt16 nPage,
141 SdrLayerID nLayer ) override;
142 virtual sal_Int8 ExecuteDrop (
143 const ExecuteDropEvent& rEvt,
144 DropTargetHelper& rTargetHelper,
145 ::sd::Window* pTargetWindow,
146 sal_uInt16 nPage,
147 SdrLayerID nLayer) override;
149 typedef ::std::vector<SdPage*> PageSelection;
151 /** Return the set of selected pages.
153 std::shared_ptr<PageSelection> GetPageSelection() const;
155 void SetPageSelection (const std::shared_ptr<PageSelection>& rSelection);
157 /** Add a listener that is called when the selection of the slide sorter
158 changes.
159 @param rListener
160 When this method is called multiple times for the same listener
161 the second and all following calls are ignored. Each listener
162 is added only once.
164 void AddSelectionChangeListener (const Link<LinkParamNone*,void>& rListener);
166 /** Remove a listener that was called when the selection of the slide
167 sorter changes.
168 @param rListener
169 It is safe to pass a listener that was not added are has been
170 removed previously. Such calls are ignored.
172 void RemoveSelectionChangeListener (const Link<LinkParamNone*,void>& rListener);
174 virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController() override;
176 /** Create an accessible object representing the specified window.
177 @param pWindow
178 The returned object makes the document displayed in this window
179 accessible.
180 @return
181 Returns an <type>AccessibleSlideSorterView</type> object.
183 virtual css::uno::Reference<css::accessibility::XAccessible>
184 CreateAccessibleDocumentView (::sd::Window* pWindow) override;
185 // handle SlideSorterView specially because AccessibleSlideSorterView doesn't inherit from AccessibleDocumentViewBase
186 virtual void SwitchViewFireFocus( const css::uno::Reference< css::accessibility::XAccessible >& xAcc ) override;
188 // Exported for unit test
189 SD_DLLPUBLIC SlideSorter& GetSlideSorter() const;
191 /** Try to relocate all toplevel window elements to the given parent
192 window.
194 virtual bool RelocateToParentWindow (vcl::Window* pParentWindow) override;
196 protected:
198 /** Override this method to handle a missing tool bar correctly.
199 This is the case when the slide sorter is not the main view shell.
201 virtual SfxUndoManager* ImpGetUndoManager() const override;
203 private:
204 std::shared_ptr<SlideSorter> mpSlideSorter;
205 bool mbIsArrangeGUIElementsPending;
207 SlideSorterViewShell (
208 SfxViewFrame* pFrame,
209 ViewShellBase& rViewShellBase,
210 vcl::Window* pParentWindow,
211 FrameView* pFrameView);
212 void Initialize();
214 /** This method overwrites the one from our base class: We do our own
215 scroll bar and the base class call is thus unnecessary. It simply
216 calls UpdateScrollBars(false).
218 virtual void UpdateScrollBars() override;
220 void PostMoveSlidesActions(const std::shared_ptr<SlideSorterViewShell::PageSelection> &rpSelection);
222 void MainViewEndEditAndUnmarkAll();
224 /** Select the same pages in the document as are selected in the
225 SlideSorterViewShell
227 return the page numbers of the first and last selected pages
229 std::pair<sal_uInt16, sal_uInt16> SyncPageSelectionToDocument(const std::shared_ptr<SlideSorterViewShell::PageSelection> &rpSelection);
232 typedef std::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection;
234 } } // end of namespace ::sd::slidesorter
236 #endif
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */