LibreOffice Module sc (master) 1
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ScValidationData Class Referencefinal

#include <validat.hxx>

Inheritance diagram for ScValidationData:
[legend]
Collaboration diagram for ScValidationData:
[legend]

Classes

struct  CustomValidationPrivateAccess
 

Public Member Functions

 ScValidationData (ScValidationMode eMode, ScConditionMode eOper, const OUString &rExpr1, const OUString &rExpr2, ScDocument &rDocument, const ScAddress &rPos, const OUString &rExprNmsp1=OUString(), const OUString &rExprNmsp2=OUString(), formula::FormulaGrammar::Grammar eGrammar1=formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::Grammar eGrammar2=formula::FormulaGrammar::GRAM_DEFAULT)
 
 ScValidationData (ScValidationMode eMode, ScConditionMode eOper, const ScTokenArray *pArr1, const ScTokenArray *pArr2, ScDocument &rDocument, const ScAddress &rPos)
 
 ScValidationData (const ScValidationData &r)
 
 ScValidationData (ScDocument &rDocument, const ScValidationData &r)
 
virtual ~ScValidationData () override
 
ScValidationDataClone () const
 
ScValidationDataClone (ScDocument *pNew) const override
 
void ResetInput ()
 
void ResetError ()
 
void SetInput (const OUString &rTitle, const OUString &rMsg)
 
void SetError (const OUString &rTitle, const OUString &rMsg, ScValidErrorStyle eStyle)
 
bool GetInput (OUString &rTitle, OUString &rMsg) const
 
bool GetErrMsg (OUString &rTitle, OUString &rMsg, ScValidErrorStyle &rStyle) const
 
bool HasErrMsg () const
 
ScValidationMode GetDataMode () const
 
sal_Int16 GetListType () const
 
void SetListType (sal_Int16 nListType)
 
bool HasSelectionList () const
 Returns true, if the validation cell will show a selection list. More...
 
bool FillSelectionList (std::vector< ScTypedStrData > &rStrings, const ScAddress &rPos) const
 Tries to fill the passed collection with list validation entries. More...
 
bool IsDataValid (const OUString &rTest, const ScPatternAttr &rPattern, const ScAddress &rPos) const
 
bool IsDataValidCustom (const OUString &rTest, const ScPatternAttr &rPattern, const ScAddress &rPos, const CustomValidationPrivateAccess &) const
 
bool IsDataValid (ScRefCellValue &rCell, const ScAddress &rPos) const
 
bool isFormulaResultsValidatable (const OUString &rTest, const ScAddress &rPos, SvNumberFormatter *pFormatter, OUString &rStrResult, double &nVal, sal_uInt32 &nFormat, bool &bIsVal) const
 Test, if formula is valid. More...
 
bool DoError (weld::Window *pParent, const OUString &rInput, const ScAddress &rPos) const
 
void DoCalcError (ScFormulaCell *pCell) const
 
bool IsEmpty () const
 
sal_uInt32 GetKey () const
 
void SetKey (sal_uInt32 nNew)
 
bool EqualEntries (const ScValidationData &r) const
 
bool operator< (const ScValidationData &r) const
 
- Public Member Functions inherited from ScConditionEntry
 ScConditionEntry (ScConditionMode eOper, const OUString &rExpr1, const OUString &rExpr2, ScDocument &rDocument, const ScAddress &rPos, const OUString &rExprNmsp1, const OUString &rExprNmsp2, formula::FormulaGrammar::Grammar eGrammar1, formula::FormulaGrammar::Grammar eGrammar2, Type eType=Type::Condition)
 
 ScConditionEntry (ScConditionMode eOper, const ScTokenArray *pArr1, const ScTokenArray *pArr2, ScDocument &rDocument, const ScAddress &rPos)
 
 ScConditionEntry (const ScConditionEntry &r)
 
 ScConditionEntry (ScDocument &rDocument, const ScConditionEntry &r)
 
virtual ~ScConditionEntry () override
 
bool IsEqual (const ScFormatEntry &r, bool bIgnoreSrcPos) const override
 
virtual void SetParent (ScConditionalFormat *pNew) override
 
bool IsCellValid (ScRefCellValue &rCell, const ScAddress &rPos) const
 
ScConditionMode GetOperation () const
 
void SetOperation (ScConditionMode eMode)
 
bool IsIgnoreBlank () const
 
void SetIgnoreBlank (bool bSet)
 
const OUString & GetSrcString () const
 
const ScAddressGetSrcPos () const
 
ScAddress GetValidSrcPos () const
 Return a position that's adjusted to allow textual representation of expressions if possible. More...
 
void SetSrcString (const OUString &rNew)
 
void SetFormula1 (const ScTokenArray &rArray)
 
void SetFormula2 (const ScTokenArray &rArray)
 
OUString GetExpression (const ScAddress &rCursor, sal_uInt16 nPos, sal_uInt32 nNumFmt=0, const formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT) const
 
std::unique_ptr< ScTokenArrayCreateFlatCopiedTokenArray (sal_uInt16 nPos) const
 Create a flat copy using ScTokenArray copy-ctor with shared tokens. More...
 
void CompileAll ()
 Delete formula cells, so we re-compile at the next IsValid. More...
 
void CompileXML ()
 
virtual void UpdateReference (sc::RefUpdateContext &rCxt) override
 
virtual void UpdateInsertTab (sc::RefUpdateInsertTabContext &rCxt) override
 
virtual void UpdateDeleteTab (sc::RefUpdateDeleteTabContext &rCxt) override
 
virtual void UpdateMoveTab (sc::RefUpdateMoveTabContext &rCxt) override
 
bool MarkUsedExternalReferences () const
 
virtual Type GetType () const override
 
virtual ScFormatEntryClone (ScDocument *pDoc) const override
 
virtual void endRendering () override
 
virtual void startRendering () override
 
bool NeedsRepaint () const
 
void CalcAll ()
 
- Public Member Functions inherited from ScFormatEntry
 ScFormatEntry (ScDocument *pDoc)
 
virtual ~ScFormatEntry ()
 
virtual Type GetType () const =0
 
virtual void UpdateReference (sc::RefUpdateContext &rCxt)=0
 
virtual void UpdateInsertTab (sc::RefUpdateInsertTabContext &rCxt)=0
 
virtual void UpdateDeleteTab (sc::RefUpdateDeleteTabContext &rCxt)=0
 
virtual void UpdateMoveTab (sc::RefUpdateMoveTabContext &rCxt)=0
 
virtual ScFormatEntryClone (ScDocument *pDoc) const =0
 
virtual void SetParent (ScConditionalFormat *pNew)=0
 
bool operator== (const ScFormatEntry &) const
 
virtual bool IsEqual (const ScFormatEntry &, bool bIgnoreSrcPos) const
 
virtual void startRendering ()
 
virtual void endRendering ()
 
virtual void updateValues ()
 

Private Member Functions

bool DoMacro (const ScAddress &rPos, const OUString &rInput, ScFormulaCell *pCell, weld::Window *pParent) const
 
bool DoScript (const ScAddress &rPos, const OUString &rInput, ScFormulaCell *pCell, weld::Window *pParent) const
 
 DECL_STATIC_LINK (ScValidationData, InstallLOKNotifierHdl, void *, vcl::ILibreOfficeKitNotifier *)
 
bool GetSelectionFromFormula (std::vector< ScTypedStrData > *pStrings, ScRefCellValue &rCell, const ScAddress &rPos, const ScTokenArray &rTokArr, int &rMatch) const
 Tries to fill the passed collection with list validation entries. More...
 
bool IsEqualToTokenArray (ScRefCellValue &rCell, const ScAddress &rPos, const ScTokenArray &rTokArr) const
 Tests, if pCell is equal to what the passed token array represents. More...
 
bool IsListValid (ScRefCellValue &rCell, const ScAddress &rPos) const
 Tests, if contents of pCell occur in cell range referenced by own formula, or in a string list. More...
 
bool IsDataValidTextLen (std::u16string_view rTest, const ScAddress &rPos, ScValidationDataIsNumeric *pDataNumeric) const
 Tests, if string or numeric data has valid text length. More...
 

Private Attributes

sal_uInt32 nKey
 
ScValidationMode eDataMode
 
bool bShowInput
 
bool bShowError
 
ScValidErrorStyle eErrorStyle
 
sal_Int16 mnListType
 
OUString aInputTitle
 
OUString aInputMessage
 
OUString aErrorTitle
 
OUString aErrorMessage
 

Additional Inherited Members

- Public Types inherited from ScFormatEntry
enum class  Type {
  Condition ,
  ExtCondition ,
  Colorscale ,
  Databar ,
  Iconset ,
  Date
}
 
- Static Public Member Functions inherited from ScConditionEntry
static ScConditionMode GetModeFromApi (css::sheet::ConditionOperator nOperator)
 
- Protected Member Functions inherited from ScConditionEntry
virtual void DataChanged () const
 
