Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / embedserv / source / inc / docholder.hxx
blob9daab2220c5919711c598f04e14e7ba60f0df4f5
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>
32 #include <rtl/ref.hxx>
34 #include "embeddocaccess.hxx"
36 class EmbedDocument_Impl;
37 class Interceptor;
38 class CIIAObj;
40 namespace winwrap {
41 class CHatchWin;
45 class DocumentHolder :
46 public ::cppu::WeakImplHelper<
47 css::util::XCloseListener,
48 css::frame::XTerminateListener,
49 css::util::XModifyListener,
50 css::ui::XDockingAreaAcceptor>
52 private:
53 ::osl::Mutex m_aMutex;
55 BOOL m_bAllowInPlace;
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;
68 RECT m_aBorder;
70 // contains top level system window data
71 bool m_bOnDeactivate;
72 HWND m_hWndxWinParent;
73 HWND m_hWndxWinCont;
74 HMENU m_nMenuHandle;
75 HMENU m_nMenuShared;
76 HOLEMENU m_nOLEMenu;
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;
93 sal_Bool m_bLink;
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 );
105 public:
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;
121 DocumentHolder(
122 const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory,
123 const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess );
125 ~DocumentHolder();
127 // Methods for inplace activation
130 BOOL isActive() const;
131 void DisableInplaceActivation(BOOL);
132 HRESULT InPlaceActivate(LPOLECLIENTSITE,BOOL);
133 void InPlaceDeactivate();
134 HRESULT UIActivate();
135 void UIDeactivate();
136 BOOL InPlaceMenuCreate();
137 BOOL InPlaceMenuDestroy();
139 void OpenIntoWindow();
140 BOOL Undo();
142 // further methods
144 void SetDocument(
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();
153 void CloseFrame();
154 void ClearInterceptor();
155 void FreeOffice();
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;
165 void show();
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.
174 void hide();
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 >
193 GetDocument() const
195 return m_xDocument;
198 // XEventListener
199 virtual void SAL_CALL
200 disposing( const css::lang::EventObject& aSource )
201 throw( css::uno::RuntimeException );
203 // XCloseListener
204 virtual void SAL_CALL
205 queryClosing(
206 const css::lang::EventObject& aSource,
207 sal_Bool bGetsOwnership
209 throw(
210 css::util::CloseVetoException
213 virtual void SAL_CALL
214 notifyClosing(
215 const css::lang::EventObject& aSource
217 throw( css::uno::RuntimeException );
219 // XTerminateListener
220 virtual void SAL_CALL
221 queryTermination(
222 const css::lang::EventObject& aSource
224 throw(
225 css::frame::TerminationVetoException
228 virtual void SAL_CALL
229 notifyTermination(
230 const css::lang::EventObject& aSource
232 throw( css::uno::RuntimeException );
235 // XModifyListener
236 virtual void SAL_CALL
237 modified(
238 const css::lang::EventObject& aEvent
240 throw (
241 css::uno::RuntimeException
244 // XDockingAreaAcceptor
246 virtual css::uno::Reference<
247 css::awt::XWindow> SAL_CALL
248 getContainerWindow(
250 throw (
251 css::uno::RuntimeException
254 virtual sal_Bool SAL_CALL
255 requestDockingAreaSpace(
256 const css::awt::Rectangle& RequestedSpace
258 throw(
259 css::uno::RuntimeException
262 virtual void SAL_CALL
263 setDockingAreaSpace(
264 const css::awt::Rectangle& BorderSpace
266 throw (
267 css::uno::RuntimeException
271 #endif
273 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */