[Libreoffice-commits] core.git: sw/source

Joren De Cuyper jorendc at libreoffice.org
Sat May 9 12:52:07 PDT 2015


 sw/source/filter/ww8/docxattributeoutput.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 442701de0c110ca58ff41abe6bf7ec4496f8457d
Author: Joren De Cuyper <jorendc at libreoffice.org>
Date:   Sat May 9 18:56:40 2015 +0200

    Don't write empty value when exporting grab-bagged w:docPartUnique
    
    See http://dev-builds.libreoffice.org/crashtest/e658cb4d5ce49d3a3c6acc63155974b5ff8490c7/validation/docx/fdo33590-2.docx.log
    
    (footer1.xml:2 col:890) cvc-datatype-valid.1.2.1: '' is not a valid value for 'boolean'.
    (footer1.xml:2 col:890) cvc-attribute.3: The value '' of attribute 'w:val' on
    element 'w:docPartUnique' is not valid with respect to its type, 'ST_OnOff'.
    
    Original document:
          <w:docPartObj>
            <w:docPartGallery w:val="Page Numbers (Bottom of Page)"/>
            <w:docPartUnique/>
          </w:docPartObj>
    
    RT document:
          <w:docPartObj>
            <w:docPartGallery w:val="Page Numbers (Bottom of Page)"/>
            <w:docPartUnique w:val=""/>
          </w:docPartObj>
    
    Change-Id: If41af8f4bca99fba4d3ad0c966c2345f87ea422a
    solution: if value is empty, export it as true (default ST-OnOff value)
    Reviewed-on: https://gerrit.libreoffice.org/15686
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index bc5d40f..abd7557 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8004,7 +8004,12 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem)
                                            FSNS( XML_w, XML_docPartCategory ),
                                            OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ).getStr() );
                         else if (aGrabBag[j].Name == "ooxml:CT_SdtDocPart_docPartUnique")
-                            AddToAttrList( m_pParagraphSdtPrTokenChildren, FSNS( XML_w, XML_docPartUnique ), "" );
+                        {
+                            if (sValue.isEmpty())
+                                sValue = "true";
+                            AddToAttrList( m_pParagraphSdtPrTokenChildren, FSNS( XML_w, XML_docPartUnique ),
+                            OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ).getStr() );
+                        }
                     }
                 }
                 else if (aPropertyValue.Name == "ooxml:CT_SdtPr_equation")


More information about the Libreoffice-commits mailing list