summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-11-28 02:54:53 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-11-29 10:36:49 +0100
commit0729e946388c4cbf3dce2971ccad30290ce66497 (patch)
treeb78b5ca639700fe32d737eab9f95055871372b7d /sw/source/core
parent8f57b3f6bf2c197c1b46caf5556fc90294cff43a (diff)
clean up and reduce indent levels
Change-Id: If35b67439eee347d15a55e965756466db1cb466c
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/unocore/unostyle.cxx91
1 files changed, 35 insertions, 56 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 2f0b67036a09..2b321f4324e8 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -644,66 +644,45 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen
throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
- if(m_pBasePool)
+ if(!m_pBasePool)
+ throw uno::RuntimeException();
+ OUString sStyleName;
+ SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum(m_eFamily), true);
+ m_pBasePool->SetSearchMask(m_eFamily);
+ SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName);
+ SfxStyleSheetBase* pUINameBase = m_pBasePool->Find( sStyleName );
+ if(pBase || pUINameBase)
+ throw container::ElementExistException();
+ if(rElement.getValueType().getTypeClass() != uno::TypeClass_INTERFACE)
+ throw lang::IllegalArgumentException();
+ uno::Reference<lang::XUnoTunnel> xStyleTunnel = rElement.get<uno::Reference<lang::XUnoTunnel>>();
+ SwXStyle* pNewStyle = nullptr;
+ if(xStyleTunnel.is())
{
- OUString sStyleName;
- SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( m_eFamily ), true);
- m_pBasePool->SetSearchMask(m_eFamily);
- SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName);
- SfxStyleSheetBase* pUINameBase = m_pBasePool->Find( sStyleName );
- if(pBase || pUINameBase)
- throw container::ElementExistException();
- else
- {
- if(rElement.getValueType().getTypeClass() ==
- uno::TypeClass_INTERFACE)
- {
- uno::Reference< uno::XInterface > const * pxRef =
- static_cast<uno::Reference< uno::XInterface > const *>(rElement.getValue());
-
- uno::Reference<lang::XUnoTunnel> xStyleTunnel( *pxRef, uno::UNO_QUERY);
-
- SwXStyle* pNewStyle = nullptr;
- if(xStyleTunnel.is())
- {
- pNewStyle = reinterpret_cast< SwXStyle * >(
- sal::static_int_cast< sal_IntPtr >( xStyleTunnel->getSomething( SwXStyle::getUnoTunnelId()) ));
- }
-
- if (!pNewStyle || !pNewStyle->IsDescriptor() || pNewStyle->GetFamily() != m_eFamily)
- throw lang::IllegalArgumentException();
+ pNewStyle = reinterpret_cast< SwXStyle * >(
+ sal::static_int_cast< sal_IntPtr >( xStyleTunnel->getSomething( SwXStyle::getUnoTunnelId()) ));
+ }
- sal_uInt16 nMask = SFXSTYLEBIT_ALL;
- if(m_eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
- nMask &= ~SWSTYLEBIT_CONDCOLL;
-#if OSL_DEBUG_LEVEL > 1
- SfxStyleSheetBase& rNewBase =
-#endif
- m_pBasePool->Make(sStyleName, m_eFamily, nMask);
- pNewStyle->SetDoc(m_pDocShell->GetDoc(), m_pBasePool);
- pNewStyle->SetStyleName(sStyleName);
- const OUString sParentStyleName(pNewStyle->GetParentStyleName());
- if (!sParentStyleName.isEmpty())
- {
- m_pBasePool->SetSearchMask(m_eFamily);
- SfxStyleSheetBase* pParentBase = m_pBasePool->Find(sParentStyleName);
- if(pParentBase && pParentBase->GetFamily() == m_eFamily &&
- &pParentBase->GetPool() == m_pBasePool)
- m_pBasePool->SetParent( m_eFamily, sStyleName, sParentStyleName );
+ if (!pNewStyle || !pNewStyle->IsDescriptor() || pNewStyle->GetFamily() != m_eFamily)
+ throw lang::IllegalArgumentException();
- }
-#if OSL_DEBUG_LEVEL > 1
- (void)rNewBase;
-#endif
- // after all, we still need to apply the properties of the descriptor
- pNewStyle->ApplyDescriptorProperties();
- }
- else
- throw lang::IllegalArgumentException();
- }
+ sal_uInt16 nMask = SFXSTYLEBIT_ALL;
+ if(m_eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
+ nMask &= ~SWSTYLEBIT_CONDCOLL;
+ m_pBasePool->Make(sStyleName, m_eFamily, nMask);
+ pNewStyle->SetDoc(m_pDocShell->GetDoc(), m_pBasePool);
+ pNewStyle->SetStyleName(sStyleName);
+ const OUString sParentStyleName(pNewStyle->GetParentStyleName());
+ if (!sParentStyleName.isEmpty())
+ {
+ m_pBasePool->SetSearchMask(m_eFamily);
+ SfxStyleSheetBase* pParentBase = m_pBasePool->Find(sParentStyleName);
+ if(pParentBase && pParentBase->GetFamily() == m_eFamily &&
+ &pParentBase->GetPool() == m_pBasePool)
+ m_pBasePool->SetParent(m_eFamily, sStyleName, sParentStyleName);
}
- else
- throw uno::RuntimeException();
+ // after all, we still need to apply the properties of the descriptor
+ pNewStyle->ApplyDescriptorProperties();
}
void SwXStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement)