summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-07-26 20:53:54 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-07-30 23:49:59 -0400
commitd528b30b9f643d44cf2a24fa81ef6a7d1a80fcb9 (patch)
tree2127070f46ad2f1714807a81350739e0062693b9 /sc/source
parent1ce304cca32116de2ff3ea8dcac62a3be61aac77 (diff)
More on the ref object.
Change-Id: Id75bf12a04a1756aed4178df397c5a28787307a8
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/formulaiter.cxx4
-rw-r--r--sc/source/core/tool/interpr1.cxx5
-rw-r--r--sc/source/core/tool/interpr4.cxx26
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx16
-rw-r--r--sc/source/filter/excel/excform8.cxx9
-rw-r--r--sc/source/filter/inc/namebuff.hxx25
-rw-r--r--sc/source/filter/lotus/lotform.cxx5
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx8
8 files changed, 20 insertions, 78 deletions
diff --git a/sc/source/core/data/formulaiter.cxx b/sc/source/core/data/formulaiter.cxx
index f14817d34db9..d055ecba6836 100644
--- a/sc/source/core/data/formulaiter.cxx
+++ b/sc/source/core/data/formulaiter.cxx
@@ -55,8 +55,8 @@ bool ScDetectiveRefIter::GetNextRef( ScRange& rRange )
if( p )
{
SingleDoubleRefProvider aProv( *p );
- rRange.aStart.Set( aProv.Ref1.nCol, aProv.Ref1.nRow, aProv.Ref1.nTab );
- rRange.aEnd.Set( aProv.Ref2.nCol, aProv.Ref2.nRow, aProv.Ref2.nTab );
+ rRange.aStart = aProv.Ref1.toAbs(aPos);
+ rRange.aEnd = aProv.Ref2.toAbs(aPos);
bRet = true;
}
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 4a4849581752..e974beb0b013 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3989,8 +3989,9 @@ void ScInterpreter::ScColumns()
String aTabName;
ScComplexRefData aRef;
PopExternalDoubleRef( nFileId, aTabName, aRef);
- nVal += static_cast<sal_uLong>(aRef.Ref2.nTab - aRef.Ref1.nTab + 1) *
- static_cast<sal_uLong>(aRef.Ref2.nCol - aRef.Ref1.nCol + 1);
+ ScRange aAbs = aRef.toAbs(aPos);
+ nVal += static_cast<sal_uLong>(aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1) *
+ static_cast<sal_uLong>(aAbs.aEnd.Col() - aAbs.aStart.Col() + 1);
}
break;
default:
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 5ad79c481944..e211d9988ca8 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1872,10 +1872,7 @@ void ScInterpreter::PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab)
if (!IfErrorPushError())
{
ScSingleRefData aRef;
- aRef.InitFlags();
- aRef.nCol = nCol;
- aRef.nRow = nRow;
- aRef.nTab = nTab;
+ aRef.InitAddress(ScAddress(nCol,nRow,nTab));
PushTempTokenWithoutError( new ScSingleRefToken( aRef ) );
}
}
@@ -1887,13 +1884,7 @@ void ScInterpreter::PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
if (!IfErrorPushError())
{
ScComplexRefData aRef;
- aRef.InitFlags();
- aRef.Ref1.nCol = nCol1;
- aRef.Ref1.nRow = nRow1;
- aRef.Ref1.nTab = nTab1;
- aRef.Ref2.nCol = nCol2;
- aRef.Ref2.nRow = nRow2;
- aRef.Ref2.nTab = nTab2;
+ aRef.InitRange(ScRange(nCol1,nRow1,nTab1,nCol2,nRow2,nTab2));
PushTempTokenWithoutError( new ScDoubleRefToken( aRef ) );
}
}
@@ -1905,10 +1896,7 @@ void ScInterpreter::PushExternalSingleRef(
if (!IfErrorPushError())
{
ScSingleRefData aRef;
- aRef.InitFlags();
- aRef.nCol = nCol;
- aRef.nRow = nRow;
- aRef.nTab = nTab;
+ aRef.InitAddress(ScAddress(nCol,nRow,nTab));
PushTempTokenWithoutError( new ScExternalSingleRefToken(nFileId, rTabName, aRef)) ;
}
}
@@ -1921,13 +1909,7 @@ void ScInterpreter::PushExternalDoubleRef(
if (!IfErrorPushError())
{
ScComplexRefData aRef;
- aRef.InitFlags();
- aRef.Ref1.nCol = nCol1;
- aRef.Ref1.nRow = nRow1;
- aRef.Ref1.nTab = nTab1;
- aRef.Ref2.nCol = nCol2;
- aRef.Ref2.nRow = nRow2;
- aRef.Ref2.nTab = nTab2;
+ aRef.InitRange(ScRange(nCol1,nRow1,nTab1,nCol2,nRow2,nTab2));
PushTempTokenWithoutError( new ScExternalDoubleRefToken(nFileId, rTabName, aRef) );
}
}
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index 0dcda689706c..6b8d2880a451 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -171,24 +171,12 @@ void ScRefTokenHelper::getRangeListFromTokens(
void ScRefTokenHelper::getTokenFromRange(ScTokenRef& pToken, const ScRange& rRange)
{
ScComplexRefData aData;
- aData.InitFlags();
- aData.Ref1.nCol = rRange.aStart.Col();
- aData.Ref1.nRow = rRange.aStart.Row();
- aData.Ref1.nTab = rRange.aStart.Tab();
- aData.Ref1.SetColRel(false);
- aData.Ref1.SetRowRel(false);
- aData.Ref1.SetTabRel(false);
+ aData.InitRange(rRange);
aData.Ref1.SetFlag3D(true);
- aData.Ref2.nCol = rRange.aEnd.Col();
- aData.Ref2.nRow = rRange.aEnd.Row();
- aData.Ref2.nTab = rRange.aEnd.Tab();
- aData.Ref2.SetColRel(false);
- aData.Ref2.SetRowRel(false);
- aData.Ref2.SetTabRel(false);
// Display sheet name on 2nd reference only when the 1st and 2nd refs are on
// different sheets.
- aData.Ref2.SetFlag3D(aData.Ref1.nTab != aData.Ref2.nTab);
+ aData.Ref2.SetFlag3D(rRange.aStart.Tab() != rRange.aEnd.Tab());
pToken.reset(new ScDoubleRefToken(aData));
}
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 7241901568b3..7a180e4b9900 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -498,8 +498,6 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
aIn >> nRow >> nCol;
- aSRD.nCol = static_cast<SCCOL>(nCol);
- aSRD.nRow = nRow & 0x3FFF;
aSRD.SetRelTab(0);
aSRD.SetFlag3D( bRangeName && !bCondFormat );
@@ -1050,8 +1048,6 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
aIn >> nRow >> nCol;
- aSRD.nCol = static_cast<SCCOL>(nCol);
- aSRD.nRow = nRow & 0x3FFF;
aSRD.SetRelTab(0);
aSRD.SetFlag3D( bRangeName && !bCondFormat );
@@ -1191,9 +1187,8 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
if( nFirstScTab != nLastScTab )
{
aCRD.Ref1 = aSRD;
- aCRD.Ref2.nCol = aSRD.nCol;
- aCRD.Ref2.nRow = aSRD.nRow;
- aCRD.Ref2.nTab = nLastScTab;
+ aCRD.Ref2 = aSRD;
+ aCRD.Ref2.SetAbsTab(nLastScTab);
rRangeList.Append( aCRD, nTab );
}
else
diff --git a/sc/source/filter/inc/namebuff.hxx b/sc/source/filter/inc/namebuff.hxx
index a8b30890a2a5..38ead51c4006 100644
--- a/sc/source/filter/inc/namebuff.hxx
+++ b/sc/source/filter/inc/namebuff.hxx
@@ -214,31 +214,14 @@ inline void RangeNameBufferWK3::Add( const String& rName, const ScRange& aScRang
{
ScComplexRefData aCRD;
ScSingleRefData* pSRD;
- const ScAddress* pScAddr;
pSRD = &aCRD.Ref1;
- pScAddr = &aScRange.aStart;
- pSRD->SetFlag3D( sal_True );
- pSRD->nCol = pScAddr->Col();
- pSRD->nRow = pScAddr->Row();
- pSRD->nTab = pScAddr->Tab();
-
- // zunaechst ALLE Refs nur absolut
- pSRD->SetColRel( false );
- pSRD->SetRowRel( false );
- pSRD->SetTabRel( false );
+ pSRD->InitAddress(aScRange.aStart);
+ pSRD->SetFlag3D(true);
pSRD = &aCRD.Ref2;
- pScAddr = &aScRange.aEnd;
- pSRD->SetFlag3D( sal_True );
- pSRD->nCol = pScAddr->Col();
- pSRD->nRow = pScAddr->Row();
- pSRD->nTab = pScAddr->Tab();
-
- // zunaechst ALLE Refs nur absolut
- pSRD->SetColRel( false );
- pSRD->SetRowRel( false );
- pSRD->SetTabRel( false );
+ pSRD->InitAddress(aScRange.aEnd);
+ pSRD->SetFlag3D(true);
Add( rName, aCRD );
}
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index ed4d0765b246..aaca8d26189e 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -464,7 +464,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
nNewId = aPool.Store( rR );
else
{
- nId = rRangeList.GetIndex( rR.nCol, rR.nRow );
+ nId = rRangeList.GetIndex(rR.Col(), rR.Row());
if( nId == ID_FAIL )
// kein Range dazu
@@ -491,8 +491,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
nNewId = aPool.Store( aCRD );
else
{
- nId = rRangeList.GetIndex(
- rR.nCol, rR.nRow, aCRD.Ref2.nCol, aCRD.Ref2.nRow );
+ nId = rRangeList.GetIndex(rR.Col(), rR.Row(), aCRD.Ref2.Col(), aCRD.Ref2.Row());
if( nId == ID_FAIL )
// kein Range dazu
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 1090ea1c309a..de55b28351ae 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -355,13 +355,7 @@ static sal_Bool lcl_AddFunctionToken( ScTokenArray& rArray, const OUString& rNam
static void lcl_AddRef( ScTokenArray& rArray, long nStartRow, long nColCount, long nRowCount )
{
ScComplexRefData aRef;
- aRef.InitFlags();
- aRef.Ref1.nTab = 0;
- aRef.Ref2.nTab = 0;
- aRef.Ref1.nCol = 0;
- aRef.Ref1.nRow = (SCROW) nStartRow;
- aRef.Ref2.nCol = (SCCOL) (nColCount - 1);
- aRef.Ref2.nRow = (SCROW) (nStartRow + nRowCount - 1);
+ aRef.InitRange(ScRange(0,nStartRow,0,nColCount-1,nStartRow+nRowCount-1,0));
rArray.AddDoubleReference(aRef);
}