From b44cbb26efe1d0b0950b1e1613e131b506dc3876 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 20 Jan 2015 12:38:10 +0200 Subject: new loplugin: change virtual methods to non-virtual Where we can prove that the virtual method is never overriden. In the case of pure-virtual methods, we remove the method entirely. Sometimes this leads to entire methods and fields being eliminated. Change-Id: I138ef81c95f115dbd8c023a83cfc7e9d5d6d14ae --- framework/inc/classes/propertysethelper.hxx | 8 +++---- framework/inc/helper/ocomponentenumeration.hxx | 2 +- framework/inc/helper/oframes.hxx | 2 +- framework/inc/helper/statusindicatorfactory.hxx | 10 ++++----- framework/inc/jobs/configaccess.hxx | 8 +++---- .../inc/xml/acceleratorconfigurationwriter.hxx | 2 +- framework/inc/xml/imagesdocumenthandler.hxx | 8 +++---- framework/inc/xml/menudocumenthandler.hxx | 6 ++--- framework/inc/xml/statusbardocumenthandler.hxx | 2 +- framework/inc/xml/toolboxdocumenthandler.hxx | 8 +++---- .../source/inc/accelerators/acceleratorcache.hxx | 18 +++++++-------- framework/source/inc/accelerators/keymapping.hxx | 4 ++-- .../source/inc/accelerators/storageholder.hxx | 26 +++++++++++----------- framework/source/inc/loadenv/actionlockguard.hxx | 8 +++---- .../uielement/langselectionstatusbarcontroller.cxx | 21 ----------------- .../source/uielement/uicommanddescription.cxx | 2 +- 16 files changed, 57 insertions(+), 78 deletions(-) (limited to 'framework') diff --git a/framework/inc/classes/propertysethelper.hxx b/framework/inc/classes/propertysethelper.hxx index 19bb4fbd5dbf..1e022a3c5f16 100644 --- a/framework/inc/classes/propertysethelper.hxx +++ b/framework/inc/classes/propertysethelper.hxx @@ -108,7 +108,7 @@ class FWI_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet * The owner of this class has to be sure, that every new property does * not clash with any existing one. */ - virtual void SAL_CALL impl_addPropertyInfo(const css::beans::Property& aProperty) + void SAL_CALL impl_addPropertyInfo(const css::beans::Property& aProperty) throw(css::beans::PropertyExistException, css::uno::Exception ); @@ -120,7 +120,7 @@ class FWI_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet * @throw [com::sun::star::beans::UnknownPropertyException] * if no property with the specified name exists. */ - virtual void SAL_CALL impl_removePropertyInfo(const OUString& sProperty) + void SAL_CALL impl_removePropertyInfo(const OUString& sProperty) throw(css::beans::UnknownPropertyException, css::uno::Exception ); @@ -130,8 +130,8 @@ class FWI_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet * There is no chance to reactive a "dead" object by calling impl_enablePropertySet() * again! */ - virtual void SAL_CALL impl_enablePropertySet(); - virtual void SAL_CALL impl_disablePropertySet(); + void SAL_CALL impl_enablePropertySet(); + void SAL_CALL impl_disablePropertySet(); /** */ diff --git a/framework/inc/helper/ocomponentenumeration.hxx b/framework/inc/helper/ocomponentenumeration.hxx index 8dfff638566e..33d8951cdcc4 100644 --- a/framework/inc/helper/ocomponentenumeration.hxx +++ b/framework/inc/helper/ocomponentenumeration.hxx @@ -139,7 +139,7 @@ class OComponentEnumeration : public ::cppu::WeakImplHelper2< ::com::sun::star @seealso destructor ~TaskEnumeration() *//*-*****************************************************************************************************/ - virtual void impl_resetObject(); + void impl_resetObject(); private: diff --git a/framework/inc/helper/oframes.hxx b/framework/inc/helper/oframes.hxx index 5e1bc562e0c1..67b7e57c6284 100644 --- a/framework/inc/helper/oframes.hxx +++ b/framework/inc/helper/oframes.hxx @@ -178,7 +178,7 @@ class OFrames : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XFr @seealso method dispose() (if it exist!) @seealso destructor ~TaskEnumeration() *//*-*****************************************************************************************************/ - virtual void impl_resetObject(); + void impl_resetObject(); private: diff --git a/framework/inc/helper/statusindicatorfactory.hxx b/framework/inc/helper/statusindicatorfactory.hxx index 142eb8256bd1..328e71320e7f 100644 --- a/framework/inc/helper/statusindicatorfactory.hxx +++ b/framework/inc/helper/statusindicatorfactory.hxx @@ -229,18 +229,18 @@ class StatusIndicatorFactory : public ::cppu::WeakImplHelper4< throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; // similar (XStatusIndicator) - virtual void start(const css::uno::Reference< css::task::XStatusIndicator >& xChild, + void start(const css::uno::Reference< css::task::XStatusIndicator >& xChild, const OUString& sText , sal_Int32 nRange); - virtual void SAL_CALL reset(const css::uno::Reference< css::task::XStatusIndicator >& xChild); + void SAL_CALL reset(const css::uno::Reference< css::task::XStatusIndicator >& xChild); - virtual void SAL_CALL end(const css::uno::Reference< css::task::XStatusIndicator >& xChild); + void SAL_CALL end(const css::uno::Reference< css::task::XStatusIndicator >& xChild); - virtual void SAL_CALL setText(const css::uno::Reference< css::task::XStatusIndicator >& xChild, + void SAL_CALL setText(const css::uno::Reference< css::task::XStatusIndicator >& xChild, const OUString& sText ); - virtual void SAL_CALL setValue(const css::uno::Reference< css::task::XStatusIndicator >& xChild, + void SAL_CALL setValue(const css::uno::Reference< css::task::XStatusIndicator >& xChild, sal_Int32 nValue); // specials diff --git a/framework/inc/jobs/configaccess.hxx b/framework/inc/jobs/configaccess.hxx index bcc01ca7bbfe..9318afe236d2 100644 --- a/framework/inc/jobs/configaccess.hxx +++ b/framework/inc/jobs/configaccess.hxx @@ -80,11 +80,11 @@ class FWI_DLLPUBLIC ConfigAccess const OUString& sRoot ); virtual ~ConfigAccess(); - virtual void open ( EOpenMode eMode ); - virtual void close ( ); - virtual EOpenMode getMode( ) const; + void open ( EOpenMode eMode ); + void close ( ); + EOpenMode getMode( ) const; - virtual const css::uno::Reference< css::uno::XInterface >& cfg(); + const css::uno::Reference< css::uno::XInterface >& cfg(); }; } // namespace framework diff --git a/framework/inc/xml/acceleratorconfigurationwriter.hxx b/framework/inc/xml/acceleratorconfigurationwriter.hxx index a5813c149cfa..c9f432456abb 100644 --- a/framework/inc/xml/acceleratorconfigurationwriter.hxx +++ b/framework/inc/xml/acceleratorconfigurationwriter.hxx @@ -74,7 +74,7 @@ class AcceleratorConfigurationWriter virtual ~AcceleratorConfigurationWriter(); /** @short TODO */ - virtual void flush(); + void flush(); // helper diff --git a/framework/inc/xml/imagesdocumenthandler.hxx b/framework/inc/xml/imagesdocumenthandler.hxx index 921f3eb6d026..cbb83f07d297 100644 --- a/framework/inc/xml/imagesdocumenthandler.hxx +++ b/framework/inc/xml/imagesdocumenthandler.hxx @@ -150,19 +150,19 @@ class OWriteImagesDocumentHandler ::com::sun::star::uno::RuntimeException ); protected: - virtual void WriteImageList( const ImageListItemDescriptor* ) throw + void WriteImageList( const ImageListItemDescriptor* ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void WriteExternalImageList( const ExternalImageItemListDescriptor* ) throw + void WriteExternalImageList( const ExternalImageItemListDescriptor* ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void WriteImage( const ImageItemDescriptor* ) throw + void WriteImage( const ImageItemDescriptor* ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void WriteExternalImage( const ExternalImageItemDescriptor* ) throw + void WriteExternalImage( const ExternalImageItemDescriptor* ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); diff --git a/framework/inc/xml/menudocumenthandler.hxx b/framework/inc/xml/menudocumenthandler.hxx index 2462bb2e9336..10de22c60af6 100644 --- a/framework/inc/xml/menudocumenthandler.hxx +++ b/framework/inc/xml/menudocumenthandler.hxx @@ -260,11 +260,11 @@ class FWE_DLLPUBLIC OWriteMenuDocumentHandler void WriteMenuDocument() throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); protected: - virtual void WriteMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rSubMenuContainer ) throw + void WriteMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rSubMenuContainer ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void WriteMenuItem( const OUString& aCommandURL, const OUString& aLabel, const OUString& aHelpURL, sal_Int16 nStyle = 0 ); - virtual void WriteMenuSeparator(); + void WriteMenuItem( const OUString& aCommandURL, const OUString& aLabel, const OUString& aHelpURL, sal_Int16 nStyle = 0 ); + void WriteMenuSeparator(); com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xMenuBarContainer; ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; diff --git a/framework/inc/xml/statusbardocumenthandler.hxx b/framework/inc/xml/statusbardocumenthandler.hxx index dfe8ef9c9a6b..96c70fdb72b3 100644 --- a/framework/inc/xml/statusbardocumenthandler.hxx +++ b/framework/inc/xml/statusbardocumenthandler.hxx @@ -137,7 +137,7 @@ class FWE_DLLPUBLIC OWriteStatusBarDocumentHandler ::com::sun::star::uno::RuntimeException ); protected: - virtual void WriteStatusBarItem( + void WriteStatusBarItem( const OUString& rCommandURL, const OUString& rHelpURL, sal_Int16 nOffset, diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx index e50df109378b..8fb52012d832 100644 --- a/framework/inc/xml/toolboxdocumenthandler.hxx +++ b/framework/inc/xml/toolboxdocumenthandler.hxx @@ -162,20 +162,20 @@ class FWE_DLLPUBLIC OWriteToolBoxDocumentHandler ::com::sun::star::uno::RuntimeException ); protected: - virtual void WriteToolBoxItem( const OUString& aCommandURL, const OUString& aLabel, const OUString& aHelpURL, const OUString& aTooltip, sal_Int16 nStyle, + void WriteToolBoxItem( const OUString& aCommandURL, const OUString& aLabel, const OUString& aHelpURL, const OUString& aTooltip, sal_Int16 nStyle, sal_Int16 nWidth, bool bVisible ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void WriteToolBoxSpace() throw + void WriteToolBoxSpace() throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void WriteToolBoxBreak() throw + void WriteToolBoxBreak() throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void WriteToolBoxSeparator() throw + void WriteToolBoxSeparator() throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); diff --git a/framework/source/inc/accelerators/acceleratorcache.hxx b/framework/source/inc/accelerators/acceleratorcache.hxx index 790ab0e03896..47e0d86ce81e 100644 --- a/framework/source/inc/accelerators/acceleratorcache.hxx +++ b/framework/source/inc/accelerators/acceleratorcache.hxx @@ -94,7 +94,7 @@ class AcceleratorCache the (changed!) copy, which should be written back to this original container. */ - virtual void takeOver(const AcceleratorCache& rCopy); + void takeOver(const AcceleratorCache& rCopy); /** TODO document me */ AcceleratorCache& operator=(const AcceleratorCache& rCopy); @@ -107,11 +107,11 @@ class AcceleratorCache @return [bool] sal_True if the speicfied key exists inside this container. */ - virtual bool hasKey(const css::awt::KeyEvent& aKey) const; - virtual bool hasCommand(const OUString& sCommand) const; + bool hasKey(const css::awt::KeyEvent& aKey) const; + bool hasCommand(const OUString& sCommand) const; /** TODO document me */ - virtual TKeyList getAllKeys() const; + TKeyList getAllKeys() const; /** @short add a new or change an existing key-command pair of this container. @@ -122,7 +122,7 @@ class AcceleratorCache @param sCommand describe the command. */ - virtual void setKeyCommandPair(const css::awt::KeyEvent& aKey , + void setKeyCommandPair(const css::awt::KeyEvent& aKey , const OUString& sCommand); /** @short returns the list of keys, which are registered @@ -134,14 +134,14 @@ class AcceleratorCache @return [TKeyList] the list of registered keys. Can be empty! */ - virtual TKeyList getKeysByCommand(const OUString& sCommand) const; + TKeyList getKeysByCommand(const OUString& sCommand) const; /** TODO */ - virtual OUString getCommandByKey(const css::awt::KeyEvent& aKey) const; + OUString getCommandByKey(const css::awt::KeyEvent& aKey) const; /** TODO */ - virtual void removeKey(const css::awt::KeyEvent& aKey); - virtual void removeCommand(const OUString& sCommand); + void removeKey(const css::awt::KeyEvent& aKey); + void removeCommand(const OUString& sCommand); }; } // namespace framework diff --git a/framework/source/inc/accelerators/keymapping.hxx b/framework/source/inc/accelerators/keymapping.hxx index 90670d45327d..dfdd327caa91 100644 --- a/framework/source/inc/accelerators/keymapping.hxx +++ b/framework/source/inc/accelerators/keymapping.hxx @@ -93,7 +93,7 @@ class KeyMapping if the given identifier does not describe a well known key code. */ - virtual sal_uInt16 mapIdentifierToCode(const OUString& sIdentifier) + sal_uInt16 mapIdentifierToCode(const OUString& sIdentifier) throw(css::lang::IllegalArgumentException); /** @short return a suitable key identifier @@ -104,7 +104,7 @@ class KeyMapping @return The corresponding string identifier. */ - virtual OUString mapCodeToIdentifier(sal_uInt16 nCode); + OUString mapCodeToIdentifier(sal_uInt16 nCode); // helper diff --git a/framework/source/inc/accelerators/storageholder.hxx b/framework/source/inc/accelerators/storageholder.hxx index 344318460e94..fcef47674374 100644 --- a/framework/source/inc/accelerators/storageholder.hxx +++ b/framework/source/inc/accelerators/storageholder.hxx @@ -84,59 +84,59 @@ class StorageHolder /** @short TODO */ - virtual void forgetCachedStorages(); + void forgetCachedStorages(); /** @short TODO */ - virtual void setRootStorage(const css::uno::Reference< css::embed::XStorage >& xRoot); + void setRootStorage(const css::uno::Reference< css::embed::XStorage >& xRoot); /** @short TODO */ - virtual css::uno::Reference< css::embed::XStorage > getRootStorage() const; + css::uno::Reference< css::embed::XStorage > getRootStorage() const; /** @short TODO open or get! */ - virtual css::uno::Reference< css::embed::XStorage > openPath(const OUString& sPath , + css::uno::Reference< css::embed::XStorage > openPath(const OUString& sPath , sal_Int32 nOpenMode); /** @short TODO */ - virtual StorageHolder::TStorageList getAllPathStorages(const OUString& sPath); + StorageHolder::TStorageList getAllPathStorages(const OUString& sPath); /** @short TODO */ - virtual void commitPath(const OUString& sPath); + void commitPath(const OUString& sPath); /** @short TODO */ - virtual void closePath(const OUString& sPath); + void closePath(const OUString& sPath); /** @short TODO */ - virtual void notifyPath(const OUString& sPath); + void notifyPath(const OUString& sPath); /** @short TODO */ - virtual void addStorageListener( IStorageListener* pListener, + void addStorageListener( IStorageListener* pListener, const OUString& sPath ); /** @short TODO */ - virtual void removeStorageListener( IStorageListener* pListener, + void removeStorageListener( IStorageListener* pListener, const OUString& sPath ); /** @short TODO */ - virtual OUString getPathOfStorage(const css::uno::Reference< css::embed::XStorage >& xStorage); + OUString getPathOfStorage(const css::uno::Reference< css::embed::XStorage >& xStorage); /** @short TODO */ - virtual css::uno::Reference< css::embed::XStorage > getParentStorage(const css::uno::Reference< css::embed::XStorage >& xChild); + css::uno::Reference< css::embed::XStorage > getParentStorage(const css::uno::Reference< css::embed::XStorage >& xChild); /** @short TODO */ - virtual css::uno::Reference< css::embed::XStorage > getParentStorage(const OUString& sChildPath); + css::uno::Reference< css::embed::XStorage > getParentStorage(const OUString& sChildPath); /** @short TODO */ diff --git a/framework/source/inc/loadenv/actionlockguard.hxx b/framework/source/inc/loadenv/actionlockguard.hxx index b60aa0a8c8e7..caa70314a7e6 100644 --- a/framework/source/inc/loadenv/actionlockguard.hxx +++ b/framework/source/inc/loadenv/actionlockguard.hxx @@ -91,7 +91,7 @@ class ActionLockGuard @return sal_True, if new resource could be set and locked. sal_False otherwise. */ - virtual bool setResource(const css::uno::Reference< css::document::XActionLockable >& xLock) + bool setResource(const css::uno::Reference< css::document::XActionLockable >& xLock) { osl::MutexGuard g(m_mutex); @@ -116,7 +116,7 @@ class ActionLockGuard @return sal_True, if new resource could be set and locked. sal_False otherwise. */ - virtual void freeResource() + void freeResource() { // SAFE -> .......................... osl::ClearableMutexGuard aMutexLock(m_mutex); @@ -135,7 +135,7 @@ class ActionLockGuard } /** @short lock the internal wrapped resource, if its not already done. */ - virtual void lock() + void lock() { osl::MutexGuard g(m_mutex); if (!m_bActionLocked && m_xActionLock.is()) @@ -146,7 +146,7 @@ class ActionLockGuard } /** @short unlock the internal wrapped resource, if its not already done. */ - virtual void unlock() + void unlock() { osl::MutexGuard g(m_mutex); if (m_bActionLocked && m_xActionLock.is()) diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx index 4558cc7175f2..41b2c55d8124 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -81,27 +81,6 @@ class LangSelectionStatusbarController: public: explicit LangSelectionStatusbarController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException) - { - return OUString("com.sun.star.comp.framework.LangSelectionStatusbarController"); - } - - virtual bool SAL_CALL supportsService(OUString const & ServiceName) - throw (css::uno::RuntimeException) - { - return ServiceName == "com.sun.star.frame.StatusbarController"; - } - - virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() - throw (css::uno::RuntimeException) - { - css::uno::Sequence< OUString > aSeq(1); - aSeq[0] = "com.sun.star.frame.StatusbarController"; - return aSeq; - } - // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index b83e31cf1bbe..2a7a19ce9942 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -112,7 +112,7 @@ class ConfigurationAccess_UICommand : // Order is necessary for right initializa virtual void SAL_CALL disposing( const EventObject& aEvent ) throw(RuntimeException, std::exception) SAL_OVERRIDE; protected: - virtual ::com::sun::star::uno::Any SAL_CALL getByNameImpl( const OUString& aName ); + ::com::sun::star::uno::Any SAL_CALL getByNameImpl( const OUString& aName ); struct CmdToInfoMap { -- cgit