summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-01-08 10:47:13 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-01-08 10:47:13 +0000
commit87307aba9e8dbca16672e6df701d9f905b9e1786 (patch)
treec4c94029c34c3a5dc7e0ed2d6cee8cebc5d31e6b /sc/inc
parentb142ca03365a5a5bfd8487fda9bfeea2e6db0d0b (diff)
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05 2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF: Add GAMMA, CHISQDIST, CHISQINV. Make the 'cumulative' parameter of GAMMADIST optional. Adapt the domain of CHIDIST to allow negative x. Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV. Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and ODFF if omitted, for backwards compatibility. 2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37) 2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula 2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula 2008-12-12 13:22:00 +0100 msc r265413 : #i97089# 2008-12-12 13:20:25 +0100 msc r265412 : #i97089# 2008-12-12 12:35:12 +0100 msc r265406 : #i97089# 2008-12-12 12:34:16 +0100 msc r265405 : #i97089# 2008-12-12 12:33:05 +0100 msc r265404 : #i97089# 2008-12-12 12:31:11 +0100 msc r265403 : #i97089# 2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG 2008-12-08 11:50:17 +0100 oj r264980 : some small changes 2008-12-05 12:57:57 +0100 oj r264902 : eof changed 2008-12-05 12:56:46 +0100 oj r264901 : eof changed 2008-12-05 12:28:47 +0100 oj r264899 : wrong var used 2008-12-05 10:08:57 +0100 oj r264890 : token order reversed 2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage 2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id 2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button 2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button 2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends 2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends 2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends 2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set 2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category 2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids 2008-12-01 14:36:43 +0100 oj r264604 : use temp var 2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula 2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula 2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc 2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select 2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void 2008-11-28 11:16:48 +0100 oj r264532 : add help ids 2008-11-28 10:16:56 +0100 oj r264529 : set help id 2008-11-28 10:16:43 +0100 oj r264528 : set help id 2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes 2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug 2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them 2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code 2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code 2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline 2008-11-21 12:35:27 +0100 oj r264124 : hold symbols 2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost 2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove 2008-11-19 20:37:41 +0100 oj r264021 : removed unused var 2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token 2008-11-19 10:59:47 +0100 oj r263967 : deleted 2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files 2008-11-18 15:27:36 +0100 oj r263777 : unused para removed 2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg 2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting 2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef 2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling 2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file 2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula 2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction 2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35 2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35 2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35 2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35 2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35 2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35 2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35 2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35 2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35 2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35 2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved 2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target 2008-10-07 10:08:39 +0200 oj r262077 : copy 2008-10-07 09:45:31 +0200 oj r262076 : #i94535# 2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class 2008-10-07 09:43:21 +0200 oj r262074 : moved to formula 2008-10-07 09:41:51 +0200 oj r262073 : new images 2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula 2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula 2008-10-02 08:08:54 +0200 oj r262023 : #i94535# 2008-10-02 08:06:28 +0200 oj r262022 : #i94535# 2008-10-02 08:05:52 +0200 oj r262021 : #i94535# 2008-10-01 17:15:29 +0200 oj r262014 : #i94535# 2008-10-01 17:12:40 +0200 oj r262013 : new module formula 2008-10-01 17:04:55 +0200 oj r262012 : #i94535# 2008-10-01 16:49:03 +0200 oj r262010 : #i94535# 2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/address.hxx24
-rw-r--r--sc/inc/cell.hxx31
-rw-r--r--sc/inc/cellsuno.hxx9
-rw-r--r--sc/inc/column.hxx2
-rw-r--r--sc/inc/compiler.hrc413
-rw-r--r--sc/inc/compiler.hxx357
-rw-r--r--sc/inc/conditio.hxx12
-rw-r--r--sc/inc/dbtoken.hxx4
-rw-r--r--sc/inc/document.hxx20
-rw-r--r--sc/inc/errorcodes.hxx115
-rw-r--r--sc/inc/fmtuno.hxx16
-rw-r--r--sc/inc/formularesult.hxx136
-rw-r--r--sc/inc/funcdesc.hxx111
-rw-r--r--sc/inc/grammar.hxx218
-rw-r--r--sc/inc/intruref.hxx97
-rw-r--r--sc/inc/lookupcache.hxx3
-rw-r--r--sc/inc/nameuno.hxx6
-rw-r--r--sc/inc/opcode.hxx414
-rw-r--r--sc/inc/rangelst.hxx4
-rw-r--r--sc/inc/rangenam.hxx10
-rw-r--r--sc/inc/refdata.hxx5
-rw-r--r--sc/inc/reffind.hxx4
-rw-r--r--sc/inc/sc.hrc15
-rw-r--r--sc/inc/scmatrix.hxx8
-rw-r--r--sc/inc/scmod.hxx4
-rw-r--r--sc/inc/token.hxx486
-rw-r--r--sc/inc/tokenarray.hxx230
-rw-r--r--sc/inc/tokenuno.hxx41
-rw-r--r--sc/inc/validat.hxx2
29 files changed, 360 insertions, 2437 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index b3cb45a316f6..4c9abc4df4a7 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -43,6 +43,7 @@
#define INCLUDED_LIMITS
#endif
#include "scdllapi.h"
+#include <formula/grammar.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -259,34 +260,21 @@ public:
enum Uninitialized { UNINITIALIZED };
enum InitializeInvalid { INITIALIZE_INVALID };
- enum Convention {
- CONV_UNSPECIFIED = -1, /* useful when we want method to chose, must be first */
- /* elements must be sequential and changes should be reflected in ScCompiler::pCharTables */
- CONV_OOO = 0, /* 'doc'#sheet.A1:sheet2.B2 */
- CONV_ODF, /* ['doc'#sheet.A1:sheet2.B2] */
- CONV_XL_A1, /* [doc]sheet:sheet2!A1:B2 */
- CONV_XL_R1C1, /* [doc]sheet:sheet2!R1C1:R2C2 */
- CONV_XL_OOX, /* [#]sheet:sheet2!A1:B2 */
-
- CONV_LOTUS_A1, /* external? 3d? A1.B2 <placeholder/> */
-
- CONV_LAST /* for loops, must always be last */
- };
struct Details {
- Convention eConv;
+ formula::FormulaGrammar::AddressConvention eConv;
SCROW nRow;
SCCOL nCol;
- inline Details( Convention eConvP, SCROW nRowP, SCCOL nColP )
+ inline Details( formula::FormulaGrammar::AddressConvention eConvP, SCROW nRowP, SCCOL nColP )
: eConv( eConvP ), nRow( nRowP ), nCol( nColP )
{}
- inline Details( Convention eConvP, ScAddress const & rAddr )
+ inline Details( formula::FormulaGrammar::AddressConvention eConvP, ScAddress const & rAddr )
: eConv( eConvP ), nRow( rAddr.Row() ), nCol( rAddr.Col() )
{}
- inline Details( Convention eConvP)
+ inline Details( formula::FormulaGrammar::AddressConvention eConvP)
: eConv( eConvP ), nRow( 0 ), nCol( 0 )
{}
- /* Use the convention associated with rAddr::Tab() */
+ /* Use the formula::FormulaGrammar::AddressConvention associated with rAddr::Tab() */
Details( const ScDocument* pDoc, const ScAddress & rAddr );
void SetPos( const ScDocument* pDoc, const ScAddress & rAddr );
};
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 81250f73165f..d0ec651c41ed 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -37,8 +37,8 @@
#include <tools/mempool.hxx>
#include <svtools/listener.hxx>
#include "global.hxx"
+#include "formula/grammar.hxx"
#include "tokenarray.hxx"
-#include "grammar.hxx"
#include "formularesult.hxx"
#include <rtl/ustrbuf.hxx>
#include <vcl/fontcvt.hxx>
@@ -56,7 +56,6 @@ class EditTextObject;
class ScMatrix;
class SvtBroadcaster;
class ScCodeArray;
-class ScTokenArray;
class ScProgress;
class ScPostIt;
@@ -111,7 +110,7 @@ public:
/** Error code if ScFormulaCell, else 0. */
USHORT GetErrorCode() const;
- /** ScFormulaCell with svEmptyCell result, or ScNoteCell (may have been
+ /** ScFormulaCell with formula::svEmptyCell result, or ScNoteCell (may have been
created due to reference to empty cell). */
BOOL HasEmptyData() const;
BOOL HasValueData() const;
@@ -220,7 +219,7 @@ class SC_DLLPUBLIC ScFormulaCell : public ScBaseCell, public SvtListener
{
private:
ScFormulaResult aResult;
- ScGrammar::Grammar eTempGrammar; // used between string (creation) and (re)compilation
+ formula::FormulaGrammar::Grammar eTempGrammar; // used between string (creation) and (re)compilation
ScTokenArray* pCode; // The (new) token array
ScDocument* pDocument;
ScFormulaCell* pPrevious;
@@ -262,16 +261,16 @@ public:
/** Empty formula cell, or with a preconstructed token array. */
ScFormulaCell( ScDocument*, const ScAddress&, const ScTokenArray* = NULL,
- const ScGrammar::Grammar = ScGrammar::GRAM_DEFAULT,
+ const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT,
BYTE = MM_NONE );
/** With formula string and grammar to compile with.
- ScGrammar::GRAM_DEFAULT effectively is ScGrammar::GRAM_NATIVE_UI that
- also includes ScAddress::CONV_UNSPECIFIED, therefor uses the address
+ formula::FormulaGrammar::GRAM_DEFAULT effectively isformula::FormulaGrammar::GRAM_NATIVE_UI that
+ also includes formula::FormulaGrammar::CONV_UNSPECIFIED, therefor uses the address
convention associated with rPos::nTab by default. */
ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
const String& rFormula,
- const ScGrammar::Grammar = ScGrammar::GRAM_DEFAULT,
+ const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT,
BYTE cMatInd = MM_NONE );
// copy-ctor
@@ -285,9 +284,9 @@ public:
BOOL bNoListening = FALSE ) const;
void GetFormula( String& rFormula,
- const ScGrammar::Grammar = ScGrammar::GRAM_DEFAULT ) const;
+ const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
void GetFormula( rtl::OUStringBuffer& rBuffer,
- const ScGrammar::Grammar = ScGrammar::GRAM_DEFAULT ) const;
+ const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
void SetDirty();
inline void SetDirtyVar() { bDirty = TRUE; }
@@ -301,7 +300,7 @@ public:
void SetNeedsListening( BOOL bVar ) { bNeedListening = bVar; }
void Compile(const String& rFormula,
BOOL bNoListening = FALSE,
- const ScGrammar::Grammar = ScGrammar::GRAM_DEFAULT );
+ const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT );
void CompileTokenArray( BOOL bNoListening = FALSE );
void CompileXML( ScProgress& rProgress ); // compile temporary string tokens
void CalcAfterLoad();
@@ -337,10 +336,10 @@ public:
BOOL IsSubTotal() const { return bSubTotal; }
BOOL IsChanged() const { return bChanged; }
void ResetChanged() { bChanged = FALSE; }
- BOOL IsEmpty(); // svEmptyCell result
- // display as empty string if svEmptyCell result
+ BOOL IsEmpty(); // formula::svEmptyCell result
+ // display as empty string if formula::svEmptyCell result
BOOL IsEmptyDisplayedAsString();
- BOOL IsValue(); // also TRUE if svEmptyCell
+ BOOL IsValue(); // also TRUE if formula::svEmptyCell
double GetValue();
double GetValueAlways(); // ignore errors
void GetString( String& rString );
@@ -388,7 +387,7 @@ public:
ULONG GetStandardFormat( SvNumberFormatter& rFormatter, ULONG nFormat ) const;
// For import filters!
- void AddRecalcMode( ScRecalcMode );
+ void AddRecalcMode( formula::ScRecalcMode );
/** For import only: set a double result. */
void SetHybridDouble( double n ) { aResult.SetHybridDouble( n); }
/** For import only: set a string result.
@@ -402,7 +401,7 @@ public:
SetHybridString() or SetHybridFormula(), use SetHybridDouble() first
for performance reasons.*/
void SetHybridFormula( const String& r,
- const ScGrammar::Grammar eGrammar )
+ const formula::FormulaGrammar::Grammar eGrammar )
{ aResult.SetHybridFormula( r); eTempGrammar = eGrammar; }
void SetErrCode( USHORT n );
inline BOOL IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); }
diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index be44ba964fbb..628e45bc5624 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -34,7 +34,7 @@
#include "global.hxx" // ScRange, ScAddress
#include "rangelst.hxx" // ScRangeList
-#include "grammar.hxx"
+#include "formula/grammar.hxx"
#include <svtools/lstner.hxx>
#include <svtools/listener.hxx>
#include <svtools/itemprop.hxx>
@@ -95,7 +95,6 @@
#include <com/sun/star/sheet/XExternalSheetName.hpp>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
-#include "scdllapi.h"
#ifndef __SGI_STL_VECTOR
#include <vector>
@@ -625,7 +624,7 @@ protected:
::com::sun::star::uno::RuntimeException);
void SetArrayFormula_Impl( const rtl::OUString& aFormula,
- const ScGrammar::Grammar eGrammar )
+ const formula::FormulaGrammar::Grammar eGrammar )
throw(::com::sun::star::uno::RuntimeException);
public:
@@ -646,7 +645,7 @@ public:
// via getImplementation()
virtual void SetArrayFormulaWithGrammar( const ::rtl::OUString& aFormula,
- const ScGrammar::Grammar )
+ const formula::FormulaGrammar::Grammar )
throw(::com::sun::star::uno::RuntimeException);
// XCellRange ist Basisklasse von XSheetCellRange und XSheetOperation
@@ -863,7 +862,7 @@ public:
void SetFormulaResultString( const ::rtl::OUString& rResult );
void SetFormulaResultDouble( double fResult );
void SetFormulaWithGrammar( const ::rtl::OUString& rFormula,
- const ScGrammar::Grammar );
+ const formula::FormulaGrammar::Grammar );
const ScAddress& GetPosition() const { return aCellPos; }
// XText
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index becced059802..6f613943c2ba 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -241,7 +241,7 @@ public:
// TRUE = Zahlformat gesetzt
BOOL SetString( SCROW nRow, SCTAB nTab, const String& rString,
- ScAddress::Convention conv = ScAddress::CONV_OOO );
+ formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO );
void SetValue( SCROW nRow, const double& rVal);
void SetNote( SCROW nRow, const ScPostIt& rNote );
void SetError( SCROW nRow, const USHORT nError);
diff --git a/sc/inc/compiler.hrc b/sc/inc/compiler.hrc
deleted file mode 100644
index af4b03606285..000000000000
--- a/sc/inc/compiler.hrc
+++ /dev/null
@@ -1,413 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: compiler.hrc,v $
- * $Revision: 1.20.134.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_COMPILER_HRC
-#define SC_COMPILER_HRC
-
-/* Central definition of OpCodes for spreadsheet functions */
-
-/*** Special commands ***/
-#define SC_OPCODE_PUSH 0 /* internal commands */
-#define SC_OPCODE_CALL 1
-#define SC_OPCODE_STOP 2
-#define SC_OPCODE_EXTERNAL 3
-#define SC_OPCODE_NAME 4
-#define SC_OPCODE_EXTERNAL_REF 5
-#define SC_OPCODE_IF 6 /* jump commands */
-#define SC_OPCODE_CHOSE 7
-#define SC_OPCODE_OPEN 8 /* parentheses and separators */
-#define SC_OPCODE_CLOSE 9
-#define SC_OPCODE_SEP 10
-#define SC_OPCODE_MISSING 11 /* special OpCodes */
-#define SC_OPCODE_BAD 12
-#define SC_OPCODE_SPACES 13
-#define SC_OPCODE_MAT_REF 14
-#define SC_OPCODE_DB_AREA 15 /* additional access operators */
-#define SC_OPCODE_MACRO 16
-#define SC_OPCODE_COL_ROW_NAME 17
-#define SC_OPCODE_COL_ROW_NAME_AUTO 18
-#define SC_OPCODE_PERCENT_SIGN 19 /* operator _follows_ value */
-#define SC_OPCODE_ARRAY_OPEN 20
-#define SC_OPCODE_ARRAY_CLOSE 21
-#define SC_OPCODE_ARRAY_ROW_SEP 22
-#define SC_OPCODE_ARRAY_COL_SEP 23 /* some convs use sep != col_sep */
-#define SC_OPCODE_STOP_DIV 24
-
-/*** error constants #... ***/
-#define SC_OPCODE_START_ERRORS 30
-#define SC_OPCODE_ERROR_NULL 30
-#define SC_OPCODE_ERROR_DIVZERO 31
-#define SC_OPCODE_ERROR_VALUE 32
-#define SC_OPCODE_ERROR_REF 33
-#define SC_OPCODE_ERROR_NAME 34
-#define SC_OPCODE_ERROR_NUM 35
-#define SC_OPCODE_ERROR_NA 36
-#define SC_OPCODE_STOP_ERRORS 37
-
-/*** Binary operators ***/
-#define SC_OPCODE_START_BIN_OP 40
-#define SC_OPCODE_ADD 40
-#define SC_OPCODE_SUB 41
-#define SC_OPCODE_MUL 42
-#define SC_OPCODE_DIV 43
-#define SC_OPCODE_AMPERSAND 44
-#define SC_OPCODE_POW 45
-#define SC_OPCODE_EQUAL 46
-#define SC_OPCODE_NOT_EQUAL 47
-#define SC_OPCODE_LESS 48
-#define SC_OPCODE_GREATER 49
-#define SC_OPCODE_LESS_EQUAL 50
-#define SC_OPCODE_GREATER_EQUAL 51
-#define SC_OPCODE_AND 52
-#define SC_OPCODE_OR 53
-#define SC_OPCODE_INTERSECT 54
-#define SC_OPCODE_UNION 55
-#define SC_OPCODE_RANGE 56
-#define SC_OPCODE_STOP_BIN_OP 57
-
-/* NOTE: binary and unary operators must be in sequence for compiler! */
-
-/*** Unary operators ***/
-#define SC_OPCODE_START_UN_OP 60
-#define SC_OPCODE_NOT 60
-#define SC_OPCODE_NEG 61
-#define SC_OPCODE_NEG_SUB 62
-#define SC_OPCODE_STOP_UN_OP 63
-
-/*** Functions without parameters ***/
-#define SC_OPCODE_START_NO_PAR 65
-#define SC_OPCODE_PI 65
-#define SC_OPCODE_RANDOM 66
-#define SC_OPCODE_TRUE 67
-#define SC_OPCODE_FALSE 68
-#define SC_OPCODE_GET_ACT_DATE 69
-#define SC_OPCODE_GET_ACT_TIME 70
-#define SC_OPCODE_NO_VALUE 71
-#define SC_OPCODE_CURRENT 72
-#define SC_OPCODE_STOP_NO_PAR 73
-
-/*** Functions with one parameter ***/
-#define SC_OPCODE_START_1_PAR 80
-#define SC_OPCODE_DEG 80 /* trigonometric */
-#define SC_OPCODE_RAD 81
-#define SC_OPCODE_SIN 82
-#define SC_OPCODE_COS 83
-#define SC_OPCODE_TAN 84
-#define SC_OPCODE_COT 85
-#define SC_OPCODE_ARC_SIN 86
-#define SC_OPCODE_ARC_COS 87
-#define SC_OPCODE_ARC_TAN 88
-#define SC_OPCODE_ARC_COT 89
-#define SC_OPCODE_SIN_HYP 90
-#define SC_OPCODE_COS_HYP 91
-#define SC_OPCODE_TAN_HYP 92
-#define SC_OPCODE_COT_HYP 93
-#define SC_OPCODE_ARC_SIN_HYP 94 /* transcendent */
-#define SC_OPCODE_ARC_COS_HYP 95
-#define SC_OPCODE_ARC_TAN_HYP 96
-#define SC_OPCODE_ARC_COT_HYP 97
-#define SC_OPCODE_EXP 98
-#define SC_OPCODE_LN 99
-#define SC_OPCODE_SQRT 100
-#define SC_OPCODE_FACT 101
-#define SC_OPCODE_GET_YEAR 102 /* date and time */
-#define SC_OPCODE_GET_MONTH 103
-#define SC_OPCODE_GET_DAY 104
-#define SC_OPCODE_GET_HOUR 105
-#define SC_OPCODE_GET_MIN 106
-#define SC_OPCODE_GET_SEC 107
-#define SC_OPCODE_PLUS_MINUS 108 /* miscellaneous */
-#define SC_OPCODE_ABS 109
-#define SC_OPCODE_INT 110
-#define SC_OPCODE_PHI 111
-#define SC_OPCODE_GAUSS 112
-#define SC_OPCODE_IS_EMPTY 113 /* obtain type */
-#define SC_OPCODE_IS_STRING 114
-#define SC_OPCODE_IS_NON_STRING 115
-#define SC_OPCODE_IS_LOGICAL 116
-#define SC_OPCODE_TYPE 117
-#define SC_OPCODE_IS_REF 118
-#define SC_OPCODE_IS_VALUE 119
-#define SC_OPCODE_IS_FORMULA 120
-#define SC_OPCODE_IS_NV 121
-#define SC_OPCODE_IS_ERR 122
-#define SC_OPCODE_IS_ERROR 123
-#define SC_OPCODE_IS_EVEN 124
-#define SC_OPCODE_IS_ODD 125
-#define SC_OPCODE_N 126
-#define SC_OPCODE_GET_DATE_VALUE 127 /* string functions */
-#define SC_OPCODE_GET_TIME_VALUE 128
-#define SC_OPCODE_CODE 129
-#define SC_OPCODE_TRIM 130
-#define SC_OPCODE_UPPER 131
-#define SC_OPCODE_PROPPER 132
-#define SC_OPCODE_LOWER 133
-#define SC_OPCODE_LEN 134
-#define SC_OPCODE_T 135 /* miscellaneous, part 21 */
-#define SC_OPCODE_VALUE 136
-#define SC_OPCODE_CLEAN 137
-#define SC_OPCODE_CHAR 138
-#define SC_OPCODE_LOG10 139
-#define SC_OPCODE_EVEN 140
-#define SC_OPCODE_ODD 141
-#define SC_OPCODE_STD_NORM_DIST 142
-#define SC_OPCODE_FISHER 143
-#define SC_OPCODE_FISHER_INV 144
-#define SC_OPCODE_S_NORM_INV 145
-#define SC_OPCODE_GAMMA_LN 146
-#define SC_OPCODE_ERROR_TYPE 147
-#define SC_OPCODE_ERR_CELL 148
-#define SC_OPCODE_FORMULA 149
-#define SC_OPCODE_ARABIC 150
-#define SC_OPCODE_INFO 151
-#define SC_OPCODE_BAHTTEXT 152
-#define SC_OPCODE_JIS 153
-#define SC_OPCODE_ASC 154
-#define SC_OPCODE_UNICODE 155
-#define SC_OPCODE_UNICHAR 156
-#define SC_OPCODE_GAMMA 157
-#define SC_OPCODE_STOP_1_PAR 158
-
-/*** Functions with more than one parameters ***/
-#define SC_OPCODE_START_2_PAR 201
-#define SC_OPCODE_ARC_TAN_2 201
-#define SC_OPCODE_CEIL 202
-#define SC_OPCODE_FLOOR 203
-#define SC_OPCODE_ROUND 204
-#define SC_OPCODE_ROUND_UP 205
-#define SC_OPCODE_ROUND_DOWN 206
-#define SC_OPCODE_TRUNC 207
-#define SC_OPCODE_LOG 208
-#define SC_OPCODE_POWER 209
-#define SC_OPCODE_GGT 210
-#define SC_OPCODE_KGV 211
-#define SC_OPCODE_MOD 212
-#define SC_OPCODE_SUM_PRODUCT 213
-#define SC_OPCODE_SUM_SQ 214
-#define SC_OPCODE_SUM_X2MY2 215
-#define SC_OPCODE_SUM_X2DY2 216
-#define SC_OPCODE_SUM_XMY2 217
-#define SC_OPCODE_GET_DATE 218
-#define SC_OPCODE_GET_TIME 219
-#define SC_OPCODE_GET_DIFF_DATE 220
-#define SC_OPCODE_GET_DIFF_DATE_360 221
-#define SC_OPCODE_MIN 222
-#define SC_OPCODE_MAX 223
-#define SC_OPCODE_SUM 224
-#define SC_OPCODE_PRODUCT 225
-#define SC_OPCODE_AVERAGE 226
-#define SC_OPCODE_COUNT 227
-#define SC_OPCODE_COUNT_2 228
-#define SC_OPCODE_NBW 229
-#define SC_OPCODE_IKV 230
-#define SC_OPCODE_VAR 231
-#define SC_OPCODE_VAR_P 232
-#define SC_OPCODE_ST_DEV 233
-#define SC_OPCODE_ST_DEV_P 234
-#define SC_OPCODE_B 235
-#define SC_OPCODE_NORM_DIST 236
-#define SC_OPCODE_EXP_DIST 237
-#define SC_OPCODE_BINOM_DIST 238
-#define SC_OPCODE_POISSON_DIST 239
-#define SC_OPCODE_KOMBIN 240
-#define SC_OPCODE_KOMBIN_2 241
-#define SC_OPCODE_VARIATIONEN 242
-#define SC_OPCODE_VARIATIONEN_2 243
-#define SC_OPCODE_BW 244
-#define SC_OPCODE_DIA 245
-#define SC_OPCODE_GDA 246
-#define SC_OPCODE_GDA_2 247
-#define SC_OPCODE_VBD 248
-#define SC_OPCODE_LAUFZ 249
-#define SC_OPCODE_LIA 250
-#define SC_OPCODE_RMZ 251
-#define SC_OPCODE_COLUMNS 252
-#define SC_OPCODE_ROWS 253
-#define SC_OPCODE_COLUMN 254
-#define SC_OPCODE_ROW 255
-#define SC_OPCODE_ZGZ 256
-#define SC_OPCODE_ZW 257
-#define SC_OPCODE_ZZR 258
-#define SC_OPCODE_ZINS 259
-#define SC_OPCODE_ZINS_Z 260
-#define SC_OPCODE_KAPZ 261
-#define SC_OPCODE_KUM_ZINS_Z 262
-#define SC_OPCODE_KUM_KAP_Z 263
-#define SC_OPCODE_EFFEKTIV 264
-#define SC_OPCODE_NOMINAL 265
-#define SC_OPCODE_SUB_TOTAL 266
-#define SC_OPCODE_DB_SUM 267 /* database functions */
-#define SC_OPCODE_DB_COUNT 268
-#define SC_OPCODE_DB_COUNT_2 269
-#define SC_OPCODE_DB_AVERAGE 270
-#define SC_OPCODE_DB_GET 271
-#define SC_OPCODE_DB_MAX 272
-#define SC_OPCODE_DB_MIN 273
-#define SC_OPCODE_DB_PRODUCT 274
-#define SC_OPCODE_DB_STD_DEV 275
-#define SC_OPCODE_DB_STD_DEV_P 276
-#define SC_OPCODE_DB_VAR 277
-#define SC_OPCODE_DB_VAR_P 278
-#define SC_OPCODE_INDIRECT 279 /* management functions */
-#define SC_OPCODE_ADDRESS 280
-#define SC_OPCODE_MATCH 281
-#define SC_OPCODE_COUNT_EMPTY_CELLS 282
-#define SC_OPCODE_COUNT_IF 283
-#define SC_OPCODE_SUM_IF 284
-#define SC_OPCODE_LOOKUP 285
-#define SC_OPCODE_V_LOOKUP 286
-#define SC_OPCODE_H_LOOKUP 287
-#define SC_OPCODE_MULTI_AREA 288
-#define SC_OPCODE_OFFSET 289
-#define SC_OPCODE_INDEX 290
-#define SC_OPCODE_AREAS 291
-#define SC_OPCODE_CURRENCY 292 /* string functions */
-#define SC_OPCODE_REPLACE 293
-#define SC_OPCODE_FIXED 294
-#define SC_OPCODE_FIND 295
-#define SC_OPCODE_EXACT 296
-#define SC_OPCODE_LEFT 297
-#define SC_OPCODE_RIGHT 298
-#define SC_OPCODE_SEARCH 299
-#define SC_OPCODE_MID 300
-#define SC_OPCODE_TEXT 301
-#define SC_OPCODE_SUBSTITUTE 302
-#define SC_OPCODE_REPT 303
-#define SC_OPCODE_CONCAT 304
-#define SC_OPCODE_MAT_VALUE 305 /* matrix functions */
-#define SC_OPCODE_MAT_DET 306
-#define SC_OPCODE_MAT_INV 307
-#define SC_OPCODE_MAT_MULT 308
-#define SC_OPCODE_MAT_TRANS 309
-#define SC_OPCODE_MATRIX_UNIT 310
-#define SC_OPCODE_BACK_SOLVER 311 /* BackSolver */
-#define SC_OPCODE_HYP_GEOM_DIST 312 /* statistical functions */
-#define SC_OPCODE_LOG_NORM_DIST 313
-#define SC_OPCODE_T_DIST 314
-#define SC_OPCODE_F_DIST 315
-#define SC_OPCODE_CHI_DIST 316
-#define SC_OPCODE_WEIBULL 317
-#define SC_OPCODE_NEG_BINOM_VERT 318
-#define SC_OPCODE_KRIT_BINOM 319
-#define SC_OPCODE_KURT 320
-#define SC_OPCODE_HAR_MEAN 321
-#define SC_OPCODE_GEO_MEAN 322
-#define SC_OPCODE_STANDARD 323
-#define SC_OPCODE_AVE_DEV 324
-#define SC_OPCODE_SCHIEFE 325
-#define SC_OPCODE_DEV_SQ 326
-#define SC_OPCODE_MEDIAN 327
-#define SC_OPCODE_MODAL_VALUE 328
-#define SC_OPCODE_Z_TEST 329
-#define SC_OPCODE_T_TEST 330
-#define SC_OPCODE_RANK 331
-#define SC_OPCODE_PERCENTILE 332
-#define SC_OPCODE_PERCENT_RANK 333
-#define SC_OPCODE_LARGE 334
-#define SC_OPCODE_SMALL 335
-#define SC_OPCODE_FREQUENCY 336
-#define SC_OPCODE_QUARTILE 337
-#define SC_OPCODE_NORM_INV 338
-#define SC_OPCODE_CONFIDENCE 339
-#define SC_OPCODE_F_TEST 340
-#define SC_OPCODE_TRIM_MEAN 341
-#define SC_OPCODE_PROB 342
-#define SC_OPCODE_CORREL 343
-#define SC_OPCODE_COVAR 344
-#define SC_OPCODE_PEARSON 345
-#define SC_OPCODE_RSQ 346
-#define SC_OPCODE_STEYX 347
-#define SC_OPCODE_SLOPE 348
-#define SC_OPCODE_INTERCEPT 349
-#define SC_OPCODE_TREND 350
-#define SC_OPCODE_GROWTH 351
-#define SC_OPCODE_RGP 352
-#define SC_OPCODE_RKP 353
-#define SC_OPCODE_FORECAST 354
-#define SC_OPCODE_CHI_INV 355
-#define SC_OPCODE_GAMMA_DIST 356
-#define SC_OPCODE_GAMMA_INV 357
-#define SC_OPCODE_T_INV 358
-#define SC_OPCODE_F_INV 359
-#define SC_OPCODE_CHI_TEST 360
-#define SC_OPCODE_LOG_INV 361
-#define SC_OPCODE_TABLE_OP 362
-#define SC_OPCODE_BETA_DIST 363
-#define SC_OPCODE_BETA_INV 364
-#define SC_OPCODE_WEEK 365 /* miscellaneous */
-#define SC_OPCODE_GET_DAY_OF_WEEK 366
-#define SC_OPCODE_NO_NAME 367
-#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_MIN_A 373
-#define SC_OPCODE_MAX_A 374
-#define SC_OPCODE_AVERAGE_A 375
-#define SC_OPCODE_ST_DEV_A 376
-#define SC_OPCODE_ST_DEV_P_A 377
-#define SC_OPCODE_VAR_A 378
-#define SC_OPCODE_VAR_P_A 379
-#define SC_OPCODE_EASTERSUNDAY 380
-#define SC_OPCODE_DECIMAL 381
-#define SC_OPCODE_CONVERT 382
-#define SC_OPCODE_ROMAN 383
-#define SC_OPCODE_MIRR 384
-#define SC_OPCODE_CELL 385
-#define SC_OPCODE_ISPMT 386
-#define SC_OPCODE_HYPERLINK 387
-#define SC_OPCODE_INDIRECT_XL 388 /* See also INDIRECT for OOO variant */
-#define SC_OPCODE_ADDRESS_XL 389 /* See also ADRESS for OOO variant */
-#define SC_OPCODE_GET_PIVOT_DATA 390
-#define SC_OPCODE_EUROCONVERT 391
-#define SC_OPCODE_NUMBERVALUE 392
-#define SC_OPCODE_CHISQ_DIST 393
-#define SC_OPCODE_CHISQ_INV 394
-#define SC_OPCODE_STOP_2_PAR 395
-
-#define SC_OPCODE_LAST_OPCODE_ID 394 /* last OpCode */
-
-/*** Interna ***/
-#define SC_OPCODE_INTERNAL_BEGIN 9995
-#define SC_OPCODE_GAME 9995
-#define SC_OPCODE_SPEW 9996
-#define SC_OPCODE_TTT 9997
-#define SC_OPCODE_TEAM 9998
-#define SC_OPCODE_ANSWER 9999
-#define SC_OPCODE_INTERNAL_END 9999
-
-/*** from here on ExtraData contained ***/
-#define SC_OPCODE_DATA_TOKEN_1 10000
-
-#define SC_OPCODE_NONE 0xFFFF
-
-
-#endif /* SC_COMPILER_HRC */
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index bc3e5f6994f2..a34933557c02 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -38,22 +38,17 @@
#include <tools/mempool.hxx>
#include "scdllapi.h"
#include "global.hxx"
-#include "tokenarray.hxx"
-#include "token.hxx"
-#include "intruref.hxx"
-#include "grammar.hxx"
+#include "refdata.hxx"
+#include "formula/token.hxx"
+#include "formula/intruref.hxx"
+#include "formula/grammar.hxx"
#include <unotools/charclass.hxx>
#include <rtl/ustrbuf.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/sheet/ExternalLinkInfo.hpp>
#include <vector>
-namespace com { namespace sun { namespace star {
- namespace sheet {
- struct FormulaOpCodeMapEntry;
- struct FormulaToken;
- }
-}}}
+#include <formula/FormulaCompiler.hxx>
+
#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
#include <boost/shared_ptr.hpp>
@@ -104,13 +99,14 @@ class ScDocument;
class ScMatrix;
class ScRangeData;
class ScExternalRefManager;
+class ScTokenArray;
// constants and data types internal to compiler
#if 0
/*
OpCode eOp; // OpCode
- StackVar eType; // type of data
+ formula::StackVar eType; // type of data
USHORT nRefCnt; // reference count
BOOL bRaw; // not cloned yet and trimmed to real size
*/
@@ -118,7 +114,7 @@ class ScExternalRefManager;
#define SC_TOKEN_FIX_MEMBERS \
OpCode eOp; \
- StackVar eType; \
+ formula::StackVar eType; \
USHORT nRefCnt; \
BOOL bRaw;
@@ -158,7 +154,7 @@ public:
struct {
sal_uInt16 nFileId;
sal_Unicode cTabName[MAXSTRLEN+1];
- ComplRefData aRef;
+ ScComplexRefData aRef;
} extref;
struct {
sal_uInt16 nFileId;
@@ -176,7 +172,7 @@ private:
~ScRawToken() {} //! only delete via Delete()
public:
DECL_FIXEDMEMPOOL_NEWDEL( ScRawToken );
- StackVar GetType() const { return (StackVar) eType; }
+ formula::StackVar GetType() const { return (formula::StackVar) eType; }
OpCode GetOpCode() const { return (OpCode) eOp; }
void NewOpCode( OpCode e ) { eOp = e; }
void IncRef() { nRefCnt++; }
@@ -198,14 +194,14 @@ public:
//UNUSED2008-05 ScComplexRefData& GetReference();
//UNUSED2008-05 void SetReference( ScComplexRefData& rRef );
void SetName( USHORT n );
- void SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef );
- void SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef );
+ void SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef );
+ void SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef );
void SetExternalName( sal_uInt16 nFileId, const String& rName );
void SetMatrix( ScMatrix* p );
void SetExternal(const sal_Unicode* pStr);
ScRawToken* Clone() const; // real copy!
- ScToken* CreateToken() const; // create typified token
+ formula::FormulaToken* CreateToken() const; // create typified token
void Load( SvStream&, USHORT nVer );
static xub_StrLen GetStrLen( const sal_Unicode* pStr ); // as long as a "string" is an array
@@ -216,25 +212,18 @@ public:
};
-typedef ScSimpleIntrusiveReference< struct ScRawToken > ScRawTokenRef;
-
-
-struct ScArrayStack;
+typedef formula::SimpleIntrusiveReference< struct ScRawToken > ScRawTokenRef;
-typedef ::std::hash_map< String, OpCode, ScStringHashCode, ::std::equal_to< String > > ScOpCodeHashMap;
-typedef ::std::hash_map< String, String, ScStringHashCode, ::std::equal_to< String > > ScExternalHashMap;
-
-
-class SC_DLLPUBLIC ScCompiler
+class SC_DLLPUBLIC ScCompiler : public formula::FormulaCompiler
{
public:
struct Convention
{
- const ScAddress::Convention meConv;
+ const formula::FormulaGrammar::AddressConvention meConv;
const ULONG* mpCharTable;
- Convention( ScAddress::Convention eConvP );
+ Convention( formula::FormulaGrammar::AddressConvention eConvP );
virtual ~Convention();
virtual void MakeRefStr( rtl::OUStringBuffer& rBuffer,
@@ -260,11 +249,11 @@ public:
virtual String makeExternalNameStr( const String& rFile, const String& rName ) const = 0;
virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef,
+ sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const = 0;
virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef,
+ sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const = 0;
enum SpecialSymbolType
@@ -285,127 +274,11 @@ public:
};
friend struct Convention;
- /** Mappings from strings to OpCodes and vice versa. */
- class OpCodeMap
- {
- ScOpCodeHashMap *mpHashMap; /// Hash map of symbols, String -> OpCode
- String *mpTable; /// Array of symbols, OpCode -> String, offset==OpCode
- ScExternalHashMap *mpExternalHashMap; /// Hash map of ocExternal, Filter String -> AddIn String
- ScExternalHashMap *mpReverseExternalHashMap; /// Hash map of ocExternal, AddIn String -> Filter String
- ScGrammar::Grammar meGrammar; /// Grammar, language and reference convention
- USHORT mnSymbols; /// Count of OpCode symbols
- bool mbCore : 1; /// If mapping was setup by core, not filters
- bool mbEnglish : 1; /// If English symbols and external names
-
- OpCodeMap(); // prevent usage
- OpCodeMap( const OpCodeMap& ); // prevent usage
- OpCodeMap& operator=( const OpCodeMap& ); // prevent usage
-
- public:
-
- OpCodeMap( USHORT nSymbols, bool bCore, ScGrammar::Grammar eGrammar ) :
- mpHashMap( new ScOpCodeHashMap( nSymbols)),
- mpTable( new String[ nSymbols ]),
- mpExternalHashMap( new ScExternalHashMap),
- mpReverseExternalHashMap( new ScExternalHashMap),
- meGrammar( eGrammar),
- mnSymbols( nSymbols),
- mbCore( bCore)
- {
- mbEnglish = ScGrammar::isEnglish( meGrammar);
- }
- ~OpCodeMap()
- {
- delete mpReverseExternalHashMap;
- delete mpExternalHashMap;
- delete [] mpTable;
- delete mpHashMap;
- }
-
- /// Get the symbol String -> OpCode hash map for finds.
- inline const ScOpCodeHashMap* getHashMap() const { return mpHashMap; }
-
- /// Get the symbol String -> AddIn String hash map for finds.
- inline const ScExternalHashMap* getExternalHashMap() const { return mpExternalHashMap; }
-
- /// Get the AddIn String -> symbol String hash map for finds.
- inline const ScExternalHashMap* getReverseExternalHashMap() const { return mpReverseExternalHashMap; }
-
- /// Get the symbol string matching an OpCode.
- inline const String& getSymbol( const OpCode eOp ) const
- {
- DBG_ASSERT( USHORT(eOp) < mnSymbols, "OpCodeMap::getSymbol: OpCode out of range");
- if (USHORT(eOp) < mnSymbols)
- return mpTable[ eOp ];
- return EMPTY_STRING;
- }
-
- /// Get the grammar.
- inline ScGrammar::Grammar getGrammar() const { return meGrammar; }
-
- /// Get the symbol count.
- inline USHORT getSymbolCount() const { return mnSymbols; }
-
- /** Are these English symbols, as opposed to native language (which may
- be English as well)? */
- inline bool isEnglish() const { return mbEnglish; }
-
- /// Is it an internal core mapping, or setup by filters?
- inline bool isCore() const { return mbCore; }
-
- /// Is it an ODF 1.1 compatibility mapping?
- inline bool isPODF() const { return ScGrammar::isPODF( meGrammar); }
-
- /// Is it an ODFF / ODF 1.2 mapping?
- inline bool isODFF() const { return ScGrammar::isODFF( meGrammar); }
-
- /// Does it have external symbol/name mappings?
- inline bool hasExternals() const { return !mpExternalHashMap->empty(); }
-
- /// Put entry of symbol String and OpCode pair.
- void putOpCode( const String & rStr, const OpCode eOp );
-
- /// Put entry of symbol String and AddIn international String pair.
- void putExternal( const String & rSymbol, const String & rAddIn );
-
- /** Put entry of symbol String and AddIn international String pair,
- failing silently if rAddIn name already exists. */
- void putExternalSoftly( const String & rSymbol, const String & rAddIn );
-
- /// Core implementation of XFormulaOpCodeMapper::getMappings()
- ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
- createSequenceOfFormulaTokens(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames ) const;
-
- /// Core implementation of XFormulaOpCodeMapper::getAvailableMappings()
- ::com::sun::star::uno::Sequence<
- ::com::sun::star::sheet::FormulaOpCodeMapEntry >
- createSequenceOfAvailableMappings( const sal_Int32 nGroup ) const;
-
- /** The value used in createSequenceOfAvailableMappings() and thus in
- XFormulaOpCodeMapper::getMappings() for an unknown symbol. */
- static inline sal_Int32 getOpCodeUnknown()
- {
- return kOpCodeUnknown;
- }
-
private:
- static const sal_Int32 kOpCodeUnknown = -1;
-
- };
-
- typedef ::boost::shared_ptr< const OpCodeMap > OpCodeMapPtr;
- typedef ::boost::shared_ptr< OpCodeMap > NonConstOpCodeMapPtr;
-
-private:
- static NonConstOpCodeMapPtr mxSymbolsODFF; // ODFF symbols
- static NonConstOpCodeMapPtr mxSymbolsPODF; // ODF 1.1 symbols
- static NonConstOpCodeMapPtr mxSymbolsNative; // native symbols
- static NonConstOpCodeMapPtr mxSymbolsEnglish; // English symbols
static CharClass *pCharClassEnglish; // character classification for en_US locale
- static const Convention *pConventions[ ScAddress::CONV_LAST ];
+ static const Convention *pConventions[ formula::FormulaGrammar::CONV_LAST ];
static const Convention * const pConvOOO_A1;
static const Convention * const pConvOOO_A1_ODF;
@@ -427,59 +300,24 @@ private:
ScDocument* pDoc;
ScAddress aPos;
- // For ScAddress::CONV_XL_OOX, may be set via API by MOOXML filter.
+ // For CONV_XL_OOX, may be set via API by MOOXML filter.
::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks;
- String aCorrectedFormula; // autocorrected Formula
- String aCorrectedSymbol; // autocorrected Symbol
sal_Unicode cSymbol[MAXSTRLEN]; // current Symbol
String aFormula; // formula source code
xub_StrLen nSrcPos; // tokenizer position (source code)
- ScTokenArray* pArr;
ScRawTokenRef pRawToken;
- ScTokenRef pToken; // current token
- ScTokenRef pCurrentFactorToken; // current factor token (of Factor() method)
- OpCode eLastOp;
- ScToken** pCode;
- ScArrayStack* pStack;
- OpCodeMapPtr mxSymbols; // which symbols are used
+
const CharClass* pCharClass; // which character classification is used for parseAnyToken
- USHORT pc;
USHORT mnPredetectedReference; // reference when reading ODF, 0 (none), 1 (single) or 2 (double)
- short nNumFmt; // set during CompileTokenArray()
SCsTAB nMaxTab; // last sheet in document
- short nRecursion; // GetToken() recursions
- BOOL glSubTotal; // if code contains one or more subtotal functions
- BOOL bAutoCorrect; // whether to apply AutoCorrection
- BOOL bCorrected; // AutoCorrection was applied
- BOOL bCompileForFAP; //! not real RPN but names, for FunctionAutoPilot,
- // will not be resolved
- BOOL bIgnoreErrors; // on AutoCorrect and CompileForFAP
- // ignore errors and create RPN nevertheless
const Convention *pConv;
bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE
- ScGrammar::Grammar meGrammar; // The grammar used, language plus convention.
bool mbExtendedErrorDetection;
- BOOL GetToken();
BOOL NextNewToken(bool bInArray = false);
- OpCode NextToken();
- void PutCode( ScTokenRef& );
- void Factor();
- void RangeLine();
- void UnionLine();
- void IntersectionLine();
- void UnaryLine();
- void PostOpLine();
- void PowLine();
- void MulDivLine();
- void AddSubLine();
- void ConcatLine();
- void CompareLine();
- void NotLine();
- OpCode Expression();
-
- void SetError(USHORT nError);
+
+ virtual void SetError(USHORT nError);
xub_StrLen NextSymbol(bool bInArray);
BOOL IsValue( const String& );
BOOL IsOpCode( const String&, bool bInArray );
@@ -496,66 +334,25 @@ private:
BOOL IsColRowName( const String& );
BOOL IsBoolean( const String& );
void AutoCorrectParsedSymbol();
- void PushTokenArray( ScTokenArray*, BOOL = FALSE );
- void PopTokenArray();
- void SetRelNameReference();
- bool MergeRangeReference( ScToken * * const pCode1, ScToken * const * const pCode2 );
- void CreateStringFromScMatrix( rtl::OUStringBuffer& rBuffer, const ScMatrix* pMatrix );
- void AppendBoolean( rtl::OUStringBuffer& rBuffer, bool bVal );
- void AppendDouble( rtl::OUStringBuffer& rBuffer, double fVal );
- void AppendString( rtl::OUStringBuffer& rBuffer, const String & rStr );
+ void SetRelNameReference();
static void InitCharClassEnglish();
public:
- ScCompiler( ScDocument* pDocument, const ScAddress&,
- const ScGrammar::Grammar eGrammar );
+ ScCompiler( ScDocument* pDocument, const ScAddress&);
- ScCompiler( ScDocument* pDocument, const ScAddress&,
- ScTokenArray& rArr,
- const ScGrammar::Grammar eGrammar );
+ ScCompiler( ScDocument* pDocument, const ScAddress&,ScTokenArray& rArr);
- static bool IsInitialized()
- {
- return mxSymbolsNative.get() && mxSymbolsEnglish.get();
- }
- static void InitSymbolsNative(); /// only SymbolsNative, on first document creation
- static void InitSymbolsEnglish(); /// only SymbolsEnglish, maybe later
-private:
- static void InitSymbolsPODF(); /// only SymbolsPODF, on demand
- static void InitSymbolsODFF(); /// only SymbolsODFF, on demand
- static void fillFromAddInMap( NonConstOpCodeMapPtr xMap, size_t nSymbolOffset );
- static void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap );
- static void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap );
public:
static void DeInit(); /// all
// for ScAddress::Format()
static void CheckTabQuotes( String& aTabName,
- const ScAddress::Convention eConv = ScAddress::CONV_OOO );
+ const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO );
static BOOL EnQuote( String& rStr );
- static BOOL DeQuote( String& rStr );
- static const String& GetNativeSymbol( OpCode eOp )
- {
- return mxSymbolsNative->getSymbol( eOp );
- }
-
- /** Get OpCode for English symbol.
- Used in XFunctionAccess to create token array.
- @param rName
- Symbol to lookup. MUST be upper case.
- */
- static OpCode GetEnglishOpCode( const String& rName );
-
- /** Get OpCodeMap for formula language.
- @param nLanguage
- One of ::com::sun::star::sheet::FormulaLanguage constants.
- @return Map for nLanguage. If nLanguage is unknown, a NULL map is returned.
- */
- static OpCodeMapPtr GetOpCodeMap( const sal_Int32 nLanguage );
//! _either_ CompileForFAP _or_ AutoCorrection, _not_ both
void SetCompileForFAP( BOOL bVal )
@@ -564,24 +361,12 @@ public:
{ bAutoCorrect = bVal; bIgnoreErrors = bVal; }
void SetCloseBrackets( bool bVal ) { mbCloseBrackets = bVal; }
void SetRefConvention( const Convention *pConvP );
- void SetRefConvention( const ScAddress::Convention eConv );
-
- /** Create an internal symbol map from API mapping.
- @param bEnglish
- Use English number parser / formatter instead of native.
- */
- static OpCodeMapPtr CreateOpCodeMap(
- const ::com::sun::star::uno::Sequence<
- const ::com::sun::star::sheet::FormulaOpCodeMapEntry > & rMapping,
- bool bEnglish );
+ void SetRefConvention( const formula::FormulaGrammar::AddressConvention eConv );
/// Set symbol map if not empty.
void SetFormulaLanguage( const OpCodeMapPtr & xMap );
- /** Set symbol map corresponding to one of predefined ScGrammar::Grammar,
- including an address reference convention. */
- void SetGrammar( const ScGrammar::Grammar eGrammar );
- inline ScGrammar::Grammar GetGrammar() const { return meGrammar; }
+ void SetGrammar( const formula::FormulaGrammar::Grammar eGrammar );
private:
/** Set grammar and reference convention from within SetFormulaLanguage()
@@ -613,20 +398,9 @@ public:
// Use convention from this->aPos by default
ScTokenArray* CompileString( const String& rFormula );
- BOOL CompileTokenArray();
- short GetNumFormatType() { return nNumFmt; }
const ScDocument* GetDoc() const { return pDoc; }
const ScAddress& GetPos() const { return aPos; }
- static const String& GetStringFromOpCode( OpCode eOpCode );
-
- ScToken* CreateStringFromToken( String& rFormula, ScToken* pToken,
- BOOL bAllowArrAdvance = FALSE );
- ScToken* CreateStringFromToken( rtl::OUStringBuffer& rBuffer, ScToken* pToken,
- BOOL bAllowArrAdvance = FALSE );
- void CreateStringFromTokenArray( String& rFormula );
- void CreateStringFromTokenArray( rtl::OUStringBuffer& rBuffer );
-
void MoveRelWrap();
static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc,
const ScAddress& rPos );
@@ -656,7 +430,7 @@ public:
/// If the character is allowed as first character in sheet names or references
static inline BOOL IsCharWordChar( String const & rStr,
xub_StrLen nPos,
- const ScAddress::Convention eConv = ScAddress::CONV_OOO )
+ const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO )
{
sal_Unicode c = rStr.GetChar( nPos );
return c < 128 ?
@@ -668,7 +442,7 @@ public:
/// If the character is allowed in sheet names or references
static inline BOOL IsWordChar( String const & rStr,
xub_StrLen nPos,
- const ScAddress::Convention eConv = ScAddress::CONV_OOO )
+ const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO )
{
sal_Unicode c = rStr.GetChar( nPos );
return c < 128 ?
@@ -678,53 +452,30 @@ public:
}
private:
+ // FormulaCompiler
+ virtual String FindAddInFunction( const String& rUpperName, BOOL bLocalFirst ) const;
+ virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const;
+ virtual void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap ) const;
+ virtual void fillFromAddInMap( NonConstOpCodeMapPtr xMap, formula::FormulaGrammar::Grammar _eGrammar ) const;
+ virtual void fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const;
+
+ virtual BOOL HandleExternalReference(const formula::FormulaToken& _aToken);
+ virtual BOOL HandleRange();
+ virtual BOOL HandleSingleRef();
+ virtual BOOL HandleDbData();
+
+ virtual formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, bool bReuseDoubleRef );
+ virtual void CreateStringFromExternal(rtl::OUStringBuffer& rBuffer, FormulaToken* pTokenP)
+ virtual void CreateStringFromSingleRef(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
+ virtual void CreateStringFromDoubleRef(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
+ virtual void CreateStringFromMatrix( rtl::OUStringBuffer& rBuffer, formula::FormulaToken* _pTokenP);
+ virtual void CreateStringFromIndex(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP);
+ virtual void LocalizeString( String& rName ); // modify rName - input: exact name
+ virtual BOOL IsImportingXML() const;
+
/// Access the CharTable flags
inline ULONG GetCharTableFlags( sal_Unicode c )
{ return c < 128 ? pConv->mpCharTable[ UINT8(c) ] : 0; }
-
- static inline void ForceArrayOperator( ScTokenRef& rCurr, const ScTokenRef& rPrev )
- {
- if ( rPrev.Is() && rPrev->HasForceArray() &&
- rCurr->GetType() == svByte && rCurr->GetOpCode() != ocPush
- && !rCurr->HasForceArray() )
- rCurr->SetForceArray( true);
- }
- // SUNWS7 needs a forward declared friend, otherwise members of the outer
- // class are not accessible.
- class CurrentFactor;
- friend class ScCompiler::CurrentFactor;
- class CurrentFactor
- {
- ScTokenRef pPrevFac;
- ScCompiler* pCompiler;
- // not implemented
- CurrentFactor( const CurrentFactor& );
- CurrentFactor& operator=( const CurrentFactor& );
- public:
- explicit CurrentFactor( ScCompiler* pComp )
- : pPrevFac( pComp->pCurrentFactorToken )
- , pCompiler( pComp )
- {}
- ~CurrentFactor()
- { pCompiler->pCurrentFactorToken = pPrevFac; }
- // yes, this operator= may modify the RValue
- void operator=( ScTokenRef& r )
- {
- ForceArrayOperator( r, pPrevFac);
- pCompiler->pCurrentFactorToken = r;
- }
- void operator=( ScToken* p )
- {
- ScTokenRef xTemp( p );
- *this = xTemp;
- }
- operator ScTokenRef&()
- { return pCompiler->pCurrentFactorToken; }
- ScToken* operator->()
- { return pCompiler->pCurrentFactorToken.operator->(); }
- operator ScToken*()
- { return operator->(); }
- };
};
SC_DLLPUBLIC String GetScCompilerNativeSymbol( OpCode eOp ); //CHINA001
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index e9a25c8688aa..90e10ed72cb3 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -33,7 +33,7 @@
#include "global.hxx"
#include "address.hxx"
-#include "grammar.hxx"
+#include "formula/grammar.hxx"
#include <svtools/svarray.hxx>
#include "scdllapi.h"
@@ -84,7 +84,7 @@ class SC_DLLPUBLIC ScConditionEntry
double nVal2;
String aStrVal1; // eingegeben oder berechnet
String aStrVal2;
- ScGrammar::Grammar eTempGrammar; // grammar to be used on (re)compilation, e.g. in XML import
+ formula::FormulaGrammar::Grammar eTempGrammar; // grammar to be used on (re)compilation, e.g. in XML import
BOOL bIsStr1; // um auch leere Strings zu erkennen
BOOL bIsStr2;
ScTokenArray* pFormula1; // eingegebene Formel
@@ -101,7 +101,7 @@ class SC_DLLPUBLIC ScConditionEntry
void MakeCells( const ScAddress& rPos );
void Compile( const String& rExpr1, const String& rExpr2,
- const ScGrammar::Grammar eGrammar, BOOL bTextToReal );
+ const formula::FormulaGrammar::Grammar eGrammar, BOOL bTextToReal );
void Interpret( const ScAddress& rPos );
BOOL IsValid( double nArg ) const;
@@ -111,7 +111,7 @@ public:
ScConditionEntry( ScConditionMode eOper,
const String& rExpr1, const String& rExpr2,
ScDocument* pDocument, const ScAddress& rPos,
- const ScGrammar::Grammar eGrammar );
+ const formula::FormulaGrammar::Grammar eGrammar );
ScConditionEntry( ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
ScDocument* pDocument, const ScAddress& rPos );
@@ -137,7 +137,7 @@ public:
void SetFormula2( const ScTokenArray& rArray );
String GetExpression( const ScAddress& rCursor, USHORT nPos, ULONG nNumFmt = 0,
- const ScGrammar::Grammar eGrammar = ScGrammar::GRAM_DEFAULT ) const;
+ const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
ScTokenArray* CreateTokenArry( USHORT nPos ) const;
@@ -172,7 +172,7 @@ public:
const String& rExpr1, const String& rExpr2,
ScDocument* pDocument, const ScAddress& rPos,
const String& rStyle,
- const ScGrammar::Grammar eGrammar = ScGrammar::GRAM_DEFAULT );
+ const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT );
ScCondFormatEntry( ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
ScDocument* pDocument, const ScAddress& rPos,
diff --git a/sc/inc/dbtoken.hxx b/sc/inc/dbtoken.hxx
index da87bf93133a..ffb8b8db6a34 100644
--- a/sc/inc/dbtoken.hxx
+++ b/sc/inc/dbtoken.hxx
@@ -45,9 +45,9 @@ ScTokenArray* DbgMakeTokenArray
( ScDocument* pDoc, SCTAB nTab, const String& r, USHORT& rErr );
void DbgDumpTokenArray( const BYTE* pArr, USHORT nLen, const char* pMsg );
void DbgDelTokenArray( ScTokenArray* );
-StackVar DbgInterpret( ScDocument* pDok, const ScTokenArray* pToken,
+formula::StackVar DbgInterpret( ScDocument* pDok, const ScTokenArray* pToken,
SCCOL nCOL, SCROW nROW, SCTAB nTAB,
- StackVar eStackVar,
+ formula::StackVar eformula::StackVar,
char* &rStringErgPtr,
double& rDoubleErg,
USHORT& rError,
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c0879f0c1327..0e79a64385b6 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -41,7 +41,7 @@
#include "rangelst.hxx"
#include "brdcst.hxx"
#include "tabopparams.hxx"
-#include "grammar.hxx"
+#include "formula/grammar.hxx"
#include <com/sun/star/chart2/XChartDocument.hpp>
#include "scdllapi.h"
@@ -326,12 +326,12 @@ private:
/** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1
documents, GRAM_ODFF for ODF 1.2 documents. */
- ScGrammar::Grammar eStorageGrammar;
+ formula::FormulaGrammar::Grammar eStorageGrammar;
/** The compiler grammar used in ODF import after brackets had been
stripped (which they shouldn't, but until that's fixed) by the XML
importer. */
- ScGrammar::Grammar eXmlImportGrammar;
+ formula::FormulaGrammar::Grammar eXmlImportGrammar;
ULONG nFormulaCodeInTree; // FormelRPN im Formelbaum
ULONG nXMLImportedFormulaCount; // progress count during XML import
@@ -403,7 +403,7 @@ private:
BOOL bInUnoBroadcast;
BOOL bInUnoListenerCall;
- ScGrammar::Grammar eGrammar;
+ formula::FormulaGrammar::Grammar eGrammar;
mutable BOOL bStyleSheetUsageInvalid;
@@ -587,9 +587,9 @@ public:
void GetScenarioFlags( SCTAB nTab, USHORT& rFlags ) const;
SC_DLLPUBLIC BOOL IsActiveScenario( SCTAB nTab ) const;
SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, BOOL bActive ); // nur fuer Undo etc.
- SC_DLLPUBLIC ScAddress::Convention GetAddressConvention() const;
- ScGrammar::Grammar GetGrammar() const;
- void SetGrammar( ScGrammar::Grammar eGram );
+ SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
+ formula::FormulaGrammar::Grammar GetGrammar() const;
+ void SetGrammar( formula::FormulaGrammar::Grammar eGram );
SC_DLLPUBLIC BYTE GetLinkMode( SCTAB nTab ) const;
BOOL IsLinked( SCTAB nTab ) const;
SC_DLLPUBLIC const String& GetLinkDoc( SCTAB nTab ) const;
@@ -720,7 +720,7 @@ public:
const ScMarkData& rMark,
const String& rFormula,
const ScTokenArray* p = NULL,
- const ScGrammar::Grammar = ScGrammar::GRAM_DEFAULT );
+ const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT );
SC_DLLPUBLIC void InsertTableOp(const ScTabOpParam& rParam, // Mehrfachoperation
SCCOL nCol1, SCROW nRow1,
SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
@@ -1663,8 +1663,8 @@ public:
void SetSortParam( ScSortParam& rParam, SCTAB nTab );
/** Should only be GRAM_PODF or GRAM_ODFF. */
- void SetStorageGrammar( ScGrammar::Grammar eGrammar );
- ScGrammar::Grammar GetStorageGrammar() const
+ void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
+ formula::FormulaGrammar::Grammar GetStorageGrammar() const
{ return eStorageGrammar; }
private: // CLOOK-Impl-Methoden
diff --git a/sc/inc/errorcodes.hxx b/sc/inc/errorcodes.hxx
deleted file mode 100644
index 077129eb046c..000000000000
--- a/sc/inc/errorcodes.hxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: errorcodes.hxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_ERRORCODES_HXX
-#define SC_ERRORCODES_HXX
-
-#include <rtl/math.hxx>
-#include <tools/solar.h>
-
-namespace ScErrorCodes
-{
-
-const USHORT errIllegalChar = 501;
-const USHORT errIllegalArgument = 502;
-const USHORT errIllegalFPOperation = 503; // #NUM!
-const USHORT errIllegalParameter = 504;
-const USHORT errIllegalJump = 505;
-const USHORT errSeparator = 506;
-const USHORT errPair = 507;
-const USHORT errPairExpected = 508;
-const USHORT errOperatorExpected = 509;
-const USHORT errVariableExpected = 510;
-const USHORT errParameterExpected = 511;
-const USHORT errCodeOverflow = 512;
-const USHORT errStringOverflow = 513;
-const USHORT errStackOverflow = 514;
-const USHORT errUnknownState = 515;
-const USHORT errUnknownVariable = 516;
-const USHORT errUnknownOpCode = 517;
-const USHORT errUnknownStackVariable = 518;
-const USHORT errNoValue = 519; // #VALUE!
-const USHORT errUnknownToken = 520;
-const USHORT errNoCode = 521; // #NULL!
-const USHORT errCircularReference = 522;
-const USHORT errNoConvergence = 523;
-const USHORT errNoRef = 524; // #REF!
-const USHORT errNoName = 525; // #NAME?
-const USHORT errDoubleRef = 526;
-const USHORT errInterpOverflow = 527;
-// Not displayed, temporary for TrackFormulas,
-// Cell depends on another cell that has errCircularReference
-const USHORT errTrackFromCircRef = 528;
-// Interpreter internal: existing cell has no value but value queried
-const USHORT errCellNoValue = 529;
-// Interpreter: needed AddIn not found
-const USHORT errNoAddin = 530;
-// Interpreter: needed Macro not found
-const USHORT errNoMacro = 531;
-// Interpreter: Division by zero
-const USHORT errDivisionByZero = 532; // #DIV/0!
-// Compiler: a non-simple (str,err,val) value was put in an array
-const USHORT errNestedArray = 533;
-
-// Interpreter: NA() not available condition, not a real error
-const USHORT NOTAVAILABLE = 0x7fff;
-
-
-/** Unconditionally construct a double value of NAN where the lower bits
- represent an interpreter error code. */
-inline double CreateDoubleError( USHORT nErr )
-{
- double fVal;
- ::rtl::math::setNan( &fVal );
- reinterpret_cast< sal_math_Double * >(&fVal)->nan_parts.fraction_lo = nErr;
- return fVal;
-}
-
-
-/** Recreate the error code of a coded double error, if any. */
-inline USHORT GetDoubleErrorValue( double fVal )
-{
- if ( ::rtl::math::isFinite( fVal ) )
- return 0;
- if ( ::rtl::math::isInf( fVal ) )
- return errIllegalFPOperation; // normal INF
- UINT32 nErr = reinterpret_cast< sal_math_Double * >(
- &fVal)->nan_parts.fraction_lo;
- if ( nErr & 0xffff0000 )
- return errNoValue; // just a normal NAN
- return (USHORT)(nErr & 0x0000ffff); // any other error
-}
-
-} // namespace ScErrorCodes
-
-// yes, exceptionally we put a "using namespace" in a header file..
-using namespace ScErrorCodes;
-
-#endif // SC_ERRORCODES_HXX
diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx
index ca1320b9e1dc..ba4e02041faa 100644
--- a/sc/inc/fmtuno.hxx
+++ b/sc/inc/fmtuno.hxx
@@ -32,7 +32,7 @@
#define SC_FMTUNO_HXX
#include "address.hxx"
-#include "grammar.hxx"
+#include "formula/grammar.hxx"
#include <tools/list.hxx>
#include <svtools/itemprop.hxx>
#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
@@ -66,11 +66,11 @@ struct ScCondFormatEntryItem
String maPosStr; // formula position as text
String maStyle; // display name as stored in ScStyleSheet
ScAddress maPos;
- ScGrammar::Grammar meGrammar; // grammar used with maExpr1 and maExpr2
+ formula::FormulaGrammar::Grammar meGrammar; // grammar used with maExpr1 and maExpr2
USHORT mnMode; // stores enum ScConditionMode
// Make sure the grammar is initialized for API calls.
- ScCondFormatEntryItem() : meGrammar( ScGrammar::GRAM_UNSPECIFIED ) {}
+ ScCondFormatEntryItem() : meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ) {}
};
class ScTableConditionalFormat : public cppu::WeakImplHelper5<
@@ -89,11 +89,11 @@ private:
ScTableConditionalFormat(); // disable
public:
ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey,
- const ScGrammar::Grammar eGrammar);
+ const formula::FormulaGrammar::Grammar eGrammar);
virtual ~ScTableConditionalFormat();
void FillFormat( ScConditionalFormat& rFormat,
- ScDocument* pDoc, ScGrammar::Grammar eGrammar ) const;
+ ScDocument* pDoc, formula::FormulaGrammar::Grammar eGrammar ) const;
void DataChanged();
// XSheetConditionalEntries
@@ -211,7 +211,7 @@ private:
USHORT nMode; // enum ScConditionMode
String aExpr1;
String aExpr2;
- ScGrammar::Grammar meGrammar; // grammar used with aExpr1 and aExpr2
+ formula::FormulaGrammar::Grammar meGrammar; // grammar used with aExpr1 and aExpr2
::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens1;
::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens2;
ScAddress aSrcPos;
@@ -232,11 +232,11 @@ private:
ScTableValidationObj(); // disabled
public:
ScTableValidationObj(ScDocument* pDoc, ULONG nKey,
- const ScGrammar::Grammar eGrammar);
+ const formula::FormulaGrammar::Grammar eGrammar);
virtual ~ScTableValidationObj();
ScValidationData* CreateValidationData( ScDocument* pDoc,
- ScGrammar::Grammar eGrammar ) const;
+ formula::FormulaGrammar::Grammar eGrammar ) const;
void DataChanged();
// XSheetCondition
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index 5ca6016f8de4..e227dd1b7995 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -41,7 +41,7 @@ class ScFormulaResult
union
{
double mfValue; // double result direct for performance and memory consumption
- const ScToken* mpToken; // if not, result token obtained from interpreter
+ const formula::FormulaToken* mpToken; // if not, result token obtained from interpreter
};
USHORT mnError; // error code
bool mbToken :1; // whether content of union is a token
@@ -52,10 +52,10 @@ class ScFormulaResult
prior to assigning other types */
inline void ResetToDefaults();
- /** If token is of svError set error code and decrement RefCount.
- If token is of svEmptyCell set mbEmpty and mbEmptyAsString and
+ /** If token is of formula::svError set error code and decrement RefCount.
+ If token is of formula::svEmptyCell set mbEmpty and mbEmptyAsString and
decrement RefCount.
- If token is of svDouble set mfValue and decrement RefCount.
+ If token is of formula::svDouble set mfValue and decrement RefCount.
Else assign token to mpToken. NULL is valid => svUnknown.
Other member variables are set accordingly.
@precondition: Token MUST had been IncRef'ed prior to this call!
@@ -63,7 +63,7 @@ class ScFormulaResult
DecRef'ed prior to this call, p will be assigned to mpToken if not
resolved.
ATTENTION! Token may get deleted in this call! */
- inline void ResolveToken( const ScToken * p );
+ inline void ResolveToken( const formula::FormulaToken * p );
public:
/** Effectively type svUnknown. */
@@ -97,7 +97,7 @@ public:
}
/** Same comments as for SetToken() apply! */
- explicit ScFormulaResult( const ScToken* p )
+ explicit ScFormulaResult( const formula::FormulaToken* p )
: mnError(0), mbToken(false),
mbEmpty(false), mbEmptyDisplayedAsString(false)
{
@@ -116,44 +116,44 @@ public:
/** Assignment as in operator=() but without return */
inline void Assign( const ScFormulaResult & r );
- /** Sets a direct double if token type is svDouble, or mbEmpty if
- svEmptyCell, else token. If p is NULL, that is set as well, effectively
+ /** Sets a direct double if token type is formula::svDouble, or mbEmpty if
+ formula::svEmptyCell, else token. If p is NULL, that is set as well, effectively
resulting in GetType()==svUnknown. If the already existing result is
ScMatrixFormulaCellToken, the upper left ist set to token.
- ATTENTION! ScToken had to be allocated using 'new' and if of type
- svDouble and no RefCount was set may not be used after this call
+ ATTENTION! formula::FormulaToken had to be allocated using 'new' and if of type
+ formula::svDouble and no RefCount was set may not be used after this call
because it was deleted after decrement! */
- inline void SetToken( const ScToken* p );
+ inline void SetToken( const formula::FormulaToken* p );
- /** May be NULL if SetToken() did so, also if type svDouble or svError! */
- inline ScConstTokenRef GetToken() const;
+ /** May be NULL if SetToken() did so, also if type formula::svDouble or formula::svError! */
+ inline formula::FormulaConstTokenRef GetToken() const;
- /** Return upper left token if svMatrixCell, else return GetToken().
- May be NULL if SetToken() did so, also if type svDouble or svError! */
- inline ScConstTokenRef GetCellResultToken() const;
+ /** Return upper left token if formula::svMatrixCell, else return GetToken().
+ May be NULL if SetToken() did so, also if type formula::svDouble or formula::svError! */
+ inline formula::FormulaConstTokenRef GetCellResultToken() const;
- /** Return type of result, including svError, svEmptyCell, svDouble and
- svMatrixCell. */
- inline StackVar GetType() const;
+ /** Return type of result, including formula::svError, formula::svEmptyCell, formula::svDouble and
+ formula::svMatrixCell. */
+ inline formula::StackVar GetType() const;
- /** If type is svMatrixCell return the type of upper left element, else
+ /** If type is formula::svMatrixCell return the type of upper left element, else
GetType() */
- inline StackVar GetCellResultType() const;
+ inline formula::StackVar GetCellResultType() const;
- /** If type is svEmptyCell (including matrix upper left) and should be
+ /** If type is formula::svEmptyCell (including matrix upper left) and should be
displayed as empty string */
inline bool IsEmptyDisplayedAsString() const;
- /** Test for cell result type svDouble, including upper left if
- svMatrixCell. Also included is svError for legacy, because previously
+ /** Test for cell result type formula::svDouble, including upper left if
+ formula::svMatrixCell. Also included is formula::svError for legacy, because previously
an error result was treated like a numeric value at some places in
- ScFormulaCell. Also included is svEmptyCell as a reference to an empty
+ ScFormulaCell. Also included is formula::svEmptyCell as a reference to an empty
cell usually is treated as numeric 0. Use GetCellResultType() for
details instead. */
inline bool IsValue() const;
- /** Get error code if set or GetCellResultType() is svError or svUnknown,
+ /** Get error code if set or GetCellResultType() is formula::svError or svUnknown,
else 0. */
inline USHORT GetResultError() const;
@@ -163,22 +163,22 @@ public:
/** Set direct double. Shouldn't be used externally except in
ScFormulaCell for rounded CalcAsShown or SetErrCode(). If
ScMatrixFormulaCellToken the token isn't replaced but upper left result
- is modified instead, but only if it was of type svDouble before or not
+ is modified instead, but only if it was of type formula::svDouble before or not
set at all. */
inline void SetDouble( double f );
- /** Return value if type svDouble or svHybridCell or svMatrixCell and upper
- left svDouble, else 0.0 */
+ /** Return value if type formula::svDouble or formula::svHybridCell or formula::svMatrixCell and upper
+ left formula::svDouble, else 0.0 */
inline double GetDouble() const;
- /** Return string if type svString or svHybridCell or svMatrixCell and
- upper left svString, else empty string. */
+ /** Return string if type formula::svString or formula::svHybridCell or formula::svMatrixCell and
+ upper left formula::svString, else empty string. */
inline const String & GetString() const;
- /** Return matrix if type svMatrixCell and ScMatrix present, else NULL. */
+ /** Return matrix if type formula::svMatrixCell and ScMatrix present, else NULL. */
inline ScConstMatrixRef GetMatrix() const;
- /** Return formula string if type svHybridCell, else empty string. */
+ /** Return formula string if type formula::svHybridCell, else empty string. */
inline const String & GetHybridFormula() const;
/** Should only be used by import filters, best in the order
@@ -214,7 +214,7 @@ inline void ScFormulaResult::ResetToDefaults()
}
-inline void ScFormulaResult::ResolveToken( const ScToken * p )
+inline void ScFormulaResult::ResolveToken( const formula::FormulaToken * p )
{
ResetToDefaults();
if (!p)
@@ -226,20 +226,20 @@ inline void ScFormulaResult::ResolveToken( const ScToken * p )
{
switch (p->GetType())
{
- case svError:
+ case formula::svError:
mnError = p->GetError();
p->DecRef();
mbToken = false;
// set in case mnError is 0 now, which shouldn't happen but ...
mfValue = 0.0;
break;
- case svEmptyCell:
+ case formula::svEmptyCell:
mbEmpty = true;
mbEmptyDisplayedAsString = static_cast<const ScEmptyCellToken*>(p)->IsDisplayedAsString();
p->DecRef();
mbToken = false;
break;
- case svDouble:
+ case formula::svDouble:
mfValue = p->GetDouble();
p->DecRef();
mbToken = false;
@@ -289,7 +289,7 @@ inline void ScFormulaResult::Assign( const ScFormulaResult & r )
}
-inline void ScFormulaResult::SetToken( const ScToken* p )
+inline void ScFormulaResult::SetToken( const formula::FormulaToken* p )
{
ResetToDefaults();
if (p)
@@ -300,7 +300,7 @@ inline void ScFormulaResult::SetToken( const ScToken* p )
if (pMatFormula)
{
const ScMatrixCellResultToken* pMatResult =
- (p && p->GetType() == svMatrixCell ?
+ (p && p->GetType() == formula::svMatrixCell ?
dynamic_cast<const ScMatrixCellResultToken*>(p) : NULL);
if (pMatResult)
{
@@ -356,25 +356,25 @@ inline void ScFormulaResult::SetDouble( double f )
}
-inline StackVar ScFormulaResult::GetType() const
+inline formula::StackVar ScFormulaResult::GetType() const
{
// Order is significant.
if (mnError)
- return svError;
+ return formula::svError;
if (mbEmpty)
- return svEmptyCell;
+ return formula::svEmptyCell;
if (!mbToken)
- return svDouble;
+ return formula::svDouble;
if (mpToken)
return mpToken->GetType();
- return svUnknown;
+ return formula::svUnknown;
}
-inline StackVar ScFormulaResult::GetCellResultType() const
+inline formula::StackVar ScFormulaResult::GetCellResultType() const
{
- StackVar sv = GetType();
- if (sv == svMatrixCell)
+ formula::StackVar sv = GetType();
+ if (sv == formula::svMatrixCell)
// don't need to test for mpToken here, GetType() already did it
sv = static_cast<const ScMatrixCellResultToken*>(mpToken)->GetUpperLeftType();
return sv;
@@ -385,7 +385,7 @@ inline bool ScFormulaResult::IsEmptyDisplayedAsString() const
{
if (mbEmpty)
return mbEmptyDisplayedAsString;
- if (GetType() == svMatrixCell)
+ if (GetType() == formula::svMatrixCell)
{
// don't need to test for mpToken here, GetType() already did it
const ScEmptyCellToken* p = dynamic_cast<const ScEmptyCellToken*>(
@@ -400,8 +400,8 @@ inline bool ScFormulaResult::IsEmptyDisplayedAsString() const
inline bool ScFormulaResult::IsValue() const
{
- StackVar sv = GetCellResultType();
- return sv == svDouble || sv == svError || sv == svEmptyCell;
+ formula::StackVar sv = GetCellResultType();
+ return sv == formula::svDouble || sv == formula::svError || sv == formula::svEmptyCell;
}
@@ -409,10 +409,10 @@ inline USHORT ScFormulaResult::GetResultError() const
{
if (mnError)
return mnError;
- StackVar sv = GetCellResultType();
- if (sv == svError)
+ formula::StackVar sv = GetCellResultType();
+ if (sv == formula::svError)
{
- if (GetType() == svMatrixCell)
+ if (GetType() == formula::svMatrixCell)
// don't need to test for mpToken here, GetType() already did it
return static_cast<const ScMatrixCellResultToken*>(mpToken)->
GetUpperLeftToken()->GetError();
@@ -429,7 +429,7 @@ inline void ScFormulaResult::SetResultError( USHORT nErr )
}
-inline ScConstTokenRef ScFormulaResult::GetToken() const
+inline formula::FormulaConstTokenRef ScFormulaResult::GetToken() const
{
if (mbToken)
return mpToken;
@@ -437,9 +437,9 @@ inline ScConstTokenRef ScFormulaResult::GetToken() const
}
-inline ScConstTokenRef ScFormulaResult::GetCellResultToken() const
+inline formula::FormulaConstTokenRef ScFormulaResult::GetCellResultToken() const
{
- if (GetType() == svMatrixCell)
+ if (GetType() == formula::svMatrixCell)
// don't need to test for mpToken here, GetType() already did it
return static_cast<const ScMatrixCellResultToken*>(mpToken)->GetUpperLeftToken();
return GetToken();
@@ -450,18 +450,18 @@ inline double ScFormulaResult::GetDouble() const
{
if (mbToken)
{
- // Should really not be of type svDouble here.
+ // Should really not be of type formula::svDouble here.
if (mpToken)
{
switch (mpToken->GetType())
{
- case svHybridCell:
+ case formula::svHybridCell:
return mpToken->GetDouble();
- case svMatrixCell:
+ case formula::svMatrixCell:
{
const ScMatrixCellResultToken* p =
static_cast<const ScMatrixCellResultToken*>(mpToken);
- if (p->GetUpperLeftType() == svDouble)
+ if (p->GetUpperLeftType() == formula::svDouble)
return p->GetUpperLeftToken()->GetDouble();
}
break;
@@ -483,14 +483,14 @@ inline const String & ScFormulaResult::GetString() const
{
switch (mpToken->GetType())
{
- case svString:
- case svHybridCell:
+ case formula::svString:
+ case formula::svHybridCell:
return mpToken->GetString();
- case svMatrixCell:
+ case formula::svMatrixCell:
{
const ScMatrixCellResultToken* p =
static_cast<const ScMatrixCellResultToken*>(mpToken);
- if (p->GetUpperLeftType() == svString)
+ if (p->GetUpperLeftType() == formula::svString)
return p->GetUpperLeftToken()->GetString();
}
break;
@@ -504,15 +504,15 @@ inline const String & ScFormulaResult::GetString() const
inline ScConstMatrixRef ScFormulaResult::GetMatrix() const
{
- if (GetType() == svMatrixCell)
- return mpToken->GetMatrix();
+ if (GetType() == formula::svMatrixCell)
+ return static_cast<const ScToken*>(mpToken)->GetMatrix();
return NULL;
}
inline const String & ScFormulaResult::GetHybridFormula() const
{
- if (GetType() == svHybridCell)
+ if (GetType() == formula::svHybridCell)
{
const ScHybridCellToken* p = dynamic_cast<const ScHybridCellToken*>(mpToken);
if (p)
@@ -571,7 +571,7 @@ inline void ScFormulaResult::SetHybridFormula( const String & rFormula )
inline const ScMatrixFormulaCellToken* ScFormulaResult::GetMatrixFormulaCellToken() const
{
- return (GetType() == svMatrixCell ?
+ return (GetType() == formula::svMatrixCell ?
dynamic_cast<const ScMatrixFormulaCellToken*>(mpToken) : NULL);
}
diff --git a/sc/inc/funcdesc.hxx b/sc/inc/funcdesc.hxx
index fe1d970e1c2e..683486286d9a 100644
--- a/sc/inc/funcdesc.hxx
+++ b/sc/inc/funcdesc.hxx
@@ -38,13 +38,36 @@
#include <tools/list.hxx>
#include <tools/string.hxx>
+#include <formula/IFunctionDescription.hxx>
#define MAX_FUNCCAT 12 /* maximum number of categories for functions */
-class ScFuncDesc
+class ScFuncDesc : public formula::IFunctionDescription
{
public:
+ virtual ::rtl::OUString getFunctionName() const ;
+ virtual const formula::IFunctionCategory* getCategory() const ;
+ virtual ::rtl::OUString getDescription() const ;
+ // GetSuppressedArgCount
+ virtual xub_StrLen getSuppressedArgumentCount() const ;
+ /** Returns the function signature with parameters from the passed string array. */
+ virtual ::rtl::OUString getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const ;
+ // GetVisibleArgMapping
+ /** Returns mapping from visible arguments to real arguments, e.g. if of 4
+ parameters the second one is suppressed {0,2,3}. For VAR_ARGS
+ parameters only one element is added to the end of the sequence. */
+ virtual void fillVisibleArgumentMapping(::std::vector<USHORT>& _rArguments) const ;
+ virtual void initArgumentInfo() const;
+ virtual ::rtl::OUString getSignature() const ;
+ virtual long getHelpId() const ;
+
+ // parameter
+ virtual sal_uInt32 getParameterCount() const ;
+ virtual ::rtl::OUString getParameterName(sal_uInt32 _nPos) const ;
+ virtual ::rtl::OUString getParameterDescription(sal_uInt32 _nPos) const ;
+ virtual bool isParameterOptional(sal_uInt32 _nPos) const ;
+
struct ParameterFlags
{
bool bOptional :1; // Parameter is optional
@@ -53,18 +76,18 @@ public:
ParameterFlags() : bOptional(false), bSuppress(false) {}
};
- ScFuncDesc();
- ~ScFuncDesc();
+
+ ScFuncDesc();
+ virtual ~ScFuncDesc();
void Clear();
- void InitArgumentInfo() const;
/** Returns a semicolon separated list of all parameter names. */
String GetParamList () const;
/** Returns the full function signature: "FUNCTIONNAME( parameter list )". */
String GetSignature () const;
- /** Returns the function signature with parameters from the passed string array. */
- String GetFormulaString ( String** aArgArr ) const;
+
+
/** Returns the number of non-suppressed arguments. In case there are
variable arguments the number of fixed non-suppressed arguments plus
@@ -72,11 +95,6 @@ public:
suppressed). */
USHORT GetSuppressedArgCount() const;
- /** Returns mapping from visible arguments to real arguments, e.g. if of 4
- parameters the second one is suppressed {0,2,3}. For VAR_ARGS
- parameters only one element is added to the end of the sequence. */
- ::std::vector<USHORT> GetVisibleArgMapping() const;
-
String *pFuncName; // Function name
String *pFuncDesc; // Description of function
String **ppDefArgNames; // Parameter name(s)
@@ -119,54 +137,47 @@ private:
};
//============================================================================
-
-class ScFunctionMgr
+class ScFunctionCategory : public formula::IFunctionCategory
{
+ ScFunctionMgr* m_pMgr;
+ List* m_pCategory;
+ mutable ::rtl::OUString m_sName;
+ sal_uInt32 m_nCategory;
public:
- ScFunctionMgr();
- ~ScFunctionMgr();
-
- const ScFuncDesc* Get( const String& rFName );
- const ScFuncDesc* Get( USHORT nFIndex );
- const ScFuncDesc* First( USHORT nCategory = 0 );
- const ScFuncDesc* Next() const;
-
-private:
- ScFunctionList* pFuncList;
- List* aCatLists[MAX_FUNCCAT];
- List* pCurCatList;
+ ScFunctionCategory(ScFunctionMgr* _pMgr,List* _pCategory,sal_uInt32 _nCategory) : m_pMgr(_pMgr),m_pCategory(_pCategory),m_nCategory(_nCategory){}
+ virtual ~ScFunctionCategory(){}
+ virtual sal_uInt32 getCount() const;
+ virtual const formula::IFunctionManager* getFunctionManager() const;
+ virtual const formula::IFunctionDescription* getFunction(sal_uInt32 _nPos) const;
+ virtual sal_uInt32 getNumber() const;
+ virtual ::rtl::OUString getName() const;
};
-
-//==================================================================
-
-class ScFormulaUtil
+//============================================================================
+#define SC_FUNCGROUP_COUNT ID_FUNCTION_GRP_ADDINS
+class ScFunctionMgr : public formula::IFunctionManager
{
public:
- static BOOL GetNextFunc( const String& rFormula,
- BOOL bBack,
- xub_StrLen& rFStart, // Ein- und Ausgabe
- xub_StrLen* pFEnd = NULL,
- const ScFuncDesc** ppFDesc = NULL,
- String*** pppArgs = NULL );
+ ScFunctionMgr();
+ virtual ~ScFunctionMgr();
- static xub_StrLen GetFunctionStart( const String& rFormula, xub_StrLen nStart,
- BOOL bBack, String* pFuncName = NULL );
+ static String GetCategoryName(sal_uInt32 _nCategoryNumber );
- static xub_StrLen GetFunctionEnd ( const String& rFormula, xub_StrLen nStart );
-
- static xub_StrLen GetArgStart ( const String& rFormula, xub_StrLen nStart,
- USHORT nArg );
-
- static String** GetArgStrings ( const String& rFormula,
- xub_StrLen nFuncPos,
- USHORT nArgs );
+ const ScFuncDesc* Get( const String& rFName ) const;
+ const ScFuncDesc* Get( USHORT nFIndex ) const;
+ const ScFuncDesc* First( USHORT nCategory = 0 ) const;
+ const ScFuncDesc* Next() const;
- static void FillArgStrings ( const String& rFormula,
- xub_StrLen nFuncPos,
- USHORT nArgs,
- String** pArgs );
+ // formula::IFunctionManager
+ virtual sal_uInt32 getCount() const;
+ virtual const formula::IFunctionCategory* getCategory(sal_uInt32 nPos) const;
+ virtual void fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const;
+ virtual const formula::IFunctionDescription* getFunctionByName(const ::rtl::OUString& _sFunctionName) const;
+ virtual const sal_Unicode getSingleToken(const formula::IFunctionManager::EToken _eToken) const;
+private:
+ ScFunctionList* pFuncList;
+ List* aCatLists[MAX_FUNCCAT];
+ mutable List* pCurCatList;
};
//============================================================================
-
#endif // SC_FUNCDESC_HXX
diff --git a/sc/inc/grammar.hxx b/sc/inc/grammar.hxx
deleted file mode 100644
index 2a8dc0f1c185..000000000000
--- a/sc/inc/grammar.hxx
+++ /dev/null
@@ -1,218 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: grammar.hxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_GRAMMAR_HXX
-#define SC_GRAMMAR_HXX
-
-#include "com/sun/star/sheet/FormulaLanguage.hpp"
-#include "address.hxx"
-
-/** Grammars digested by ScCompiler.
- */
-class ScGrammar
-{
-public:
-
- //! ScAddress::CONV_UNSPECIFIED is a negative value!
- static const int kConventionOffset = - ScAddress::CONV_UNSPECIFIED + 1;
- // Room for 32k hypothetical languages plus EXTERNAL.
- static const int kConventionShift = 16;
- // Room for 256 reference conventions.
- static const int kEnglishBit = (1 << (kConventionShift + 8));
- // Mask off all non-language bits.
- static const int kFlagMask = ~((~int(0)) << kConventionShift);
-
- /** Values encoding the formula language plus address reference convention
- plus English parsing/formatting
- */
- //! When adding new values adapt isSupported() below as well.
- enum Grammar
- {
- /// Used only in ScCompiler ctor and in some XML import API context.
- GRAM_UNSPECIFIED = -1,
- /// ODFF with default ODF A1 bracketed references.
- GRAM_ODFF = ::com::sun::star::sheet::FormulaLanguage::ODFF |
- ((ScAddress::CONV_ODF +
- kConventionOffset) << kConventionShift) |
- kEnglishBit,
- /// ODF 1.1 with default ODF A1 bracketed references.
- GRAM_PODF = ::com::sun::star::sheet::FormulaLanguage::ODF_11 |
- ((ScAddress::CONV_ODF +
- kConventionOffset) << kConventionShift) |
- kEnglishBit,
- /// English with default A1 reference style.
- GRAM_ENGLISH = ::com::sun::star::sheet::FormulaLanguage::ENGLISH |
- ((ScAddress::CONV_OOO +
- kConventionOffset) << kConventionShift) |
- kEnglishBit,
- /// Native with default A1 reference style.
- GRAM_NATIVE = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
- ((ScAddress::CONV_OOO +
- kConventionOffset) << kConventionShift),
- /// ODFF with reference style as set in UI, may be A1 or R1C1.
- GRAM_ODFF_UI = ::com::sun::star::sheet::FormulaLanguage::ODFF |
- ((ScAddress::CONV_UNSPECIFIED +
- kConventionOffset) << kConventionShift) |
- kEnglishBit,
- /// ODFF with A1 reference style, unbracketed.
- GRAM_ODFF_A1 = ::com::sun::star::sheet::FormulaLanguage::ODFF |
- ((ScAddress::CONV_OOO +
- kConventionOffset) << kConventionShift) |
- kEnglishBit,
- /// ODF 1.1 with reference style as set in UI, may be A1 or R1C1.
- GRAM_PODF_UI = ::com::sun::star::sheet::FormulaLanguage::ODF_11 |
- ((ScAddress::CONV_UNSPECIFIED +
- kConventionOffset) << kConventionShift) |
- kEnglishBit,
- /// ODF 1.1 with A1 reference style, unbracketed.
- GRAM_PODF_A1 = ::com::sun::star::sheet::FormulaLanguage::ODF_11 |
- ((ScAddress::CONV_OOO +
- kConventionOffset) << kConventionShift) |
- kEnglishBit,
- /// Native with reference style as set in UI, may be A1 or R1C1.
- GRAM_NATIVE_UI = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
- ((ScAddress::CONV_UNSPECIFIED +
- kConventionOffset) << kConventionShift),
- /// Native with ODF A1 bracketed references. Not very useful but supported.
- GRAM_NATIVE_ODF = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
- ((ScAddress::CONV_ODF +
- kConventionOffset) << kConventionShift),
- /// Native with Excel A1 reference style.
- GRAM_NATIVE_XL_A1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
- ((ScAddress::CONV_XL_A1 +
- kConventionOffset) << kConventionShift),
- /// Native with Excel R1C1 reference style.
- GRAM_NATIVE_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
- ((ScAddress::CONV_XL_R1C1 +
- kConventionOffset) << kConventionShift),
- /// Central definition of the default grammar to be used.
- GRAM_DEFAULT = GRAM_NATIVE_UI,
-
- /// Central definition of the default storage grammar to be used.
- GRAM_STORAGE_DEFAULT = GRAM_ODFF,
-
- /** OpCodeMap set by external filter and merged with reference
- convention plus English bit on top. Plain value acts as
- FormulaLanguage. */
- GRAM_EXTERNAL = (1 << (kConventionShift - 1))
- };
-
- /// If English parsing/formatting is associated with a grammar.
- static inline bool isEnglish( const Grammar eGrammar )
- {
- return (eGrammar & kEnglishBit) != 0;
- }
-
- /** Compatibility helper for old "bCompileEnglish, bCompileXML" API calls
- to obtain the new grammar. */
- static Grammar mapAPItoGrammar( const bool bEnglish, const bool bXML )
- {
- Grammar eGrammar;
- if (bEnglish && bXML)
- eGrammar = GRAM_PODF;
- else if (bEnglish && !bXML)
- eGrammar = GRAM_PODF_A1;
- else if (!bEnglish && bXML)
- eGrammar = GRAM_NATIVE_ODF;
- else // (!bEnglish && !bXML)
- eGrammar = GRAM_NATIVE;
- return eGrammar;
- }
-
- static bool isSupported( const Grammar eGrammar )
- {
- switch (eGrammar)
- {
- case GRAM_ODFF :
- case GRAM_PODF :
- case GRAM_ENGLISH :
- case GRAM_NATIVE :
- case GRAM_ODFF_UI :
- case GRAM_ODFF_A1 :
- case GRAM_PODF_UI :
- case GRAM_PODF_A1 :
- case GRAM_NATIVE_UI :
- case GRAM_NATIVE_ODF :
- case GRAM_NATIVE_XL_A1 :
- case GRAM_NATIVE_XL_R1C1 :
- return true;
- default:
- return extractFormulaLanguage( eGrammar) == GRAM_EXTERNAL;
- }
- }
-
- static inline sal_Int32 extractFormulaLanguage( const Grammar eGrammar )
- {
- return eGrammar & kFlagMask;
- }
-
- static inline ScAddress::Convention extractRefConvention( const Grammar eGrammar )
- {
- return static_cast<ScAddress::Convention>(
- ((eGrammar & ~kEnglishBit) >> kConventionShift) -
- kConventionOffset);
- }
-
- static inline Grammar setEnglishBit( const Grammar eGrammar, const bool bEnglish )
- {
- if (bEnglish)
- return static_cast<Grammar>( eGrammar | kEnglishBit);
- else
- return static_cast<Grammar>( eGrammar & ~kEnglishBit);
- }
-
- static inline Grammar mergeToGrammar( const Grammar eGrammar, const ScAddress::Convention eConv )
- {
- bool bEnglish = isEnglish( eGrammar);
- Grammar eGram = static_cast<Grammar>(
- extractFormulaLanguage( eGrammar) |
- ((eConv + kConventionOffset) << kConventionShift));
- eGram = setEnglishBit( eGram, bEnglish);
- DBG_ASSERT( isSupported( eGram), "ScCompilerGrammarMap::mergeToGrammar: unsupported grammar");
- return eGram;
- }
-
- /// If grammar is of ODF 1.1
- static inline bool isPODF( const Grammar eGrammar )
- {
- return extractFormulaLanguage( eGrammar) ==
- ::com::sun::star::sheet::FormulaLanguage::ODF_11;
- }
-
- /// If grammar is of ODFF
- static inline bool isODFF( const Grammar eGrammar )
- {
- return extractFormulaLanguage( eGrammar) ==
- ::com::sun::star::sheet::FormulaLanguage::ODFF;
- }
-
-};
-
-#endif // SC_GRAMMAR_HXX
diff --git a/sc/inc/intruref.hxx b/sc/inc/intruref.hxx
deleted file mode 100644
index 0444fdb839c2..000000000000
--- a/sc/inc/intruref.hxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: intruref.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_INTRUREF_HXX
-#define SC_INTRUREF_HXX
-
-/** A simple intrusive refcounting template, not thread safe, but therefore
- also a bit faster than boost's smart_ptr or uno::Reference equivalents, and
- the type to be refcounted has full control over its behavior.
-
- Mainly used in formula compiler and interpreter context, e.g. ScTokenRef,
- ScMatrixRef.
-
- Type T must implement methods IncRef() and DecRef(), in case typename T is
- const they must be const as well and the reference counter be mutable.
- */
-template< typename T > class ScSimpleIntrusiveReference
-{
- T* p;
-public:
- inline ScSimpleIntrusiveReference() : p(0) {}
- inline ScSimpleIntrusiveReference( const ScSimpleIntrusiveReference& r )
- {
- p = r.p;
- if ( p )
- p->IncRef();
- }
- inline ScSimpleIntrusiveReference( T *t )
- {
- p = t;
- if ( p )
- t->IncRef();
- }
- inline void Clear()
- {
- if ( p )
- {
- p->DecRef();
- p = 0;
- }
- }
- inline ~ScSimpleIntrusiveReference()
- {
- if ( p )
- p->DecRef();
- }
- inline ScSimpleIntrusiveReference& operator=( T* t )
- {
- if ( t )
- t->IncRef();
- if ( p )
- p->DecRef();
- p = t;
- return *this;
- }
- inline ScSimpleIntrusiveReference& operator=( const ScSimpleIntrusiveReference& r )
- {
- *this = r.p;
- return *this;
- }
- inline bool Is() const { return p != 0; }
- inline bool operator ! () const { return p == 0; }
- inline T* operator&() const { return p; }
- inline T* operator->() const { return p; }
- inline T& operator*() const { return *p; }
- inline operator T*() const { return p; }
-};
-
-#endif // SC_INTRUREF_HXX
-
diff --git a/sc/inc/lookupcache.hxx b/sc/inc/lookupcache.hxx
index 2e0a81e1adf6..12b85d54cc49 100644
--- a/sc/inc/lookupcache.hxx
+++ b/sc/inc/lookupcache.hxx
@@ -32,7 +32,8 @@
#define INCLUDED_SC_LOOKUPCACHE_HXX
#include "address.hxx"
-#include "token.hxx"
+#include "global.hxx"
+#include "formula/token.hxx"
#include <svtools/listener.hxx>
#include <tools/string.hxx>
diff --git a/sc/inc/nameuno.hxx b/sc/inc/nameuno.hxx
index a34e32ee8e30..bac1dd9711d5 100644
--- a/sc/inc/nameuno.hxx
+++ b/sc/inc/nameuno.hxx
@@ -33,7 +33,7 @@
#include <svtools/lstner.hxx>
#include "address.hxx"
-#include "grammar.hxx"
+#include "formula/grammar.hxx"
#include <com/sun/star/sheet/XLabelRange.hpp>
#include <com/sun/star/sheet/XLabelRanges.hpp>
#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
@@ -74,7 +74,7 @@ private:
void Modify_Impl( const String* pNewName,
const ScTokenArray* pNewTokens, const String* pNewContent,
const ScAddress* pNewPos, const sal_uInt16* pNewType,
- const ScGrammar::Grammar eGrammar );
+ const formula::FormulaGrammar::Grammar eGrammar );
public:
ScNamedRangeObj(ScDocShell* pDocSh, const String& rNm);
@@ -170,7 +170,7 @@ public:
// methods accessible via getImplementation()
void SetContentWithGrammar( const ::rtl::OUString& aContent,
- const ScGrammar::Grammar eGrammar )
+ const formula::FormulaGrammar::Grammar eGrammar )
throw(::com::sun::star::uno::RuntimeException);
};
diff --git a/sc/inc/opcode.hxx b/sc/inc/opcode.hxx
deleted file mode 100644
index 278b7f2d22f6..000000000000
--- a/sc/inc/opcode.hxx
+++ /dev/null
@@ -1,414 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: opcode.hxx,v $
- * $Revision: 1.23.134.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_OPCODE_HXX
-#define SC_OPCODE_HXX
-
-#ifndef SC_COMPILER_HRC
-#include "compiler.hrc" // OpCodes
-#endif
-#include <tools/solar.h>
-
-enum OpCodeEnum
-{
- // Special commands
- ocPush = SC_OPCODE_PUSH,
- ocCall = SC_OPCODE_CALL,
- ocStop = SC_OPCODE_STOP,
- ocExternal = SC_OPCODE_EXTERNAL,
- ocName = SC_OPCODE_NAME,
- ocExternalRef = SC_OPCODE_EXTERNAL_REF,
- // Jump commands
- ocIf = SC_OPCODE_IF,
- ocChose = SC_OPCODE_CHOSE,
- // Parentheses and separators
- ocOpen = SC_OPCODE_OPEN,
- ocClose = SC_OPCODE_CLOSE,
- ocSep = SC_OPCODE_SEP,
- ocArrayOpen = SC_OPCODE_ARRAY_OPEN,
- ocArrayClose = SC_OPCODE_ARRAY_CLOSE,
- ocArrayRowSep = SC_OPCODE_ARRAY_ROW_SEP,
- ocArrayColSep = SC_OPCODE_ARRAY_COL_SEP,
- // Special OpCodes
- ocMissing = SC_OPCODE_MISSING,
- ocBad = SC_OPCODE_BAD,
- ocSpaces = SC_OPCODE_SPACES,
- ocMatRef = SC_OPCODE_MAT_REF,
- // Access commands
- ocDBArea = SC_OPCODE_DB_AREA,
- ocMacro = SC_OPCODE_MACRO,
- ocColRowName = SC_OPCODE_COL_ROW_NAME,
- ocColRowNameAuto = SC_OPCODE_COL_ROW_NAME_AUTO,
- // Percent operator _follows_ value
- ocPercentSign = SC_OPCODE_PERCENT_SIGN,
- // Error constants
- ocErrNull = SC_OPCODE_ERROR_NULL,
- ocErrDivZero = SC_OPCODE_ERROR_DIVZERO,
- ocErrValue = SC_OPCODE_ERROR_VALUE,
- ocErrRef = SC_OPCODE_ERROR_REF,
- ocErrName = SC_OPCODE_ERROR_NAME,
- ocErrNum = SC_OPCODE_ERROR_NUM,
- ocErrNA = SC_OPCODE_ERROR_NA,
- // Binary operators
- ocAdd = SC_OPCODE_ADD,
- ocSub = SC_OPCODE_SUB,
- ocMul = SC_OPCODE_MUL,
- ocDiv = SC_OPCODE_DIV,
- ocAmpersand = SC_OPCODE_AMPERSAND,
- ocPow = SC_OPCODE_POW,
- ocEqual = SC_OPCODE_EQUAL,
- ocNotEqual = SC_OPCODE_NOT_EQUAL,
- ocLess = SC_OPCODE_LESS,
- ocGreater = SC_OPCODE_GREATER,
- ocLessEqual = SC_OPCODE_LESS_EQUAL,
- ocGreaterEqual = SC_OPCODE_GREATER_EQUAL,
- ocAnd = SC_OPCODE_AND,
- ocOr = SC_OPCODE_OR,
- ocIntersect = SC_OPCODE_INTERSECT,
- ocUnion = SC_OPCODE_UNION,
- ocRange = SC_OPCODE_RANGE,
- // Unary operators
- ocNot = SC_OPCODE_NOT,
- ocNeg = SC_OPCODE_NEG,
- ocNegSub = SC_OPCODE_NEG_SUB,
- // Functions with no parameters
- ocPi = SC_OPCODE_PI,
- ocRandom = SC_OPCODE_RANDOM,
- ocTrue = SC_OPCODE_TRUE,
- ocFalse = SC_OPCODE_FALSE,
- ocGetActDate = SC_OPCODE_GET_ACT_DATE,
- ocGetActTime = SC_OPCODE_GET_ACT_TIME,
- ocNotAvail = SC_OPCODE_NO_VALUE,
- ocCurrent = SC_OPCODE_CURRENT,
- // Functions with one parameter
- ocDeg = SC_OPCODE_DEG,
- ocRad = SC_OPCODE_RAD,
- ocSin = SC_OPCODE_SIN,
- ocCos = SC_OPCODE_COS,
- ocTan = SC_OPCODE_TAN,
- ocCot = SC_OPCODE_COT,
- ocArcSin = SC_OPCODE_ARC_SIN,
- ocArcCos = SC_OPCODE_ARC_COS,
- ocArcTan = SC_OPCODE_ARC_TAN,
- ocArcCot = SC_OPCODE_ARC_COT,
- ocSinHyp = SC_OPCODE_SIN_HYP,
- ocCosHyp = SC_OPCODE_COS_HYP,
- ocTanHyp = SC_OPCODE_TAN_HYP,
- ocCotHyp = SC_OPCODE_COT_HYP,
- ocArcSinHyp = SC_OPCODE_ARC_SIN_HYP,
- ocArcCosHyp = SC_OPCODE_ARC_COS_HYP,
- ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP,
- ocArcCotHyp = SC_OPCODE_ARC_COT_HYP,
- ocExp = SC_OPCODE_EXP,
- ocLn = SC_OPCODE_LN,
- ocSqrt = SC_OPCODE_SQRT,
- ocFact = SC_OPCODE_FACT,
- ocGetYear = SC_OPCODE_GET_YEAR,
- ocGetMonth = SC_OPCODE_GET_MONTH,
- ocGetDay = SC_OPCODE_GET_DAY,
- ocGetHour = SC_OPCODE_GET_HOUR,
- ocGetMin = SC_OPCODE_GET_MIN,
- ocGetSec = SC_OPCODE_GET_SEC,
- ocPlusMinus = SC_OPCODE_PLUS_MINUS,
- ocAbs = SC_OPCODE_ABS,
- ocInt = SC_OPCODE_INT,
- ocPhi = SC_OPCODE_PHI,
- ocGauss = SC_OPCODE_GAUSS,
- ocIsEmpty = SC_OPCODE_IS_EMPTY,
- ocIsString = SC_OPCODE_IS_STRING,
- ocIsNonString = SC_OPCODE_IS_NON_STRING,
- ocIsLogical = SC_OPCODE_IS_LOGICAL,
- ocType = SC_OPCODE_TYPE,
- ocCell = SC_OPCODE_CELL,
- ocIsRef = SC_OPCODE_IS_REF,
- ocIsValue = SC_OPCODE_IS_VALUE,
- ocIsFormula = SC_OPCODE_IS_FORMULA,
- ocIsNA = SC_OPCODE_IS_NV,
- ocIsErr = SC_OPCODE_IS_ERR,
- ocIsError = SC_OPCODE_IS_ERROR,
- ocIsEven = SC_OPCODE_IS_EVEN,
- ocIsOdd = SC_OPCODE_IS_ODD,
- ocN = SC_OPCODE_N,
- // String functions
- ocGetDateValue = SC_OPCODE_GET_DATE_VALUE,
- ocGetTimeValue = SC_OPCODE_GET_TIME_VALUE,
- ocCode = SC_OPCODE_CODE,
- ocTrim = SC_OPCODE_TRIM,
- ocUpper = SC_OPCODE_UPPER,
- ocPropper = SC_OPCODE_PROPPER,
- ocLower = SC_OPCODE_LOWER,
- ocLen = SC_OPCODE_LEN,
- ocT = SC_OPCODE_T,
- ocValue = SC_OPCODE_VALUE,
- ocClean = SC_OPCODE_CLEAN,
- ocChar = SC_OPCODE_CHAR,
- ocLog10 = SC_OPCODE_LOG10,
- ocEven = SC_OPCODE_EVEN,
- ocOdd = SC_OPCODE_ODD,
- ocStdNormDist = SC_OPCODE_STD_NORM_DIST,
- ocFisher = SC_OPCODE_FISHER,
- ocFisherInv = SC_OPCODE_FISHER_INV,
- ocSNormInv = SC_OPCODE_S_NORM_INV,
- ocGammaLn = SC_OPCODE_GAMMA_LN,
- ocGamma = SC_OPCODE_GAMMA,
- ocErrorType = SC_OPCODE_ERROR_TYPE,
- ocErrCell = SC_OPCODE_ERR_CELL,
- ocFormula = SC_OPCODE_FORMULA,
- ocArabic = SC_OPCODE_ARABIC,
- ocInfo = SC_OPCODE_INFO,
- ocBahtText = SC_OPCODE_BAHTTEXT,
- ocJis = SC_OPCODE_JIS,
- ocAsc = SC_OPCODE_ASC,
- ocUnicode = SC_OPCODE_UNICODE,
- ocUnichar = SC_OPCODE_UNICHAR,
- // Functions with more than one parameters
- ocArcTan2 = SC_OPCODE_ARC_TAN_2,
- ocCeil = SC_OPCODE_CEIL,
- ocFloor = SC_OPCODE_FLOOR,
- ocRound = SC_OPCODE_ROUND,
- ocRoundUp = SC_OPCODE_ROUND_UP,
- ocRoundDown = SC_OPCODE_ROUND_DOWN,
- ocTrunc = SC_OPCODE_TRUNC,
- ocLog = SC_OPCODE_LOG,
- ocPower = SC_OPCODE_POWER,
- ocGCD = SC_OPCODE_GGT,
- ocLCM = SC_OPCODE_KGV,
- ocMod = SC_OPCODE_MOD,
- ocSumProduct = SC_OPCODE_SUM_PRODUCT,
- ocSumSQ = SC_OPCODE_SUM_SQ,
- ocSumX2MY2 = SC_OPCODE_SUM_X2MY2,
- ocSumX2DY2 = SC_OPCODE_SUM_X2DY2,
- ocSumXMY2 = SC_OPCODE_SUM_XMY2,
- ocGetDate = SC_OPCODE_GET_DATE,
- ocGetTime = SC_OPCODE_GET_TIME,
- ocGetDiffDate = SC_OPCODE_GET_DIFF_DATE,
- ocGetDiffDate360 = SC_OPCODE_GET_DIFF_DATE_360,
- ocMin = SC_OPCODE_MIN,
- ocMax = SC_OPCODE_MAX,
- ocSum = SC_OPCODE_SUM,
- ocProduct = SC_OPCODE_PRODUCT,
- ocAverage = SC_OPCODE_AVERAGE,
- ocCount = SC_OPCODE_COUNT,
- ocCount2 = SC_OPCODE_COUNT_2,
- ocNPV = SC_OPCODE_NBW,
- ocIRR = SC_OPCODE_IKV,
- ocMIRR = SC_OPCODE_MIRR,
- ocISPMT = SC_OPCODE_ISPMT,
- ocVar = SC_OPCODE_VAR,
- ocVarP = SC_OPCODE_VAR_P,
- ocStDev = SC_OPCODE_ST_DEV,
- ocStDevP = SC_OPCODE_ST_DEV_P,
- ocB = SC_OPCODE_B,
- ocNormDist = SC_OPCODE_NORM_DIST,
- ocExpDist = SC_OPCODE_EXP_DIST,
- ocBinomDist = SC_OPCODE_BINOM_DIST,
- ocPoissonDist = SC_OPCODE_POISSON_DIST,
- ocKombin = SC_OPCODE_KOMBIN,
- ocKombin2 = SC_OPCODE_KOMBIN_2,
- ocVariationen = SC_OPCODE_VARIATIONEN,
- ocVariationen2 = SC_OPCODE_VARIATIONEN_2,
- ocBW = SC_OPCODE_BW,
- ocDIA = SC_OPCODE_DIA,
- ocGDA = SC_OPCODE_GDA,
- ocGDA2 = SC_OPCODE_GDA_2,
- ocVBD = SC_OPCODE_VBD,
- ocLaufz = SC_OPCODE_LAUFZ,
- ocLIA = SC_OPCODE_LIA,
- ocRMZ = SC_OPCODE_RMZ,
- ocColumns = SC_OPCODE_COLUMNS,
- ocRows = SC_OPCODE_ROWS,
- ocColumn = SC_OPCODE_COLUMN,
- ocRow = SC_OPCODE_ROW,
- ocZGZ = SC_OPCODE_ZGZ,
- ocZW = SC_OPCODE_ZW,
- ocZZR = SC_OPCODE_ZZR,
- ocZins = SC_OPCODE_ZINS,
- ocZinsZ = SC_OPCODE_ZINS_Z,
- ocKapz = SC_OPCODE_KAPZ,
- ocKumZinsZ = SC_OPCODE_KUM_ZINS_Z,
- ocKumKapZ = SC_OPCODE_KUM_KAP_Z,
- ocEffektiv = SC_OPCODE_EFFEKTIV,
- ocNominal = SC_OPCODE_NOMINAL,
- ocSubTotal = SC_OPCODE_SUB_TOTAL,
- // Database functions
- ocDBSum = SC_OPCODE_DB_SUM,
- ocDBCount = SC_OPCODE_DB_COUNT,
- ocDBCount2 = SC_OPCODE_DB_COUNT_2,
- ocDBAverage = SC_OPCODE_DB_AVERAGE,
- ocDBGet = SC_OPCODE_DB_GET,
- ocDBMax = SC_OPCODE_DB_MAX,
- ocDBMin = SC_OPCODE_DB_MIN,
- ocDBProduct = SC_OPCODE_DB_PRODUCT,
- ocDBStdDev = SC_OPCODE_DB_STD_DEV,
- ocDBStdDevP = SC_OPCODE_DB_STD_DEV_P,
- ocDBVar = SC_OPCODE_DB_VAR,
- ocDBVarP = SC_OPCODE_DB_VAR_P,
- // Management functions
- ocIndirect = SC_OPCODE_INDIRECT,
- ocIndirectXL = SC_OPCODE_INDIRECT_XL,
- ocAddress = SC_OPCODE_ADDRESS,
- ocAddressXL = SC_OPCODE_ADDRESS_XL,
- ocMatch = SC_OPCODE_MATCH,
- ocCountEmptyCells = SC_OPCODE_COUNT_EMPTY_CELLS,
- ocCountIf = SC_OPCODE_COUNT_IF,
- ocSumIf = SC_OPCODE_SUM_IF,
- ocLookup = SC_OPCODE_LOOKUP,
- ocVLookup = SC_OPCODE_V_LOOKUP,
- ocHLookup = SC_OPCODE_H_LOOKUP,
- ocMultiArea = SC_OPCODE_MULTI_AREA,
- ocOffset = SC_OPCODE_OFFSET,
- ocIndex = SC_OPCODE_INDEX,
- ocAreas = SC_OPCODE_AREAS,
- // String functions
- ocCurrency = SC_OPCODE_CURRENCY,
- ocReplace = SC_OPCODE_REPLACE,
- ocFixed = SC_OPCODE_FIXED,
- ocFind = SC_OPCODE_FIND,
- ocExact = SC_OPCODE_EXACT,
- ocLeft = SC_OPCODE_LEFT,
- ocRight = SC_OPCODE_RIGHT,
- ocSearch = SC_OPCODE_SEARCH,
- ocMid = SC_OPCODE_MID,
- ocText = SC_OPCODE_TEXT,
- ocSubstitute = SC_OPCODE_SUBSTITUTE,
- ocRept = SC_OPCODE_REPT,
- ocConcat = SC_OPCODE_CONCAT,
- // Matrix functions
- ocMatValue = SC_OPCODE_MAT_VALUE,
- ocMatDet = SC_OPCODE_MAT_DET,
- ocMatInv = SC_OPCODE_MAT_INV,
- ocMatMult = SC_OPCODE_MAT_MULT,
- ocMatTrans = SC_OPCODE_MAT_TRANS,
- ocMatrixUnit = SC_OPCODE_MATRIX_UNIT,
- // BackSolver
- ocBackSolver = SC_OPCODE_BACK_SOLVER,
- // Statistical functions
- ocHypGeomDist = SC_OPCODE_HYP_GEOM_DIST,
- ocLogNormDist = SC_OPCODE_LOG_NORM_DIST,
- ocTDist = SC_OPCODE_T_DIST,
- ocFDist = SC_OPCODE_F_DIST,
- ocChiDist = SC_OPCODE_CHI_DIST,
- ocChiSqDist = SC_OPCODE_CHISQ_DIST,
- ocChiSqInv = SC_OPCODE_CHISQ_INV,
- ocWeibull = SC_OPCODE_WEIBULL,
- ocNegBinomVert = SC_OPCODE_NEG_BINOM_VERT,
- ocKritBinom = SC_OPCODE_KRIT_BINOM,
- ocKurt = SC_OPCODE_KURT,
- ocHarMean = SC_OPCODE_HAR_MEAN,
- ocGeoMean = SC_OPCODE_GEO_MEAN,
- ocStandard = SC_OPCODE_STANDARD,
- ocAveDev = SC_OPCODE_AVE_DEV,
- ocSchiefe = SC_OPCODE_SCHIEFE,
- ocDevSq = SC_OPCODE_DEV_SQ,
- ocMedian = SC_OPCODE_MEDIAN,
- ocModalValue = SC_OPCODE_MODAL_VALUE,
- ocZTest = SC_OPCODE_Z_TEST,
- ocTTest = SC_OPCODE_T_TEST,
- ocRank = SC_OPCODE_RANK,
- ocPercentile = SC_OPCODE_PERCENTILE,
- ocPercentrank = SC_OPCODE_PERCENT_RANK,
- ocLarge = SC_OPCODE_LARGE,
- ocSmall = SC_OPCODE_SMALL,
- ocFrequency = SC_OPCODE_FREQUENCY,
- ocQuartile = SC_OPCODE_QUARTILE,
- ocNormInv = SC_OPCODE_NORM_INV,
- ocConfidence = SC_OPCODE_CONFIDENCE,
- ocFTest = SC_OPCODE_F_TEST,
- ocTrimMean = SC_OPCODE_TRIM_MEAN,
- ocProb = SC_OPCODE_PROB,
- ocCorrel = SC_OPCODE_CORREL,
- ocCovar = SC_OPCODE_COVAR,
- ocPearson = SC_OPCODE_PEARSON,
- ocRSQ = SC_OPCODE_RSQ,
- ocSTEYX = SC_OPCODE_STEYX,
- ocSlope = SC_OPCODE_SLOPE,
- ocIntercept = SC_OPCODE_INTERCEPT,
- ocTrend = SC_OPCODE_TREND,
- ocGrowth = SC_OPCODE_GROWTH,
- ocRGP = SC_OPCODE_RGP,
- ocRKP = SC_OPCODE_RKP,
- ocForecast = SC_OPCODE_FORECAST,
- ocChiInv = SC_OPCODE_CHI_INV,
- ocGammaDist = SC_OPCODE_GAMMA_DIST,
- ocGammaInv = SC_OPCODE_GAMMA_INV,
- ocTInv = SC_OPCODE_T_INV,
- ocFInv = SC_OPCODE_F_INV,
- ocChiTest = SC_OPCODE_CHI_TEST,
- ocLogInv = SC_OPCODE_LOG_INV,
- ocTableOp = SC_OPCODE_TABLE_OP,
- ocBetaDist = SC_OPCODE_BETA_DIST,
- ocBetaInv = SC_OPCODE_BETA_INV,
- // miscellaneous
- ocWeek = SC_OPCODE_WEEK,
- ocGetDayOfWeek = SC_OPCODE_GET_DAY_OF_WEEK,
- ocNoName = SC_OPCODE_NO_NAME,
- ocStyle = SC_OPCODE_STYLE,
- ocDde = SC_OPCODE_DDE,
- ocBase = SC_OPCODE_BASE,
- ocTable = SC_OPCODE_TABLE,
- ocTables = SC_OPCODE_TABLES,
- ocMinA = SC_OPCODE_MIN_A,
- ocMaxA = SC_OPCODE_MAX_A,
- ocAverageA = SC_OPCODE_AVERAGE_A,
- ocStDevA = SC_OPCODE_ST_DEV_A,
- ocStDevPA = SC_OPCODE_ST_DEV_P_A,
- ocVarA = SC_OPCODE_VAR_A,
- ocVarPA = SC_OPCODE_VAR_P_A,
- ocEasterSunday = SC_OPCODE_EASTERSUNDAY,
- ocDecimal = SC_OPCODE_DECIMAL,
- ocConvert = SC_OPCODE_CONVERT,
- ocRoman = SC_OPCODE_ROMAN,
- ocHyperLink = SC_OPCODE_HYPERLINK,
- ocGetPivotData = SC_OPCODE_GET_PIVOT_DATA,
- ocEuroConvert = SC_OPCODE_EUROCONVERT,
- ocNumberValue = SC_OPCODE_NUMBERVALUE,
- // internal stuff
- ocInternalBegin = SC_OPCODE_INTERNAL_BEGIN,
- ocGame = SC_OPCODE_GAME,
- ocSpew = SC_OPCODE_SPEW,
- ocTTT = SC_OPCODE_TTT,
- ocTeam = SC_OPCODE_TEAM,
- ocAnswer = SC_OPCODE_ANSWER,
- ocInternalEnd = SC_OPCODE_INTERNAL_END,
- // from here on ExtraData
- ocDataToken1 = SC_OPCODE_DATA_TOKEN_1,
- // no OpCode
- ocNone = SC_OPCODE_NONE
-};
-
-#ifdef PRODUCT
-// save memory since compilers tend to int an enum
-typedef USHORT OpCode;
-#else
-// have enum names in debugger
-typedef OpCodeEnum OpCode;
-#endif
-
-#endif
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx
index 8ce292003f2d..e2ceba32b2f1 100644
--- a/sc/inc/rangelst.hxx
+++ b/sc/inc/rangelst.hxx
@@ -57,10 +57,10 @@ public:
}
USHORT Parse( const String&, ScDocument* = NULL,
USHORT nMask = SCA_VALID,
- ScAddress::Convention eConv = ScAddress::CONV_OOO,
+ formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
char cDelimiter = 0 );
void Format( String&, USHORT nFlags = 0, ScDocument* = NULL,
- ScAddress::Convention eConv = ScAddress::CONV_OOO,
+ formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
char cDelimiter = 0 ) const;
void Join( const ScRange&, BOOL bIsInList = FALSE );
BOOL UpdateReference( UpdateRefMode, ScDocument*,
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 4b61c4de360d..baa477461528 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -34,7 +34,7 @@
#include "global.hxx" // -> enum UpdateRefMode
#include "address.hxx"
#include "collect.hxx"
-#include "grammar.hxx"
+#include "formula/grammar.hxx"
#include "scdllapi.h"
//------------------------------------------------------------------------
@@ -89,7 +89,7 @@ public:
const String& rSymbol,
const ScAddress& rAdr = ScAddress(),
RangeType nType = RT_NAME,
- const ScGrammar::Grammar eGrammar = ScGrammar::GRAM_DEFAULT );
+ const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT );
SC_DLLPUBLIC ScRangeData( ScDocument* pDoc,
const String& rName,
const ScTokenArray& rArr,
@@ -124,11 +124,9 @@ public:
void AddType( RangeType nType ) { eType = eType|nType; }
RangeType GetType() const { return eType; }
BOOL HasType( RangeType nType ) const;
- SC_DLLPUBLIC void GetSymbol( String& rSymbol, const ScGrammar::Grammar eGrammar = ScGrammar::GRAM_DEFAULT ) const;
- void UpdateSymbol( String& rSymbol, const ScAddress&,
- const ScGrammar::Grammar eGrammar = ScGrammar::GRAM_DEFAULT );
+ SC_DLLPUBLIC void GetSymbol( String& rSymbol, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
void UpdateSymbol( rtl::OUStringBuffer& rBuffer, const ScAddress&,
- const ScGrammar::Grammar eGrammar = ScGrammar::GRAM_DEFAULT );
+ const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT );
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& r,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index 38baadfd7e55..6a51d66fdc07 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -113,11 +113,8 @@ struct SC_DLLPUBLIC ScSingleRefData // Single reference (one address) int
void SmartRelAbs( const ScAddress& rPos );
void CalcRelFromAbs( const ScAddress& rPos );
void CalcAbsIfRel( const ScAddress& rPos );
-//UNUSED2008-05 void OldBoolsToNewFlags( const OldSingleRefBools& );
-//UNUSED2008-05 BYTE CreateStoreByteFromFlags() const;
-//UNUSED2008-05 void CreateFlagsFromLoadByte( BYTE );
BOOL operator==( const ScSingleRefData& ) const;
- bool operator!=( const SingleRefData& ) const;
+ bool operator!=( const ScSingleRefData& ) const;
};
inline void ScSingleRefData::InitAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP )
diff --git a/sc/inc/reffind.hxx b/sc/inc/reffind.hxx
index 4192bf0a7dae..0752e8685b74 100644
--- a/sc/inc/reffind.hxx
+++ b/sc/inc/reffind.hxx
@@ -42,7 +42,7 @@ class ScRefFinder
{
private:
String aFormula;
- ScAddress::Convention eConv;
+ formula::FormulaGrammar::AddressConvention eConv;
ScDocument* pDoc;
xub_StrLen nFound;
xub_StrLen nSelStart;
@@ -53,7 +53,7 @@ public:
ScRefFinder( const String& rFormula,
ScDocument* pDocument = NULL,
- ScAddress::Convention eConvP = ScAddress::CONV_OOO );
+ formula::FormulaGrammar::AddressConvention eConvP = formula::FormulaGrammar::CONV_OOO );
~ScRefFinder();
const String& GetText() const { return aFormula; }
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 7e78911dd994..d1bd0be467ca 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1161,30 +1161,31 @@
#define RID_POPUP_EDIT (SC_RESOURCE_START+33)
#define RID_POPUP_AUDIT (SC_RESOURCE_START+34)
#define RID_OBJECTBAR_TOOLS (SC_RESOURCE_START+35)
-#define RID_SC_FUNCTION_NAMES (SC_RESOURCE_START+36)
-#define RID_SC_FUNCTION_NAMES_ENGLISH (SC_RESOURCE_START+37)
+// free
+// free
#define RID_TBXCTL_INSERT (SC_RESOURCE_START+38)
#define RID_TBXCTL_INSCELLS (SC_RESOURCE_START+39)
#define RID_TBXCTL_INSOBJ (SC_RESOURCE_START+40)
-#define RID_BMP_REFBTN1 (SC_RESOURCE_START+41)
-#define RID_BMP_REFBTN2 (SC_RESOURCE_START+42)
+// free
+// free
#define RID_SC_FUNCTION_DESCRIPTIONS1 (SC_RESOURCE_START+43)
#define RID_SC_FUNCTION_DESCRIPTIONS2 (SC_RESOURCE_START+44)
#define RID_POPUP_CONTROL (SC_RESOURCE_START+45)
#define RID_POPUP_PAGEBREAK (SC_RESOURCE_START+46)
-#define RID_SC_FUNCTION_NAMES_ENGLISH_ODFF (SC_RESOURCE_START+47)
+// free
#define RID_POPUP_DRAWFORM (SC_RESOURCE_START+48)
#define RID_SC_ADDIN_ROT13 (SC_RESOURCE_START+50)
#define RID_SC_ADDIN_DFA (SC_RESOURCE_START+51)
#define RID_IMAGELIST_NAVCONT (SC_RESOURCE_START+52)
#define RID_DRAW_OBJECTBAR (SC_RESOURCE_START+53)
#define RID_GRAPHIC_OBJECTBAR (SC_RESOURCE_START+54)
-#define RID_BMP_REFBTN1_H (SC_RESOURCE_START+55)
-#define RID_BMP_REFBTN2_H (SC_RESOURCE_START+56)
+// free
+// free
#define RID_IMAGELIST_H_NAVCONT (SC_RESOURCE_START+57)
#define RID_OUTLINEBITMAPS_H (SC_RESOURCE_START+58)
#define RID_MEDIA_OBJECTBAR (SC_RESOURCE_START+60)
#define RID_POPUP_MEDIA (SC_RESOURCE_START+61)
+#define RID_FUNCTION_CATEGORIES (SC_RESOURCE_START+62)
#define STR_START (SC_RESOURCE_START+100)
#define STR_ROWHEIGHT (STR_START)
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 0b779477b0a6..140d3dfe4c4a 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -32,8 +32,8 @@
#define SC_MATRIX_HXX
#include "global.hxx"
-#include "intruref.hxx"
-#include "errorcodes.hxx"
+#include "formula/intruref.hxx"
+#include "formula/errorcodes.hxx"
#include <tools/string.hxx>
#include "scdllapi.h"
@@ -423,8 +423,8 @@ public:
};
-typedef ScSimpleIntrusiveReference< class ScMatrix > ScMatrixRef;
-typedef ScSimpleIntrusiveReference< const class ScMatrix > ScConstMatrixRef;
+typedef formula::SimpleIntrusiveReference< class ScMatrix > ScMatrixRef;
+typedef formula::SimpleIntrusiveReference< const class ScMatrix > ScConstMatrixRef;
#endif // SC_MATRIX_HXX
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 5b791c506a29..69f3def3efc5 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -77,11 +77,13 @@ class ScMessagePool;
class EditFieldInfo;
class ScNavipiCfg;
class ScAddInCfg;
-class ScFormEditData;
+
class ScTransferObj;
class ScDrawTransferObj;
class ScSelectionTransferObj;
+class ScFormEditData;
+
//==================================================================
// for internal Drag&Drop:
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index 0dd582504aac..6413c8a77992 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -33,111 +33,46 @@
#include <memory>
#include <vector>
-#include "opcode.hxx"
+#include "formula/opcode.hxx"
#include "refdata.hxx"
#include "scmatrix.hxx"
-#include "intruref.hxx"
+#include "formula/intruref.hxx"
#include <tools/mempool.hxx>
#include "scdllapi.h"
-
-enum StackVarEnum
-{
- svByte,
- svDouble,
- svString,
- svSingleRef,
- svDoubleRef,
- svMatrix,
- svIndex,
- svJump,
- svExternal, // Byte + String
- svFAP, // FormulaAutoPilot only, ever exported
- svJumpMatrix, // 2003-07-02
- svRefList, // ocUnion result
- svEmptyCell, // Result is an empty cell, e.g. in LOOKUP()
-
- svMatrixCell, // Result is a matrix with bells and
- // whistles as needed for _the_ matrix
- // formula result.
-
- svHybridCell, // A temporary condition of a formula
- // cell during import, having a double
- // and/or string result and a formula
- // string to be compiled.
- svExternalSingleRef,
- svExternalDoubleRef,
- svExternalName,
- svError, // error token
- svMissing = 0x70, // 0 or ""
- svSep, // separator, ocSep, ocOpen, ocClose
- svUnknown // unknown StackType
-};
-
-#ifdef PRODUCT
-// save memory since compilers tend to int an enum
-typedef BYTE StackVar;
-#else
-// have enum names in debugger
-typedef StackVarEnum StackVar;
-#endif
+#include "formula/IFunctionDescription.hxx"
+#include "formula/token.hxx"
class ScJumpMatrix;
-
class ScToken;
-typedef ScSimpleIntrusiveReference< class ScToken > ScTokenRef;
-typedef ScSimpleIntrusiveReference< const class ScToken > ScConstTokenRef;
typedef ::std::vector< ScComplexRefData > ScRefList;
+typedef formula::SimpleIntrusiveReference< class ScToken > ScTokenRef;
-class SC_DLLPUBLIC ScToken
+class SC_DLLPUBLIC ScToken : public formula::FormulaToken
{
private:
-
- const StackVar eType; // type of data
- mutable USHORT nRefCnt; // reference count
-
// not implemented, prevent usage
ScToken();
ScToken& operator=( const ScToken& );
protected:
- static String aDummyString;
-
- ScToken( StackVar eTypeP ) :
- eType( eTypeP ), nRefCnt(0) {}
- ScToken( const ScToken& r ) :
- eType( r.eType ), nRefCnt(0) {}
+ ScToken( formula::StackVar eTypeP,OpCode e = ocPush ) : formula::FormulaToken(eTypeP,e) {}
+ ScToken( const ScToken& r ): formula::FormulaToken(r) {}
public:
virtual ~ScToken();
- inline void Delete() { delete this; }
- inline StackVar GetType() const { return eType; }
- BOOL IsFunction() const; // pure functions, no operators
- BOOL IsMatrixFunction() const; // if a function _always_ returns a Matrix
- BYTE GetParamCount() const;
- inline void IncRef() const { nRefCnt++; }
- inline void DecRef() const
- {
- if (!--nRefCnt)
- const_cast<ScToken*>(this)->Delete();
- }
- inline USHORT GetRef() const { return nRefCnt; }
-
/**
Dummy methods to avoid switches and casts where possible,
the real token classes have to overload the appropriate method[s].
The only methods valid anytime if not overloaded are:
- - GetOpCode() since for a token type not needing an explicit OpCode set
- the implicit OpCode is ocPush.
-
- GetByte() since this represents the count of parameters to a function
- which of course is 0 on non-functions. ScByteToken and ScExternal do
+ which of course is 0 on non-functions. formula::FormulaByteToken and ScExternal do
overload it.
- HasForceArray() since also this is only used for operators and
@@ -146,14 +81,6 @@ public:
Any other non-overloaded method pops up an assertion.
*/
- virtual OpCode GetOpCode() const;
- virtual BYTE GetByte() const;
- virtual void SetByte( BYTE n );
- virtual bool HasForceArray() const;
- virtual void SetForceArray( bool b );
- virtual double GetDouble() const;
- virtual double& GetDoubleAsReference();
- virtual const String& GetString() const;
virtual const ScSingleRefData& GetSingleRef() const;
virtual ScSingleRefData& GetSingleRef();
virtual const ScComplexRefData& GetDoubleRef() const;
@@ -164,27 +91,12 @@ public:
virtual void CalcRelFromAbs( const ScAddress& );
virtual const ScMatrix* GetMatrix() const;
virtual ScMatrix* GetMatrix();
- virtual USHORT GetIndex() const;
- virtual void SetIndex( USHORT n );
- virtual short* GetJump() const;
- virtual const String& GetExternal() const;
- virtual ScToken* GetFAPOrigToken() const;
virtual ScJumpMatrix* GetJumpMatrix() const;
virtual const ScRefList* GetRefList() const;
virtual ScRefList* GetRefList();
- virtual USHORT GetError() const;
- virtual void SetError( USHORT );
- ScToken* Clone() const;
-
- virtual BOOL operator==( const ScToken& rToken ) const;
- BOOL TextEqual( const ScToken& rToken ) const;
- BOOL Is3DRef() const; // reference with 3D flag set
-
-//UNUSED2008-05 // If token in RPN resulted from resolving a name and contains an absolute
-//UNUSED2008-05 // reference. Token must be obtained through ScTokenArray::GetNextReferenceRPN()
-//UNUSED2008-05 // or similar.
-//UNUSED2008-05 BOOL IsRPNReferenceAbsName() const;
+ virtual BOOL TextEqual( const formula::FormulaToken& rToken ) const;
+ virtual BOOL Is3DRef() const; // reference with 3D flag set
/** If rTok1 and rTok2 both are SingleRef or DoubleRef tokens, extend/merge
ranges as needed for ocRange.
@@ -198,179 +110,37 @@ public:
A reused or new'ed ScDoubleRefToken, or a NULL TokenRef if rTok1 or
rTok2 are not of sv(Single|Double)Ref
*/
- static ScTokenRef ExtendRangeReference( ScToken & rTok1, ScToken & rTok2, const ScAddress & rPos, bool bReuseDoubleRef );
-
- static size_t GetStrLenBytes( xub_StrLen nLen )
- { return nLen * sizeof(sal_Unicode); }
- static size_t GetStrLenBytes( const String& rStr )
- { return GetStrLenBytes( rStr.Len() ); }
+ static formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, const ScAddress & rPos, bool bReuseDoubleRef );
};
-
-/** Tokens that need a different OpCode than ocPush are derived from this. */
-class ScOpToken : public ScToken
-{
-private:
- OpCode eOp;
-public:
- ScOpToken( OpCode e, StackVar v ) :
- ScToken( v ), eOp( e ) {}
- ScOpToken( const ScOpToken & r ) :
- ScToken( r ), eOp( r.eOp ) {}
- /** This is dirty and only the compiler should use it! */
- inline void NewOpCode( OpCode e ) { eOp = e; }
- virtual OpCode GetOpCode() const;
-
- // No operator== to be overloaded, ScToken::operator== already checks the
- // OpCode as well via GetOpCode().
-};
-
-
-class ScByteToken : public ScOpToken
-{
-private:
- BYTE nByte;
- bool bHasForceArray;
-protected:
- ScByteToken( OpCode e, BYTE n, StackVar v, bool b ) :
- ScOpToken( e, v ), nByte( n ),
- bHasForceArray( b ) {}
-public:
- ScByteToken( OpCode e, BYTE n, bool b ) :
- ScOpToken( e, svByte ), nByte( n ),
- bHasForceArray( b ) {}
- ScByteToken( OpCode e, BYTE n ) :
- ScOpToken( e, svByte ), nByte( n ),
- bHasForceArray( false ) {}
- ScByteToken( OpCode e ) :
- ScOpToken( e, svByte ), nByte( 0 ),
- bHasForceArray( false ) {}
- ScByteToken( const ScByteToken& r ) :
- ScOpToken( r ), nByte( r.nByte ),
- bHasForceArray( r.bHasForceArray ) {}
- virtual BYTE GetByte() const;
- virtual void SetByte( BYTE n );
- virtual bool HasForceArray() const;
- virtual void SetForceArray( bool b );
- virtual BOOL operator==( const ScToken& rToken ) const;
-
- DECL_FIXEDMEMPOOL_NEWDEL( ScByteToken );
-};
-
-
-// A special token for the FormulaAutoPilot only. Keeps a reference pointer of
-// the token of which it was created for comparison.
-class ScFAPToken : public ScByteToken
-{
-private:
- ScTokenRef pOrigToken;
-public:
- ScFAPToken( OpCode e, BYTE n, ScToken* p ) :
- ScByteToken( e, n, svFAP, false ),
- pOrigToken( p ) {}
- ScFAPToken( const ScFAPToken& r ) :
- ScByteToken( r ), pOrigToken( r.pOrigToken ) {}
- virtual ScToken* GetFAPOrigToken() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScDoubleToken : public ScToken
-{
-private:
- double fDouble;
-public:
- ScDoubleToken( double f ) :
- ScToken( svDouble ), fDouble( f ) {}
- ScDoubleToken( const ScDoubleToken& r ) :
- ScToken( r ), fDouble( r.fDouble ) {}
- virtual double GetDouble() const;
- virtual double& GetDoubleAsReference();
- virtual BOOL operator==( const ScToken& rToken ) const;
-
- DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleToken );
-};
-
-
-class ScStringToken : public ScToken
-{
-private:
- String aString;
-public:
- ScStringToken( const String& r ) :
- ScToken( svString ), aString( r ) {}
- ScStringToken( const ScStringToken& r ) :
- ScToken( r ), aString( r.aString ) {}
- virtual const String& GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-
- DECL_FIXEDMEMPOOL_NEWDEL( ScStringToken );
-};
-
-
-/** Identical to ScStringToken, but with explicit OpCode instead of implicit
- ocPush, and an optional BYTE for ocBad tokens. */
-class ScStringOpToken : public ScByteToken
-{
-private:
- String aString;
-public:
- ScStringOpToken( OpCode e, const String& r ) :
- ScByteToken( e, 0, svString, false ), aString( r ) {}
- ScStringOpToken( const ScStringOpToken& r ) :
- ScByteToken( r ), aString( r.aString ) {}
- virtual const String& GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
class ScSingleRefToken : public ScToken
{
private:
ScSingleRefData aSingleRef;
public:
- ScSingleRefToken( const ScSingleRefData& r ) :
- ScToken( svSingleRef ), aSingleRef( r ) {}
+ ScSingleRefToken( const ScSingleRefData& r, OpCode e = ocPush ) :
+ ScToken( formula::svSingleRef, e ), aSingleRef( r ) {}
ScSingleRefToken( const ScSingleRefToken& r ) :
ScToken( r ), aSingleRef( r.aSingleRef ) {}
virtual const ScSingleRefData& GetSingleRef() const;
virtual ScSingleRefData& GetSingleRef();
virtual void CalcAbsIfRel( const ScAddress& );
virtual void CalcRelFromAbs( const ScAddress& );
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScSingleRefToken(*this); }
DECL_FIXEDMEMPOOL_NEWDEL( ScSingleRefToken );
};
-
-/** Identical to ScSingleRefToken, but with explicit OpCode instead of implicit
- ocPush. */
-class ScSingleRefOpToken : public ScOpToken
-{
-private:
- ScSingleRefData aSingleRef;
-public:
- ScSingleRefOpToken( OpCode e, const ScSingleRefData& r ) :
- ScOpToken( e, svSingleRef ), aSingleRef( r ) {}
- ScSingleRefOpToken( const ScSingleRefOpToken& r ) :
- ScOpToken( r ), aSingleRef( r.aSingleRef ) {}
- virtual const ScSingleRefData& GetSingleRef() const;
- virtual ScSingleRefData& GetSingleRef();
- virtual void CalcAbsIfRel( const ScAddress& );
- virtual void CalcRelFromAbs( const ScAddress& );
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
class ScDoubleRefToken : public ScToken
{
private:
ScComplexRefData aDoubleRef;
public:
- ScDoubleRefToken( const ScComplexRefData& r ) :
- ScToken( svDoubleRef ), aDoubleRef( r ) {}
- ScDoubleRefToken( const ScSingleRefData& r ) :
- ScToken( svDoubleRef )
+ ScDoubleRefToken( const ScComplexRefData& r, OpCode e = ocPush ) :
+ ScToken( formula::svDoubleRef, e ), aDoubleRef( r ) {}
+ ScDoubleRefToken( const ScSingleRefData& r, OpCode e = ocPush ) :
+ ScToken( formula::svDoubleRef, e )
{
aDoubleRef.Ref1 = r;
aDoubleRef.Ref2 = r;
@@ -385,118 +155,75 @@ public:
virtual ScSingleRefData& GetSingleRef2();
virtual void CalcAbsIfRel( const ScAddress& );
virtual void CalcRelFromAbs( const ScAddress& );
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScDoubleRefToken(*this); }
DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleRefToken );
};
-
-/** Identical to ScDoubleRefToken, but with explicit OpCode instead of implicit
- ocPush. */
-class ScDoubleRefOpToken : public ScOpToken
-{
-private:
- ScComplexRefData aDoubleRef;
-public:
- ScDoubleRefOpToken( OpCode e, const ScComplexRefData& r ) :
- ScOpToken( e, svDoubleRef ), aDoubleRef( r ) {}
- ScDoubleRefOpToken( OpCode e, const ScSingleRefData& r ) :
- ScOpToken( e, svDoubleRef )
- {
- aDoubleRef.Ref1 = r;
- aDoubleRef.Ref2 = r;
- }
- ScDoubleRefOpToken( const ScDoubleRefOpToken& r ) :
- ScOpToken( r ), aDoubleRef( r.aDoubleRef ) {}
- virtual const ScSingleRefData& GetSingleRef() const;
- virtual ScSingleRefData& GetSingleRef();
- virtual const ScComplexRefData& GetDoubleRef() const;
- virtual ScComplexRefData& GetDoubleRef();
- virtual const ScSingleRefData& GetSingleRef2() const;
- virtual ScSingleRefData& GetSingleRef2();
- virtual void CalcAbsIfRel( const ScAddress& );
- virtual void CalcRelFromAbs( const ScAddress& );
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
class ScMatrixToken : public ScToken
{
private:
ScMatrixRef pMatrix;
public:
ScMatrixToken( ScMatrix* p ) :
- ScToken( svMatrix ), pMatrix( p ) {}
+ ScToken( formula::svMatrix ), pMatrix( p ) {}
ScMatrixToken( const ScMatrixToken& r ) :
ScToken( r ), pMatrix( r.pMatrix ) {}
virtual const ScMatrix* GetMatrix() const;
virtual ScMatrix* GetMatrix();
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScIndexToken : public ScOpToken
-{
-private:
- USHORT nIndex;
-public:
- ScIndexToken( OpCode e, USHORT n ) :
- ScOpToken( e, svIndex ), nIndex( n ) {}
- ScIndexToken( const ScIndexToken& r ) :
- ScOpToken( r ), nIndex( r.nIndex ) {}
- virtual USHORT GetIndex() const;
- virtual void SetIndex( USHORT n );
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScMatrixToken(*this); }
};
-class ScExternalSingleRefToken : public ScOpToken
+class ScExternalSingleRefToken : public ScToken
{
private:
sal_uInt16 mnFileId;
String maTabName;
- SingleRefData maSingleRef;
+ ScSingleRefData maSingleRef;
ScExternalSingleRefToken(); // disabled
public:
- ScExternalSingleRefToken( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& r );
+ ScExternalSingleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& r );
ScExternalSingleRefToken( const ScExternalSingleRefToken& r );
virtual ~ScExternalSingleRefToken();
virtual USHORT GetIndex() const;
virtual const String& GetString() const;
- virtual const SingleRefData& GetSingleRef() const;
- virtual SingleRefData& GetSingleRef();
+ virtual const ScSingleRefData& GetSingleRef() const;
+ virtual ScSingleRefData& GetSingleRef();
virtual BOOL operator==( const ScToken& rToken ) const;
};
-class ScExternalDoubleRefToken : public ScOpToken
+class ScExternalDoubleRefToken : public ScToken
{
private:
sal_uInt16 mnFileId;
String maTabName; // name of the first sheet
- ComplRefData maDoubleRef;
+ ScComplexRefData maDoubleRef;
ScExternalDoubleRefToken(); // disabled
public:
- ScExternalDoubleRefToken( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& r );
+ ScExternalDoubleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& r );
ScExternalDoubleRefToken( const ScExternalDoubleRefToken& r );
virtual ~ScExternalDoubleRefToken();
virtual USHORT GetIndex() const;
virtual const String& GetString() const;
- virtual const SingleRefData& GetSingleRef() const;
- virtual SingleRefData& GetSingleRef();
- virtual const SingleRefData& GetSingleRef2() const;
- virtual SingleRefData& GetSingleRef2();
- virtual const ComplRefData& GetDoubleRef() const;
- virtual ComplRefData& GetDoubleRef();
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual const ScSingleRefData& GetSingleRef() const;
+ virtual ScSingleRefData& GetSingleRef();
+ virtual const ScSingleRefData& GetSingleRef2() const;
+ virtual ScSingleRefData& GetSingleRef2();
+ virtual const ScComplexRefData& GetDoubleRef() const;
+ virtual ScComplexRefData& GetDoubleRef();
+ virtual BOOL operator==( const ScToken& rToken ) const;
};
-class ScExternalNameToken : public ScOpToken
+class ScExternalNameToken : public ScToken
{
private:
sal_uInt16 mnFileId;
@@ -513,29 +240,6 @@ public:
};
-class ScJumpToken : public ScOpToken
-{
-private:
- short* pJump;
-public:
- ScJumpToken( OpCode e, short* p ) :
- ScOpToken( e, svJump )
- {
- pJump = new short[ p[0] + 1 ];
- memcpy( pJump, p, (p[0] + 1) * sizeof(short) );
- }
- ScJumpToken( const ScJumpToken& r ) :
- ScOpToken( r )
- {
- pJump = new short[ r.pJump[0] + 1 ];
- memcpy( pJump, r.pJump, (r.pJump[0] + 1) * sizeof(short) );
- }
- virtual ~ScJumpToken();
- virtual short* GetJump() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
// Only created from within the interpreter, no conversion from ScRawToken,
// never added to ScTokenArray!
class ScJumpMatrixToken : public ScToken
@@ -544,12 +248,13 @@ private:
ScJumpMatrix* pJumpMatrix;
public:
ScJumpMatrixToken( ScJumpMatrix* p ) :
- ScToken( svJumpMatrix ), pJumpMatrix( p ) {}
+ ScToken( formula::svJumpMatrix ), pJumpMatrix( p ) {}
ScJumpMatrixToken( const ScJumpMatrixToken& r ) :
ScToken( r ), pJumpMatrix( r.pJumpMatrix ) {}
virtual ~ScJumpMatrixToken();
virtual ScJumpMatrix* GetJumpMatrix() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScJumpMatrixToken(*this); }
};
@@ -561,74 +266,15 @@ private:
ScRefList aRefList;
public:
ScRefListToken() :
- ScToken( svRefList ) {}
+ ScToken( formula::svRefList ) {}
ScRefListToken( const ScRefListToken & r ) :
ScToken( r ), aRefList( r.aRefList ) {}
virtual void CalcAbsIfRel( const ScAddress& );
virtual void CalcRelFromAbs( const ScAddress& );
virtual const ScRefList* GetRefList() const;
virtual ScRefList* GetRefList();
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class SC_DLLPUBLIC ScExternalToken : public ScOpToken
-{
-private:
- String aExternal;
- BYTE nByte;
-public:
- ScExternalToken( OpCode e, BYTE n, const String& r ) :
- ScOpToken( e, svExternal ), aExternal( r ),
- nByte( n ) {}
- ScExternalToken( OpCode e, const String& r ) :
- ScOpToken( e, svExternal ), aExternal( r ),
- nByte( 0 ) {}
- ScExternalToken( const ScExternalToken& r ) :
- ScOpToken( r ), aExternal( r.aExternal ),
- nByte( r.nByte ) {}
- virtual const String& GetExternal() const;
- virtual BYTE GetByte() const;
- virtual void SetByte( BYTE n );
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScMissingToken : public ScOpToken
-{
-public:
- ScMissingToken() :
- ScOpToken( ocMissing, svMissing ) {}
- ScMissingToken( const ScMissingToken& r ) :
- ScOpToken( r ) {}
- virtual double GetDouble() const;
- virtual const String& GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScUnknownToken : public ScOpToken
-{
-public:
- ScUnknownToken( OpCode e ) :
- ScOpToken( e, svUnknown ) {}
- ScUnknownToken( const ScUnknownToken& r ) :
- ScOpToken( r ) {}
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScErrorToken : public ScToken
-{
- USHORT nError;
-public:
- ScErrorToken( USHORT nErr ) :
- ScToken( svError ), nError( nErr) {}
- ScErrorToken( const ScErrorToken& r ) :
- ScToken( r ), nError( r.nError) {}
- virtual USHORT GetError() const;
- virtual void SetError( USHORT nErr );
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScRefListToken(*this); }
};
@@ -638,7 +284,7 @@ class ScEmptyCellToken : public ScToken
bool bDisplayedAsString :1;
public:
explicit ScEmptyCellToken( bool bInheritedP, bool bDisplayAsString ) :
- ScToken( svEmptyCell ),
+ ScToken( formula::svEmptyCell ),
bInherited( bInheritedP ),
bDisplayedAsString( bDisplayAsString ) {}
ScEmptyCellToken( const ScEmptyCellToken& r ) :
@@ -649,7 +295,8 @@ public:
bool IsDisplayedAsString() const { return bDisplayedAsString; }
virtual double GetDouble() const;
virtual const String & GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScEmptyCellToken(*this); }
};
@@ -662,10 +309,10 @@ class ScMatrixCellResultToken : public ScToken
protected:
ScConstMatrixRef xMatrix;
- ScConstTokenRef xUpperLeft;
+ formula::FormulaConstTokenRef xUpperLeft;
public:
- ScMatrixCellResultToken( ScMatrix* pMat, ScToken* pUL ) :
- ScToken( svMatrixCell ),
+ ScMatrixCellResultToken( ScMatrix* pMat, formula::FormulaToken* pUL ) :
+ ScToken( formula::svMatrixCell ),
xMatrix( pMat), xUpperLeft( pUL) {}
ScMatrixCellResultToken( const ScMatrixCellResultToken& r ) :
ScToken( r ), xMatrix( r.xMatrix ),
@@ -673,14 +320,15 @@ public:
virtual double GetDouble() const;
virtual const String & GetString() const;
virtual const ScMatrix* GetMatrix() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
- StackVar GetUpperLeftType() const
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScMatrixCellResultToken(*this); }
+ formula::StackVar GetUpperLeftType() const
{
return xUpperLeft ?
xUpperLeft->GetType() :
- static_cast<StackVar>(svUnknown);
+ static_cast<formula::StackVar>(formula::svUnknown);
}
- ScConstTokenRef GetUpperLeftToken() const { return xUpperLeft; }
+ inline formula::FormulaConstTokenRef GetUpperLeftToken() const { return xUpperLeft; }
void Assign( const ScMatrixCellResultToken & r )
{
xMatrix = r.xMatrix;
@@ -709,7 +357,8 @@ public:
if (xUpperLeft)
xUpperLeft = xUpperLeft->Clone();
}
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScMatrixFormulaCellToken(*this); }
void SetMatColsRows( SCCOL nC, SCROW nR )
{
nRows = nR;
@@ -736,10 +385,10 @@ public:
appropriate Assign() call, other tokens
are assigned to xUpperLeft and xMatrix will
be assigned NULL. */
- void Assign( const ScToken & r );
+ void Assign( const formula::FormulaToken & r );
- /** Modify xUpperLeft if svDouble, or create
- new ScDoubleToken if not set yet. Does
+ /** Modify xUpperLeft if formula::svDouble, or create
+ new formula::FormulaDoubleToken if not set yet. Does
nothing if xUpperLeft is of different type! */
void SetUpperLeftDouble( double f);
@@ -763,7 +412,7 @@ public:
ScHybridCellToken( double f,
const String & rStr,
const String & rFormula ) :
- ScToken( svHybridCell ),
+ ScToken( formula::svHybridCell ),
fDouble( f ), aString( rStr ),
aFormula( rFormula ) {}
ScHybridCellToken( const ScHybridCellToken& r ) :
@@ -772,7 +421,8 @@ public:
const String & GetFormula() const { return aFormula; }
virtual double GetDouble() const;
virtual const String & GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScHybridCellToken(*this); }
};
@@ -791,7 +441,7 @@ class SingleDoubleRefModifier
public:
SingleDoubleRefModifier( ScToken& rT )
{
- if ( rT.GetType() == svSingleRef )
+ if ( rT.GetType() == formula::svSingleRef )
{
pS = &rT.GetSingleRef();
aDub.Ref1 = aDub.Ref2 = *pS;
@@ -826,7 +476,7 @@ public:
SingleDoubleRefProvider( const ScToken& r )
: Ref1( r.GetSingleRef() ),
- Ref2( r.GetType() == svDoubleRef ?
+ Ref2( r.GetType() == formula::svDoubleRef ?
r.GetDoubleRef().Ref2 : Ref1 )
{}
SingleDoubleRefProvider( const ScSingleRefData& r )
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 9bb7eb6f8b6c..8c15f07c6c1b 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -31,27 +31,17 @@
#ifndef SC_TOKENARRAY_HXX
#define SC_TOKENARRAY_HXX
-#include "token.hxx"
+#include "formula/token.hxx"
#include <tools/solar.h>
#include "scdllapi.h"
-
-// RecalcMode access only via TokenArray SetRecalcMode / IsRecalcMode...
-
-typedef BYTE ScRecalcMode;
-// Only one of the exclusive bits can be set,
-// handled by TokenArray SetRecalcMode... methods
-#define RECALCMODE_NORMAL 0x01 // exclusive
-#define RECALCMODE_ALWAYS 0x02 // exclusive, always
-#define RECALCMODE_ONLOAD 0x04 // exclusive, always after load
-#define RECALCMODE_ONLOAD_ONCE 0x08 // exclusive, once after load
-#define RECALCMODE_FORCED 0x10 // combined, also if cell isn't visible
-#define RECALCMODE_ONREFMOVE 0x20 // combined, if reference was moved
-#define RECALCMODE_EMASK 0x0F // mask of exclusive bits
-// If new bits are to be defined, AddRecalcMode has to be adjusted!
+#include <formula/tokenarray.hxx>
struct ScRawToken;
+struct ScSingleRefData;
+struct ScComplexRefData;
+class ScMatrix;
-class ScMissingConvention
+class ScTokenArray : public formula::FormulaTokenArray
{
bool mbODFF; /// TRUE: ODFF, FALSE: PODF
public:
@@ -64,233 +54,57 @@ public:
class SC_DLLPUBLIC ScTokenArray
{
friend class ScCompiler;
- friend class ScTokenIterator;
-
- ScToken** pCode; // Token code array
- ScToken** pRPN; // RPN array
- USHORT nLen; // Length of token array
- USHORT nRPN; // Length of RPN array
- USHORT nIndex; // Current step index
- USHORT nError; // Error code
- short nRefs; // Count of cell references
- ScRecalcMode nMode; // Flags to indicate when to recalc this code
- BOOL bHyperLink; // If HYPERLINK() occurs in the formula.
-
- void Assign( const ScTokenArray& );
-
- /// Also used by the compiler. The token MUST had been allocated with new!
- ScToken* Add( ScToken* );
- inline void SetCombinedBitsRecalcMode( ScRecalcMode nBits )
- { nMode |= (nBits & ~RECALCMODE_EMASK); }
- inline ScRecalcMode GetCombinedBitsRecalcMode() const
- { return nMode & ~RECALCMODE_EMASK; }
- /** Exclusive bits already set in nMode are
- zero'ed, nVal may contain combined bits, but
- only one exclusive bit may be set! */
- inline void SetMaskedRecalcMode( ScRecalcMode nBits )
- { nMode = GetCombinedBitsRecalcMode() | nBits; }
-
BOOL ImplGetReference( ScRange& rRange, BOOL bValidOnly ) const;
public:
ScTokenArray();
/// Assignment with references to ScToken entries (not copied!)
ScTokenArray( const ScTokenArray& );
- ~ScTokenArray();
+ virtual ~ScTokenArray();
ScTokenArray* Clone() const; /// True copy!
- void Clear();
- void DelRPN();
- ScToken* First() { nIndex = 0; return Next(); }
- ScToken* Next();
- ScToken* FirstNoSpaces() { nIndex = 0; return NextNoSpaces(); }
- ScToken* NextNoSpaces();
- ScToken* GetNextName();
- ScToken* GetNextDBArea();
- ScToken* GetNextReference();
- ScToken* GetNextReferenceRPN();
- ScToken* GetNextReferenceOrName();
- ScToken* GetNextColRowName();
- ScToken* GetNextOpCodeRPN( OpCode );
- /// Peek at nIdx-1 if not out of bounds, decrements nIdx if successful. Returns NULL if not.
- ScToken* PeekPrev( USHORT & nIdx );
- ScToken* PeekNext();
- ScToken* PeekPrevNoSpaces(); /// Only after Reset/First/Next/Last/Prev!
- ScToken* PeekNextNoSpaces(); /// Only after Reset/First/Next/Last/Prev!
- ScToken* FirstRPN() { nIndex = 0; return NextRPN(); }
- ScToken* NextRPN();
- ScToken* LastRPN() { nIndex = nRPN; return PrevRPN(); }
- ScToken* PrevRPN();
-
- BOOL HasOpCode( OpCode ) const;
- BOOL HasOpCodeRPN( OpCode ) const;
-//UNUSED2008-05 /// Token of type svIndex
-//UNUSED2008-05 BOOL HasName() const;
- /// Token of type svIndex or opcode ocColRowName
- BOOL HasNameOrColRowName() const;
/// Exactly and only one range (valid or deleted)
BOOL IsReference( ScRange& rRange ) const;
/// Exactly and only one valid range (no #REF!s)
BOOL IsValidReference( ScRange& rRange ) const;
- ScToken** GetArray() const { return pCode; }
- ScToken** GetCode() const { return pRPN; }
- USHORT GetLen() const { return nLen; }
- USHORT GetCodeLen() const { return nRPN; }
- void Reset() { nIndex = 0; }
- USHORT GetCodeError() const { return nError; }
- void SetCodeError( USHORT n ) { nError = n; }
- short GetRefs() const { return nRefs; }
- void SetHyperLink( BOOL bVal ) { bHyperLink = bVal; }
- BOOL IsHyperLink() const { return bHyperLink; }
- inline ScRecalcMode GetRecalcMode() const { return nMode; }
- /** Bits aren't set directly but validated and
- maybe handled according to priority if more
- than one exclusive bit was set. */
- void AddRecalcMode( ScRecalcMode nBits );
-
- inline void ClearRecalcMode() { nMode = RECALCMODE_NORMAL; }
- inline void SetRecalcModeNormal()
- { SetMaskedRecalcMode( RECALCMODE_NORMAL ); }
- inline void SetRecalcModeAlways()
- { SetMaskedRecalcMode( RECALCMODE_ALWAYS ); }
- inline void SetRecalcModeOnLoad()
- { SetMaskedRecalcMode( RECALCMODE_ONLOAD ); }
- inline void SetRecalcModeOnLoadOnce()
- { SetMaskedRecalcMode( RECALCMODE_ONLOAD_ONCE ); }
- inline void SetRecalcModeForced()
- { nMode |= RECALCMODE_FORCED; }
- inline void ClearRecalcModeForced()
- { nMode &= ~RECALCMODE_FORCED; }
- inline void SetRecalcModeOnRefMove()
- { nMode |= RECALCMODE_ONREFMOVE; }
- inline void ClearRecalcModeOnRefMove()
- { nMode &= ~RECALCMODE_ONREFMOVE; }
- inline BOOL IsRecalcModeNormal() const
- { return (nMode & RECALCMODE_NORMAL) != 0; }
- inline BOOL IsRecalcModeAlways() const
- { return (nMode & RECALCMODE_ALWAYS) != 0; }
- inline BOOL IsRecalcModeOnLoad() const
- { return (nMode & RECALCMODE_ONLOAD) != 0; }
- inline BOOL IsRecalcModeOnLoadOnce() const
- { return (nMode & RECALCMODE_ONLOAD_ONCE) != 0; }
- inline BOOL IsRecalcModeForced() const
- { return (nMode & RECALCMODE_FORCED) != 0; }
- inline BOOL IsRecalcModeOnRefMove() const
- { return (nMode & RECALCMODE_ONREFMOVE) != 0; }
-
- /** Get OpCode of the most outer function */
- inline OpCode GetOuterFuncOpCode();
/** Determines the extent of direct adjacent
references. Only use with real functions, e.g.
GetOuterFuncOpCode() == ocSum ! */
BOOL GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend,
const ScAddress& rPos, ScDirection );
- /** Operators +,-,*,/,^,&,=,<>,<,>,<=,>=
- with DoubleRef in Formula? */
- BOOL HasMatrixDoubleRefOps();
-
- ScToken* AddToken( const ScRawToken& );
- ScToken* AddToken( const ScToken& );
- ScToken* AddOpCode( OpCode eCode );
- ScToken* AddString( const sal_Unicode* pStr );
- ScToken* AddString( const String& rStr );
- ScToken* AddDouble( double fVal );
+ formula::FormulaToken* AddRawToken( const ScRawToken& );
+ virtual bool AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken);
+ virtual formula::FormulaToken* AddOpCode( OpCode eCode );
/** ScSingleRefToken with ocPush. */
- ScToken* AddSingleReference( const ScSingleRefData& rRef );
+ formula::FormulaToken* AddSingleReference( const ScSingleRefData& rRef );
/** ScSingleRefOpToken with ocMatRef. */
- ScToken* AddMatrixSingleReference( const ScSingleRefData& rRef );
- ScToken* AddDoubleReference( const ScComplexRefData& rRef );
- ScToken* AddName( USHORT n );
- ScToken* AddMatrix( ScMatrix* p );
- ScToken* AddExternalName( sal_uInt16 nFileId, const String& rName );
- ScToken* AddExternalSingleReference( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& rRef );
- ScToken* AddExternalDoubleReference( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& rRef );
- ScToken* AddExternal( const sal_Unicode* pStr );
- /** Xcl import may play dirty tricks with OpCode!=ocExternal.
- Others don't use! */
- ScToken* AddExternal( const String& rStr, OpCode eOp = ocExternal );
+ formula::FormulaToken* AddMatrixSingleReference( const ScSingleRefData& rRef );
+ formula::FormulaToken* AddDoubleReference( const ScComplexRefData& rRef );
+ formula::FormulaToken* AddExternalName( sal_uInt16 nFileId, const String& rName );
+ formula::FormulaToken* AddExternalSingleReference( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef );
+ formula::FormulaToken* AddExternalDoubleReference( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef );
+ formula::FormulaToken* AddMatrix( ScMatrix* p );
/** ScSingleRefOpToken with ocColRowName. */
- ScToken* AddColRowName( const ScSingleRefData& rRef );
- ScToken* AddBad( const sal_Unicode* pStr ); /// ocBad with String
- ScToken* AddBad( const String& rStr ); /// ocBad with String
- ScToken* MergeArray( );
+ formula::FormulaToken* AddColRowName( const ScSingleRefData& rRef );
+ virtual formula::FormulaToken* MergeArray( );
+
/** Merge very last SingleRef+ocRange+SingleRef combination into DoubleRef
and adjust pCode array, or do nothing if conditions not met.
Unconditionally returns last token from the resulting pCode array, or
NULL if there is no pCode (which actually would be caller's fault). */
- ScToken* MergeRangeReference( const ScAddress & rPos );
+ formula::FormulaToken* MergeRangeReference( const ScAddress & rPos );
/// Assignment with references to ScToken entries (not copied!)
ScTokenArray& operator=( const ScTokenArray& );
/// Make 3D references point to old referenced position even if relative
- void ReadjustRelative3DReferences(
+ void ReadjustRelative3DReferences(
const ScAddress& rOldPos,
const ScAddress& rNewPos );
-
- /** Determines if this formula needs any changes to convert it to something
- previous versions of OOo could consume (Plain Old Formula). */
- bool NeedsPofRewrite( const ScMissingConvention & rConv );
-
- /** Rewrites to Plain Old Formula, substituting missing parameters. The
- ScTokenArray* returned is new'ed. */
- ScTokenArray* RewriteMissingToPof( const ScMissingConvention & rConv );
-
- /** Determines if this formula may be followed by a reference. */
- bool MayReferenceFollow();
-};
-
-inline OpCode ScTokenArray::GetOuterFuncOpCode()
-{
- if ( pRPN && nRPN )
- return pRPN[nRPN-1]->GetOpCode();
- return ocNone;
-}
-
-struct ImpTokenIterator
-{
- ImpTokenIterator* pNext;
- const ScTokenArray* pArr;
- short nPC;
- short nStop;
-
- DECL_FIXEDMEMPOOL_NEWDEL( ImpTokenIterator );
-};
-
-class ScTokenIterator
-{
- friend class ScInterpreter; // for Jump()
- ImpTokenIterator* pCur;
- /** Jump or subroutine call.
- Program counter values will be incremented before code is executed =>
- positions are to be passed with -1 offset.
- @param nStart
- Start on code at position nStart+1 (yes, pass with offset -1)
- @param nNext
- After subroutine continue with instruction at position nNext+1
- @param nStop
- Stop before reaching code at position nStop. If not specified the
- default is to either run the entire code, or to stop if an ocSep or
- ocClose is encountered, which are only present in ocIf or ocChose
- jumps.
- */
- void Jump( short nStart, short nNext, short nStop = SHRT_MAX );
- void Push( const ScTokenArray* );
- void Pop();
-public:
- ScTokenIterator( const ScTokenArray& );
- ~ScTokenIterator();
- void Reset();
- const ScToken* First();
- const ScToken* Next();
- bool IsEndOfPath() const; /// if a jump or subroutine path is done
- bool HasStacked() const { return pCur->pNext != 0; }
- short GetPC() const { return pCur->nPC; }
};
-
#endif // SC_TOKENARRAY_HXX
diff --git a/sc/inc/tokenuno.hxx b/sc/inc/tokenuno.hxx
index 58808edc0131..ee12febd5659 100644
--- a/sc/inc/tokenuno.hxx
+++ b/sc/inc/tokenuno.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: tokenuno.hxx,v $
- * $Revision: 1.4.130.3 $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -39,9 +39,8 @@
#include <com/sun/star/sheet/XFormulaParser.hpp>
#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
-#include <com/sun/star/sheet/ExternalLinkInfo.hpp>
#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/implbase2.hxx>
+#include <formula/FormulaOpCodeMapperObj.hxx>
#include "address.hxx"
#include "compiler.hxx"
@@ -53,11 +52,9 @@ class ScTokenConversion
{
public:
static bool ConvertToTokenArray(
- ScDocument& rDoc,
ScTokenArray& rTokenArray,
const com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& rSequence );
static bool ConvertToTokenSequence(
- ScDocument& rDoc,
com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& rSequence,
const ScTokenArray& rTokenArray );
};
@@ -71,13 +68,13 @@ class ScFormulaParserObj : public ::cppu::WeakImplHelper3<
{
private:
::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::FormulaOpCodeMapEntry > maOpCodeMapping;
- ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks;
ScCompiler::OpCodeMapPtr mxOpCodeMap;
ScDocShell* mpDocShell;
ScAddress maRefPos;
sal_Int16 mnConv;
bool mbEnglish;
bool mbIgnoreSpaces;
+ bool mbCompileFAP;
void SetCompilerFlags( ScCompiler& rCompiler ) const;
@@ -145,38 +142,10 @@ public:
throw(::com::sun::star::uno::RuntimeException);
};
-
-class ScFormulaOpCodeMapperObj : public ::cppu::WeakImplHelper2<
- ::com::sun::star::sheet::XFormulaOpCodeMapper,
- ::com::sun::star::lang::XServiceInfo >
+class ScFormulaOpCodeMapperObj : public formula::FormulaOpCodeMapperObj
{
public:
- ScFormulaOpCodeMapperObj();
- virtual ~ScFormulaOpCodeMapperObj();
-
- // XFormulaOpCodeMapper
- // Attributes
- virtual ::sal_Int32 SAL_CALL getOpCodeExternal() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getOpCodeUnknown() throw (::com::sun::star::uno::RuntimeException);
- // Methods
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getMappings(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames,
- sal_Int32 nLanguage )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry > SAL_CALL getAvailableMappings(
- sal_Int32 nLanguage, sal_Int32 nGroups )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw(::com::sun::star::uno::RuntimeException);
-
+ ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> _pCompiler);
};
#endif
diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index 575860d90e2b..6aaa6f40d325 100644
--- a/sc/inc/validat.hxx
+++ b/sc/inc/validat.hxx
@@ -93,7 +93,7 @@ public:
ScValidationData( ScValidationMode eMode, ScConditionMode eOper,
const String& rExpr1, const String& rExpr2,
ScDocument* pDocument, const ScAddress& rPos,
- const ScGrammar::Grammar eGrammar = ScGrammar::GRAM_DEFAULT );
+ const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT );
ScValidationData( ScValidationMode eMode, ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
ScDocument* pDocument, const ScAddress& rPos );