LibreOffice Module formula (master) 1
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
formula::FormulaGrammar Class Reference

Grammars digested by ScCompiler. More...

#include <grammar.hxx>

Public Types

enum  AddressConvention {
  CONV_UNSPECIFIED = -1 ,
  CONV_OOO = 0 ,
  CONV_ODF ,
  CONV_XL_A1 ,
  CONV_XL_R1C1 ,
  CONV_XL_OOX ,
  CONV_LOTUS_A1 ,
  CONV_LAST ,
  CONV_A1_XL_A1
}
 
enum  Grammar {
  GRAM_UNSPECIFIED = -1 ,
  GRAM_ODFF ,
  GRAM_PODF ,
  GRAM_ENGLISH ,
  GRAM_NATIVE ,
  GRAM_ODFF_UI ,
  GRAM_ODFF_A1 ,
  GRAM_PODF_UI ,
  GRAM_PODF_A1 ,
  GRAM_NATIVE_UI ,
  GRAM_NATIVE_ODF ,
  GRAM_NATIVE_XL_A1 ,
  GRAM_NATIVE_XL_R1C1 ,
  GRAM_ENGLISH_XL_A1 ,
  GRAM_ENGLISH_XL_R1C1 ,
  GRAM_ENGLISH_XL_OOX ,
  GRAM_OOXML ,
  GRAM_API ,
  GRAM_DEFAULT = GRAM_NATIVE_UI ,
  GRAM_STORAGE_DEFAULT = GRAM_ODFF ,
  GRAM_EXTERNAL = (1 << (kConventionShift - 1))
}
 Values encoding the formula language plus address reference convention plus English parsing/formatting. More...
 

Static Public Member Functions

static bool isEnglish (const Grammar eGrammar)
 If English parsing/formatting is associated with a grammar. More...
 
static Grammar mapAPItoGrammar (const bool bEnglish, const bool bXML)
 Compatibility helper for old "bCompileEnglish, bCompileXML" API calls to obtain the new grammar. More...
 
static bool isSupported (const Grammar eGrammar)
 
static sal_Int32 extractFormulaLanguage (const Grammar eGrammar)
 
static AddressConvention extractRefConvention (const Grammar eGrammar)
 
static Grammar setEnglishBit (const Grammar eGrammar, const bool bEnglish)
 
static Grammar mergeToGrammar (const Grammar eGrammar, const AddressConvention eConv)
 
static bool isPODF (const Grammar eGrammar)
 If grammar is of ODF 1.1. More...
 
static bool isODFF (const Grammar eGrammar)
 If grammar is of ODFF. More...
 
static bool isOOXML (const Grammar eGrammar)
 If grammar is of OOXML. More...
 
static bool isRefConventionOOXML (const Grammar eGrammar)
 If reference convention is OOXML. More...
 
static bool isExcelSyntax (const Grammar eGrammar)
 If grammar has an Excel syntax, determined by address convention. More...
 

Static Public Attributes

static const int kConventionOffset = - CONV_UNSPECIFIED + 1
 CONV_UNSPECIFIED is a negative value! More...
 
static const int kConventionShift = 16
 
static const int kEnglishBit = (1 << (kConventionShift + 8))
 
static const int kFlagMask = ~((~unsigned(0)) << kConventionShift)
 

Detailed Description

Grammars digested by ScCompiler.

Definition at line 32 of file grammar.hxx.

Member Enumeration Documentation

◆ AddressConvention

Enumerator
CONV_UNSPECIFIED 
CONV_OOO 
CONV_ODF 
CONV_XL_A1 
CONV_XL_R1C1 
CONV_XL_OOX 
CONV_LOTUS_A1 
CONV_LAST 
CONV_A1_XL_A1 

Definition at line 35 of file grammar.hxx.

◆ Grammar

Values encoding the formula language plus address reference convention plus English parsing/formatting.

When adding new values adapt isSupported() below as well.

Enumerator
GRAM_UNSPECIFIED 

Used only in ScCompiler ctor and in some XML import API context.

GRAM_ODFF 

ODFF with default ODF A1 bracketed references.

GRAM_PODF 

ODF 1.1 with default ODF A1 bracketed references.

GRAM_ENGLISH 

English with default A1 reference style.

GRAM_NATIVE 

Native with default A1 reference style.

GRAM_ODFF_UI 

ODFF with reference style as set in UI, may be A1 or R1C1.

GRAM_ODFF_A1 

ODFF with A1 reference style, unbracketed.

GRAM_PODF_UI 

ODF 1.1 with reference style as set in UI, may be A1 or R1C1.

GRAM_PODF_A1 

ODF 1.1 with A1 reference style, unbracketed.

GRAM_NATIVE_UI 

Native with reference style as set in UI, may be A1 or R1C1.

GRAM_NATIVE_ODF 

Native with ODF A1 bracketed references. Not very useful but supported.

GRAM_NATIVE_XL_A1 

Native with Excel A1 reference style.

