summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 18:49:00 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-28 22:14:43 +0100
commitee1d50f6fb4fd9cf6284b583caf68bf53bd7cf3b (patch)
tree4958d253f9f5d60b87b17169f8062237e69ad7e6
parent538e8006b66edff4455bf41cafb30251355b4c7d (diff)
simplify a bit
Change-Id: If0e5ec0d16290aa1934200711e0e894b662ff945
-rw-r--r--sw/source/core/unocore/unotbl.cxx54
1 files changed, 25 insertions, 29 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 32359567b40e..d84dcde061b8 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -2291,39 +2291,35 @@ uno::Reference<table::XCell> SwXTextTable::getCellByPosition(sal_Int32 nColumn,
throw lang::IndexOutOfBoundsException();
}
-uno::Reference< table::XCellRange > SwXTextTable::GetRangeByName(SwFrmFmt* pFmt, SwTable* pTable,
- const OUString& rTLName, const OUString& rBRName,
- SwRangeDescriptor& rDesc)
+uno::Reference<table::XCellRange> SwXTextTable::GetRangeByName(SwFrmFmt* pFmt, SwTable* pTable,
+ const OUString& rTLName, const OUString& rBRName,
+ SwRangeDescriptor& rDesc)
{
SolarMutexGuard aGuard;
- uno::Reference< table::XCellRange > aRef;
- const SwTableBox* pTLBox = pTable->GetTblBox( rTLName );
- if(pTLBox)
+ const SwTableBox* pTLBox = pTable->GetTblBox(rTLName);
+ if(!pTLBox)
+ return nullptr;
+ // invalidate all actions
+ UnoActionRemoveContext aRemoveContext(pFmt->GetDoc());
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // set cursor to the upper-left cell of the range
+ SwUnoCrsr* pUnoCrsr = pFmt->GetDoc()->CreateUnoCrsr(aPos, true);
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+ pUnoCrsr->SetRemainInSection(false);
+ const SwTableBox* pBRBox(pTable->GetTblBox(rBRName));
+ if(!pBRBox)
{
- // invalidate all actions
- UnoActionRemoveContext aRemoveContext(pFmt->GetDoc());
- const SwStartNode* pSttNd = pTLBox->GetSttNd();
- SwPosition aPos(*pSttNd);
- // set cursor to the upper-left cell of the range
- SwUnoCrsr* pUnoCrsr = pFmt->GetDoc()->CreateUnoCrsr(aPos, true);
- pUnoCrsr->Move( fnMoveForward, fnGoNode );
- pUnoCrsr->SetRemainInSection( false );
- const SwTableBox* pBRBox = pTable->GetTblBox( rBRName );
- if(pBRBox)
- {
- pUnoCrsr->SetMark();
- pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
- pUnoCrsr->Move( fnMoveForward, fnGoNode );
- SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
- pCrsr->MakeBoxSels();
- // pUnoCrsr will be provided and will not be deleted
- SwXCellRange* pCellRange = new SwXCellRange(pUnoCrsr, *pFmt, rDesc);
- aRef = pCellRange;
- }
- else
- delete pUnoCrsr;
+ delete pUnoCrsr;
+ return nullptr;
}
- return aRef;
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
+ pCrsr->MakeBoxSels();
+ // pUnoCrsr will be provided and will not be deleted
+ return new SwXCellRange(pUnoCrsr, *pFmt, rDesc);
}
uno::Reference< table::XCellRange > SwXTextTable::getCellRangeByPosition(sal_Int32 nLeft, sal_Int32 nTop,