summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 04:32:22 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 22:14:20 +0100
commitef9d2e03bec142da915fb021a6ccbfc9df519651 (patch)
treef87da3b84a33ecf587cf98f635ccc62c8bca6081
parent1cef3995f626c9bc826f79756d0518f75ba12f14 (diff)
flatten conditionals
Change-Id: I13978be6dd654274caf383d9cee7b379f4d001eb
-rw-r--r--sw/source/core/unocore/unotbl.cxx42
1 files changed, 18 insertions, 24 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index a875f14ffa81..0a3636139ad2 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -4754,35 +4754,29 @@ uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
- uno::Any aRet;
SwFrmFmt* pFrmFmt = GetFrmFmt();
if(!pFrmFmt || nIndex < 0 )
throw lang::IndexOutOfBoundsException();
- else
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(static_cast<size_t>(nIndex) >= pTable->GetTabLines().size())
+ throw lang::IndexOutOfBoundsException();
+ SwTableLine* pLine = pTable->GetTabLines()[nIndex];
+ SwIterator<SwXTextTableRow,SwFmt> aIter( *pFrmFmt );
+ SwXTextTableRow* pXRow = aIter.First();
+ while( pXRow )
{
- SwTable* pTable = SwTable::FindTable( pFrmFmt );
- if( pTable->GetTabLines().size() > static_cast<size_t>(nIndex))
- {
- SwTableLine* pLine = pTable->GetTabLines()[nIndex];
- SwIterator<SwXTextTableRow,SwFmt> aIter( *pFrmFmt );
- SwXTextTableRow* pXRow = aIter.First();
- while( pXRow )
- {
- // is there already a proper cell?
- if(pXRow->GetTblRow() == pLine)
- break;
- pXRow = aIter.Next();
- }
- // otherwise create it
- if(!pXRow)
- pXRow = new SwXTextTableRow(pFrmFmt, pLine);
- uno::Reference< beans::XPropertySet > xRet =
- (beans::XPropertySet*)pXRow;
- aRet.setValue(&xRet, cppu::UnoType<beans::XPropertySet>::get());
- }
- else
- throw lang::IndexOutOfBoundsException();
+ // is there already a proper cell?
+ if(pXRow->GetTblRow() == pLine)
+ break;
+ pXRow = aIter.Next();
}
+ // otherwise create it
+ if(!pXRow)
+ pXRow = new SwXTextTableRow(pFrmFmt, pLine);
+ uno::Reference< beans::XPropertySet > xRet =
+ (beans::XPropertySet*)pXRow;
+ uno::Any aRet;
+ aRet.setValue(&xRet, cppu::UnoType<beans::XPropertySet>::get());
return aRet;
}