[ooo-build-commit] Branch 'ooo/master' - sc/inc sc/source

Jan Holesovsky kendy at kemper.freedesktop.org
Fri Aug 7 17:14:25 PDT 2009


 sc/inc/compiler.hxx                  |    6 ++---
 sc/inc/rangenam.hxx                  |   10 ++++++++
 sc/source/core/data/cell2.cxx        |    6 ++---
 sc/source/core/inc/refupdat.hxx      |    4 +--
 sc/source/core/tool/compiler.cxx     |   22 +++++++++---------
 sc/source/core/tool/rangenam.cxx     |   42 +++++++++++++++++++++++++++++------
 sc/source/core/tool/refupdat.cxx     |   12 +++++-----
 sc/source/filter/excel/namebuff.cxx  |    3 ++
 sc/source/filter/excel/xeformula.cxx |    2 -
 9 files changed, 74 insertions(+), 33 deletions(-)

New commits:
commit 26f5cc34d5c4d44b0e17588ac3c0e2efd97274f3
Author: Release Engineers <releng at openoffice.org>
Date:   Fri Aug 7 12:33:11 2009 +0000

    CWS-TOOLING: integrate CWS calcooo311_DEV300
    2009-08-04 13:55:19 +0200 er  r274617 : #i102356# add patch flag for i18npool lib
    2009-08-03 17:29:15 +0200 dr  r274589 : #i103968# ported fix from DEV300, new pie charts lose point color
    2009-07-29 23:20:00 +0200 er  r274467 : #i103861# Shared formula and named range relative reference wrap with different grid sizes; patch from <kohei>

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 0b48742..6e4d47e 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -409,9 +409,9 @@ public:
     const ScDocument* GetDoc() const { return pDoc; }
     const ScAddress& GetPos() const { return aPos; }
 
-    void MoveRelWrap();
-    static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc,
-                             const ScAddress& rPos );
+    void MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow );
+    static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos, 
+                             SCCOL nMaxCol, SCROW nMaxRow );
 
     BOOL UpdateNameReference( UpdateRefMode eUpdateRefMode,
                               const ScRange&,
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 8231cbd..e93bfda 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -81,6 +81,11 @@ private:
     USHORT			nIndex;
     BOOL			bModified;			// wird bei UpdateReference gesetzt/geloescht
 
+    // max row and column to use for wrapping of references.  If -1 use the 
+    // application's default.
+    SCROW           mnMaxRow;
+    SCCOL           mnMaxCol;
+
     friend class ScRangeName;
     ScRangeData( USHORT nIndex );
 public:
@@ -153,6 +158,11 @@ public:
 
     static void		MakeValidName( String& rName );
     SC_DLLPUBLIC static BOOL		IsNameValid( const String& rName, ScDocument* pDoc );
+
+    SC_DLLPUBLIC void SetMaxRow(SCROW nRow);
+    SCROW GetMaxRow() const;
+    SC_DLLPUBLIC void SetMaxCol(SCCOL nCol);
+    SCCOL GetMaxCol() const;
 };
 
 inline BOOL ScRangeData::HasType( RangeType nType ) const
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 13923c5..c92676f 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -1067,7 +1067,7 @@ void ScFormulaCell::UpdateInsertTab(SCTAB nTable)
             pCode = new ScTokenArray( *pRangeData->GetCode() );
             ScCompiler aComp2(pDocument, aPos, *pCode);
             aComp2.SetGrammar(pDocument->GetGrammar());
-            aComp2.MoveRelWrap();
+            aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
             aComp2.UpdateInsertTab( nTable, FALSE );
             // If the shared formula contained a named range/formula containing
             // an absolute reference to a sheet, those have to be readjusted.
@@ -1103,7 +1103,7 @@ BOOL ScFormulaCell::UpdateDeleteTab(SCTAB nTable, BOOL bIsMove)
             ScCompiler aComp2(pDocument, aPos, *pCode);
             aComp2.SetGrammar(pDocument->GetGrammar());
             aComp2.CompileTokenArray();
