[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - forms/source xmloff/source

Lionel Elie Mamane lionel at mamane.lu
Fri Jun 28 05:56:47 PDT 2013


 forms/source/component/ListBox.cxx     |    5 +++++
 xmloff/source/forms/elementexport.cxx  |    3 ++-
 xmloff/source/forms/propertyexport.cxx |    4 ++--
 xmloff/source/forms/propertyexport.hxx |   11 ++++++++---
 4 files changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 60d4d5a4ec70186f64b12ebb485428e905283785
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Jun 27 17:14:16 2013 +0200

    fdo#66171 ListBox correctly save empty or zero BoundColumn
    
    Change-Id: I05fa923f962191081ea3318837d3e181c183b466
    Reviewed-on: https://gerrit.libreoffice.org/4590
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index c3aba8b..6b143c4 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -609,6 +609,11 @@ namespace frm
             _rxInStream >> nValue;
             m_aBoundColumn <<= nValue;
         }
+        else // the constructor initialises to 1, so if it is empty,
+             // we must explicitly set to empty
+        {
+            m_aBoundColumn = Any();
+        }
 
         if (nVersion > 2)
             readHelpTextCompatibly(_rxInStream);
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 818be04..2254cec 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -888,7 +888,8 @@ namespace xmloff
                 OAttributeMetaData::getDatabaseAttributeNamespace(DA_BOUND_COLUMN),
                 OAttributeMetaData::getDatabaseAttributeName(DA_BOUND_COLUMN),
                 PROPERTY_BOUNDCOLUMN,
-                0);
+                0,
+                true);
             RESET_BIT( nIncludeDatabase, DA_BOUND_COLUMN );
         }
 
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx
index 2af7199..83f0601 100644
--- a/xmloff/source/forms/propertyexport.cxx
+++ b/xmloff/source/forms/propertyexport.cxx
@@ -319,7 +319,7 @@ namespace xmloff
 
     //---------------------------------------------------------------------
     void OPropertyExport::exportInt16PropertyAttribute(const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName,
-        const ::rtl::OUString& _rPropertyName, const sal_Int16 _nDefault)
+        const ::rtl::OUString& _rPropertyName, const sal_Int16 _nDefault, bool force)
     {
         DBG_CHECK_PROPERTY( _rPropertyName, sal_Int16 );
 
@@ -328,7 +328,7 @@ namespace xmloff
         m_xProps->getPropertyValue( _rPropertyName ) >>= nCurrentValue;
 
         // add the attribute
-        if (_nDefault != nCurrentValue)
+        if (force || _nDefault != nCurrentValue)
         {
             // let the formatter of the export context build a string
             ::rtl::OUStringBuffer sBuffer;
diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx
index cab0764..191f55a 100644
--- a/xmloff/source/forms/propertyexport.hxx
+++ b/xmloff/source/forms/propertyexport.hxx
@@ -160,14 +160,19 @@ namespace xmloff
             @param _pPropertyName
                 the name of the property to ask the control for
             @param _nDefault
-                the default of the attribute. If the current property value equals this default, no
-                attribute is added.
+                the default of the attribute. See force parameter.
+            @param force
+                if true and the property is not set or does not contain a sal_Int16,
+                then _nDefault is written out.
+                if false and the current property value equals _nDefault,
+                then no attribute is added.
         */
         void exportInt16PropertyAttribute(
             const sal_uInt16 _nNamespaceKey,
             const sal_Char* _pAttributeName,
             const ::rtl::OUString& _rPropertyName,
-            const sal_Int16 _nDefault);
+            const sal_Int16 _nDefault,
+            const bool force = false);
 
         /** add an attribute which is represented by a sal_Int32 property to the export context
 


More information about the Libreoffice-commits mailing list