Update ooo320-m1
[ooovba.git] / embedserv / source / inc / docholder.hxx
blobbd42bc0926e93b36d75a62d672c706d22b2e52c4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docholder.hxx,v $
10 * $Revision: 1.21.10.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DOCHOLDER_HXX_
32 #define _DOCHOLDER_HXX_
34 #include "common.h"
35 #include <com/sun/star/frame/XLayoutManager.hpp>
36 #include <com/sun/star/util/XCloseListener.hpp>
37 #include <com/sun/star/frame/XTerminateListener.hpp>
38 #include <com/sun/star/util/XModifyListener.hpp>
39 #include <com/sun/star/frame/XFrame.hpp>
40 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
41 #include <cppuhelper/implbase4.hxx>
43 #include <rtl/ref.hxx>
45 #include "embeddocaccess.hxx"
47 class EmbedDocument_Impl;
48 class Interceptor;
49 class CIIAObj;
51 namespace winwrap {
52 class CHatchWin;
56 class DocumentHolder :
57 public ::cppu::WeakImplHelper4<
58 ::com::sun::star::util::XCloseListener,
59 ::com::sun::star::frame::XTerminateListener,
60 ::com::sun::star::util::XModifyListener,
61 ::com::sun::star::ui::XDockingAreaAcceptor>
63 private:
64 ::osl::Mutex m_aMutex;
66 BOOL m_bAllowInPlace;
67 LPOLEINPLACESITE m_pIOleIPSite;
68 LPOLEINPLACEFRAME m_pIOleIPFrame;
69 LPOLEINPLACEUIWINDOW m_pIOleIPUIWindow;
70 winwrap::CHatchWin* m_pCHatchWin;
72 ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOleAccess;
74 ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xInterceptorLocker;
75 Interceptor* m_pInterceptor;
77 ::com::sun::star::uno::Reference<
78 ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
80 RECT m_aBorder;
82 // contains top level system window data
83 bool m_bOnDeactivate;
84 HWND m_hWndxWinParent;
85 HWND m_hWndxWinCont;
86 HMENU m_nMenuHandle;
87 HMENU m_nMenuShared;
88 HOLEMENU m_nOLEMenu;
89 com::sun::star::uno::Reference<
90 com::sun::star::awt::XWindow> m_xEditWindow;
92 com::sun::star::uno::Reference<
93 com::sun::star::awt::XWindow> m_xContainerWindow;
95 ::com::sun::star::uno::Reference<
96 ::com::sun::star::frame::XModel > m_xDocument;
97 sal_Int16 m_nMacroExecMode;
99 ::com::sun::star::uno::Reference<
100 ::com::sun::star::frame::XLayoutManager> m_xLayoutManager;
103 ::com::sun::star::uno::Reference<
104 ::com::sun::star::frame::XFrame > m_xFrame;
106 ::rtl::OUString m_aContainerName,m_aDocumentNamePart,m_aFilterName;
108 CComPtr< IDispatch > m_pIDispatch;
110 sal_Bool m_bLink;
113 ::com::sun::star::uno::Reference<
114 ::com::sun::star::frame::XFrame > DocumentFrame();
117 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >
118 CreateNewInterceptor();
120 void ClearInterceptorInternally();
122 void LoadDocInFrame( sal_Bool bPluginMode );
123 public:
126 // the instance to which we belong
127 static HINSTANCE m_hInstance;
129 HWND GetEditWindowParentHandle() const
131 return m_hWndxWinParent;
134 void SetContainerWindowHandle(HWND hWndxWinCont)
136 m_hWndxWinCont = hWndxWinCont;
139 DocumentHolder(
140 const ::com::sun::star::uno::Reference<
141 ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
142 const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess );
144 ~DocumentHolder();
146 // Methods for inplace activation
149 BOOL isActive() const;
150 void DisableInplaceActivation(BOOL);
151 HRESULT InPlaceActivate(LPOLECLIENTSITE,BOOL);
152 void InPlaceDeactivate(void);
153 HRESULT UIActivate();
154 void UIDeactivate();
155 BOOL InPlaceMenuCreate(void);
156 BOOL InPlaceMenuDestroy(void);
158 void OpenIntoWindow(void);
159 BOOL Undo(void);
161 // further methods
163 void SetDocument(
164 const ::com::sun::star::uno::Reference<
165 ::com::sun::star::frame::XModel >& xDoc,
166 sal_Bool bLink = sal_False
169 sal_Bool ExecuteSuspendCloseFrame();
171 void DisconnectFrameDocument( sal_Bool bComplete = sal_False );
172 void CloseDocument();
173 void CloseFrame();
174 void ClearInterceptor();
175 void FreeOffice();
177 void resizeWin( const SIZEL& rNewSize );
179 void setTitle(const rtl::OUString& aDocumentName);
180 rtl::OUString getTitle() const { return m_aDocumentNamePart; }
182 void setContainerName(const rtl::OUString& aContainerName);
183 rtl::OUString getContainerName() const { return m_aContainerName; }
184 void OnPosRectChanged(LPRECT lpRect) const;
185 void show();
187 sal_Bool HasFrame() { return m_xFrame.is(); }
188 sal_Bool IsLink() { return m_bLink; }
190 /** hides the document window, even in case of an external container
191 * side managed window.
194 void hide();
196 IDispatch* GetIDispatch();
198 HRESULT GetDocumentBorder( RECT *pRect );
199 // HRESULT SetVisArea( const RECTL *pRect );
200 // HRESULT GetVisArea( RECTL *pRect );
201 HRESULT SetExtent( const SIZEL *pSize );
202 HRESULT GetExtent( SIZEL *pSize );
203 // sets extension on the hatchwindow
204 HRESULT SetContRects(LPCRECT pRect);
205 HRESULT SetObjectRects(LPCRECT aRect, LPCRECT aClip);
207 HWND GetTopMostWinHandle() const
209 return m_hWndxWinParent;
212 ::com::sun::star::uno::Reference<
213 ::com::sun::star::frame::XModel >
214 GetDocument() const
216 return m_xDocument;
219 // XEventListener
220 virtual void SAL_CALL
221 disposing( const com::sun::star::lang::EventObject& aSource )
222 throw( ::com::sun::star::uno::RuntimeException );
224 // XCloseListener
225 virtual void SAL_CALL
226 queryClosing(
227 const com::sun::star::lang::EventObject& aSource,
228 sal_Bool bGetsOwnership
230 throw(
231 ::com::sun::star::util::CloseVetoException
234 virtual void SAL_CALL
235 notifyClosing(
236 const com::sun::star::lang::EventObject& aSource
238 throw( ::com::sun::star::uno::RuntimeException );
240 // XTerminateListener
241 virtual void SAL_CALL
242 queryTermination(
243 const com::sun::star::lang::EventObject& aSource
245 throw(
246 ::com::sun::star::frame::TerminationVetoException
249 virtual void SAL_CALL
250 notifyTermination(
251 const com::sun::star::lang::EventObject& aSource
253 throw( ::com::sun::star::uno::RuntimeException );
256 // XModifyListener
257 virtual void SAL_CALL
258 modified(
259 const ::com::sun::star::lang::EventObject& aEvent
261 throw (
262 ::com::sun::star::uno::RuntimeException
265 // XDockingAreaAcceptor
267 virtual ::com::sun::star::uno::Reference<
268 ::com::sun::star::awt::XWindow> SAL_CALL
269 getContainerWindow(
271 throw (
272 ::com::sun::star::uno::RuntimeException
275 virtual sal_Bool SAL_CALL
276 requestDockingAreaSpace(
277 const ::com::sun::star::awt::Rectangle& RequestedSpace
279 throw(
280 ::com::sun::star::uno::RuntimeException
283 virtual void SAL_CALL
284 setDockingAreaSpace(
285 const ::com::sun::star::awt::Rectangle& BorderSpace
287 throw (
288 ::com::sun::star::uno::RuntimeException
292 #endif