[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Thu Jul 25 21:40:45 PDT 2013


 sc/inc/refdata.hxx                 |    3 
 sc/source/core/data/column3.cxx    |    7 -
 sc/source/core/data/conditio.cxx   |    4 
 sc/source/core/data/documen4.cxx   |   12 +-
 sc/source/core/tool/chgtrack.cxx   |    6 -
 sc/source/core/tool/compiler.cxx   |    6 -
 sc/source/core/tool/refdata.cxx    |   24 ++++
 sc/source/filter/excel/excform.cxx |   14 +-
 sc/source/ui/unoobj/chart2uno.cxx  |  197 ++++++++++++++++++-------------------
 9 files changed, 144 insertions(+), 129 deletions(-)

New commits:
commit 73724a9b99346f4e6f55c76b2f1e52acfb4f6774
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Jul 26 00:41:07 2013 -0400

    More on avoiding direct access to data members.
    
    Change-Id: I5fdc0d248fe9c36418fd02a1e652e4e35a638c8a

diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index 629e8ae..337b66c 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -67,10 +67,13 @@ struct SC_DLLPUBLIC ScSingleRefData
 
     void SetAbsCol( SCCOL nVal );
     void SetRelCol( SCCOL nVal );
+    void IncCol( SCCOL nInc );
     void SetAbsRow( SCROW nVal );
     void SetRelRow( SCROW nVal );
+    void IncRow( SCROW nInc );
     void SetAbsTab( SCTAB nVal );
     void SetRelTab( SCTAB nVal );
+    void IncTab( SCTAB nInc );
 
     void SetColDeleted( bool bVal );
     bool IsColDeleted() const;
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 1e0ec16..f7cc15e 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -909,15 +909,14 @@ void ScColumn::CopyFromClip(
 
         //  Create reference (Source Position)
         ScSingleRefData aRef;
-        aRef.nCol = rColumn.nCol;
-        //  Adapt nRow
-        aRef.nTab = rColumn.nTab;
         aRef.InitFlags(); // -> All absolute
+        aRef.SetAbsCol(rColumn.nCol);
+        aRef.SetAbsTab(rColumn.nTab);
         aRef.SetFlag3D(true);
 
         for (SCROW nDestRow = nRow1; nDestRow <= nRow2; nDestRow++)
         {
-            aRef.nRow = nDestRow - nDy; // Source row
+            aRef.SetAbsRow(nDestRow - nDy); // Source row
             aDestPos.SetRow( nDestRow );
 
             ScTokenArray aArr;
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 3fb8a5f..e56f75b 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1389,7 +1389,7 @@ void ScConditionEntry::SourceChanged( const ScAddress& rChanged )
                         nCol2 = rChanged.Col() - aProv.Ref1.Col();
                     else
                     {
-                        bHit &= ( rChanged.Col() >= aProv.Ref1.nCol );
+                        bHit &= (rChanged.Col() >= aProv.Ref1.Col());
                         nCol2 = MAXCOL;
                     }
                     if ( aProv.Ref1.IsRowRel() )
@@ -1411,7 +1411,7 @@ void ScConditionEntry::SourceChanged( const ScAddress& rChanged )
                         nCol1 = rChanged.Col() - aProv.Ref2.Col();
                     else
                     {
-                        bHit &= ( rChanged.Col() <= aProv.Ref2.nCol );
+                        bHit &= ( rChanged.Col() <= aProv.Ref2.Col() );
                         nCol1 = 0;
                     }
                     if ( aProv.Ref2.IsRowRel() )
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 9499fa0..38f012a 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -74,9 +74,9 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
         {
             ScSingleRefData aRefData;
             aRefData.InitFlags();
-            aRefData.nCol = nVCol;
-            aRefData.nRow = nVRow;
-            aRefData.nTab = nVTab;
+            aRefData.SetAbsCol(nVCol);
+            aRefData.SetAbsRow(nVRow);
+            aRefData.SetAbsTab(nVTab);
 
             ScTokenArray aArr;
             aArr.AddOpCode( ocBackSolver );
@@ -84,9 +84,9 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
             aArr.AddSingleReference( aRefData );
             aArr.AddOpCode( ocSep );
 
-            aRefData.nCol = nFCol;
-            aRefData.nRow = nFRow;
-            aRefData.nTab = nFTab;
+            aRefData.SetAbsCol(nFCol);
+            aRefData.SetAbsRow(nFRow);
+            aRefData.SetAbsTab(nFTab);
 
             aArr.AddSingleReference( aRefData );
             aArr.AddOpCode( ocSep );
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 5265722..e4bb249 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1976,17 +1976,14 @@ static void lcl_InvalidateReference( ScToken& rTok, const ScBigAddress& rPos )
     ScSingleRefData& rRef1 = rTok.GetSingleRef();
     if ( rPos.Col() < 0 || MAXCOL < rPos.Col() )
     {
-        rRef1.nCol = SCCOL_MAX;
         rRef1.SetColDeleted( true );
     }
     if ( rPos.Row() < 0 || MAXROW < rPos.Row() )
     {
-        rRef1.nRow = SCROW_MAX;
         rRef1.SetRowDeleted( true );
     }
     if ( rPos.Tab() < 0 || MAXTAB < rPos.Tab() )
     {
-        rRef1.nTab = SCTAB_MAX;
         rRef1.SetTabDeleted( true );
     }
     if ( rTok.GetType() == formula::svDoubleRef )
@@ -1994,17 +1991,14 @@ static void lcl_InvalidateReference( ScToken& rTok, const ScBigAddress& rPos )
         ScSingleRefData& rRef2 = rTok.GetDoubleRef().Ref2;
         if ( rPos.Col() < 0 || MAXCOL < rPos.Col() )
         {
-            rRef2.nCol = SCCOL_MAX;
             rRef2.SetColDeleted( true );
         }
         if ( rPos.Row() < 0 || MAXROW < rPos.Row() )
         {
-            rRef2.nRow = SCROW_MAX;
             rRef2.SetRowDeleted( true );
         }
         if ( rPos.Tab() < 0 || MAXTAB < rPos.Tab() )
         {
-            rRef2.nTab = SCTAB_MAX;
             rRef2.SetTabDeleted( true );
         }
     }
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 4c17edf..198f653 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2739,11 +2739,11 @@ bool ScCompiler::IsSingleReference( const String& rName )
         if( !( nFlags & SCA_VALID ) )
         {
             if( !( nFlags & SCA_VALID_COL ) )
-                aRef.nCol = MAXCOL+1;
+                aRef.SetColDeleted(true);
             if( !( nFlags & SCA_VALID_ROW ) )
-                aRef.nRow = MAXROW+1;
+                aRef.SetRowDeleted(true);
             if( !( nFlags & SCA_VALID_TAB ) )
-                aRef.nTab = MAXTAB+3;
+                aRef.SetTabDeleted(true);
             nFlags |= SCA_VALID;
         }
         aRef.SetAddress(aAddr, aPos);
diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx
index a4735dc..45676a5 100644
--- a/sc/source/core/tool/refdata.cxx
+++ b/sc/source/core/tool/refdata.cxx
@@ -52,6 +52,14 @@ void ScSingleRefData::SetRelCol( SCCOL nVal )
     nRelCol = nVal;
 }
 
+void ScSingleRefData::IncCol( SCCOL nInc )
+{
+    if (Flags.bColRel)
+        nRelCol += nInc;
+    else
+        nCol += nInc;
+}
+
 void ScSingleRefData::SetAbsRow( SCROW nVal )
 {
     Flags.bRowRel = false;
@@ -64,6 +72,14 @@ void ScSingleRefData::SetRelRow( SCROW nVal )
     nRelRow = nVal;
 }
 
+void ScSingleRefData::IncRow( SCROW nInc )
+{
+    if (Flags.bRowRel)
+        nRelRow += nInc;
+    else
+        nRow += nInc;
+}
+
 void ScSingleRefData::SetAbsTab( SCTAB nVal )
 {
     Flags.bTabRel = false;
@@ -76,6 +92,14 @@ void ScSingleRefData::SetRelTab( SCTAB nVal )
     nRelTab = nVal;
 }
 
+void ScSingleRefData::IncTab( SCTAB nInc )
+{
+    if (Flags.bTabRel)
+        nRelTab += nInc;
+    else
+        nTab += nInc;
+}
+
 void ScSingleRefData::SetColDeleted( bool bVal )
 {
     Flags.bColDeleted = (bVal ? true : false );
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index c5aaf3c..ec9817d 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -519,8 +519,8 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
             case 0x6A:
             case 0x2A: // Deleted Cell Reference                [323 273]
                 aIn >> nUINT16 >> nByte;
-                aSRD.nCol = static_cast<SCsCOL>(nByte);
-                aSRD.nRow = nUINT16 & 0x3FFF;
+                aSRD.SetAbsCol(static_cast<SCsCOL>(nByte));
+                aSRD.SetAbsRow(nUINT16 & 0x3FFF);
                 aSRD.SetRelTab(0);
                 aSRD.SetFlag3D( bRangeName );
 
@@ -1030,8 +1030,8 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
             case 0x64:
             case 0x24: // Cell Reference                        [319 270]
                 aIn >> nUINT16 >> nByte;
-                aSRD.nCol = static_cast<SCsCOL>(nByte);
-                aSRD.nRow = nUINT16 & 0x3FFF;
+                aSRD.SetAbsCol(static_cast<SCsCOL>(nByte));
+                aSRD.SetAbsRow(nUINT16 & 0x3FFF);
                 aSRD.SetRelTab(0);
                 aSRD.SetFlag3D( bRangeName );
 
@@ -1188,12 +1188,10 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
                     if( nTabLast != nTabFirst )
                     {
                         aCRD.Ref1 = aSRD;
-                        aCRD.Ref2.nCol = aSRD.nCol;
-                        aCRD.Ref2.nRow = aSRD.nRow;
-                        aCRD.Ref2.nTab = static_cast<SCTAB>(nTabLast);
+                        aCRD.Ref2 = aSRD;
+                        aCRD.Ref2.SetAbsTab(static_cast<SCTAB>(nTabLast));
                         b3D = ( static_cast<SCTAB>(nTabLast) != aEingPos.Tab() );
                         aCRD.Ref2.SetFlag3D( b3D );
-                        aCRD.Ref2.SetTabRel( false );
                         rRangeList.Append( aCRD, nTab );
                     }
                     else
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index c2b8459..628c5c9 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -519,12 +519,12 @@ void Chart2Positioner::glueState()
         ScComplexRefData aData;
         if (ScRefTokenHelper::getDoubleRefDataFromToken(aData, p))
         {
-            if (aData.Ref1.nTab == aData.Ref2.nTab)
+            if (aData.Ref1.Tab() == aData.Ref2.Tab())
                 meGlue = GLUETYPE_NONE;
             else
                 meGlue = GLUETYPE_COLS;
-            mnStartCol = aData.Ref1.nCol;
-            mnStartRow = aData.Ref1.nRow;
+            mnStartCol = aData.Ref1.Col();
+            mnStartRow = aData.Ref1.Row();
         }
         else
         {
@@ -537,8 +537,8 @@ void Chart2Positioner::glueState()
 
     ScComplexRefData aData;
     ScRefTokenHelper::getDoubleRefDataFromToken(aData, mrRefTokens.front());
-    mnStartCol = aData.Ref1.nCol;
-    mnStartRow = aData.Ref1.nRow;
+    mnStartCol = aData.Ref1.Col();
+    mnStartRow = aData.Ref1.Row();
 
     SCCOL nEndCol = 0;
     SCROW nEndRow = 0;
@@ -546,8 +546,8 @@ void Chart2Positioner::glueState()
          ; itr != itrEnd; ++itr)
     {
         ScRefTokenHelper::getDoubleRefDataFromToken(aData, *itr);
-        SCCOLROW n1 = aData.Ref1.nCol;
-        SCCOLROW n2 = aData.Ref2.nCol;
+        SCCOLROW n1 = aData.Ref1.Col();
+        SCCOLROW n2 = aData.Ref2.Col();
         if (n1 > MAXCOL)
             n1 = MAXCOL;
         if (n2 > MAXCOL)
@@ -620,10 +620,10 @@ void Chart2Positioner::calcGlueState(SCCOL nColSize, SCROW nRowSize)
     {
         ScComplexRefData aData;
         ScRefTokenHelper::getDoubleRefDataFromToken(aData, *itr);
-        SCCOL nCol1 = static_cast<SCCOL>(aData.Ref1.nCol) - mnStartCol;
-        SCCOL nCol2 = static_cast<SCCOL>(aData.Ref2.nCol) - mnStartCol;
-        SCROW nRow1 = static_cast<SCROW>(aData.Ref1.nRow) - mnStartRow;
-        SCROW nRow2 = static_cast<SCROW>(aData.Ref2.nRow) - mnStartRow;
+        SCCOL nCol1 = aData.Ref1.Col() - mnStartCol;
+        SCCOL nCol2 = aData.Ref2.Col() - mnStartCol;
+        SCROW nRow1 = aData.Ref1.Row() - mnStartRow;
+        SCROW nRow2 = aData.Ref2.Row() - mnStartRow;
         for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
             for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
             {
@@ -739,9 +739,9 @@ void Chart2Positioner::createPositionMap()
             break;
         const ScSingleRefData& s = aData.Ref1;
         const ScSingleRefData& e = aData.Ref2;
-        SCCOL nCol1 = s.nCol, nCol2 = e.nCol;
-        SCROW nRow1 = s.nRow, nRow2 = e.nRow;
-        SCTAB nTab1 = s.nTab, nTab2 = e.nTab;
+        SCCOL nCol1 = s.Col(), nCol2 = e.Col();
+        SCROW nRow1 = s.Row(), nRow2 = e.Row();
+        SCTAB nTab1 = s.Tab(), nTab2 = e.Tab();
 
         for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
         {
@@ -771,9 +771,9 @@ void Chart2Positioner::createPositionMap()
                     aCellData.SetColRel(false);
                     aCellData.SetRowRel(false);
                     aCellData.SetTabRel(false);
-                    aCellData.nCol = nCol;
-                    aCellData.nRow = nRow;
-                    aCellData.nTab = nTab;
+                    aCellData.SetAbsCol(nCol);
+                    aCellData.SetAbsRow(nRow);
+                    aCellData.SetAbsTab(nTab);
 
                     if (pCol->find(nInsRow) == pCol->end())
                     {
@@ -1135,31 +1135,31 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
         case svSingleRef:
         {
             const ScSingleRefData& rData = pToken->GetSingleRef();
-            nMinCol = rData.nCol;
-            nMinRow = rData.nRow;
-            nMaxCol = rData.nCol;
-            nMaxRow = rData.nRow;
-            nTab = rData.nTab;
+            nMinCol = rData.Col();
+            nMinRow = rData.Row();
+            nMaxCol = rData.Col();
+            nMaxRow = rData.Row();
+            nTab = rData.Tab();
         }
         break;
         case svDoubleRef:
         {
             const ScComplexRefData& rData = pToken->GetDoubleRef();
-            nMinCol = min(rData.Ref1.nCol, rData.Ref2.nCol);
-            nMinRow = min(rData.Ref1.nRow, rData.Ref2.nRow);
-            nMaxCol = max(rData.Ref1.nCol, rData.Ref2.nCol);
-            nMaxRow = max(rData.Ref1.nRow, rData.Ref2.nRow);
-            nTab = rData.Ref1.nTab;
+            nMinCol = min(rData.Ref1.Col(), rData.Ref2.Col());
+            nMinRow = min(rData.Ref1.Row(), rData.Ref2.Row());
+            nMaxCol = max(rData.Ref1.Col(), rData.Ref2.Col());
+            nMaxRow = max(rData.Ref1.Row(), rData.Ref2.Row());
+            nTab = rData.Ref1.Tab();
         }
         break;
         case svExternalSingleRef:
         {
             const ScSingleRefData& rData = pToken->GetSingleRef();
-            nMinCol = rData.nCol;
-            nMinRow = rData.nRow;
-            nMaxCol = rData.nCol;
-            nMaxRow = rData.nRow;
-            nTab = rData.nTab;
+            nMinCol = rData.Col();
+            nMinRow = rData.Row();
+            nMaxCol = rData.Col();
+            nMaxRow = rData.Row();
+            nTab = rData.Tab();
             nFileId = pToken->GetIndex();
             aExtTabName = pToken->GetString();
             bExternal = true;
@@ -1168,11 +1168,11 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
         case svExternalDoubleRef:
         {
             const ScComplexRefData& rData = pToken->GetDoubleRef();
-            nMinCol = min(rData.Ref1.nCol, rData.Ref2.nCol);
-            nMinRow = min(rData.Ref1.nRow, rData.Ref2.nRow);
-            nMaxCol = max(rData.Ref1.nCol, rData.Ref2.nCol);
-            nMaxRow = max(rData.Ref1.nRow, rData.Ref2.nRow);
-            nTab = rData.Ref1.nTab;
+            nMinCol = min(rData.Ref1.Col(), rData.Ref2.Col());
+            nMinRow = min(rData.Ref1.Row(), rData.Ref2.Row());
+            nMaxCol = max(rData.Ref1.Col(), rData.Ref2.Col());
+            nMaxRow = max(rData.Ref1.Row(), rData.Ref2.Row());
+            nTab = rData.Ref1.Tab();
             nFileId = pToken->GetIndex();
             aExtTabName = pToken->GetString();
             bExternal = true;
@@ -1194,11 +1194,11 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
             {
                 const ScSingleRefData& rData = pToken->GetSingleRef();
 
-                nMinCol = min(nMinCol, rData.nCol);
-                nMinRow = min(nMinRow, rData.nRow);
-                nMaxCol = max(nMaxCol, rData.nCol);
-                nMaxRow = max(nMaxRow, rData.nRow);
-                if (nTab != rData.nTab || bExternal)
+                nMinCol = min(nMinCol, rData.Col());
+                nMinRow = min(nMinRow, rData.Row());
+                nMaxCol = max(nMaxCol, rData.Col());
+                nMaxRow = max(nMaxRow, rData.Row());
+                if (nTab != rData.Tab() || bExternal)
                     return false;
             }
             break;
@@ -1206,17 +1206,17 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
             {
                 const ScComplexRefData& rData = pToken->GetDoubleRef();
 
-                nMinCol = min(nMinCol, rData.Ref1.nCol);
-                nMinCol = min(nMinCol, rData.Ref2.nCol);
-                nMinRow = min(nMinRow, rData.Ref1.nRow);
-                nMinRow = min(nMinRow, rData.Ref2.nRow);
+                nMinCol = min(nMinCol, rData.Ref1.Col());
+                nMinCol = min(nMinCol, rData.Ref2.Col());
+                nMinRow = min(nMinRow, rData.Ref1.Row());
+                nMinRow = min(nMinRow, rData.Ref2.Row());
 
-                nMaxCol = max(nMaxCol, rData.Ref1.nCol);
-                nMaxCol = max(nMaxCol, rData.Ref2.nCol);
-                nMaxRow = max(nMaxRow, rData.Ref1.nRow);
-                nMaxRow = max(nMaxRow, rData.Ref2.nRow);
+                nMaxCol = max(nMaxCol, rData.Ref1.Col());
+                nMaxCol = max(nMaxCol, rData.Ref2.Col());
+                nMaxRow = max(nMaxRow, rData.Ref1.Row());
+                nMaxRow = max(nMaxRow, rData.Ref2.Row());
 
-                if (nTab != rData.Ref1.nTab || bExternal)
+                if (nTab != rData.Ref1.Tab() || bExternal)
                     return false;
             }
             break;
@@ -1230,10 +1230,10 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
 
                 const ScSingleRefData& rData = pToken->GetSingleRef();
 
-                nMinCol = min(nMinCol, rData.nCol);
-                nMinRow = min(nMinRow, rData.nRow);
-                nMaxCol = max(nMaxCol, rData.nCol);
-                nMaxRow = max(nMaxRow, rData.nRow);
+                nMinCol = min(nMinCol, rData.Col());
+                nMinRow = min(nMinRow, rData.Row());
+                nMaxCol = max(nMaxCol, rData.Col());
+                nMaxRow = max(nMaxRow, rData.Row());
             }
             break;
             case svExternalDoubleRef:
@@ -1246,15 +1246,15 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
 
                 const ScComplexRefData& rData = pToken->GetDoubleRef();
 
-                nMinCol = min(nMinCol, rData.Ref1.nCol);
-                nMinCol = min(nMinCol, rData.Ref2.nCol);
-                nMinRow = min(nMinRow, rData.Ref1.nRow);
-                nMinRow = min(nMinRow, rData.Ref2.nRow);
+                nMinCol = min(nMinCol, rData.Ref1.Col());
+                nMinCol = min(nMinCol, rData.Ref2.Col());
+                nMinRow = min(nMinRow, rData.Ref1.Row());
+                nMinRow = min(nMinRow, rData.Ref2.Row());
 
-                nMaxCol = max(nMaxCol, rData.Ref1.nCol);
-                nMaxCol = max(nMaxCol, rData.Ref2.nCol);
-                nMaxRow = max(nMaxRow, rData.Ref1.nRow);
-                nMaxRow = max(nMaxRow, rData.Ref2.nRow);
+                nMaxCol = max(nMaxCol, rData.Ref1.Col());
+                nMaxCol = max(nMaxCol, rData.Ref2.Col());
+                nMaxRow = max(nMaxRow, rData.Ref1.Row());
+                nMaxRow = max(nMaxRow, rData.Ref2.Row());
             }
             break;
             default:
@@ -1285,17 +1285,17 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
             case svExternalSingleRef:
             {
                 const ScSingleRefData& rData = pToken->GetSingleRef();
-                if (rData.nCol == nMinCol && rData.nRow == nMinRow)
+                if (rData.Col() == nMinCol && rData.Row() == nMinRow)
                     // The corner cell is contained.
                     return false;
 
-                if (rData.nCol == nMinCol+nCornerColumnCount && rData.nRow == nMinRow)
+                if (rData.Col() == nMinCol+nCornerColumnCount && rData.Row() == nMinRow)
                     bRight = true;
 
-                if (rData.nCol == nMinCol && rData.nRow == nMinRow+nCornerRowCount)
+                if (rData.Col() == nMinCol && rData.Row() == nMinRow+nCornerRowCount)
                     bBottom = true;
 
-                if (rData.nCol == nMinCol+nCornerColumnCount && rData.nRow == nMinRow+nCornerRowCount)
+                if (rData.Col() == nMinCol+nCornerColumnCount && rData.Row() == nMinRow+nCornerRowCount)
                     bDiagonal = true;
             }
             break;
@@ -1305,21 +1305,21 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
                 const ScComplexRefData& rData = pToken->GetDoubleRef();
                 const ScSingleRefData& r1 = rData.Ref1;
                 const ScSingleRefData& r2 = rData.Ref2;
-                if (r1.nCol <= nMinCol && nMinCol <= r2.nCol &&
-                    r1.nRow <= nMinRow && nMinRow <= r2.nRow)
+                if (r1.Col() <= nMinCol && nMinCol <= r2.Col() &&
+                    r1.Row() <= nMinRow && nMinRow <= r2.Row())
                     // The corner cell is contained.
                     return false;
 
-                if (r1.nCol <= nMinCol+nCornerColumnCount && nMinCol+nCornerColumnCount <= r2.nCol &&
-                    r1.nRow <= nMinRow && nMinRow <= r2.nRow)
+                if (r1.Col() <= nMinCol+nCornerColumnCount && nMinCol+nCornerColumnCount <= r2.Col() &&
+                    r1.Row() <= nMinRow && nMinRow <= r2.Row())
                     bRight = true;
 
-                if (r1.nCol <= nMinCol && nMinCol <= r2.nCol &&
-                    r1.nRow <= nMinRow+nCornerRowCount && nMinRow+nCornerRowCount <= r2.nRow)
+                if (r1.Col() <= nMinCol && nMinCol <= r2.Col() &&
+                    r1.Row() <= nMinRow+nCornerRowCount && nMinRow+nCornerRowCount <= r2.Row())
                     bBottom = true;
 
-                if (r1.nCol <= nMinCol+nCornerColumnCount && nMinCol+nCornerColumnCount <= r2.nCol &&
-                    r1.nRow <= nMinRow+nCornerRowCount && nMinRow+nCornerRowCount <= r2.nRow)
+                if (r1.Col() <= nMinCol+nCornerColumnCount && nMinCol+nCornerColumnCount <= r2.Col() &&
+                    r1.Row() <= nMinRow+nCornerRowCount && nMinRow+nCornerRowCount <= r2.Row())
                     bDiagonal = true;
             }
             break;
@@ -1335,12 +1335,9 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
     ScSingleRefData aData;
     aData.InitFlags();
     aData.SetFlag3D(true);
-    aData.SetColRel(false);
-    aData.SetRowRel(false);
-    aData.SetTabRel(false);
-    aData.nCol = nMinCol;
-    aData.nRow = nMinRow;
-    aData.nTab = nTab;
+    aData.SetAbsCol(nMinCol);
+    aData.SetAbsRow(nMinRow);
+    aData.SetAbsTab(nTab);
 
     if( nCornerRowCount==1 && nCornerColumnCount==1 )
     {
@@ -1359,8 +1356,8 @@ bool lcl_addUpperLeftCornerIfMissing(vector<ScTokenRef>& rRefTokens,
     else
     {
         ScSingleRefData aDataEnd(aData);
-        aDataEnd.nCol += (nCornerColumnCount-1);
-        aDataEnd.nRow += (nCornerRowCount-1);
+        aDataEnd.IncCol(nCornerColumnCount-1);
+        aDataEnd.IncRow(nCornerRowCount-1);
         ScComplexRefData r;
         r.Ref1=aData;
         r.Ref2=aDataEnd;
@@ -1403,7 +1400,7 @@ public:
         SCROW nMinRow = MAXROW, nMaxRow = 0;
 
         // Determine the smallest range that encompasses the data ranges of all sheets.
-        SCTAB nTab1 = s.nTab, nTab2 = e.nTab;
+        SCTAB nTab1 = s.Tab(), nTab2 = e.Tab();
         for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
         {
             SCCOL nCol1 = 0, nCol2 = MAXCOL;
@@ -1416,14 +1413,14 @@ public:
         }
 
         // Shrink range to the data range if applicable.
-        if (s.nCol < nMinCol)
-            s.nCol = nMinCol;
-        if (s.nRow < nMinRow)
-            s.nRow = nMinRow;
-        if (e.nCol > nMaxCol)
-            e.nCol = nMaxCol;
-        if (e.nRow > nMaxRow)
-            e.nRow = nMaxRow;
+        if (s.Col() < nMinCol)
+            s.SetAbsCol(nMinCol);
+        if (s.Row() < nMinRow)
+            s.SetAbsRow(nMinRow);
+        if (e.Col() > nMaxCol)
+            e.SetAbsCol(nMaxCol);
+        if (e.Row() > nMaxRow)
+            e.SetAbsRow(nMaxRow);
     }
 };
 
@@ -1689,16 +1686,16 @@ void RangeAnalyzer::initRangeAnalyzer( const vector<ScTokenRef>& rTokens )
             const ScComplexRefData& r = aRefToken->GetDoubleRef();
             if (r.Ref1.nTab == r.Ref2.nTab)
             {
-                mnColumnCount = std::max<SCCOL>( mnColumnCount, static_cast<SCCOL>(abs(r.Ref2.nCol - r.Ref1.nCol)+1) );
-                mnRowCount = std::max<SCROW>( mnRowCount, static_cast<SCROW>(abs(r.Ref2.nRow - r.Ref1.nRow)+1) );
+                mnColumnCount = std::max<SCCOL>(mnColumnCount, static_cast<SCCOL>(abs(r.Ref2.Col() - r.Ref1.Col())+1));
+                mnRowCount = std::max<SCROW>(mnRowCount, static_cast<SCROW>(abs(r.Ref2.Row() - r.Ref1.Row())+1));
                 if( mnStartColumn == -1 )
                 {
-                    mnStartColumn = r.Ref1.nCol;
-                    mnStartRow = r.Ref1.nRow;
+                    mnStartColumn = r.Ref1.Col();
+                    mnStartRow = r.Ref1.Row();
                 }
                 else
                 {
-                    if( mnStartColumn != r.Ref1.nCol && mnStartRow != r.Ref1.nRow )
+                    if (mnStartColumn != r.Ref1.Col() && mnStartRow != r.Ref1.Row())
                         mbAmbiguous=true;
                 }
             }
@@ -1712,12 +1709,12 @@ void RangeAnalyzer::initRangeAnalyzer( const vector<ScTokenRef>& rTokens )
             mnRowCount = std::max<SCROW>( mnRowCount, 1);
             if( mnStartColumn == -1 )
             {
-                mnStartColumn = r.nCol;
-                mnStartRow = r.nRow;
+                mnStartColumn = r.Col();
+                mnStartRow = r.Row();
             }
             else
             {
-                if( mnStartColumn != r.nCol && mnStartRow != r.nRow )
+                if (mnStartColumn != r.Col() && mnStartRow != r.Row())
                     mbAmbiguous=true;
             }
         }


More information about the Libreoffice-commits mailing list