1c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file
5c45d927aSAndrew Rist * distributed with this work for additional information
6c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the
8c45d927aSAndrew Rist * "License"); you may not use this file except in compliance
9c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at
10c45d927aSAndrew Rist *
11c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12c45d927aSAndrew Rist *
13c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing,
14c45d927aSAndrew Rist * software distributed under the License is distributed on an
15c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c45d927aSAndrew Rist * KIND, either express or implied. See the License for the
17c45d927aSAndrew Rist * specific language governing permissions and limitations
18c45d927aSAndrew Rist * under the License.
19c45d927aSAndrew Rist *
20c45d927aSAndrew Rist *************************************************************/
21c45d927aSAndrew Rist
22c45d927aSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef SD_VIEW_SHELL_HXX
25cdf0e10cSrcweir #define SD_VIEW_SHELL_HXX
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <rtl/ref.hxx>
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include <vcl/field.hxx>
30cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
31cdf0e10cSrcweir #include <vcl/field.hxx>
32cdf0e10cSrcweir #include <vcl/prntypes.hxx>
33cdf0e10cSrcweir #include <svtools/transfer.hxx>
34cdf0e10cSrcweir #include <comphelper/implementationreference.hxx>
35cdf0e10cSrcweir #include "glob.hxx"
36cdf0e10cSrcweir #include "pres.hxx"
37cdf0e10cSrcweir #include "cfgids.hxx"
38cdf0e10cSrcweir #include "View.hxx"
39cdf0e10cSrcweir #include "sddllapi.h"
40cdf0e10cSrcweir
41cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawSubController.hpp>
42cdf0e10cSrcweir #include <memory>
43cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
44cdf0e10cSrcweir
45cdf0e10cSrcweir class SdPage;
46cdf0e10cSrcweir class SvxRuler;
47cdf0e10cSrcweir class SdrOle2Obj; // fuer die, die Teile von SVDRAW rausdefiniert haben
48cdf0e10cSrcweir class ScrollBarBox;
49cdf0e10cSrcweir class SdDrawDocument;
50cdf0e10cSrcweir class ScrollBar;
51cdf0e10cSrcweir class FmFormShell;
52cdf0e10cSrcweir class SdOptionsPrintItem;
53cdf0e10cSrcweir class MultiSelection;
54cdf0e10cSrcweir
55cdf0e10cSrcweir extern const String aEmptyStr;
56cdf0e10cSrcweir
57cdf0e10cSrcweir namespace com { namespace sun { namespace star {
58cdf0e10cSrcweir namespace embed {
59cdf0e10cSrcweir class XEmbeddedObject;
60cdf0e10cSrcweir }}}}
61cdf0e10cSrcweir
62cdf0e10cSrcweir namespace css = ::com::sun::star;
63cdf0e10cSrcweir
64cdf0e10cSrcweir namespace sd {
65cdf0e10cSrcweir
66cdf0e10cSrcweir class Client;
67cdf0e10cSrcweir class DrawDocShell;
68cdf0e10cSrcweir class DrawSubController;
69cdf0e10cSrcweir class FrameView;
70cdf0e10cSrcweir class FuPoor;
71cdf0e10cSrcweir class FuSearch;
72cdf0e10cSrcweir class SlideShow;
73cdf0e10cSrcweir class LayerTabBar;
74cdf0e10cSrcweir class View;
75cdf0e10cSrcweir class ViewShellBase;
76cdf0e10cSrcweir class ViewTabBar;
77cdf0e10cSrcweir class Window;
78cdf0e10cSrcweir class WindowUpdater;
79cdf0e10cSrcweir class ZoomList;
80cdf0e10cSrcweir
81cdf0e10cSrcweir #undef OUTPUT_DRAWMODE_COLOR
82cdf0e10cSrcweir #undef OUTPUT_DRAWMODE_CONTRAST
83cdf0e10cSrcweir
84cdf0e10cSrcweir /** Base class of the stacked shell hierarchy.
85cdf0e10cSrcweir
86cdf0e10cSrcweir <p>Despite its name this class is not a descendant of SfxViewShell
87cdf0e10cSrcweir but of SfxShell. Its name expresses the fact that it acts like a
88cdf0e10cSrcweir view shell. Beeing a stacked shell rather then being an actual view shell
89cdf0e10cSrcweir there can be several instances of this class that
90cdf0e10cSrcweir <ul>
91cdf0e10cSrcweir <li>all are based on the same view shell and thus show the same
92cdf0e10cSrcweir document and share common view functionality and</li>
93cdf0e10cSrcweir <li>are all visible at the same time and live in the same
94cdf0e10cSrcweir frame.</li>
95cdf0e10cSrcweir <ul></p>
96cdf0e10cSrcweir
97cdf0e10cSrcweir <p>This class replaces the former ViewShell class.</p>
98cdf0e10cSrcweir */
99cdf0e10cSrcweir class ViewShell
100cdf0e10cSrcweir : public SfxShell
101cdf0e10cSrcweir {
102cdf0e10cSrcweir public:
103cdf0e10cSrcweir enum ShellType {
104cdf0e10cSrcweir ST_NONE,
105cdf0e10cSrcweir ST_DRAW, // The Draw application.
106cdf0e10cSrcweir ST_IMPRESS, // Main view of the Impress application.
107cdf0e10cSrcweir ST_NOTES,
108cdf0e10cSrcweir ST_HANDOUT,
109cdf0e10cSrcweir ST_OUTLINE,
110cdf0e10cSrcweir ST_SLIDE_SORTER,
111cdf0e10cSrcweir ST_PRESENTATION,
1127a32b0c8SAndre Fischer ST_SIDEBAR
113cdf0e10cSrcweir };
114cdf0e10cSrcweir static const int MAX_HSPLIT_CNT = 1;
115cdf0e10cSrcweir static const int MAX_VSPLIT_CNT = 1;
116cdf0e10cSrcweir static const int MIN_SCROLLBAR_SIZE = 50;
117cdf0e10cSrcweir
118cdf0e10cSrcweir static const sal_uLong OUTPUT_DRAWMODE_COLOR = DRAWMODE_DEFAULT;
119cdf0e10cSrcweir static const sal_uLong OUTPUT_DRAWMODE_GRAYSCALE
120cdf0e10cSrcweir = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL
121cdf0e10cSrcweir | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP
122cdf0e10cSrcweir | DRAWMODE_GRAYGRADIENT;
123cdf0e10cSrcweir static const int OUTPUT_DRAWMODE_BLACKWHITE
124cdf0e10cSrcweir = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT
125cdf0e10cSrcweir | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP
126cdf0e10cSrcweir | DRAWMODE_WHITEGRADIENT;
127cdf0e10cSrcweir static const int OUTPUT_DRAWMODE_CONTRAST
128cdf0e10cSrcweir = DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL
129cdf0e10cSrcweir | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT;
130cdf0e10cSrcweir
131cdf0e10cSrcweir TYPEINFO();
132cdf0e10cSrcweir
133cdf0e10cSrcweir ViewShell (
134cdf0e10cSrcweir SfxViewFrame *pFrame,
135cdf0e10cSrcweir ::Window* pParentWindow,
136cdf0e10cSrcweir ViewShellBase& rViewShellBase,
137cdf0e10cSrcweir bool bAllowCenter = true);
138cdf0e10cSrcweir virtual ~ViewShell (void);
139cdf0e10cSrcweir
140cdf0e10cSrcweir /** The Init method has to be called from the outside directly
141cdf0e10cSrcweir after a new object of this class has been created. It can be
142cdf0e10cSrcweir used for that part of the initialisation that can be run only
143cdf0e10cSrcweir after the creation of the new object is finished. This
144cdf0e10cSrcweir includes registration as listener at event broadcasters.
145cdf0e10cSrcweir
146cdf0e10cSrcweir Derived classes should call this method at the head of their
147cdf0e10cSrcweir Init() methods.
148cdf0e10cSrcweir @param bIsMainViewShell
149cdf0e10cSrcweir This flag tells the Init() method whether the new ViewShell will
150cdf0e10cSrcweir be the main view shell.
151cdf0e10cSrcweir */
152cdf0e10cSrcweir virtual void Init (bool bIsMainViewShell);
153cdf0e10cSrcweir
154cdf0e10cSrcweir /** The Exit() method has to be called before the destructor so that the
155cdf0e10cSrcweir view shell is still a valid object and can safely call methods that
156cdf0e10cSrcweir rely on that.
157cdf0e10cSrcweir */
158cdf0e10cSrcweir virtual void Exit (void);
159cdf0e10cSrcweir
160cdf0e10cSrcweir void Cancel();
161cdf0e10cSrcweir
162cdf0e10cSrcweir /** Return the window that is the parent of all controls of this view
163cdf0e10cSrcweir shell. This may or may not be the window of the frame.
164cdf0e10cSrcweir */
165cdf0e10cSrcweir inline ::Window* GetParentWindow (void) const;
166cdf0e10cSrcweir
167cdf0e10cSrcweir inline ::sd::View* GetView (void) const;
168cdf0e10cSrcweir inline SdrView* GetDrawView (void) const;
169cdf0e10cSrcweir SD_DLLPUBLIC DrawDocShell* GetDocSh (void) const;
170cdf0e10cSrcweir
171cdf0e10cSrcweir SdDrawDocument* GetDoc (void) const;
172cdf0e10cSrcweir
173cdf0e10cSrcweir SD_DLLPUBLIC SfxViewFrame* GetViewFrame (void) const;
174cdf0e10cSrcweir
175cdf0e10cSrcweir /** The active window is usually the mpContentWindow. When there is a
176cdf0e10cSrcweir show running then the active window is a ShowWindow.
177cdf0e10cSrcweir */
178cdf0e10cSrcweir ::sd::Window* GetActiveWindow (void) const;
179cdf0e10cSrcweir
180cdf0e10cSrcweir /** Set the active window. When the shell is displayed in the center
181cdf0e10cSrcweir pane then the window of the ViewShellBase is also set to the given
182cdf0e10cSrcweir window.
183cdf0e10cSrcweir */
184cdf0e10cSrcweir void SetActiveWindow (::sd::Window* pWindow);
185cdf0e10cSrcweir
186cdf0e10cSrcweir /** Return the rectangle that encloses all windows of the view. That
187cdf0e10cSrcweir excludes the controls in the frame like rulers, scroll bars, tab
188cdf0e10cSrcweir bar, and buttons.
189cdf0e10cSrcweir @return
190cdf0e10cSrcweir The rectangle is returned in screen coordinates, i.e. pixel
191cdf0e10cSrcweir values relative to the upper left corner of the screen?.
192cdf0e10cSrcweir */
193cdf0e10cSrcweir const Rectangle& GetAllWindowRect (void);
194cdf0e10cSrcweir
195cdf0e10cSrcweir // Mouse- & Key-Events
196cdf0e10cSrcweir virtual void PrePaint();
197cdf0e10cSrcweir virtual void Paint (const Rectangle& rRect, ::sd::Window* pWin);
198cdf0e10cSrcweir virtual sal_Bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin);
199cdf0e10cSrcweir virtual void MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin);
200cdf0e10cSrcweir virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin);
201cdf0e10cSrcweir virtual void MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin);
202cdf0e10cSrcweir virtual void Command(const CommandEvent& rCEvt, ::sd::Window* pWin);
203cdf0e10cSrcweir virtual sal_Bool RequestHelp( const HelpEvent& rEvt, ::sd::Window* pWin );
204cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt, ::sd::Window* pWin );
205cdf0e10cSrcweir
206cdf0e10cSrcweir virtual bool HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin);
207cdf0e10cSrcweir
208cdf0e10cSrcweir virtual void Draw(OutputDevice &rDev, const Region &rReg);
209cdf0e10cSrcweir
210cdf0e10cSrcweir virtual void SetUIUnit(FieldUnit eUnit);
211cdf0e10cSrcweir virtual void SetDefTabHRuler( sal_uInt16 nDefTab );
212cdf0e10cSrcweir
213cc69f169SZheng Fan const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId);
214cc69f169SZheng Fan
215cdf0e10cSrcweir sal_Bool HasRuler (void);
216cdf0e10cSrcweir void SetRuler(sal_Bool bRuler);
217cdf0e10cSrcweir
218cdf0e10cSrcweir /** Set internal values of all scroll bars that determine thumb size and
219cdf0e10cSrcweir position. The external values like size and position of the scroll
220cdf0e10cSrcweir bar controls are not modified.
221cdf0e10cSrcweir */
222cdf0e10cSrcweir virtual void UpdateScrollBars (void);
223cdf0e10cSrcweir void Scroll(long nX, long nY);
224cdf0e10cSrcweir void ScrollLines(long nX, long nY);
225cdf0e10cSrcweir virtual void SetZoom(long nZoom);
226cdf0e10cSrcweir virtual void SetZoomRect(const Rectangle& rZoomRect);
227cdf0e10cSrcweir void InitWindows(const Point& rViewOrigin, const Size& rViewSize,
228cdf0e10cSrcweir const Point& rWinPos, sal_Bool bUpdate = sal_False);
229cdf0e10cSrcweir void InvalidateWindows();
230cdf0e10cSrcweir /** This method is still used by the OutlineViewShell to update the
231cdf0e10cSrcweir model according to the content of the outline view. This in turn
232cdf0e10cSrcweir updates the previews in the slide sorter.
233cdf0e10cSrcweir */
234cdf0e10cSrcweir virtual void UpdatePreview (SdPage* pPage, sal_Bool bInit = sal_False);
235cdf0e10cSrcweir
236cdf0e10cSrcweir void DrawMarkRect(const Rectangle& rRect) const;
237cdf0e10cSrcweir
238cdf0e10cSrcweir void ExecReq( SfxRequest &rReq );
239cdf0e10cSrcweir
240cdf0e10cSrcweir ZoomList* GetZoomList (void);
241cdf0e10cSrcweir
242cdf0e10cSrcweir FrameView* GetFrameView (void);
243cdf0e10cSrcweir /** Setting a frame view triggers ReadFrameViewData() for the new
244cdf0e10cSrcweir frame.
245cdf0e10cSrcweir @param pFrameView
246cdf0e10cSrcweir The new frame view that replaces the old one.
247cdf0e10cSrcweir */
248cdf0e10cSrcweir void SetFrameView (FrameView* pFrameView);
249cdf0e10cSrcweir virtual void ReadFrameViewData(FrameView* pView);
250cdf0e10cSrcweir virtual void WriteFrameViewData();
251cdf0e10cSrcweir virtual void WriteUserData(String& rString);
252cdf0e10cSrcweir virtual void ReadUserData(const String& rString);
253cdf0e10cSrcweir
254cdf0e10cSrcweir virtual sal_Bool ActivateObject(SdrOle2Obj* pObj, long nVerb);
255cdf0e10cSrcweir
256cdf0e10cSrcweir /** @returns
257cdf0e10cSrcweir current or selected page or 0. This method
258cdf0e10cSrcweir will fail in master page mode.
259cdf0e10cSrcweir
260cdf0e10cSrcweir @deprecated, please use getCurrentPage();
261cdf0e10cSrcweir */
262cdf0e10cSrcweir virtual SdPage* GetActualPage() = 0;
263cdf0e10cSrcweir
264cdf0e10cSrcweir /** @returns
265cdf0e10cSrcweir current or selected page or 0.
266cdf0e10cSrcweir */
267cdf0e10cSrcweir virtual SdPage* getCurrentPage() const = 0;
268cdf0e10cSrcweir
GetOldFunction() const269cdf0e10cSrcweir FunctionReference GetOldFunction() const { return mxOldFunction; }
HasOldFunction() const270cdf0e10cSrcweir bool HasOldFunction() const { return mxOldFunction.is(); }
GetCurrentFunction() const271cdf0e10cSrcweir FunctionReference GetCurrentFunction() const { return mxCurrentFunction; }
HasCurrentFunction(sal_uInt16 nSID)272cdf0e10cSrcweir bool HasCurrentFunction( sal_uInt16 nSID ) { return mxCurrentFunction.is() && (mxCurrentFunction->GetSlotID() == nSID ); }
HasCurrentFunction()273cdf0e10cSrcweir bool HasCurrentFunction() { return mxCurrentFunction.is(); }
274cdf0e10cSrcweir
275cdf0e10cSrcweir void SetCurrentFunction(const FunctionReference& xFunction);
276cdf0e10cSrcweir void SetOldFunction(const FunctionReference& xFunction);
277cdf0e10cSrcweir void DeactivateCurrentFunction( bool bPermanent = false );
278cdf0e10cSrcweir
279cdf0e10cSrcweir void SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
280cdf0e10cSrcweir long nLeft, long nRight, long nUpper, long nLower,
281cdf0e10cSrcweir sal_Bool bScaleAll, Orientation eOrient, sal_uInt16 nPaperBin,
282cdf0e10cSrcweir sal_Bool bBackgroundFullSize );
283cdf0e10cSrcweir
SetStartShowWithDialog(sal_Bool bIn=sal_True)284cdf0e10cSrcweir void SetStartShowWithDialog( sal_Bool bIn = sal_True ) { mbStartShowWithDialog = bIn; }
IsStartShowWithDialog() const285cdf0e10cSrcweir sal_Bool IsStartShowWithDialog() const { return mbStartShowWithDialog; }
286cdf0e10cSrcweir
GetPrintedHandoutPageNum(void) const287cdf0e10cSrcweir sal_uInt16 GetPrintedHandoutPageNum (void) const { return mnPrintedHandoutPageNum; }
SetPrintedHandoutPageNum(sal_uInt16 nPageNumber)288cdf0e10cSrcweir void SetPrintedHandoutPageNum (sal_uInt16 nPageNumber) {mnPrintedHandoutPageNum=nPageNumber; }
289cdf0e10cSrcweir
GetPrintedHandoutPageCount(void) const290cdf0e10cSrcweir sal_uInt16 GetPrintedHandoutPageCount(void) const { return mnPrintedHandoutPageCount; }
SetPrintedHandoutPageCount(sal_uInt16 nPageCount)291cdf0e10cSrcweir void SetPrintedHandoutPageCount (sal_uInt16 nPageCount) {mnPrintedHandoutPageCount=nPageCount; }
292cdf0e10cSrcweir
293cdf0e10cSrcweir virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
294cdf0e10cSrcweir
295cdf0e10cSrcweir void GetMenuState(SfxItemSet& rSet);
296cdf0e10cSrcweir
297cdf0e10cSrcweir virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
298cdf0e10cSrcweir ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer );
299cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
300cdf0e10cSrcweir ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer );
301cdf0e10cSrcweir
302cdf0e10cSrcweir virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
303cdf0e10cSrcweir virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
304cdf0e10cSrcweir
305cdf0e10cSrcweir /** this method is called when the visible area of the view from this viewshell is changed */
306cdf0e10cSrcweir virtual void VisAreaChanged(const Rectangle& rRect);
307cdf0e10cSrcweir
308cdf0e10cSrcweir /** Create an accessible object representing the specified window.
309cdf0e10cSrcweir Overload this method to provide view mode specific objects. The
310cdf0e10cSrcweir default implementation returns an empty reference.
311cdf0e10cSrcweir @param pWindow
312cdf0e10cSrcweir Make the document displayed in this window accessible.
313cdf0e10cSrcweir @return
314cdf0e10cSrcweir This default implementation returns an empty reference.
315cdf0e10cSrcweir */
316cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference<
317cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible>
318cdf0e10cSrcweir CreateAccessibleDocumentView (::sd::Window* pWindow);
319cdf0e10cSrcweir
320*0deba7fbSSteve Yin virtual void SwitchViewFireFocus( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc );
321*0deba7fbSSteve Yin virtual void SwitchActiveViewFireFocus( );
322*0deba7fbSSteve Yin // Move these two methods from DrawViewShell to enable slide show view
323*0deba7fbSSteve Yin void NotifyAccUpdate();
324*0deba7fbSSteve Yin void fireSwitchCurrentPage(sal_Int32 pageIndex);
325cdf0e10cSrcweir void SetWinViewPos(const Point& rWinPos, bool bUpdate);
326cdf0e10cSrcweir Point GetWinViewPos() const;
327cdf0e10cSrcweir Point GetViewOrigin() const;
328cdf0e10cSrcweir
329cdf0e10cSrcweir /** Return the window updater of this view shell.
330cdf0e10cSrcweir @return
331cdf0e10cSrcweir In rare circumstances the returned pointer may be <null/>,
332cdf0e10cSrcweir i.e. when no memory is available anymore.
333cdf0e10cSrcweir */
334cdf0e10cSrcweir ::sd::WindowUpdater* GetWindowUpdater (void) const;
335cdf0e10cSrcweir
336cdf0e10cSrcweir /** Return the border that is drawn arround the actual document view.
337cdf0e10cSrcweir The border contains typically rulers and scroll bars.
338cdf0e10cSrcweir @param bOuterResize
339cdf0e10cSrcweir When this flag is <TRUE/> then the border is used for an
340cdf0e10cSrcweir OuterResizePixel(), i.e. there is a given window size and the
341cdf0e10cSrcweir border elements are placed inside so that the document view has
342cdf0e10cSrcweir the given window size minus the border.
343cdf0e10cSrcweir When the flag is <FALSE/> then the border is used for an
344cdf0e10cSrcweir InnerResizePixel(), i.e. the document view has a given size and
345cdf0e10cSrcweir the border is placed outside. In this scenario the parent
346cdf0e10cSrcweir window has the size of the document view plus the border.
347cdf0e10cSrcweir */
348cdf0e10cSrcweir SvBorder GetBorder (bool bOuterResize);
349cdf0e10cSrcweir
350cdf0e10cSrcweir /** Notify the view shell that its parent window has been resized.
351cdf0e10cSrcweir The ViewShell places and resizes its UI elements accordingly.
352cdf0e10cSrcweir The new size can be obtained from the parent window.
353cdf0e10cSrcweir */
354cdf0e10cSrcweir virtual void Resize (void);
355cdf0e10cSrcweir
356cdf0e10cSrcweir /** Set the position and size of the area which contains the GUI
357cdf0e10cSrcweir elements like rulers, sliders, and buttons as well as the document
358cdf0e10cSrcweir view. Both size and position are expected to be in pixel
359cdf0e10cSrcweir coordinates. The positions and sizes of the mentioned GUI elements
360cdf0e10cSrcweir are updated as well.
361cdf0e10cSrcweir
362cdf0e10cSrcweir <p> This method is implemented by first setting copying the given
363cdf0e10cSrcweir values to internal variables and then calling the
364cdf0e10cSrcweir <type>ArrangeGUIElements</type> method which performs the actual
365cdf0e10cSrcweir work of sizeing and arranging the UI elements accordingly.</p>
366cdf0e10cSrcweir @param rPos
367cdf0e10cSrcweir The position of the enclosing window relative to the document
368cdf0e10cSrcweir window. This is only interesting if a Draw/Impress document
369cdf0e10cSrcweir view is embedded as OLE object into another document view. For
370cdf0e10cSrcweir normal documents this position is (0,0).
371cdf0e10cSrcweir @param rSize
372cdf0e10cSrcweir The new size in pixel.
373cdf0e10cSrcweir */
374cdf0e10cSrcweir // This is to be replaced by Resize.
375cdf0e10cSrcweir // virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize);
376cdf0e10cSrcweir
377cdf0e10cSrcweir /** Set position and size of the GUI elements that are controllerd by
378cdf0e10cSrcweir the view shell like rulers and scroll bars as well as the actual
379cdf0e10cSrcweir document view according to the position and size that were given
380cdf0e10cSrcweir with the last Resize() call.
381cdf0e10cSrcweir */
382cdf0e10cSrcweir virtual void ArrangeGUIElements (void);
383cdf0e10cSrcweir
384cdf0e10cSrcweir // virtual void OuterResizePixel(const Point &rPos, const Size &rSize);
385cdf0e10cSrcweir // virtual void InnerResizePixel(const Point &rPos, const Size &rSize);
386cdf0e10cSrcweir
387cdf0e10cSrcweir ViewShellBase& GetViewShellBase (void) const;
388cdf0e10cSrcweir
389cdf0e10cSrcweir /** Return <TRUE/> when the called view shell is the main sub shell of
390cdf0e10cSrcweir its ViewShellBase object, i.e. is display in the center pane. This
391cdf0e10cSrcweir convenience function is equivalent to comparing the this pointer to
392cdf0e10cSrcweir the result of ViewShellBase::GetViewShell(PT_CENTER).
393cdf0e10cSrcweir */
394cdf0e10cSrcweir bool IsMainViewShell (void) const;
395cdf0e10cSrcweir
396cdf0e10cSrcweir /** Set or reset the flag that indicates whether the called shell is the
397cdf0e10cSrcweir one displayed in the center pane. By default this flag is set to
398cdf0e10cSrcweir <FALSE/>. For the main view shell it thus has to be set to <TRUE/>.
399cdf0e10cSrcweir */
400cdf0e10cSrcweir void SetIsMainViewShell (bool bIsMainViewShell);
401cdf0e10cSrcweir
402cdf0e10cSrcweir /** Return a sub controller that implements the view shell specific
403cdf0e10cSrcweir part of the DrawController.
404cdf0e10cSrcweir */
405cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void) = 0;
406cdf0e10cSrcweir
407cdf0e10cSrcweir /** Return the type of the shell.
408cdf0e10cSrcweir */
409cdf0e10cSrcweir virtual ShellType GetShellType (void) const;
410cdf0e10cSrcweir
411cdf0e10cSrcweir /** This method is more or less an alias to Deactivate(). It is called
412cdf0e10cSrcweir before an object of this class is taken from the stack of view
413cdf0e10cSrcweir shells.
414cdf0e10cSrcweir
415cdf0e10cSrcweir <p>When this method is not called before a view shell is taken from
416cdf0e10cSrcweir a stack then the Deactivate() call from the SFX as a response to
417cdf0e10cSrcweir RemoveSubShell() comes to late when the view shell is not on the
418cdf0e10cSrcweir stack anymore.</p>
419cdf0e10cSrcweir */
420cdf0e10cSrcweir virtual void Shutdown (void);
421cdf0e10cSrcweir
422cdf0e10cSrcweir /** This function is called from the underlying ViewShellBase
423cdf0e10cSrcweir object to handle a verb execution request.
424cdf0e10cSrcweir */
425cdf0e10cSrcweir virtual ErrCode DoVerb (long nVerb);
426cdf0e10cSrcweir
427cdf0e10cSrcweir virtual void UIActivating( SfxInPlaceClient* );
428cdf0e10cSrcweir virtual void UIDeactivated( SfxInPlaceClient* );
429cdf0e10cSrcweir
430cdf0e10cSrcweir /** Show controls of the UI or hide them, depending on the given flag.
431cdf0e10cSrcweir As a result the border is adapted.
432cdf0e10cSrcweir */
433cdf0e10cSrcweir virtual void ShowUIControls (bool bVisible = true);
434cdf0e10cSrcweir sal_Bool IsPageFlipMode(void) const;
435cdf0e10cSrcweir
436cdf0e10cSrcweir /** Set the given window as new parent window. This is not possible for
437cdf0e10cSrcweir all views, so the return value tells the caller if the relocation
438cdf0e10cSrcweir was successfull.
439cdf0e10cSrcweir */
440cdf0e10cSrcweir virtual bool RelocateToParentWindow (::Window* pParentWindow);
441cdf0e10cSrcweir
442cdf0e10cSrcweir /** Depending on the given request create a new page or duplicate an
443cdf0e10cSrcweir existing one. A new page is created behind the given slide.
444cdf0e10cSrcweir @param rRequest
445cdf0e10cSrcweir The request as passed to an Execute() method. Its arguments are
446cdf0e10cSrcweir evaluated. Its slot id determines whether to create or
447cdf0e10cSrcweir duplicate a slide.
448cdf0e10cSrcweir @param pPage
449cdf0e10cSrcweir This page is either duplicated or becomes the predecessor of the
450cdf0e10cSrcweir new slide. If NULL a duplication request is ignored. A new
451cdf0e10cSrcweir slide is inserted as first slide.
452cdf0e10cSrcweir @param nInsertPosition
453cdf0e10cSrcweir When -1 (the default) then insert after pPage. Otherwise insert
454cdf0e10cSrcweir before the given index (of a standard page).
455cdf0e10cSrcweir @return
456cdf0e10cSrcweir The new slide is returned. If for some reason a new page can
457cdf0e10cSrcweir not be created then NULL is returned.
458cdf0e10cSrcweir */
459cdf0e10cSrcweir virtual SdPage* CreateOrDuplicatePage (
460cdf0e10cSrcweir SfxRequest& rRequest,
461cdf0e10cSrcweir PageKind ePageKind,
462cdf0e10cSrcweir SdPage* pPage,
463cdf0e10cSrcweir const sal_Int32 nInsertPosition = -1);
464cdf0e10cSrcweir
465cdf0e10cSrcweir
466cdf0e10cSrcweir class Implementation;
467cdf0e10cSrcweir
468cdf0e10cSrcweir protected:
469cdf0e10cSrcweir /** must be called in the beginning of each subclass d'tor.
470cdf0e10cSrcweir disposes and clears both current and old function. */
471cdf0e10cSrcweir void DisposeFunctions();
472cdf0e10cSrcweir
473cdf0e10cSrcweir friend class ViewShellBase;
474cdf0e10cSrcweir
475cdf0e10cSrcweir /** Window inside the rulers and scroll bars that shows a view of the
476cdf0e10cSrcweir document.
477cdf0e10cSrcweir */
478cdf0e10cSrcweir
479cdf0e10cSrcweir ::boost::shared_ptr<sd::Window> mpContentWindow;
480cdf0e10cSrcweir
481cdf0e10cSrcweir /// Horizontal scroll bar for the current slide is displayed when needed.
482cdf0e10cSrcweir ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
483cdf0e10cSrcweir /// Vertical scroll bar for whole document is always visible.
484cdf0e10cSrcweir ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
485cdf0e10cSrcweir /// Horizontal ruler is not shown by default.
486cdf0e10cSrcweir ::std::auto_ptr<SvxRuler> mpHorizontalRuler;
487cdf0e10cSrcweir /// Vertical ruler is not shown by default.
488cdf0e10cSrcweir ::std::auto_ptr<SvxRuler> mpVerticalRuler;
489cdf0e10cSrcweir /// Filler of the little square enclosed by the two scroll bars.
490cdf0e10cSrcweir ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
491cdf0e10cSrcweir /// Layer tab bar.
492cdf0e10cSrcweir ::std::auto_ptr<LayerTabBar> mpLayerTabBar;
493cdf0e10cSrcweir
494cdf0e10cSrcweir /// This flag controls whether the rulers are visible.
495cdf0e10cSrcweir bool mbHasRulers;
496cdf0e10cSrcweir
497cdf0e10cSrcweir /// The active window.
498cdf0e10cSrcweir ::sd::Window* mpActiveWindow;
499cdf0e10cSrcweir ::sd::View* mpView;
500cdf0e10cSrcweir FrameView* mpFrameView;
501cdf0e10cSrcweir
502cdf0e10cSrcweir FunctionReference mxCurrentFunction;
503cdf0e10cSrcweir FunctionReference mxOldFunction;
504cdf0e10cSrcweir ZoomList* mpZoomList;
505cdf0e10cSrcweir
506cdf0e10cSrcweir Point maViewPos;
507cdf0e10cSrcweir Size maViewSize;
508cdf0e10cSrcweir Size maScrBarWH;
509cdf0e10cSrcweir
510cdf0e10cSrcweir sal_Bool mbCenterAllowed; // wird an Fenster weitergegeben
511cdf0e10cSrcweir
512cdf0e10cSrcweir sal_Bool mbStartShowWithDialog; // Praesentation wurde ueber Dialog gestartet
513cdf0e10cSrcweir sal_uInt16 mnPrintedHandoutPageNum; // Page number of the handout page that is to be printed.
514cdf0e10cSrcweir sal_uInt16 mnPrintedHandoutPageCount; // Page count of the handout pages that are to be printed.
515cdf0e10cSrcweir
516cdf0e10cSrcweir //af sal_Bool bPrintDirectSelected; // Print only selected objects in direct print
517cdf0e10cSrcweir //afString sPageRange; // pagerange if selected objects in direct print
518cdf0e10cSrcweir
519cdf0e10cSrcweir /** Area covered by all windows, i.e. the area of the parent window
520cdf0e10cSrcweir without the controls at the borders like rulers, scroll bars, tab
521cdf0e10cSrcweir bar, buttons.
522cdf0e10cSrcweir This rectangle may be set in window coordinates (i.e. pixel values
523cdf0e10cSrcweir relative to the parent window). It is transformed by every call to
524cdf0e10cSrcweir GetAllWindowRectangle() into screen coordinates (relative to the
525cdf0e10cSrcweir upper left corner of the screen.
526cdf0e10cSrcweir */
527cdf0e10cSrcweir Rectangle maAllWindowRectangle;
528cdf0e10cSrcweir
529cdf0e10cSrcweir /// The type of the shell. Returned by GetShellType().
530cdf0e10cSrcweir ShellType meShellType;
531cdf0e10cSrcweir
532cdf0e10cSrcweir ::std::auto_ptr<Implementation> mpImpl;
533cdf0e10cSrcweir
534cdf0e10cSrcweir // #96090# Support methods for centralized UNDO/REDO
535cdf0e10cSrcweir virtual ::svl::IUndoManager* ImpGetUndoManager (void) const;
536cdf0e10cSrcweir void ImpGetUndoStrings(SfxItemSet &rSet) const;
537cdf0e10cSrcweir void ImpGetRedoStrings(SfxItemSet &rSet) const;
538cdf0e10cSrcweir void ImpSidUndo(sal_Bool bDrawViewShell, SfxRequest& rReq);
539cdf0e10cSrcweir void ImpSidRedo(sal_Bool bDrawViewShell, SfxRequest& rReq);
540cdf0e10cSrcweir
541cdf0e10cSrcweir DECL_LINK( HScrollHdl, ScrollBar * );
542cdf0e10cSrcweir DECL_LINK( VScrollHdl, ScrollBar * );
543cdf0e10cSrcweir
544cdf0e10cSrcweir // virt. Scroll-Handler, hier koennen sich abgeleitete Klassen einklinken
545cdf0e10cSrcweir virtual long VirtHScrollHdl(ScrollBar* pHScroll);
546cdf0e10cSrcweir virtual long VirtVScrollHdl(ScrollBar* pVScroll);
547cdf0e10cSrcweir
548cdf0e10cSrcweir // virtuelle Funktionen fuer Lineal-Handling
549cdf0e10cSrcweir virtual SvxRuler* CreateHRuler(::sd::Window* pWin, sal_Bool bIsFirst);
550cdf0e10cSrcweir virtual SvxRuler* CreateVRuler(::sd::Window* pWin);
551cdf0e10cSrcweir virtual void UpdateHRuler();
552cdf0e10cSrcweir virtual void UpdateVRuler();
553cdf0e10cSrcweir
554cdf0e10cSrcweir // Zeiger auf ein zusaetzliches Control im horizontalen ScrollBar
555cdf0e10cSrcweir // abgeleiteter Klassen (z.B. ein TabBar) zurueckgeben
556cdf0e10cSrcweir virtual long GetHCtrlWidth();
557cdf0e10cSrcweir
558cdf0e10cSrcweir virtual void Activate(sal_Bool IsMDIActivate);
559cdf0e10cSrcweir virtual void Deactivate(sal_Bool IsMDIActivate);
560cdf0e10cSrcweir
561cdf0e10cSrcweir virtual void SetZoomFactor( const Fraction &rZoomX,
562cdf0e10cSrcweir const Fraction &rZoomY );
563cdf0e10cSrcweir
564cdf0e10cSrcweir private:
565cdf0e10cSrcweir ::Window* mpParentWindow;
566cdf0e10cSrcweir /** This window updater is used to keep all relevant windows up to date
567cdf0e10cSrcweir with reference to the digit langugage used to display digits in text
568cdf0e10cSrcweir shapes.
569cdf0e10cSrcweir */
570cdf0e10cSrcweir ::std::auto_ptr< ::sd::WindowUpdater> mpWindowUpdater;
571cdf0e10cSrcweir
572cdf0e10cSrcweir /** Code common to all constructors. It generally is a bad idea
573cdf0e10cSrcweir to call this function from outside a constructor.
574cdf0e10cSrcweir */
575cdf0e10cSrcweir void construct (void);
576cdf0e10cSrcweir
577cdf0e10cSrcweir DECL_LINK(FrameWindowEventListener, VclSimpleEvent*);
578cdf0e10cSrcweir
579cdf0e10cSrcweir /** Create the rulers.
580cdf0e10cSrcweir */
581cdf0e10cSrcweir void SetupRulers (void);
582cdf0e10cSrcweir };
583cdf0e10cSrcweir
584cdf0e10cSrcweir
585cdf0e10cSrcweir
586cdf0e10cSrcweir
GetParentWindow(void) const587cdf0e10cSrcweir ::Window* ViewShell::GetParentWindow (void) const
588cdf0e10cSrcweir {
589cdf0e10cSrcweir return mpParentWindow;
590cdf0e10cSrcweir }
591cdf0e10cSrcweir
GetView(void) const592cdf0e10cSrcweir ::sd::View* ViewShell::GetView (void) const
593cdf0e10cSrcweir {
594cdf0e10cSrcweir return mpView;
595cdf0e10cSrcweir }
596cdf0e10cSrcweir
GetDrawView(void) const597cdf0e10cSrcweir SdrView* ViewShell::GetDrawView (void) const
598cdf0e10cSrcweir {
599cdf0e10cSrcweir return static_cast<SdrView*>(mpView);
600cdf0e10cSrcweir }
601cdf0e10cSrcweir
602cdf0e10cSrcweir } // end of namespace sd
603cdf0e10cSrcweir
604cdf0e10cSrcweir #endif
605