-            aComp2.MoveRelWrap();
+            aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
             aComp2.UpdateDeleteTab( nTable, FALSE, FALSE, bRefChanged );
             // If the shared formula contained a named range/formula containing
             // an absolute reference to a sheet, those have to be readjusted.
@@ -1140,7 +1140,7 @@ void ScFormulaCell::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo )
             ScCompiler aComp2(pDocument, aPos, *pCode);
             aComp2.SetGrammar(pDocument->GetGrammar());
             aComp2.CompileTokenArray();
-            aComp2.MoveRelWrap();
+            aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
             aComp2.UpdateMoveTab( nOldPos, nNewPos, TRUE );
             bCompile = TRUE;
         }
diff --git a/sc/source/core/inc/refupdat.hxx b/sc/source/core/inc/refupdat.hxx
index c60cccc..1a4c66d 100644
--- a/sc/source/core/inc/refupdat.hxx
+++ b/sc/source/core/inc/refupdat.hxx
@@ -81,8 +81,8 @@ public:
                                 SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
                                 ScComplexRefData& rRef, BOOL bWrap, BOOL bAbsolute );
 
-    static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
-                                ScComplexRefData& rRef );
+    static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos, 
+                             SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef );
 
     /// Before calling, the absolute references must be up-to-date!
     static ScRefUpdateRes UpdateTranspose( ScDocument* pDoc,
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index c35e2ef..987cfa4 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3959,7 +3959,7 @@ BOOL ScCompiler::HandleRange()
             if( pRangeData->HasReferences() )
             {
                 SetRelNameReference();
-                MoveRelWrap();
+                MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
             }
             pNew->Reset();
             if ( bAddPair )
@@ -4011,7 +4011,7 @@ BOOL ScCompiler::HandleExternalReference(const FormulaToken& _aToken)
             if (pNew->GetNextReference() != NULL)
             {
                 SetRelNameReference();
-                MoveRelWrap();
+                MoveRelWrap(MAXCOL, MAXROW);
             }
             pNew->Reset();
             return GetToken();
@@ -4106,33 +4106,33 @@ void ScCompiler::SetRelNameReference()
 
 // Wrap-adjust relative references of a RangeName to current position,
 // don't call for other token arrays!
-void ScCompiler::MoveRelWrap()
+void ScCompiler::MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow )
 {
     pArr->Reset();
     for( ScToken* t = static_cast<ScToken*>(pArr->GetNextReference()); t;
                   t = static_cast<ScToken*>(pArr->GetNextReference()) )
     {
         if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef )
-            ScRefUpdate::MoveRelWrap( pDoc, aPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
+            ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
         else
-            ScRefUpdate::MoveRelWrap( pDoc, aPos, t->GetDoubleRef() );
+            ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, t->GetDoubleRef() );
     }
 }
 
 // static
 // Wrap-adjust relative references of a RangeName to current position,
 // don't call for other token arrays!
-void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc,
-            const ScAddress& rPos )
+void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos,
+                              SCCOL nMaxCol, SCROW nMaxRow )
 {
     rArr.Reset();
     for( ScToken* t = static_cast<ScToken*>(rArr.GetNextReference()); t;
                   t = static_cast<ScToken*>(rArr.GetNextReference()) )
     {
         if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef )
-            ScRefUpdate::MoveRelWrap( pDoc, rPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
+            ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
         else
-            ScRefUpdate::MoveRelWrap( pDoc, rPos, t->GetDoubleRef() );
+            ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, t->GetDoubleRef() );
     }
 }
 
@@ -4307,7 +4307,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
                     SingleDoubleRefModifier aMod( rRef );
                     if ( rRef.IsRelName() )
                     {
-                        ScRefUpdate::MoveRelWrap( pDoc, aPos, aMod.Ref() );
+                        ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, aMod.Ref() );
                         rChanged = TRUE;
                     }
                     else
