[Libreoffice-commits] .: 2 commits - sw/source

Lubos Lunak llunak at kemper.freedesktop.org
Tue Mar 1 08:24:04 PST 2011


 sw/source/filter/ww8/attributeoutputbase.hxx |    3 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   16 ++++++++++++----
 sw/source/filter/ww8/docxattributeoutput.hxx |    3 ++-
 sw/source/filter/ww8/docxexport.hxx          |    1 +
 sw/source/filter/ww8/rtfattributeoutput.hxx  |    1 +
 sw/source/filter/ww8/wrtw8sty.cxx            |    2 +-
 sw/source/filter/ww8/ww8attributeoutput.hxx  |    1 +
 7 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit d923fd6c53b4792bce5c722c19b8450dd69295c2
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Mar 1 15:49:52 2011 +0100

    write also w:characterSet

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index f0a6eee..cea2c36 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2552,15 +2552,23 @@ void DocxAttributeOutput::FontAlternateName( const String& rName ) const
             FSEND );
 }
 
-void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet ) const
+void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEncoding ) const
 {
+    FastAttributeList* pAttr = m_pSerializer->createAttrList();
+
     OString aCharSet( OString::valueOf( sal_Int32( nCharSet ), 16 ) );
     if ( aCharSet.getLength() == 1 )
         aCharSet = OString( "0" ) + aCharSet;
+    pAttr->add( FSNS( XML_w, XML_val ), aCharSet.getStr());
 
-    m_pSerializer->singleElementNS( XML_w, XML_charset,
-            FSNS( XML_w, XML_val ), aCharSet.getStr(),
-            FSEND );
+    const DocxExport& rExport = dynamic_cast< const DocxExport& >( GetExport() );
+    if( rExport.GetFilter().getVersion( ) != oox::core::ECMA_DIALECT )
+    {
+        if( const char* charset = rtl_getMimeCharsetFromTextEncoding( nEncoding ))
+            pAttr->add( FSNS( XML_w, XML_characterSet ), charset );
+    }
+
+    m_pSerializer->singleElementNS( XML_w, XML_charset, XFastAttributeListRef( pAttr ));
 }
 
 void DocxAttributeOutput::FontFamilyType( FontFamily eFamily ) const
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index a745eb7..744bfe6 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -232,7 +232,7 @@ public:
     void FontAlternateName( const String& rName ) const;
 
     /// Font charset.
-    void FontCharset( sal_uInt8 nCharSet ) const;
+    void FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEncoding ) const;
 
     /// Font family.
     void FontFamilyType( FontFamily eFamily ) const;
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 3b51896..c7c4be5 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -712,7 +712,7 @@ void wwFont::WriteDocx( const DocxAttributeOutput* rAttrOutput ) const
 
     if ( mbAlt )
         rAttrOutput->FontAlternateName( msAltNm );
-    rAttrOutput->FontCharset( sw::ms::rtl_TextEncodingToWinCharset( meChrSet ) );
+    rAttrOutput->FontCharset( sw::ms::rtl_TextEncodingToWinCharset( meChrSet ), meChrSet );
     rAttrOutput->FontFamilyType( meFamily );
     rAttrOutput->FontPitchType( mePitch );
 
commit 32e0194675a93dcd2fee7d3431541def53162b77
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Mar 1 15:21:50 2011 +0100

    const version of GetExport()

diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 96173de..d31b66b 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -568,6 +568,9 @@ public:
     /// Return the right export class.
     virtual MSWordExportBase& GetExport() = 0;
 
+    /// @overload
+    const MSWordExportBase& GetExport() const { return const_cast< AttributeOutputBase* >( this )->GetExport(); }
+
     /// Call the right virtual function according to the type of the item.
     void OutputItem( const SfxPoolItem& rHt );
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 8795614..a745eb7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -587,6 +587,7 @@ public:
 
     /// Return the right export class.
     virtual MSWordExportBase& GetExport();
+    using AttributeOutputBase::GetExport;
 
     /// For eg. the output of the styles, we need to switch the serializer to enother one.
     void SetSerializer( ::sax_fastparser::FSHelperPtr pSerializer ) { m_pSerializer = pSerializer; }
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 9e7a0c5..77015d9 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -88,6 +88,7 @@ class DocxExport : public MSWordExportBase
 public:
 
     DocxExportFilter& GetFilter() { return *m_pFilter; };
+    const DocxExportFilter& GetFilter() const { return *m_pFilter; };
 
     /// Access to the attribute output class.
     virtual AttributeOutputBase& AttrOutput() const;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 13535f7..6eeb14c 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -543,6 +543,7 @@ public:
 
     /// Return the right export class.
     virtual MSWordExportBase& GetExport();
+    using AttributeOutputBase::GetExport;
 
     rtl::OStringBuffer m_aTabStop;
 
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 0779ce4..028ff10 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -428,6 +428,7 @@ public:
 
     /// Return the right export class.
     virtual MSWordExportBase& GetExport() { return m_rWW8Export; }
+    using AttributeOutputBase::GetExport;
 
 protected:
     /// Output the bold etc. attributes


More information about the Libreoffice-commits mailing list