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

Caolán McNamara caolanm at redhat.com
Sat Apr 18 13:11:10 PDT 2015


 sw/source/filter/html/htmltabw.cxx           |    4 ++--
 sw/source/filter/inc/wrtswtbl.hxx            |   14 ++++++++++----
 sw/source/filter/writer/wrtswtbl.cxx         |    8 ++++----
 sw/source/filter/ww8/docxattributeoutput.cxx |    6 +++---
 sw/source/filter/ww8/docxattributeoutput.hxx |   25 +------------------------
 sw/source/filter/ww8/rtfattributeoutput.cxx  |   12 +++++++-----
 6 files changed, 27 insertions(+), 42 deletions(-)

New commits:
commit 980ab387851a9ac0b2f39a648bc01b8cba855715
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 18 21:05:39 2015 +0100

    fix export to rtf of ooo87305-1.odt
    
    fold DocxWriteTable into SwWriteTable and make the same improvement to the rtf
    filter as the docx filter to keep the table writer in sync with the current
    table, and mirroring the cache improvement of the docx filter into the rtf one
    
    Change-Id: Ia0d5972acbe6524da67497defdcbcd26cfdc44fb

diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 24f064a..ba2b916 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -98,13 +98,13 @@ SwHTMLWrtTable::SwHTMLWrtTable( const SwTableLines& rLines, long nWidth,
                                 sal_uInt32 nBWidth, bool bRel,
                                 sal_uInt16 nLSub, sal_uInt16 nRSub,
                                 sal_uInt16 nNumOfRowsToRepeat )
-    : SwWriteTable( rLines, nWidth, nBWidth, bRel, MAX_DEPTH, nLSub, nRSub, nNumOfRowsToRepeat )
+    : SwWriteTable(NULL, rLines, nWidth, nBWidth, bRel, MAX_DEPTH, nLSub, nRSub, nNumOfRowsToRepeat)
 {
     PixelizeBorders();
 }
 
 SwHTMLWrtTable::SwHTMLWrtTable( const SwHTMLTableLayout *pLayoutInfo )
-    : SwWriteTable( pLayoutInfo )
+    : SwWriteTable(NULL, pLayoutInfo)
 {
     // Einige Twip-Werte an Pixel-Grenzen anpassen
     if( bCollectBorderWidth )
diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx
index e14261d..ad3c9f5 100644
--- a/sw/source/filter/inc/wrtswtbl.hxx
+++ b/sw/source/filter/inc/wrtswtbl.hxx
@@ -218,8 +218,12 @@ public:
     ~SwWriteTableCols() { DeleteAndDestroyAll(); }
 };
 
+class SwTable;
+
 class SW_DLLPUBLIC SwWriteTable
 {
+private:
+    const SwTable* m_pTable;
 protected:
     SwWriteTableCols aCols; // alle Spalten
     SwWriteTableRows aRows; // alle Zellen
@@ -299,14 +303,16 @@ protected:
     sal_uInt16 GetRightSpace(size_t nCol, sal_uInt16 nColSpan) const;
 
 public:
-    SwWriteTable( const SwTableLines& rLines, long nWidth, sal_uInt32 nBWidth,
-                    bool bRel, sal_uInt16 nMaxDepth = USHRT_MAX,
-                    sal_uInt16 nLeftSub=0, sal_uInt16 nRightSub=0, sal_uInt32 nNumOfRowsToRepeat=0 );
-    SwWriteTable( const SwHTMLTableLayout *pLayoutInfo );
+    SwWriteTable(const SwTable* pTable, const SwTableLines& rLines, long nWidth, sal_uInt32 nBWidth,
+                 bool bRel, sal_uInt16 nMaxDepth = USHRT_MAX,
+                 sal_uInt16 nLeftSub=0, sal_uInt16 nRightSub=0, sal_uInt32 nNumOfRowsToRepeat=0);
+    SwWriteTable(const SwTable* pTable, const SwHTMLTableLayout *pLayoutInfo);
     virtual ~SwWriteTable();
 
     const SwWriteTableCols& GetCols() const { return aCols; }
     const SwWriteTableRows& GetRows() const { return aRows; }
+
+    const SwTable* GetTable() const { return m_pTable; }
 };
 
 #endif
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index 1f58fdf..1e5ca18 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -726,9 +726,9 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow,
     }
 }
 
-SwWriteTable::SwWriteTable(const SwTableLines& rLines, long nWidth,
+SwWriteTable::SwWriteTable(const SwTable* pTable, const SwTableLines& rLines, long nWidth,
     sal_uInt32 nBWidth, bool bRel, sal_uInt16 nMaxDepth, sal_uInt16 nLSub, sal_uInt16 nRSub, sal_uInt32 nNumOfRowsToRepeat)
-    : nBorderColor((sal_uInt32)-1), nCellSpacing(0), nCellPadding(0), nBorder(0),
+    : m_pTable(pTable), nBorderColor((sal_uInt32)-1), nCellSpacing(0), nCellPadding(0), nBorder(0),
     nInnerBorder(0), nBaseWidth(nBWidth), nHeadEndRow(USHRT_MAX),
      nLeftSub(nLSub), nRightSub(nRSub), nTabWidth(nWidth), bRelWidths(bRel),
     bUseLayoutHeights(true),
@@ -760,8 +760,8 @@ SwWriteTable::SwWriteTable(const SwTableLines& rLines, long nWidth,
         nBorder = nInnerBorder;
 }
 
-SwWriteTable::SwWriteTable( const SwHTMLTableLayout *pLayoutInfo )
-    : nBorderColor((sal_uInt32)-1), nCellSpacing(0), nCellPadding(0), nBorder(0),
+SwWriteTable::SwWriteTable(const SwTable* pTable, const SwHTMLTableLayout *pLayoutInfo)
+    : m_pTable(pTable), nBorderColor((sal_uInt32)-1), nCellSpacing(0), nCellPadding(0), nBorder(0),
     nInnerBorder(0), nBaseWidth(pLayoutInfo->GetWidthOption()), nHeadEndRow(0),
     nLeftSub(0), nRightSub(0), nTabWidth(pLayoutInfo->GetWidthOption()),
     bRelWidths(pLayoutInfo->HasPrcWidthOption()), bUseLayoutHeights(false),
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e29339c..263c722 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2899,7 +2899,7 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
 void DocxAttributeOutput::InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
     const SwTable* pTable = pTableTextNodeInfoInner->getTable();
-    if (m_xTableWrt && pTable == m_xTableWrt->getTable())
+    if (m_xTableWrt && pTable == m_xTableWrt->GetTable())
         return;
 
     long nPageSize = 0;
@@ -2913,9 +2913,9 @@ void DocxAttributeOutput::InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t
 
     const SwHTMLTableLayout *pLayout = pTable->GetHTMLTableLayout();
     if( pLayout && pLayout->IsExportable() )
-        m_xTableWrt.reset(new DocxWriteTable(pTable, pLayout));
+        m_xTableWrt.reset(new SwWriteTable(pTable, pLayout));
     else
-        m_xTableWrt.reset(new DocxWriteTable(pTable, pTable->GetTabLines(), nPageSize, nTblSz, false));
+        m_xTableWrt.reset(new SwWriteTable(pTable, pTable->GetTabLines(), nPageSize, nTblSz, false));
 }
 
 void DocxAttributeOutput::StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index ff49541..d0bf46c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -138,29 +138,6 @@ struct TableReference
     }
 };
 
-class DocxWriteTable : public SwWriteTable
-{
-public:
-    DocxWriteTable(const SwTable* pTable, const SwTableLines& rLines, long nWidth, sal_uInt32 nBWidth,
-                 bool bRel, sal_uInt16 nMaxDepth = USHRT_MAX,
-                 sal_uInt16 nInLeftSub=0, sal_uInt16 nInRightSub=0, sal_uInt32 nNumOfRowsToRepeat=0)
-        : SwWriteTable(rLines, nWidth, nBWidth,
-                       bRel, nMaxDepth, nInLeftSub, nInRightSub, nNumOfRowsToRepeat)
-        , m_pTable(pTable)
-    {
-    }
-
-    DocxWriteTable(const SwTable* pTable, const SwHTMLTableLayout *pLayoutInfo )
-        : SwWriteTable(pLayoutInfo)
-        , m_pTable(pTable)
-    {
-    }
-
-    const SwTable* getTable() const { return m_pTable; }
-private:
-    const SwTable* m_pTable;
-};
-
 /// The class that has handlers for various resource types when exporting as DOCX.
 class DocxAttributeOutput : public AttributeOutputBase, public oox::vml::VMLTextExport, public oox::drawingml::DMLTextExport
 {
@@ -818,7 +795,7 @@ private:
     std::vector<css::beans::PropertyValue> m_aTextEffectsGrabBag;
 
     /// The current table helper
-    std::unique_ptr<DocxWriteTable> m_xTableWrt;
+    std::unique_ptr<SwWriteTable> m_xTableWrt;
 
     sw::Frame* m_pCurrentFrame;
 
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 738887e..4f7ce74 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -543,8 +543,7 @@ void RtfAttributeOutput::TableInfoRow(ww8::WW8TableNodeInfoInner::Pointer_t /*pT
 
 void RtfAttributeOutput::TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
 {
-    if (!m_pTableWrt)
-        InitTableHelper(pTableTextNodeInfoInner);
+    InitTableHelper(pTableTextNodeInfoInner);
 
     const SwTable* pTbl = pTableTextNodeInfoInner->getTable();
     SwFrmFmt* pFmt = pTbl->GetFrmFmt();
@@ -844,21 +843,24 @@ void RtfAttributeOutput::TableRowEnd(sal_uInt32 /*nDepth*/)
 
 void RtfAttributeOutput::InitTableHelper(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
 {
+    const SwTable* pTable = pTableTextNodeInfoInner->getTable();
+    if (m_pTableWrt && pTable == m_pTableWrt->GetTable())
+        return;
+
     long nPageSize = 0;
     bool bRelBoxSize = false;
 
     // Create the SwWriteTable instance to use col spans
     GetTablePageSize(pTableTextNodeInfoInner.get(), nPageSize, bRelBoxSize);
 
-    const SwTable* pTable = pTableTextNodeInfoInner->getTable();
     const SwFrmFmt* pFmt = pTable->GetFrmFmt();
     const sal_uInt32 nTblSz = static_cast<sal_uInt32>(pFmt->GetFrmSize().GetWidth());
 
     const SwHTMLTableLayout* pLayout = pTable->GetHTMLTableLayout();
     if (pLayout && pLayout->IsExportable())
-        m_pTableWrt = new SwWriteTable(pLayout);
+        m_pTableWrt = new SwWriteTable(pTable, pLayout);
     else
-        m_pTableWrt = new SwWriteTable(pTable->GetTabLines(), nPageSize, nTblSz, false);
+        m_pTableWrt = new SwWriteTable(pTable, pTable->GetTabLines(), nPageSize, nTblSz, false);
 }
 
 void RtfAttributeOutput::StartTable(ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/)


More information about the Libreoffice-commits mailing list