ScDocumentGetDocument () const
 
- Protected Attributes inherited from ScConditionEntry
ScConditionalFormatpCondFormat
 
- Protected Attributes inherited from ScFormatEntry
ScDocumentmpDoc
 

Detailed Description

Definition at line 62 of file validat.hxx.

Constructor & Destructor Documentation

◆ ScValidationData() [1/4]

ScValidationData::ScValidationData ( ScValidationMode  eMode,
ScConditionMode  eOper,
const OUString &  rExpr1,
const OUString &  rExpr2,
ScDocument rDocument,
const ScAddress rPos,
const OUString &  rExprNmsp1 = OUString(),
const OUString &  rExprNmsp2 = OUString(),
formula::FormulaGrammar::Grammar  eGrammar1 = formula::FormulaGrammar::GRAM_DEFAULT,
formula::FormulaGrammar::Grammar  eGrammar2 = formula::FormulaGrammar::GRAM_DEFAULT 
)

Definition at line 63 of file validat.cxx.

References eMode.

◆ ScValidationData() [2/4]

ScValidationData::ScValidationData ( ScValidationMode  eMode,
ScConditionMode  eOper,
const ScTokenArray pArr1,
const ScTokenArray pArr2,
ScDocument rDocument,
const ScAddress rPos 
)

Definition at line 80 of file validat.cxx.

References eMode.

◆ ScValidationData() [3/4]

ScValidationData::ScValidationData ( const ScValidationData r)

Definition at line 93 of file validat.cxx.

◆ ScValidationData() [4/4]

ScValidationData::ScValidationData ( ScDocument rDocument,
const ScValidationData r 
)

Definition at line 109 of file validat.cxx.

◆ ~ScValidationData()

ScValidationData::~ScValidationData ( )
overridevirtual

Definition at line 125 of file validat.cxx.

Member Function Documentation

◆ Clone() [1/2]

ScValidationData * ScValidationData::Clone ( ) const
inline

Definition at line 101 of file validat.hxx.

References ScConditionEntry::GetDocument().

Referenced by ScDocument::AddValidationEntry().

◆ Clone() [2/2]

ScValidationData * ScValidationData::Clone ( ScDocument pNew) const
inlineoverridevirtual

Reimplemented from ScConditionEntry.

Definition at line 103 of file validat.hxx.

◆ DECL_STATIC_LINK()

ScValidationData::DECL_STATIC_LINK ( ScValidationData  ,
InstallLOKNotifierHdl  ,
void *  ,
vcl::ILibreOfficeKitNotifier  
)
private

◆ DoCalcError()

void ScValidationData::DoCalcError ( ScFormulaCell pCell) const

Definition at line 364 of file validat.cxx.

References ScFormulaCell::aPos, DoMacro(), eErrorStyle, and SC_VALERR_MACRO.

◆ DoError()

bool ScValidationData::DoError ( weld::Window pParent,
const OUString &  rInput,
const ScAddress rPos 
) const

◆ DoMacro()

bool ScValidationData::DoMacro ( const ScAddress rPos,
const OUString &  rInput,
ScFormulaCell pCell,
weld::Window pParent 
) const
private

◆ DoScript()

bool ScValidationData::DoScript ( const ScAddress rPos,
const OUString &  rInput,
ScFormulaCell pCell,
weld::Window pParent 
) const
private

◆ EqualEntries()

bool ScValidationData::EqualEntries ( const ScValidationData r) const

◆ FillSelectionList()

bool ScValidationData::FillSelectionList ( std::vector< ScTypedStrData > &  rStrings,
const ScAddress rPos 
) const

Tries to fill the passed collection with list validation entries.

@descr Fills the list only, if this is a list validation and IsShowList() is enabled.

Parameters
rStrings(out-param) The string list to fill with list validation entries.
Returns
true = rStrings has been filled with at least one entry.

Definition at line 997 of file validat.cxx.

References aStr, ScConditionEntry::CreateFlatCopiedTokenArray(), ScConditionEntry::GetDocument(), ScDocument::GetFormatTable(), GetSelectionFromFormula(), HasSelectionList(), SvNumberFormatter::IsNumberFormat(), ScTypedStrData::Standard, and ScTypedStrData::Value.

◆ GetDataMode()

ScValidationMode ScValidationData::GetDataMode ( ) const
inline

Definition at line 118 of file validat.hxx.

Referenced by ScCellShell::ExecuteDB(), and IsDataValidCustom().

◆ GetErrMsg()

