xref: /aoo42x/main/sd/source/ui/inc/SlideViewShell.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_SLIDE_VIEW_SHELL_HXX
29 #define SD_SLIDE_VIEW_SHELL_HXX
30 
31 
32 #include "ViewShell.hxx"
33 #include "SlideView.hxx"
34 #include <sfx2/viewfac.hxx>
35 #include <sfx2/viewsh.hxx>
36 
37 
38 
39 class SdPage;
40 
41 
42 
43 namespace sd {
44 
45 class SdUnoSlideView;
46 class Window;
47 
48 /** Show an overview over the slides in an Impress document and allow
49     some high level editing i.e. editing of the order in a show, not
50     the contents of the slides.
51 */
52 class SlideViewShell
53     : public ViewShell
54 {
55 public:
56 
57     TYPEINFO();
58 
59     SFX_DECL_VIEWFACTORY(SlideViewShell);
60     SFX_DECL_INTERFACE(SD_IF_SDSLIDEVIEWSHELL)
61 
62     /** Create a new view shell for the slide view.
63         @param rViewShellBase
64             The new object will be stacked on this view shell base.
65         @param pFrameView
66             The frame view that makes it possible to pass information from
67             one view shell to the next.
68     */
69     SlideViewShell(SfxViewFrame* pFrame,
70         ViewShellBase& rViewShellBase,
71         ::Window* pParentWindow,
72         FrameView* pFrameView = NULL);
73 
74     SlideViewShell(SfxViewFrame *pFrame,
75         ::Window* pParentWindow,
76         const SlideViewShell& rShell);
77 
78     virtual ~SlideViewShell (void);
79 
80 	virtual void    Paint(const Rectangle& rRect, ::sd::Window* pWin);
81 
82     /** Arrange and resize the GUI elements like rulers, sliders, and
83         buttons as well as the actual document view according to the size of
84         the enclosing window and current sizes of buttons, rulers, and
85         sliders.
86     */
87     virtual void ArrangeGUIElements (void);
88 	virtual void    AddWindow(::sd::Window* pWin) { pSlideView->AddWindowToPaintView((OutputDevice*) pWin); }
89 	virtual void    RemoveWindow(::sd::Window* pWin) { pSlideView->DeleteWindowFromPaintView((OutputDevice*) pWin); }
90 
91 	virtual sal_Bool    KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin);
92 	virtual void    MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin);
93 	virtual void    MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin);
94 	virtual void    MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin);
95 	virtual void    Command(const CommandEvent& rCEvt, ::sd::Window* pWin);
96 
97 	virtual SdPage*	GetActualPage();
98 
99 	/** @returns
100 			current or selected page or 0.
101 	*/
102 	virtual SdPage* getCurrentPage() const;
103 
104 	void            ExecCtrl(SfxRequest &rReq);
105 	void            GetCtrlState(SfxItemSet &rSet);
106 	void            GetMenuState(SfxItemSet &rSet);
107 	void            GetAttrState(SfxItemSet &rSet);
108 
109     void            SetPagesPerRow( sal_uInt16 nPagesPerRow );
110 
111 	void            ExecStatusBar(SfxRequest& rReq);
112 	void            GetStatusBarState(SfxItemSet& rSet);
113 
114 	void            FuTemporary(SfxRequest &rReq);
115 	void            FuPermanent(SfxRequest &rReq);
116 	void            FuSupport(SfxRequest &rReq);
117 
118 	virtual void    ReadFrameViewData(FrameView* pView);
119 	virtual void    WriteFrameViewData();
120 
121 	virtual void	SetZoom(long nZoom);
122 	virtual void	SetZoomRect(const Rectangle& rZoomRect);
123 
124 	virtual sal_Bool    HasSelection( sal_Bool bText = sal_True ) const;
125 
126     /** Draw the rectangle arround the specified slide that indicates whether
127         the slide is selected or not.  When not selected the rectangle is
128         painted in the background color (WindowColor from the style settings)
129         and is therefore not visible.  A selected slide is painted with the
130         WindowTextColor from the style settings.  Painting takes place in
131         all associated windows.  The line- and fill color of the windows are
132         restored to their original values after the rectangle is painted.
133         @param nPage
134             When the page number is invalid then the call is ignored.
135     */
136 	void			DrawSelectionRect( sal_uInt16 nPage );
137     void			DrawFocusRect( sal_uInt16 nPage );
138 
139     virtual void    WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
140     virtual void    ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
141 
142 	virtual void    VisAreaChanged(const Rectangle& rRect);
143 
144     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> CreateAccessibleDocumentView( ::sd::Window* pWindow );
145 
146     void            SelectionHasChanged();
147     void            PageLayoutHasChanged();
148     void            FocusHasChanged( sal_uInt16 nOldFocusPage, sal_uInt16 nNewFocusPage );
149     void            PageVisibilityHasChanged( sal_uInt16 nPage, sal_Bool bVisible );
150 
151     /** On activation the preview is turned off.
152     */
153     virtual void Activate (sal_Bool IsMDIActivate);
154 
155 protected:
156 	virtual Size    GetOptimalSizePixel() const;
157 	virtual long    VirtHScrollHdl(ScrollBar* pHScroll);
158 	virtual long    VirtVScrollHdl(ScrollBar* pVHScroll);
159 
160 
161 private:
162 	SlideView* pSlideView;
163 	Point		    aDisplayPos;
164 	Size		    aDisplaySize;
165     sal_uInt16          nCurFocusPage;
166 	bool		    bSetInitialZoomFactor;
167 	bool		    bInitializeWinPos;
168 
169 	void            Construct(SdDrawDocument* pDoc);
170     void            ImplDrawFocusRect( sal_uInt16 nPage, sal_Bool bVisible );
171 };
172 
173 } // end of namespace sd
174 
175 #endif
176