summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 16:17:35 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 22:14:31 +0100
commitc4fcf9100cc1a4ad2dfe7f83bb80b56ba070c0b4 (patch)
treef1ab20a868730055d1223814c4a29c162e4c52a7
parentdcb26ea845f86fdeace62ab3d8450b21c4fb103c (diff)
flatten and simplify
Change-Id: I72d71c035b43fb3786390eb4a146ef379f547e69
-rw-r--r--sw/source/core/unocore/unotbl.cxx89
1 files changed, 42 insertions, 47 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 9af71361df72..b59aa178eecb 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1752,59 +1752,54 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
{
SolarMutexGuard aGuard;
SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr)
+ if(!pUnoCrsr)
+ return;
+ auto pSttNode = pUnoCrsr->GetNode().StartOfSectionNode();
+ const SwTableNode* pTblNode = pSttNode->FindTableNode();
+ lcl_FormatTable(pTblNode->GetTable().GetFrmFmt());
+ auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName));
+ if(!pEntry)
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
+ throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ auto& rTblCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr);
+ rTblCrsr.MakeBoxSels();
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ switch(pEntry->nWID)
{
- SwStartNode* pSttNode = pUnoCrsr->GetNode().StartOfSectionNode();
- const SwTableNode* pTblNode = pSttNode->FindTableNode();
- lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt());
- SwUnoTableCrsr& rTblCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr);
- const SfxItemPropertySimpleEntry* pEntry =
- m_pPropSet->getPropertyMap().getByName(rPropertyName);
- if(pEntry)
+ case FN_UNO_TABLE_CELL_BACKGROUND:
{
- if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
- rTblCrsr.MakeBoxSels();
- SwDoc* pDoc = pUnoCrsr->GetDoc();
- switch(pEntry->nWID )
- {
- case FN_UNO_TABLE_CELL_BACKGROUND:
- {
- SvxBrushItem aBrush( RES_BACKGROUND );
- pDoc->GetBoxAttr( *pUnoCrsr, aBrush );
- aBrush.PutValue(aValue, pEntry->nMemberId);
- pDoc->SetBoxAttr( *pUnoCrsr, aBrush );
+ SvxBrushItem aBrush(RES_BACKGROUND);
+ pDoc->GetBoxAttr(*pUnoCrsr, aBrush);
+ aBrush.PutValue(aValue, pEntry->nMemberId);
+ pDoc->SetBoxAttr(*pUnoCrsr, aBrush);
- }
- break;
- case RES_BOXATR_FORMAT:
- {
- SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
- aNumberFormat.PutValue(aValue, 0);
- pDoc->SetBoxAttr( *pUnoCrsr, aNumberFormat);
- }
- break;
- case FN_UNO_PARA_STYLE:
- SwUnoCursorHelper::SetTxtFmtColl(aValue, *pUnoCrsr);
- break;
- default:
- {
- SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID );
- SwUnoCursorHelper::GetCrsrAttr(rTblCrsr.GetSelRing(),
- aItemSet);
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ {
+ SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
+ aNumberFormat.PutValue(aValue, 0);
+ pDoc->SetBoxAttr(*pUnoCrsr, aNumberFormat);
+ }
+ break;
+ case FN_UNO_PARA_STYLE:
+ SwUnoCursorHelper::SetTxtFmtColl(aValue, *pUnoCrsr);
+ break;
+ default:
+ {
+ SfxItemSet aItemSet(pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID);
+ SwUnoCursorHelper::GetCrsrAttr(rTblCrsr.GetSelRing(),
+ aItemSet);
- if (!SwUnoCursorHelper::SetCursorPropertyValue(
- *pEntry, aValue, rTblCrsr.GetSelRing(), aItemSet))
- {
- m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet);
- }
- SwUnoCursorHelper::SetCrsrAttr(rTblCrsr.GetSelRing(),
- aItemSet, SetAttrMode::DEFAULT, true);
- }
+ if (!SwUnoCursorHelper::SetCursorPropertyValue(
+ *pEntry, aValue, rTblCrsr.GetSelRing(), aItemSet))
+ {
+ m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet);
}
+ SwUnoCursorHelper::SetCrsrAttr(rTblCrsr.GetSelRing(),
+ aItemSet, SetAttrMode::DEFAULT, true);
}
- else
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
}
}