bool ScValidationData::GetErrMsg ( OUString &  rTitle,
OUString &  rMsg,
ScValidErrorStyle rStyle 
) const

Definition at line 177 of file validat.cxx.

References aErrorMessage, aErrorTitle, bShowError, and eErrorStyle.

Referenced by ScCellShell::ExecuteDB().

◆ GetInput()

bool ScValidationData::GetInput ( OUString &  rTitle,
OUString &  rMsg 
) const
inline

Definition at line 112 of file validat.hxx.

Referenced by ScCellShell::ExecuteDB().

◆ GetKey()

sal_uInt32 ScValidationData::GetKey ( ) const
inline

Definition at line 168 of file validat.hxx.

◆ GetListType()

sal_Int16 ScValidationData::GetListType ( ) const
inline

Definition at line 120 of file validat.hxx.

Referenced by ScCellShell::ExecuteDB().

◆ GetSelectionFromFormula()

bool ScValidationData::GetSelectionFromFormula ( std::vector< ScTypedStrData > *  pStrings,
ScRefCellValue rCell,
const ScAddress rPos,
const ScTokenArray rTokArr,
int rMatch 
) const
private

Tries to fill the passed collection with list validation entries.

@descr Fills the list only if it is non-NULL,

Parameters
pStrings(out-param) Optionally NULL, string list to fill with list validation entries.
pCellcan be NULL if it is not necessary to which element in the list is selected.
rPosthe base address for relative references.
rTokArrFormula token array.
rMatch(out-param) the index of the first item that matched, -1 if nothing matched.
Returns
true = Cell range found, rRange is valid, or an error entry stuffed into the list if pCell==NULL.

Definition at line 804 of file validat.cxx.

References formula::FormulaTokenArray::AddDouble(), formula::FormulaTokenArray::AddString(), ScRange::aStart, aStr, ScAddress::Col(), ScDBCollection::NamedDBs::findByIndex(), ScDocument::FindRangeNameBySheetAndIndex(), Formula, ScMatrixValue::fVal, ScDocument::GetDBCollection(), ScConditionEntry::GetDocument(), ScFormulaCell::GetErrCode(), ScMatrixValue::GetError(), ScGlobal::GetErrorString(), ScDocument::GetFormatTable(), SvNumberFormatter::GetInputLineString(), ScDocument::GetInputString(), formula::FormulaTokenArray::GetLen(), ScFormulaCell::GetMatrix(), ScDBCollection::getNamedDBs(), formula::FormulaTokenArrayPlainIterator::GetNextReferenceOrName(), ScDocument::GetNumberFormat(), ScDocument::GetSharedStringPool(), ScFormulaCell::GetString(), svl::SharedString::getString(), ScMatrixValue::GetString(), ScFormulaCell::GetValue(), formula::FormulaGrammar::GRAM_DEFAULT, svl::SharedStringPool::intern(), ScFormulaCell::Interpret(), ScRefCellValue::isEmpty(), IsEqualToTokenArray(), ScMatrix::IsNonValueType(), ScTokenArray::IsValidReference(), ScFormulaCell::IsValue(), n, ScMatrixValue::nType, ocDBArea, ocName, ocTableRef, pName, pValues, ScAddress::Row(), ScTypedStrData::Standard, svIndex, t, ScAddress::Tab(), and ScTypedStrData::Value.

Referenced by FillSelectionList(), and IsListValid().

◆ HasErrMsg()

bool ScValidationData::HasErrMsg ( ) const
inline

Definition at line 116 of file validat.hxx.

◆ HasSelectionList()

bool ScValidationData::HasSelectionList ( ) const

Returns true, if the validation cell will show a selection list.

@descr Use this instead of GetListType() which returns the raw property regardless of the validation type.

Definition at line 799 of file validat.cxx.

References eDataMode, mnListType, and SC_VALID_LIST.

Referenced by FillSelectionList().

◆ IsDataValid() [1/2]

bool ScValidationData::IsDataValid ( const OUString &  rTest,
const ScPatternAttr rPattern,
const ScAddress rPos 
) const

◆ IsDataValid() [2/2]

bool ScValidationData::IsDataValid ( ScRefCellValue rCell,
const ScAddress rPos 
) const

◆ IsDataValidCustom()

bool ScValidationData::IsDataValidCustom ( const OUString &  rTest,
const ScPatternAttr rPattern,
const ScAddress rPos,
const CustomValidationPrivateAccess  
) const

◆ IsDataValidTextLen()

