LibreOffice Module sc (master)  1
Public Member Functions | Private Attributes | List of all members
oox::xls::FormulaParser Class Reference

Import formula parser for OOXML and BIFF filters. More...

#include <formulaparser.hxx>

Inheritance diagram for oox::xls::FormulaParser:
[legend]
Collaboration diagram for oox::xls::FormulaParser:
[legend]

Public Member Functions

 FormulaParser (const WorkbookHelper &rHelper)
 
virtual ~FormulaParser () override
 
ApiTokenSequence importFormula (const ScAddress &rBaseAddr, const OUString &rFormulaString) const
 Converts an OOXML formula string. More...
 
ApiTokenSequence importFormula (const ScAddress &rBaseAddr, FormulaType eType, SequenceInputStream &rStrm) const
 Imports and converts a BIFF12 token array from the passed stream. More...
 
OUString importOleTargetLink (const OUString &rFormulaString)
 Converts the passed XML formula to an OLE link target. More...
 
OUString importOleTargetLink (SequenceInputStream &rStrm)
 Imports and converts an OLE link target from the passed stream. More...
 
OUString importMacroName (const OUString &rFormulaString)
 Converts the passed formula to a macro name for a drawing shape. More...
 
- Public Member Functions inherited from oox::xls::FormulaProcessorBase
 FormulaProcessorBase (const WorkbookHelper &rHelper)
 
css::uno::Any extractReference (const ApiTokenSequence &rTokens) const
 Tries to extract a single cell reference from a formula token sequence. More...
 
bool extractCellRange (ScRange &orRange, const ApiTokenSequence &rTokens) const
 Tries to extract a cell range address from a formula token sequence. More...
 
void extractCellRangeList (ScRangeList &orRanges, const ApiTokenSequence &rTokens, sal_Int32 nFilterBySheet) const
 Tries to extract a cell range list from a formula token sequence. More...
 
bool extractString (OUString &orString, const ApiTokenSequence &rTokens) const
 Tries to extract a string from a formula token sequence. More...
 
bool extractSpecialTokenInfo (ApiSpecialTokenInfo &orTokenInfo, const ApiTokenSequence &rTokens) const
 Tries to extract information about a special token used for array formulas, shared formulas, or table operations. More...
 
void convertStringToStringList (ApiTokenSequence &orTokens, sal_Unicode cStringSep, bool bTrimLeadingSpaces) const
 Converts a single string with separators in the passed formula token sequence to a list of string tokens. More...
 
- Public Member Functions inherited from oox::xls::OpCodeProvider
 OpCodeProvider (const css::uno::Reference< css::lang::XMultiServiceFactory > &rxModelFactory, bool bImportFilter)
 
virtual ~OpCodeProvider () override
 
 OpCodeProvider (OpCodeProvider const &)=default
 
 OpCodeProvider (OpCodeProvider &&)=default
 
OpCodeProvideroperator= (OpCodeProvider const &)=delete
 
OpCodeProvideroperator= (OpCodeProvider &&)=delete
 
const ApiOpCodesgetOpCodes () const
 Returns the structure containing all token op-codes for operators and special tokens used by the Calc document and its formula parser. More...
 
const FunctionInfogetFuncInfoFromApiToken (const ApiToken &rToken) const
 Returns the function info for an API token, or 0 on error. More...
 
css::uno::Sequence< css::sheet::FormulaOpCodeMapEntry > getOoxParserMap () const
 Returns the op-code map that is used by the OOXML formula parser. More...
 
- Public Member Functions inherited from oox::xls::FunctionProvider
 FunctionProvider (bool bImportFilter)
 
virtual ~FunctionProvider ()
 
 FunctionProvider (FunctionProvider const &)=default
 
 FunctionProvider (FunctionProvider &&)=default
 
FunctionProvideroperator= (FunctionProvider const &)=delete
 
FunctionProvideroperator= (FunctionProvider &&)=delete
 
const FunctionInfogetFuncInfoFromOoxFuncName (const OUString &rFuncName) const
 Returns the function info for an OOXML function name, or 0 on error. More...
 
const FunctionInfogetFuncInfoFromBiff12FuncId (sal_uInt16 nFuncId) const
 Returns the function info for a BIFF12 function index, or 0 on error. More...
 
const FunctionInfogetFuncInfoFromMacroName (const OUString &rFuncName) const
 Returns the function info for a macro function referred by the EXTERN.CALL function, or 0 on error. More...
 
- Public Member Functions inherited from oox::xls::WorkbookHelper
 WorkbookHelper (WorkbookGlobals &rBookGlob)
 
virtual ~WorkbookHelper ()
 
 WorkbookHelper (WorkbookHelper const &)=default
 
 WorkbookHelper (WorkbookHelper &&)=default
 
WorkbookHelperoperator= (WorkbookHelper const &)=delete
 
WorkbookHelperoperator= (WorkbookHelper &&)=delete
 
::oox::core::FilterBasegetBaseFilter () const
 Returns the base filter object (base class of all filters). More...
 
SegmentProgressBargetProgressBar () const
 Returns the filter progress bar. More...
 
sal_Int16 getCurrentSheetIndex () const
 Returns the index of the current Calc sheet, if filter currently processes a sheet. More...
 
bool isGeneratorKnownGood () const
 Returns true when reading a file generated by a known good generator. More...
 
void setVbaProjectStorage (const StorageRef &rxVbaPrjStrg)
 Sets the VBA project storage used to import VBA source code and forms. More...
 
void setCurrentSheetIndex (SCTAB nSheet)
 Sets the index of the current Calc sheet, if filter currently processes a sheet. More...
 
void finalizeWorkbookImport ()
 Final conversion after importing the workbook. More...
 
void useInternalChartDataTable (bool bInternal)
 
ScDocumentgetScDocument ()
 
const ScDocumentgetScDocument () const
 
ScDocumentImportgetDocImport ()
 
const ScDocumentImportgetDocImport () const
 
ScEditEngineDefaultergetEditEngine () const
 
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument () const
 Returns a reference to the source/target spreadsheet document model. More...
 
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc (sal_Int32 nSheet) const
 Returns a reference to the specified spreadsheet in the document model. More...
 
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc (const OUString &rSheet) const
 Returns a reference to the specified spreadsheet in the document model. More...
 
css::uno::Reference< css::table::XCellRange > getCellRangeFromDoc (const ScRange &rRange) const
 Returns the XCellRange interface for the passed cell range address. More...
 
css::uno::Reference< css::container::XNameContainer > getCellStyleFamily () const
 Returns the cell styles container from the Calc document. More...
 
css::uno::Reference< css::style::XStyle > getStyleObject (const OUString &rStyleName, bool bPageStyle) const
 Returns the specified cell or page style from the Calc document. More...
 
ScRangeDatacreateNamedRangeObject (OUString &orName, const css::uno::Sequence< css::sheet::FormulaToken > &rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags) const
 Creates and returns a defined name on-the-fly in the Calc document. More...
 
ScRangeDatacreateLocalNamedRangeObject (OUString &orName, const css::uno::Sequence< css::sheet::FormulaToken > &rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab) const
 Creates and returns a defined name on-the-fly in the sheet. More...
 
css::uno::Reference< css::sheet::XDatabaseRange > createDatabaseRangeObject (OUString &orName, const ScRange &rRangeAddr) const
 Creates and returns a database range on-the-fly in the Calc document. More...
 
css::uno::Reference< css::sheet::XDatabaseRange > createUnnamedDatabaseRangeObject (const ScRange &rRangeAddr) const
 Creates and returns an unnamed database range on-the-fly in the Calc document. More...
 
ScDBDatafindDatabaseRangeByIndex (sal_uInt16 nIndex) const
 Finds the (already existing) database range of the given formula token index. More...
 
css::uno::Reference< css::style::XStyle > createStyleObject (OUString &orStyleName, bool bPageStyle) const
 Creates and returns a com.sun.star.style.Style object for cells or pages. More...
 
FormulaBuffergetFormulaBuffer () const
 
WorkbookSettingsgetWorkbookSettings () const
 Returns the global workbook settings object. More...
 
ViewSettingsgetViewSettings () const
 Returns the workbook and sheet view settings object. More...
 
WorksheetBuffergetWorksheets () const
 Returns the worksheet buffer containing sheet names and properties. More...
 
ThemeBuffergetTheme () const
 Returns the office theme object read from the theme substorage. More...
 
StylesBuffergetStyles () const
 Returns all cell formatting objects read from the styles substream. More...
 
SharedStringsBuffergetSharedStrings () const
 Returns the shared strings read from the shared strings substream. More...
 
ExternalLinkBuffergetExternalLinks () const
 Returns the external links read from the external links substream. More...
 
DefinedNamesBuffergetDefinedNames () const
 Returns the defined names read from the workbook globals. More...
 
TableBuffergetTables () const
 Returns the tables collection (equivalent to Calc's database ranges). More...
 
ScenarioBuffergetScenarios () const
 Returns the scenarios collection. More...
 
ConnectionsBuffergetConnections () const
 Returns the collection of external data connections. More...
 
PivotCacheBuffergetPivotCaches () const
 Returns the collection of pivot caches. More...
 
PivotTableBuffergetPivotTables () const
 Returns the collection of pivot tables. More...
 
FormulaParsergetFormulaParser () const
 Returns a shared import formula parser (import filter only!). More...
 
FormulaParsercreateFormulaParser () const
 Returns an unshared import formula parser (import filter only!). More...
 
UnitConvertergetUnitConverter () const
 Returns the measurement unit converter. More...
 
AddressConvertergetAddressConverter () const
 Returns the converter for string to cell address/range conversion. More...
 
oox::drawingml::chart::ChartConvertergetChartConverter () const
 Returns the chart object converter. More...
 
PageSettingsConvertergetPageSettingsConverter () const
 Returns the page and print settings converter. More...
 
::oox::core::XmlFilterBasegetOoxFilter () const
 Returns the base OOXML/BIFF12 filter object. More...
 
bool importOoxFragment (const rtl::Reference< oox::core::FragmentHandler > &rxHandler)
 Imports a fragment using the passed fragment handler, which contains the full path to the fragment stream. More...
 
bool importOoxFragment (const rtl::Reference< oox::core::FragmentHandler > &rxHandler, oox::core::FastParser &rParser)
 
rtl_TextEncoding getTextEncoding () const
 Returns the text encoding used to import/export byte strings. More...
 

Private Attributes

::std::unique_ptr< FormulaParserImplmxImpl
 

Additional Inherited Members

- Static Public Member Functions inherited from oox::xls::FormulaProcessorBase
static OUString generateAddress2dString (const ScAddress &rAddress, bool bAbsolute)
 Generates a cell address string in A1 notation from the passed cell address. More...
 
static OUString generateAddress2dString (const BinAddress &rAddress, bool bAbsolute)
 Generates a cell address string in A1 notation from the passed binary cell address. More...
 
static OUString generateApiString (const OUString &rString)
 Generates a string in Calc formula notation from the passed string. More...
 
static OUString generateApiArray (const Matrix< css::uno::Any > &rMatrix)
 Generates an array string in Calc formula notation from the passed matrix with Any's containing double values or strings. More...
 
- Static Public Member Functions inherited from oox::xls::FunctionProvider
static FunctionLibraryType getFuncLibTypeFromLibraryName (const OUString &rLibraryName)
 Returns the library type associated with the passed URL of a function library (function add-in). More...
 
- Static Public Member Functions inherited from oox::xls::WorkbookHelper
static WorkbookGlobalsRef constructGlobals (ExcelFilter &rFilter)
 
- Protected Member Functions inherited from oox::xls::FunctionProvider
const FunctionInfoVectorgetFuncs () const
 Returns the list of all function infos. More...
 
- Protected Member Functions inherited from oox::xls::WorkbookHelper
 WorkbookHelper (WorkbookGlobals &rBookGlob)
 
virtual ~WorkbookHelper ()
 
 WorkbookHelper (WorkbookHelper const &)=default
 
 WorkbookHelper (WorkbookHelper &&)=default
 
WorkbookHelperoperator= (WorkbookHelper const &)=delete
 
WorkbookHelperoperator= (WorkbookHelper &&)=delete
 
::oox::core::FilterBasegetBaseFilter () const
 Returns the base filter object (base class of all filters). More...
 
SegmentProgressBargetProgressBar () const
 Returns the filter progress bar. More...
 
sal_Int16 getCurrentSheetIndex () const
 Returns the index of the current Calc sheet, if filter currently processes a sheet. More...
 
bool isGeneratorKnownGood () const
 Returns true when reading a file generated by a known good generator. More...
 
void setVbaProjectStorage (const StorageRef &rxVbaPrjStrg)
 Sets the VBA project storage used to import VBA source code and forms. More...
 
void setCurrentSheetIndex (SCTAB nSheet)
 Sets the index of the current Calc sheet, if filter currently processes a sheet. More...
 
void finalizeWorkbookImport ()
 Final conversion after importing the workbook. More...
 
void useInternalChartDataTable (bool bInternal)
 
ScDocumentgetScDocument ()
 
const ScDocumentgetScDocument () const
 
ScDocumentImportgetDocImport ()
 
const ScDocumentImportgetDocImport () const
 
ScEditEngineDefaultergetEditEngine () const
 
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument () const
 Returns a reference to the source/target spreadsheet document model. More...
 
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc (sal_Int32 nSheet) const
 Returns a reference to the specified spreadsheet in the document model. More...
 
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc (const OUString &rSheet) const
 Returns a reference to the specified spreadsheet in the document model. More...
 
css::uno::Reference< css::table::XCellRange > getCellRangeFromDoc (const ScRange &rRange) const
 Returns the XCellRange interface for the passed cell range address. More...
 
css::uno::Reference< css::container::XNameContainer > getCellStyleFamily () const
 Returns the cell styles container from the Calc document. More...
 
css::uno::Reference< css::style::XStyle > getStyleObject (const OUString &rStyleName, bool bPageStyle) const
 Returns the specified cell or page style from the Calc document. More...
 
ScRangeDatacreateNamedRangeObject (OUString &orName, const css::uno::Sequence< css::sheet::FormulaToken > &rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags) const
 Creates and returns a defined name on-the-fly in the Calc document. More...
 
ScRangeDatacreateLocalNamedRangeObject (OUString &orName, const css::uno::Sequence< css::sheet::FormulaToken > &rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab) const
 Creates and returns a defined name on-the-fly in the sheet. More...
 
css::uno::Reference< css::sheet::XDatabaseRange > createDatabaseRangeObject (OUString &orName, const ScRange &rRangeAddr) const
 Creates and returns a database range on-the-fly in the Calc document. More...
 
css::uno::Reference< css::sheet::XDatabaseRange > createUnnamedDatabaseRangeObject (const ScRange &rRangeAddr) const
 Creates and returns an unnamed database range on-the-fly in the Calc document. More...
 
ScDBDatafindDatabaseRangeByIndex (sal_uInt16 nIndex) const
 Finds the (already existing) database range of the given formula token index. More...
 
css::uno::Reference< css::style::XStyle > createStyleObject (OUString &orStyleName, bool bPageStyle) const
 Creates and returns a com.sun.star.style.Style object for cells or pages. More...
 
FormulaBuffergetFormulaBuffer () const
 
WorkbookSettingsgetWorkbookSettings () const
 Returns the global workbook settings object. More...
 
ViewSettingsgetViewSettings () const
 Returns the workbook and sheet view settings object. More...
 
WorksheetBuffergetWorksheets () const
 Returns the worksheet buffer containing sheet names and properties. More...
 
ThemeBuffergetTheme () const
 Returns the office theme object read from the theme substorage. More...
 
StylesBuffergetStyles () const
 Returns all cell formatting objects read from the styles substream. More...
 
SharedStringsBuffergetSharedStrings () const
 Returns the shared strings read from the shared strings substream. More...
 
ExternalLinkBuffergetExternalLinks () const
 Returns the external links read from the external links substream. More...
 
DefinedNamesBuffergetDefinedNames () const
 Returns the defined names read from the workbook globals. More...
 
TableBuffergetTables () const
 Returns the tables collection (equivalent to Calc's database ranges). More...
 
ScenarioBuffergetScenarios () const
 Returns the scenarios collection. More...
 
ConnectionsBuffergetConnections () const
 Returns the collection of external data connections. More...
 
PivotCacheBuffergetPivotCaches () const
 Returns the collection of pivot caches. More...
 
PivotTableBuffergetPivotTables () const
 Returns the collection of pivot tables. More...
 
FormulaParsergetFormulaParser () const
 Returns a shared import formula parser (import filter only!). More...
 
FormulaParsercreateFormulaParser () const
 Returns an unshared import formula parser (import filter only!). More...
 
UnitConvertergetUnitConverter () const
 Returns the measurement unit converter. More...
 
AddressConvertergetAddressConverter () const
 Returns the converter for string to cell address/range conversion. More...
 
oox::drawingml::chart::ChartConvertergetChartConverter () const
 Returns the chart object converter. More...
 
PageSettingsConvertergetPageSettingsConverter () const
 Returns the page and print settings converter. More...
 
::oox::core::XmlFilterBasegetOoxFilter () const
 Returns the base OOXML/BIFF12 filter object. More...
 
bool importOoxFragment (const rtl::Reference< oox::core::FragmentHandler > &rxHandler)
 Imports a fragment using the passed fragment handler, which contains the full path to the fragment stream. More...
 
bool importOoxFragment (const rtl::Reference< oox::core::FragmentHandler > &rxHandler, oox::core::FastParser &rParser)
 
rtl_TextEncoding getTextEncoding () const
 Returns the text encoding used to import/export byte strings. More...
 
- Static Protected Member Functions inherited from oox::xls::WorkbookHelper
static WorkbookGlobalsRef constructGlobals (ExcelFilter &rFilter)
 
- Protected Attributes inherited from oox::xls::ApiOpCodes
sal_Int32 OPCODE_UNKNOWN
 
sal_Int32 OPCODE_EXTERNAL
 Internal: function name unknown to mapper. More...
 
sal_Int32 OPCODE_PUSH
 External function call (e.g. add-ins). More...
 
sal_Int32 OPCODE_MISSING
 Op-code for common value operands. More...
 
sal_Int32 OPCODE_SPACES
 Placeholder for a missing function parameter. More...
 
sal_Int32 OPCODE_NAME
 Spaces between other formula tokens. More...
 
sal_Int32 OPCODE_DBAREA
 Index of a defined name. More...
 
sal_Int32 OPCODE_NLR
 Index of a database area. More...
 
sal_Int32 OPCODE_DDE
 Natural language reference. More...
 
sal_Int32 OPCODE_MACRO
 DDE link function. More...
 
sal_Int32 OPCODE_BAD
 Macro function call. More...
 
sal_Int32 OPCODE_NONAME
 Bad token (unknown name, formula error). More...
 
sal_Int32 OPCODE_OPEN
 Function style #NAME? error. More...
 
sal_Int32 OPCODE_CLOSE
 Opening parenthesis. More...
 
sal_Int32 OPCODE_SEP
 Closing parenthesis. More...
 
sal_Int32 OPCODE_ARRAY_OPEN
 Function parameter separator. More...
 
sal_Int32 OPCODE_ARRAY_CLOSE
 Opening brace for constant arrays. More...
 
sal_Int32 OPCODE_ARRAY_ROWSEP
 Closing brace for constant arrays. More...
 
sal_Int32 OPCODE_ARRAY_COLSEP
 Row separator in constant arrays. More...
 
sal_Int32 OPCODE_PLUS_SIGN
 Column separator in constant arrays. More...
 
sal_Int32 OPCODE_MINUS_SIGN
 Unary plus sign. More...
 
sal_Int32 OPCODE_PERCENT
 Unary minus sign. More...
 
sal_Int32 OPCODE_ADD
 Percent sign. More...
 
sal_Int32 OPCODE_SUB
 Addition operator. More...
 
sal_Int32 OPCODE_MULT
 Subtraction operator. More...
 
sal_Int32 OPCODE_DIV
 Multiplication operator. More...
 
sal_Int32 OPCODE_POWER
 Division operator. More...
 
sal_Int32 OPCODE_CONCAT
 Power operator. More...
 
sal_Int32 OPCODE_EQUAL
 String concatenation operator. More...
 
sal_Int32 OPCODE_NOT_EQUAL
 Compare equal operator. More...
 
sal_Int32 OPCODE_LESS
 Compare not equal operator. More...
 
sal_Int32 OPCODE_LESS_EQUAL
 Compare less operator. More...
 
sal_Int32 OPCODE_GREATER
 Compare less or equal operator. More...
 
sal_Int32 OPCODE_GREATER_EQUAL
 Compare greater operator. More...
 
sal_Int32 OPCODE_INTERSECT
 Compare greater or equal operator. More...
 
sal_Int32 OPCODE_LIST
 Range intersection operator. More...
 
sal_Int32 OPCODE_RANGE
 Range list operator. More...
 

Detailed Description

Import formula parser for OOXML and BIFF filters.

This class implements formula import for the OOXML and BIFF filter. One instance is contained in the global filter data to prevent construction and destruction of internal buffers for every imported formula.

Definition at line 100 of file formulaparser.hxx.

Constructor & Destructor Documentation

oox::xls::FormulaParser::FormulaParser ( const WorkbookHelper rHelper)
explicit

Definition at line 1752 of file formulaparser.cxx.

References mxImpl.

oox::xls::FormulaParser::~FormulaParser ( )
overridevirtual

Definition at line 1758 of file formulaparser.cxx.

Member Function Documentation

ApiTokenSequence oox::xls::FormulaParser::importFormula ( const ScAddress rBaseAddr,
const OUString &  rFormulaString 
) const
ApiTokenSequence oox::xls::FormulaParser::importFormula ( const ScAddress rBaseAddr,
FormulaType  eType,
SequenceInputStream rStrm 
) const

Imports and converts a BIFF12 token array from the passed stream.

Definition at line 1767 of file formulaparser.cxx.

References mxImpl.

OUString oox::xls::FormulaParser::importMacroName ( const OUString &  rFormulaString)
OUString oox::xls::FormulaParser::importOleTargetLink ( const OUString &  rFormulaString)

Converts the passed XML formula to an OLE link target.

Definition at line 1772 of file formulaparser.cxx.

References mxImpl.

Referenced by oox::xls::WorksheetFragment::importOleObject().

OUString oox::xls::FormulaParser::importOleTargetLink ( SequenceInputStream rStrm)

Member Data Documentation

::std::unique_ptr< FormulaParserImpl > oox::xls::FormulaParser::mxImpl
private

Definition at line 127 of file formulaparser.hxx.

Referenced by FormulaParser(), importFormula(), and importOleTargetLink().


The documentation for this class was generated from the following files: