Hi everyone (including those who bring this up on wrong irc channels),

Here's a quick overview on what I have in mind for the API to allow the OOX import component to handle formulas:

1. The cell will have a new interface "XFormulaTokens" or something, with methods
* sequence<any> getTokenArray()
* void setTokenArray([in] sequence<any> aTokens)
There will be UNO structs for the different token types we have, and each any will contain one of them.

2. From the document, a new service like "FormulaParser" can be instantiated, which has an interface with methods
* sequence<any> parseFormula([in] string aFormula)
* string printFormula([in] sequence<any> aTokens)
and properties to control things like reference style, parameter separators, or possibly a function name replacement list. This is basically a wrapper around ScCompiler::CompileString and CreateStringFromTokenArray.

I'll try to flesh this out and make a basic implementation (without settings beyond what ScCompiler has today) this week, on CWS xmlfilter02, so it can be used and extended with what's needed for the filter.

To share formula handling code between xls and xlsx import, I think of something like this:
xls:
1. Read tokens into API structs
2. Reorder tokens from RPN into "normal" order
3. Do some magic processing
4. Apply the tokens to the cell

xlsx:
1. Read the formula string
2. Use new service to parse into tokens
3. Do some magic processing
4. Apply the tokens to the cell

This would allow step 3 to be shared.

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to