1*08421ca6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*08421ca6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*08421ca6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*08421ca6SAndrew Rist * distributed with this work for additional information 6*08421ca6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*08421ca6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*08421ca6SAndrew Rist * "License"); you may not use this file except in compliance 9*08421ca6SAndrew Rist * with the License. You may obtain a copy of the License at 10*08421ca6SAndrew Rist * 11*08421ca6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*08421ca6SAndrew Rist * 13*08421ca6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*08421ca6SAndrew Rist * software distributed under the License is distributed on an 15*08421ca6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*08421ca6SAndrew Rist * KIND, either express or implied. See the License for the 17*08421ca6SAndrew Rist * specific language governing permissions and limitations 18*08421ca6SAndrew Rist * under the License. 19*08421ca6SAndrew Rist * 20*08421ca6SAndrew Rist *************************************************************/ 21*08421ca6SAndrew Rist 22*08421ca6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _DOCHOLDER_HXX_ 25cdf0e10cSrcweir #define _DOCHOLDER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/util/XCloseListener.hpp> 28cdf0e10cSrcweir #include <com/sun/star/frame/XTerminateListener.hpp> 29cdf0e10cSrcweir #include <com/sun/star/util/XModifyListener.hpp> 30cdf0e10cSrcweir #include <com/sun/star/util/XCloseable.hpp> 31cdf0e10cSrcweir #include <com/sun/star/document/XEventListener.hpp> 32cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 33cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 34cdf0e10cSrcweir #include <com/sun/star/frame/XBorderResizeListener.hpp> 35cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_XBORDERWIDTHS_HPP_ 36cdf0e10cSrcweir #include <com/sun/star/frame/BorderWidths.hpp> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp> 39cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp> 40cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 41cdf0e10cSrcweir #include <com/sun/star/embed/XHatchWindowController.hpp> 42cdf0e10cSrcweir #include <com/sun/star/frame/XLayoutManager.hpp> 43cdf0e10cSrcweir #include <cppuhelper/implbase6.hxx> 44cdf0e10cSrcweir 45cdf0e10cSrcweir class OCommonEmbeddedObject; 46cdf0e10cSrcweir class Interceptor; 47cdf0e10cSrcweir 48cdf0e10cSrcweir class DocumentHolder : 49cdf0e10cSrcweir public ::cppu::WeakImplHelper6< 50cdf0e10cSrcweir ::com::sun::star::util::XCloseListener, 51cdf0e10cSrcweir ::com::sun::star::frame::XTerminateListener, 52cdf0e10cSrcweir ::com::sun::star::util::XModifyListener, 53cdf0e10cSrcweir ::com::sun::star::document::XEventListener, 54cdf0e10cSrcweir ::com::sun::star::frame::XBorderResizeListener, 55cdf0e10cSrcweir ::com::sun::star::embed::XHatchWindowController > 56cdf0e10cSrcweir { 57cdf0e10cSrcweir private: 58cdf0e10cSrcweir 59cdf0e10cSrcweir OCommonEmbeddedObject* m_pEmbedObj; 60cdf0e10cSrcweir 61cdf0e10cSrcweir Interceptor* m_pInterceptor; 62cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xOutplaceInterceptor; 63cdf0e10cSrcweir 64cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; 65cdf0e10cSrcweir 66cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > m_xComponent; 67cdf0e10cSrcweir 68cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; 69cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xOwnWindow; // set for inplace objects 70cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xHatchWindow; // set for inplace objects 71cdf0e10cSrcweir 72cdf0e10cSrcweir ::com::sun::star::awt::Rectangle m_aObjRect; 73cdf0e10cSrcweir ::com::sun::star::frame::BorderWidths m_aBorderWidths; 74cdf0e10cSrcweir 75cdf0e10cSrcweir ::rtl::OUString m_aContainerName; 76cdf0e10cSrcweir ::rtl::OUString m_aDocumentNamePart; 77cdf0e10cSrcweir 78cdf0e10cSrcweir sal_Bool m_bReadOnly; 79cdf0e10cSrcweir 80cdf0e10cSrcweir sal_Bool m_bWaitForClose; 81cdf0e10cSrcweir sal_Bool m_bAllowClosing; 82cdf0e10cSrcweir sal_Bool m_bDesktopTerminated; 83cdf0e10cSrcweir 84cdf0e10cSrcweir sal_Int32 m_nNoBorderResizeReact; 85cdf0e10cSrcweir sal_Int32 m_nNoResizeReact; 86cdf0e10cSrcweir 87cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > m_xCachedDocAreaAcc; 88cdf0e10cSrcweir 89cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aOutplaceFrameProps; 90cdf0e10cSrcweir 91cdf0e10cSrcweir 92cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetDocFrame(); 93cdf0e10cSrcweir sal_Bool LoadDocToFrame( sal_Bool ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir ::com::sun::star::awt::Rectangle CalculateBorderedArea( const ::com::sun::star::awt::Rectangle& aRect ); 96cdf0e10cSrcweir ::com::sun::star::awt::Rectangle AddBorderToArea( const ::com::sun::star::awt::Rectangle& aRect ); 97cdf0e10cSrcweir 98cdf0e10cSrcweir void ResizeWindows_Impl( const ::com::sun::star::awt::Rectangle& aHatchRect ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > RetrieveOwnMenu_Impl(); 101cdf0e10cSrcweir sal_Bool MergeMenues_Impl( 102cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xOwnLM, 103cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContLM, 104cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContDisp, 105cdf0e10cSrcweir const ::rtl::OUString& aContModuleName ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir public: 108cdf0e10cSrcweir 109cdf0e10cSrcweir static void FindConnectPoints( 110cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xMenu, 111cdf0e10cSrcweir sal_Int32 nConnectPoints[2] ) 112cdf0e10cSrcweir throw ( ::com::sun::star::uno::Exception ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > MergeMenuesForInplace( 115cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xContMenu, 116cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContDisp, 117cdf0e10cSrcweir const ::rtl::OUString& aContModuleName, 118cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xOwnMenu, 119cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xOwnDisp ) 120cdf0e10cSrcweir throw ( ::com::sun::star::uno::Exception ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir 123cdf0e10cSrcweir DocumentHolder( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, 124cdf0e10cSrcweir OCommonEmbeddedObject* pEmbObj ); 125cdf0e10cSrcweir ~DocumentHolder(); 126cdf0e10cSrcweir GetEmbedObject()127cdf0e10cSrcweir OCommonEmbeddedObject* GetEmbedObject() { return m_pEmbedObj; } 128cdf0e10cSrcweir 129cdf0e10cSrcweir void SetComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable >& xDoc, sal_Bool bReadOnly ); 130cdf0e10cSrcweir void ResizeHatchWindow(); 131cdf0e10cSrcweir void LockOffice(); 132cdf0e10cSrcweir void FreeOffice(); 133cdf0e10cSrcweir 134cdf0e10cSrcweir void CloseDocument( sal_Bool bDeliverOwnership, sal_Bool bWaitForClose ); 135cdf0e10cSrcweir void CloseFrame(); 136cdf0e10cSrcweir GetTitle() const137cdf0e10cSrcweir rtl::OUString GetTitle() const 138cdf0e10cSrcweir { 139cdf0e10cSrcweir return m_aContainerName + ::rtl::OUString::createFromAscii( " - " ) + m_aDocumentNamePart; 140cdf0e10cSrcweir } 141cdf0e10cSrcweir GetContainerName() const142cdf0e10cSrcweir rtl::OUString GetContainerName() const { return m_aContainerName; } 143cdf0e10cSrcweir SetOutplaceFrameProperties(const::com::sun::star::uno::Sequence<::com::sun::star::uno::Any> aProps)144cdf0e10cSrcweir void SetOutplaceFrameProperties( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aProps ) 145cdf0e10cSrcweir { m_aOutplaceFrameProps = aProps; } 146cdf0e10cSrcweir 147cdf0e10cSrcweir void PlaceFrame( const ::com::sun::star::awt::Rectangle& aNewRect ); 148cdf0e10cSrcweir 149cdf0e10cSrcweir sal_Bool SetFrameLMVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, 150cdf0e10cSrcweir sal_Bool bVisible ); 151cdf0e10cSrcweir 152cdf0e10cSrcweir sal_Bool ShowInplace( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent, 153cdf0e10cSrcweir const ::com::sun::star::awt::Rectangle& aRectangleToShow, 154cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContainerDP ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir sal_Bool ShowUI( 157cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContainerLM, 158cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContainerDP, 159cdf0e10cSrcweir const ::rtl::OUString& aContModuleName ); 160cdf0e10cSrcweir sal_Bool HideUI( 161cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContainerLM ); 162cdf0e10cSrcweir 163cdf0e10cSrcweir void Show(); 164cdf0e10cSrcweir 165cdf0e10cSrcweir // sal_Bool SetVisArea( sal_Int64 nAspect, const ::com::sun::star::awt::Rectangle& aRect ); 166cdf0e10cSrcweir // sal_Bool GetVisArea( sal_Int64 nAspect, ::com::sun::star::awt::Rectangle *pRect ); 167cdf0e10cSrcweir sal_Bool SetExtent( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize ); 168cdf0e10cSrcweir sal_Bool GetExtent( sal_Int64 nAspect, ::com::sun::star::awt::Size *pSize ); 169cdf0e10cSrcweir 170cdf0e10cSrcweir sal_Int32 GetMapUnit( sal_Int64 nAspect ); 171cdf0e10cSrcweir SetOutplaceDispatchInterceptor(const::com::sun::star::uno::Reference<::com::sun::star::frame::XDispatchProviderInterceptor> & xOutplaceInterceptor)172cdf0e10cSrcweir void SetOutplaceDispatchInterceptor( 173cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& 174cdf0e10cSrcweir xOutplaceInterceptor ) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir m_xOutplaceInterceptor = xOutplaceInterceptor; 177cdf0e10cSrcweir } 178cdf0e10cSrcweir GetComponent()179cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > GetComponent() { return m_xComponent; } 180cdf0e10cSrcweir 181cdf0e10cSrcweir // XEventListener 182cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); 183cdf0e10cSrcweir 184cdf0e10cSrcweir // XCloseListener 185cdf0e10cSrcweir virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& Source, sal_Bool GetsOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException); 186cdf0e10cSrcweir virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); 187cdf0e10cSrcweir 188cdf0e10cSrcweir // XTerminateListener 189cdf0e10cSrcweir virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException); 190cdf0e10cSrcweir virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); 191cdf0e10cSrcweir 192cdf0e10cSrcweir // XModifyListener 193cdf0e10cSrcweir virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw ( ::com::sun::star::uno::RuntimeException ); 194cdf0e10cSrcweir 195cdf0e10cSrcweir // XEventListener 196cdf0e10cSrcweir virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw ( ::com::sun::star::uno::RuntimeException ); 197cdf0e10cSrcweir 198cdf0e10cSrcweir // XBorderResizeListener 199cdf0e10cSrcweir virtual void SAL_CALL borderWidthsChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObject, const ::com::sun::star::frame::BorderWidths& aNewSize ) throw (::com::sun::star::uno::RuntimeException); 200cdf0e10cSrcweir 201cdf0e10cSrcweir // XHatchWindowController 202cdf0e10cSrcweir virtual void SAL_CALL requestPositioning( const ::com::sun::star::awt::Rectangle& aRect ) throw (::com::sun::star::uno::RuntimeException); 203cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL calcAdjustedRectangle( const ::com::sun::star::awt::Rectangle& aRect ) throw (::com::sun::star::uno::RuntimeException); 204cdf0e10cSrcweir virtual void SAL_CALL activated( ) throw (::com::sun::star::uno::RuntimeException); 205cdf0e10cSrcweir virtual void SAL_CALL deactivated( ) throw (::com::sun::star::uno::RuntimeException); 206cdf0e10cSrcweir }; 207cdf0e10cSrcweir 208cdf0e10cSrcweir #endif 209cdf0e10cSrcweir 210