diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2018-02-01 12:28:54 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-05-31 19:08:23 +0200 |
commit | f15c4b0f3c2cdfa7a72c97301ff32cc1764c54da (patch) | |
tree | c617d896afc9b12095df05786e69e623793db574 /sc/source/filter/oox/worksheethelper.cxx | |
parent | ff7e2868d61f2958ec86fbd53bb3e2957ca3da39 (diff) |
tdf#96698 - calc: add support for custom validation (through a formula)
Now it is possible to select a `custom` validation in the validation
dialog: this type of validation let's the user to define a formula,
the cell content is valid when the formula is evaluted to true, and
not valid when evaluated to false.
The `cutom` validation is correctly saved and restored for ods
documents, and is correctly imported and exported to xlsx documents
This patch contains an adaptation of a preliminary work of Justin Luth
for importing custom validation from xlsx documents. Thanks Justin!
Change-Id: Idc26654ba69a6f73d1b208d63acdad4b880c776d
Reviewed-on: https://gerrit.libreoffice.org/49084
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/filter/oox/worksheethelper.cxx')
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 907e7b399753..f2f2d211030a 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/sheet/ConditionOperator2.hpp> #include <com/sun/star/sheet/TableValidationVisibility.hpp> #include <com/sun/star/sheet/ValidationType.hpp> #include <com/sun/star/sheet/ValidationAlertStyle.hpp> @@ -1124,7 +1125,10 @@ void WorksheetGlobals::finalizeValidationRanges() const { // condition operator Reference< XSheetCondition2 > xSheetCond( xValidation, UNO_QUERY_THROW ); - xSheetCond->setConditionOperator( CondFormatBuffer::convertToApiOperator( validation.mnOperator ) ); + if( eType == ValidationType_CUSTOM ) + xSheetCond->setConditionOperator( ConditionOperator2::FORMULA ); + else + xSheetCond->setConditionOperator( CondFormatBuffer::convertToApiOperator( validation.mnOperator ) ); // condition formulas Reference< XMultiFormulaTokens > xTokens( xValidation, UNO_QUERY_THROW ); |