diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-17 14:19:26 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-24 17:59:30 +0200 |
commit | b8abd0368854329efb5ce91606e99fe448944ff9 (patch) | |
tree | 983039646a880dbbc5ae5c16ab877d5ef289326d /framework | |
parent | Related fdo#46808: Improve previous commit slightly (diff) | |
download | core-b8abd0368854329efb5ce91606e99fe448944ff9.tar.gz core-b8abd0368854329efb5ce91606e99fe448944ff9.zip |
fdo#46808, use service constructor for frame::DispatchHelper
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/services.h | 1 | ||||
-rw-r--r-- | framework/source/layoutmanager/helpers.cxx | 12 | ||||
-rw-r--r-- | framework/source/layoutmanager/helpers.hxx | 2 | ||||
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 11 | ||||
-rw-r--r-- | framework/source/services/dispatchhelper.cxx | 2 |
5 files changed, 10 insertions, 18 deletions
diff --git a/framework/inc/services.h b/framework/inc/services.h index 861006351cb7..7d30422db854 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -57,7 +57,6 @@ namespace framework{ #define SERVICENAME_DISPATCHRECORDER DECLARE_ASCII("com.sun.star.frame.DispatchRecorder" ) #define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" ) #define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" ) -#define SERVICENAME_DISPATCHHELPER DECLARE_ASCII("com.sun.star.frame.DispatchHelper" ) #define SERVICENAME_DETECTORFACTORY DECLARE_ASCII("com.sun.star.document.ExtendedTypeDetectionFactory" ) #define SERVICENAME_SCRIPTCONVERTER DECLARE_ASCII("com.sun.star.script.Converter" ) #define SERVICENAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.frame.LayoutManager" ) diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index ef48be24888e..a954551c6db5 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -33,7 +33,7 @@ #include <com/sun/star/ui/DockingArea.hpp> #include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/XTopWindow.hpp> -#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/frame/DispatchHelper.hpp> #include <com/sun/star/awt/XDockableWindow.hpp> #include <com/sun/star/awt/XDockableWindowListener.hpp> #include <com/sun/star/awt/XWindowListener.hpp> @@ -308,10 +308,9 @@ sal_Bool implts_isFrameOrWindowTop( const uno::Reference< frame::XFrame >& xFram return sal_False; } -void impl_setDockingWindowVisibility( const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMGR, const css::uno::Reference< css::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ) +void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ) { const ::rtl::OUString aDockWinPrefixCommand( RTL_CONSTASCII_USTRINGPARAM( "DockingWindow" )); - css::uno::WeakReference< css::frame::XDispatchHelper > xDispatchHelper; sal_Int32 nID = rDockingWindowName.toInt32(); sal_Int32 nIndex = nID - DOCKWIN_ID_BASE; @@ -328,12 +327,7 @@ void impl_setDockingWindowVisibility( const css::uno::Reference< css::lang::XMul aArgs[0].Name = aDockWinArgName; aArgs[0].Value = css::uno::makeAny( bVisible ); - css::uno::Reference< css::frame::XDispatchHelper > xDispatcher( xDispatchHelper ); - if ( !xDispatcher.is()) - { - xDispatcher = css::uno::Reference< css::frame::XDispatchHelper >( - rSMGR->createInstance(SERVICENAME_DISPATCHHELPER), css::uno::UNO_QUERY_THROW); - } + css::uno::Reference< css::frame::XDispatchHelper > xDispatcher = css::frame::DispatchHelper::create( rxContext ); aDockWinCommand = aDockWinCommand + aDockWinArgName; xDispatcher->executeDispatch( diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx index dbe1cd0b5a0e..e2e667c073f9 100644 --- a/framework/source/layoutmanager/helpers.hxx +++ b/framework/source/layoutmanager/helpers.hxx @@ -77,7 +77,7 @@ void parseResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aElemen ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > impl_getModelFromFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); sal_Bool implts_isPreviewModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); sal_Bool implts_isFrameOrWindowTop( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); -void impl_setDockingWindowVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& rSMGR, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ); +void impl_setDockingWindowVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ); void impl_addWindowListeners( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xThis, const ::com::sun::star::uno::Reference< css::ui::XUIElement >& xUIElement ); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > implts_createToolkitWindow( const css::uno::Reference< ::com::sun::star::awt::XToolkit2 >& rToolkit, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent ); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 9bb969292b62..37e08e6f5e79 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -63,7 +63,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/frame/LayoutManagerEvents.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/frame/DispatchHelper.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/util/URLTransformer.hpp> @@ -1639,7 +1639,7 @@ throw (RuntimeException) uno::Reference< lang::XMultiServiceFactory > xSMGR( m_xSMGR ); aWriteLock.unlock(); - impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false ); + impl_setDockingWindowVisibility( comphelper::getComponentContext(xSMGR), xFrame, aElementName, false ); bMustBeLayouted = false; bNotify = false; } @@ -1860,7 +1860,7 @@ throw (RuntimeException) uno::Reference< lang::XMultiServiceFactory > xSMGR( m_xSMGR ); aReadGuard.unlock(); - impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, true ); + impl_setDockingWindowVisibility( comphelper::getComponentContext(xSMGR), xFrame, aElementName, true ); } else if ( aElementType.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("toolpanel"))) { @@ -1950,7 +1950,7 @@ throw (RuntimeException) uno::Reference< lang::XMultiServiceFactory > xSMGR( m_xSMGR ); aReadGuard.unlock(); - impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false ); + impl_setDockingWindowVisibility( comphelper::getComponentContext(xSMGR), xFrame, aElementName, false ); } if ( bMustLayout ) @@ -2670,8 +2670,7 @@ IMPL_LINK_NOARG(LayoutManager, MenuBarClose) if ( !xProvider.is()) return 0; - uno::Reference< frame::XDispatchHelper > xDispatcher( - xSMGR->createInstance(SERVICENAME_DISPATCHHELPER), uno::UNO_QUERY_THROW); + uno::Reference< frame::XDispatchHelper > xDispatcher = frame::DispatchHelper::create( comphelper::getComponentContext( xSMGR ) ); xDispatcher->executeDispatch( xProvider, diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx index e3b264e47696..52e18fcb6216 100644 --- a/framework/source/services/dispatchhelper.cxx +++ b/framework/source/services/dispatchhelper.cxx @@ -44,7 +44,7 @@ namespace framework{ DEFINE_XSERVICEINFO_MULTISERVICE(DispatchHelper , ::cppu::OWeakObject , - SERVICENAME_DISPATCHHELPER , + DECLARE_ASCII("com.sun.star.frame.DispatchHelper"), IMPLEMENTATIONNAME_DISPATCHHELPER) DEFINE_INIT_SERVICE( DispatchHelper, {} ) |