Kaydet (Commit) 0729e946 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

clean up and reduce indent levels

Change-Id: If35b67439eee347d15a55e965756466db1cb466c
üst 8f57b3f6
...@@ -644,25 +644,18 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen ...@@ -644,25 +644,18 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen
throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
if(m_pBasePool) if(!m_pBasePool)
{ throw uno::RuntimeException();
OUString sStyleName; OUString sStyleName;
SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( m_eFamily ), true); SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum(m_eFamily), true);
m_pBasePool->SetSearchMask(m_eFamily); m_pBasePool->SetSearchMask(m_eFamily);
SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName); SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName);
SfxStyleSheetBase* pUINameBase = m_pBasePool->Find( sStyleName ); SfxStyleSheetBase* pUINameBase = m_pBasePool->Find( sStyleName );
if(pBase || pUINameBase) if(pBase || pUINameBase)
throw container::ElementExistException(); throw container::ElementExistException();
else if(rElement.getValueType().getTypeClass() != uno::TypeClass_INTERFACE)
{ throw lang::IllegalArgumentException();
if(rElement.getValueType().getTypeClass() == uno::Reference<lang::XUnoTunnel> xStyleTunnel = rElement.get<uno::Reference<lang::XUnoTunnel>>();
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; SwXStyle* pNewStyle = nullptr;
if(xStyleTunnel.is()) if(xStyleTunnel.is())
{ {
...@@ -676,9 +669,6 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen ...@@ -676,9 +669,6 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen
sal_uInt16 nMask = SFXSTYLEBIT_ALL; sal_uInt16 nMask = SFXSTYLEBIT_ALL;
if(m_eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional()) if(m_eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
nMask &= ~SWSTYLEBIT_CONDCOLL; nMask &= ~SWSTYLEBIT_CONDCOLL;
#if OSL_DEBUG_LEVEL > 1
SfxStyleSheetBase& rNewBase =
#endif
m_pBasePool->Make(sStyleName, m_eFamily, nMask); m_pBasePool->Make(sStyleName, m_eFamily, nMask);
pNewStyle->SetDoc(m_pDocShell->GetDoc(), m_pBasePool); pNewStyle->SetDoc(m_pDocShell->GetDoc(), m_pBasePool);
pNewStyle->SetStyleName(sStyleName); pNewStyle->SetStyleName(sStyleName);
...@@ -689,21 +679,10 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen ...@@ -689,21 +679,10 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen
SfxStyleSheetBase* pParentBase = m_pBasePool->Find(sParentStyleName); SfxStyleSheetBase* pParentBase = m_pBasePool->Find(sParentStyleName);
if(pParentBase && pParentBase->GetFamily() == m_eFamily && if(pParentBase && pParentBase->GetFamily() == m_eFamily &&
&pParentBase->GetPool() == m_pBasePool) &pParentBase->GetPool() == m_pBasePool)
m_pBasePool->SetParent( m_eFamily, sStyleName, sParentStyleName ); m_pBasePool->SetParent(m_eFamily, sStyleName, sParentStyleName);
} }
#if OSL_DEBUG_LEVEL > 1
(void)rNewBase;
#endif
// after all, we still need to apply the properties of the descriptor // after all, we still need to apply the properties of the descriptor
pNewStyle->ApplyDescriptorProperties(); pNewStyle->ApplyDescriptorProperties();
}
else
throw lang::IllegalArgumentException();
}
}
else
throw uno::RuntimeException();
} }
void SwXStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement) void SwXStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment