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 .
23 #include <com/sun/star/frame/XLayoutManager.hpp>
24 #include <com/sun/star/util/XCloseListener.hpp>
25 #include <com/sun/star/frame/XTerminateListener.hpp>
26 #include <com/sun/star/util/XModifyListener.hpp>
27 #include <com/sun/star/frame/XFrame2.hpp>
28 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
29 #include <cppuhelper/implbase.hxx>
30 #include <cppuhelper/weakref.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 rtl::Reference
<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( 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
);
125 ~DocumentHolder() override
;
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 static void OpenIntoWindow();
145 const css::uno::Reference
< css::frame::XModel
>& xDoc
,
149 bool ExecuteSuspendCloseFrame();
151 void DisconnectFrameDocument( bool bComplete
= 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 bool HasFrame() { return m_xFrame
.is(); }
168 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
) override
;
203 virtual void SAL_CALL
205 const css::lang::EventObject
& aSource
,
206 sal_Bool bGetsOwnership
209 virtual void SAL_CALL
211 const css::lang::EventObject
& aSource
214 // XTerminateListener
215 virtual void SAL_CALL
217 const css::lang::EventObject
& aSource
220 virtual void SAL_CALL
222 const css::lang::EventObject
& aSource
227 virtual void SAL_CALL
229 const css::lang::EventObject
& aEvent
232 // XDockingAreaAcceptor
234 virtual css::uno::Reference
<
235 css::awt::XWindow
> SAL_CALL
239 virtual sal_Bool SAL_CALL
240 requestDockingAreaSpace(
241 const css::awt::Rectangle
& RequestedSpace
244 virtual void SAL_CALL
246 const css::awt::Rectangle
& BorderSpace
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */