[Libreoffice-commits] .: sw/source

Lubos Lunak llunak at kemper.freedesktop.org
Wed Mar 2 08:57:07 PST 2011


 sw/source/filter/ww8/docxattributeoutput.cxx |   19 +++++++------------
 sw/source/filter/ww8/docxattributeoutput.hxx |    7 +++----
 sw/source/filter/ww8/docxexport.cxx          |    1 +
 sw/source/filter/ww8/docxexport.hxx          |    2 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx  |    2 +-
 sw/source/filter/ww8/rtfattributeoutput.hxx  |    6 +++---
 sw/source/filter/ww8/rtfexport.cxx           |    1 +
 sw/source/filter/ww8/rtfexport.hxx           |    2 +-
 sw/source/filter/ww8/rtfsdrexport.cxx        |    1 +
 sw/source/filter/ww8/ww8attributeoutput.hxx  |    4 ++--
 10 files changed, 21 insertions(+), 24 deletions(-)

New commits:
commit 0e3e6ee8cd59fd9abd6b1cce286a20c24e158f2a
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Mar 2 15:33:49 2011 +0100

    covariant return type and const overload for GetExport()
    
    I don't see why one should do this manually when the compiler
    knows it.

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index cea2c36..307c2ea 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1447,8 +1447,7 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
 
     const SwTableBox *pTblBox = pTableTextNodeInfoInner->getTableBox( );
 
-    DocxExport& rExport = dynamic_cast< DocxExport& >( GetExport() );
-    bool bEcma = rExport.GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
+    bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
 
     // Cell prefered width
     SwTwips nWidth = GetGridCols( pTableTextNodeInfoInner )->at( pTableTextNodeInfoInner->getCell() );
