[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 12 16:26:46 UTC 2018


 xmloff/source/forms/elementexport.cxx  |    2 +-
 xmloff/source/forms/propertyexport.cxx |    4 ++--
 xmloff/source/forms/propertyexport.hxx |    3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 6585ccbae80cb8f825cc657ad42f30644d9a4b38
Author:     Lionel Elie Mamane <lionel at mamane.lu>
AuthorDate: Wed Dec 5 17:17:21 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Dec 12 17:26:23 2018 +0100

    address forward incompatibility of InputRequired default change
    
    commit fec8c14e960fbcd639a04d6c3354caff2d0bd365 changed the default value
    of InputRequired as read from the file; that is the value InputRequired
    has when it is set to neither false nor true in the file
    
    This is to mitigate the fact that InputRequired was not property
    enforced and now suddenly is, but its default value was "true"! So
    lots of past forms have InputRequired==true everywhere, users did not
    pay attention to it because it was not enforced, and now it is
    enforced, which suddenly is a huge PITA for users because they have to
    update most controls in all forms. Since older versions of LibreOffice
    omitted the input-required attribute in the file (the XML stream) when
    it had its then-default value (namely "true"), we changed that to now
    mean "false". As a side-effect, newer LibreOffice omits the attribute
    in the XML stream when InputRequired has its new default value, namely
    "false".
    
    So the situation is that any file saved with an older LibreOffice will
    have all its form controls with InputRequired==false when opened with
    a newer LibreOffice, and any file saved with a newer LibreOffice will
    have all its form controls with InputRequired==true when opened with
    an older LibreOffice.
    
    This commit makes LibreOffice always write the XML attribute. So that
    any file saved with a newer LibreOffice will have the same
    InputRequired values when opened in an older LibreOffice.
    
    This enhances forward compatibility, because InputRequired was
    enforced in older versions when the underlying database field was
    marked NOT NULL. So the current situation leads to unwanted
    enforcement in older LibreOffice versions, with a file that is saved
    from newer LibreOffice with a control having InputRequired==false and
    bound to a database field marked NOT NULL. This commit fixes that, by
    ensuring that any form control with InputRequired==false in newer
    LibreOffice will also have InputRequired==false in older LibreOffice.
    
    Change-Id: I92ef48ad99c4e2ead43e95376282cc861c181ab3
    Reviewed-on: https://gerrit.libreoffice.org/64641
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    Tested-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 4bf3e1c2c205..1acb6cc40a3a 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -837,7 +837,7 @@ namespace xmloff
                 OAttributeMetaData::getDatabaseAttributeNamespace(),
                 OAttributeMetaData::getDatabaseAttributeName( DAFlags::InputRequired ),
                 PROPERTY_INPUT_REQUIRED,
-                BoolAttrFlags::DefaultFalse
+                BoolAttrFlags::DefaultFalse | BoolAttrFlags::DefaultVoid
             );
             RESET_BIT( nIncludeDatabase, DAFlags::InputRequired );
         }
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx
index 4fbf337600d4..3c6711bc1555 100644
--- a/xmloff/source/forms/propertyexport.cxx
+++ b/xmloff/source/forms/propertyexport.cxx
@@ -269,8 +269,8 @@ namespace xmloff
         // no check of the property value type: this method is allowed to be called with any integer properties
         // (e.g. sal_Int32, sal_uInt16 etc)
 
-        bool bDefault = (BoolAttrFlags::DefaultTrue == (BoolAttrFlags::DefaultMask & _nBooleanAttributeFlags));
-        bool bDefaultVoid = (BoolAttrFlags::DefaultVoid == (BoolAttrFlags::DefaultMask & _nBooleanAttributeFlags));
+        bool bDefault     = (BoolAttrFlags::DefaultTrue == (BoolAttrFlags::DefaultValueMask & _nBooleanAttributeFlags));
+        bool bDefaultVoid = (BoolAttrFlags::DefaultVoid == (BoolAttrFlags::DefaultVoidMask  & _nBooleanAttributeFlags));
 
         // get the value
         bool bCurrentValue = bDefault;
diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx
index 2d940bf392df..a6f701a428fc 100644
--- a/xmloff/source/forms/propertyexport.hxx
+++ b/xmloff/source/forms/propertyexport.hxx
@@ -35,7 +35,8 @@ enum class BoolAttrFlags {
     DefaultFalse          = 0x00,
     DefaultTrue           = 0x01,
     DefaultVoid           = 0x02,
-    DefaultMask           = 0x03,
+    DefaultValueMask      = 0x01,
+    DefaultVoidMask       = 0x02,
     InverseSemantics      = 0x04,
 };
 namespace o3tl {


More information about the Libreoffice-commits mailing list