From b248624126c271c88381d3dad6e04fc954f65779 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 22 Mar 2013 09:24:15 +0200 Subject: fdo#46808, Convert frame::Frame to new style Change-Id: I74427d1e0059808f04960c648b93245b06c20f7f --- framework/inc/macros/xtypeprovider.hxx | 28 +++++++++++ framework/inc/services.h | 2 - framework/inc/services/frame.hxx | 54 +++++++++++----------- framework/inc/services/taskcreatorsrv.hxx | 10 ++-- framework/source/services/frame.cxx | 69 ++++++++++++++++++++++------ framework/source/services/taskcreatorsrv.cxx | 16 +++---- 6 files changed, 125 insertions(+), 54 deletions(-) (limited to 'framework') diff --git a/framework/inc/macros/xtypeprovider.hxx b/framework/inc/macros/xtypeprovider.hxx index 3de533fc552e..85648a75bb99 100644 --- a/framework/inc/macros/xtypeprovider.hxx +++ b/framework/inc/macros/xtypeprovider.hxx @@ -638,6 +638,34 @@ ________________________________________________________________________________ )) \ ) +// implementation of XTypeProvider with 20 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_21( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16, TYPE17, TYPE18, TYPE19, TYPE20, TYPE21 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_12 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 , \ + TYPE11 , \ + TYPE12 \ + )), \ + (PRIVATE_DEFINE_TYPE_9 ( TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 , \ + TYPE17 , \ + TYPE18 , \ + TYPE19 , \ + TYPE20 , \ + TYPE21 \ + )) \ + ) + // implementation of XTypeProvider with 1 additional interface for getTypes() AND using 1 baseclass #define DEFINE_XTYPEPROVIDER_1_WITH_BASECLASS( CLASS, BASECLASS, TYPE1 ) \ PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ diff --git a/framework/inc/services.h b/framework/inc/services.h index 956568db3721..bf1502632bea 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -28,7 +28,6 @@ namespace framework{ // used servicenames by framework //_________________________________________________________________________________________________________________ -#define SERVICENAME_FRAME DECLARE_ASCII("com.sun.star.frame.Frame" ) #define SERVICENAME_FRAMELOADERFACTORY DECLARE_ASCII("com.sun.star.frame.FrameLoaderFactory" ) #define SERVICENAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.document.FilterFactory" ) #define SERVICENAME_TYPEDETECTION DECLARE_ASCII("com.sun.star.document.TypeDetection" ) @@ -62,7 +61,6 @@ namespace framework{ // used implementationnames by framework //_________________________________________________________________________________________________________________ -#define IMPLEMENTATIONNAME_FRAME DECLARE_ASCII("com.sun.star.comp.framework.Frame" ) #define IMPLEMENTATIONNAME_DESKTOP DECLARE_ASCII("com.sun.star.comp.framework.Desktop" ) #define IMPLEMENTATIONNAME_URLTRANSFORMER DECLARE_ASCII("com.sun.star.comp.framework.URLTransformer" ) #define IMPLEMENTATIONNAME_GENERICFRAMELOADER DECLARE_ASCII("com.sun.star.comp.office.FrameLoader" ) diff --git a/framework/inc/services/frame.hxx b/framework/inc/services/frame.hxx index cc050cff67c1..492c3989c064 100644 --- a/framework/inc/services/frame.hxx +++ b/framework/inc/services/frame.hxx @@ -35,23 +35,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -60,8 +43,18 @@ #include #include #include -#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include #include #include @@ -111,11 +104,7 @@ class WindowCommandDispatch; class Frame : // interfaces public css::lang::XTypeProvider , public css::lang::XServiceInfo , - public css::frame::XFramesSupplier , // => XFrame => XComponent - public css::frame::XDispatchProvider , - public css::frame::XDispatchProviderInterception , - public css::frame::XDispatchInformationProvider , - public css::task::XStatusIndicatorFactory , + public css::frame::XFrame2 , public css::awt::XWindowListener , // => XEventListener public css::awt::XTopWindowListener , public css::awt::XFocusListener , @@ -290,6 +279,19 @@ class Frame : // interfaces virtual void SAL_CALL addTitleChangeListener ( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) throw (css::uno::RuntimeException); virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListenr ) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XFrame2 attributes + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference SAL_CALL getUserDefinedAttributes() throw (css::uno::RuntimeException); + + virtual css::uno::Reference SAL_CALL getDispatchRecorderSupplier() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDispatchRecorderSupplier(const css::uno::Reference&) throw (css::uno::RuntimeException); + + virtual css::uno::Reference SAL_CALL getLayoutManager() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLayoutManager(const css::uno::Reference&) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- // PropertySetHelper => XPropertySet, XPropertySetInfo //--------------------------------------------------------------------------------------------------------- @@ -331,7 +333,7 @@ class Frame : // interfaces // non threadsafe void impl_checkMenuCloser ( ); - void impl_setCloser ( const css::uno::Reference< css::frame::XFrame >& xFrame , + void impl_setCloser ( const css::uno::Reference< css::frame::XFrame2 >& xFrame , sal_Bool bState ); void impl_disposeContainerWindow ( css::uno::Reference< css::awt::XWindow >& xWindow ); static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor( ); @@ -403,8 +405,8 @@ class Frame : // interfaces SvtCommandOptions m_aCommandOptions ; /// ref counted class to support disabling commands defined by configuration file sal_Bool m_bSelfClose ; /// in case of CloseVetoException on method close() wqs thrown by ourself - we must close ourself later if no internal processes are running sal_Bool m_bIsHidden ; /// indicates, if this frame is used in hidden mode or not - static css::uno::WeakReference< css::frame::XFrame > m_xCloserFrame ; /// holds the only frame, which must show the special closer menu item (can be NULL!) - css::uno::Reference< ::com::sun::star::frame::XLayoutManager > m_xLayoutManager ; /// is used to layout the child windows of the frame. + static css::uno::WeakReference< css::frame::XFrame2 > m_xCloserFrame ; /// holds the only frame, which must show the special closer menu item (can be NULL!) + css::uno::Reference< ::css::frame::XLayoutManager > m_xLayoutManager ; /// is used to layout the child windows of the frame. css::uno::Reference< css::frame::XDispatchInformationProvider > m_xDispatchInfoHelper ; css::uno::Reference< css::frame::XTitle > m_xTitleHelper ; diff --git a/framework/inc/services/taskcreatorsrv.hxx b/framework/inc/services/taskcreatorsrv.hxx index 2d80f43163dd..68654e0c89e7 100644 --- a/framework/inc/services/taskcreatorsrv.hxx +++ b/framework/inc/services/taskcreatorsrv.hxx @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include @@ -132,14 +132,14 @@ class TaskCreatorService : public css::lang::XTypeProvider void implts_applyDocStyleToWindow(const css::uno::Reference< css::awt::XWindow >& xWindow) const; - css::uno::Reference< css::frame::XFrame > implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame , + css::uno::Reference< css::frame::XFrame2 > implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame , const css::uno::Reference< css::awt::XWindow >& xContainerWindow , const OUString& sName ); - void implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame >& xFrame ); - void implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame >& xFrame ); + void implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame ); + void implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame2 >& xFrame ); - void implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame >& xFrame ); + void implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame ); OUString impl_filterNames( const OUString& sName ); }; diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 6c6a32aeec67..44d30d03d4de 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -91,22 +91,23 @@ namespace framework{ -css::uno::WeakReference< css::frame::XFrame > Frame::m_xCloserFrame = css::uno::WeakReference< css::frame::XFrame >(); +css::uno::WeakReference< css::frame::XFrame2 > Frame::m_xCloserFrame = css::uno::WeakReference< css::frame::XFrame2 >(); //***************************************************************************************************************** // XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XINTERFACE_21 ( Frame , +DEFINE_XINTERFACE_22 ( Frame , OWeakObject , DIRECT_INTERFACE(css::lang::XTypeProvider ), DIRECT_INTERFACE(css::lang::XServiceInfo ), + DIRECT_INTERFACE(css::frame::XFrame2 ), DIRECT_INTERFACE(css::frame::XFramesSupplier ), DIRECT_INTERFACE(css::frame::XFrame ), - DIRECT_INTERFACE(css::lang::XComponent ), DIRECT_INTERFACE(css::task::XStatusIndicatorFactory ), DIRECT_INTERFACE(css::frame::XDispatchProvider ), DIRECT_INTERFACE(css::frame::XDispatchInformationProvider ), DIRECT_INTERFACE(css::frame::XDispatchProviderInterception ), + DIRECT_INTERFACE(css::lang::XComponent ), DIRECT_INTERFACE(css::beans::XPropertySet ), DIRECT_INTERFACE(css::beans::XPropertySetInfo ), DIRECT_INTERFACE(css::awt::XWindowListener ), @@ -121,18 +122,19 @@ DEFINE_XINTERFACE_21 ( Frame DIRECT_INTERFACE(css::frame::XTitleChangeBroadcaster ) ) -DEFINE_XTYPEPROVIDER_20 ( Frame , +DEFINE_XTYPEPROVIDER_21 ( Frame , css::lang::XTypeProvider , css::lang::XServiceInfo , + css::frame::XFrame2 , css::frame::XFramesSupplier , css::frame::XFrame , - css::lang::XComponent , css::task::XStatusIndicatorFactory , - css::beans::XPropertySet , - css::beans::XPropertySetInfo , css::frame::XDispatchProvider , css::frame::XDispatchInformationProvider , css::frame::XDispatchProviderInterception , + css::lang::XComponent , + css::beans::XPropertySet , + css::beans::XPropertySetInfo , css::awt::XWindowListener , css::awt::XTopWindowListener , css::awt::XFocusListener , @@ -146,8 +148,8 @@ DEFINE_XTYPEPROVIDER_20 ( Frame DEFINE_XSERVICEINFO_MULTISERVICE ( Frame , ::cppu::OWeakObject , - SERVICENAME_FRAME , - IMPLEMENTATIONNAME_FRAME + "com.sun.star.frame.Frame" , + OUString("com.sun.star.comp.framework.Frame") ) DEFINE_INIT_SERVICE ( Frame, @@ -1735,6 +1737,47 @@ void SAL_CALL Frame::removeTitleChangeListener( const css::uno::Reference< css:: xTitle->removeTitleChangeListener(xListener); } +css::uno::Reference SAL_CALL Frame::getUserDefinedAttributes() throw (css::uno::RuntimeException) +{ + // optional attribute + return 0; +} + +css::uno::Reference SAL_CALL Frame::getDispatchRecorderSupplier() throw (css::uno::RuntimeException) +{ + ReadGuard aReadLock( m_aLock ); + return m_xDispatchRecorderSupplier; +} + +void SAL_CALL Frame::setDispatchRecorderSupplier(const css::uno::Reference& p) throw (css::uno::RuntimeException) +{ + TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); + + /* SAFE { */ + WriteGuard aWriteLock( m_aLock ); + m_xDispatchRecorderSupplier.set(p); + aWriteLock.unlock(); + /* } SAFE */ +} + +css::uno::Reference SAL_CALL Frame::getLayoutManager() throw (css::uno::RuntimeException) +{ + ReadGuard aReadLock( m_aLock ); + return m_xLayoutManager; +} + +void SAL_CALL Frame::setLayoutManager(const css::uno::Reference& p1) throw (css::uno::RuntimeException) +{ + TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); + + /* SAFE { */ + WriteGuard aWriteLock( m_aLock ); + m_xLayoutManager.set(p1, css::uno::UNO_QUERY_THROW); + aWriteLock.unlock(); + /* } SAFE */ +} + + /*-****************************************************************************************************/ void Frame::implts_forgetSubFrames() { @@ -3011,7 +3054,7 @@ void Frame::implts_checkSuicide() enable; disable this state */ -void Frame::impl_setCloser( /*IN*/ const css::uno::Reference< css::frame::XFrame >& xFrame , +void Frame::impl_setCloser( /*IN*/ const css::uno::Reference< css::frame::XFrame2 >& xFrame , /*IN*/ sal_Bool bState ) { // Note: If start module isnt installed - no closer has to be shown! @@ -3068,7 +3111,7 @@ void Frame::impl_checkMenuCloser() FrameListAnalyzer::E_HIDDEN | FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT); // specify the new frame, which must have this special state ... - css::uno::Reference< css::frame::XFrame > xNewCloserFrame; + css::uno::Reference< css::frame::XFrame2 > xNewCloserFrame; // ----------------------------- // a) @@ -3088,7 +3131,7 @@ void Frame::impl_checkMenuCloser() { // others[0] can't be the backing component! // Because it's set at the special member aAnalyzer.m_xBackingComponent ... :-) - xNewCloserFrame = aAnalyzer.m_lOtherVisibleFrames[0]; + xNewCloserFrame.set( aAnalyzer.m_lOtherVisibleFrames[0], css::uno::UNO_QUERY_THROW ); } // ----------------------------- // b) @@ -3109,7 +3152,7 @@ void Frame::impl_checkMenuCloser() // or must be enabled/disabled at all. /* STATIC SAFE { */ WriteGuard aStaticWriteLock(LockHelper::getGlobalLock()); - css::uno::Reference< css::frame::XFrame > xCloserFrame (m_xCloserFrame.get(), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XFrame2 > xCloserFrame (m_xCloserFrame.get(), css::uno::UNO_QUERY); if (xCloserFrame!=xNewCloserFrame) { if (xCloserFrame.is()) diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx index b90ef2cef4ab..52f5ebe60a7d 100644 --- a/framework/source/services/taskcreatorsrv.cxx +++ b/framework/source/services/taskcreatorsrv.cxx @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -160,7 +160,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL TaskCreatorService::createI //-------------------> // create the new frame - css::uno::Reference< css::frame::XFrame > xFrame = implts_createFrame(xParentFrame, xContainerWindow, sRightName); + css::uno::Reference< css::frame::XFrame2 > xFrame = implts_createFrame(xParentFrame, xContainerWindow, sRightName); // special freature: // A special listener will restore pos/size states in case @@ -264,7 +264,7 @@ css::uno::Reference< css::awt::XWindow > TaskCreatorService::implts_createContai } //----------------------------------------------- -css::uno::Reference< css::frame::XFrame > TaskCreatorService::implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame , +css::uno::Reference< css::frame::XFrame2 > TaskCreatorService::implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame , const css::uno::Reference< css::awt::XWindow >& xContainerWindow, const OUString& sName ) { @@ -275,7 +275,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreatorService::implts_createFrame // <- SAFE // create new frame. - css::uno::Reference< css::frame::XFrame > xNewFrame( xSMGR->createInstance( SERVICENAME_FRAME ), css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::frame::XFrame2 > xNewFrame = css::frame::Frame::create( comphelper::getComponentContext(xSMGR) ); // Set window on frame. // Do it before calling any other interface methods ... @@ -288,7 +288,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreatorService::implts_createFrame { css::uno::Reference< css::frame::XFramesSupplier > xSupplier (xParentFrame, css::uno::UNO_QUERY_THROW); css::uno::Reference< css::frame::XFrames > xContainer = xSupplier->getFrames(); - xContainer->append( xNewFrame ); + xContainer->append( css::uno::Reference(xNewFrame, css::uno::UNO_QUERY_THROW) ); } // Set it's API name (if there is one from outside) @@ -299,7 +299,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreatorService::implts_createFrame } //----------------------------------------------- -void TaskCreatorService::implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame >& xFrame ) +void TaskCreatorService::implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame ) { // SAFE -> ReadGuard aReadLock( m_aLock ); @@ -320,7 +320,7 @@ void TaskCreatorService::implts_establishWindowStateListener( const css::uno::Re } //----------------------------------------------- -void TaskCreatorService::implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame >& xFrame ) +void TaskCreatorService::implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame ) { // SAFE -> ReadGuard aReadLock( m_aLock ); @@ -340,7 +340,7 @@ void TaskCreatorService::implts_establishDocModifyListener( const css::uno::Refe } //----------------------------------------------- -void TaskCreatorService::implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame >& xFrame ) +void TaskCreatorService::implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame2 >& xFrame ) { // SAFE -> ReadGuard aReadLock( m_aLock ); -- cgit