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=EMPTY_OUSTRING, const OUString &rExprNmsp2=EMPTY_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 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 void endRendering () override
 
virtual void startRendering () override
 
bool NeedsRepaint () const
 
void CalcAll ()
 
- Public Member Functions inherited from ScFormatEntry
 ScFormatEntry (ScDocument *pDoc)
 
virtual ~ScFormatEntry ()
 
bool operator== (const ScFormatEntry &) const
 

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
 
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 (const OUString &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  Type {
  Type::Condition,
  Type::ExtCondition,
  Type::Colorscale,
  Type::Databar,
  Type::Iconset,
  Type::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 61 of file validat.hxx.

Constructor & Destructor Documentation

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

Definition at line 62 of file validat.cxx.

References sheet.

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

Definition at line 79 of file validat.cxx.

References sheet.

ScValidationData::ScValidationData ( const ScValidationData r)

Definition at line 92 of file validat.cxx.

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

Definition at line 108 of file validat.cxx.

ScValidationData::~ScValidationData ( )
overridevirtual

Definition at line 124 of file validat.cxx.

Member Function Documentation

ScValidationData* ScValidationData::Clone ( ) const
inline

Definition at line 98 of file validat.hxx.

References ScConditionEntry::GetDocument().

Referenced by ScDocument::AddValidationEntry().

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

Reimplemented from ScConditionEntry.

Definition at line 100 of file validat.hxx.

void ScValidationData::DoCalcError ( ScFormulaCell pCell) const
bool ScValidationData::DoError ( weld::Window pParent,
const OUString &  rInput,
const ScAddress rPos 
) const
bool ScValidationData::DoMacro ( const ScAddress rPos,
const OUString &  rInput,
ScFormulaCell pCell,
weld::Window pParent 
) const
private
bool ScValidationData::DoScript ( const ScAddress rPos,
const OUString &  rInput,
ScFormulaCell pCell,
weld::Window pParent 
) const
private
bool ScValidationData::EqualEntries ( const ScValidationData r) const
bool ScValidationData::FillSelectionList ( std::vector< ScTypedStrData > &  rStrings,
const ScAddress rPos 
) const

Tries to fill the passed collection with list validation entries.

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 908 of file validat.cxx.

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

Referenced by ScDocument::GetDataEntries().

ScValidationMode ScValidationData::GetDataMode ( ) const
inline
bool ScValidationData::GetErrMsg ( OUString &  rTitle,
OUString &  rMsg,
ScValidErrorStyle rStyle 
) const
bool ScValidationData::GetInput ( OUString &  rTitle,
OUString &  rMsg 
) const
inline
sal_uInt32 ScValidationData::GetKey ( ) const
inline

Definition at line 161 of file validat.hxx.

Referenced by ScDocument::AddValidationEntry().

sal_Int16 ScValidationData::GetListType ( ) const
inline
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.

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 716 of file validat.cxx.

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

Referenced by FillSelectionList(), and IsListValid().

bool ScValidationData::HasErrMsg ( ) const
inline

Definition at line 113 of file validat.hxx.

Referenced by ScInputHandler::EnterHandler().

bool ScValidationData::HasSelectionList ( ) const

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

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

Definition at line 711 of file validat.cxx.

References eDataMode, mnListType, and SC_VALID_LIST.

Referenced by FillSelectionList(), ScDocument::HasSelectionData(), ScAccessibleCell::IsDropdown(), and ScTabView::TestHintWindow().

bool ScValidationData::IsDataValid ( const OUString &  rTest,
const ScPatternAttr rPattern,
const ScAddress rPos 
) const
bool ScValidationData::IsDataValid ( ScRefCellValue rCell,
const ScAddress rPos 
) const
bool ScValidationData::IsDataValidCustom ( const OUString &  rTest,
const ScPatternAttr rPattern,
const ScAddress rPos,
const CustomValidationPrivateAccess  
) const
bool ScValidationData::IsDataValidTextLen ( const OUString &  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 503 of file validat.cxx.

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

Referenced by IsDataValid().

bool ScValidationData::IsEmpty ( ) const
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 944 of file validat.cxx.

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

Referenced by GetSelectionFromFormula(), and IsListValid().

bool ScValidationData::IsListValid ( ScRefCellValue rCell,
const ScAddress rPos 
) const
private
bool ScValidationData::operator< ( const ScValidationData r) const
inline

Definition at line 167 of file validat.hxx.

References nKey.

void ScValidationData::ResetError ( )
void ScValidationData::ResetInput ( )
void ScValidationData::SetError ( const OUString &  rTitle,
const OUString &  rMsg,
ScValidErrorStyle  eStyle 
)
void ScValidationData::SetInput ( const OUString &  rTitle,
const OUString &  rMsg 
)
void ScValidationData::SetKey ( sal_uInt32  nNew)
inline

Definition at line 162 of file validat.hxx.

void ScValidationData::SetListType ( sal_Int16  nListType)
inline

Member Data Documentation

OUString ScValidationData::aErrorMessage
private

Definition at line 74 of file validat.hxx.

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

OUString ScValidationData::aErrorTitle
private

Definition at line 73 of file validat.hxx.

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

OUString ScValidationData::aInputMessage
private

Definition at line 72 of file validat.hxx.

Referenced by EqualEntries(), and SetInput().

OUString ScValidationData::aInputTitle
private

Definition at line 71 of file validat.hxx.

Referenced by EqualEntries(), and SetInput().

bool ScValidationData::bShowError
private

Definition at line 68 of file validat.hxx.

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

bool ScValidationData::bShowInput
private

Definition at line 67 of file validat.hxx.

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

ScValidationMode ScValidationData::eDataMode
private

Definition at line 66 of file validat.hxx.

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

ScValidErrorStyle ScValidationData::eErrorStyle
private

Definition at line 69 of file validat.hxx.

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

sal_Int16 ScValidationData::mnListType
private

Definition at line 70 of file validat.hxx.

Referenced by EqualEntries(), and HasSelectionList().

sal_uInt32 ScValidationData::nKey
private

Definition at line 64 of file validat.hxx.

Referenced by operator<().


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