[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Jul 13 12:45:58 PDT 2012


 sw/source/filter/ww8/docxattributeoutput.cxx |    7 ++++++-
 sw/source/filter/ww8/docxexport.cxx          |    6 ++++++
 sw/source/filter/ww8/docxexport.hxx          |    5 +++--
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit d34d2c1a026ce99c3f6e2730efbf8c41dcbcd3e1
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Jul 13 18:22:27 2012 +0200

    do not write default tab stop into the default style in .docx
    
    Use w:defaultTabStop in w:settings instead.
    
    Change-Id: I7056ff0ee8574fd942e2f330a1f76bae657a825e
    (cherry picked from commit 15af925c254f27046427de70a59011e2ac3d6bdb)
    
    Signed-off-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 2d1bb23..4737501 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3788,7 +3788,12 @@ void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop )
 
     sal_uInt16 nCount = rTabStop.Count();
     for (sal_uInt16 i = 0; i < nCount; i++ )
-        impl_WriteTabElement( m_pSerializer, rTabStop[i], nCurrentLeft );
+    {
+        if( rTabStop[i].GetAdjustment() != SVX_TAB_ADJUST_DEFAULT )
+            impl_WriteTabElement( m_pSerializer, rTabStop[i], nCurrentLeft );
+        else
+            GetExport().setDefaultTabStop( rTabStop[i].GetTabPos());
+    }
 
     m_pSerializer->endElementNS( XML_w, XML_tabs );
 }
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index de50add..418589d 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -687,6 +687,9 @@ void DocxExport::WriteSettings()
     rtl::OString aZoom(rtl::OString::valueOf(sal_Int32(pViewShell->GetViewOptions()->GetZoom())));
     pFS->singleElementNS(XML_w, XML_zoom, FSNS(XML_w, XML_percent), aZoom.getStr(), FSEND);
 
+    if( settings.defaultTabStop != 0 )
+        pFS->singleElementNS( XML_w, XML_defaultTabStop, FSNS( XML_w, XML_val ),
+            rtl::OString::valueOf( sal_Int32( settings.defaultTabStop )).getStr(), FSEND );
     if( settings.evenAndOddHeaders )
         pFS->singleElementNS( XML_w, XML_evenAndOddHeaders, FSEND );
 
@@ -833,6 +836,7 @@ DocxExport::~DocxExport()
 
 DocxSettingsData::DocxSettingsData()
 : evenAndOddHeaders( false )
+, defaultTabStop( 0 )
 {
 }
 
@@ -840,6 +844,8 @@ bool DocxSettingsData::hasData() const
 {
     if( evenAndOddHeaders )
         return true;
+    if( defaultTabStop != 0 )
+        return true;
     return false;
 }
 
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 8963cd3..c89afc7 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -64,6 +64,7 @@ struct DocxSettingsData
     DocxSettingsData();
     bool hasData() const; /// returns true if there are any non-default settings (i.e. something to write)
     bool evenAndOddHeaders;
+    int defaultTabStop;
 };
 
 /// The class that does all the actual DOCX export-related work.
@@ -228,8 +229,8 @@ public:
     /// Reference to the VMLExport instance for the main document.
     oox::vml::VMLExport& VMLExporter();
 
-    /// Data to be exported in the settings part of the document
-    DocxSettingsData& settingsData();
+    /// Set the document default tab stop.
+    void setDefaultTabStop( int stop ) { settings.defaultTabStop = stop; }
 
 private:
     /// No copying.


More information about the Libreoffice-commits mailing list