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>
31 #include <cppuhelper/weakref.hxx>
33 #include <rtl/ref.hxx>
35 #include "embeddocaccess.hxx"
37 class EmbedDocument_Impl
;
46 class DocumentHolder
:
47 public ::cppu::WeakImplHelper
<
48 css::util::XCloseListener
,
49 css::frame::XTerminateListener
,
50 css::util::XModifyListener
,
51 css::ui::XDockingAreaAcceptor
>
54 ::osl::Mutex m_aMutex
;
57 LPOLEINPLACESITE m_pIOleIPSite
;
58 LPOLEINPLACEFRAME m_pIOleIPFrame
;
59 LPOLEINPLACEUIWINDOW m_pIOleIPUIWindow
;
60 winwrap::CHatchWin
* m_pCHatchWin
;
62 ::rtl::Reference
< EmbeddedDocumentInstanceAccess_Impl
> m_xOleAccess
;
64 css::uno::WeakReference
< css::frame::XDispatchProviderInterceptor
> m_xInterceptorLocker
;
65 Interceptor
* m_pInterceptor
;
67 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xFactory
;
71 // contains top level system window data
73 HWND m_hWndxWinParent
;
78 css::uno::Reference
< css::awt::XWindow
> m_xEditWindow
;
80 css::uno::Reference
< css::awt::XWindow
> m_xContainerWindow
;
82 css::uno::Reference
< css::frame::XModel
> m_xDocument
;
83 sal_Int16 m_nMacroExecMode
;
85 css::uno::Reference
< css::frame::XLayoutManager
> m_xLayoutManager
;
88 css::uno::Reference
< css::frame::XFrame2
> m_xFrame
;
90 OUString m_aContainerName
,m_aDocumentNamePart
,m_aFilterName
;
92 CComPtr
< IDispatch
> m_pIDispatch
;
97 css::uno::Reference
< css::frame::XFrame2
> DocumentFrame();
100 css::uno::Reference
< css::frame::XDispatchProviderInterceptor
>
101 CreateNewInterceptor();
103 void ClearInterceptorInternally();
105 void LoadDocInFrame( bool bPluginMode
);
109 // the instance to which we belong
110 static HINSTANCE m_hInstance
;
112 HWND
GetEditWindowParentHandle() const
114 return m_hWndxWinParent
;
117 void SetContainerWindowHandle(HWND hWndxWinCont
)
119 m_hWndxWinCont
= hWndxWinCont
;
123 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xFactory
,
124 const ::rtl::Reference
< EmbeddedDocumentInstanceAccess_Impl
>& xOleAccess
);
126 ~DocumentHolder() override
;
128 // Methods for inplace activation
131 BOOL
isActive() const;
132 void DisableInplaceActivation(BOOL
);
133 HRESULT
InPlaceActivate(LPOLECLIENTSITE
,BOOL
);
134 void InPlaceDeactivate();
135 HRESULT
UIActivate();
137 BOOL
InPlaceMenuCreate();
138 BOOL
InPlaceMenuDestroy();
140 static void OpenIntoWindow();
146 const css::uno::Reference
< css::frame::XModel
>& xDoc
,
150 bool ExecuteSuspendCloseFrame();
152 void DisconnectFrameDocument( bool bComplete
= false );
153 void CloseDocument();
155 void ClearInterceptor();
158 void resizeWin( const SIZEL
& rNewSize
);
160 void setTitle(const OUString
& aDocumentName
);
161 OUString
getTitle() const { return m_aDocumentNamePart
; }
163 void setContainerName(const OUString
& aContainerName
);
164 OUString
getContainerName() const { return m_aContainerName
; }
165 void OnPosRectChanged(LPRECT lpRect
) const;
168 bool HasFrame() { return m_xFrame
.is(); }
169 bool IsLink() { return m_bLink
; }
171 /** hides the document window, even in case of an external container
172 * side managed window.
177 IDispatch
* GetIDispatch();
179 HRESULT
GetDocumentBorder( RECT
*pRect
);
180 // HRESULT SetVisArea( const RECTL *pRect );
181 // HRESULT GetVisArea( RECTL *pRect );
182 HRESULT
SetExtent( const SIZEL
*pSize
);
183 HRESULT
GetExtent( SIZEL
*pSize
);
184 // sets extension on the hatchwindow
185 HRESULT
SetContRects(LPCRECT pRect
);
186 HRESULT
SetObjectRects(LPCRECT aRect
, LPCRECT aClip
);
188 HWND
GetTopMostWinHandle() const
190 return m_hWndxWinParent
;
193 css::uno::Reference
< css::frame::XModel
>
200 virtual void SAL_CALL
201 disposing( const css::lang::EventObject
& aSource
) override
;
204 virtual void SAL_CALL
206 const css::lang::EventObject
& aSource
,
207 sal_Bool bGetsOwnership
210 virtual void SAL_CALL
212 const css::lang::EventObject
& aSource
215 // XTerminateListener
216 virtual void SAL_CALL
218 const css::lang::EventObject
& aSource
221 virtual void SAL_CALL
223 const css::lang::EventObject
& aSource
228 virtual void SAL_CALL
230 const css::lang::EventObject
& aEvent
233 // XDockingAreaAcceptor
235 virtual css::uno::Reference
<
236 css::awt::XWindow
> SAL_CALL
240 virtual sal_Bool SAL_CALL
241 requestDockingAreaSpace(
242 const css::awt::Rectangle
& RequestedSpace
245 virtual void SAL_CALL
247 const css::awt::Rectangle
& BorderSpace
253 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */