1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _DOCHOLDER_HXX_
21 #define _DOCHOLDER_HXX_
24 #include <com/sun/star/frame/XLayoutManager.hpp>
25 #include <com/sun/star/util/XCloseListener.hpp>
26 #include <com/sun/star/frame/XTerminateListener.hpp>
27 #include <com/sun/star/util/XModifyListener.hpp>
28 #include <com/sun/star/frame/XFrame.hpp>
29 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
30 #include <cppuhelper/implbase4.hxx>
32 #include <rtl/ref.hxx>
34 #include "embeddocaccess.hxx"
36 class EmbedDocument_Impl
;
45 class DocumentHolder
:
46 public ::cppu::WeakImplHelper4
<
47 ::com::sun::star::util::XCloseListener
,
48 ::com::sun::star::frame::XTerminateListener
,
49 ::com::sun::star::util::XModifyListener
,
50 ::com::sun::star::ui::XDockingAreaAcceptor
>
53 ::osl::Mutex m_aMutex
;
56 LPOLEINPLACESITE m_pIOleIPSite
;
57 LPOLEINPLACEFRAME m_pIOleIPFrame
;
58 LPOLEINPLACEUIWINDOW m_pIOleIPUIWindow
;
59 winwrap::CHatchWin
* m_pCHatchWin
;
61 ::rtl::Reference
< EmbeddedDocumentInstanceAccess_Impl
> m_xOleAccess
;
63 ::com::sun::star::uno::WeakReference
< ::com::sun::star::frame::XDispatchProviderInterceptor
> m_xInterceptorLocker
;
64 Interceptor
* m_pInterceptor
;
66 ::com::sun::star::uno::Reference
<
67 ::com::sun::star::lang::XMultiServiceFactory
> m_xFactory
;
71 // contains top level system window data
73 HWND m_hWndxWinParent
;
78 com::sun::star::uno::Reference
<
79 com::sun::star::awt::XWindow
> m_xEditWindow
;
81 com::sun::star::uno::Reference
<
82 com::sun::star::awt::XWindow
> m_xContainerWindow
;
84 ::com::sun::star::uno::Reference
<
85 ::com::sun::star::frame::XModel
> m_xDocument
;
86 sal_Int16 m_nMacroExecMode
;
88 ::com::sun::star::uno::Reference
<
89 ::com::sun::star::frame::XLayoutManager
> m_xLayoutManager
;
92 ::com::sun::star::uno::Reference
<
93 ::com::sun::star::frame::XFrame
> m_xFrame
;
95 ::rtl::OUString m_aContainerName
,m_aDocumentNamePart
,m_aFilterName
;
97 CComPtr
< IDispatch
> m_pIDispatch
;
102 ::com::sun::star::uno::Reference
<
103 ::com::sun::star::frame::XFrame
> DocumentFrame();
106 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProviderInterceptor
>
107 CreateNewInterceptor();
109 void ClearInterceptorInternally();
111 void LoadDocInFrame( sal_Bool bPluginMode
);
115 // the instance to which we belong
116 static HINSTANCE m_hInstance
;
118 HWND
GetEditWindowParentHandle() const
120 return m_hWndxWinParent
;
123 void SetContainerWindowHandle(HWND hWndxWinCont
)
125 m_hWndxWinCont
= hWndxWinCont
;
129 const ::com::sun::star::uno::Reference
<
130 ::com::sun::star::lang::XMultiServiceFactory
>& xFactory
,
131 const ::rtl::Reference
< EmbeddedDocumentInstanceAccess_Impl
>& xOleAccess
);
135 // Methods for inplace activation
138 BOOL
isActive() const;
139 void DisableInplaceActivation(BOOL
);
140 HRESULT
InPlaceActivate(LPOLECLIENTSITE
,BOOL
);
141 void InPlaceDeactivate(void);
142 HRESULT
UIActivate();
144 BOOL
InPlaceMenuCreate(void);
145 BOOL
InPlaceMenuDestroy(void);
147 void OpenIntoWindow(void);
153 const ::com::sun::star::uno::Reference
<
154 ::com::sun::star::frame::XModel
>& xDoc
,
155 sal_Bool bLink
= sal_False
158 sal_Bool
ExecuteSuspendCloseFrame();
160 void DisconnectFrameDocument( sal_Bool bComplete
= sal_False
);
161 void CloseDocument();
163 void ClearInterceptor();
166 void resizeWin( const SIZEL
& rNewSize
);
168 void setTitle(const rtl::OUString
& aDocumentName
);
169 rtl::OUString
getTitle() const { return m_aDocumentNamePart
; }
171 void setContainerName(const rtl::OUString
& aContainerName
);
172 rtl::OUString
getContainerName() const { return m_aContainerName
; }
173 void OnPosRectChanged(LPRECT lpRect
) const;
176 sal_Bool
HasFrame() { return m_xFrame
.is(); }
177 sal_Bool
IsLink() { return m_bLink
; }
179 /** hides the document window, even in case of an external container
180 * side managed window.
185 IDispatch
* GetIDispatch();
187 HRESULT
GetDocumentBorder( RECT
*pRect
);
188 // HRESULT SetVisArea( const RECTL *pRect );
189 // HRESULT GetVisArea( RECTL *pRect );
190 HRESULT
SetExtent( const SIZEL
*pSize
);
191 HRESULT
GetExtent( SIZEL
*pSize
);
192 // sets extension on the hatchwindow
193 HRESULT
SetContRects(LPCRECT pRect
);
194 HRESULT
SetObjectRects(LPCRECT aRect
, LPCRECT aClip
);
196 HWND
GetTopMostWinHandle() const
198 return m_hWndxWinParent
;
201 ::com::sun::star::uno::Reference
<
202 ::com::sun::star::frame::XModel
>
209 virtual void SAL_CALL
210 disposing( const com::sun::star::lang::EventObject
& aSource
)
211 throw( ::com::sun::star::uno::RuntimeException
);
214 virtual void SAL_CALL
216 const com::sun::star::lang::EventObject
& aSource
,
217 sal_Bool bGetsOwnership
220 ::com::sun::star::util::CloseVetoException
223 virtual void SAL_CALL
225 const com::sun::star::lang::EventObject
& aSource
227 throw( ::com::sun::star::uno::RuntimeException
);
229 // XTerminateListener
230 virtual void SAL_CALL
232 const com::sun::star::lang::EventObject
& aSource
235 ::com::sun::star::frame::TerminationVetoException
238 virtual void SAL_CALL
240 const com::sun::star::lang::EventObject
& aSource
242 throw( ::com::sun::star::uno::RuntimeException
);
246 virtual void SAL_CALL
248 const ::com::sun::star::lang::EventObject
& aEvent
251 ::com::sun::star::uno::RuntimeException
254 // XDockingAreaAcceptor
256 virtual ::com::sun::star::uno::Reference
<
257 ::com::sun::star::awt::XWindow
> SAL_CALL
261 ::com::sun::star::uno::RuntimeException
264 virtual sal_Bool SAL_CALL
265 requestDockingAreaSpace(
266 const ::com::sun::star::awt::Rectangle
& RequestedSpace
269 ::com::sun::star::uno::RuntimeException
272 virtual void SAL_CALL
274 const ::com::sun::star::awt::Rectangle
& BorderSpace
277 ::com::sun::star::uno::RuntimeException
283 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */