From 8ef4dc07cd4413253b5747dd714fadd548d6bcf6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 21 Mar 2024 19:12:56 +0200 Subject: improve loplugin:staticmethods Some of the exclusions were too aggressive. Restrict them to only the important classes, which exposes some more places this plugin applies. Change-Id: I1b2d1fb24391adc71ed0984f94168f61a149479f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165154 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/framework/titlehelper.hxx | 10 +++++----- include/svl/asiancfg.hxx | 10 +++++----- include/svl/inethist.hxx | 2 +- include/svl/itemprop.hxx | 12 ++++++------ include/svl/numformat.hxx | 6 +++--- include/unotools/fontcfg.hxx | 12 ++++++------ include/unotools/localedatawrapper.hxx | 2 +- include/unotools/textsearch.hxx | 2 +- 8 files changed, 28 insertions(+), 28 deletions(-) (limited to 'include') diff --git a/include/framework/titlehelper.hxx b/include/framework/titlehelper.hxx index b0afc7c77b75..064bfe8cc7b7 100644 --- a/include/framework/titlehelper.hxx +++ b/include/framework/titlehelper.hxx @@ -132,16 +132,16 @@ class UNLESS_MERGELIBS_MORE(FWK_DLLPUBLIC) TitleHelper final : private ::cppu::B void impl_startListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame); void impl_updateListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame); - void impl_appendComponentTitle ( OUStringBuffer& sTitle , + static void impl_appendComponentTitle ( OUStringBuffer& sTitle , const css::uno::Reference< css::uno::XInterface >& xComponent); - void impl_appendProductName (OUStringBuffer& sTitle); + static void impl_appendProductName (OUStringBuffer& sTitle); void impl_appendModuleName (OUStringBuffer& sTitle); - void impl_appendDebugVersion (OUStringBuffer& sTitle); - void impl_appendSafeMode (OUStringBuffer& sTitle); + static void impl_appendDebugVersion (OUStringBuffer& sTitle); + static void impl_appendSafeMode (OUStringBuffer& sTitle); void impl_setSubTitle (const css::uno::Reference< css::frame::XTitle >& xSubTitle); - OUString impl_convertURL2Title(std::u16string_view sURL); + static OUString impl_convertURL2Title(std::u16string_view sURL); // member diff --git a/include/svl/asiancfg.hxx b/include/svl/asiancfg.hxx index 6ee88fe3575f..1385560bd062 100644 --- a/include/svl/asiancfg.hxx +++ b/include/svl/asiancfg.hxx @@ -49,19 +49,19 @@ public: void Commit(); - bool IsKerningWesternTextOnly() const; + static bool IsKerningWesternTextOnly(); void SetKerningWesternTextOnly(bool value); - CharCompressType GetCharDistanceCompression() const; + static CharCompressType GetCharDistanceCompression(); void SetCharDistanceCompression(CharCompressType value); - css::uno::Sequence< css::lang::Locale > GetStartEndCharLocales() const; + static css::uno::Sequence< css::lang::Locale > GetStartEndCharLocales(); - bool GetStartEndChars( + static bool GetStartEndChars( css::lang::Locale const & locale, OUString & startChars, - OUString & endChars) const; + OUString & endChars); void SetStartEndChars( css::lang::Locale const & locale, diff --git a/include/svl/inethist.hxx b/include/svl/inethist.hxx index 9f88fd84baa7..a04a907d4beb 100644 --- a/include/svl/inethist.hxx +++ b/include/svl/inethist.hxx @@ -56,7 +56,7 @@ public: /** QueryProtocol. */ - bool QueryProtocol (INetProtocol eProto) const + static bool QueryProtocol (INetProtocol eProto) { return ((eProto == INetProtocol::File ) || (eProto == INetProtocol::Ftp ) || diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx index 219b04e69a20..f3db2f2eb6d9 100644 --- a/include/svl/itemprop.hxx +++ b/include/svl/itemprop.hxx @@ -105,9 +105,9 @@ public: ~SfxItemPropertySet(); /// @throws css::uno::RuntimeException - void getPropertyValue( const SfxItemPropertyMapEntry& rEntry, + static void getPropertyValue( const SfxItemPropertyMapEntry& rEntry, const SfxItemSet& rSet, - css::uno::Any& rAny) const; + css::uno::Any& rAny); /// @throws css::uno::RuntimeException /// @throws css::beans::UnknownPropertyException void getPropertyValue( const OUString &rName, @@ -120,9 +120,9 @@ public: const SfxItemSet& rSet ) const; /// @throws css::uno::RuntimeException /// @throws css::lang::IllegalArgumentException - void setPropertyValue( const SfxItemPropertyMapEntry& rEntry, + static void setPropertyValue( const SfxItemPropertyMapEntry& rEntry, const css::uno::Any& aVal, - SfxItemSet& rSet ) const; + SfxItemSet& rSet ); /// @throws css::uno::RuntimeException /// @throws css::lang::IllegalArgumentException /// @throws css::beans::UnknownPropertyException @@ -133,8 +133,8 @@ public: /// @throws css::beans::UnknownPropertyException css::beans::PropertyState getPropertyState(const OUString& rName, const SfxItemSet& rSet)const; - css::beans::PropertyState - getPropertyState(const SfxItemPropertyMapEntry& rEntry, const SfxItemSet& rSet) const + static css::beans::PropertyState + getPropertyState(const SfxItemPropertyMapEntry& rEntry, const SfxItemSet& rSet) noexcept; css::uno::Reference const & diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx index 2ebed94959cc..47e85cd0fa5a 100644 --- a/include/svl/numformat.hxx +++ b/include/svl/numformat.hxx @@ -546,13 +546,13 @@ public: const NfKeywordTable& GetKeywords(sal_uInt32 nKey); /** Access for unit tests. */ - const NfKeywordTable& GetEnglishKeywords() const; + static const NfKeywordTable& GetEnglishKeywords(); /** Access for unit tests. */ - const std::vector& GetStandardColors() const; + static const std::vector& GetStandardColors(); /** Access for unit tests. */ - size_t GetMaxDefaultColors() const; + static size_t GetMaxDefaultColors(); struct InputScannerPrivateAccess { diff --git a/include/unotools/fontcfg.hxx b/include/unotools/fontcfg.hxx index 1f77d484531a..db7aa0f263d2 100644 --- a/include/unotools/fontcfg.hxx +++ b/include/unotools/fontcfg.hxx @@ -160,12 +160,12 @@ private: void fillSubstVector( const css::uno::Reference< css::container::XNameAccess >& rFont, const OUString& rType, std::vector< OUString >& rSubstVector ) const; - FontWeight getSubstWeight( const css::uno::Reference< css::container::XNameAccess >& rFont, - const OUString& rType ) const; - FontWidth getSubstWidth( const css::uno::Reference< css::container::XNameAccess >& rFont, - const OUString& rType ) const; - ImplFontAttrs getSubstType( const css::uno::Reference< css::container::XNameAccess >& rFont, - const OUString& rType ) const; + static FontWeight getSubstWeight( const css::uno::Reference< css::container::XNameAccess >& rFont, + const OUString& rType ); + static FontWidth getSubstWidth( const css::uno::Reference< css::container::XNameAccess >& rFont, + const OUString& rType ); + static ImplFontAttrs getSubstType( const css::uno::Reference< css::container::XNameAccess >& rFont, + const OUString& rType ); void readLocaleSubst( const OUString& rBcp47 ) const; public: FontSubstConfiguration(); diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx index d6eeb174e735..5c5e170aed02 100644 --- a/include/unotools/localedatawrapper.hxx +++ b/include/unotools/localedatawrapper.hxx @@ -177,7 +177,7 @@ public: static const std::vector< LanguageType > & getInstalledLanguageTypes(); /// maps the LocaleData string to the International enum - MeasurementSystem mapMeasurementStringToEnum( std::u16string_view rMS ) const; + static MeasurementSystem mapMeasurementStringToEnum( std::u16string_view rMS ); /// Convenience method to obtain the default calendar. const std::shared_ptr< css::i18n::Calendar2 >& getDefaultCalendar() const; diff --git a/include/unotools/textsearch.hxx b/include/unotools/textsearch.hxx index b07d7d364801..753534166098 100644 --- a/include/unotools/textsearch.hxx +++ b/include/unotools/textsearch.hxx @@ -208,7 +208,7 @@ public: const css::lang::Locale& rLocale ); /* replace back references in the replace string by the sub expressions from the search result */ - void ReplaceBackReferences( OUString& rReplaceStr, std::u16string_view rStr, const css::util::SearchResult& rResult ) const; + static void ReplaceBackReferences( OUString& rReplaceStr, std::u16string_view rStr, const css::util::SearchResult& rResult ); }; } // namespace utl -- cgit