summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore/unostyle.cxx
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-11-28 02:31:32 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-11-29 10:36:48 +0100
commit50c3352ef26bc08bf6df84d1d57e37098c4f5923 (patch)
tree0e3c987f76d768af736b24023c2e669276c66339 /sw/source/core/unocore/unostyle.cxx
parenta96181328df3b775f749316216b5f66fecaafe25 (diff)
clean up and reduce indent levels, remove hugely scoped Any
Change-Id: I2681ddb9b9cba0529ea88c5b81c1f060d1df8eb4
Diffstat (limited to 'sw/source/core/unocore/unostyle.cxx')
-rw-r--r--sw/source/core/unocore/unostyle.cxx47
1 files changed, 19 insertions, 28 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 6fb4d0290ff7..e3f14289c160 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -576,39 +576,30 @@ uno::Any SwXStyleFamily::getByName(const OUString& rName)
throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
- uno::Any aRet;
OUString sStyleName;
- SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( m_eFamily ), true );
- if(m_pBasePool)
+ SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum(m_eFamily), true);
+ if(!m_pBasePool)
+ throw uno::RuntimeException();
+ m_pBasePool->SetSearchMask(m_eFamily);
+ SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName);
+ if(!pBase)
+ throw container::NoSuchElementException();
+ uno::Reference<style::XStyle> xStyle = _FindStyle(sStyleName);
+ if(!xStyle.is())
{
- m_pBasePool->SetSearchMask(m_eFamily);
- SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName);
- if(pBase)
+ switch(m_eFamily)
{
- uno::Reference< style::XStyle > xStyle = _FindStyle(sStyleName);
- if(!xStyle.is())
- {
- switch(m_eFamily)
- {
- case SFX_STYLE_FAMILY_PAGE:
- xStyle = new SwXPageStyle(*m_pBasePool, m_pDocShell, m_eFamily, sStyleName);
- break;
- case SFX_STYLE_FAMILY_FRAME:
- xStyle = new SwXFrameStyle(*m_pBasePool, m_pDocShell->GetDoc(), pBase->GetName());
- break;
- default:
- xStyle = new SwXStyle(*m_pBasePool, m_eFamily, m_pDocShell->GetDoc(), sStyleName);
- }
- }
- aRet.setValue(&xStyle, cppu::UnoType<style::XStyle>::get());
+ case SFX_STYLE_FAMILY_PAGE:
+ xStyle = new SwXPageStyle(*m_pBasePool, m_pDocShell, m_eFamily, sStyleName);
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ xStyle = new SwXFrameStyle(*m_pBasePool, m_pDocShell->GetDoc(), pBase->GetName());
+ break;
+ default:
+ xStyle = new SwXStyle(*m_pBasePool, m_eFamily, m_pDocShell->GetDoc(), sStyleName);
}
- else
- throw container::NoSuchElementException();
}
- else
- throw uno::RuntimeException();
- return aRet;
-
+ return uno::makeAny(xStyle);
}
uno::Sequence< OUString > SwXStyleFamily::getElementNames() throw( uno::RuntimeException, std::exception )