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 INCLUDED_EMBEDSERV_SOURCE_INC_DOCHOLDER_HXX
21 #define INCLUDED_EMBEDSERV_SOURCE_INC_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/XFrame2.hpp>
29 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
30 #include <cppuhelper/implbase.hxx>
32 #include <rtl/ref.hxx>
34 #include "embeddocaccess.hxx"
36 class EmbedDocument_Impl
;
45 class DocumentHolder
:
46 public ::cppu::WeakImplHelper
<
47 css::util::XCloseListener
,
48 css::frame::XTerminateListener
,
49 css::util::XModifyListener
,
50 css::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 css::uno::WeakReference
< css::frame::XDispatchProviderInterceptor
> m_xInterceptorLocker
;
64 Interceptor
* m_pInterceptor
;
66 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xFactory
;
70 // contains top level system window data
72 HWND m_hWndxWinParent
;
77 css::uno::Reference
< css::awt::XWindow
> m_xEditWindow
;
79 css::uno::Reference
< css::awt::XWindow
> m_xContainerWindow
;
81 css::uno::Reference
< css::frame::XModel
> m_xDocument
;
82 sal_Int16 m_nMacroExecMode
;
84 css::uno::Reference
< css::frame::XLayoutManager
> m_xLayoutManager
;
87 css::uno::Reference
< css::frame::XFrame2
> m_xFrame
;
89 OUString m_aContainerName
,m_aDocumentNamePart
,m_aFilterName
;
91 CComPtr
< IDispatch
> m_pIDispatch
;
96 css::uno::Reference
< css::frame::XFrame2
> DocumentFrame();
99 css::uno::Reference
< css::frame::XDispatchProviderInterceptor
>
100 CreateNewInterceptor();
102 void ClearInterceptorInternally();
104 void LoadDocInFrame( sal_Bool bPluginMode
);
108 // the instance to which we belong
109 static HINSTANCE m_hInstance
;
111 HWND
GetEditWindowParentHandle() const
113 return m_hWndxWinParent
;
116 void SetContainerWindowHandle(HWND hWndxWinCont
)
118 m_hWndxWinCont
= hWndxWinCont
;
122 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xFactory
,
123 const ::rtl::Reference
< EmbeddedDocumentInstanceAccess_Impl
>& xOleAccess
);
127 // Methods for inplace activation
130 BOOL
isActive() const;
131 void DisableInplaceActivation(BOOL
);
132 HRESULT
InPlaceActivate(LPOLECLIENTSITE
,BOOL
);
133 void InPlaceDeactivate();
134 HRESULT
UIActivate();
136 BOOL
InPlaceMenuCreate();
137 BOOL
InPlaceMenuDestroy();
139 void OpenIntoWindow();
145 const css::uno::Reference
< css::frame::XModel
>& xDoc
,
146 sal_Bool bLink
= sal_False
149 sal_Bool
ExecuteSuspendCloseFrame();
151 void DisconnectFrameDocument( sal_Bool bComplete
= sal_False
);
152 void CloseDocument();
154 void ClearInterceptor();
157 void resizeWin( const SIZEL
& rNewSize
);
159 void setTitle(const OUString
& aDocumentName
);
160 OUString
getTitle() const { return m_aDocumentNamePart
; }
162 void setContainerName(const OUString
& aContainerName
);
163 OUString
getContainerName() const { return m_aContainerName
; }
164 void OnPosRectChanged(LPRECT lpRect
) const;
167 sal_Bool
HasFrame() { return m_xFrame
.is(); }
168 sal_Bool
IsLink() { return m_bLink
; }
170 /** hides the document window, even in case of an external container
171 * side managed window.
176 IDispatch
* GetIDispatch();
178 HRESULT
GetDocumentBorder( RECT
*pRect
);
179 // HRESULT SetVisArea( const RECTL *pRect );
180 // HRESULT GetVisArea( RECTL *pRect );
181 HRESULT
SetExtent( const SIZEL
*pSize
);
182 HRESULT
GetExtent( SIZEL
*pSize
);
183 // sets extension on the hatchwindow
184 HRESULT
SetContRects(LPCRECT pRect
);
185 HRESULT
SetObjectRects(LPCRECT aRect
, LPCRECT aClip
);
187 HWND
GetTopMostWinHandle() const
189 return m_hWndxWinParent
;
192 css::uno::Reference
< css::frame::XModel
>
199 virtual void SAL_CALL
200 disposing( const css::lang::EventObject
& aSource
)
201 throw( css::uno::RuntimeException
);
204 virtual void SAL_CALL
206 const css::lang::EventObject
& aSource
,
207 sal_Bool bGetsOwnership
210 css::util::CloseVetoException
213 virtual void SAL_CALL
215 const css::lang::EventObject
& aSource
217 throw( css::uno::RuntimeException
);
219 // XTerminateListener
220 virtual void SAL_CALL
222 const css::lang::EventObject
& aSource
225 css::frame::TerminationVetoException
228 virtual void SAL_CALL
230 const css::lang::EventObject
& aSource
232 throw( css::uno::RuntimeException
);
236 virtual void SAL_CALL
238 const css::lang::EventObject
& aEvent
241 css::uno::RuntimeException
244 // XDockingAreaAcceptor
246 virtual css::uno::Reference
<
247 css::awt::XWindow
> SAL_CALL
251 css::uno::RuntimeException
254 virtual sal_Bool SAL_CALL
255 requestDockingAreaSpace(
256 const css::awt::Rectangle
& RequestedSpace
259 css::uno::RuntimeException
262 virtual void SAL_CALL
264 const css::awt::Rectangle
& BorderSpace
267 css::uno::RuntimeException
273 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */