diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-02-03 16:58:19 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-02-04 11:51:49 +0100 |
commit | 20c207905f5e9a38f9e06488ab5488c5c21c24e4 (patch) | |
tree | 03cc29d5f4200aacedcd5829146f900a3262a4ed /cui | |
parent | 8f50196ef1ba0cc03904e18cc5b034074f92aa4e (diff) |
Simplify showKeyConfigTabPage
Change-Id: I31f7dd7ded3d319ba67e38f530128e28c265b7d5
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/customize/cfg.cxx | 34 |
1 files 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); } |