sw/qa/extras/ooxmlexport/ooxmlexport5.cxx    |    2 ++
 sw/source/filter/ww8/docxattributeoutput.cxx |    8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit c2cc63338f3c2f38d0a4f6be822c6cdeedb8213c
Author: Joren De Cuyper <jore...@libreoffice.org>
Date:   Sun May 10 11:24:20 2015 +0200

    Don't write empty vertAnchor, HorzAnchor, tblpYSpec and tblpXSpec attributes
    
    This attributes needs a value from the enumeration.
    See 
http://dev-builds.libreoffice.org/crashtest/6183a945de03dcd5fe0b967d5814a0add954a8c8/validation/docx/fdo43632-1.docx.log
 :
    
    (word/document.xml:2 col:70,187) cvc-enumeration-valid: Value '' is not 
facet-valid with respect to enumeration
    '[inline, top, center, bottom, inside, outside]'. It must be a value from 
the enumeration.
    (word/document.xml:2 col:70,187) cvc-attribute.3: The value '' of attribute 
'w:tblpYSpec' on element 'w:tblpPr'
    is not valid with respect to its type, 'ST_YAlign'.
    
    Change-Id: Ibe4ccdf1c273e2ede22dc8865ec91af4de162e10
    Reviewed-on: https://gerrit.libreoffice.org/15693
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Joren De Cuyper <jore...@libreoffice.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 89a1502..07ba2ae 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -234,6 +234,8 @@ DECLARE_OOXMLEXPORT_TEST(testFloatingTable, "fdo77887.docx")
     assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "tblpY", "2266");
     assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "vertAnchor", 
"page");
 
+    //make sure not to write empty attributes which requires enumeration
+    assertXPathNoAttribute(pXmlDoc, 
"/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "tblpYSpec");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testOldComplexMergeRight, "tdf90681-1.odt")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index abd7557..9147bfe 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3224,22 +3224,22 @@ void DocxAttributeOutput::TableDefinition( 
ww8::WW8TableNodeInfoInner::Pointer_t
             uno::Sequence<beans::PropertyValue> aTablePosition = 
aGrabBagElement->second.get<uno::Sequence<beans::PropertyValue> >();
             for (sal_Int32 i = 0; i < aTablePosition.getLength(); ++i)
             {
-                if (aTablePosition[i].Name == "vertAnchor")
+                if (aTablePosition[i].Name == "vertAnchor" && 
aTablePosition[i].Value.get<OUString>() != "")
                 {
                     OString strTemp = 
OUStringToOString(aTablePosition[i].Value.get<OUString>(), 
RTL_TEXTENCODING_UTF8);
                     attrListTablePos->add( FSNS( XML_w, XML_vertAnchor ), 
strTemp.getStr() );
                 }
-                else if (aTablePosition[i].Name == "tblpYSpec")
+                else if (aTablePosition[i].Name == "tblpYSpec" && 
aTablePosition[i].Value.get<OUString>() != "")
                 {
                     OString strTemp = 
OUStringToOString(aTablePosition[i].Value.get<OUString>(), 
RTL_TEXTENCODING_UTF8);
                     attrListTablePos->add( FSNS( XML_w, XML_tblpYSpec ), 
strTemp.getStr() );
                 }
-                else if (aTablePosition[i].Name == "horzAnchor")
+                else if (aTablePosition[i].Name == "horzAnchor" && 
aTablePosition[i].Value.get<OUString>() != "")
                 {
                     OString strTemp = 
OUStringToOString(aTablePosition[i].Value.get<OUString>(), 
RTL_TEXTENCODING_UTF8);
                     attrListTablePos->add( FSNS( XML_w, XML_horzAnchor ), 
strTemp.getStr() );
                 }
-                else if (aTablePosition[i].Name == "tblpXSpec")
+                else if (aTablePosition[i].Name == "tblpXSpec" && 
aTablePosition[i].Value.get<OUString>() != "")
                 {
                     OString strTemp = 
OUStringToOString(aTablePosition[i].Value.get<OUString>(), 
RTL_TEXTENCODING_UTF8);
                     attrListTablePos->add( FSNS( XML_w, XML_tblpXSpec ), 
strTemp.getStr() );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to