1*a20fd023SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*a20fd023SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*a20fd023SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*a20fd023SAndrew Rist * distributed with this work for additional information 6*a20fd023SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*a20fd023SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*a20fd023SAndrew Rist * "License"); you may not use this file except in compliance 9*a20fd023SAndrew Rist * with the License. You may obtain a copy of the License at 10*a20fd023SAndrew Rist * 11*a20fd023SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*a20fd023SAndrew Rist * 13*a20fd023SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*a20fd023SAndrew Rist * software distributed under the License is distributed on an 15*a20fd023SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*a20fd023SAndrew Rist * KIND, either express or implied. See the License for the 17*a20fd023SAndrew Rist * specific language governing permissions and limitations 18*a20fd023SAndrew Rist * under the License. 19*a20fd023SAndrew Rist * 20*a20fd023SAndrew Rist *************************************************************/ 21*a20fd023SAndrew Rist 22*a20fd023SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _DOCHOLDER_HXX_ 25cdf0e10cSrcweir #define _DOCHOLDER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "common.h" 28cdf0e10cSrcweir #include <com/sun/star/frame/XLayoutManager.hpp> 29cdf0e10cSrcweir #include <com/sun/star/util/XCloseListener.hpp> 30cdf0e10cSrcweir #include <com/sun/star/frame/XTerminateListener.hpp> 31cdf0e10cSrcweir #include <com/sun/star/util/XModifyListener.hpp> 32cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 33cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 34cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <rtl/ref.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include "embeddocaccess.hxx" 39cdf0e10cSrcweir 40cdf0e10cSrcweir class EmbedDocument_Impl; 41cdf0e10cSrcweir class Interceptor; 42cdf0e10cSrcweir class CIIAObj; 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace winwrap { 45cdf0e10cSrcweir class CHatchWin; 46cdf0e10cSrcweir } 47cdf0e10cSrcweir 48cdf0e10cSrcweir 49cdf0e10cSrcweir class DocumentHolder : 50cdf0e10cSrcweir public ::cppu::WeakImplHelper4< 51cdf0e10cSrcweir ::com::sun::star::util::XCloseListener, 52cdf0e10cSrcweir ::com::sun::star::frame::XTerminateListener, 53cdf0e10cSrcweir ::com::sun::star::util::XModifyListener, 54cdf0e10cSrcweir ::com::sun::star::ui::XDockingAreaAcceptor> 55cdf0e10cSrcweir { 56cdf0e10cSrcweir private: 57cdf0e10cSrcweir ::osl::Mutex m_aMutex; 58cdf0e10cSrcweir 59cdf0e10cSrcweir BOOL m_bAllowInPlace; 60cdf0e10cSrcweir LPOLEINPLACESITE m_pIOleIPSite; 61cdf0e10cSrcweir LPOLEINPLACEFRAME m_pIOleIPFrame; 62cdf0e10cSrcweir LPOLEINPLACEUIWINDOW m_pIOleIPUIWindow; 63cdf0e10cSrcweir winwrap::CHatchWin* m_pCHatchWin; 64cdf0e10cSrcweir 65cdf0e10cSrcweir ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOleAccess; 66cdf0e10cSrcweir 67cdf0e10cSrcweir ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xInterceptorLocker; 68cdf0e10cSrcweir Interceptor* m_pInterceptor; 69cdf0e10cSrcweir 70cdf0e10cSrcweir ::com::sun::star::uno::Reference< 71cdf0e10cSrcweir ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; 72cdf0e10cSrcweir 73cdf0e10cSrcweir RECT m_aBorder; 74cdf0e10cSrcweir 75cdf0e10cSrcweir // contains top level system window data 76cdf0e10cSrcweir bool m_bOnDeactivate; 77cdf0e10cSrcweir HWND m_hWndxWinParent; 78cdf0e10cSrcweir HWND m_hWndxWinCont; 79cdf0e10cSrcweir HMENU m_nMenuHandle; 80cdf0e10cSrcweir HMENU m_nMenuShared; 81cdf0e10cSrcweir HOLEMENU m_nOLEMenu; 82cdf0e10cSrcweir com::sun::star::uno::Reference< 83cdf0e10cSrcweir com::sun::star::awt::XWindow> m_xEditWindow; 84cdf0e10cSrcweir 85cdf0e10cSrcweir com::sun::star::uno::Reference< 86cdf0e10cSrcweir com::sun::star::awt::XWindow> m_xContainerWindow; 87cdf0e10cSrcweir 88cdf0e10cSrcweir ::com::sun::star::uno::Reference< 89cdf0e10cSrcweir ::com::sun::star::frame::XModel > m_xDocument; 90cdf0e10cSrcweir sal_Int16 m_nMacroExecMode; 91cdf0e10cSrcweir 92cdf0e10cSrcweir ::com::sun::star::uno::Reference< 93cdf0e10cSrcweir ::com::sun::star::frame::XLayoutManager> m_xLayoutManager; 94cdf0e10cSrcweir 95cdf0e10cSrcweir 96cdf0e10cSrcweir ::com::sun::star::uno::Reference< 97cdf0e10cSrcweir ::com::sun::star::frame::XFrame > m_xFrame; 98cdf0e10cSrcweir 99cdf0e10cSrcweir ::rtl::OUString m_aContainerName,m_aDocumentNamePart,m_aFilterName; 100cdf0e10cSrcweir 101cdf0e10cSrcweir CComPtr< IDispatch > m_pIDispatch; 102cdf0e10cSrcweir 103cdf0e10cSrcweir sal_Bool m_bLink; 104cdf0e10cSrcweir 105cdf0e10cSrcweir 106cdf0e10cSrcweir ::com::sun::star::uno::Reference< 107cdf0e10cSrcweir ::com::sun::star::frame::XFrame > DocumentFrame(); 108cdf0e10cSrcweir 109cdf0e10cSrcweir 110cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > 111cdf0e10cSrcweir CreateNewInterceptor(); 112cdf0e10cSrcweir 113cdf0e10cSrcweir void ClearInterceptorInternally(); 114cdf0e10cSrcweir 115cdf0e10cSrcweir void LoadDocInFrame( sal_Bool bPluginMode ); 116cdf0e10cSrcweir public: 117cdf0e10cSrcweir 118cdf0e10cSrcweir 119cdf0e10cSrcweir // the instance to which we belong 120cdf0e10cSrcweir static HINSTANCE m_hInstance; 121cdf0e10cSrcweir GetEditWindowParentHandle() const122cdf0e10cSrcweir HWND GetEditWindowParentHandle() const 123cdf0e10cSrcweir { 124cdf0e10cSrcweir return m_hWndxWinParent; 125cdf0e10cSrcweir } 126cdf0e10cSrcweir SetContainerWindowHandle(HWND hWndxWinCont)127cdf0e10cSrcweir void SetContainerWindowHandle(HWND hWndxWinCont) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir m_hWndxWinCont = hWndxWinCont; 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir DocumentHolder( 133cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 134cdf0e10cSrcweir ::com::sun::star::lang::XMultiServiceFactory >& xFactory, 135cdf0e10cSrcweir const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir ~DocumentHolder(); 138cdf0e10cSrcweir 139cdf0e10cSrcweir // Methods for inplace activation 140cdf0e10cSrcweir 141cdf0e10cSrcweir 142cdf0e10cSrcweir BOOL isActive() const; 143cdf0e10cSrcweir void DisableInplaceActivation(BOOL); 144cdf0e10cSrcweir HRESULT InPlaceActivate(LPOLECLIENTSITE,BOOL); 145cdf0e10cSrcweir void InPlaceDeactivate(void); 146cdf0e10cSrcweir HRESULT UIActivate(); 147cdf0e10cSrcweir void UIDeactivate(); 148cdf0e10cSrcweir BOOL InPlaceMenuCreate(void); 149cdf0e10cSrcweir BOOL InPlaceMenuDestroy(void); 150cdf0e10cSrcweir 151cdf0e10cSrcweir void OpenIntoWindow(void); 152cdf0e10cSrcweir BOOL Undo(void); 153cdf0e10cSrcweir 154cdf0e10cSrcweir // further methods 155cdf0e10cSrcweir 156cdf0e10cSrcweir void SetDocument( 157cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 158cdf0e10cSrcweir ::com::sun::star::frame::XModel >& xDoc, 159cdf0e10cSrcweir sal_Bool bLink = sal_False 160cdf0e10cSrcweir ); 161cdf0e10cSrcweir 162cdf0e10cSrcweir sal_Bool ExecuteSuspendCloseFrame(); 163cdf0e10cSrcweir 164cdf0e10cSrcweir void DisconnectFrameDocument( sal_Bool bComplete = sal_False ); 165cdf0e10cSrcweir void CloseDocument(); 166cdf0e10cSrcweir void CloseFrame(); 167cdf0e10cSrcweir void ClearInterceptor(); 168cdf0e10cSrcweir void FreeOffice(); 169cdf0e10cSrcweir 170cdf0e10cSrcweir void resizeWin( const SIZEL& rNewSize ); 171cdf0e10cSrcweir 172cdf0e10cSrcweir void setTitle(const rtl::OUString& aDocumentName); getTitle() const173cdf0e10cSrcweir rtl::OUString getTitle() const { return m_aDocumentNamePart; } 174cdf0e10cSrcweir 175cdf0e10cSrcweir void setContainerName(const rtl::OUString& aContainerName); getContainerName() const176cdf0e10cSrcweir rtl::OUString getContainerName() const { return m_aContainerName; } 177cdf0e10cSrcweir void OnPosRectChanged(LPRECT lpRect) const; 178cdf0e10cSrcweir void show(); 179cdf0e10cSrcweir HasFrame()180cdf0e10cSrcweir sal_Bool HasFrame() { return m_xFrame.is(); } IsLink()181cdf0e10cSrcweir sal_Bool IsLink() { return m_bLink; } 182cdf0e10cSrcweir 183cdf0e10cSrcweir /** hides the document window, even in case of an external container 184cdf0e10cSrcweir * side managed window. 185cdf0e10cSrcweir */ 186cdf0e10cSrcweir 187cdf0e10cSrcweir void hide(); 188cdf0e10cSrcweir 189cdf0e10cSrcweir IDispatch* GetIDispatch(); 190cdf0e10cSrcweir 191cdf0e10cSrcweir HRESULT GetDocumentBorder( RECT *pRect ); 192cdf0e10cSrcweir // HRESULT SetVisArea( const RECTL *pRect ); 193cdf0e10cSrcweir // HRESULT GetVisArea( RECTL *pRect ); 194cdf0e10cSrcweir HRESULT SetExtent( const SIZEL *pSize ); 195cdf0e10cSrcweir HRESULT GetExtent( SIZEL *pSize ); 196cdf0e10cSrcweir // sets extension on the hatchwindow 197cdf0e10cSrcweir HRESULT SetContRects(LPCRECT pRect); 198cdf0e10cSrcweir HRESULT SetObjectRects(LPCRECT aRect, LPCRECT aClip); 199cdf0e10cSrcweir GetTopMostWinHandle() const200cdf0e10cSrcweir HWND GetTopMostWinHandle() const 201cdf0e10cSrcweir { 202cdf0e10cSrcweir return m_hWndxWinParent; 203cdf0e10cSrcweir } 204cdf0e10cSrcweir 205cdf0e10cSrcweir ::com::sun::star::uno::Reference< 206cdf0e10cSrcweir ::com::sun::star::frame::XModel > GetDocument() const207cdf0e10cSrcweir GetDocument() const 208cdf0e10cSrcweir { 209cdf0e10cSrcweir return m_xDocument; 210cdf0e10cSrcweir } 211cdf0e10cSrcweir 212cdf0e10cSrcweir // XEventListener 213cdf0e10cSrcweir virtual void SAL_CALL 214cdf0e10cSrcweir disposing( const com::sun::star::lang::EventObject& aSource ) 215cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 216cdf0e10cSrcweir 217cdf0e10cSrcweir // XCloseListener 218cdf0e10cSrcweir virtual void SAL_CALL 219cdf0e10cSrcweir queryClosing( 220cdf0e10cSrcweir const com::sun::star::lang::EventObject& aSource, 221cdf0e10cSrcweir sal_Bool bGetsOwnership 222cdf0e10cSrcweir ) 223cdf0e10cSrcweir throw( 224cdf0e10cSrcweir ::com::sun::star::util::CloseVetoException 225cdf0e10cSrcweir ); 226cdf0e10cSrcweir 227cdf0e10cSrcweir virtual void SAL_CALL 228cdf0e10cSrcweir notifyClosing( 229cdf0e10cSrcweir const com::sun::star::lang::EventObject& aSource 230cdf0e10cSrcweir ) 231cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 232cdf0e10cSrcweir 233cdf0e10cSrcweir // XTerminateListener 234cdf0e10cSrcweir virtual void SAL_CALL 235cdf0e10cSrcweir queryTermination( 236cdf0e10cSrcweir const com::sun::star::lang::EventObject& aSource 237cdf0e10cSrcweir ) 238cdf0e10cSrcweir throw( 239cdf0e10cSrcweir ::com::sun::star::frame::TerminationVetoException 240cdf0e10cSrcweir ); 241cdf0e10cSrcweir 242cdf0e10cSrcweir virtual void SAL_CALL 243cdf0e10cSrcweir notifyTermination( 244cdf0e10cSrcweir const com::sun::star::lang::EventObject& aSource 245cdf0e10cSrcweir ) 246cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 247cdf0e10cSrcweir 248cdf0e10cSrcweir 249cdf0e10cSrcweir // XModifyListener 250cdf0e10cSrcweir virtual void SAL_CALL 251cdf0e10cSrcweir modified( 252cdf0e10cSrcweir const ::com::sun::star::lang::EventObject& aEvent 253cdf0e10cSrcweir ) 254cdf0e10cSrcweir throw ( 255cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 256cdf0e10cSrcweir ); 257cdf0e10cSrcweir 258cdf0e10cSrcweir // XDockingAreaAcceptor 259cdf0e10cSrcweir 260cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 261cdf0e10cSrcweir ::com::sun::star::awt::XWindow> SAL_CALL 262cdf0e10cSrcweir getContainerWindow( 263cdf0e10cSrcweir ) 264cdf0e10cSrcweir throw ( 265cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 266cdf0e10cSrcweir ); 267cdf0e10cSrcweir 268cdf0e10cSrcweir virtual sal_Bool SAL_CALL 269cdf0e10cSrcweir requestDockingAreaSpace( 270cdf0e10cSrcweir const ::com::sun::star::awt::Rectangle& RequestedSpace 271cdf0e10cSrcweir ) 272cdf0e10cSrcweir throw( 273cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 274cdf0e10cSrcweir ); 275cdf0e10cSrcweir 276cdf0e10cSrcweir virtual void SAL_CALL 277cdf0e10cSrcweir setDockingAreaSpace( 278cdf0e10cSrcweir const ::com::sun::star::awt::Rectangle& BorderSpace 279cdf0e10cSrcweir ) 280cdf0e10cSrcweir throw ( 281cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException 282cdf0e10cSrcweir ); 283cdf0e10cSrcweir }; 284cdf0e10cSrcweir 285cdf0e10cSrcweir #endif 286cdf0e10cSrcweir 287