Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / embedserv / source / inc / docholder.hxx
blob3e60df87f15de9327c3e5816b9131cb275f3253b
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 _DOCHOLDER_HXX_
21 #define _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/XFrame.hpp>
29 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
30 #include <cppuhelper/implbase4.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::WeakImplHelper4<
47 ::com::sun::star::util::XCloseListener,
48 ::com::sun::star::frame::XTerminateListener,
49 ::com::sun::star::util::XModifyListener,
50 ::com::sun::star::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 ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xInterceptorLocker;
64 Interceptor* m_pInterceptor;
66 ::com::sun::star::uno::Reference<
67 ::com::sun::star::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 com::sun::star::uno::Reference<
79 com::sun::star::awt::XWindow> m_xEditWindow;
81 com::sun::star::uno::Reference<
82 com::sun::star::awt::XWindow> m_xContainerWindow;
84 ::com::sun::star::uno::Reference<
85 ::com::sun::star::frame::XModel > m_xDocument;
86 sal_Int16 m_nMacroExecMode;
88 ::com::sun::star::uno::Reference<
89 ::com::sun::star::frame::XLayoutManager> m_xLayoutManager;
92 ::com::sun::star::uno::Reference<
93 ::com::sun::star::frame::XFrame > m_xFrame;
95 ::rtl::OUString m_aContainerName,m_aDocumentNamePart,m_aFilterName;
97 CComPtr< IDispatch > m_pIDispatch;
99 sal_Bool m_bLink;
102 ::com::sun::star::uno::Reference<
103 ::com::sun::star::frame::XFrame > DocumentFrame();
106 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >
107 CreateNewInterceptor();
109 void ClearInterceptorInternally();
111 void LoadDocInFrame( sal_Bool bPluginMode );
112 public:
115 // the instance to which we belong
116 static HINSTANCE m_hInstance;
118 HWND GetEditWindowParentHandle() const
120 return m_hWndxWinParent;
123 void SetContainerWindowHandle(HWND hWndxWinCont)
125 m_hWndxWinCont = hWndxWinCont;
128 DocumentHolder(
129 const ::com::sun::star::uno::Reference<
130 ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
131 const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess );
133 ~DocumentHolder();
135 // Methods for inplace activation
138 BOOL isActive() const;
139 void DisableInplaceActivation(BOOL);
140 HRESULT InPlaceActivate(LPOLECLIENTSITE,BOOL);
141 void InPlaceDeactivate(void);
142 HRESULT UIActivate();
143 void UIDeactivate();
144 BOOL InPlaceMenuCreate(void);
145 BOOL InPlaceMenuDestroy(void);
147 void OpenIntoWindow(void);
148 BOOL Undo(void);
150 // further methods
152 void SetDocument(
153 const ::com::sun::star::uno::Reference<
154 ::com::sun::star::frame::XModel >& xDoc,
155 sal_Bool bLink = sal_False
158 sal_Bool ExecuteSuspendCloseFrame();
160 void DisconnectFrameDocument( sal_Bool bComplete = sal_False );
161 void CloseDocument();
162 void CloseFrame();
163 void ClearInterceptor();
164 void FreeOffice();
166 void resizeWin( const SIZEL& rNewSize );
168 void setTitle(const rtl::OUString& aDocumentName);
169 rtl::OUString getTitle() const { return m_aDocumentNamePart; }
171 void setContainerName(const rtl::OUString& aContainerName);
172 rtl::OUString getContainerName() const { return m_aContainerName; }
173 void OnPosRectChanged(LPRECT lpRect) const;
174 void show();
176 sal_Bool HasFrame() { return m_xFrame.is(); }
177 sal_Bool IsLink() { return m_bLink; }
179 /** hides the document window, even in case of an external container
180 * side managed window.
183 void hide();
185 IDispatch* GetIDispatch();
187 HRESULT GetDocumentBorder( RECT *pRect );
188 // HRESULT SetVisArea( const RECTL *pRect );
189 // HRESULT GetVisArea( RECTL *pRect );
190 HRESULT SetExtent( const SIZEL *pSize );
191 HRESULT GetExtent( SIZEL *pSize );
192 // sets extension on the hatchwindow
193 HRESULT SetContRects(LPCRECT pRect);
194 HRESULT SetObjectRects(LPCRECT aRect, LPCRECT aClip);
196 HWND GetTopMostWinHandle() const
198 return m_hWndxWinParent;
201 ::com::sun::star::uno::Reference<
202 ::com::sun::star::frame::XModel >
203 GetDocument() const
205 return m_xDocument;
208 // XEventListener
209 virtual void SAL_CALL
210 disposing( const com::sun::star::lang::EventObject& aSource )
211 throw( ::com::sun::star::uno::RuntimeException );
213 // XCloseListener
214 virtual void SAL_CALL
215 queryClosing(
216 const com::sun::star::lang::EventObject& aSource,
217 sal_Bool bGetsOwnership
219 throw(
220 ::com::sun::star::util::CloseVetoException
223 virtual void SAL_CALL
224 notifyClosing(
225 const com::sun::star::lang::EventObject& aSource
227 throw( ::com::sun::star::uno::RuntimeException );
229 // XTerminateListener
230 virtual void SAL_CALL
231 queryTermination(
232 const com::sun::star::lang::EventObject& aSource
234 throw(
235 ::com::sun::star::frame::TerminationVetoException
238 virtual void SAL_CALL
239 notifyTermination(
240 const com::sun::star::lang::EventObject& aSource
242 throw( ::com::sun::star::uno::RuntimeException );
245 // XModifyListener
246 virtual void SAL_CALL
247 modified(
248 const ::com::sun::star::lang::EventObject& aEvent
250 throw (
251 ::com::sun::star::uno::RuntimeException
254 // XDockingAreaAcceptor
256 virtual ::com::sun::star::uno::Reference<
257 ::com::sun::star::awt::XWindow> SAL_CALL
258 getContainerWindow(
260 throw (
261 ::com::sun::star::uno::RuntimeException
264 virtual sal_Bool SAL_CALL
265 requestDockingAreaSpace(
266 const ::com::sun::star::awt::Rectangle& RequestedSpace
268 throw(
269 ::com::sun::star::uno::RuntimeException
272 virtual void SAL_CALL
273 setDockingAreaSpace(
274 const ::com::sun::star::awt::Rectangle& BorderSpace
276 throw (
277 ::com::sun::star::uno::RuntimeException
281 #endif
283 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */