formula/source/core/api/FormulaCompiler.cxx | 18 ++++++-- formula/source/core/api/token.cxx | 3 + formula/source/core/resource/core_resource.src | 16 +++---- include/formula/FormulaCompiler.hxx | 3 - include/formula/compiler.hrc | 25 ++++++------ include/formula/opcode.hxx | 5 +- sc/inc/compiler.hxx | 8 +++ sc/inc/global.hxx | 4 - sc/inc/token.hxx | 33 +++++++++++++++ sc/source/core/data/column4.cxx | 1 sc/source/core/data/conditio.cxx | 2 sc/source/core/data/formulacell.cxx | 6 +- sc/source/core/data/validat.cxx | 5 +- sc/source/core/inc/interpre.hxx | 4 - sc/source/core/tool/compiler.cxx | 25 +++++++++++- sc/source/core/tool/dbdata.cxx | 2 sc/source/core/tool/interpr1.cxx | 4 - sc/source/core/tool/interpr4.cxx | 4 - sc/source/core/tool/parclass.cxx | 4 - sc/source/core/tool/token.cxx | 52 ++++++++++++++++++++++++- sc/source/filter/excel/xlformula.cxx | 4 - sc/source/filter/qpro/qproform.cxx | 2 sc/source/ui/src/scfuncs.src | 4 - 23 files changed, 179 insertions(+), 55 deletions(-)
New commits: commit 967f609cb7bcfd42ccae3d6c8ea75ef9e40910be Author: Eike Rathke <er...@redhat.com> Date: Wed Mar 4 22:33:41 2015 +0100 add Item enum to ScTableRefToken Change-Id: Ie35d717fd55e6bbde958d3f2be4dac5f489467f9 diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index acfdad6..298e341 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -26,6 +26,7 @@ #include "scdllapi.h" #include "global.hxx" #include "refdata.hxx" +#include "token.hxx" #include <formula/token.hxx> #include <formula/grammar.hxx> #include <unotools/charclass.hxx> @@ -137,7 +138,8 @@ public: sal_uInt16 nIndex; } name; struct { - sal_uInt16 nIndex; + sal_uInt16 nIndex; + ScTableRefToken::Item eItem; } table; struct { rtl_uString* mpData; diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx index 8d0d333..5564a20 100644 --- a/sc/inc/token.hxx +++ b/sc/inc/token.hxx @@ -211,17 +211,34 @@ public: /** Special token to remember details of ocTableRef "structured references". */ class ScTableRefToken : public formula::FormulaToken { - sal_uInt16 mnIndex; ///< index into table / database range collection - - ScTableRefToken(); // disabled public: - ScTableRefToken( sal_uInt16 nIndex ); + + enum Item + { + ALL = 0, + HEADERS = 1, + DATA = 2, + TOTALS = 4, + THIS_ROW = 8 + }; + + ScTableRefToken( sal_uInt16 nIndex, Item eItem ); ScTableRefToken( const ScTableRefToken& r ); virtual ~ScTableRefToken(); virtual sal_uInt16 GetIndex() const SAL_OVERRIDE; virtual bool operator==( const formula::FormulaToken& rToken ) const SAL_OVERRIDE; virtual FormulaToken* Clone() const SAL_OVERRIDE { return new ScTableRefToken(*this); } + + Item GetItem() const; + +private: + + sal_uInt16 mnIndex; ///< index into table / database range collection + Item meItem; + + ScTableRefToken(); // disabled + }; // Only created from within the interpreter, no conversion from ScRawToken, diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 96e3b58..b38c370 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -329,7 +329,7 @@ FormulaToken* ScRawToken::CreateToken() const return new ScMatrixToken( pMat ); case svIndex : if (eOp == ocTableRef) - return new ScTableRefToken( table.nIndex); + return new ScTableRefToken( table.nIndex, table.eItem); else return new FormulaIndexToken( eOp, name.nIndex, name.bGlobal); case svExternalSingleRef: @@ -828,15 +828,17 @@ bool ScExternalNameToken::operator==( const FormulaToken& r ) const return maName.getData() == r.GetString().getData(); } -ScTableRefToken::ScTableRefToken( sal_uInt16 nIndex ) : +ScTableRefToken::ScTableRefToken( sal_uInt16 nIndex, ScTableRefToken::Item eItem ) : FormulaToken( svIndex, ocTableRef), - mnIndex(nIndex) + mnIndex(nIndex), + meItem(eItem) { } ScTableRefToken::ScTableRefToken( const ScTableRefToken& r ) : FormulaToken(r), - mnIndex(r.mnIndex) + mnIndex(r.mnIndex), + meItem(r.meItem) { } @@ -847,6 +849,11 @@ sal_uInt16 ScTableRefToken::GetIndex() const return mnIndex; } +ScTableRefToken::Item ScTableRefToken::GetItem() const +{ + return meItem; +} + bool ScTableRefToken::operator==( const FormulaToken& r ) const { if ( !FormulaToken::operator==(r) ) @@ -855,6 +862,13 @@ bool ScTableRefToken::operator==( const FormulaToken& r ) const if (mnIndex != r.GetIndex()) return false; + const ScTableRefToken* p = dynamic_cast<const ScTableRefToken*>(&r); + if (!p) + return false; + + if (meItem != p->GetItem()) + return false; + return true; } commit 338d006c9da54ecdd211144dbfe76a076fe20b27 Author: Eike Rathke <er...@redhat.com> Date: Wed Mar 4 20:55:17 2015 +0100 use ScTableRefToken in ScRawToken::CreateToken() Change-Id: I895f142667a593bc5fc4f33f2417cbee991e503a diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index f1b83d9..acfdad6 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -137,6 +137,9 @@ public: sal_uInt16 nIndex; } name; struct { + sal_uInt16 nIndex; + } table; + struct { rtl_uString* mpData; rtl_uString* mpDataIgnoreCase; } sharedstring; diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 47e9237..96e3b58 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -328,7 +328,10 @@ FormulaToken* ScRawToken::CreateToken() const IF_NOT_OPCODE_ERROR( ocPush, ScMatrixToken); return new ScMatrixToken( pMat ); case svIndex : - return new FormulaIndexToken( eOp, name.nIndex, name.bGlobal); + if (eOp == ocTableRef) + return new ScTableRefToken( table.nIndex); + else + return new FormulaIndexToken( eOp, name.nIndex, name.bGlobal); case svExternalSingleRef: { OUString aTabName(extref.cTabName); commit 20e95bcd836baba16909149ded5b54f978b70ce3 Author: Eike Rathke <er...@redhat.com> Date: Wed Mar 4 20:22:28 2015 +0100 introduce ScTableRefToken Change-Id: Id6f7f0fbc120072cf6a61229838e39c4a53aeee7 diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx index f742d01..8d0d333 100644 --- a/sc/inc/token.hxx +++ b/sc/inc/token.hxx @@ -208,6 +208,22 @@ public: virtual FormulaToken* Clone() const SAL_OVERRIDE { return new ScExternalNameToken(*this); } }; +/** Special token to remember details of ocTableRef "structured references". */ +class ScTableRefToken : public formula::FormulaToken +{ + sal_uInt16 mnIndex; ///< index into table / database range collection + + ScTableRefToken(); // disabled +public: + ScTableRefToken( sal_uInt16 nIndex ); + ScTableRefToken( const ScTableRefToken& r ); + virtual ~ScTableRefToken(); + + virtual sal_uInt16 GetIndex() const SAL_OVERRIDE; + virtual bool operator==( const formula::FormulaToken& rToken ) const SAL_OVERRIDE; + virtual FormulaToken* Clone() const SAL_OVERRIDE { return new ScTableRefToken(*this); } +}; + // Only created from within the interpreter, no conversion from ScRawToken, // never added to ScTokenArray! class ScJumpMatrixToken : public formula::FormulaToken diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index ff0b548..47e9237 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -825,6 +825,36 @@ bool ScExternalNameToken::operator==( const FormulaToken& r ) const return maName.getData() == r.GetString().getData(); } +ScTableRefToken::ScTableRefToken( sal_uInt16 nIndex ) : + FormulaToken( svIndex, ocTableRef), + mnIndex(nIndex) +{ +} + +ScTableRefToken::ScTableRefToken( const ScTableRefToken& r ) : + FormulaToken(r), + mnIndex(r.mnIndex) +{ +} + +ScTableRefToken::~ScTableRefToken() {} + +sal_uInt16 ScTableRefToken::GetIndex() const +{ + return mnIndex; +} + +bool ScTableRefToken::operator==( const FormulaToken& r ) const +{ + if ( !FormulaToken::operator==(r) ) + return false; + + if (mnIndex != r.GetIndex()) + return false; + + return true; +} + ScJumpMatrix* ScJumpMatrixToken::GetJumpMatrix() const { return pJumpMatrix; } bool ScJumpMatrixToken::operator==( const FormulaToken& r ) const { commit a1b956d03e83fd91f56250e25932ff4951cbc29e Author: Eike Rathke <er...@redhat.com> Date: Wed Mar 4 18:54:12 2015 +0100 error for css::sheet::FormulaToken with ocTableRef not implemented Change-Id: I1d95b0168e880029e1fe319f025e586944f636ab diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 180ba0f..1780c57 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -390,7 +390,7 @@ bool FormulaTokenArray::AddFormulaToken( if ( eOpCode == ocDBArea ) AddToken( formula::FormulaIndexToken( eOpCode, static_cast<sal_uInt16>(nValue) ) ); else if ( eOpCode == ocTableRef ) - /* TODO: implementation */ ; + bError = true; /* TODO: implementation */ else if ( eOpCode == ocSpaces ) AddToken( formula::FormulaByteToken( ocSpaces, static_cast<sal_uInt8>(nValue) ) ); else diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 298451b..ff0b548 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1045,7 +1045,7 @@ bool ScTokenArray::AddFormulaToken( else if (eOpCode == ocDBArea) AddDBRange(aTokenData.Index); else if (eOpCode == ocTableRef) - /* TODO: AddTableRef(aTokenData.Index) */ ; + bError = true; /* TODO: implementation */ else bError = true; } commit eaf5a24b1ea7f6f37a7d59e3cdd4b8ba949a4f4f Author: Eike Rathke <er...@redhat.com> Date: Wed Mar 4 14:05:42 2015 +0100 add HandleTableRef() Change-Id: I95e80bfa11177e1a52f3215d27448f4642091bad diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index e0bed7f..6af9f36 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1112,7 +1112,7 @@ bool FormulaCompiler::GetToken() } else if( mpToken->GetOpCode() == ocTableRef ) { - /* TODO: return HandleTableRef() */ ; + return HandleTableRef(); } return true; } @@ -2104,6 +2104,11 @@ bool FormulaCompiler::HandleDbData() return true; } +bool FormulaCompiler::HandleTableRef() +{ + return true; +} + void FormulaCompiler::CreateStringFromSingleRef( OUStringBuffer& /*rBuffer*/, FormulaToken* /*pTokenP*/) const { } diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx index adf593c..7f9097b 100644 --- a/include/formula/FormulaCompiler.hxx +++ b/include/formula/FormulaCompiler.hxx @@ -282,6 +282,7 @@ protected: virtual bool HandleRange(); virtual bool HandleColRowName(); virtual bool HandleDbData(); + virtual bool HandleTableRef(); virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* pTokenP) const; virtual void CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP) const; diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 5838a5a..f1b83d9 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -453,6 +453,7 @@ private: virtual bool HandleRange() SAL_OVERRIDE; virtual bool HandleColRowName() SAL_OVERRIDE; virtual bool HandleDbData() SAL_OVERRIDE; + virtual bool HandleTableRef() SAL_OVERRIDE; virtual formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, bool bReuseDoubleRef ) SAL_OVERRIDE; virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, formula::FormulaToken* pTokenP) const SAL_OVERRIDE; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 8a33bab..6bdf70a 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4601,6 +4601,25 @@ bool ScCompiler::HandleDbData() return true; } +bool ScCompiler::HandleTableRef() +{ + ScDBData* pDBData = pDoc->GetDBCollection()->getNamedDBs().findByIndex(mpToken->GetIndex()); + if ( !pDBData ) + SetError(errNoName); + else if (mbJumpCommandReorder) + { + /* TODO: handle it */ +#if 0 + ScTokenArray* pNew = new ScTokenArray(); + pNew->AddDoubleReference( aRefData ); + PushTokenArray( pNew, true ); + pNew->Reset(); + return GetToken(); +#endif + } + return true; +} + FormulaTokenRef ScCompiler::ExtendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2, bool bReuseDoubleRef ) { return extendRangeReference( rTok1, rTok2, aPos,bReuseDoubleRef ); commit 40a3cec85f91709e302c08626b59fee0381ef261 Author: Eike Rathke <er...@redhat.com> Date: Tue Mar 3 17:55:55 2015 +0100 handle ocTableRef same as ocDBArea Change-Id: Id64556850ef0d44db1ff4dedb41e0e1cb9735b76 diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 37231a8..e0bed7f 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -359,6 +359,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create { FormulaMapGroupSpecialOffset::SPACES , ocSpaces } , { FormulaMapGroupSpecialOffset::MAT_REF , ocMatRef } , { FormulaMapGroupSpecialOffset::DB_AREA , ocDBArea } , + /* TODO: { FormulaMapGroupSpecialOffset::TABLE_REF , ocTableRef } , */ { FormulaMapGroupSpecialOffset::MACRO , ocMacro } , { FormulaMapGroupSpecialOffset::COL_ROW_NAME , ocColRowName } }; @@ -1109,6 +1110,10 @@ bool FormulaCompiler::GetToken() { return HandleDbData(); } + else if( mpToken->GetOpCode() == ocTableRef ) + { + /* TODO: return HandleTableRef() */ ; + } return true; } @@ -1123,9 +1128,9 @@ void FormulaCompiler::Factor() OpCode eOp = mpToken->GetOpCode(); if( eOp == ocPush || eOp == ocColRowNameAuto || eOp == ocMatRef || - eOp == ocDBArea + eOp == ocDBArea || eOp == ocTableRef || (!mbJumpCommandReorder && ((eOp == ocName) || (eOp == ocDBArea) - || (eOp == ocColRowName) || (eOp == ocBad))) + || (eOp == ocTableRef) || (eOp == ocColRowName) || (eOp == ocBad))) ) { PutCode( mpToken ); diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index f81b9e7..180ba0f 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -79,6 +79,7 @@ bool FormulaToken::IsFunction() const { return (eOp != ocPush && eOp != ocBad && eOp != ocColRowName && eOp != ocColRowNameAuto && eOp != ocName && eOp != ocDBArea && + eOp != ocTableRef && (GetByte() != 0 // x parameters || (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR) // no parameter || (ocIf == eOp || ocIfError == eOp || ocIfNA == eOp || ocChoose == eOp ) // @ jump commands @@ -388,6 +389,8 @@ bool FormulaTokenArray::AddFormulaToken( sal_Int32 nValue = rToken.Data.get<sal_Int32>(); if ( eOpCode == ocDBArea ) AddToken( formula::FormulaIndexToken( eOpCode, static_cast<sal_uInt16>(nValue) ) ); + else if ( eOpCode == ocTableRef ) + /* TODO: implementation */ ; else if ( eOpCode == ocSpaces ) AddToken( formula::FormulaByteToken( ocSpaces, static_cast<sal_uInt8>(nValue) ) ); else diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index a162ca7..ee64aa0 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -867,6 +867,7 @@ void ScColumn::PreprocessDBDataUpdate( aOps.insert(ocBad); aOps.insert(ocColRowName); aOps.insert(ocDBArea); + aOps.insert(ocTableRef); RecompileByOpcodeHandler aFunc(pDocument, aOps, rEndListenCxt, rCompileCxt); std::for_each(aGroups.begin(), aGroups.end(), aFunc); } diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 1d6ee1e..2f7af3d 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -830,7 +830,7 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons OpCode eOpCode = pToken->GetOpCode(); if (eOpCode == ocName) adjustRangeName(pToken, rDoc, rCell.pDocument, aPos, rCell.aPos); - else if (eOpCode == ocDBArea) + else if (eOpCode == ocDBArea || eOpCode == ocTableRef) adjustDBRange(pToken, rDoc, rCell.pDocument); } } @@ -3568,7 +3568,8 @@ void ScFormulaCell::CompileDBFormula( sc::CompileFormulaContext& rCxt ) { for( FormulaToken* p = pCode->First(); p; p = pCode->Next() ) { - if ( p->GetOpCode() == ocDBArea ) + OpCode eOp = p->GetOpCode(); + if ( eOp == ocDBArea || eOp == ocTableRef ) { bCompile = true; CompileTokenArray(rCxt); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 7efcab2..5982168 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -685,7 +685,8 @@ bool ScValidationData::GetSelectionFromFormula( formula::FormulaToken* t = NULL; if (pArr->GetLen() == 1 && (t = pArr->GetNextReferenceOrName()) != NULL) { - if (t->GetOpCode() == ocDBArea) + OpCode eOpCode = t->GetOpCode(); + if (eOpCode == ocDBArea || eOpCode == ocTableRef) { if (const ScDBData* pDBData = pDocument->GetDBCollection()->getNamedDBs().findByIndex(t->GetIndex())) { @@ -693,7 +694,7 @@ bool ScValidationData::GetSelectionFromFormula( bRef = true; } } - else if (t->GetOpCode() == ocName) + else if (eOpCode == ocName) { ScRangeData* pName = pDocument->GetRangeName()->findByIndex( t->GetIndex() ); if (pName && pName->IsReference(aRange)) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 8d32278..8a33bab 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2962,7 +2962,8 @@ bool ScCompiler::IsDBRange( const OUString& rName ) { if (rName == "[]") { - if (maRawToken.GetOpCode() == ocDBArea) + OpCode eOp = maRawToken.GetOpCode(); + if (eOp == ocDBArea || eOp == ocTableRef) { // In OOXML, a database range is named Table1[], Table2[] etc. // Skip the [] part if the previous token is a valid db range. @@ -4289,6 +4290,7 @@ void ScCompiler::CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* _pT } break; case ocDBArea: + case ocTableRef: { const ScDBData* pDBData = pDoc->GetDBCollection()->getNamedDBs().findByIndex(_pTokenP->GetIndex()); if (pDBData) diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index ce101fc..298451b 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1044,6 +1044,8 @@ bool ScTokenArray::AddFormulaToken( AddRangeName(aTokenData.Index, aTokenData.Global); else if (eOpCode == ocDBArea) AddDBRange(aTokenData.Index); + else if (eOpCode == ocTableRef) + /* TODO: AddTableRef(aTokenData.Index) */ ; else bError = true; } @@ -4008,6 +4010,7 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons } break; case ocDBArea: + case ocTableRef: { NameType::const_iterator it = rCxt.maNamedDBs.find(nIndex); if (it != rCxt.maNamedDBs.end()) commit 8ee20e2691aa6f67c67d40c61a8cd1569458b5a8 Author: Eike Rathke <er...@redhat.com> Date: Tue Mar 3 15:16:45 2015 +0100 rename ScInterpreter::ScTable/s() to ScSheet/s() to follow ocSheet/s Change-Id: Ia0db62b27577c64d3d6f6603f2e2c72b56cf1a81 diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 0b669ec..0255b62 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -507,10 +507,10 @@ void ScStDev( bool bTextAsZero = false ); void ScStDevP( bool bTextAsZero = false ); void ScColumns(); void ScRows(); -void ScTables(); +void ScSheets(); void ScColumn(); void ScRow(); -void ScTable(); +void ScSheet(); void ScMatch(); double IterateParametersIf( ScIterFuncIf ); void ScCountIf(); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index a5ac375..4082491 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3797,7 +3797,7 @@ void ScInterpreter::ScRows() PushDouble((double)nVal); } -void ScInterpreter::ScTables() +void ScInterpreter::ScSheets() { sal_uInt8 nParamCount = GetByte(); sal_uLong nVal; @@ -4013,7 +4013,7 @@ void ScInterpreter::ScRow() } } -void ScInterpreter::ScTable() +void ScInterpreter::ScSheet() { sal_uInt8 nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 0, 1 ) ) diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 760ef27..386b306 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -4047,10 +4047,10 @@ StackVar ScInterpreter::Interpret() case ocPMT : ScPMT(); break; case ocColumns : ScColumns(); break; case ocRows : ScRows(); break; - case ocSheets : ScTables(); break; + case ocSheets : ScSheets(); break; case ocColumn : ScColumn(); break; case ocRow : ScRow(); break; - case ocSheet : ScTable(); break; + case ocSheet : ScSheet(); break; case ocRRI : ScRRI(); break; case ocFV : ScFV(); break; case ocNper : ScNper(); break; commit d406edf2442a9d35262daeb48bedb51777ee2255 Author: Eike Rathke <er...@redhat.com> Date: Tue Mar 3 14:51:57 2015 +0100 rename SC_OPCODE_TABLE/S,ocTable/s to SC_OPCODE_SHEET/S,ocSheet/s Like their function names and to prevent confusion that ocTableRef would be related. Change-Id: I739c7d8e0413aa1e573facdef6bdd854c462f14d diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src index 2f3f2bc..483a5d2 100644 --- a/formula/source/core/resource/core_resource.src +++ b/formula/source/core/resource/core_resource.src @@ -221,10 +221,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_PMT { Text = "PMT" ; }; String SC_OPCODE_COLUMNS { Text = "COLUMNS" ; }; String SC_OPCODE_ROWS { Text = "ROWS" ; }; - String SC_OPCODE_TABLES { Text = "SHEETS" ; }; + String SC_OPCODE_SHEETS { Text = "SHEETS" ; }; String SC_OPCODE_COLUMN { Text = "COLUMN" ; }; String SC_OPCODE_ROW { Text = "ROW" ; }; - String SC_OPCODE_TABLE { Text = "SHEET" ; }; + String SC_OPCODE_SHEET { Text = "SHEET" ; }; String SC_OPCODE_RRI { Text = "RRI" ; }; String SC_OPCODE_FV { Text = "FV" ; }; String SC_OPCODE_NPER { Text = "NPER" ; }; @@ -630,10 +630,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML String SC_OPCODE_PMT { Text = "PMT" ; }; String SC_OPCODE_COLUMNS { Text = "COLUMNS" ; }; String SC_OPCODE_ROWS { Text = "ROWS" ; }; - String SC_OPCODE_TABLES { Text = "_xlfn.SHEETS" ; }; + String SC_OPCODE_SHEETS { Text = "_xlfn.SHEETS" ; }; String SC_OPCODE_COLUMN { Text = "COLUMN" ; }; String SC_OPCODE_ROW { Text = "ROW" ; }; - String SC_OPCODE_TABLE { Text = "_xlfn.SHEET" ; }; + String SC_OPCODE_SHEET { Text = "_xlfn.SHEET" ; }; String SC_OPCODE_RRI { Text = "_xlfn.RRI" ; }; String SC_OPCODE_FV { Text = "FV" ; }; String SC_OPCODE_NPER { Text = "NPER" ; }; @@ -1041,10 +1041,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_PMT { Text = "PMT" ; }; String SC_OPCODE_COLUMNS { Text = "COLUMNS" ; }; String SC_OPCODE_ROWS { Text = "ROWS" ; }; - String SC_OPCODE_TABLES { Text = "SHEETS" ; }; + String SC_OPCODE_SHEETS { Text = "SHEETS" ; }; String SC_OPCODE_COLUMN { Text = "COLUMN" ; }; String SC_OPCODE_ROW { Text = "ROW" ; }; - String SC_OPCODE_TABLE { Text = "SHEET" ; }; + String SC_OPCODE_SHEET { Text = "SHEET" ; }; String SC_OPCODE_RRI { Text = "ZGZ" ; }; String SC_OPCODE_FV { Text = "FV" ; }; String SC_OPCODE_NPER { Text = "NPER" ; }; @@ -1973,7 +1973,7 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "ROWS" ; }; - String SC_OPCODE_TABLES + String SC_OPCODE_SHEETS { Text [ en-US ] = "SHEETS" ; }; @@ -1985,7 +1985,7 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "ROW" ; }; - String SC_OPCODE_TABLE + String SC_OPCODE_SHEET { Text [ en-US ] = "SHEET" ; }; diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc index 2081b09..ba31646 100644 --- a/include/formula/compiler.hrc +++ b/include/formula/compiler.hrc @@ -371,8 +371,8 @@ #define SC_OPCODE_STYLE 368 #define SC_OPCODE_DDE 369 #define SC_OPCODE_BASE 370 -#define SC_OPCODE_TABLE 371 -#define SC_OPCODE_TABLES 372 +#define SC_OPCODE_SHEET 371 +#define SC_OPCODE_SHEETS 372 #define SC_OPCODE_MIN_A 373 #define SC_OPCODE_MAX_A 374 #define SC_OPCODE_AVERAGE_A 375 diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx index 8c578c5..667edeb 100644 --- a/include/formula/opcode.hxx +++ b/include/formula/opcode.hxx @@ -445,8 +445,8 @@ enum OpCode : sal_uInt16 ocStyle = SC_OPCODE_STYLE, ocDde = SC_OPCODE_DDE, ocBase = SC_OPCODE_BASE, - ocTable = SC_OPCODE_TABLE, - ocTables = SC_OPCODE_TABLES, + ocSheet = SC_OPCODE_SHEET, + ocSheets = SC_OPCODE_SHEETS, ocMinA = SC_OPCODE_MIN_A, ocMaxA = SC_OPCODE_MAX_A, ocAverageA = SC_OPCODE_AVERAGE_A, diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 729cb7e..8553bdd 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -119,7 +119,7 @@ static bool lcl_HasRelRef( ScDocument* pDoc, ScTokenArray* pFormula, sal_uInt16 { case ocRow: // ROW() returns own row index case ocColumn: // COLUMN() returns own column index - case ocTable: // SHEET() returns own sheet index + case ocSheet: // SHEET() returns own sheet index case ocCell: // CELL() may return own cell address return true; default: diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index b4c72e4..760ef27 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -4047,10 +4047,10 @@ StackVar ScInterpreter::Interpret() case ocPMT : ScPMT(); break; case ocColumns : ScColumns(); break; case ocRows : ScRows(); break; - case ocTables : ScTables(); break; + case ocSheets : ScTables(); break; case ocColumn : ScColumn(); break; case ocRow : ScRow(); break; - case ocTable : ScTable(); break; + case ocSheet : ScTable(); break; case ocRRI : ScRRI(); break; case ocFV : ScFV(); break; case ocNper : ScNper(); break; diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx index 81e3deb..3f29b50 100644 --- a/sc/source/core/tool/parclass.cxx +++ b/sc/source/core/tool/parclass.cxx @@ -193,8 +193,8 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] = { ocSumX2MY2, {{ ForceArray, ForceArray }, 0 }}, { ocSumX2DY2, {{ ForceArray, ForceArray }, 0 }}, { ocSumXMY2, {{ ForceArray, ForceArray }, 0 }}, - { ocTable, {{ Reference }, 0 }}, - { ocTables, {{ Reference }, 1 }}, + { ocSheet, {{ Reference }, 0 }}, + { ocSheets, {{ Reference }, 1 }}, { ocTrend, {{ Reference, Reference, Reference, Value }, 0 }}, { ocTrimMean, {{ Reference, Value }, 0 }}, { ocTTest, {{ ForceArray, ForceArray, Value, Value }, 0 }}, diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index ec31fad..5684121 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -560,8 +560,8 @@ static const XclFunctionInfo saFuncTable_2013[] = EXC_FUNCENTRY_V_VR( ocRRI, 3, 3, 0, "RRI" ), EXC_FUNCENTRY_V_VR_IMPORT( ocSecant, 1, 1, 0, "SEC" ), EXC_FUNCENTRY_V_VR_IMPORT( ocSecantHyp, 1, 1, 0, "SECH" ), - EXC_FUNCENTRY_V_RO( ocTable, 0, 1, 0, "SHEET" ), - EXC_FUNCENTRY_V_RO( ocTables, 0, 1, 0, "SHEETS" ), + EXC_FUNCENTRY_V_RO( ocSheet, 0, 1, 0, "SHEET" ), + EXC_FUNCENTRY_V_RO( ocSheets, 0, 1, 0, "SHEETS" ), EXC_FUNCENTRY_V_RX( ocSkewp, 1, MX, 0, "SKEW.P" ), EXC_FUNCENTRY_V_VR( ocUnichar, 1, 1, 0, "UNICHAR" ), EXC_FUNCENTRY_V_VR( ocUnicode, 1, 1, 0, "UNICODE" ), diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx index a63eed1..21249ea 100644 --- a/sc/source/filter/qpro/qproform.cxx +++ b/sc/source/filter/qpro/qproform.cxx @@ -526,7 +526,7 @@ static const struct { ocNoName, FT_NOP }, // 151 { ocNoName, FT_NOP }, // 152 { ocNoName, FT_NOP }, // 153 - { ocTable, FT_FuncFix1 }, + { ocSheet, FT_FuncFix1 }, { ocNoName, FT_NOP }, // 155 - opcodes do not represent any function. { ocNoName, FT_NOP }, // 156 { ocIndex, FT_FuncFix4 }, diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index 1e7be9b..1bb371e 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -9979,7 +9979,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; }; // -=*# Resource for function SHEET #*=- - Resource SC_OPCODE_TABLE + Resource SC_OPCODE_SHEET { String 1 // Description { @@ -10051,7 +10051,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; }; // -=*# Resource for function SHEETS #*=- - Resource SC_OPCODE_TABLES + Resource SC_OPCODE_SHEETS { String 1 // Description { commit 962e14e94d081e587c554e762910c0983f6a139b Author: Eike Rathke <er...@redhat.com> Date: Tue Mar 3 14:13:47 2015 +0100 introduce SC_OPCODE_TABLE_REF / ocTableRef Change-Id: I74cd756fe41b75791f7c2665373e33aec04b1eee diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc index dbbea90..2081b09 100644 --- a/include/formula/compiler.hrc +++ b/include/formula/compiler.hrc @@ -42,16 +42,17 @@ #define SC_OPCODE_SPACES 16 #define SC_OPCODE_MAT_REF 17 #define SC_OPCODE_DB_AREA 18 /* additional access operators */ -#define SC_OPCODE_MACRO 19 -#define SC_OPCODE_COL_ROW_NAME 20 -#define SC_OPCODE_COL_ROW_NAME_AUTO 21 -#define SC_OPCODE_PERCENT_SIGN 22 /* operator _follows_ value */ -#define SC_OPCODE_ARRAY_OPEN 23 -#define SC_OPCODE_ARRAY_CLOSE 24 -#define SC_OPCODE_ARRAY_ROW_SEP 25 -#define SC_OPCODE_ARRAY_COL_SEP 26 /* some convs use sep != col_sep */ -#define SC_OPCODE_STOP_DIV 27 -#define SC_OPCODE_SKIP 28 /* used to skip raw tokens during string compilation */ +#define SC_OPCODE_TABLE_REF 19 +#define SC_OPCODE_MACRO 20 +#define SC_OPCODE_COL_ROW_NAME 21 +#define SC_OPCODE_COL_ROW_NAME_AUTO 22 +#define SC_OPCODE_PERCENT_SIGN 23 /* operator _follows_ value */ +#define SC_OPCODE_ARRAY_OPEN 24 +#define SC_OPCODE_ARRAY_CLOSE 25 +#define SC_OPCODE_ARRAY_ROW_SEP 26 +#define SC_OPCODE_ARRAY_COL_SEP 27 /* some convs use sep != col_sep */ +#define SC_OPCODE_STOP_DIV 28 +#define SC_OPCODE_SKIP 29 /* used to skip raw tokens during string compilation */ /*** error constants #... ***/ #define SC_OPCODE_START_ERRORS 30 diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx index 3a2af3a..8c578c5 100644 --- a/include/formula/opcode.hxx +++ b/include/formula/opcode.hxx @@ -54,6 +54,7 @@ enum OpCode : sal_uInt16 ocSkip = SC_OPCODE_SKIP, // Access commands ocDBArea = SC_OPCODE_DB_AREA, + ocTableRef = SC_OPCODE_TABLE_REF, ocMacro = SC_OPCODE_MACRO, ocColRowName = SC_OPCODE_COL_ROW_NAME, ocColRowNameAuto = SC_OPCODE_COL_ROW_NAME_AUTO, commit b68987558068f88fa8016e5bd2d62f57d27d0c19 Author: Eike Rathke <er...@redhat.com> Date: Mon Mar 2 16:11:01 2015 +0100 remove SC_START_INDEX_DB_COLL binary file format legacy There's no ocName that should be ocDBArea instead anymore. Change-Id: Idbbb62330bfdc5c4e83f99436490e12d90cfd1d4 diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 85bb412..2c6c612 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -71,10 +71,6 @@ const sal_Unicode CHAR_ZWNBSP = 0x2060; const SCSIZE MAXSUBTOTAL = 3; -#define SC_START_INDEX_DB_COLL 50000 - // Above this threshold are indices - // for data base areas - #define SC_USE_PS_POINTS 1 /**< use PostScript points (72ppi) instead of old TeX points (72.27ppi) */ #define PIXEL_PER_INCH 96.0 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index d4bba7d..1d6ee1e 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3568,8 +3568,7 @@ void ScFormulaCell::CompileDBFormula( sc::CompileFormulaContext& rCxt ) { for( FormulaToken* p = pCode->First(); p; p = pCode->Next() ) { - if ( p->GetOpCode() == ocDBArea - || (p->GetOpCode() == ocName && p->GetIndex() >= SC_START_INDEX_DB_COLL) ) + if ( p->GetOpCode() == ocDBArea ) { bCompile = true; CompileTokenArray(rCxt); diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index 8a04a9c..e9299e3 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -801,7 +801,7 @@ bool ScDBCollection::AnonDBs::operator== (const AnonDBs& r) const } ScDBCollection::ScDBCollection(ScDocument* pDocument) : - pDoc(pDocument), nEntryIndex(SC_START_INDEX_DB_COLL), maNamedDBs(*this, *pDocument) {} + pDoc(pDocument), nEntryIndex(1), maNamedDBs(*this, *pDocument) {} ScDBCollection::ScDBCollection(const ScDBCollection& r) : pDoc(r.pDoc), nEntryIndex(r.nEntryIndex), maNamedDBs(r.maNamedDBs), maAnonDBs(r.maAnonDBs) {} commit 8d78888a0c62641284d5e5fbe42cb3b950e22683 Author: Eike Rathke <er...@redhat.com> Date: Mon Mar 2 14:09:34 2015 +0100 rename confusing HandleSingleRef() to more appropriate HandleColRowName() Change-Id: Ib2e6d5cd9863ac1f9b0ba9b192f5d17d489ed19f diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index f81a97b..37231a8 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1103,7 +1103,7 @@ bool FormulaCompiler::GetToken() } else if( mpToken->GetOpCode() == ocColRowName ) { - return HandleSingleRef(); + return HandleColRowName(); } else if( mpToken->GetOpCode() == ocDBArea ) { @@ -2089,7 +2089,7 @@ bool FormulaCompiler::HandleRange() return true; } -bool FormulaCompiler::HandleSingleRef() +bool FormulaCompiler::HandleColRowName() { return true; } diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx index 0758dda..adf593c 100644 --- a/include/formula/FormulaCompiler.hxx +++ b/include/formula/FormulaCompiler.hxx @@ -280,7 +280,7 @@ protected: virtual FormulaTokenRef ExtendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2, bool bReuseDoubleRef ); virtual bool HandleExternalReference(const FormulaToken& _aToken); virtual bool HandleRange(); - virtual bool HandleSingleRef(); + virtual bool HandleColRowName(); virtual bool HandleDbData(); virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* pTokenP) const; diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 6fb4b1b..5838a5a 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -451,7 +451,7 @@ private: virtual bool HandleExternalReference(const formula::FormulaToken& _aToken) SAL_OVERRIDE; virtual bool HandleRange() SAL_OVERRIDE; - virtual bool HandleSingleRef() SAL_OVERRIDE; + virtual bool HandleColRowName() SAL_OVERRIDE; virtual bool HandleDbData() SAL_OVERRIDE; virtual formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, bool bReuseDoubleRef ) SAL_OVERRIDE; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 84611ee..8d32278 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4363,7 +4363,7 @@ void ScCompiler::fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaO // FIXME: what about those old non-UNO AddIns? } -bool ScCompiler::HandleSingleRef() +bool ScCompiler::HandleColRowName() { ScSingleRefData& rRef = *mpToken.get()->GetSingleRef(); ScAddress aAbs = rRef.toAbs(aPos); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits