Bump version to 6.4-15
[LibreOffice.git] / embedserv / source / inc / docholder.hxx
blob1bd9a87463239793affc6d95a177603db9be7196
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include "common.h"
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;
38 class Interceptor;
39 class CIIAObj;
41 namespace winwrap {
42 class CHatchWin;
46 class DocumentHolder :
47 public ::cppu::WeakImplHelper<
48 css::util::XCloseListener,
49 css::frame::XTerminateListener,
50 css::util::XModifyListener,
51 css::ui::XDockingAreaAcceptor>
53 private:
54 ::osl::Mutex m_aMutex;
56 BOOL m_bAllowInPlace;
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;
69 RECT m_aBorder;
71 // contains top level system window data
72 bool m_bOnDeactivate;
73 HWND m_hWndxWinParent;
74 HWND m_hWndxWinCont;
75 HMENU m_nMenuHandle;
76 HMENU m_nMenuShared;
77 HOLEMENU m_nOLEMenu;
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;
94 bool m_bLink;
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 );
106 public:
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;
122 DocumentHolder(
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();
136 void UIDeactivate();
137 BOOL InPlaceMenuCreate();
138 BOOL InPlaceMenuDestroy();
140 static void OpenIntoWindow();
141 static BOOL Undo();
143 // further methods
145 void SetDocument(
146 const css::uno::Reference< css::frame::XModel >& xDoc,
147 bool bLink = false
150 bool ExecuteSuspendCloseFrame();
152 void DisconnectFrameDocument( bool bComplete = false );
153 void CloseDocument();
154 void CloseFrame();
155 void ClearInterceptor();
156 void FreeOffice();
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;
166 void show();
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.
175 void hide();
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 >
194 GetDocument() const
196 return m_xDocument;
199 // XEventListener
200 virtual void SAL_CALL
201 disposing( const css::lang::EventObject& aSource ) override;
203 // XCloseListener
204 virtual void SAL_CALL
205 queryClosing(
206 const css::lang::EventObject& aSource,
207 sal_Bool bGetsOwnership
208 ) override;
210 virtual void SAL_CALL
211 notifyClosing(
212 const css::lang::EventObject& aSource
213 ) override;
215 // XTerminateListener
216 virtual void SAL_CALL
217 queryTermination(
218 const css::lang::EventObject& aSource
219 ) override;
221 virtual void SAL_CALL
222 notifyTermination(
223 const css::lang::EventObject& aSource
224 ) override;
227 // XModifyListener
228 virtual void SAL_CALL
229 modified(
230 const css::lang::EventObject& aEvent
231 ) override;
233 // XDockingAreaAcceptor
235 virtual css::uno::Reference<
236 css::awt::XWindow> SAL_CALL
237 getContainerWindow(
238 ) override;
240 virtual sal_Bool SAL_CALL
241 requestDockingAreaSpace(
242 const css::awt::Rectangle& RequestedSpace
243 ) override;
245 virtual void SAL_CALL
246 setDockingAreaSpace(
247 const css::awt::Rectangle& BorderSpace
248 ) override;
251 #endif
253 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */