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

Miklos Vajna vmiklos at collabora.co.uk
Thu Dec 11 08:04:12 PST 2014


 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |    3 +++
 sw/source/filter/ww8/docxexport.cxx       |    6 ++++--
 sw/source/filter/ww8/docxexport.hxx       |    2 +-
 sw/source/filter/ww8/wrtw8sty.cxx         |    2 +-
 sw/source/filter/ww8/wrtww8.hxx           |    2 +-
 5 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 19762e8b96f16504e6e7607f96ff9c5c62e9e35c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Dec 11 11:13:13 2014 +0100

    DOCX export: don't write w:suppressAutoHyphens unconditionally
    
    Change-Id: I0e716f1c6d5034774247264cd098ede14601f751

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 7b0edaf..b411a4c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -262,6 +262,9 @@ DECLARE_OOXMLEXPORT_TEST(testStyleInheritance, "style-inheritance.docx")
 
     // Finally check the same for numbering styles.
     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NoList']", "default", "1");
+
+    // This was 1, the default style had <w:suppressAutoHyphens w:val="true"/> even for a default style having no RES_PARATR_HYPHENZONE set.
+    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:pPr/w:suppressAutoHyphens", 0);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testCalendar1, "calendar1.docx")
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 197eac9..6cb7d80 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1348,11 +1348,13 @@ XFastAttributeListRef DocxExport::MainXmlNamespaces( FSHelperPtr serializer )
     return XFastAttributeListRef( pAttr );
 }
 
-bool DocxExport::ignoreAttributeForStyles( sal_uInt16 nWhich ) const
+bool DocxExport::ignoreAttributeForStyleDefaults( sal_uInt16 nWhich ) const
 {
     if( nWhich == RES_TEXTGRID )
         return true; // w:docGrid is written only to document.xml, not to styles.xml
-    return MSWordExportBase::ignoreAttributeForStyles( nWhich );
+    if (nWhich == RES_PARATR_HYPHENZONE)
+        return true; // w:suppressAutoHyphens is only a formatting exception, not a default
+    return MSWordExportBase::ignoreAttributeForStyleDefaults( nWhich );
 }
 
 void DocxExport::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTyp)
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 3c4e708..f2a320e 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -125,7 +125,7 @@ public:
 
     virtual bool AddSectionBreaksForTOX() const SAL_OVERRIDE { return true; }
 
-    virtual bool ignoreAttributeForStyles( sal_uInt16 nWhich ) const SAL_OVERRIDE;
+    virtual bool ignoreAttributeForStyleDefaults( sal_uInt16 nWhich ) const SAL_OVERRIDE;
 
     virtual bool PreferPageBreakBefore() const SAL_OVERRIDE { return false; }
 
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index ae6fafe..3c84833 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -473,7 +473,7 @@ void MSWordStyles::SetStyleDefaults( const SwFmt& rFmt, bool bPap )
     const bool* pFlags = aFlags + ( nStt - RES_CHRATR_BEGIN );
     for ( n = nStt; n < nEnd; ++n, ++pFlags )
     {
-        if ( *pFlags && !m_rExport.ignoreAttributeForStyles( n )
+        if ( *pFlags && !m_rExport.ignoreAttributeForStyleDefaults( n )
             && SfxItemState::SET != rFmt.GetItemState(n, false))
         {
             //If we are a character property then see if it is one of the
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index c725847..09dd0dc 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -655,7 +655,7 @@ public:
     virtual bool AddSectionBreaksForTOX() const = 0;
 
     /// Used to filter out attributes that can be e.g. written to .doc but not to .docx
-    virtual bool ignoreAttributeForStyles( sal_uInt16 /*nWhich*/ ) const { return false; }
+    virtual bool ignoreAttributeForStyleDefaults( sal_uInt16 /*nWhich*/ ) const { return false; }
 
     /// If saving page break is preferred as a paragraph attribute (yes) or as a special character (no).
     virtual bool PreferPageBreakBefore() const = 0;


More information about the Libreoffice-commits mailing list