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-29 10:36:54 +0100 |
commit | 9c852dd419bc3b30e1e4ed69be3ba8132b4f2e65 (patch) | |
tree | eacba077147405ef618cdcba4036a21470d1934c /sw/source/core/unocore/unostyle.cxx | |
parent | 71a7e566397773765e2c80a2944d194861cf7e45 (diff) |
make GetCountOrName a private member to reduce args
Change-Id: I72430f032d032f825034ec00d662ceaaa6a4dc62
Diffstat (limited to 'sw/source/core/unocore/unostyle.cxx')
-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(); |