Bugzilla – Attachment 134080 Details for
Bug 96698
Data => Validity => Custom (like Excel) is missing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
partial fix: custom formulas work as long as they don't reference the edited cell.
0001-tdf-96698-ScDataValidation-import-force-SC_COND_DIRE.patch (text/plain), 3.50 KB, created by
Justin L
on 2017-06-17 11:44:02 UTC
(
hide
)
Description:
partial fix: custom formulas work as long as they don't reference the edited cell.
Filename:
MIME Type:
Creator:
Justin L
Created:
2017-06-17 11:44:02 UTC
Size:
3.50 KB
patch
obsolete
>From 659a3c5c7d0da3aaa5c2bd920e9b98f4ab58c0cc Mon Sep 17 00:00:00 2001 >From: Justin Luth <justin_luth@sil.org> >Date: Sat, 17 Jun 2017 14:15:03 +0300 >Subject: [PATCH] tdf#96698 ScDataValidation import: force SC_COND_DIRECT for > _CUSTOM > >The default value for comparision is _BETWEEN. However, custom >rules are a formula, and thus the comparator should be ignored >and only a true or false from the formula is evaluated. In Calc, >formulas use comparison SC_COND_DIRECT. > >This is only a partial fix. It only works if the formula does not >reference the cell that is receiving data-entry. The formula >evaluates the edited cell using the existing value, and not the >one that is being entered. > >I think that is what this validat.cxx comment is trying to say: > // for Custom, it must be eOp == SC_COND_DIRECT > //TODO: the value must be in the document !!! >originally in 2000 initial import stated as > // fuer Custom muss eOp == SC_COND_DIRECT sein > //! der Wert muss im Dokument stehen !!!!!!!!!!!!!!!!!!!! > >So first, we need to setup a scenario where the data is written >to the cell, run the validation formula on that scenario, discard >the scenario, and then accept, or reject the entered change. >Or something like that. > >Change-Id: I39882ae84d67a7b05bf204fadadd4ebbc66a2d8c >--- > sc/source/filter/excel/xicontent.cxx | 6 ++++++ > sc/source/filter/oox/worksheethelper.cxx | 9 ++++++++- > 2 files changed, 14 insertions(+), 1 deletion(-) > >diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx >index 150820e..8b765f6 100644 >--- a/sc/source/filter/excel/xicontent.cxx >+++ b/sc/source/filter/excel/xicontent.cxx >@@ -880,6 +880,12 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm ) > // No valid validation found. Bail out. > return; > >+ if( eValMode == SC_VALID_CUSTOM ) >+ { >+ assert ( eCondMode == SC_COND_BETWEEN ); >+ eCondMode = SC_COND_DIRECT; >+ } >+ > // first range for base address for relative references > const ScRange& rScRange = *aScRanges.front(); // aScRanges is not empty > >diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx >index 9e8758c..3c3eceb 100644 >--- a/sc/source/filter/oox/worksheethelper.cxx >+++ b/sc/source/filter/oox/worksheethelper.cxx >@@ -26,6 +26,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> >@@ -1105,7 +1106,13 @@ void WorksheetGlobals::finalizeValidationRanges() const > { > // condition operator > Reference< XSheetCondition2 > xSheetCond( xValidation, UNO_QUERY_THROW ); >- xSheetCond->setConditionOperator( CondFormatBuffer::convertToApiOperator( aIt->mnOperator ) ); >+ if( eType == ValidationType_CUSTOM ) >+ { >+ assert (aIt->mnOperator == XML_between); // the default value is never changed right? >+ xSheetCond->setConditionOperator( ConditionOperator2::FORMULA ); >+ } >+ else >+ xSheetCond->setConditionOperator( CondFormatBuffer::convertToApiOperator( aIt->mnOperator ) ); > > // condition formulas > Reference< XMultiFormulaTokens > xTokens( xValidation, UNO_QUERY_THROW ); >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 96698
:
134044
| 134080