LibreOffice Module sw (master) 1
|
#include <calc.hxx>
Public Member Functions | |
SwCalc (SwDoc &rD) | |
~SwCalc () | |
SwSbxValue | Calculate (const OUString &rStr) |
OUString | GetStrResult (const SwSbxValue &rValue) |
OUString | GetStrResult (double) |
SwCalcExp * | VarInsert (const OUString &r) |
SwCalcExp * | VarLook (const OUString &rStr, bool bIns=false) |
void | VarChange (const OUString &rStr, const SwSbxValue &rValue) |
void | VarChange (const OUString &rStr, double) |
SwHashTable< SwCalcExp > & | GetVarTable () |
bool | Push (const SwUserFieldType *pUserFieldType) |
void | Pop () |
const CharClass * | GetCharClass () const |
void | SetCharClass (const LanguageTag &rLanguageTag) |
void | SetCalcError (SwCalcError eErr) |
bool | IsCalcError () const |
bool | IsCalcNotANumber () const |
Static Public Member Functions | |
static bool | Str2Double (const OUString &rStr, sal_Int32 &rPos, double &rVal) |
static bool | Str2Double (const OUString &rStr, sal_Int32 &rPos, double &rVal, SwDoc const *const pDoc) |
static LanguageType | GetDocAppScriptLang (SwDoc const &rDoc) |
static SW_DLLPUBLIC bool | IsValidVarName (const OUString &rStr, OUString *pValidName=nullptr) |
Private Member Functions | |
SwCalcOper | GetToken () |
SwSbxValue | Expr () |
SwSbxValue | Term () |
SwSbxValue | PrimFunc (bool &rChkPow) |
SwSbxValue | Prim () |
SwSbxValue | StdFunc (pfCalc pFnc, bool bChkTrig) |
OUString | GetDBName (std::u16string_view rName) |
SwCalc (const SwCalc &)=delete | |
SwCalc & | operator= (const SwCalc &)=delete |
void | ImplDestroy () |
Static Private Member Functions | |
static OUString | GetColumnName (const OUString &rName) |
Private Attributes | |
SwHashTable< SwCalcExp > | m_aVarTable |
OUStringBuffer | m_aVarName |
OUString | m_sCurrSym |
OUString | m_sCommand |
std::vector< const SwUserFieldType * > | m_aRekurStack |
SwSbxValue | m_nLastLeft |
SwSbxValue | m_nNumberValue |
SwCalcExp | m_aErrExpr |
sal_Int32 | m_nCommandPos |
SwDoc & | m_rDoc |
std::unique_ptr< LocaleDataWrapper > | m_xLocaleDataWrapper |
CharClass * | m_pCharClass |
sal_uInt16 | m_nListPor |
bool | m_bHasNumber |
SwCalcOper | m_eCurrOper |
SwCalcOper | m_eCurrListOper |
SwCalcError | m_eError |
|
privatedelete |
SwCalc::SwCalc | ( | SwDoc & | rD | ) |
Definition at line 220 of file calc.cxx.
References SwHash::aStr, GetDocAppScriptLang(), IDocumentStatistics::GetDocStat(), SvtUserOptions::GetFirstName(), SvtUserOptions::GetID(), SwDoc::getIDocumentStatistics(), CharClass::getLanguageTag(), LanguageTag::getLanguageType(), SvtUserOptions::GetLastName(), SvtUserOptions::GetToken(), CharClass::lowercase(), m_aErrExpr, m_aVarTable, m_pCharClass, m_rDoc, m_sCurrSym, m_xLocaleDataWrapper, n, SwDocStat::nChar, SwDocStat::nGrf, SwDocStat::nOLE, SwDocStat::nPage, SwDocStat::nPara, SwDocStat::nTable, nValue, SwDocStat::nWord, SbxValue::PutString(), comphelper::string::strip(), and SW_MOD.
SwCalc::~SwCalc | ( | ) |
Definition at line 358 of file calc.cxx.
References ImplDestroy(), and suppress_fun_call_w_exception.
SwSbxValue SwCalc::Calculate | ( | const OUString & | rStr | ) |
Definition at line 363 of file calc.cxx.
References CALC_ENDCALC, CALC_PLUS, Expr(), GetToken(), m_eCurrListOper, m_eCurrOper, m_eError, m_nCommandPos, m_nListPor, m_sCommand, NONE, and SbxValue::PutDouble().
Referenced by SwTableBoxFormula::Calc(), SwTableField::CalcField(), SwEditShell::Calculate(), SwGetExpField::ChangeExpansion(), SwUserFieldType::GetValue(), SwTableBox::GetValue(), SwDoc::InsertSwSection(), SwUndoDelSection::UndoImpl(), sw::DocumentFieldsManager::UpdateDBNumFields(), sw::DocumentFieldsManager::UpdateExpFieldsImpl(), and SwDoc::UpdateSection().
|
private |
Definition at line 1309 of file calc.cxx.
References CALC_MINUS, CALC_PLUS, GetToken(), left, m_eCurrOper, m_nLastLeft, m_nListPor, right, SbxMINUS, SbxPLUS, and Term().
Referenced by Calculate(), and PrimFunc().
const CharClass * SwCalc::GetCharClass | ( | ) | const |
Definition at line 632 of file calc.cxx.
References m_pCharClass.
Referenced by SwUserFieldType::GetValue().
|
staticprivate |
|
private |
|
static |
Definition at line 199 of file calc.cxx.
References GetAppLanguage(), SwDoc::GetDefault(), SvtLanguageOptions::GetI18NScriptTypeOfLanguage(), GetWhichOfScript(), and RES_CHRATR_LANGUAGE().
Referenced by SwFormulaField::SetExpandedFormula(), Str2Double(), and SwCalc().
OUString SwCalc::GetStrResult | ( | const SwSbxValue & | rValue | ) |
Definition at line 391 of file calc.cxx.
References SwSbxValue::GetDouble(), SbxValue::GetOUString(), GetStrResult(), and SbxValue::IsDouble().
Referenced by SwEditShell::Calculate(), GetStrResult(), and SwTableFormula::MakeFormula_().
OUString SwCalc::GetStrResult | ( | double | nValue | ) |
Definition at line 400 of file calc.cxx.
References ShellResource::aCalc_Brack, ShellResource::aCalc_Default, ShellResource::aCalc_Overflow, ShellResource::aCalc_Pow, ShellResource::aCalc_Syntax, ShellResource::aCalc_ZeroDiv, DivByZero, FaultyBrackets, SwViewShell::GetShellRes(), m_eError, m_xLocaleDataWrapper, nValue, Overflow, OverflowInPower, and Syntax.
|
private |
Definition at line 642 of file calc.cxx.
References aName, CALC_AVERAGE, CALC_COUNT, CALC_DATE, CALC_DAY, CALC_ENDCALC, CALC_EQ, CALC_GEQ, CALC_GRE, CALC_LEQ, CALC_LES, CALC_MAX, CALC_MAX_IN, CALC_MEAN, CALC_MIN, CALC_MIN_IN, CALC_MONTH, CALC_MUL, CALC_NAME, CALC_NEQ, CALC_NOT, CALC_NUMBER, CALC_PLUS, CALC_PRINT, CALC_PRODUCT, CALC_SUM, ch, cListDelim, coContFlags, coStartFlags, CalcOp::eOp, FindOperator(), GetToken(), CharClass::lowercase(), m_aVarName, m_eCurrListOper, m_eCurrOper, m_eError, m_nCommandPos, m_nNumberValue, m_pCharClass, m_sCommand, m_sCurrSym, CharClass::parseAnyToken(), SbxValue::PutDouble(), SbxValue::PutString(), and Syntax.
Referenced by Calculate(), Expr(), GetToken(), Prim(), PrimFunc(), StdFunc(), and Term().
|
inline |
Definition at line 248 of file calc.hxx.
References m_aVarTable.
Referenced by SwEditShell::Calculate().
|
private |
Definition at line 352 of file calc.cxx.
References GetAppCharClass(), and m_pCharClass.
Referenced by ~SwCalc().
|
inline |
Definition at line 256 of file calc.hxx.
References m_eError, NaN, and NONE.
Referenced by SwTableBoxFormula::Calc(), SwTableField::CalcField(), SwTableCalcPara::CalcWithStackOverflow(), SwUserFieldType::GetValue(), SwTableBox::GetValue(), SwTableFormula::MakeFormula_(), and sw::DocumentFieldsManager::UpdateExpFieldsImpl().
|
inline |
Definition at line 257 of file calc.hxx.
Referenced by SwTableFormula::MakeFormula_().
|
static |
Definition at line 1420 of file calc.cxx.
References coContFlags, coStartFlags, GetAppCharClass(), and CharClass::parseAnyToken().
Referenced by TextFilterAutoConvert::filter(), and IMPL_LINK_NOARG().
void SwCalc::Pop | ( | ) |
Definition at line 625 of file calc.cxx.
References m_aRekurStack.
Referenced by SwUserFieldType::GetValue().
|
private |
Definition at line 1272 of file calc.cxx.
References CALC_POW, SbxValue::Clear(), SwSbxValue::GetDouble(), GetToken(), m_eCurrOper, m_eError, Overflow, OverflowInPower, Prim(), PrimFunc(), SbxValue::PutDouble(), right, and o3tl::temporary().
Referenced by Prim(), PrimFunc(), StdFunc(), and Term().
|
private |
! computes a binary NOT
Definition at line 1060 of file calc.cxx.
References abs(), CALC_ABS, CALC_ACOS, CALC_ASIN, CALC_ASSIGN, CALC_ATAN, CALC_AVERAGE, CALC_COS, CALC_COUNT, CALC_DATE, CALC_ENDCALC, CALC_INT, CALC_LP, CALC_MAX, CALC_MEAN, CALC_MIN, CALC_MINUS, CALC_NAME, CALC_NOT, CALC_NUMBER, CALC_PHD, CALC_PRODUCT, CALC_RP, CALC_SIGN, CALC_SIN, CALC_SQRT, CALC_SUM, CALC_TAN, SbxValue::Clear(), SbxValue::Compute(), DivByZero, Expr(), FaultyBrackets, SwSbxValue::GetBool(), SwSbxValue::GetDouble(), SbxValue::GetOUString(), GetToken(), SbxValue::GetType(), SbxValue::IsNumeric(), SwSbxValue::IsVoidValue(), m_aVarName, m_bHasNumber, m_eCurrOper, m_eError, m_nListPor, m_nNumberValue, n, SwCalcExp::nValue, Overflow, Prim(), SbxValue::PutBool(), SbxValue::PutDouble(), SbxValue::PutLong(), SAL_INFO, SbxNOT, SbxSTRING, StdFunc(), Syntax, VarInsert(), and VarLook().
Referenced by Prim().
bool SwCalc::Push | ( | const SwUserFieldType * | pUserFieldType | ) |
Definition at line 616 of file calc.cxx.
References m_aRekurStack.
Referenced by SwUserFieldType::GetValue().
|
inline |
Definition at line 255 of file calc.hxx.
References m_eError.
Referenced by SwTableCalcPara::CalcWithStackOverflow(), SwUserFieldType::GetValue(), SwTableBox::GetValue(), and SwTableFormula::MakeFormula_().
void SwCalc::SetCharClass | ( | const LanguageTag & | rLanguageTag | ) |
Definition at line 637 of file calc.cxx.
References m_pCharClass.
Referenced by SwUserFieldType::GetValue().
|
private |
Definition at line 1048 of file calc.cxx.
References SwSbxValue::GetDouble(), GetToken(), m_eError, Overflow, Prim(), and SbxValue::PutDouble().
Referenced by PrimFunc().
|
static |
Definition at line 1393 of file calc.cxx.
References SvtSysLocale::GetLocaleData().
Referenced by SwSbxValue::GetDouble(), and SwFormulaField::SetFormula().
|
static |
Definition at line 1400 of file calc.cxx.
References GetDocAppScriptLang(), SvtSysLocale::GetLanguageTag(), LanguageTag::getLanguageType(), and SvtSysLocale::GetLocaleData().
|
private |
Definition at line 867 of file calc.cxx.
References CALC_AND, CALC_DAY, CALC_DIV, CALC_EQ, CALC_GEQ, CALC_GRE, CALC_LEQ, CALC_LES, CALC_MAX_IN, CALC_MIN_IN, CALC_MONTH, CALC_MUL, CALC_NEQ, CALC_OR, CALC_ROUND, CALC_XOR, DivByZero, SwSbxValue::GetBool(), SwSbxValue::GetDouble(), GetToken(), i, lcl_ConvertToDateValue(), left, m_eCurrOper, m_eError, m_nLastLeft, m_rDoc, SwSbxValue::MakeDouble(), nRoundVal, Overflow, Prim(), SbxDIV, SbxEQ, SbxGE, SbxGT, SbxLE, SbxLT, SbxMUL, and SbxNE.
Referenced by Expr().
void SwCalc::VarChange | ( | const OUString & | rStr, |
const SwSbxValue & | rValue | ||
) |
Definition at line 597 of file calc.cxx.
References aStr, SwHashTable< T >::Find(), CharClass::lowercase(), m_aVarTable, m_pCharClass, nPos, SwCalcExp::nValue, and SwHash::pNext.
Referenced by SwDBManager::FillCalcWithMergeData(), sw::DocumentFieldsManager::UpdateDBNumFields(), sw::DocumentFieldsManager::UpdateExpFieldsImpl(), VarChange(), and VarLook().
void SwCalc::VarChange | ( | const OUString & | rStr, |
double | nValue | ||
) |
Definition at line 591 of file calc.cxx.
References nValue, and VarChange().
SwCalcExp * SwCalc::VarInsert | ( | const OUString & | r | ) |
Definition at line 423 of file calc.cxx.
References aStr, CharClass::lowercase(), m_pCharClass, and VarLook().
Referenced by PrimFunc().
SwCalcExp * SwCalc::VarLook | ( | const OUString & | rStr, |
bool | bIns = false |
||
) |
Definition at line 429 of file calc.cxx.
References aStr, DatabaseSetNumber, DB_DELIM, SwHashTable< T >::Find(), sw::proofreadingiterator::get(), SwDBManager::GetColumnCnt(), GetColumnName(), SwUserFieldType::GetContent(), SwDoc::GetDBManager(), GetDBName(), SwSbxValue::GetDouble(), SwDocUpdateField::GetFieldTypeTable(), SwDoc::getIDocumentFieldsAccess(), SbxValue::GetOUString(), SwDBManager::GetSelectedRecordId(), SwUserFieldType::GetType(), SwFieldType::GetTypeStr(), IDocumentFieldsAccess::GetUpdateFields(), SwUserFieldType::GetValue(), nsSwGetSetExpType::GSE_STRING, SwSbxValue::IsDBvalue(), SbxValue::IsDouble(), SwDBManager::IsInMerge(), SbxValue::IsString(), SwUserFieldType::IsValid(), CharClass::lowercase(), m_aErrExpr, m_aVarTable, m_bHasNumber, m_eCurrListOper, m_eCurrOper, m_nCommandPos, m_nLastLeft, m_nListPor, m_nNumberValue, m_pCharClass, m_rDoc, m_sCommand, m_xLocaleDataWrapper, nLang, SwCalcExp::nValue, SwDBManager::OpenDataSource(), SwCalcExp::pFieldType, SwHash::pNext, SbxValue::PutDouble(), SbxValue::PutString(), SbxValue::PutULong(), ReplacePoint(), SwSbxValue::SetVoidValue(), User, VarChange(), and SwFieldType::Which().
Referenced by SwEditShell::Calculate(), PrimFunc(), and VarInsert().
|
private |
|
private |
|
private |
Definition at line 202 of file calc.hxx.
Referenced by GetToken(), and PrimFunc().
|
private |
Definition at line 201 of file calc.hxx.
Referenced by GetVarTable(), SwCalc(), VarChange(), and VarLook().
|
private |
Definition at line 216 of file calc.hxx.
Referenced by PrimFunc(), and VarLook().
|
private |
Definition at line 218 of file calc.hxx.
Referenced by Calculate(), GetToken(), and VarLook().
|
private |
Definition at line 217 of file calc.hxx.
Referenced by Calculate(), Expr(), GetToken(), Prim(), PrimFunc(), Term(), and VarLook().
|
private |
Definition at line 219 of file calc.hxx.
Referenced by Calculate(), GetStrResult(), GetToken(), IsCalcError(), IsCalcNotANumber(), Prim(), PrimFunc(), SetCalcError(), StdFunc(), and Term().
|
private |
Definition at line 209 of file calc.hxx.
Referenced by Calculate(), GetToken(), and VarLook().
|
private |
|
private |
Definition at line 215 of file calc.hxx.
Referenced by Calculate(), Expr(), PrimFunc(), and VarLook().
|
private |
Definition at line 207 of file calc.hxx.
Referenced by GetToken(), PrimFunc(), and VarLook().
|
private |
Definition at line 213 of file calc.hxx.
Referenced by GetCharClass(), GetToken(), ImplDestroy(), SetCharClass(), SwCalc(), VarChange(), VarInsert(), and VarLook().
|
private |
|
private |
Definition at line 204 of file calc.hxx.
Referenced by Calculate(), GetToken(), and VarLook().
|
private |
Definition at line 203 of file calc.hxx.
Referenced by GetToken(), and SwCalc().
|
private |
Definition at line 212 of file calc.hxx.
Referenced by GetStrResult(), SwCalc(), and VarLook().