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

flatten and simplify

Change-Id: Iefcbf2ab06dcf18cdd0f0d82e4389ec1766927f9
üst 2049746a
...@@ -1523,37 +1523,28 @@ OUString SwXTextTableCursor::getRangeName() ...@@ -1523,37 +1523,28 @@ OUString SwXTextTableCursor::getRangeName()
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
OUString aRet;
SwUnoCrsr* pUnoCrsr = GetCrsr(); SwUnoCrsr* pUnoCrsr = GetCrsr();
SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr); SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
//!! see also SwChartDataSequence::getSourceRangeRepresentation //!! see also SwChartDataSequence::getSourceRangeRepresentation
if (pTblCrsr) if(!pTblCrsr)
{ return OUString();
pTblCrsr->MakeBoxSels(); pTblCrsr->MakeBoxSels();
const SwStartNode* pNode = pTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode(); const SwStartNode* pNode = pTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
const SwTable* pTable = SwTable::FindTable( GetFrmFmt() ); const SwTable* pTable = SwTable::FindTable(GetFrmFmt());
const SwTableBox* pEndBox = pTable->GetTblBox( pNode->GetIndex()); const SwTableBox* pEndBox = pTable->GetTblBox(pNode->GetIndex());
aRet = pEndBox->GetName(); if(pTblCrsr->HasMark())
{
if(pTblCrsr->HasMark()) pNode = pTblCrsr->GetMark()->nNode.GetNode().FindTableBoxStartNode();
const SwTableBox* pStartBox = pTable->GetTblBox(pNode->GetIndex());
if(pEndBox != pStartBox)
{ {
pNode = pTblCrsr->GetMark()->nNode.GetNode().FindTableBoxStartNode(); // need to switch start and end?
const SwTableBox* pStartBox = pTable->GetTblBox( pNode->GetIndex()); if(*pTblCrsr->GetPoint() < *pTblCrsr->GetMark())
if(pEndBox != pStartBox) std::swap(pStartBox, pEndBox);
{ return pStartBox->GetName() + ":" + pEndBox->GetName();
// need to switch start and end?
if (*pTblCrsr->GetPoint() < *pTblCrsr->GetMark())
{
const SwTableBox* pTmpBox = pStartBox;
pStartBox = pEndBox;
pEndBox = pTmpBox;
}
aRet = pStartBox->GetName() + ":" + pEndBox->GetName();
}
} }
} }
return aRet; return pEndBox->GetName();
} }
sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& sCellName, sal_Bool Expand) sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& sCellName, sal_Bool Expand)
......
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