@@ -1621,8 +1620,7 @@ void DocxAttributeOutput::TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t /*
 
 void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
-    DocxExport& rExport = dynamic_cast< DocxExport& >( GetExport() );
-    bool bEcma = rExport.GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
+    bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
 
     // Write the table properties
     m_pSerializer->startElementNS( XML_w, XML_tblPr, FSEND );
@@ -1702,8 +1700,7 @@ void DocxAttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Point
     const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
     const SwFrmFmt * pFrmFmt = pTabBox->GetFrmFmt();
 
-    DocxExport& rExport = dynamic_cast< DocxExport& >( GetExport() );
-    bool bEcma = rExport.GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
+    bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
 
     // the defaults of the table are taken from the top-left cell
     m_pSerializer->startElementNS( XML_w, XML_tblBorders, FSEND );
@@ -2561,8 +2558,7 @@ void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEnc
         aCharSet = OString( "0" ) + aCharSet;
     pAttr->add( FSNS( XML_w, XML_val ), aCharSet.getStr());
 
-    const DocxExport& rExport = dynamic_cast< const DocxExport& >( GetExport() );
-    if( rExport.GetFilter().getVersion( ) != oox::core::ECMA_DIALECT )
+    if( GetExport().GetFilter().getVersion( ) != oox::core::ECMA_DIALECT )
     {
         if( const char* charset = rtl_getMimeCharsetFromTextEncoding( nEncoding ))
             pAttr->add( FSNS( XML_w, XML_characterSet ), charset );
@@ -3400,10 +3396,9 @@ void DocxAttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust )
 {
     const char *pAdjustString;
 
-    DocxExport& rExport = dynamic_cast< DocxExport& >( GetExport() );
-    bool bEcma = rExport.GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
+    bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
 
-    const SfxItemSet* pItems = rExport.GetCurItemSet();
+    const SfxItemSet* pItems = GetExport().GetCurItemSet();
     const SvxFrameDirectionItem* rFrameDir = static_cast< const SvxFrameDirectionItem* >( pItems->GetItem( RES_FRAMEDIR ) );
 
     bool bRtl = false;
@@ -4118,7 +4113,7 @@ DocxAttributeOutput::~DocxAttributeOutput()
     m_pParentFrame = NULL;
 }
 
-MSWordExportBase& DocxAttributeOutput::GetExport()
+DocxExport& DocxAttributeOutput::GetExport()
 {
     return m_rExport;
 }
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 744bfe6..4590da9 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -32,6 +32,7 @@
 #include "attributeoutputbase.hxx"
 #include "fields.hxx"
 #include "IMark.hxx"
+#include "docxexport.hxx"
 
 #include <sax/fshelper.hxx>
 #include <sax/fastattribs.hxx>
@@ -41,8 +42,6 @@
 
 #include <vector>
 
-class DocxExport;
-
 class SwGrfNode;
 class SdrObject;
 
@@ -586,8 +585,8 @@ public:
     virtual ~DocxAttributeOutput();
 
     /// Return the right export class.
-    virtual MSWordExportBase& GetExport();
-    using AttributeOutputBase::GetExport;
+    virtual DocxExport& GetExport();
+    const DocxExport& GetExport() const { return const_cast< DocxAttributeOutput* >( this )->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.cxx b/sw/source/filter/ww8/docxexport.cxx
index 64c88d9..472c665 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -28,6 +28,7 @@
 
 #include "docxexport.hxx"
 #include "docxexportfilter.hxx"
+#include "docxattributeoutput.hxx"
 
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XDocumentProperties.hpp>
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 77015d9..411346d 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -29,7 +29,6 @@
 #ifndef _DOCXEXPORT_HXX_
 #define _DOCXEXPORT_HXX_
 
-#include "docxattributeoutput.hxx"
 #include "wrtww8.hxx"
 
 #include <sax/fshelper.hxx>
@@ -39,6 +38,7 @@
 #include <cstdio>
 #include <vector>
 
+class DocxAttributeOutput;
 class DocxExportFilter;
 class SwNode;
 class SwEndNode;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 01eaf3a..35f2248 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3024,7 +3024,7 @@ RtfAttributeOutput::~RtfAttributeOutput()
     OSL_TRACE("%s", OSL_THIS_FUNC);
 }
 
-MSWordExportBase& RtfAttributeOutput::GetExport()
+RtfExport& RtfAttributeOutput::GetExport()
 {
     return m_rExport;
 }
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 6eeb14c..adb0cbc 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -32,6 +32,7 @@
 #include <set>
 #include "attributeoutputbase.hxx"
 #include "fields.hxx"
+#include "rtfexport.hxx"
 
 #include <vcl/vclenum.hxx>
 
@@ -40,7 +41,6 @@
 
 #include <vector>
 
-class RtfExport;
 
 class SwGrfNode;
 class SwOLENode;
@@ -542,8 +542,8 @@ public:
     virtual ~RtfAttributeOutput();
 
     /// Return the right export class.
-    virtual MSWordExportBase& GetExport();
-    using AttributeOutputBase::GetExport;
+    virtual RtfExport& GetExport();
+    const RtfExport& GetExport() const { return const_cast< RtfAttributeOutput* >( this )->GetExport(); }
 
     rtl::OStringBuffer m_aTabStop;
 
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 0e58e80..5e946cf 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -29,6 +29,7 @@
 #include "rtfexport.hxx"
 #include "rtfexportfilter.hxx"
 #include "rtfsdrexport.hxx"
+#include "rtfattributeoutput.hxx"
 
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XDocumentProperties.hpp>
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index f7f4d21..5b14c1d 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -30,7 +30,6 @@
 #define _RTFEXPORT_HXX_
 
 #include <set>
-#include "rtfattributeoutput.hxx"
 #include "wrtww8.hxx"
 
 #include <rtl/ustring.hxx>
@@ -38,6 +37,7 @@
 #include <cstdio>
 #include <map>
 
+class RtfAttributeOutput;
 class RtfExportFilter;
 class RtfSdrExport;
 typedef std::map<USHORT,Color> RtfColorTbl;
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index d3543e3..1b05b57 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -29,6 +29,7 @@
 #include "rtfsdrexport.hxx"
 #include "rtfexport.hxx"
 #include "writerhelper.hxx"
+#include "rtfattributeoutput.hxx"
 
 #include <com/sun/star/i18n/ScriptType.hdl>
 #include <osl/diagnose.h>
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 028ff10..044acb1 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -427,8 +427,8 @@ public:
     virtual ~WW8AttributeOutput() {}
 
     /// Return the right export class.
-    virtual MSWordExportBase& GetExport() { return m_rWW8Export; }
-    using AttributeOutputBase::GetExport;
+    virtual WW8Export& GetExport() { return m_rWW8Export; }
+    const WW8Export& GetExport() const { return m_rWW8Export; }
 
 protected:
     /// Output the bold etc. attributes


More information about the Libreoffice-commits mailing list