[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Fri Jul 26 20:05:52 PDT 2013
sc/source/core/data/table2.cxx | 5 --
sc/source/core/data/table3.cxx | 12 ++---
sc/source/core/tool/token.cxx | 6 +-
sc/source/filter/excel/excform.cxx | 14 ++---
sc/source/filter/excel/excform8.cxx | 14 ++---
sc/source/filter/excel/frmbase.cxx | 85 +++++++++++++++++-------------------
sc/source/filter/inc/formel.hxx | 4 -
7 files changed, 67 insertions(+), 73 deletions(-)
New commits:
commit 311d4726572ce9c439288f198cb7373576fac2a1
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Jul 26 23:06:06 2013 -0400
More of the same. Will this ever end, I'm starting to wonder...
Change-Id: I36bc90e8477cba306e107fb6d6e47f5732161df8
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 5bbb6d3..ebbd7fb 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -971,10 +971,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
ScAddress aDestPos( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab );
ScSingleRefData aRef;
- aRef.nCol = nCol;
- aRef.nRow = nRow;
- aRef.nTab = nTab;
- aRef.InitFlags(); // -> all absolute
+ aRef.InitAddress(ScAddress(nCol,nRow,nTab));
aRef.SetFlag3D(true);
ScTokenArray aArr;
aArr.AddSingleReference( aRef );
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 9971816..60df260 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1107,8 +1107,8 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
// now insert the formulas
ScComplexRefData aRef;
aRef.InitFlags();
- aRef.Ref1.nTab = nTab;
- aRef.Ref2.nTab = nTab;
+ aRef.Ref1.SetAbsTab(nTab);
+ aRef.Ref2.SetAbsTab(nTab);
for ( ::std::vector< RowEntry >::const_iterator iEntry( aRowVector.begin());
iEntry != aRowVector.end(); ++iEntry)
{
@@ -1117,10 +1117,10 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
ScSubTotalFunc* eResFunc = rParam.pFunctions[iEntry->nGroupNo];
for ( SCCOL nResult=0; nResult < nResCount; ++nResult )
{
- aRef.Ref1.nCol = nResCols[nResult];
- aRef.Ref1.nRow = iEntry->nFuncStart;
- aRef.Ref2.nCol = nResCols[nResult];
- aRef.Ref2.nRow = iEntry->nFuncEnd;
+ aRef.Ref1.SetAbsCol(nResCols[nResult]);
+ aRef.Ref1.SetAbsRow(iEntry->nFuncStart);
+ aRef.Ref2.SetAbsCol(nResCols[nResult]);
+ aRef.Ref2.SetAbsRow(iEntry->nFuncEnd);
ScTokenArray aArr;
aArr.AddOpCode( ocSubTotal );
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index a46d33e..df54e8f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2070,13 +2070,13 @@ void AdjustSingleRefData( ScSingleRefData& rRef, const ScAddress& rOldPos, const
SCsTAB nTabs = rNewPos.Tab() - rOldPos.Tab();
if (!rRef.IsColRel())
- rRef.nCol += nCols;
+ rRef.IncCol(nCols);
if (!rRef.IsRowRel())
- rRef.nRow += nRows;
+ rRef.IncRow(nRows);
if (!rRef.IsTabRel())
- rRef.nTab += nTabs;
+ rRef.IncTab(nTabs);
}
}
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index ec9817d..7918bad 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -1037,7 +1037,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
ExcRelToScRel( nUINT16, nByte, aSRD, bRangeName );
- rRangeList.Append( aSRD, nTab );
+ rRangeList.Append(aSRD.toAbs(aEingPos), nTab);
break;
case 0x45:
case 0x65:
@@ -1063,7 +1063,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
else if( IsComplRowRange( nRowFirst, nRowLast ) )
SetComplRow( aCRD );
- rRangeList.Append( aCRD, nTab );
+ rRangeList.Append(aCRD.toAbs(aEingPos), nTab);
}
break;
case 0x46:
@@ -1099,7 +1099,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
ExcRelToScRel( nUINT16, nByte, aSRD, bRNorSF );
- rRangeList.Append( aSRD, nTab );
+ rRangeList.Append(aSRD.toAbs(aEingPos), nTab);
}
break;
case 0x4D:
@@ -1124,7 +1124,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
else if( IsComplRowRange( nRowFirst, nRowLast ) )
SetComplRow( aCRD );
- rRangeList.Append( aCRD, nTab );
+ rRangeList.Append(aCRD.toAbs(aEingPos), nTab);
}
break;
case 0x49:
@@ -1192,10 +1192,10 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
aCRD.Ref2.SetAbsTab(static_cast<SCTAB>(nTabLast));
b3D = ( static_cast<SCTAB>(nTabLast) != aEingPos.Tab() );
aCRD.Ref2.SetFlag3D( b3D );
- rRangeList.Append( aCRD, nTab );
+ rRangeList.Append(aCRD.toAbs(aEingPos), nTab);
}
else
- rRangeList.Append( aSRD, nTab );
+ rRangeList.Append(aSRD.toAbs(aEingPos), nTab);
}
}
@@ -1250,7 +1250,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
else if( IsComplRowRange( nRowFirst, nRowLast ) )
SetComplRow( aCRD );
- rRangeList.Append( aCRD, nTab );
+ rRangeList.Append(aCRD.toAbs(aEingPos), nTab);
}//END in current Workbook
}
break;
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 7a180e4..7e72b04 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -1053,7 +1053,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
ExcRelToScRel8( nRow, nCol, aSRD, bRangeName );
- rRangeList.Append( aSRD, nTab );
+ rRangeList.Append(aSRD.toAbs(aEingPos), nTab);
}
break;
case 0x45:
@@ -1080,7 +1080,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
else if( IsComplRowRange( nRowFirst, nRowLast ) )
SetComplRow( aCRD );
- rRangeList.Append( aCRD, nTab );
+ rRangeList.Append(aCRD.toAbs(aEingPos), nTab);
}
break;
case 0x46:
@@ -1123,7 +1123,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
ExcRelToScRel8( nRow, nCol, aSRD, bRNorSF );
- rRangeList.Append( aSRD, nTab );
+ rRangeList.Append(aSRD.toAbs(aEingPos), nTab);
}
break;
case 0x4D:
@@ -1148,7 +1148,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
else if( IsComplRowRange( nRowFirst, nRowLast ) )
SetComplRow( aCRD );
- rRangeList.Append( aCRD, nTab );
+ rRangeList.Append(aCRD.toAbs(aEingPos), nTab);
}
break;
case 0x4E:
@@ -1189,10 +1189,10 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
aCRD.Ref1 = aSRD;
aCRD.Ref2 = aSRD;
aCRD.Ref2.SetAbsTab(nLastScTab);
- rRangeList.Append( aCRD, nTab );
+ rRangeList.Append(aCRD.toAbs(aEingPos), nTab);
}
else
- rRangeList.Append( aSRD, nTab );
+ rRangeList.Append(aSRD.toAbs(aEingPos), nTab);
}
}
break;
@@ -1225,7 +1225,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
else if( IsComplRowRange( nRw1, nRw2 ) )
SetComplRow( aCRD );
- rRangeList.Append( aCRD, nTab );
+ rRangeList.Append(aCRD.toAbs(aEingPos), nTab);
}
}
break;
diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx
index 936f41d..b1166ee 100644
--- a/sc/source/filter/excel/frmbase.cxx
+++ b/sc/source/filter/excel/frmbase.cxx
@@ -29,18 +29,20 @@ _ScRangeListTabs::~_ScRangeListTabs()
}
-void _ScRangeListTabs::Append( ScSingleRefData a, SCTAB nTab, const bool b )
+void _ScRangeListTabs::Append( const ScAddress& aSRD, SCTAB nTab, const bool b )
{
+ ScAddress a = aSRD;
+
if( b )
{
- if( a.nTab > MAXTAB )
- a.nTab = MAXTAB;
+ if (a.Tab() > MAXTAB)
+ a.SetTab(MAXTAB);
- if( a.nCol > MAXCOL )
- a.nCol = MAXCOL;
+ if (a.Col() > MAXCOL)
+ a.SetCol(MAXCOL);
- if( a.nRow > MAXROW )
- a.nRow = MAXROW;
+ if (a.Row() > MAXROW)
+ a.SetRow(MAXROW);
}
else
{
@@ -50,7 +52,7 @@ void _ScRangeListTabs::Append( ScSingleRefData a, SCTAB nTab, const bool b )
if( nTab == SCTAB_MAX)
return;
if( nTab < 0)
- nTab = a.nTab;
+ nTab = a.Tab();
if (nTab < 0 || MAXTAB < nTab)
return;
@@ -68,46 +70,43 @@ void _ScRangeListTabs::Append( ScSingleRefData a, SCTAB nTab, const bool b )
itr = r.first;
}
- itr->second->push_back(ScRange(a.nCol,a.nRow,a.nTab));
+ itr->second->push_back(ScRange(a.Col(),a.Row(),a.Tab()));
}
-void _ScRangeListTabs::Append( ScComplexRefData a, SCTAB nTab, bool b )
+void _ScRangeListTabs::Append( const ScRange& aCRD, SCTAB nTab, bool b )
{
+ ScRange a = aCRD;
+
if( b )
{
// ignore 3D ranges
- if( a.Ref1.nTab != a.Ref2.nTab )
+ if (a.aStart.Tab() != a.aEnd.Tab())
return;
- SCsTAB& rTab = a.Ref1.nTab;
- if( rTab > MAXTAB )
- rTab = MAXTAB;
- else if( rTab < 0 )
- rTab = 0;
-
- SCsCOL& rCol1 = a.Ref1.nCol;
- if( rCol1 > MAXCOL )
- rCol1 = MAXCOL;
- else if( rCol1 < 0 )
- rCol1 = 0;
-
- SCsROW& rRow1 = a.Ref1.nRow;
- if( rRow1 > MAXROW )
- rRow1 = MAXROW;
- else if( rRow1 < 0 )
- rRow1 = 0;
-
- SCsCOL& rCol2 = a.Ref2.nCol;
- if( rCol2 > MAXCOL )
- rCol2 = MAXCOL;
- else if( rCol2 < 0 )
- rCol2 = 0;
-
- SCsROW& rRow2 = a.Ref2.nRow;
- if( rRow2 > MAXROW )
- rRow2 = MAXROW;
- else if( rRow2 < 0 )
- rRow2 = 0;
+ if (a.aStart.Tab() > MAXTAB)
+ a.aStart.SetTab(MAXTAB);
+ else if (a.aStart.Tab() < 0)
+ a.aStart.SetTab(0);
+
+ if (a.aStart.Col() > MAXCOL)
+ a.aStart.SetCol(MAXCOL);
+ else if (a.aStart.Col() < 0)
+ a.aStart.SetCol(0);
+
+ if (a.aStart.Row() > MAXROW)
+ a.aStart.SetRow(MAXROW);
+ else if (a.aStart.Row() < 0)
+ a.aStart.SetRow(0);
+
+ if (a.aEnd.Col() > MAXCOL)
+ a.aEnd.SetCol(MAXCOL);
+ else if (a.aEnd.Col() < 0)
+ a.aEnd.SetCol(0);
+
+ if (a.aEnd.Row() > MAXROW)
+ a.aEnd.SetRow(MAXROW);
+ else if (a.aEnd.Row() < 0)
+ a.aEnd.SetRow(0);
}
else
{
@@ -121,7 +120,7 @@ void _ScRangeListTabs::Append( ScComplexRefData a, SCTAB nTab, bool b )
return;
if( nTab < -1)
- nTab = a.Ref1.nTab;
+ nTab = a.aStart.Tab();
if (nTab < 0 || MAXTAB < nTab)
return;
@@ -139,9 +138,7 @@ void _ScRangeListTabs::Append( ScComplexRefData a, SCTAB nTab, bool b )
itr = r.first;
}
- itr->second->push_back(
- ScRange(a.Ref1.nCol,a.Ref1.nRow,a.Ref1.nTab,
- a.Ref2.nCol,a.Ref2.nRow,a.Ref2.nTab));
+ itr->second->push_back(a);
}
const ScRange* _ScRangeListTabs::First( SCTAB n )
diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index 1514e11..faf61b7 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -65,8 +65,8 @@ public:
_ScRangeListTabs ();
~_ScRangeListTabs();
- void Append( ScSingleRefData aSRD, SCTAB nTab, bool bLimit = true );
- void Append( ScComplexRefData aCRD, SCTAB nTab, bool bLimit = true );
+ void Append( const ScAddress& aSRD, SCTAB nTab, bool bLimit = true );
+ void Append( const ScRange& aCRD, SCTAB nTab, bool bLimit = true );
const ScRange* First ( SCTAB nTab = 0 );
const ScRange* Next ();
More information about the Libreoffice-commits
mailing list