@@ -4337,7 +4337,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
                     SCTAB nTabs = rRef.Ref2.nTab - rRef.Ref1.nTab;
                     if ( rRef.Ref1.IsRelName() || rRef.Ref2.IsRelName() )
                     {
-                        ScRefUpdate::MoveRelWrap( pDoc, aPos, rRef );
+                        ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, rRef );
                         rChanged = TRUE;
                     }
                     else
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 6029663..a249cc7 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -60,7 +60,7 @@ using namespace formula;
 // Interner ctor fuer das Suchen nach einem Index
 
 ScRangeData::ScRangeData( USHORT n )
-           : pCode( NULL ), nIndex( n ), bModified( FALSE )
+           : pCode( NULL ), nIndex( n ), bModified( FALSE ), mnMaxRow(-1), mnMaxCol(-1)
 {}
 
 ScRangeData::ScRangeData( ScDocument* pDok,
@@ -76,7 +76,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
                 eType		( nType ),
                 pDoc		( pDok ),
                 nIndex		( 0 ),
-                bModified	( FALSE )
+                bModified	( FALSE ),
+                mnMaxRow    (-1),
+                mnMaxCol    (-1)
 {
     if (rSymbol.Len() > 0)
     {
@@ -122,7 +124,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
                 eType		( nType ),
                 pDoc		( pDok ),
                 nIndex		( 0 ),
-                bModified	( FALSE )
+                bModified	( FALSE ),
+                mnMaxRow    (-1),
+                mnMaxCol    (-1)
 {
     if( !pCode->GetCodeError() )
     {
@@ -157,7 +161,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
                 eType		( RT_NAME ),
                 pDoc		( pDok ),
                 nIndex		( 0 ),
-                bModified	( FALSE )
+                bModified	( FALSE ),
+                mnMaxRow    (-1),
+                mnMaxCol    (-1)
 {
     ScSingleRefData aRefData;
     aRefData.InitAddress( rTarget );
@@ -179,7 +185,9 @@ ScRangeData::ScRangeData(const ScRangeData& rScRangeData) :
     eType		(rScRangeData.eType),
     pDoc		(rScRangeData.pDoc),
     nIndex   	(rScRangeData.nIndex),
-    bModified	(rScRangeData.bModified)
+    bModified	(rScRangeData.bModified),
+    mnMaxRow    (rScRangeData.mnMaxRow),
+    mnMaxCol    (rScRangeData.mnMaxCol)
 {}
 
 ScRangeData::~ScRangeData()
@@ -247,7 +255,7 @@ void ScRangeData::UpdateSymbol(	rtl::OUStringBuffer& rBuffer, const ScAddress& r
     ::std::auto_ptr<ScTokenArray> pTemp( pCode->Clone() );
     ScCompiler aComp( pDoc, rPos, *pTemp.get());
     aComp.SetGrammar(eGrammar);
-    aComp.MoveRelWrap();
+    aComp.MoveRelWrap(GetMaxCol(), GetMaxRow());
     aComp.CreateStringFromTokenArray( rBuffer );
 }
 
@@ -393,7 +401,7 @@ BOOL ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const
         ::std::auto_ptr<ScTokenArray> pTemp( pCode->Clone() );
         ScCompiler aComp( pDoc, rPos, *pTemp);
         aComp.SetGrammar(pDoc->GetGrammar());
-        aComp.MoveRelWrap();
+        aComp.MoveRelWrap(MAXCOL, MAXROW);
         return pTemp->IsReference( rRange );
     }
 
@@ -520,6 +528,26 @@ BOOL ScRangeData::IsNameValid( const String& rName, ScDocument* pDoc )
     return TRUE;
 }
 
+void ScRangeData::SetMaxRow(SCROW nRow)
+{
+    mnMaxRow = nRow;
+}
+
+SCROW ScRangeData::GetMaxRow() const
+{
+    return mnMaxRow >= 0 ? mnMaxRow : MAXROW;
+}
+
+void ScRangeData::SetMaxCol(SCCOL nCol)
+{
+    mnMaxCol = nCol;
+}
+
+SCCOL ScRangeData::GetMaxCol() const
+{
+    return mnMaxCol >= 0 ? mnMaxCol : MAXCOL;
+}
+
 
 USHORT ScRangeData::GetErrCode()
 {
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index 0836979..461a1d7 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -820,28 +820,28 @@ ScRefUpdateRes ScRefUpdate::Move( ScDocument* pDoc, const ScAddress& rPos,
     return eRet;
 }
 
-void ScRefUpdate::MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
-                                  ScComplexRefData& rRef )
+void ScRefUpdate::MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos, 
+                               SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef )
 {
     if( rRef.Ref1.IsColRel() )
     {
         rRef.Ref1.nCol = rRef.Ref1.nRelCol + rPos.Col();
-        lcl_MoveItWrap( rRef.Ref1.nCol, static_cast<SCsCOL>(0), MAXCOL );
+        lcl_MoveItWrap( rRef.Ref1.nCol, static_cast<SCsCOL>(0), nMaxCol );
     }
     if( rRef.Ref2.IsColRel() )
     {
         rRef.Ref2.nCol = rRef.Ref2.nRelCol + rPos.Col();
-        lcl_MoveItWrap( rRef.Ref2.nCol, static_cast<SCsCOL>(0), MAXCOL );
+        lcl_MoveItWrap( rRef.Ref2.nCol, static_cast<SCsCOL>(0), nMaxCol );
     }
     if( rRef.Ref1.IsRowRel() )
     {
         rRef.Ref1.nRow = rRef.Ref1.nRelRow + rPos.Row();
-        lcl_MoveItWrap( rRef.Ref1.nRow, static_cast<SCsROW>(0), MAXROW );
+        lcl_MoveItWrap( rRef.Ref1.nRow, static_cast<SCsROW>(0), nMaxRow );
     }
     if( rRef.Ref2.IsRowRel() )
     {
         rRef.Ref2.nRow = rRef.Ref2.nRelRow + rPos.Row();
-        lcl_MoveItWrap( rRef.Ref2.nRow, static_cast<SCsROW>(0), MAXROW );
+        lcl_MoveItWrap( rRef.Ref2.nRow, static_cast<SCsROW>(0), nMaxRow );
     }
     SCsTAB nMaxTab = (SCsTAB) pDoc->GetTableCount() - 1;
     if( rRef.Ref1.IsTabRel() )
diff --git a/sc/source/filter/excel/namebuff.cxx b/sc/source/filter/excel/namebuff.cxx
index f007482..5ecea62 100644
--- a/sc/source/filter/excel/namebuff.cxx
+++ b/sc/source/filter/excel/namebuff.cxx
@@ -127,6 +127,9 @@ void ShrfmlaBuffer::Store( const ScRange& rRange, const ScTokenArray& rToken )
     DBG_ASSERT( mnCurrIdx <= 0xFFFF, "*ShrfmlaBuffer::Store(): Gleich wird mir schlecht...!" );
 
     ScRangeData* pData = new ScRangeData( pExcRoot->pIR->GetDocPtr(), aName, rToken, rRange.aStart, RT_SHARED );
+    const ScAddress& rMaxPos = pExcRoot->pIR->GetMaxPos();
+    pData->SetMaxCol(rMaxPos.Col());
+    pData->SetMaxRow(rMaxPos.Row());
     pData->SetIndex( static_cast< USHORT >( mnCurrIdx ) );
     pExcRoot->pIR->GetNamedRanges().Insert( pData );
     index_hash[rRange.aStart] = static_cast< USHORT >( mnCurrIdx );
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index 6767ad2..0611a63 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -619,7 +619,7 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA
             DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - missing cell address" );
             // clone the passed token array, convert references relative to current cell position
             mxOwnScTokArr.reset( rScTokArr.Clone() );
-            ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos );
+            ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW );
             // don't remember pScBasePos in mpScBasePos, shared formulas use real relative refs
         break;
         default:;


More information about the ooo-build-commit mailing list