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