LibreOffice Module sc (master) 1
|
Import formula parser for OOXML and BIFF filters. More...
#include <formulaparser.hxx>
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 (std::u16string_view aFormulaString) |
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 (std::u16string_view aFormulaString) |
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 | |
OpCodeProvider & | operator= (OpCodeProvider const &)=delete |
OpCodeProvider & | operator= (OpCodeProvider &&)=delete |
const ApiOpCodes & | getOpCodes () 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 FunctionInfo * | getFuncInfoFromApiToken (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 | |
FunctionProvider & | operator= (FunctionProvider const &)=delete |
FunctionProvider & | operator= (FunctionProvider &&)=delete |
const FunctionInfo * | getFuncInfoFromOoxFuncName (const OUString &rFuncName) const |
Returns the function info for an OOXML function name, or 0 on error. More... | |
const FunctionInfo * | getFuncInfoFromBiff12FuncId (sal_uInt16 nFuncId) const |
Returns the function info for a BIFF12 function index, or 0 on error. More... | |
const FunctionInfo * | getFuncInfoFromMacroName (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 | |
WorkbookHelper & | operator= (WorkbookHelper const &)=delete |
WorkbookHelper & | operator= (WorkbookHelper &&)=delete |
::oox::core::FilterBase & | getBaseFilter () const |
Returns the base filter object (base class of all filters). More... | |
SegmentProgressBar & | getProgressBar () 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... | |
bool | hasCalculatedFormulaCells () const |
Returns true if any formula cell is calculated. More... | |
void | setCalculatedFormulaCells () |
Set if any formula cell is calculated. 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) |
ScDocument & | getScDocument () |
const ScDocument & | getScDocument () const |
ScDocumentImport & | getDocImport () |
const ScDocumentImport & | getDocImport () const |
ScEditEngineDefaulter & | getEditEngine () 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... | |
RangeDataRet | createNamedRangeObject (OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden) const |
Creates and returns a defined name on-the-fly in the Calc document. More... | |
RangeDataRet | createLocalNamedRangeObject (OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden) 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... | |
ScDBData * | findDatabaseRangeByIndex (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... | |
FormulaBuffer & | getFormulaBuffer () const |
WorkbookSettings & | getWorkbookSettings () const |
Returns the global workbook settings object. More... | |
ViewSettings & | getViewSettings () const |
Returns the workbook and sheet view settings object. More... | |
WorksheetBuffer & | getWorksheets () const |
Returns the worksheet buffer containing sheet names and properties. More... | |
ThemeBuffer & | getTheme () const |
Returns the office theme object read from the theme substorage. More... | |
StylesBuffer & | getStyles () const |
Returns all cell formatting objects read from the styles substream. More... | |
SharedStringsBuffer & | getSharedStrings () const |
Returns the shared strings read from the shared strings substream. More... | |
ExternalLinkBuffer & | getExternalLinks () const |
Returns the external links read from the external links substream. More... | |
DefinedNamesBuffer & | getDefinedNames () const |
Returns the defined names read from the workbook globals. More... | |
TableBuffer & | getTables () const |
Returns the tables collection (equivalent to Calc's database ranges). More... | |
ScenarioBuffer & | getScenarios () const |
Returns the scenarios collection. More... | |
ConnectionsBuffer & | getConnections () const |
Returns the collection of external data connections. More... | |
PivotCacheBuffer & | getPivotCaches () const |
Returns the collection of pivot caches. More... | |
PivotTableBuffer & | getPivotTables () const |
Returns the collection of pivot tables. More... | |
FormulaParser & | getFormulaParser () const |
Returns a shared import formula parser (import filter only!). More... | |
FormulaParser * | createFormulaParser () const |
Returns an unshared import formula parser (import filter only!). More... | |
UnitConverter & | getUnitConverter () const |
Returns the measurement unit converter. More... | |
AddressConverter & | getAddressConverter () const |
Returns the converter for string to cell address/range conversion. More... | |
oox::drawingml::chart::ChartConverter * | getChartConverter () const |
Returns the chart object converter. More... | |
PageSettingsConverter & | getPageSettingsConverter () const |
Returns the page and print settings converter. More... | |
::oox::core::XmlFilterBase & | getOoxFilter () 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< FormulaParserImpl > | mxImpl |
Additional Inherited Members | |
Public Types inherited from oox::xls::WorkbookHelper | |
typedef std::pair< ScRangeData *, bool > | RangeDataRet |
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 | 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 (std::u16string_view 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 Types inherited from oox::xls::WorkbookHelper | |
typedef std::pair< ScRangeData *, bool > | RangeDataRet |
Protected Member Functions inherited from oox::xls::FunctionProvider | |
const FunctionInfoVector & | getFuncs () 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 | |
WorkbookHelper & | operator= (WorkbookHelper const &)=delete |
WorkbookHelper & | operator= (WorkbookHelper &&)=delete |
::oox::core::FilterBase & | getBaseFilter () const |
Returns the base filter object (base class of all filters). More... | |
SegmentProgressBar & | getProgressBar () 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... | |
bool | hasCalculatedFormulaCells () const |
Returns true if any formula cell is calculated. More... | |
void | setCalculatedFormulaCells () |
Set if any formula cell is calculated. 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) |
ScDocument & | getScDocument () |
const ScDocument & | getScDocument () const |
ScDocumentImport & | getDocImport () |
const ScDocumentImport & | getDocImport () const |
ScEditEngineDefaulter & | getEditEngine () 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... | |
RangeDataRet | createNamedRangeObject (OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden) const |
Creates and returns a defined name on-the-fly in the Calc document. More... | |
RangeDataRet | createLocalNamedRangeObject (OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden) 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... | |
ScDBData * | findDatabaseRangeByIndex (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... | |
FormulaBuffer & | getFormulaBuffer () const |
WorkbookSettings & | getWorkbookSettings () const |
Returns the global workbook settings object. More... | |
ViewSettings & | getViewSettings () const |
Returns the workbook and sheet view settings object. More... | |
WorksheetBuffer & | getWorksheets () const |
Returns the worksheet buffer containing sheet names and properties. More... | |
ThemeBuffer & | getTheme () const |
Returns the office theme object read from the theme substorage. More... | |
StylesBuffer & | getStyles () const |
Returns all cell formatting objects read from the styles substream. More... | |
SharedStringsBuffer & | getSharedStrings () const |
Returns the shared strings read from the shared strings substream. More... | |
ExternalLinkBuffer & | getExternalLinks () const |
Returns the external links read from the external links substream. More... | |
DefinedNamesBuffer & | getDefinedNames () const |
Returns the defined names read from the workbook globals. More... | |
TableBuffer & | getTables () const |
Returns the tables collection (equivalent to Calc's database ranges). More... | |
ScenarioBuffer & | getScenarios () const |
Returns the scenarios collection. More... | |
ConnectionsBuffer & | getConnections () const |
Returns the collection of external data connections. More... | |
PivotCacheBuffer & | getPivotCaches () const |
Returns the collection of pivot caches. More... | |
PivotTableBuffer & | getPivotTables () const |
Returns the collection of pivot tables. More... | |
FormulaParser & | getFormulaParser () const |
Returns a shared import formula parser (import filter only!). More... | |
FormulaParser * | createFormulaParser () const |
Returns an unshared import formula parser (import filter only!). More... | |
UnitConverter & | getUnitConverter () const |
Returns the measurement unit converter. More... | |
AddressConverter & | getAddressConverter () const |
Returns the converter for string to cell address/range conversion. More... | |
oox::drawingml::chart::ChartConverter * | getChartConverter () const |
Returns the chart object converter. More... | |
PageSettingsConverter & | getPageSettingsConverter () const |
Returns the page and print settings converter. More... | |
::oox::core::XmlFilterBase & | getOoxFilter () 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... | |
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 99 of file formulaparser.hxx.
|
explicit |
Definition at line 1753 of file formulaparser.cxx.
References mxImpl.
|
overridevirtual |
Definition at line 1759 of file formulaparser.cxx.
ApiTokenSequence oox::xls::FormulaParser::importFormula | ( | const ScAddress & | rBaseAddr, |
const OUString & | rFormulaString | ||
) | const |
Converts an OOXML formula string.
Definition at line 1763 of file formulaparser.cxx.
References mxImpl.
Referenced by oox::xls::CondFormatRule::appendFormula(), oox::xls::ExcelChartConverter::createDataSequence(), oox::xls::CondFormatRule::importCfRule(), and oox::xls::DataValidationsContextBase::importDataValidation().
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 1768 of file formulaparser.cxx.
OUString oox::xls::FormulaParser::importMacroName | ( | std::u16string_view | aFormulaString | ) |
Converts the passed formula to a macro name for a drawing shape.
Definition at line 1800 of file formulaparser.cxx.
References oox::xls::DefinedNamesBuffer::getByModelName(), oox::xls::WorkbookHelper::getDefinedNames(), oox::xls::ExternalLinkBuffer::getExternalLink(), oox::xls::WorkbookHelper::getExternalLinks(), oox::xls::ExternalLink::getLinkType(), oox::xls::DefinedName::isVBName(), and oox::xls::Self.
Referenced by oox::xls::VmlDrawing::createAndInsertClientXShape(), and oox::xls::Shape::Shape().
OUString oox::xls::FormulaParser::importOleTargetLink | ( | SequenceInputStream & | rStrm | ) |
Imports and converts an OLE link target from the passed stream.
Definition at line 1783 of file formulaparser.cxx.
References oox::xls::BIFF_TOKCLASS_VAL, oox::xls::BIFF_TOKID_NAMEX, mxImpl, nToken, and rStrm.
OUString oox::xls::FormulaParser::importOleTargetLink | ( | std::u16string_view | aFormulaString | ) |
Converts the passed XML formula to an OLE link target.
Definition at line 1773 of file formulaparser.cxx.
References mxImpl.
Referenced by oox::xls::WorksheetFragment::importOleObject().
|
private |
Definition at line 126 of file formulaparser.hxx.
Referenced by FormulaParser(), importFormula(), and importOleTargetLink().