From 20c207905f5e9a38f9e06488ab5488c5c21c24e4 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 3 Feb 2014 16:58:19 +0100 Subject: Simplify showKeyConfigTabPage Change-Id: I31f7dd7ded3d319ba67e38f530128e28c265b7d5 --- cui/source/customize/cfg.cxx | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 738757a0181a..d4f5361285aa 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); } -- cgit