bool ScValidationData::IsDataValidTextLen ( std::u16string_view  rTest,
const ScAddress rPos,
ScValidationDataIsNumeric pDataNumeric 
) const
private

Tests, if string or numeric data has valid text length.

Parameters
pDataNumericnullptr if string data to be tested, else for numeric data a properly initialized ScValidationDataIsNumeric struct, see implementation.

Definition at line 512 of file validat.cxx.

References aStr, ScConditionEntry::GetDocument(), SvNumberFormatter::GetInputLineString(), ScValidationDataIsNumeric::init(), ScConditionEntry::IsCellValid(), ScValidationDataIsNumeric::mfVal, ScValidationDataIsNumeric::mnFormat, and ScValidationDataIsNumeric::mpFormatter.

Referenced by IsDataValid().

◆ IsEmpty()

bool ScValidationData::IsEmpty ( ) const

◆ IsEqualToTokenArray()

bool ScValidationData::IsEqualToTokenArray ( ScRefCellValue rCell,
const ScAddress rPos,
const ScTokenArray rTokArr 
) const
private

Tests, if pCell is equal to what the passed token array represents.

Definition at line 1033 of file validat.cxx.

References Equal, ScConditionEntry::GetDocument(), and ScConditionEntry::IsCellValid().

Referenced by GetSelectionFromFormula(), and IsListValid().

◆ isFormulaResultsValidatable()

bool ScValidationData::isFormulaResultsValidatable ( const OUString &  rTest,
const ScAddress rPos,
SvNumberFormatter pFormatter,
OUString &  rStrResult,
double &  nVal,
sal_uInt32 &  nFormat,
bool &  bIsVal 
) const

◆ IsListValid()

bool ScValidationData::IsListValid ( ScRefCellValue rCell,
const ScAddress rPos 
) const
private

◆ operator<()

bool ScValidationData::operator< ( const ScValidationData r) const
inline

Definition at line 174 of file validat.hxx.

References nKey.

◆ ResetError()

void ScValidationData::ResetError ( )

◆ ResetInput()

void ScValidationData::ResetInput ( )

◆ SetError()

void ScValidationData::SetError ( const OUString &  rTitle,
const OUString &  rMsg,
ScValidErrorStyle  eStyle 
)

◆ SetInput()

void ScValidationData::SetInput ( const OUString &  rTitle,
const OUString &  rMsg 
)

◆ SetKey()

void ScValidationData::SetKey ( sal_uInt32  nNew)
inline

Definition at line 169 of file validat.hxx.

◆ SetListType()

void ScValidationData::SetListType ( sal_Int16  nListType)
inline

Member Data Documentation

◆ aErrorMessage

OUString ScValidationData::aErrorMessage
private

Definition at line 75 of file validat.hxx.

Referenced by DoError(), EqualEntries(), GetErrMsg(), and SetError().

◆ aErrorTitle

OUString ScValidationData::aErrorTitle
private

Definition at line 74 of file validat.hxx.

Referenced by DoError(), DoMacro(), DoScript(), EqualEntries(), GetErrMsg(), and SetError().

◆ aInputMessage

OUString ScValidationData::aInputMessage
private

Definition at line 73 of file validat.hxx.

Referenced by EqualEntries(), and SetInput().

◆ aInputTitle

OUString ScValidationData::aInputTitle
private

Definition at line 72 of file validat.hxx.

Referenced by EqualEntries(), and SetInput().

◆ bShowError

bool ScValidationData::bShowError
private

Definition at line 69 of file validat.hxx.

Referenced by EqualEntries(), GetErrMsg(), ResetError(), and SetError().

◆ bShowInput

bool ScValidationData::bShowInput
private

Definition at line 68 of file validat.hxx.

Referenced by EqualEntries(), ResetInput(), and SetInput().

◆ eDataMode

ScValidationMode ScValidationData::eDataMode
private

Definition at line 67 of file validat.hxx.

Referenced by EqualEntries(), HasSelectionList(), and IsDataValid().

◆ eErrorStyle

ScValidErrorStyle ScValidationData::eErrorStyle
private

Definition at line 70 of file validat.hxx.

Referenced by DoCalcError(), DoError(), EqualEntries(), GetErrMsg(), and SetError().

◆ mnListType

sal_Int16 ScValidationData::mnListType
private

Definition at line 71 of file validat.hxx.

Referenced by EqualEntries(), and HasSelectionList().

◆ nKey

sal_uInt32 ScValidationData::nKey
private

Definition at line 65 of file validat.hxx.

Referenced by operator<().


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