1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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_
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
;
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
>
64 ::osl::Mutex m_aMutex
;
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
;
82 // contains top level system window data
84 HWND m_hWndxWinParent
;
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
;
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
);
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
;
140 const ::com::sun::star::uno::Reference
<
141 ::com::sun::star::lang::XMultiServiceFactory
>& xFactory
,
142 const ::rtl::Reference
< EmbeddedDocumentInstanceAccess_Impl
>& xOleAccess
);
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();
155 BOOL
InPlaceMenuCreate(void);
156 BOOL
InPlaceMenuDestroy(void);
158 void OpenIntoWindow(void);
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();
174 void ClearInterceptor();
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;
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.
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
>
220 virtual void SAL_CALL
221 disposing( const com::sun::star::lang::EventObject
& aSource
)
222 throw( ::com::sun::star::uno::RuntimeException
);
225 virtual void SAL_CALL
227 const com::sun::star::lang::EventObject
& aSource
,
228 sal_Bool bGetsOwnership
231 ::com::sun::star::util::CloseVetoException
234 virtual void SAL_CALL
236 const com::sun::star::lang::EventObject
& aSource
238 throw( ::com::sun::star::uno::RuntimeException
);
240 // XTerminateListener
241 virtual void SAL_CALL
243 const com::sun::star::lang::EventObject
& aSource
246 ::com::sun::star::frame::TerminationVetoException
249 virtual void SAL_CALL
251 const com::sun::star::lang::EventObject
& aSource
253 throw( ::com::sun::star::uno::RuntimeException
);
257 virtual void SAL_CALL
259 const ::com::sun::star::lang::EventObject
& aEvent
262 ::com::sun::star::uno::RuntimeException
265 // XDockingAreaAcceptor
267 virtual ::com::sun::star::uno::Reference
<
268 ::com::sun::star::awt::XWindow
> SAL_CALL
272 ::com::sun::star::uno::RuntimeException
275 virtual sal_Bool SAL_CALL
276 requestDockingAreaSpace(
277 const ::com::sun::star::awt::Rectangle
& RequestedSpace
280 ::com::sun::star::uno::RuntimeException
283 virtual void SAL_CALL
285 const ::com::sun::star::awt::Rectangle
& BorderSpace
288 ::com::sun::star::uno::RuntimeException