From c5498c310f6765ec9857e34169fd4a8d48953eb7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 25 Oct 2016 11:47:17 +0200 Subject: [PATCH] loplugin:expandablemethods in UnoControls..vbahelper Change-Id: I7e607df2a1f6d4eb207ee0d3eb30f41fac44a0c6 Reviewed-on: https://gerrit.libreoffice.org/30262 Tested-by: Jenkins Reviewed-by: Noel Grandin --- UnoControls/inc/basecontrol.hxx | 2 - UnoControls/source/base/basecontrol.cxx | 48 ++++++++----------- include/unotools/confignode.hxx | 7 --- include/unotools/configvaluecontainer.hxx | 17 ------- include/vbahelper/vbahelper.hxx | 2 - unotools/source/config/confignode.cxx | 7 +-- .../source/config/configvaluecontainer.cxx | 10 +--- vbahelper/source/vbahelper/vbahelper.cxx | 10 ++-- 8 files changed, 25 insertions(+), 78 deletions(-) diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx index f78686e483fb..fbf1686d2a51 100644 --- a/UnoControls/inc/basecontrol.hxx +++ b/UnoControls/inc/basecontrol.hxx @@ -379,8 +379,6 @@ protected: private: - void impl_releasePeer(); - OMRCListenerMultiplexerHelper* impl_getMultiplexer(); css::uno::Reference< css::uno::XComponentContext > m_xComponentContext; diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx index b9c7e4cf0052..457dd5cb7821 100644 --- a/UnoControls/source/base/basecontrol.cxx +++ b/UnoControls/source/base/basecontrol.cxx @@ -231,7 +231,25 @@ void SAL_CALL BaseControl::dispose() throw( RuntimeException, std::exception ) // release context and peer m_xContext.clear(); - impl_releasePeer(); + if ( m_xPeer.is() ) + { + if ( m_xGraphicsPeer.is() ) + { + removePaintListener( this ); + removeWindowListener( this ); + m_xGraphicsPeer.clear(); + } + + m_xPeer->dispose(); + m_xPeerWindow.clear(); + m_xPeer.clear(); + + if ( m_pMultiplexer != nullptr ) + { + // take changes on multiplexer + m_pMultiplexer->setPeer( Reference< XWindow >() ); + } + } // release view if ( m_xGraphicsView.is() ) @@ -741,34 +759,6 @@ void BaseControl::impl_recalcLayout( const WindowEvent& /*aEvent*/ ) // But we make it not pure virtual because it's not necessary for all derived classes! } -// protected method - - -// private method - -void BaseControl::impl_releasePeer() -{ - if ( m_xPeer.is() ) - { - if ( m_xGraphicsPeer.is() ) - { - removePaintListener( this ); - removeWindowListener( this ); - m_xGraphicsPeer.clear(); - } - - m_xPeer->dispose(); - m_xPeerWindow.clear(); - m_xPeer.clear(); - - if ( m_pMultiplexer != nullptr ) - { - // take changes on multiplexer - m_pMultiplexer->setPeer( Reference< XWindow >() ); - } - } -} - // private method OMRCListenerMultiplexerHelper* BaseControl::impl_getMultiplexer() diff --git a/include/unotools/confignode.hxx b/include/unotools/confignode.hxx index 5ab77c19da87..cae0bd9b8b92 100644 --- a/include/unotools/confignode.hxx +++ b/include/unotools/confignode.hxx @@ -142,13 +142,6 @@ namespace utl css::uno::Sequence< OUString > getNodeNames() const throw(); - /** enables or disables name escaping when accessing direct children

