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