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

flatten and simplify

Change-Id: I7339a7a54dcb6eb3a887416d05f8f78f38aa3c96
üst df384772
...@@ -1049,7 +1049,7 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV ...@@ -1049,7 +1049,7 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
if(rPropertyName == "FRMDirection") if(rPropertyName == "FRMDirection")
{ {
SvxFrameDirection eDir = FRMDIR_ENVIRONMENT; SvxFrameDirection eDir = FRMDIR_ENVIRONMENT;
sal_Int16 nNum = aValue.get<sal_Int16>(nNum); sal_Int32 nNum = aValue.get<sal_Int32>();
SAL_INFO("sw.uno", "FRMDirection val " << nNum); SAL_INFO("sw.uno", "FRMDirection val " << nNum);
switch (nNum) switch (nNum)
{ {
...@@ -1074,16 +1074,15 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV ...@@ -1074,16 +1074,15 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
uno::Sequence<beans::PropertyValue> tableCellProperties; uno::Sequence<beans::PropertyValue> tableCellProperties;
tableCellProperties = aValue.get< uno::Sequence< beans::PropertyValue > >(); tableCellProperties = aValue.get< uno::Sequence< beans::PropertyValue > >();
comphelper::SequenceAsHashMap aPropMap(tableCellProperties); comphelper::SequenceAsHashMap aPropMap(tableCellProperties);
uno::Any sRedlineTypeValue = aPropMap.getUnpackedValueOrDefault("RedlineType", makeAny()); uno::Any sRedlineTypeValue = aPropMap.getUnpackedValueOrDefault("RedlineType", uno::Any());
if(!sRedlineTypeValue.has(OUString)) if(!sRedlineTypeValue.has<OUString>())
throw beans::UnknownPropertyException("No redline type property: ", static_cast < cppu::OWeakObject * > ( this ) ); throw beans::UnknownPropertyException("No redline type property: ", static_cast<cppu::OWeakObject*>(this));
// Create a 'Table Cell Redline' object // Create a 'Table Cell Redline' object
SwUnoCursorHelper::makeTableCellRedline(*pBox, sRedlineTypeValue.get<OUString(), tableCellProperties); SwUnoCursorHelper::makeTableCellRedline(*pBox, sRedlineTypeValue.get<OUString>(), tableCellProperties);
} }
else else
{ {
const SfxItemPropertySimpleEntry* pEntry = auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName));
m_pPropSet->getPropertyMap().getByName(rPropertyName);
if(!pEntry) if(!pEntry)
{ {
beans::UnknownPropertyException aEx; beans::UnknownPropertyException aEx;
...@@ -1110,56 +1109,50 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName) ...@@ -1110,56 +1109,50 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
uno::Any aRet; if(!IsValid())
if(IsValid()) return uno::Any();
{ auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName));
const SfxItemPropertySimpleEntry* pEntry = if(!pEntry)
m_pPropSet->getPropertyMap().getByName(rPropertyName);
if( !pEntry )
{ {
beans::UnknownPropertyException aEx; beans::UnknownPropertyException aEx;
aEx.Message = rPropertyName; aEx.Message = rPropertyName;
throw( aEx ); throw(aEx);
} }
switch( pEntry->nWID ) switch(pEntry->nWID)
{ {
case FN_UNO_CELL_ROW_SPAN: case FN_UNO_CELL_ROW_SPAN:
aRet <<= pBox->getRowSpan(); return uno::makeAny(pBox->getRowSpan());
break; break;
case FN_UNO_TEXT_SECTION: case FN_UNO_TEXT_SECTION:
{ {
SwFrmFmt* pTblFmt = GetFrmFmt(); SwFrmFmt* pTblFmt = GetFrmFmt();
SwTable* pTable = SwTable::FindTable( pTblFmt ); SwTable* pTable = SwTable::FindTable(pTblFmt);
SwTableNode* pTblNode = pTable->GetTableNode(); SwTableNode* pTblNode = pTable->GetTableNode();
SwSectionNode* pSectionNode = pTblNode->FindSectionNode(); SwSectionNode* pSectionNode = pTblNode->FindSectionNode();
if(pSectionNode) if(!pSectionNode)
{ return uno::Any();
SwSection& rSect = pSectionNode->GetSection(); SwSection& rSect = pSectionNode->GetSection();
uno::Reference< text::XTextSection > xSect = return uno::makeAny(SwXTextSections::GetObject(*rSect.GetFmt()));
SwXTextSections::GetObject( *rSect.GetFmt() );
aRet <<= xSect;
}
} }
break; break;
case FN_UNO_CELL_NAME: case FN_UNO_CELL_NAME:
aRet <<= pBox->GetName(); return uno::makeAny(pBox->GetName());
break; break;
case FN_UNO_REDLINE_NODE_START: case FN_UNO_REDLINE_NODE_START:
case FN_UNO_REDLINE_NODE_END: case FN_UNO_REDLINE_NODE_END:
{ {
//redline can only be returned if it's a living object //redline can only be returned if it's a living object
aRet = SwXText::getPropertyValue(rPropertyName); return makeAny(SwXText::getPropertyValue(rPropertyName));
} }
break; break;
default: default:
{ {
const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); const SwAttrSet& rSet = pBox->GetFrmFmt()->GetAttrSet();
const SwAttrSet& rSet = pBoxFmt->GetAttrSet(); uno::Any aResult;
m_pPropSet->getPropertyValue(rPropertyName, rSet, aRet); m_pPropSet->getPropertyValue(rPropertyName, rSet, aResult);
return aResult;
} }
} }
}
return aRet;
} }
void SwXCell::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) void SwXCell::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
......
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