cui/source/customize/cfg.cxx | 34 ++++++------------ qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java | 2 + sfx2/source/appl/appdispatchprovider.cxx | 34 +++++++++++------- 3 files changed, 36 insertions(+), 34 deletions(-)
New commits: commit 20c207905f5e9a38f9e06488ab5488c5c21c24e4 Author: Stephan Bergmann <sberg...@redhat.com> Date: Mon Feb 3 16:58:19 2014 +0100 Simplify showKeyConfigTabPage Change-Id: I31f7dd7ded3d319ba67e38f530128e28c265b7d5 diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 738757a..d4f5361 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -749,30 +749,22 @@ SfxTabPage *CreateSvxEventConfigPage( Window *pParent, const SfxItemSet& rSet ) return new SvxEventConfigPage( pParent, rSet, SvxEventConfigPage::EarlyInit() ); } -sal_Bool impl_showKeyConfigTabPage( const css::uno::Reference< css::frame::XFrame >& xFrame ) -{ - static OUString MODULEID_STARTMODULE ("com.sun.star.frame.StartModule" ); +namespace { - try +bool showKeyConfigTabPage( const css::uno::Reference< css::frame::XFrame >& xFrame ) +{ + if (!xFrame.is()) { - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); - css::uno::Reference< css::frame::XModuleManager2 > xMM = css::frame::ModuleManager::create(xContext); - - if (xFrame.is()) - { - OUString sModuleId = xMM->identify(xFrame); - if ( - ( !sModuleId.isEmpty() ) && - (!sModuleId.equals(MODULEID_STARTMODULE)) - ) - return sal_True; - } + return false; } - catch(const css::uno::Exception&) - {} + OUString sModuleId( + css::frame::ModuleManager::create( + comphelper::getProcessComponentContext()) + ->identify(xFrame)); + return !sModuleId.isEmpty() + && sModuleId != "com.sun.star.frame.StartModule"; +} - return sal_False; } /****************************************************************************** @@ -815,7 +807,7 @@ void SvxConfigDialog::SetFrame(const ::com::sun::star::uno::Reference< ::com::su { m_xFrame = xFrame; - if (!impl_showKeyConfigTabPage( xFrame )) + if (!showKeyConfigTabPage( xFrame )) RemoveTabPage(m_nKeyboardPageId); } commit 8f50196ef1ba0cc03904e18cc5b034074f92aa4e Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 4 10:16:07 2014 +0100 *_AppDispatchProvider_get_implementation cannot bypass XInitialization ...as SfxAppDispatchProvider implements new-style service css.frame.AppDispatchProvider that doesn't declare any non-default ctors (which looks broken, though) and old-style service css.frame.DispatchProvicer. (And fix the test code to pass in meaningful XInitialization arguments.) Change-Id: Ifcc32d17f6b96ade2acc40ccdb60f7bad2d503a4 diff --git a/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java b/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java index 8a56c10..84664a9 100644 --- a/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java +++ b/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java @@ -88,6 +88,8 @@ public class AppDispatchProvider extends TestCase { // adding relation for :XDispatchProvider tEnv.addObjRelation("XDispatchProvider.URL", ".uno:BibliographyComponent") ; + tEnv.addObjRelation("XInitialization.args", new Object[] { null }); + return tEnv; } // finish method getTestEnvironment diff --git a/sfx2/source/appl/appdispatchprovider.cxx b/sfx2/source/appl/appdispatchprovider.cxx index da2a6fd..e2615e4 100644 --- a/sfx2/source/appl/appdispatchprovider.cxx +++ b/sfx2/source/appl/appdispatchprovider.cxx @@ -23,6 +23,8 @@ #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/util/URL.hpp> @@ -30,7 +32,7 @@ #include <basic/basmgr.hxx> #include <basic/sbuno.hxx> #include <comphelper/sequence.hxx> -#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> #include <cppuhelper/supportsservice.hxx> #include <rtl/ref.hxx> #include <sfx2/app.hxx> @@ -57,12 +59,16 @@ using namespace ::com::sun::star::uno; namespace { -class SfxAppDispatchProvider : public ::cppu::WeakImplHelper2< css::frame::XAppDispatchProvider, - css::lang::XServiceInfo> +class SfxAppDispatchProvider : public ::cppu::WeakImplHelper3< css::frame::XAppDispatchProvider, + css::lang::XServiceInfo, + css::lang::XInitialization > { css::uno::WeakReference < css::frame::XFrame > m_xFrame; public: - SfxAppDispatchProvider(const css::uno::Sequence< css::uno::Any >&aArguments) + SfxAppDispatchProvider() {} + + virtual void SAL_CALL initialize( + css::uno::Sequence<css::uno::Any> const & aArguments) throw (css::uno::Exception, css::uno::RuntimeException); virtual OUString SAL_CALL getImplementationName() @@ -90,15 +96,17 @@ public: throw (css::uno::RuntimeException); }; -SfxAppDispatchProvider::SfxAppDispatchProvider(const css::uno::Sequence< css::uno::Any >& aArguments) - throw (uno::Exception, uno::RuntimeException) +void SfxAppDispatchProvider::initialize( + css::uno::Sequence<css::uno::Any> const & aArguments) + throw (css::uno::Exception, css::uno::RuntimeException) { - Reference < XFrame > xFrame; - if ( aArguments.getLength() ) - { - aArguments[0] >>= xFrame; - m_xFrame = xFrame; + css::uno::Reference<css::frame::XFrame> f; + if (aArguments.getLength() != 1 || !(aArguments[0] >>= f)) { + throw css::lang::IllegalArgumentException( + "SfxAppDispatchProvider::initialize expects one XFrame argument", + static_cast<OWeakObject *>(this), 0); } + m_xFrame = f; } OUString SAL_CALL SfxAppDispatchProvider::getImplementationName() throw( css::uno::RuntimeException ) @@ -253,9 +261,9 @@ throw (uno::RuntimeException) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation( css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &arguments) + css::uno::Sequence<css::uno::Any> const &) { - return cppu::acquire(new SfxAppDispatchProvider(arguments)); + return cppu::acquire(new SfxAppDispatchProvider); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits