From cf25dad00c68e0c753b060737ba0eeab971f970f Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Wed, 23 Dec 2015 19:57:53 +0100 Subject: refactor SwXStyle::isUserDefined/isInUse Change-Id: I67d8408d410698f0f31738fcc30321c627307c73 --- sw/source/core/unocore/unostyle.cxx | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'sw/source/core/unocore') diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 16313afe6dd3..9b8d860dc4bc 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1217,34 +1217,22 @@ void SwXStyle::setName(const OUString& rName) throw( uno::RuntimeException, std: sal_Bool SwXStyle::isUserDefined() throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - bool bRet = false; - if(m_pBasePool) - { - m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); - //if it is not found it must be non user defined - if(pBase) - bRet = pBase->IsUserDefined(); - } - else + if(!m_pBasePool) throw uno::RuntimeException(); - return bRet; + m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + //if it is not found it must be non user defined + return pBase && pBase->IsUserDefined(); } sal_Bool SwXStyle::isInUse() throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - bool bRet = false; - if(m_pBasePool) - { - m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, SFXSTYLEBIT_USED); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); - if(pBase) - bRet = pBase->IsUsed(); - } - else + if(!m_pBasePool) throw uno::RuntimeException(); - return bRet; + m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, SFXSTYLEBIT_USED); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + return pBase && pBase->IsUsed(); } OUString SwXStyle::getParentStyle() throw( uno::RuntimeException, std::exception ) -- cgit v1.2.3