xref: /aoo41x/main/sd/source/ui/inc/ViewShell.hxx (revision 7a32b0c8)
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,
112*7a32b0c8SAndre 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 
213cdf0e10cSrcweir     sal_Bool HasRuler (void);
214cdf0e10cSrcweir 	void SetRuler(sal_Bool bRuler);
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     /** Set internal values of all scroll bars that determine thumb size and
217cdf0e10cSrcweir         position.  The external values like size and position of the scroll
218cdf0e10cSrcweir         bar controls are not modified.
219cdf0e10cSrcweir     */
220cdf0e10cSrcweir 	virtual void UpdateScrollBars (void);
221cdf0e10cSrcweir 	void	Scroll(long nX, long nY);
222cdf0e10cSrcweir 	void	ScrollLines(long nX, long nY);
223cdf0e10cSrcweir 	virtual void	SetZoom(long nZoom);
224cdf0e10cSrcweir 	virtual void	SetZoomRect(const Rectangle& rZoomRect);
225cdf0e10cSrcweir 	void	InitWindows(const Point& rViewOrigin, const Size& rViewSize,
226cdf0e10cSrcweir 						const Point& rWinPos, sal_Bool bUpdate = sal_False);
227cdf0e10cSrcweir 	void	InvalidateWindows();
228cdf0e10cSrcweir     /** This method is still used by the OutlineViewShell to update the
229cdf0e10cSrcweir         model according to the content of the outline view.  This in turn
230cdf0e10cSrcweir         updates the previews in the slide sorter.
231cdf0e10cSrcweir     */
232cdf0e10cSrcweir  	virtual void UpdatePreview (SdPage* pPage, sal_Bool bInit = sal_False);
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 	void    DrawMarkRect(const Rectangle& rRect) const;
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 	void	ExecReq( SfxRequest &rReq );
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 	ZoomList* GetZoomList (void);
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	FrameView* GetFrameView (void);
241cdf0e10cSrcweir     /** Setting a frame view triggers ReadFrameViewData() for the new
242cdf0e10cSrcweir         frame.
243cdf0e10cSrcweir         @param pFrameView
244cdf0e10cSrcweir             The new frame view that replaces the old one.
245cdf0e10cSrcweir     */
246cdf0e10cSrcweir     void SetFrameView (FrameView* pFrameView);
247cdf0e10cSrcweir 	virtual void  ReadFrameViewData(FrameView* pView);
248cdf0e10cSrcweir 	virtual void  WriteFrameViewData();
249cdf0e10cSrcweir 	virtual void  WriteUserData(String& rString);
250cdf0e10cSrcweir 	virtual void  ReadUserData(const String& rString);
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	virtual sal_Bool  ActivateObject(SdrOle2Obj* pObj, long nVerb);
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 	/** @returns
255cdf0e10cSrcweir 			current or selected page or 0. This method
256cdf0e10cSrcweir 			will fail in master page mode.
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 		@deprecated, please use getCurrentPage();
259cdf0e10cSrcweir 	*/
260cdf0e10cSrcweir 	virtual SdPage*	GetActualPage() = 0;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 	/** @returns
263cdf0e10cSrcweir 			current or selected page or 0.
264cdf0e10cSrcweir 	*/
265cdf0e10cSrcweir 	virtual SdPage* getCurrentPage() const = 0;
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 	FunctionReference GetOldFunction() const { return mxOldFunction; }
268cdf0e10cSrcweir 	bool HasOldFunction() const { return mxOldFunction.is(); }
269cdf0e10cSrcweir 	FunctionReference GetCurrentFunction() const { return mxCurrentFunction; }
270cdf0e10cSrcweir 	bool HasCurrentFunction( sal_uInt16 nSID ) { return mxCurrentFunction.is() && (mxCurrentFunction->GetSlotID() == nSID ); }
271cdf0e10cSrcweir 	bool HasCurrentFunction() { return mxCurrentFunction.is(); }
272cdf0e10cSrcweir 
273cdf0e10cSrcweir     void SetCurrentFunction(const FunctionReference& xFunction);
274cdf0e10cSrcweir     void SetOldFunction(const FunctionReference& xFunction);
275cdf0e10cSrcweir 	void DeactivateCurrentFunction( bool bPermanent = false );
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 	void	SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
278cdf0e10cSrcweir 							long nLeft, long nRight, long nUpper, long nLower,
279cdf0e10cSrcweir 							sal_Bool bScaleAll, Orientation eOrient, sal_uInt16 nPaperBin,
280cdf0e10cSrcweir 							sal_Bool bBackgroundFullSize );
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 	void	SetStartShowWithDialog( sal_Bool bIn = sal_True ) { mbStartShowWithDialog = bIn; }
283cdf0e10cSrcweir 	sal_Bool	IsStartShowWithDialog() const { return mbStartShowWithDialog; }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	sal_uInt16 GetPrintedHandoutPageNum (void) const { return mnPrintedHandoutPageNum; }
286cdf0e10cSrcweir 	void SetPrintedHandoutPageNum (sal_uInt16 nPageNumber) {mnPrintedHandoutPageNum=nPageNumber; }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir     sal_uInt16 GetPrintedHandoutPageCount(void) const { return mnPrintedHandoutPageCount; }
289cdf0e10cSrcweir     void SetPrintedHandoutPageCount (sal_uInt16 nPageCount) {mnPrintedHandoutPageCount=nPageCount; }
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 	virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 	void GetMenuState(SfxItemSet& rSet);
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 	virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
296cdf0e10cSrcweir                                  ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer );
297cdf0e10cSrcweir 	virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
298cdf0e10cSrcweir                                   ::sd::Window* pTargetWindow, sal_uInt16 nPage, sal_uInt16 nLayer );
299cdf0e10cSrcweir 
300cdf0e10cSrcweir     virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
301cdf0e10cSrcweir     virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
302cdf0e10cSrcweir 
303cdf0e10cSrcweir 	/** this method is called when the visible area of the view from this viewshell is changed */
304cdf0e10cSrcweir 	virtual void VisAreaChanged(const Rectangle& rRect);
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     /** Create an accessible object representing the specified window.
307cdf0e10cSrcweir 	    Overload this method to provide view mode specific objects.  The
308cdf0e10cSrcweir 	    default implementation returns an empty reference.
309cdf0e10cSrcweir         @param pWindow
310cdf0e10cSrcweir             Make the document displayed in this window accessible.
311cdf0e10cSrcweir         @return
312cdf0e10cSrcweir             This default implementation returns an empty reference.
313cdf0e10cSrcweir     */
314cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
315cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible>
316cdf0e10cSrcweir         CreateAccessibleDocumentView (::sd::Window* pWindow);
317cdf0e10cSrcweir 
318cdf0e10cSrcweir 	void SetWinViewPos(const Point& rWinPos, bool bUpdate);
319cdf0e10cSrcweir 	Point GetWinViewPos() const;
320cdf0e10cSrcweir 	Point GetViewOrigin() const;
321cdf0e10cSrcweir 
322cdf0e10cSrcweir     /** Return the window updater of this view shell.
323cdf0e10cSrcweir         @return
324cdf0e10cSrcweir             In rare circumstances the returned pointer may be <null/>,
325cdf0e10cSrcweir             i.e. when no memory is available anymore.
326cdf0e10cSrcweir     */
327cdf0e10cSrcweir     ::sd::WindowUpdater* GetWindowUpdater (void) const;
328cdf0e10cSrcweir 
329cdf0e10cSrcweir     /** Return the border that is drawn arround the actual document view.
330cdf0e10cSrcweir         The border contains typically rulers and scroll bars.
331cdf0e10cSrcweir         @param bOuterResize
332cdf0e10cSrcweir             When this flag is <TRUE/> then the border is used for an
333cdf0e10cSrcweir             OuterResizePixel(), i.e. there is a given window size and the
334cdf0e10cSrcweir             border elements are placed inside so that the document view has
335cdf0e10cSrcweir             the given window size minus the border.
336cdf0e10cSrcweir             When the flag is <FALSE/> then the border is used for an
337cdf0e10cSrcweir             InnerResizePixel(), i.e. the document view has a given size and
338cdf0e10cSrcweir             the border is placed outside.  In this scenario the parent
339cdf0e10cSrcweir             window has the size of the document view plus the border.
340cdf0e10cSrcweir     */
341cdf0e10cSrcweir     SvBorder GetBorder (bool bOuterResize);
342cdf0e10cSrcweir 
343cdf0e10cSrcweir     /** Notify the view shell that its parent window has been resized.
344cdf0e10cSrcweir         The ViewShell places and resizes its UI elements accordingly.
345cdf0e10cSrcweir         The new size can be obtained from the parent window.
346cdf0e10cSrcweir     */
347cdf0e10cSrcweir     virtual void Resize (void);
348cdf0e10cSrcweir 
349cdf0e10cSrcweir     /** Set the position and size of the area which contains the GUI
350cdf0e10cSrcweir         elements like rulers, sliders, and buttons as well as the document
351cdf0e10cSrcweir         view.  Both size and position are expected to be in pixel
352cdf0e10cSrcweir         coordinates.  The positions and sizes of the mentioned GUI elements
353cdf0e10cSrcweir         are updated as well.
354cdf0e10cSrcweir 
355cdf0e10cSrcweir         <p> This method is implemented by first setting copying the given
356cdf0e10cSrcweir         values to internal variables and then calling the
357cdf0e10cSrcweir         <type>ArrangeGUIElements</type> method which performs the actual
358cdf0e10cSrcweir         work of sizeing and arranging the UI elements accordingly.</p>
359cdf0e10cSrcweir         @param rPos
360cdf0e10cSrcweir             The position of the enclosing window relative to the document
361cdf0e10cSrcweir             window.  This is only interesting if a Draw/Impress document
362cdf0e10cSrcweir             view is embedded as OLE object into another document view.  For
363cdf0e10cSrcweir             normal documents this position is (0,0).
364cdf0e10cSrcweir         @param rSize
365cdf0e10cSrcweir             The new size in pixel.
366cdf0e10cSrcweir     */
367cdf0e10cSrcweir     // This is to be replaced by Resize.
368cdf0e10cSrcweir     //	virtual void AdjustPosSizePixel(const Point &rPos, const Size &rSize);
369cdf0e10cSrcweir 
370cdf0e10cSrcweir     /** Set position and size of the GUI elements that are controllerd by
371cdf0e10cSrcweir         the view shell like rulers and scroll bars as well as the actual
372cdf0e10cSrcweir         document view according to the position and size that were given
373cdf0e10cSrcweir         with the last Resize() call.
374cdf0e10cSrcweir     */
375cdf0e10cSrcweir     virtual void ArrangeGUIElements (void);
376cdf0e10cSrcweir 
377cdf0e10cSrcweir     //	virtual void OuterResizePixel(const Point &rPos, const Size &rSize);
378cdf0e10cSrcweir     //	virtual void InnerResizePixel(const Point &rPos, const Size &rSize);
379cdf0e10cSrcweir 
380cdf0e10cSrcweir     ViewShellBase& GetViewShellBase (void) const;
381cdf0e10cSrcweir 
382cdf0e10cSrcweir     /** Return <TRUE/> when the called view shell is the main sub shell of
383cdf0e10cSrcweir         its ViewShellBase object, i.e. is display in the center pane.  This
384cdf0e10cSrcweir         convenience function is equivalent to comparing the this pointer to
385cdf0e10cSrcweir         the result of ViewShellBase::GetViewShell(PT_CENTER).
386cdf0e10cSrcweir     */
387cdf0e10cSrcweir     bool IsMainViewShell (void) const;
388cdf0e10cSrcweir 
389cdf0e10cSrcweir     /** Set or reset the flag that indicates whether the called shell is the
390cdf0e10cSrcweir         one displayed in the center pane.  By default this flag is set to
391cdf0e10cSrcweir         <FALSE/>.  For the main view shell it thus has to be set to <TRUE/>.
392cdf0e10cSrcweir     */
393cdf0e10cSrcweir     void SetIsMainViewShell (bool bIsMainViewShell);
394cdf0e10cSrcweir 
395cdf0e10cSrcweir     /** Return a sub controller that implements the view shell specific
396cdf0e10cSrcweir         part of the DrawController.
397cdf0e10cSrcweir     */
398cdf0e10cSrcweir     virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void) = 0;
399cdf0e10cSrcweir 
400cdf0e10cSrcweir     /** Return the type of the shell.
401cdf0e10cSrcweir     */
402cdf0e10cSrcweir     virtual ShellType GetShellType (void) const;
403cdf0e10cSrcweir 
404cdf0e10cSrcweir     /** This method is more or less an alias to Deactivate().  It is called
405cdf0e10cSrcweir         before an object of this class is taken from the stack of view
406cdf0e10cSrcweir         shells.
407cdf0e10cSrcweir 
408cdf0e10cSrcweir         <p>When this method is not called before a view shell is taken from
409cdf0e10cSrcweir         a stack then the Deactivate() call from the SFX as a response to
410cdf0e10cSrcweir         RemoveSubShell() comes to late when the view shell is not on the
411cdf0e10cSrcweir         stack anymore.</p>
412cdf0e10cSrcweir     */
413cdf0e10cSrcweir     virtual void Shutdown (void);
414cdf0e10cSrcweir 
415cdf0e10cSrcweir     /** This function is called from the underlying ViewShellBase
416cdf0e10cSrcweir         object to handle a verb execution request.
417cdf0e10cSrcweir     */
418cdf0e10cSrcweir     virtual ErrCode DoVerb (long nVerb);
419cdf0e10cSrcweir 
420cdf0e10cSrcweir     virtual void UIActivating( SfxInPlaceClient* );
421cdf0e10cSrcweir     virtual void UIDeactivated( SfxInPlaceClient* );
422cdf0e10cSrcweir 
423cdf0e10cSrcweir     /** Show controls of the UI or hide them, depending on the given flag.
424cdf0e10cSrcweir         As a result the border is adapted.
425cdf0e10cSrcweir     */
426cdf0e10cSrcweir 	virtual void ShowUIControls (bool bVisible = true);
427cdf0e10cSrcweir 	sal_Bool IsPageFlipMode(void) const;
428cdf0e10cSrcweir 
429cdf0e10cSrcweir     /** Set the given window as new parent window.  This is not possible for
430cdf0e10cSrcweir         all views, so the return value tells the caller if the relocation
431cdf0e10cSrcweir         was successfull.
432cdf0e10cSrcweir     */
433cdf0e10cSrcweir     virtual bool RelocateToParentWindow (::Window* pParentWindow);
434cdf0e10cSrcweir 
435cdf0e10cSrcweir     /** Depending on the given request create a new page or duplicate an
436cdf0e10cSrcweir         existing one.  A new page is created behind the given slide.
437cdf0e10cSrcweir         @param rRequest
438cdf0e10cSrcweir             The request as passed to an Execute() method.  Its arguments are
439cdf0e10cSrcweir             evaluated.  Its slot id determines whether to create or
440cdf0e10cSrcweir             duplicate a slide.
441cdf0e10cSrcweir         @param pPage
442cdf0e10cSrcweir             This page is either duplicated or becomes the predecessor of the
443cdf0e10cSrcweir             new slide.  If NULL a duplication request is ignored.  A new
444cdf0e10cSrcweir             slide is inserted as first slide.
445cdf0e10cSrcweir         @param nInsertPosition
446cdf0e10cSrcweir             When -1 (the default) then insert after pPage.  Otherwise insert
447cdf0e10cSrcweir             before the given index (of a standard page).
448cdf0e10cSrcweir         @return
449cdf0e10cSrcweir             The new slide is returned.  If for some reason a new page can
450cdf0e10cSrcweir             not be created then NULL is returned.
451cdf0e10cSrcweir     */
452cdf0e10cSrcweir     virtual SdPage* CreateOrDuplicatePage (
453cdf0e10cSrcweir         SfxRequest& rRequest,
454cdf0e10cSrcweir         PageKind ePageKind,
455cdf0e10cSrcweir         SdPage* pPage,
456cdf0e10cSrcweir         const sal_Int32 nInsertPosition = -1);
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 
459cdf0e10cSrcweir     class Implementation;
460cdf0e10cSrcweir 
461cdf0e10cSrcweir protected:
462cdf0e10cSrcweir 	/** must be called in the beginning of each subclass d'tor.
463cdf0e10cSrcweir 		disposes and clears both current and old function. */
464cdf0e10cSrcweir 	void DisposeFunctions();
465cdf0e10cSrcweir 
466cdf0e10cSrcweir     friend class ViewShellBase;
467cdf0e10cSrcweir 
468cdf0e10cSrcweir     /** Window inside the rulers and scroll bars that shows a view of the
469cdf0e10cSrcweir         document.
470cdf0e10cSrcweir     */
471cdf0e10cSrcweir 
472cdf0e10cSrcweir     ::boost::shared_ptr<sd::Window> mpContentWindow;
473cdf0e10cSrcweir 
474cdf0e10cSrcweir     /// Horizontal scroll bar for the current slide is displayed when needed.
475cdf0e10cSrcweir     ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
476cdf0e10cSrcweir     /// Vertical scroll bar for whole document is always visible.
477cdf0e10cSrcweir     ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
478cdf0e10cSrcweir 	/// Horizontal ruler is not shown by default.
479cdf0e10cSrcweir 	::std::auto_ptr<SvxRuler> mpHorizontalRuler;
480cdf0e10cSrcweir     /// Vertical ruler is not shown by default.
481cdf0e10cSrcweir 	::std::auto_ptr<SvxRuler> mpVerticalRuler;
482cdf0e10cSrcweir     /// Filler of the little square enclosed by the two scroll bars.
483cdf0e10cSrcweir     ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
484cdf0e10cSrcweir     /// Layer tab bar.
485cdf0e10cSrcweir     ::std::auto_ptr<LayerTabBar> mpLayerTabBar;
486cdf0e10cSrcweir 
487cdf0e10cSrcweir     /// This flag controls whether the rulers are visible.
488cdf0e10cSrcweir 	bool mbHasRulers;
489cdf0e10cSrcweir 
490cdf0e10cSrcweir 	/// The active window.
491cdf0e10cSrcweir 	::sd::Window* mpActiveWindow;
492cdf0e10cSrcweir 	::sd::View* mpView;
493cdf0e10cSrcweir 	FrameView*	mpFrameView;
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 	FunctionReference	mxCurrentFunction;
496cdf0e10cSrcweir 	FunctionReference	mxOldFunction;
497cdf0e10cSrcweir 	ZoomList*	mpZoomList;
498cdf0e10cSrcweir 
499cdf0e10cSrcweir 	Point		maViewPos;
500cdf0e10cSrcweir 	Size		maViewSize;
501cdf0e10cSrcweir 	Size		maScrBarWH;
502cdf0e10cSrcweir 
503cdf0e10cSrcweir 	sal_Bool		mbCenterAllowed; 		  // wird an Fenster weitergegeben
504cdf0e10cSrcweir 
505cdf0e10cSrcweir 	sal_Bool		mbStartShowWithDialog;	// Praesentation wurde ueber Dialog gestartet
506cdf0e10cSrcweir 	sal_uInt16		mnPrintedHandoutPageNum; // Page number of the handout page that is to be printed.
507cdf0e10cSrcweir     sal_uInt16      mnPrintedHandoutPageCount; // Page count of the handout pages that are to be printed.
508cdf0e10cSrcweir 
509cdf0e10cSrcweir     //af	sal_Bool		bPrintDirectSelected;		// Print only selected objects in direct print
510cdf0e10cSrcweir 	//afString		sPageRange;					// pagerange if selected objects in direct print
511cdf0e10cSrcweir 
512cdf0e10cSrcweir     /** Area covered by all windows, i.e. the area of the parent window
513cdf0e10cSrcweir         without the controls at the borders like rulers, scroll bars, tab
514cdf0e10cSrcweir         bar, buttons.
515cdf0e10cSrcweir         This rectangle may be set in window coordinates (i.e. pixel values
516cdf0e10cSrcweir         relative to the parent window).  It is transformed by every call to
517cdf0e10cSrcweir         GetAllWindowRectangle() into screen coordinates (relative to the
518cdf0e10cSrcweir         upper left corner of the screen.
519cdf0e10cSrcweir     */
520cdf0e10cSrcweir     Rectangle maAllWindowRectangle;
521cdf0e10cSrcweir 
522cdf0e10cSrcweir     /// The type of the shell.  Returned by GetShellType().
523cdf0e10cSrcweir     ShellType meShellType;
524cdf0e10cSrcweir 
525cdf0e10cSrcweir     ::std::auto_ptr<Implementation> mpImpl;
526cdf0e10cSrcweir 
527cdf0e10cSrcweir 	// #96090# Support methods for centralized UNDO/REDO
528cdf0e10cSrcweir 	virtual ::svl::IUndoManager* ImpGetUndoManager (void) const;
529cdf0e10cSrcweir 	void ImpGetUndoStrings(SfxItemSet &rSet) const;
530cdf0e10cSrcweir 	void ImpGetRedoStrings(SfxItemSet &rSet) const;
531cdf0e10cSrcweir 	void ImpSidUndo(sal_Bool bDrawViewShell, SfxRequest& rReq);
532cdf0e10cSrcweir 	void ImpSidRedo(sal_Bool bDrawViewShell, SfxRequest& rReq);
533cdf0e10cSrcweir 
534cdf0e10cSrcweir 	DECL_LINK( HScrollHdl, ScrollBar * );
535cdf0e10cSrcweir 	DECL_LINK( VScrollHdl, ScrollBar * );
536cdf0e10cSrcweir 
537cdf0e10cSrcweir 	// virt. Scroll-Handler, hier koennen sich abgeleitete Klassen einklinken
538cdf0e10cSrcweir 	virtual long VirtHScrollHdl(ScrollBar* pHScroll);
539cdf0e10cSrcweir 	virtual long VirtVScrollHdl(ScrollBar* pVScroll);
540cdf0e10cSrcweir 
541cdf0e10cSrcweir 	// virtuelle Funktionen fuer Lineal-Handling
542cdf0e10cSrcweir 	virtual SvxRuler* CreateHRuler(::sd::Window* pWin, sal_Bool bIsFirst);
543cdf0e10cSrcweir 	virtual SvxRuler* CreateVRuler(::sd::Window* pWin);
544cdf0e10cSrcweir 	virtual void UpdateHRuler();
545cdf0e10cSrcweir 	virtual void UpdateVRuler();
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 	// Zeiger auf ein zusaetzliches Control im horizontalen ScrollBar
548cdf0e10cSrcweir 	// abgeleiteter Klassen (z.B. ein TabBar) zurueckgeben
549cdf0e10cSrcweir 	virtual long GetHCtrlWidth();
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 	virtual void Activate(sal_Bool IsMDIActivate);
552cdf0e10cSrcweir 	virtual void Deactivate(sal_Bool IsMDIActivate);
553cdf0e10cSrcweir 
554cdf0e10cSrcweir 	virtual void SetZoomFactor( const Fraction &rZoomX,
555cdf0e10cSrcweir 								const Fraction &rZoomY );
556cdf0e10cSrcweir 
557cdf0e10cSrcweir private:
558cdf0e10cSrcweir     ::Window* mpParentWindow;
559cdf0e10cSrcweir     /** This window updater is used to keep all relevant windows up to date
560cdf0e10cSrcweir         with reference to the digit langugage used to display digits in text
561cdf0e10cSrcweir         shapes.
562cdf0e10cSrcweir     */
563cdf0e10cSrcweir     ::std::auto_ptr< ::sd::WindowUpdater> mpWindowUpdater;
564cdf0e10cSrcweir 
565cdf0e10cSrcweir     /** Code common to all constructors.  It generally is a bad idea
566cdf0e10cSrcweir         to call this function from outside a constructor.
567cdf0e10cSrcweir     */
568cdf0e10cSrcweir 	void construct (void);
569cdf0e10cSrcweir 
570cdf0e10cSrcweir     DECL_LINK(FrameWindowEventListener, VclSimpleEvent*);
571cdf0e10cSrcweir 
572cdf0e10cSrcweir     /** Create the rulers.
573cdf0e10cSrcweir     */
574cdf0e10cSrcweir     void SetupRulers (void);
575cdf0e10cSrcweir };
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 
580cdf0e10cSrcweir ::Window* ViewShell::GetParentWindow (void) const
581cdf0e10cSrcweir {
582cdf0e10cSrcweir     return mpParentWindow;
583cdf0e10cSrcweir }
584cdf0e10cSrcweir 
585cdf0e10cSrcweir ::sd::View* ViewShell::GetView (void) const
586cdf0e10cSrcweir {
587cdf0e10cSrcweir     return mpView;
588cdf0e10cSrcweir }
589cdf0e10cSrcweir 
590cdf0e10cSrcweir SdrView* ViewShell::GetDrawView (void) const
591cdf0e10cSrcweir {
592cdf0e10cSrcweir     return static_cast<SdrView*>(mpView);
593cdf0e10cSrcweir }
594cdf0e10cSrcweir 
595cdf0e10cSrcweir } // end of namespace sd
596cdf0e10cSrcweir 
597cdf0e10cSrcweir #endif
598