[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - xmlscript/source

Serge Krot (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 27 14:37:36 UTC 2020


 xmlscript/source/xmldlg_imexp/imp_share.hxx        |    5 ++++-
 xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx |    8 ++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit bc3d663ac83c59ccc6850277e0a00a9ab4881724
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Wed Oct 21 13:39:01 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Oct 27 15:37:03 2020 +0100

    tdf#137652 fix XDL import: no more missing empty items for combobox
    
    Change-Id: I6837968ee7cc5e4b3bc9abd7e320f562c6ff0833
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104619
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104715
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
index 709bdf88c8ee..caed524c9a54 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -312,6 +312,7 @@ class MenuPopupElement
 {
     std::vector< OUString > _itemValues;
     std::vector< sal_Int16 > _itemSelected;
+    bool _allowEmptyItems;
 public:
     css::uno::Sequence< OUString > getItemValues();
     css::uno::Sequence< sal_Int16 > getSelectedItems();
@@ -324,9 +325,11 @@ public:
     MenuPopupElement(
         OUString const & rLocalName,
         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-        ElementBase * pParent, DialogImport * pImport )
+        ElementBase * pParent, DialogImport * pImport,
+        bool aAllowEmptyItems)
         : ElementBase( pImport->XMLNS_DIALOGS_UID,
                        rLocalName, xAttributes, pParent, pImport )
+        , _allowEmptyItems(aAllowEmptyItems)
         {}
 };
 
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index 640776592e58..f3ed895b0c24 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -1275,8 +1275,8 @@ Reference< xml::input::XElement > MenuPopupElement::startChildElement(
     else if ( rLocalName == "menuitem" )
     {
         OUString aValue( xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID,"value" ) );
-        SAL_WARN_IF( aValue.isEmpty(), "xmlscript.xmldlg", "### menuitem has no value?" );
-        if (!aValue.isEmpty())
+        SAL_WARN_IF( aValue.isEmpty() && !_allowEmptyItems, "xmlscript.xmldlg", "### menuitem has no value?" );
+        if ((!aValue.isEmpty()) || _allowEmptyItems)
         {
             _itemValues.push_back( aValue );
 
@@ -1331,7 +1331,7 @@ Reference< xml::input::XElement > MenuListElement::startChildElement(
     // menupopup
     else if ( rLocalName == "menupopup" )
     {
-        _popup = new MenuPopupElement( rLocalName, xAttributes, this, m_xImport.get() );
+        _popup = new MenuPopupElement( rLocalName, xAttributes, this, m_xImport.get(), false );
         return _popup;
     }
     else
@@ -1399,7 +1399,7 @@ Reference< xml::input::XElement > ComboBoxElement::startChildElement(
     // menupopup
     else if ( rLocalName == "menupopup" )
     {
-        _popup = new MenuPopupElement( rLocalName, xAttributes, this, m_xImport.get() );
+        _popup = new MenuPopupElement( rLocalName, xAttributes, this, m_xImport.get(), true );
         return _popup;
     }
     else


More information about the Libreoffice-commits mailing list