summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-03-06 11:55:10 +0000
committerKurt Zenker <kz@openoffice.org>2009-03-06 11:55:10 +0000
commitf7a1c1f19f820b99d4b847b233b4697a96045b81 (patch)
treee6aa91fc388accdc5edc8c48c1de703a01c7df92
parent43f57caba5db242a5b6de6f069b0f4c9bc2e37ea (diff)
CWS-TOOLING: integrate CWS calcperf03_OOO310
2009-01-27 17:45:09 +0100 er r267014 : satisfy some stoneage compiler (tinderbox error) 2009-01-26 13:53:16 +0100 er r266921 : corrected merge accident 2009-01-23 23:27:18 +0100 er r266857 : #i97468# for better accuracy use ::rtl::math::atanh() in ATANH and FISHER, tanh() in FISHERINV; patch from <regina> 2009-01-23 23:08:14 +0100 er r266854 : #i97467# added C99 atanh() substitute rtl_math_atanh() and ::rtl::math::atanh() since not all compilers have it; patch from <regina> Plus in rtl_math_log1p() made a variable volatile to prevent compilers from being too smart. 2009-01-23 19:20:43 +0100 er r266849 : #i95381# make PODF adapter recognize empty/missing parameter, in this case ADDRESS 3rd parameter 2009-01-23 17:34:21 +0100 er r266841 : #i95450# support ADDRESS 3rd parameter (abs) as missing parameter 2009-01-23 15:53:23 +0100 er r266830 : some minor beautification 2009-01-23 15:45:20 +0100 er r266829 : small bits missed during integration of cws frmdlg 2009-01-23 02:56:38 +0100 er r266764 : removed CVS nonsense 2009-01-23 02:50:15 +0100 er r266763 : get rid of nasty DOS lineends 2009-01-23 01:56:09 +0100 er r266762 : #i98318# fix crash with external references constructed via Function Wizard; also fixes crash #i98338# and WaE #i97555# 2009-01-22 15:58:41 +0100 er r266732 : #i97547# EUROCONVERT: add SKK/EUR 2009-01-21 15:47:39 +0100 er r266676 : CWS-TOOLING: rebase CWS calcperf03 to trunk@266428 (milestone: DEV300:m39) 2009-01-09 17:22:23 +0100 er r266105 : #i89976# use ::std::nth_element() instead of a fully sorted array for MEDIAN, PERCENTILE, QUARTILE, LARGE, SMALL 2008-11-07 20:13:55 +0100 er r263483 : #i95967# Broadcast: use bulk broadcast also for single cell changes as multiple identical listeners may be involved; speeds up the Zaske document to draw level with Excel 2008-11-07 20:08:37 +0100 er r263482 : #i95967# Notify: spare a vtable access
-rw-r--r--formula/inc/formula/FormulaCompiler.hxx3
-rw-r--r--formula/inc/formula/tokenarray.hxx20
-rw-r--r--formula/prj/CVS/Entries4
-rw-r--r--formula/prj/CVS/Repository1
-rw-r--r--formula/prj/CVS/Root1
-rw-r--r--formula/prj/CVS/Tag1
-rw-r--r--formula/prj/CVS/Template42
-rw-r--r--formula/source/core/api/token.cxx73
8 files changed, 45 insertions, 100 deletions
diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx
index 5f5cea3d0b..9aa65ba30d 100644
--- a/formula/inc/formula/FormulaCompiler.hxx
+++ b/formula/inc/formula/FormulaCompiler.hxx
@@ -89,10 +89,11 @@ public:
FormulaCompiler(FormulaTokenArray& _rArr);
virtual ~FormulaCompiler();
- // SUNWS7 needs a forward declared friend, otherwise members of the outer
+ // SUNWS8 needs a forward declared friend, otherwise members of the outer
// class are not accessible.
class OpCodeMap;
friend class FormulaCompiler::OpCodeMap;
+
/** Mappings from strings to OpCodes and vice versa. */
class FORMULA_DLLPUBLIC OpCodeMap
{
diff --git a/formula/inc/formula/tokenarray.hxx b/formula/inc/formula/tokenarray.hxx
index 703c799285..46192f9271 100644
--- a/formula/inc/formula/tokenarray.hxx
+++ b/formula/inc/formula/tokenarray.hxx
@@ -74,30 +74,30 @@ class FORMULA_DLLPUBLIC FormulaTokenArray
friend class FormulaMissingContext;
protected:
- FormulaToken** pCode; // Token code array
- FormulaToken** pRPN; // RPN array
+ FormulaToken** pCode; // Token code array
+ FormulaToken** 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.
+ BOOL bHyperLink; // If HYPERLINK() occurs in the formula.
protected:
void Assign( const FormulaTokenArray& );
/// Also used by the compiler. The token MUST had been allocated with new!
- FormulaToken* Add( FormulaToken* );
+ FormulaToken* Add( FormulaToken* );
inline void SetCombinedBitsRecalcMode( ScRecalcMode nBits )
- { nMode |= (nBits & ~RECALCMODE_EMASK); }
+ { nMode |= (nBits & ~RECALCMODE_EMASK); }
inline ScRecalcMode GetCombinedBitsRecalcMode() const
- { return nMode & ~RECALCMODE_EMASK; }
+ { 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; }
+ { nMode = GetCombinedBitsRecalcMode() | nBits; }
public:
FormulaTokenArray();
@@ -222,14 +222,14 @@ public:
/** Determines if this formula needs any changes to convert it to something
previous versions of OOo could consume (Plain Old Formula). */
- bool NeedsPofRewrite(const MissingConvention & rConv);
+ bool NeedsPofRewrite(const MissingConvention & rConv);
/** Rewrites to Plain Old Formula, substituting missing parameters. The
FormulaTokenArray* returned is new'ed. */
- FormulaTokenArray* RewriteMissingToPof(const MissingConvention & rConv);
+ FormulaTokenArray* RewriteMissingToPof(const MissingConvention & rConv);
/** Determines if this formula may be followed by a reference. */
- bool MayReferenceFollow();
+ bool MayReferenceFollow();
};
inline OpCode FormulaTokenArray::GetOuterFuncOpCode()
diff --git a/formula/prj/CVS/Entries b/formula/prj/CVS/Entries
deleted file mode 100644
index 3ae75e3153..0000000000
--- a/formula/prj/CVS/Entries
+++ /dev/null
@@ -1,4 +0,0 @@
-/build.lst/1.10/Wed Aug 20 14:15:04 2008//Tcws_dev300_frmdlg
-/d.lst/1.6/Fri Aug 17 11:27:10 2007//Tcws_dev300_frmdlg
-/rpt.xml/1.2/Mon Jul 09 11:56:12 2007//Tcws_dev300_frmdlg
-D
diff --git a/formula/prj/CVS/Repository b/formula/prj/CVS/Repository
deleted file mode 100644
index 573341612f..0000000000
--- a/formula/prj/CVS/Repository
+++ /dev/null
@@ -1 +0,0 @@
-/cvs/dba/reportdesign/prj
diff --git a/formula/prj/CVS/Root b/formula/prj/CVS/Root
deleted file mode 100644
index ed0df2a218..0000000000
--- a/formula/prj/CVS/Root
+++ /dev/null
@@ -1 +0,0 @@
-:pserver:oj@so-cvs-tunnel.germany.sun.com:/cvs
diff --git a/formula/prj/CVS/Tag b/formula/prj/CVS/Tag
deleted file mode 100644
index 9ff93ee1ef..0000000000
--- a/formula/prj/CVS/Tag
+++ /dev/null
@@ -1 +0,0 @@
-Tcws_dev300_frmdlg
diff --git a/formula/prj/CVS/Template b/formula/prj/CVS/Template
deleted file mode 100644
index eec9bab36d..0000000000
--- a/formula/prj/CVS/Template
+++ /dev/null
@@ -1,42 +0,0 @@
-Issue number:
-Submitted by:
-Reviewed by:
-CVS: ----------------------------------------------------------------------
-CVS: Issue number:
-CVS: If this change addresses one or more issues,
-CVS: then enter the issue number(s) here.
-CVS: Submitted by:
-CVS: If this code has been contributed to the project by someone else; i.e.,
-CVS: they sent us a patch or a set of diffs, then include their name/email
-CVS: address here. If this is your work then delete this line.
-CVS: Reviewed by:
-CVS: If we are doing pre-commit code reviews and someone else has
-CVS: reviewed your changes, include their name(s) here.
-CVS: If you have not had it reviewed then delete this line.
-CVS: ----------------------------------------------------------------------
-CVS: Committers,
-CVS:
-CVS: Please follow these protocols:
-CVS:
-CVS: * Please include in the log message
-CVS: reference(s) by ID / number and/or URL
-CVS: to any and all relevant OpenOffice.org issue(s).
-CVS:
-CVS: * If the code is contributed from outside Sun
-CVS: then please verify using the list at the following URL
-CVS: http://www.openoffice.org/copyright/copyrightapproved.html
-CVS: that Sun has received a signed Copyright Assignment Form
-CVS: from the submitter.
-CVS:
-CVS: Otherwise,
-CVS: please send an email TO: the submitter; and CC: OOCRequest@eng.sun.com
-CVS: the letter (CopyRightRequest.txt) to request assignment of copyright to Sun
-CVS: (http://www.openoffice.org/copyright/assign_copyright.html).
-CVS:
-CVS: Please do NOT commit code until you have verified (as detailed above) that
-CVS: Sun has received a signed Copyright Assignment Form from the submitter.
-CVS:
-CVS: * Please send an email TO: the submitter
-CVS: (particularly, if from outside Sun)
-CVS: advising that the code has been committed,
-CVS: and gratefully recognizing the contribution.
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 2ee64da24b..7262388bc5 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -880,11 +880,6 @@ BOOL FormulaTokenArray::HasMatrixDoubleRefOps()
// --- POF (plain old formula) rewrite of a token array ---------------------
-/* TODO: When both POF OOoXML and ODFF are to be supported differently, the
- * FormulaMissingContext and FormulaTokenArray::*Pof* methods should go to a convention
- * on its own.
- */
-
#if 0
// static function can't be compiled if not used (warning)
//#if OSL_DEBUG_LEVEL > 0
@@ -904,10 +899,10 @@ inline bool MissingConvention::isRewriteNeeded( OpCode eOp ) const
{
case ocGammaDist:
case ocPoissonDist:
+ case ocAddress:
return true;
case ocMissing:
case ocLog:
- case ocAddress:
return !isODFF(); // rewrite only for PODF
default:
return false;
@@ -917,16 +912,16 @@ inline bool MissingConvention::isRewriteNeeded( OpCode eOp ) const
class FormulaMissingContext
{
public:
- const FormulaToken* mpFunc;
- int mnCurArg;
+ const FormulaToken* mpFunc;
+ int mnCurArg;
void Clear() { mpFunc = NULL; mnCurArg = 0; }
inline bool AddDefaultArg( FormulaTokenArray* pNewArr, int nArg, double f ) const;
- static inline bool IsRewriteNeeded( OpCode eOp );
bool AddMissingExternal( FormulaTokenArray* pNewArr ) const;
bool AddMissing( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const;
void AddMoreArgs( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const;
};
+
void FormulaMissingContext::AddMoreArgs( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const
{
if ( !mpFunc )
@@ -970,21 +965,10 @@ inline bool FormulaMissingContext::AddDefaultArg( FormulaTokenArray* pNewArr, in
return false;
}
-inline bool FormulaMissingContext::IsRewriteNeeded( OpCode eOp )
-{
- switch (eOp)
- {
- case ocMissing:
- case ocLog:
- case ocAddress:
- return true;
- default:
- return false;
- }
-}
-
bool FormulaMissingContext::AddMissingExternal( FormulaTokenArray *pNewArr ) const
{
+ // Only called for PODF, not ODFF. No need to distinguish.
+
const String &rName = mpFunc->GetExternal();
// initial (fast) check:
@@ -1011,38 +995,47 @@ bool FormulaMissingContext::AddMissing( FormulaTokenArray *pNewArr, const Missin
return false;
bool bRet = false;
+ const OpCode eOp = mpFunc->GetOpCode();
+
+ // Add for both, PODF and ODFF
+ switch (eOp)
+ {
+ case ocAddress:
+ return AddDefaultArg( pNewArr, 2, 1.0 ); // abs
+ default:
+ break;
+ }
+
if (rConv.isODFF())
{
+ // Add for ODFF
}
else
{
- switch ( mpFunc->GetOpCode() )
+ // Add for PODF
+ switch (eOp)
{
case ocFixed:
return AddDefaultArg( pNewArr, 1, 2.0 );
- //break;
case ocBetaDist:
case ocBetaInv:
- case ocRMZ: // PMT
+ case ocRMZ: // PMT
return AddDefaultArg( pNewArr, 3, 0.0 );
- //break;
- case ocZinsZ: // IPMT
- case ocKapz: // PPMT
+ case ocZinsZ: // IPMT
+ case ocKapz: // PPMT
return AddDefaultArg( pNewArr, 4, 0.0 );
- //break;
- case ocBW: // PV
- case ocZW: // FV
- bRet |= AddDefaultArg( pNewArr, 2, 0.0 ); // pmt
- bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // [fp]v
+ case ocBW: // PV
+ case ocZW: // FV
+ bRet |= AddDefaultArg( pNewArr, 2, 0.0 ); // pmt
+ bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // [fp]v
break;
- case ocZins: // RATE
- bRet |= AddDefaultArg( pNewArr, 1, 0.0 ); // pmt
- bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // fv
- bRet |= AddDefaultArg( pNewArr, 4, 0.0 ); // type
+ case ocZins: // RATE
+ bRet |= AddDefaultArg( pNewArr, 1, 0.0 ); // pmt
+ bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // fv
+ bRet |= AddDefaultArg( pNewArr, 4, 0.0 ); // type
break;
case ocExternal:
return AddMissingExternal( pNewArr );
- //break;
// --- more complex cases ---
@@ -1113,8 +1106,8 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissingToPof( const MissingConvent
++nFn; // all following operations on _that_ function
pCtx[ nFn ].mpFunc = PeekPrevNoSpaces();
pCtx[ nFn ].mnCurArg = 0;
- if (pCtx[ nFn ].mpFunc && pCtx[ nFn ].mpFunc->GetOpCode() == ocAddress)
- pOcas[ nOcas++ ] = nFn; // entering ADDRESS()
+ if (pCtx[ nFn ].mpFunc && pCtx[ nFn ].mpFunc->GetOpCode() == ocAddress && !rConv.isODFF())
+ pOcas[ nOcas++ ] = nFn; // entering ADDRESS() if PODF
break;
case ocClose:
pCtx[ nFn ].AddMoreArgs( pNewArr, rConv );