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