- Escaping is disabled by default, usually you enable it for set nodes (e.g. with calling setEscape(isSetNode)). - Once escaping is enabled, you should not access indirect children (e.g. openNode("child/grandchild"), 'cause - escaping for such names may not be supported by the underlying API objects. - @see getEscape - */ - void setEscape(bool _bEnable); /** get the flag specifying the current escape behaviour @see setEscape */ diff --git a/include/unotools/configvaluecontainer.hxx b/include/unotools/configvaluecontainer.hxx index 16048134353d..d5838711ba98 100644 --- a/include/unotools/configvaluecontainer.hxx +++ b/include/unotools/configvaluecontainer.hxx @@ -120,23 +120,6 @@ namespace utl */ void read( ); - /** updates the configuration data - -

The current values in memory (your exchange locations registered using the registerXXX methods) is - forwarded to their respective configuration nodes.

- -

Note that calling write(commit().

- - @precond - The access must have been created for update access - - You must explicitly call commit to make your changes persistent. - - @see read - @see commit - */ - void write(); - /** commits any changes done

Note that calling write(commit().

diff --git a/include/vbahelper/vbahelper.hxx b/include/vbahelper/vbahelper.hxx index ab5a2e1f45c3..79f85068669f 100644 --- a/include/vbahelper/vbahelper.hxx +++ b/include/vbahelper/vbahelper.hxx @@ -254,8 +254,6 @@ public: static void basicexception( const css::uno::Exception& ex ) throw( css::script::BasicErrorException ); - static void runtimeexception( const OUString& DetailedMessage, const css::uno::Exception& ex, int err, const OUString& /*additionalArgument*/ ) throw( css::uno::RuntimeException ); - static void runtimeexception( int err, const OUString& additionalArgument ) throw( css::uno::RuntimeException ); }; diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 89c38fa74790..4d0eec963c11 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -74,7 +74,7 @@ namespace utl startComponentListening(xConfigNodeComp); if (isValid()) - setEscape(isSetNode()); + m_bEscapeNames = isSetNode() && Reference< XStringEscape >::query(m_xDirectAccess).is(); } OConfigurationNode::OConfigurationNode(const OConfigurationNode& _rSource) @@ -303,11 +303,6 @@ namespace utl return OConfigurationNode(); } - void OConfigurationNode::setEscape(bool _bEnable) - { - m_bEscapeNames = _bEnable && Reference< XStringEscape >::query(m_xDirectAccess).is(); - } - bool OConfigurationNode::isSetNode() const { bool bIsSet = false; diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx index 873dcfef85d7..312751089213 100644 --- a/unotools/source/config/configvaluecontainer.cxx +++ b/unotools/source/config/configvaluecontainer.cxx @@ -271,20 +271,14 @@ namespace utl ); } - void OConfigurationValueContainer::write() + void OConfigurationValueContainer::commit() { - // collect the current values in the exchange locations + // write the current values in the exchange locations std::for_each( m_pImpl->aAccessors.begin(), m_pImpl->aAccessors.end(), UpdateToConfig( m_pImpl->aConfigRoot, m_pImpl->rMutex ) ); - } - - void OConfigurationValueContainer::commit() - { - // write the current values in the exchange locations - write(); // commit the changes done m_pImpl->aConfigRoot.commit( ); diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 406cc847225c..76b0e7e54f55 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -1063,15 +1063,11 @@ void DebugHelper::basicexception( const css::uno::Exception& ex ) throw( css::sc basicexception( OUString(), ex, ERRCODE_BASIC_INTERNAL_ERROR, OUString() ); } -void DebugHelper::runtimeexception( const OUString& DetailedMessage, const css::uno::Exception& ex, int err, const OUString& /*additionalArgument*/ ) throw( css::uno::RuntimeException ) +void DebugHelper::runtimeexception( int err, const OUString& /*additionalArgument*/ ) throw( css::uno::RuntimeException ) { // #TODO #FIXME ( do we want to support additionalArg here ) - throw css::uno::RuntimeException( DetailedMessage.concat( " " ).concat( ex.Message ).concat(" ").concat(OUString::number(err)), css::uno::Reference< css::uno::XInterface >() ); -} - -void DebugHelper::runtimeexception( int err, const OUString& additionalArgument ) throw( css::uno::RuntimeException ) -{ - runtimeexception( OUString(), css::uno::Exception(), err, additionalArgument ); + throw css::uno::RuntimeException( css::uno::Exception().Message + " " + OUString::number(err), + css::uno::Reference< css::uno::XInterface >() ); } Millimeter::Millimeter():m_nMillimeter(0) {}