Add remove validations
This commit is contained in:
parent
ff43f85594
commit
d81ccd943a
|
@ -180,16 +180,14 @@ class Border(IntEnum):
|
|||
class ValidationType():
|
||||
from com.sun.star.sheet.ValidationType \
|
||||
import ANY, WHOLE, DECIMAL, DATE, TIME, TEXT_LEN, LIST, CUSTOM
|
||||
class VT(ValidationType):
|
||||
pass
|
||||
VT = ValidationType
|
||||
|
||||
|
||||
# ~ https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1sheet.html#aecf58149730f4c8c5c18c70f3c7c5db7
|
||||
class ValidationAlertStyle():
|
||||
from com.sun.star.sheet.ValidationAlertStyle \
|
||||
import STOP, WARNING, INFO, MACRO
|
||||
class VAS(ValidationAlertStyle):
|
||||
pass
|
||||
VAS = ValidationAlertStyle
|
||||
|
||||
|
||||
# ~ https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1sheet_1_1ConditionOperator2.html
|
||||
|
@ -197,8 +195,7 @@ class ConditionOperator():
|
|||
from com.sun.star.sheet.ConditionOperator2 \
|
||||
import NONE, EQUAL, NOT_EQUAL, GREATER, GREATER_EQUAL, LESS, \
|
||||
LESS_EQUAL, BETWEEN, NOT_BETWEEN, FORMULA, DUPLICATE, NOT_DUPLICATE
|
||||
class CO(ConditionOperator):
|
||||
pass
|
||||
CO = ConditionOperator
|
||||
|
||||
|
||||
OS = platform.system()
|
||||
|
@ -2432,15 +2429,19 @@ class LOCalcRange(object):
|
|||
return self.obj.Validation
|
||||
@validation.setter
|
||||
def validation(self, values):
|
||||
is_list = False
|
||||
current = self.validation
|
||||
for k, v in values.items():
|
||||
if k == 'Type' and v == 6:
|
||||
is_list = True
|
||||
if k == 'Formula1' and is_list:
|
||||
if isinstance(v, (tuple, list)):
|
||||
v = ';'.join(['"{}"'.format(i) for i in v])
|
||||
setattr(current, k, v)
|
||||
if not values:
|
||||
current.Type = ValidationType.ANY
|
||||
current.ShowInputMessage = False
|
||||
else:
|
||||
is_list = False
|
||||
for k, v in values.items():
|
||||
if k == 'Type' and v == VT.LIST:
|
||||
is_list = True
|
||||
if k == 'Formula1' and is_list:
|
||||
if isinstance(v, (tuple, list)):
|
||||
v = ';'.join(['"{}"'.format(i) for i in v])
|
||||
setattr(current, k, v)
|
||||
self.obj.Validation = current
|
||||
|
||||
def select(self):
|
||||
|
|
Loading…
Reference in New Issue