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     /** Update the preview to show the specified page.
143     */
144 	virtual void UpdatePreview (SdPage* pPage, sal_Bool bInit = sal_False);
145 
146     virtual css::uno::Reference<css::drawing::XDrawSubController> CreateSubController (void);
147 
148     /** Make the given page the new current page.  This method
149         notifies the controller and adapts the selection of the
150         model.
151         @param pPage
152             The new current page.  Pass NULL when there is no current page.
153     */
154     void SetCurrentPage (SdPage* pPage);
155 
156 	bool UpdateTitleObject( SdPage* pPage, Paragraph* pPara );
157 	bool UpdateOutlineObject( SdPage* pPage, Paragraph* pPara );
158 
159 protected:
160 	virtual Size GetOptimalSizePixel() const;
161 
162 private:
163 	OutlineView* pOlView;
164 	SdPage*			pLastPage; // Zur performanten Aufbereitung der Preview
165 	TransferableClipboardListener* pClipEvtLstnr;
166 	sal_Bool			bPastePossible;
167     bool mbInitialized;
168 
169 	void Construct (DrawDocShell* pDocSh);
170 	DECL_LINK( ClipboardChanged, TransferableDataHelper* );
171 };
172 
173 } // end of namespace sd
174 
175 #endif
176