Branch data 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 SD_SLIDESORTER_SLIDE_SORTER_VIEW_SHELL_HXX
21 : : #define SD_SLIDESORTER_SLIDE_SORTER_VIEW_SHELL_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();
46 : 25 : 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);
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);
74 : :
75 : : /// inherited from sd::ViewShell
76 : : virtual SdPage* getCurrentPage() const;
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);
87 : : virtual void GetMenuState (SfxItemSet &rSet);
88 : : virtual void GetClipboardState (SfxItemSet &rSet);
89 : :
90 : : virtual void ReadFrameViewData (FrameView* pView);
91 : : virtual void WriteFrameViewData (void);
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);
100 : : virtual void SetZoomRect (const Rectangle& rZoomRect);
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);
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);
112 : :
113 : : virtual void Activate (sal_Bool IsMDIActivate);
114 : :
115 : : //===== Drag and Drop =====================================================
116 : :
117 : : virtual void StartDrag (
118 : : const Point& rDragPt,
119 : : ::Window* pWindow );
120 : : virtual void DragFinished (
121 : : sal_Int8 nDropAction);
122 : : virtual sal_Int8 AcceptDrop (
123 : : const AcceptDropEvent& rEvt,
124 : : DropTargetHelper& rTargetHelper,
125 : : ::sd::Window* pTargetWindow = NULL,
126 : : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
127 : : sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
128 : : virtual sal_Int8 ExecuteDrop (
129 : : const ExecuteDropEvent& rEvt,
130 : : DropTargetHelper& rTargetHelper,
131 : : ::sd::Window* pTargetWindow = NULL,
132 : : sal_uInt16 nPage = SDRPAGE_NOTFOUND,
133 : : sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
134 : :
135 : : typedef ::std::vector<SdPage*> PageSelection;
136 : :
137 : : /** Return the set of selected pages.
138 : : */
139 : : ::boost::shared_ptr<PageSelection> GetPageSelection (void) const;
140 : :
141 : : void SetPageSelection (const ::boost::shared_ptr<PageSelection>& rSelection);
142 : :
143 : : /** Add a listener that is called when the selection of the slide sorter
144 : : changes.
145 : : @param rListener
146 : : When this method is called multiple times for the same listener
147 : : the second and all following calls are ignored. Each listener
148 : : is added only once.
149 : : */
150 : : void AddSelectionChangeListener (const Link& rListener);
151 : :
152 : : /** Remove a listener that was called when the selection of the slide
153 : : sorter changes.
154 : : @param rListener
155 : : It is save to pass a listener that was not added are has been
156 : : removed previously. Such calls are ignored.
157 : : */
158 : : void RemoveSelectionChangeListener (const Link& rListener);
159 : :
160 : : virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
161 : :
162 : : /** Create an accessible object representing the specified window.
163 : : @param pWindow
164 : : The returned object makes the document displayed in this window
165 : : accessible.
166 : : @return
167 : : Returns an <type>AccessibleSlideSorterView</type> object.
168 : : */
169 : : virtual ::com::sun::star::uno::Reference<
170 : : ::com::sun::star::accessibility::XAccessible>
171 : : CreateAccessibleDocumentView (::sd::Window* pWindow);
172 : :
173 : : SlideSorter& GetSlideSorter (void) const;
174 : :
175 : : /** Try to relocate all toplevel window elements to the given parent
176 : : window.
177 : : */
178 : : virtual bool RelocateToParentWindow (::Window* pParentWindow);
179 : :
180 : : protected:
181 : :
182 : : virtual SvBorder GetBorder (bool bOuterResize);
183 : :
184 : : /** This method is overloaded to handle a missing tool bar correctly.
185 : : This is the case when the slide sorter is not the main view shell.
186 : : */
187 : : virtual ::svl::IUndoManager* ImpGetUndoManager (void) const;
188 : :
189 : : private:
190 : : ::boost::shared_ptr<SlideSorter> mpSlideSorter;
191 : : bool mbIsArrangeGUIElementsPending;
192 : :
193 : : SlideSorterViewShell (
194 : : SfxViewFrame* pFrame,
195 : : ViewShellBase& rViewShellBase,
196 : : ::Window* pParentWindow,
197 : : FrameView* pFrameView);
198 : : void Initialize (void);
199 : :
200 : : /** This method overwrites the one from our base class: We do our own
201 : : scroll bar and the base class call is thus unnecessary. It simply
202 : : calls UpdateScrollBars(false).
203 : : */
204 : : virtual void UpdateScrollBars (void);
205 : : };
206 : :
207 : : typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection;
208 : :
209 : : } } // end of namespace ::sd::slidesorter
210 : :
211 : : #endif
212 : :
213 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|