From 98460e7a502e61f8885c6fb960f0f9fa69de4f3e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 8 Nov 2016 10:11:23 +0200 Subject: loplugin:expandablemethods in framework Change-Id: I444f31f06d2445392a59879c2d7fb1f8ad1c24c6 Reviewed-on: https://gerrit.libreoffice.org/30684 Tested-by: Jenkins Reviewed-by: Noel Grandin --- framework/inc/dispatch/popupmenudispatcher.hxx | 1 - framework/inc/helper/oframes.hxx | 54 ++++++---------------- framework/inc/uielement/constitemcontainer.hxx | 1 - framework/inc/uielement/statusbarmanager.hxx | 1 - .../documentacceleratorconfiguration.cxx | 14 +----- framework/source/dispatch/popupmenudispatcher.cxx | 11 +---- .../source/dispatch/windowcommanddispatch.cxx | 5 -- framework/source/fwe/helper/undomanagerhelper.cxx | 7 +-- .../source/fwi/uielement/constitemcontainer.cxx | 9 +--- framework/source/helper/oframes.cxx | 19 ++------ .../source/inc/dispatch/windowcommanddispatch.hxx | 9 +--- framework/source/uielement/statusbarmanager.cxx | 6 +-- 12 files changed, 26 insertions(+), 111 deletions(-) diff --git a/framework/inc/dispatch/popupmenudispatcher.hxx b/framework/inc/dispatch/popupmenudispatcher.hxx index c4dd32b9cedf..3c3d1512e05c 100644 --- a/framework/inc/dispatch/popupmenudispatcher.hxx +++ b/framework/inc/dispatch/popupmenudispatcher.hxx @@ -119,7 +119,6 @@ class PopupMenuDispatcher : public ::cppu::WeakImplHelper< virtual ~PopupMenuDispatcher() override; void impl_RetrievePopupControllerQuery(); - void impl_CreateUriRefFactory(); // variables diff --git a/framework/inc/helper/oframes.hxx b/framework/inc/helper/oframes.hxx index af330aa0822e..1a13ff553b50 100644 --- a/framework/inc/helper/oframes.hxx +++ b/framework/inc/helper/oframes.hxx @@ -34,7 +34,7 @@ namespace framework{ -/* +/** @short implement XFrames, XIndexAccess and XElementAccess interfaces as helper for services @descr Use this class as helper for these interfaces. We share mutex and framecontainer with our owner. The framecontainer is a member of it from type "FrameContainer". That means; @@ -42,22 +42,15 @@ namespace framework{ to prevent against compete access. In future we plan support of semaphore! @devstatus deprecated - @implements XInterface - XFrames - XIndexAccess - XElementAccess - @base OWeakObject - @ATTENTION Don't use this class as direct member - use it dynamicly. Do not derive from this class. + @ATTENTION Don't use this class as direct member - use it dynamically. Do not derive from this class. We hold a weakreference to our owner not to our superclass. - - @devstatus deprecated */ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > { public: - /* + /** @short standard ctor @descr These initialize a new instance of this class with all needed information for work. We share framecontainer with owner implementation! It's a threadsafe container. @@ -69,7 +62,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > // XFrames - /* + /** @short append frame to container @descr We share the container with our owner. We can do this only, if no lock is set on container. Valid references are accepted only! @@ -81,7 +74,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > */ virtual void SAL_CALL append( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException, std::exception ) override; - /* + /** @short remove frame from container @descr This is the companion to append(). We only accept valid references and don't work, if a lock is set. @@ -93,7 +86,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > */ virtual void SAL_CALL remove( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException, std::exception ) override; - /* + /** @short return list of all applicable frames for given flags @descr Call these to get a list of all frames, which are match with given search flags. @param "nSearchFlag", flags to search right frames. @@ -105,7 +98,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > // XIndexAccess - /* + /** @short get count of all current frames in container @descr This is the beginning of full index-access. With a count you can step over all items in container. Next call should be getByIndex(). But these mechanism works only, if no lock in container is set! @@ -118,7 +111,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > */ virtual sal_Int32 SAL_CALL getCount() throw( css::uno::RuntimeException, std::exception ) override; - /* + /** @short get specified container item by index @descr If you called getCount() successful - this method return the specified element as an Any. You must observe the range from 0 to count-1! Otherwise an IndexOutOfBoundsException is thrown. @@ -138,7 +131,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > // XElementAccess - /* + /** @short get uno-type of all container items @descr In current implementation type is fixed to XFrame! (container-lock is ignored) @@ -146,7 +139,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > */ virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException, std::exception ) override; - /* + /** @short get fill state of current container @descr Call these to get information about, if items exist in container or not. (container-lock is ignored) @@ -159,7 +152,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > protected: - /* + /** @short standard destructor @descr This method destruct an instance of this class and clear some member. This method is protected, because it's not allowed to use this class as a member! @@ -167,7 +160,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > */ virtual ~OFrames() override; - /* + /** @short reset instance to default values @descr There are two ways to delete an instance of this class.
1) delete with destructor
@@ -181,7 +174,7 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > private: - /* + /** @short append one sequence to another @descr There is no operation to add to sequences! Use this helper-method to do this. @@ -194,30 +187,9 @@ class OFrames : public ::cppu::WeakImplHelper< css::frame::XFrames > void impl_appendSequence( css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqDestination , const css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqSource ); - // debug methods - // (should be private everyway!) - - /* - @short debug-method to check incoming parameter of some other mehods of this class - @descr The following methods are used to check parameters for other methods - of this class. The return value is used directly for an ASSERT(...). - - @seealso ASSERTs in implementation! - - @param references to checking variables - @return sal_False ,on invalid parameter - @return sal_True ,otherwise - */ - private: - static bool impldbg_checkParameter_OFramesCtor ( const css::uno::Reference< css::frame::XFrame >& xOwner , - FrameContainer* pFrameContainer ); static bool impldbg_checkParameter_queryFrames ( sal_Int32 nSearchFlags ); - // variables - // (should be private everyway!) - - private: css::uno::WeakReference< css::frame::XFrame > m_xOwner; /// reference to owner of this instance (Hold no hard reference!) FrameContainer* m_pFrameContainer; /// with owner shared list to hold all direct children of an XFramesSupplier bool m_bRecursiveSearchProtection; /// flag to protect against recursive searches of frames at parents diff --git a/framework/inc/uielement/constitemcontainer.hxx b/framework/inc/uielement/constitemcontainer.hxx index 5537238cadc8..f9740ae9279b 100644 --- a/framework/inc/uielement/constitemcontainer.hxx +++ b/framework/inc/uielement/constitemcontainer.hxx @@ -96,7 +96,6 @@ class FWI_DLLPUBLIC ConstItemContainer : public ::cppu::WeakImplHelper< private: ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); - static css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo( ::cppu::IPropertyArrayHelper & rProperties ); void copyItemContainer( const std::vector< css::uno::Sequence< css::beans::PropertyValue > >& rSourceVector ); css::uno::Reference< css::container::XIndexAccess > deepCopyContainer( const css::uno::Reference< css::container::XIndexAccess >& rSubContainer ); diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx index 117ddcf48eb9..b8b3485b8f32 100644 --- a/framework/inc/uielement/statusbarmanager.hxx +++ b/framework/inc/uielement/statusbarmanager.hxx @@ -90,7 +90,6 @@ class StatusBarManager : public ::cppu::WeakImplHelper< void RemoveControllers(); void CreateControllers(); void UpdateControllers(); - void AddFrameActionListener(); void MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL css::frame::XStatusbarController::*_pMethod )(const css::awt::MouseEvent&)); protected: diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index 5794c0e9c30e..d9b05459fe85 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -99,12 +99,6 @@ public: /** read all data into the cache. */ void fillCache(); - -private: - - /** forget all currently cached data AND(!) - forget all currently used storages. */ - void clearCache(); }; DocumentAcceleratorConfiguration::DocumentAcceleratorConfiguration( @@ -147,7 +141,8 @@ void SAL_CALL DocumentAcceleratorConfiguration::setStorage(const css::uno::Refer } if (bForgetOldStorages) - clearCache(); + /* forget all currently cached data AND(!) forget all currently used storages. */ + m_aPresetHandler.forgetCachedStorages(); if (xStorage.is()) fillCache(); @@ -200,11 +195,6 @@ void DocumentAcceleratorConfiguration::fillCache() {} } -void DocumentAcceleratorConfiguration::clearCache() -{ - m_aPresetHandler.forgetCachedStorages(); -} - } // namespace framework extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx index 3723f324f77f..c07f0bf26da2 100644 --- a/framework/source/dispatch/popupmenudispatcher.cxx +++ b/framework/source/dispatch/popupmenudispatcher.cxx @@ -171,7 +171,8 @@ throw( css::uno::RuntimeException, std::exception ) // --- SAFE --- SolarMutexClearableGuard aGuard; impl_RetrievePopupControllerQuery(); - impl_CreateUriRefFactory(); + if ( !m_xUriRefFactory.is() ) + m_xUriRefFactory = css::uri::UriReferenceFactory::create( m_xContext ); css::uno::Reference< css::container::XNameAccess > xPopupCtrlQuery( m_xPopupCtrlQuery ); css::uno::Reference< css::uri::XUriReferenceFactory > xUriRefFactory( m_xUriRefFactory ); @@ -337,14 +338,6 @@ void PopupMenuDispatcher::impl_RetrievePopupControllerQuery() } } -void PopupMenuDispatcher::impl_CreateUriRefFactory() -{ - if ( !m_xUriRefFactory.is() ) - { - m_xUriRefFactory = css::uri::UriReferenceFactory::create( m_xContext ); - } -} - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/dispatch/windowcommanddispatch.cxx b/framework/source/dispatch/windowcommanddispatch.cxx index 71ecaa0a5020..bc9e6389d707 100644 --- a/framework/source/dispatch/windowcommanddispatch.cxx +++ b/framework/source/dispatch/windowcommanddispatch.cxx @@ -127,11 +127,6 @@ IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, VclWindowEvent&, rEvent, vo return; } - impl_dispatchCommand(sCommand); -} - -void WindowCommandDispatch::impl_dispatchCommand(const OUString& sCommand) -{ // ignore all errors here. It's clicking a menu entry only ... // The user will try it again, in case nothing happens .-) try diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx index 7efb8bfce4c4..5fb5f6659325 100644 --- a/framework/source/fwe/helper/undomanagerhelper.cxx +++ b/framework/source/fwe/helper/undomanagerhelper.cxx @@ -287,11 +287,6 @@ namespace framework void notify( OUString const& i_title, void ( SAL_CALL XUndoManagerListener::*i_notificationMethod )( const UndoManagerEvent& ) ); - void notify( void ( SAL_CALL XUndoManagerListener::*i_notificationMethod )( const UndoManagerEvent& ) ) - { - notify( OUString(), i_notificationMethod ); - } - void notify( void ( SAL_CALL XUndoManagerListener::*i_notificationMethod )( const EventObject& ) ); private: @@ -825,7 +820,7 @@ namespace framework if ( m_bAPIActionRunning ) return; - notify( &XUndoManagerListener::cancelledContext ); + notify( OUString(), &XUndoManagerListener::cancelledContext ); } void UndoManagerHelper_Impl::undoManagerDying() diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx index ad41b0f15437..9653444f9126 100644 --- a/framework/source/fwi/uielement/constitemcontainer.cxx +++ b/framework/source/fwi/uielement/constitemcontainer.cxx @@ -230,7 +230,7 @@ throw (css::uno::RuntimeException, std::exception) { // Create structure of propertysetinfo for baseclass "OPropertySetHelper". // (Use method "getInfoHelper()".) - static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + static Reference< XPropertySetInfo > xInfo = new ::comphelper::PropertySetInfo(getInfoHelper().getProperties()); pInfo = &xInfo; } } @@ -337,13 +337,6 @@ const css::uno::Sequence< css::beans::Property > ConstItemContainer::impl_getSta return lPropertyDescriptor; } -Reference < XPropertySetInfo > ConstItemContainer::createPropertySetInfo( - IPropertyArrayHelper & rProperties ) -{ - return static_cast( - new ::comphelper::PropertySetInfo(rProperties.getProperties())); -} - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx index 4f96df15f476..f243584b1e97 100644 --- a/framework/source/helper/oframes.cxx +++ b/framework/source/helper/oframes.cxx @@ -42,12 +42,13 @@ OFrames::OFrames( const css::uno::Reference< XFrame >& xOwner , m_pFrameContainer ( pFrameContainer ) , m_bRecursiveSearchProtection( false ) { - // Safe impossible cases - // Method is not defined for ALL incoming parameters! - SAL_WARN_IF( !impldbg_checkParameter_OFramesCtor( xOwner, pFrameContainer ), "fwk", "OFrames::OFrames(): Invalid parameter detected!" ); + // An instance of this class can only work with valid initialization. + // We share the mutex with our owner class, need a valid factory to instanciate new services and + // use the access to our owner for some operations. + SAL_WARN_IF( !xOwner.is() || !pFrameContainer, "fwk", "OFrames::OFrames(): Invalid parameter detected!" ); } -// (proteced!) destructor +// (protected!) destructor OFrames::~OFrames() { @@ -345,16 +346,6 @@ void OFrames::impl_appendSequence( Sequence< css::uno::Reference< XFram But ... look for right testing! See using of this methods! -----------------------------------------------------------------------------------------------------------------*/ -// An instance of this class can only work with valid initialization. -// We share the mutex with our owner class, need a valid factory to instanciate new services and -// use the access to our owner for some operations. -bool OFrames::impldbg_checkParameter_OFramesCtor( const css::uno::Reference< XFrame >& xOwner , - FrameContainer* pFrameContainer ) -{ - return xOwner.is() && pFrameContainer != nullptr; -} - - // A search for frames must initiate with right flags. // Some one are superflous and not supported yet. But here we control only the range of incoming parameter! bool OFrames::impldbg_checkParameter_queryFrames( sal_Int32 nSearchFlags ) diff --git a/framework/source/inc/dispatch/windowcommanddispatch.hxx b/framework/source/inc/dispatch/windowcommanddispatch.hxx index c9cca2c40d90..5ae5dfc41ef6 100644 --- a/framework/source/inc/dispatch/windowcommanddispatch.hxx +++ b/framework/source/inc/dispatch/windowcommanddispatch.hxx @@ -104,14 +104,7 @@ class WindowCommandDispatch final */ DECL_LINK( impl_notifyCommand, VclWindowEvent&, void ); - /** @short dispatch right command URLs into our frame context. - - @param sCommand - the command for dispatch - */ - void impl_dispatchCommand(const OUString& sCommand); - -}; // class MACDispatch +}; // class WindowCommandDispatch } // namespace framework diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index eb4096c18d2e..9b6a86bc42ba 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -388,11 +388,7 @@ void StatusBarManager::CreateControllers() } } - AddFrameActionListener(); -} - -void StatusBarManager::AddFrameActionListener() -{ + // add frame action listeners if ( !m_bFrameActionRegistered && m_xFrame.is() ) { m_bFrameActionRegistered = true; -- cgit