summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 13:07:19 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 22:14:26 +0100
commite71e5ff29980e1f2274e6a6e6bd1334cdc0bab29 (patch)
tree5a478d3bb8c748af26094f2119eb6e8dfb09b057
parent812aef9e3893a4de15fad0fca1ed6bf1fa17836a (diff)
flatten scope
Change-Id: Ia77518c6fa3d651f7026aedd68f81e160ea193a0
-rw-r--r--sw/source/core/unocore/unotbl.cxx47
1 files changed, 23 insertions, 24 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 44a407a97d82..4e5be40a0cdb 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -929,32 +929,31 @@ OUString SwXCell::getFormula(void) throw( uno::RuntimeException, std::exception
void SwXCell::setFormula(const OUString& rFormula) throw( uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
- if(IsValid())
+ if(!IsValid())
+ return;
+ // first this text (maybe) needs to be deleted
+ sal_uInt32 nNdPos = pBox->IsValidNumTxtNd( true );
+ if(USHRT_MAX == nNdPos)
+ sw_setString( *this, OUString(), true );
+ OUString sFml(comphelper::string::stripStart(rFormula, ' '));
+ if( !sFml.isEmpty() && '=' == sFml[0] )
+ sFml = sFml.copy( 1 );
+ SwTblBoxFormula aFml( sFml );
+ SwDoc* pMyDoc = GetDoc();
+ UnoActionContext aAction(pMyDoc);
+ SfxItemSet aSet(pMyDoc->GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMULA);
+ const SfxPoolItem* pItem;
+ SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ if(SfxItemState::SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, true, &pItem)
+ || pMyDoc->GetNumberFormatter()->IsTextFormat(static_cast<const SwTblBoxNumFormat*>(pItem)->GetValue()))
{
- // first this text (maybe) needs to be deleted
- sal_uInt32 nNdPos = pBox->IsValidNumTxtNd( true );
- if(USHRT_MAX == nNdPos)
- sw_setString( *this, OUString(), true );
- OUString sFml(comphelper::string::stripStart(rFormula, ' '));
- if( !sFml.isEmpty() && '=' == sFml[0] )
- sFml = sFml.copy( 1 );
- SwTblBoxFormula aFml( sFml );
- SwDoc* pMyDoc = GetDoc();
- UnoActionContext aAction(pMyDoc);
- SfxItemSet aSet(pMyDoc->GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMULA);
- const SfxPoolItem* pItem;
- SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
- if(SfxItemState::SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, true, &pItem)
- || pMyDoc->GetNumberFormatter()->IsTextFormat(static_cast<const SwTblBoxNumFormat*>(pItem)->GetValue()))
- {
- aSet.Put(SwTblBoxNumFormat(0));
- }
- aSet.Put(aFml);
- GetDoc()->SetTblBoxFormulaAttrs( *pBox, aSet );
- // update table
- SwTableFmlUpdate aTblUpdate( SwTable::FindTable( GetFrmFmt() ));
- pMyDoc->getIDocumentFieldsAccess().UpdateTblFlds( &aTblUpdate );
+ aSet.Put(SwTblBoxNumFormat(0));
}
+ aSet.Put(aFml);
+ GetDoc()->SetTblBoxFormulaAttrs( *pBox, aSet );
+ // update table
+ SwTableFmlUpdate aTblUpdate( SwTable::FindTable( GetFrmFmt() ));
+ pMyDoc->getIDocumentFieldsAccess().UpdateTblFlds( &aTblUpdate );
}
double SwXCell::getValue(void) throw( uno::RuntimeException, std::exception )