GRAM_NATIVE_XL_R1C1 

Native with Excel R1C1 reference style.

GRAM_ENGLISH_XL_A1 

English with Excel A1 reference style.

GRAM_ENGLISH_XL_R1C1 

English with Excel R1C1 reference style.

GRAM_ENGLISH_XL_OOX 

English with Excel OOXML reference style.

GRAM_OOXML 

Excel OOXML with Excel OOXML reference style.

GRAM_API 

API English with A1 reference style, unbracketed.

GRAM_DEFAULT 

Central definition of the default grammar to be used.

GRAM_STORAGE_DEFAULT 

Central definition of the default storage grammar to be used.

GRAM_EXTERNAL 

OpCodeMap set by external filter and merged with reference convention plus English bit on top.

Plain value acts as FormulaLanguage.

Definition at line 67 of file grammar.hxx.

Member Function Documentation

◆ extractFormulaLanguage()

static sal_Int32 formula::FormulaGrammar::extractFormulaLanguage ( const Grammar  eGrammar)
inlinestatic

◆ extractRefConvention()

static AddressConvention formula::FormulaGrammar::extractRefConvention ( const Grammar  eGrammar)
inlinestatic

Definition at line 180 of file grammar.hxx.

◆ isEnglish()

static bool formula::FormulaGrammar::isEnglish ( const Grammar  eGrammar)
inlinestatic

If English parsing/formatting is associated with a grammar.

Definition at line 164 of file grammar.hxx.

Referenced by mergeToGrammar().

◆ isExcelSyntax()

static bool formula::FormulaGrammar::isExcelSyntax ( const Grammar  eGrammar)
inlinestatic

If grammar has an Excel syntax, determined by address convention.

Definition at line 226 of file grammar.hxx.

Referenced by formula::FormulaCompiler::CreateStringFromToken(), formula::FormulaCompiler::GetToken(), and formula::FormulaCompiler::NextToken().

◆ isODFF()

static bool formula::FormulaGrammar::isODFF ( const Grammar  eGrammar)
inlinestatic

◆ isOOXML()

static bool formula::FormulaGrammar::isOOXML ( const Grammar  eGrammar)
inlinestatic

If grammar is of OOXML.

Definition at line 206 of file grammar.hxx.

Referenced by formula::FormulaCompiler::CreateStringFromTokenArray(), and formula::FormulaCompiler::OpCodeMap::isOOXML().

◆ isPODF()

static bool formula::FormulaGrammar::isPODF ( const Grammar  eGrammar)
inlinestatic

◆ isRefConventionOOXML()

static bool formula::FormulaGrammar::isRefConventionOOXML ( const Grammar  eGrammar)
inlinestatic

If reference convention is OOXML.

Note this is not equivalent to isOOXML() as it does not have to be FormulaLanguage::OOXML but can be Grammar::GRAM_EXTERNAL merged with AddressConvention::CONV_XL_OOX, which is used by various parts of OOXML import through the API FormulaParser.

Definition at line 219 of file grammar.hxx.

◆ isSupported()

bool formula::FormulaGrammar::isSupported ( const Grammar  eGrammar)
static

◆ mapAPItoGrammar()

FormulaGrammar::Grammar formula::FormulaGrammar::mapAPItoGrammar ( const bool  bEnglish,
const bool  bXML 
)
static

Compatibility helper for old "bCompileEnglish, bCompileXML" API calls to obtain the new grammar.

Definition at line 25 of file grammar.cxx.

References GRAM_API, GRAM_NATIVE, GRAM_NATIVE_ODF, and GRAM_PODF.

◆ mergeToGrammar()

FormulaGrammar::Grammar formula::FormulaGrammar::mergeToGrammar ( const Grammar  eGrammar,
const AddressConvention  eConv 
)
static

◆ setEnglishBit()

FormulaGrammar::Grammar formula::FormulaGrammar::setEnglishBit ( const Grammar  eGrammar,
const bool  bEnglish 
)
static

Definition at line 66 of file grammar.cxx.

References kEnglishBit.

Referenced by formula::FormulaCompiler::CreateOpCodeMap(), and mergeToGrammar().

Member Data Documentation

◆ kConventionOffset

const int formula::FormulaGrammar::kConventionOffset = - CONV_UNSPECIFIED + 1
static

CONV_UNSPECIFIED is a negative value!

Definition at line 55 of file grammar.hxx.

Referenced by mergeToGrammar().

◆ kConventionShift

const int formula::FormulaGrammar::kConventionShift = 16
static

Definition at line 57 of file grammar.hxx.

Referenced by mergeToGrammar().

◆ kEnglishBit

const int formula::FormulaGrammar::kEnglishBit = (1 << (kConventionShift + 8))
static

Definition at line 59 of file grammar.hxx.

Referenced by setEnglishBit().

◆ kFlagMask

const int formula::FormulaGrammar::kFlagMask = ~((~unsigned(0)) << kConventionShift)
static

Definition at line 61 of file grammar.hxx.


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