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