diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-11-28 04:36:50 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-11-28 23:59:23 +0100 |
commit | 88b9f4241f4718061bf6d97a19c3aca0d4bd5fa6 (patch) | |
tree | 7a8efc6ac2254652fffffdbf00c2ce06fcb6294b | |
parent | consolidate range voodoo (diff) | |
download | core-88b9f4241f4718061bf6d97a19c3aca0d4bd5fa6.tar.gz core-88b9f4241f4718061bf6d97a19c3aca0d4bd5fa6.zip |
make GetCountOrName a private member to reduce args
Change-Id: I72430f032d032f825034ec00d662ceaaa6a4dc62
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 86b18197cd29..715921030c11 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -145,6 +145,8 @@ namespace sw SwDocShell* m_pDocShell; SwXStyle* _FindStyle(const OUString& rStyleName) const; + sal_Int32 GetCountOrName(OUString* pString, sal_Int32 nIndex = SAL_MAX_INT32); + public: XStyleFamily(SwDocShell* pDocShell, const SfxStyleFamily eFamily) : m_eFamily(eFamily) @@ -157,7 +159,11 @@ namespace sw virtual ~XStyleFamily() {}; //XIndexAccess - virtual sal_Int32 SAL_CALL getCount() throw( uno::RuntimeException, std::exception ) override; + virtual sal_Int32 SAL_CALL getCount() throw( uno::RuntimeException, std::exception ) override + { + SolarMutexGuard aGuard; + return GetCountOrName(nullptr); + }; virtual uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) override; //XElementAccess @@ -496,9 +502,10 @@ sal_Int32 lcl_GetCountOrNameImpl<SFX_STYLE_FAMILY_PSEUDO>(const SwDoc& rDoc, OUS return nCount + nBaseCount; } -static sal_Int32 lcl_GetCountOrName(const SwDoc& rDoc, SfxStyleFamily eFamily, OUString* pString, sal_Int32 nIndex = SAL_MAX_INT32) +sal_Int32 XStyleFamily::GetCountOrName(OUString* pString, sal_Int32 nIndex) { - switch(eFamily) + const auto& rDoc = *m_pDocShell->GetDoc(); + switch(m_eFamily) { case SFX_STYLE_FAMILY_CHAR: return lcl_GetCountOrNameImpl<SFX_STYLE_FAMILY_CHAR>(rDoc, pString, nIndex); @@ -515,12 +522,6 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc& rDoc, SfxStyleFamily eFamily, O } } -sal_Int32 XStyleFamily::getCount() throw( uno::RuntimeException, std::exception ) -{ - SolarMutexGuard aGuard; - return lcl_GetCountOrName(*m_pDocShell->GetDoc(), m_eFamily, nullptr); -} - uno::Any XStyleFamily::getByIndex(sal_Int32 nIndex) throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) { @@ -583,7 +584,7 @@ uno::Any XStyleFamily::getByIndex(sal_Int32 nIndex) ; } if (sStyleName.isEmpty()) - lcl_GetCountOrName(*m_pDocShell->GetDoc(), m_eFamily, &sStyleName, nIndex); + GetCountOrName(&sStyleName, nIndex); if(sStyleName.isEmpty()) throw lang::IndexOutOfBoundsException(); |