23#include <osl/diagnose.h>
27#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
28#include <com/sun/star/sheet/ConditionOperator2.hpp>
29#include <com/sun/star/sheet/ValidationAlertStyle.hpp>
30#include <com/sun/star/sheet/ValidationType.hpp>
31#include <com/sun/star/sheet/TableValidationVisibility.hpp>
36#include <document.hxx>
37#include <unonames.hxx>
38#include <tokenarray.hxx>
62 return aValidatePropertyMap_Impl;
94 sheet::ConditionOperator eOper = sheet::ConditionOperator_NONE;
137 meGrammar1( FormulaGrammar::GRAM_UNSPECIFIED ),
138 meGrammar2( FormulaGrammar::GRAM_UNSPECIFIED ),
148 if ( !(pDoc && nKey) )
163 size_t nEntryCount = pFormat->
size();
164 for (
size_t i=0;
i<nEntryCount;
i++)
186FormulaGrammar::Grammar lclResolveGrammar( FormulaGrammar::Grammar eExtGrammar, FormulaGrammar::Grammar eIntGrammar )
188 if( eExtGrammar != FormulaGrammar::GRAM_UNSPECIFIED )
190 OSL_ENSURE( eIntGrammar != FormulaGrammar::GRAM_UNSPECIFIED,
"lclResolveGrammar - unspecified grammar, using GRAM_API" );
191 return (eIntGrammar == FormulaGrammar::GRAM_UNSPECIFIED) ? FormulaGrammar::GRAM_API : eIntGrammar;
197 ScDocument& rDoc, FormulaGrammar::Grammar eGrammar)
const
201 OSL_ENSURE( rFormat.
IsEmpty(),
"FillFormat: format not empty" );
208 FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar,
aData.meGrammar1 );
209 FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar,
aData.meGrammar2 );
214 if ( !
aData.maPosStr.isEmpty() )
217 if (
aData.maTokens1.hasElements() )
224 if (
aData.maTokens2.hasElements() )
252 const uno::Sequence<beans::PropertyValue >& aConditionalEntry )
258 for (
const beans::PropertyValue& rProp : aConditionalEntry)
268 uno::Sequence<sheet::FormulaToken> aTokens;
269 if ( rProp.Value >>= aStrVal )
271 else if ( rProp.Value >>= aTokens )
280 uno::Sequence<sheet::FormulaToken> aTokens;
281 if ( rProp.Value >>= aStrVal )
283 else if ( rProp.Value >>= aTokens )
291 table::CellAddress aAddress;
292 if ( rProp.Value >>= aAddress )
298 if ( rProp.Value >>= aStrVal )
304 if ( rProp.Value >>= aStrVal )
306 aStrVal, SfxStyleFamily::Para );
311 if ( rProp.Value >>= aStrVal )
317 if ( rProp.Value >>= aStrVal )
323 if ( rProp.Value >>= nVal )
324 aEntry.
meGrammar1 =
static_cast< FormulaGrammar::Grammar
>( nVal );
329 if ( rProp.Value >>= nVal )
330 aEntry.
meGrammar2 =
static_cast< FormulaGrammar::Grammar
>( nVal );
334 OSL_FAIL(
"wrong property");
363 return new ScIndexEnumeration(
this,
"com.sun.star.sheet.TableConditionalEntryEnumeration");
379 throw lang::IndexOutOfBoundsException();
400 OUString aRet =
"Entry" + OUString::number(
nIndex );
408 uno::Reference<sheet::XSheetConditionalEntry> xEntry;
418 throw container::NoSuchElementException();
428 uno::Sequence<OUString> aNames(
nCount);
429 OUString* pArray = aNames.getArray();
516 table::CellAddress aRet;
526 aData.
maPos.
Set(
static_cast<SCCOL>(aSourcePosition.Column),
static_cast<SCROW>(aSourcePosition.Row), aSourcePosition.Sheet );
560 nValMode = sal::static_int_cast<sal_uInt16>(
pData->GetDataMode() );
566 nErrorStyle = sal::static_int_cast<sal_uInt16>( eStyle );
573 pData->MarkUsedExternalReferences();
587 FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar,
meGrammar1 );
588 FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar,
meGrammar2 );
594 eGrammar1, eGrammar2 );
631 nShowList = sheet::TableValidationVisibility::UNSORTED;
704 table::CellAddress aRet;
714 aSrcPos.
Set(
static_cast<SCCOL>(aSourcePosition.Column),
static_cast<SCROW>(aSourcePosition.Row), aSourcePosition.Sheet );
721 throw lang::IndexOutOfBoundsException();
730 throw lang::IndexOutOfBoundsException();
752 static uno::Reference<beans::XPropertySetInfo> aRef(
758 const OUString& aPropertyName,
const uno::Any& aValue )
769 if ( aValue >>= aStrVal )
775 if ( aValue >>= aStrVal )
781 if ( aValue >>= aStrVal )
787 if ( aValue >>= aStrVal )
829 if ( aValue >>= aStrVal )
837 if ( aValue >>= aStrVal )
845 if ( aValue >>= aStrVal )
853 if ( aValue >>= nVal )
854 meGrammar1 =
static_cast< FormulaGrammar::Grammar
>(nVal);
861 if ( aValue >>= nVal )
862 meGrammar2 =
static_cast< FormulaGrammar::Grammar
>(nVal);
881 sheet::ValidationType
eType = sheet::ValidationType_ANY;
897 sheet::ValidationAlertStyle eStyle = sheet::ValidationAlertStyle_STOP;
900 case SC_VALERR_STOP: eStyle = sheet::ValidationAlertStyle_STOP;
break;
902 case SC_VALERR_INFO: eStyle = sheet::ValidationAlertStyle_INFO;
break;
903 case SC_VALERR_MACRO: eStyle = sheet::ValidationAlertStyle_MACRO;
break;
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
const OUString & GetStyle() const
ScAddress GetValidSrcPos() const
Return a position that's adjusted to allow textual representation of expressions if possible.
void SetIgnoreBlank(bool bSet)
void SetFormula1(const ScTokenArray &rArray)
static ScConditionMode GetModeFromApi(css::sheet::ConditionOperator nOperator)
ScConditionMode GetOperation() const
void SetFormula2(const ScTokenArray &rArray)
void SetSrcString(const OUString &rNew)
OUString GetExpression(const ScAddress &rCursor, sal_uInt16 nPos, sal_uInt32 nNumFmt=0, const formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT) const
SC_DLLPUBLIC const ScValidationData * GetValidationEntry(sal_uInt32 nIndex) const
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
bool IsInExternalReferenceMarking() const
virtual Type GetType() const =0
static SC_DLLPUBLIC OUString ProgrammaticToDisplayName(const OUString &rProgName, SfxStyleFamily nType)
static OUString DisplayToProgrammaticName(const OUString &rDispName, SfxStyleFamily nType)
virtual sal_Int32 SAL_CALL getConditionOperator() override
virtual void SAL_CALL setStyleName(const OUString &aStyleName) override
ScCondFormatEntryItem aData
virtual void SAL_CALL setSourcePosition(const css::table::CellAddress &aSourcePosition) override
virtual OUString SAL_CALL getFormula1() override
virtual ~ScTableConditionalEntry() override
virtual void SAL_CALL setOperator(css::sheet::ConditionOperator nOperator) override
virtual void SAL_CALL setFormula1(const OUString &aFormula1) override
virtual void SAL_CALL setFormula2(const OUString &aFormula2) override
virtual void SAL_CALL setConditionOperator(sal_Int32 nOperator) override
virtual OUString SAL_CALL getFormula2() override
virtual OUString SAL_CALL getStyleName() override
virtual css::table::CellAddress SAL_CALL getSourcePosition() override
virtual css::sheet::ConditionOperator SAL_CALL getOperator() override
ScTableConditionalEntry()=delete
void GetData(ScCondFormatEntryItem &rData) const
ScValidationData * CreateValidationData(ScDocument &rDoc, formula::FormulaGrammar::Grammar eGrammar) const
virtual css::sheet::ConditionOperator SAL_CALL getOperator() override
virtual void SAL_CALL setTokens(sal_Int32 nIndex, const css::uno::Sequence< css::sheet::FormulaToken > &aTokens) override
ScTableValidationObj()=delete
virtual void SAL_CALL setFormula1(const OUString &aFormula1) override
virtual sal_Int32 SAL_CALL getConditionOperator() override
formula::FormulaGrammar::Grammar meGrammar1
virtual void SAL_CALL setSourcePosition(const css::table::CellAddress &aSourcePosition) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual sal_Int32 SAL_CALL getCount() override
virtual ~ScTableValidationObj() override
virtual css::table::CellAddress SAL_CALL getSourcePosition() override
css::uno::Sequence< css::sheet::FormulaToken > aTokens1
virtual OUString SAL_CALL getFormula1() override
virtual OUString SAL_CALL getFormula2() override
virtual void SAL_CALL setConditionOperator(sal_Int32 nOperator) override
css::uno::Sequence< css::sheet::FormulaToken > aTokens2
virtual void SAL_CALL setFormula2(const OUString &aFormula2) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getTokens(sal_Int32 nIndex) override
formula::FormulaGrammar::Grammar meGrammar2
virtual void SAL_CALL setOperator(css::sheet::ConditionOperator nOperator) override
SfxItemPropertySet aPropSet
static SC_DLLPUBLIC bool ConvertToTokenArray(ScDocument &rDoc, ScTokenArray &rTokenArray, const css::uno::Sequence< css::sheet::FormulaToken > &rSequence)
static sal_Int32 GetEnumFromAny(const css::uno::Any &aAny)
static bool GetBoolFromAny(const css::uno::Any &aAny)
void SetListType(sal_Int16 nListType)
void SetInput(const OUString &rTitle, const OUString &rMsg)
void SetError(const OUString &rTitle, const OUString &rMsg, ScValidErrorStyle eStyle)
const SfxItemPropertyMap & getPropertyMap() const
css::uno::Type const & get()
static sheet::ConditionOperator lcl_ConditionModeToOperator(ScConditionMode eMode)
static o3tl::span< const SfxItemPropertyMapEntry > lcl_GetValidatePropertyMap()
static ScConditionMode lcl_ConditionOperatorToMode(sheet::ConditionOperator eOper)
static OUString lcl_GetEntryNameFromIndex(sal_Int32 nIndex)
static sal_Int32 lcl_ConditionModeToOperatorNew(ScConditionMode eMode)
std::unique_ptr< sal_Int32[]> pData
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
constexpr OUStringLiteral aData
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
formula::FormulaGrammar::Grammar meGrammar2
css::uno::Sequence< css::sheet::FormulaToken > maTokens2
css::uno::Sequence< css::sheet::FormulaToken > maTokens1
formula::FormulaGrammar::Grammar meGrammar1
constexpr OUStringLiteral SC_UNONAME_FORMULANMSP1
constexpr OUStringLiteral SC_UNONAME_STYLENAME
constexpr OUStringLiteral SC_UNONAME_FORMULA1
constexpr OUStringLiteral SC_UNONAME_FORMULA2
constexpr OUStringLiteral SC_UNONAME_SHOWINP
constexpr OUStringLiteral SC_UNONAME_SHOWERR
constexpr OUStringLiteral SC_UNONAME_IGNOREBL
constexpr OUStringLiteral SC_UNONAME_FORMULANMSP2
constexpr OUStringLiteral SC_UNONAME_SOURCESTR
constexpr OUStringLiteral SC_UNONAME_ERRALSTY
constexpr OUStringLiteral SC_UNONAME_TYPE
constexpr OUStringLiteral SC_UNONAME_GRAMMAR2
constexpr OUStringLiteral SC_UNONAME_OPERATOR
constexpr OUStringLiteral SC_UNONAME_INPMESS
constexpr OUStringLiteral SC_UNONAME_SOURCEPOS
constexpr OUStringLiteral SC_UNONAME_ERRTITLE
constexpr OUStringLiteral SC_UNONAME_ERRMESS
constexpr OUStringLiteral SC_UNONAME_SHOWLIST
constexpr OUStringLiteral SC_UNONAME_GRAMMAR1
constexpr OUStringLiteral SC_UNONAME_INPTITLE