summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-04-18 21:05:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-04-18 21:05:42 +0100
commit980ab387851a9ac0b2f39a648bc01b8cba855715 (patch)
tree6758b7efb736a11def7a2f14a755e6015af9e038 /sw
parenta5f76a11ec9eb9640e792056ef0629cffa1a2d12 (diff)
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
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/html/htmltabw.cxx4
-rw-r--r--sw/source/filter/inc/wrtswtbl.hxx14
-rw-r--r--sw/source/filter/writer/wrtswtbl.cxx8
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx6
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx25
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx12
6 files changed, 27 insertions, 42 deletions
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 24f064afe74d..ba2b9166d592 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 e14261dbc6bb..ad3c9f5d3e80 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 1f58fdf63d60..1e5ca18cdec8 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 e29339cd8b79..263c72256cb8 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 ff495417e25a..d0bf46c7e202 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 738887ef8245..4f7ce74f8a83 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*/)