LibreOffice Module embedserv (master) 1
docholder.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include "common.h"
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>
31
32#include <rtl/ref.hxx>
33
34#include "embeddocaccess.hxx"
35
37class Interceptor;
38class CIIAObj;
39
40namespace winwrap {
41 class CHatchWin;
42}
43
44
45class DocumentHolder :
46 public ::cppu::WeakImplHelper<
47 css::util::XCloseListener,
48 css::frame::XTerminateListener,
49 css::util::XModifyListener,
50 css::ui::XDockingAreaAcceptor>
51{
52private:
53 ::osl::Mutex m_aMutex;
54
55 bool m_bAllowInPlace;
56 LPOLEINPLACESITE m_pIOleIPSite;
57 LPOLEINPLACEFRAME m_pIOleIPFrame;
58 LPOLEINPLACEUIWINDOW m_pIOleIPUIWindow;
59 winwrap::CHatchWin* m_pCHatchWin;
60
62
63 css::uno::WeakReference< css::frame::XDispatchProviderInterceptor > m_xInterceptorLocker;
64 rtl::Reference<Interceptor> m_pInterceptor;
65
66 css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
67
68 RECT m_aBorder;
69
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;
78
79 css::uno::Reference< css::awt::XWindow> m_xContainerWindow;
80
81 css::uno::Reference< css::frame::XModel > m_xDocument;
82 sal_Int16 m_nMacroExecMode;
83
84 css::uno::Reference< css::frame::XLayoutManager> m_xLayoutManager;
85
86
87 css::uno::Reference< css::frame::XFrame2 > m_xFrame;
88
89 OUString m_aContainerName,m_aDocumentNamePart,m_aFilterName;
90
91 CComPtr< IDispatch > m_pIDispatch;
92
93 bool m_bLink;
94
95
96 css::uno::Reference< css::frame::XFrame2 > DocumentFrame();
97
98
99 css::uno::Reference< css::frame::XDispatchProviderInterceptor >
100 CreateNewInterceptor();
101
102 void ClearInterceptorInternally();
103
104 void LoadDocInFrame( bool bPluginMode );
105public:
106
107
108 // the instance to which we belong
109 static HINSTANCE m_hInstance;
110
111 HWND GetEditWindowParentHandle() const
112 {
113 return m_hWndxWinParent;
114 }
115
116 void SetContainerWindowHandle(HWND hWndxWinCont)
117 {
118 m_hWndxWinCont = hWndxWinCont;
119 }
120
122 const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory,
123 const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess );
124
125 ~DocumentHolder() override;
126
127 // Methods for inplace activation
128
129
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();
138
139 static void OpenIntoWindow();
140 static BOOL Undo();
141
142 // further methods
143
144 void SetDocument(
145 const css::uno::Reference< css::frame::XModel >& xDoc,
146 bool bLink = false
147 );
148
149 bool ExecuteSuspendCloseFrame();
150
151 void DisconnectFrameDocument( bool bComplete = false );
152 void CloseDocument();
153 void CloseFrame();
154 void ClearInterceptor();
155 void FreeOffice();
156
157 void resizeWin( const SIZEL& rNewSize );
158
159 void setTitle(const OUString& aDocumentName);
160 OUString getTitle() const { return m_aDocumentNamePart; }
161
162 void setContainerName(const OUString& aContainerName);
163 OUString getContainerName() const { return m_aContainerName; }
164 void OnPosRectChanged(LPRECT lpRect) const;
165 void show();
166
167 bool HasFrame() { return m_xFrame.is(); }
168 bool IsLink() { return m_bLink; }
169
174 void hide();
175
176 IDispatch* GetIDispatch();
177
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);
186
187 HWND GetTopMostWinHandle() const
188 {
189 return m_hWndxWinParent;
190 }
191
192 css::uno::Reference< css::frame::XModel >
193 GetDocument() const
194 {
195 return m_xDocument;
196 }
197
198 // XEventListener
199 virtual void SAL_CALL
200 disposing( const css::lang::EventObject& aSource ) override;
201
202 // XCloseListener
203 virtual void SAL_CALL
205 const css::lang::EventObject& aSource,
206 sal_Bool bGetsOwnership
207 ) override;
208
209 virtual void SAL_CALL
211 const css::lang::EventObject& aSource
212 ) override;
213
214 // XTerminateListener
215 virtual void SAL_CALL
217 const css::lang::EventObject& aSource
218 ) override;
219
220 virtual void SAL_CALL
222 const css::lang::EventObject& aSource
223 ) override;
224
225
226 // XModifyListener
227 virtual void SAL_CALL
228 modified(
229 const css::lang::EventObject& aEvent
230 ) override;
231
232 // XDockingAreaAcceptor
233
234 virtual css::uno::Reference<
235 css::awt::XWindow> SAL_CALL
236 getContainerWindow(
237 ) override;
238
239 virtual sal_Bool SAL_CALL
240 requestDockingAreaSpace(
241 const css::awt::Rectangle& RequestedSpace
242 ) override;
243
244 virtual void SAL_CALL
245 setDockingAreaSpace(
246 const css::awt::Rectangle& BorderSpace
247 ) override;
248};
249
250/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: docholder.cxx:1281
virtual void SAL_CALL queryClosing(const css::lang::EventObject &Source, sal_Bool GetsOwnership) override
virtual ~DocumentHolder() override
Definition: docholder.cxx:99
void CloseDocument(bool bDeliverOwnership, bool bWaitForClose)
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL notifyClosing(const css::lang::EventObject &Source) override
OUString m_aContainerName
Definition: docholder.hxx:89
DocumentHolder(css::uno::Reference< css::uno::XComponentContext > xContext, OCommonEmbeddedObject *pEmbObj)
virtual void SAL_CALL notifyTermination(const css::lang::EventObject &Event) override
void CloseFrame()
Definition: docholder.cxx:662
void FreeOffice()
Definition: docholder.cxx:597
bool GetExtent(sal_Int64 nAspect, css::awt::Size *pSize)
bool SetExtent(sal_Int64 nAspect, const css::awt::Size &aSize)
OUString m_aDocumentNamePart
Definition: docholder.hxx:89
virtual void SAL_CALL queryTermination(const css::lang::EventObject &Event) override
css::uno::Reference< css::frame::XFrame > m_xFrame
Reference< XOfficeDatabaseDocument > m_xDocument
const wchar_t *typedef BOOL
unsigned char sal_Bool