diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-03-13 17:14:44 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-03-17 23:54:43 +0100 |
commit | 4b4484b6c9c663f4cad46c0421887c6cf9a3b05d (patch) | |
tree | 35da02ef7f411f1e760ca639b20d7ca7961f3c18 | |
parent | c523212ee2ed7cb3865859e502e07edf97d48717 (diff) |
refactor SwXStyle::SetPropertyValues_Impl
- check invariant m_bIsDescriptor outside loop
- OSL_ENSURE -> SAL_WARN_IF
Change-Id: I9250f7242cd9dd42b1d133c45f2ce8568d354982
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 50a033b2eb34..a4577bc1e919 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1880,9 +1880,7 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const } } -void SwXStyle::SetPropertyValues_Impl( - const uno::Sequence< OUString >& rPropertyNames, - const uno::Sequence< uno::Any >& rValues ) +void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNames, const uno::Sequence<uno::Any>& rValues) { if(!m_pDoc) throw uno::RuntimeException(); @@ -1898,12 +1896,13 @@ void SwXStyle::SetPropertyValues_Impl( m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, nSaveMask); - OSL_ENSURE(pBase, "where is the style?"); - if(pBase) - aBaseImpl.setNewBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase))); - else + SAL_WARN_IF(!pBase, "sw.uno", "where is the style?"); + if(!pBase) throw uno::RuntimeException(); + aBaseImpl.setNewBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase))); } + if(!aBaseImpl.getNewBase().is() && !m_bIsDescriptor) + throw uno::RuntimeException(); const OUString* pNames = rPropertyNames.getConstArray(); const uno::Any* pValues = rValues.getConstArray(); @@ -1915,26 +1914,13 @@ void SwXStyle::SetPropertyValues_Impl( if(pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast<cppu::OWeakObject*>(this)); if(aBaseImpl.getNewBase().is()) - { SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl); - } - else if(m_bIsDescriptor) - { - if(!m_pPropertiesImpl->SetProperty(pNames[nProp], pValues[nProp])) - { - throw lang::IllegalArgumentException(); - } - } - else - { - throw uno::RuntimeException(); - } + else if(!m_pPropertiesImpl->SetProperty(pNames[nProp], pValues[nProp])) + throw lang::IllegalArgumentException(); } if(aBaseImpl.HasItemSet()) - { aBaseImpl.getNewBase()->SetItemSet(aBaseImpl.GetItemSet()); - } } void SwXStyle::setPropertyValues( |