summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2009-08-07 12:33:11 +0000
committerRelease Engineers <releng@openoffice.org>2009-08-07 12:33:11 +0000
commitb37c10a1019a40cb906fdb98693e44306d44fed2 (patch)
treedd1df9ea14bdcf0c8ed09975f7d6e92b3e0ce066 /sc
parent32cd63b065ce197e0e141177e3cde3858e8f91c0 (diff)
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>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/compiler.hxx6
-rw-r--r--sc/inc/rangenam.hxx10
-rw-r--r--sc/source/core/data/cell2.cxx6
-rw-r--r--sc/source/core/inc/refupdat.hxx2
-rw-r--r--sc/source/core/tool/compiler.cxx22
-rw-r--r--sc/source/core/tool/rangenam.cxx42
-rw-r--r--sc/source/core/tool/refupdat.cxx10
-rw-r--r--sc/source/filter/excel/namebuff.cxx3
-rw-r--r--sc/source/filter/excel/xeformula.cxx2
9 files changed, 72 insertions, 31 deletions
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 058b3b30f30a..76293479660c 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 962aff918e7b..002adf9b77ce 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 2a1525b76401..a0e776458ca2 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 0461578db0a6..2a8b17335fbf 100644
--- a/sc/source/core/inc/refupdat.hxx
+++ b/sc/source/core/inc/refupdat.hxx
@@ -82,7 +82,7 @@ public:
ScComplexRefData& rRef, BOOL bWrap, BOOL bAbsolute );
static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
- ScComplexRefData& rRef );
+ 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 2b66663f3ee9..bc2266cbd3c8 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 704c3255486e..4a4683935e99 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 d019a6082583..ddb5f3dc0a5c 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -821,27 +821,27 @@ ScRefUpdateRes ScRefUpdate::Move( ScDocument* pDoc, const ScAddress& rPos,
}
void ScRefUpdate::MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
- ScComplexRefData& rRef )
+ 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 df53c3edcd3c..b01f5a728263 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 e065099b2824..457c31d4ab04 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:;