summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 16:32:25 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 22:14:31 +0100
commite2b58f2f586dd33229a53795159a11d8691f633f (patch)
treec317817f4b3f06857649eae0eb7c41cf0ecc541b
parenta1eeefa5c173332122a67fdcc0be070fb8f888c1 (diff)
flatten and simplify
Change-Id: I1dd846e27d15bb959ec65c90abfb33ab43788739
-rw-r--r--sw/source/core/unocore/unotbl.cxx86
1 files changed, 39 insertions, 47 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 2342be79ec30..5173b7666d89 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1812,59 +1812,51 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
std::exception)
{
SolarMutexGuard aGuard;
- uno::Any aRet;
SwUnoCrsr* pUnoCrsr = GetCrsr();
- if(pUnoCrsr)
+ if(!pUnoCrsr)
+ return uno::Any();
{
- SwStartNode* pSttNode = pUnoCrsr->GetNode().StartOfSectionNode();
+ auto 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)
+ lcl_FormatTable(pTblNode->GetTable().GetFrmFmt());
+ }
+ SwUnoTableCrsr& rTblCrsr = dynamic_cast<SwUnoTableCrsr&>(*pUnoCrsr);
+ auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName));
+ if(!pEntry)
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ rTblCrsr.MakeBoxSels();
+ uno::Any aResult;
+ switch(pEntry->nWID)
+ {
+ case FN_UNO_TABLE_CELL_BACKGROUND:
{
- rTblCrsr.MakeBoxSels();
- switch(pEntry->nWID )
- {
- case FN_UNO_TABLE_CELL_BACKGROUND:
- {
- SvxBrushItem aBrush( RES_BACKGROUND );
- if (rTblCrsr.GetDoc()->GetBoxAttr( *pUnoCrsr, aBrush ))
- aBrush.QueryValue(aRet, pEntry->nMemberId);
-
- }
- break;
- case RES_BOXATR_FORMAT:
- // TODO: GetAttr for table selections in a Doc is missing
- OSL_FAIL("not implemented");
- break;
- case FN_UNO_PARA_STYLE:
- {
- SwFmtColl *const pFmt =
- SwUnoCursorHelper::GetCurTxtFmtColl(*pUnoCrsr, false);
- OUString sRet;
- if(pFmt)
- sRet = pFmt->GetName();
- aRet <<= sRet;
- }
- break;
- default:
- {
- SfxItemSet aSet(rTblCrsr.GetDoc()->GetAttrPool(),
- RES_CHRATR_BEGIN, RES_FRMATR_END -1,
- RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
- 0L);
- SwUnoCursorHelper::GetCrsrAttr(rTblCrsr.GetSelRing(),
- aSet);
- m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
- }
- }
+ SvxBrushItem aBrush(RES_BACKGROUND);
+ if (rTblCrsr.GetDoc()->GetBoxAttr(*pUnoCrsr, aBrush))
+ aBrush.QueryValue(aResult, pEntry->nMemberId);
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ // TODO: GetAttr for table selections in a Doc is missing
+ throw uno::RuntimeException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ break;
+ case FN_UNO_PARA_STYLE:
+ {
+ auto pFmt(SwUnoCursorHelper::GetCurTxtFmtColl(*pUnoCrsr, false));
+ if(pFmt)
+ aResult = uno::makeAny(pFmt->GetName());
+ }
+ break;
+ default:
+ {
+ SfxItemSet aSet(rTblCrsr.GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END-1,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ 0L);
+ SwUnoCursorHelper::GetCrsrAttr(rTblCrsr.GetSelRing(), aSet);
+ m_pPropSet->getPropertyValue(*pEntry, aSet, aResult);
}
- else
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
}
- return aRet;
+ return aResult;
}
void SwXTextTableCursor::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )