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