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_OUTLINE_VIEW_SHELL_HXX
29 #define SD_OUTLINE_VIEW_SHELL_HXX
30 
31 #include "DrawDocShell.hxx"
32 #include "ViewShell.hxx"
33 #include "OutlineView.hxx"
34 
35 class SdPage;
36 class TransferableDataHelper;
37 class TransferableClipboardListener;
38 
39 namespace sd {
40 
41 class SdUnoOutlineView;
42 
43 /** Show a textual overview of the text contents of all slides.
44 */
45 class OutlineViewShell
46     : public ViewShell
47 {
48 public:
49 	TYPEINFO();
50 
51 	SFX_DECL_VIEWFACTORY(OutlineViewShell);
52 	SFX_DECL_INTERFACE(SD_IF_SDOUTLINEVIEWSHELL)
53 
54     // The previous macros change access mode.  To be sure switch back
55     // to public access.
56 public:
57     /** Create a new view shell for the outline mode.
58         @param rViewShellBase
59             The new object will be stacked on this view shell base.
60         @param pFrameView
61             The frame view that makes it possible to pass information from
62             one view shell to the next.
63     */
64     OutlineViewShell (
65         SfxViewFrame* pFrame,
66         ViewShellBase& rViewShellBase,
67         ::Window* pParentWindow,
68         FrameView* pFrameView = NULL);
69 
70 	virtual ~OutlineViewShell (void);
71 
72     virtual void Shutdown (void);
73 
74 	virtual void Paint(const Rectangle& rRect, ::sd::Window* pWin);
75 
76     /** Arrange and resize the GUI elements like rulers, sliders, and
77         buttons as well as the actual document view according to the size of
78         the enclosing window and current sizes of buttons, rulers, and
79         sliders.
80     */
81     virtual void ArrangeGUIElements (void);
82 
83 	virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
84 
85 	virtual long VirtHScrollHdl(ScrollBar* pHScroll);
86 	virtual long VirtVScrollHdl(ScrollBar* pVHScroll);
87 
88 	virtual void AddWindow(::sd::Window* pWin);
89 	virtual void RemoveWindow(::sd::Window* pWin);
90 
91 	virtual void Activate( sal_Bool IsMDIActivate );
92 	virtual void Deactivate( sal_Bool IsMDIActivate );
93 
94 	virtual SdPage*	GetActualPage();
95 
96 	/// inherited from sd::ViewShell
97 	virtual SdPage* getCurrentPage() const;
98 
99 	void ExecCtrl(SfxRequest &rReq);
100 	void GetCtrlState(SfxItemSet &rSet);
101 	void GetMenuState(SfxItemSet &rSet);
102 	void GetAttrState(SfxItemSet &rSet);
103     void GetState (SfxItemSet& rSet);
104 
105 	void ExecStatusBar(SfxRequest& rReq);
106 	void GetStatusBarState(SfxItemSet& rSet);
107 
108 	void FuTemporary(SfxRequest &rReq);
109 	void FuTemporaryModify(SfxRequest &rReq);
110 	void FuPermanent(SfxRequest &rReq);
111 	void FuSupport(SfxRequest &rReq);
112 
113 	virtual void SetZoom(long nZoom);
114 	virtual void SetZoomRect(const Rectangle& rZoomRect);
115 	virtual String	GetSelectionText( sal_Bool bCompleteWords = sal_False );
116 	virtual sal_Bool    HasSelection( sal_Bool bText = sal_True ) const;
117 
118 	void Execute(SfxRequest& rReq);
119 
120 	virtual void ReadFrameViewData(FrameView* pView);
121 	virtual void WriteFrameViewData();
122 
123 	virtual void Command( const CommandEvent& rCEvt, ::sd::Window* pWin );
124 	virtual sal_Bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin);
125 	virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin);
126 
127     sal_uLong   Read(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat);
128 
129     virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
130     virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
131 
132 	/** this method is called when the visible area of the view from this viewshell is changed */
133 	virtual void VisAreaChanged(const Rectangle& rRect);
134 
135     /** Create an accessible object representing the specified window.
136 	    @param pWindow
137 	        The returned object makes the document displayed in this window
138 	        accessible.
139         @return
140 	        Returns an <type>AccessibleDrawDocumentView</type> object.
141    */
142     virtual ::com::sun::star::uno::Reference<
143         ::com::sun::star::accessibility::XAccessible>
144         CreateAccessibleDocumentView (::sd::Window* pWindow);
145 
146     /** Update the preview to show the specified page.
147     */
148 	virtual void UpdatePreview (SdPage* pPage, sal_Bool bInit = sal_False);
149 
150     virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
151 
152     /** Make the given page the new current page.  This method
153         notifies the controller and adapts the selection of the
154         model.
155         @param pPage
156             The new current page.  Pass NULL when there is no current page.
157     */
158     void SetCurrentPage (SdPage* pPage);
159 
160 	bool UpdateTitleObject( SdPage* pPage, Paragraph* pPara );
161 	bool UpdateOutlineObject( SdPage* pPage, Paragraph* pPara );
162 
163 protected:
164 	virtual Size GetOptimalSizePixel() const;
165 
166 private:
167 	OutlineView* pOlView;
168 	SdPage*			pLastPage; // Zur performanten Aufbereitung der Preview
169 	TransferableClipboardListener* pClipEvtLstnr;
170 	sal_Bool			bPastePossible;
171     bool mbInitialized;
172 
173 	void Construct (DrawDocShell* pDocSh);
174 	DECL_LINK( ClipboardChanged, TransferableDataHelper* );
175 };
176 
177 } // end of namespace sd
178 
179 #endif
180