From 6afc83865f77e572e9a04cc298ca5b0eab85af62 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Sat, 28 Nov 2015 02:58:37 +0100 Subject: clean up and reduce indent levels Change-Id: Idfc5ea5acf7f09046c92aa37ff01df29147cd738 --- sw/source/core/unocore/unostyle.cxx | 42 +++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'sw/source/core') diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 2b321f4324e8..cebbdeeceb84 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -689,33 +689,29 @@ void SwXStyleFamily::replaceByName(const OUString& rName, const uno::Any& rEleme throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - if(m_pBasePool) + if(!m_pBasePool) + throw uno::RuntimeException(); + m_pBasePool->SetSearchMask(m_eFamily); + SfxStyleSheetBase* pBase = m_pBasePool->Find(rName); + // replacements only for userdefined styles + if(!pBase) + throw container::NoSuchElementException(); + if(!pBase->IsUserDefined()) + throw lang::IllegalArgumentException(); + //if theres an object available to this style then it must be invalidated + uno::Reference xStyle = _FindStyle(pBase->GetName()); + if(xStyle.is()) { - m_pBasePool->SetSearchMask(m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(rName); - // replacements only for userdefined styles - if(!pBase) - throw container::NoSuchElementException(); - if(!pBase->IsUserDefined()) - throw lang::IllegalArgumentException(); - //if theres an object available to this style then it must be invalidated - uno::Reference< style::XStyle > xStyle = _FindStyle(pBase->GetName()); - if(xStyle.is()) + uno::Reference xTunnel( xStyle, uno::UNO_QUERY); + if(xTunnel.is()) { - uno::Reference xTunnel( xStyle, uno::UNO_QUERY); - if(xTunnel.is()) - { - SwXStyle* pStyle = reinterpret_cast< SwXStyle * >( - sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( SwXStyle::getUnoTunnelId()) )); - pStyle->Invalidate(); - } + SwXStyle* pStyle = reinterpret_cast< SwXStyle * >( + sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( SwXStyle::getUnoTunnelId()) )); + pStyle->Invalidate(); } - - m_pBasePool->Remove(pBase); - insertByName(rName, rElement); } - else - throw uno::RuntimeException(); + m_pBasePool->Remove(pBase); + insertByName(rName, rElement); } void SwXStyleFamily::removeByName(const OUString& rName) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) -- cgit v1.2.3