summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-03-21 19:12:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-22 11:47:36 +0100
commit8ef4dc07cd4413253b5747dd714fadd548d6bcf6 (patch)
treead51fde4a825d0a918a87719ef3a5e55d6ba50cb /svl
parente136900e7a971385be9367a3dcaedea54d1e7207 (diff)
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/qa/unit/svl.cxx8
-rw-r--r--svl/source/config/asiancfg.cxx11
-rw-r--r--svl/source/items/itemprop.cxx9
-rw-r--r--svl/source/numbers/zforlist.cxx9
4 files changed, 23 insertions, 14 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 118016de3b68..3f3f092a5d18 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1827,7 +1827,7 @@ void Test::testUserDefinedNumberFormats()
void Test::testNfEnglishKeywordsIntegrity()
{
SvNumberFormatter aFormatter(m_xContext, LANGUAGE_ENGLISH_US);
- const NfKeywordTable& rEnglishKeywords = aFormatter.GetEnglishKeywords();
+ const NfKeywordTable& rEnglishKeywords = SvNumberFormatter::GetEnglishKeywords();
const NfKeywordTable& sKeywords = aFormatter.GetKeywords(0);
CPPUNIT_ASSERT_EQUAL( size_t(NF_KEYWORD_ENTRIES_COUNT), rEnglishKeywords.size() );
for (size_t i = 0; i < size_t(NF_KEYWORD_ENTRIES_COUNT); ++i)
@@ -1892,8 +1892,8 @@ void Test::testNfEnglishKeywordsIntegrity()
void Test::testStandardColorIntegrity()
{
SvNumberFormatter aFormatter(m_xContext, LANGUAGE_ENGLISH_US);
- const ::std::vector<Color> & rStandardColors = aFormatter.GetStandardColors();
- const size_t nMaxDefaultColors = aFormatter.GetMaxDefaultColors();
+ const ::std::vector<Color> & rStandardColors = SvNumberFormatter::GetStandardColors();
+ const size_t nMaxDefaultColors = SvNumberFormatter::GetMaxDefaultColors();
CPPUNIT_ASSERT_EQUAL( size_t(NF_KEY_LASTCOLOR) - size_t(NF_KEY_FIRSTCOLOR) + 1, nMaxDefaultColors );
CPPUNIT_ASSERT_EQUAL( nMaxDefaultColors, rStandardColors.size() );
// Colors must follow same order as in sEnglishKeyword
@@ -1912,7 +1912,7 @@ void Test::testStandardColorIntegrity()
void Test::testColorNamesConversion()
{
SvNumberFormatter aFormatter(m_xContext, LANGUAGE_GERMAN);
- const NfKeywordTable& rEnglishKeywords = aFormatter.GetEnglishKeywords();
+ const NfKeywordTable& rEnglishKeywords = SvNumberFormatter::GetEnglishKeywords();
const NfKeywordTable& rKeywords = aFormatter.GetKeywords(0);
// Holding a reference to the NfKeywordTable doesn't help if we switch
diff --git a/svl/source/config/asiancfg.cxx b/svl/source/config/asiancfg.cxx
index a8f4e08e519d..d1515f6e76f7 100644
--- a/svl/source/config/asiancfg.cxx
+++ b/svl/source/config/asiancfg.cxx
@@ -71,7 +71,8 @@ void SvxAsianConfig::Commit() {
impl_->batch->commit();
}
-bool SvxAsianConfig::IsKerningWesternTextOnly() const {
+// static
+bool SvxAsianConfig::IsKerningWesternTextOnly() {
return
officecfg::Office::Common::AsianLayout::IsKerningWesternTextOnly::get();
}
@@ -81,7 +82,8 @@ void SvxAsianConfig::SetKerningWesternTextOnly(bool value) {
value, impl_->batch);
}
-CharCompressType SvxAsianConfig::GetCharDistanceCompression() const {
+// static
+CharCompressType SvxAsianConfig::GetCharDistanceCompression() {
return static_cast<CharCompressType>(officecfg::Office::Common::AsianLayout::CompressCharacterDistance::get());
}
@@ -90,8 +92,8 @@ void SvxAsianConfig::SetCharDistanceCompression(CharCompressType value) {
static_cast<sal_uInt16>(value), impl_->batch);
}
+// static
css::uno::Sequence< css::lang::Locale > SvxAsianConfig::GetStartEndCharLocales()
- const
{
const css::uno::Sequence< OUString > ns(
officecfg::Office::Common::AsianLayout::StartEndCharacters::get()->
@@ -103,9 +105,10 @@ css::uno::Sequence< css::lang::Locale > SvxAsianConfig::GetStartEndCharLocales()
return ls;
}
+// static
bool SvxAsianConfig::GetStartEndChars(
css::lang::Locale const & locale, OUString & startChars,
- OUString & endChars) const
+ OUString & endChars)
{
css::uno::Reference< css::container::XNameAccess > set(
officecfg::Office::Common::AsianLayout::StartEndCharacters::get());
diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx
index 8478eaadc98a..9595ce62ea55 100644
--- a/svl/source/items/itemprop.cxx
+++ b/svl/source/items/itemprop.cxx
@@ -113,8 +113,9 @@ SfxItemPropertySet::~SfxItemPropertySet()
{
}
+// static
void SfxItemPropertySet::getPropertyValue( const SfxItemPropertyMapEntry& rEntry,
- const SfxItemSet& rSet, Any& rAny ) const
+ const SfxItemSet& rSet, Any& rAny )
{
// get the SfxPoolItem
const SfxPoolItem* pItem = nullptr;
@@ -159,9 +160,10 @@ Any SfxItemPropertySet::getPropertyValue( const OUString &rName,
return aVal;
}
+// static
void SfxItemPropertySet::setPropertyValue( const SfxItemPropertyMapEntry& rEntry,
const Any& aVal,
- SfxItemSet& rSet ) const
+ SfxItemSet& rSet )
{
// get the SfxPoolItem
const SfxPoolItem* pItem = nullptr;
@@ -196,7 +198,8 @@ void SfxItemPropertySet::setPropertyValue( const OUString &rName,
setPropertyValue(*pEntry, aVal, rSet);
}
-PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertyMapEntry& rEntry, const SfxItemSet& rSet) const
+// static
+PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertyMapEntry& rEntry, const SfxItemSet& rSet)
noexcept
{
PropertyState eRet = PropertyState_DIRECT_VALUE;
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index b4ef00d2a96c..ace560bad560 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -4917,17 +4917,20 @@ const NfKeywordTable & SvNumberFormatter::GetKeywords( sal_uInt32 nKey )
return pFormatScanner->GetKeywords();
}
-const NfKeywordTable & SvNumberFormatter::GetEnglishKeywords() const
+// static
+const NfKeywordTable & SvNumberFormatter::GetEnglishKeywords()
{
return ImpSvNumberformatScan::GetEnglishKeywords();
}
-const std::vector<Color> & SvNumberFormatter::GetStandardColors() const
+// static
+const std::vector<Color> & SvNumberFormatter::GetStandardColors()
{
return ImpSvNumberformatScan::GetStandardColors();
}
-size_t SvNumberFormatter::GetMaxDefaultColors() const
+// static
+size_t SvNumberFormatter::GetMaxDefaultColors()
{
return ImpSvNumberformatScan::GetMaxDefaultColors();
}