summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2011-07-28 16:09:54 +0200
committerMiklos Vajna <vmiklos@frugalware.org>2011-07-29 17:32:41 +0200
commit89457083258d090e55012f59e21210614e613ec3 (patch)
tree6fadcf16704d949f7ef4337a2b338169f31814c0
parent42b90d539efa169af9846fc6e67503b3fcef11af (diff)
send cell width values in the first row only
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx16
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx2
2 files changed, 16 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5ecd01373..58809d4b0 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -250,6 +250,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_aFontEncodings(),
m_aColorTable(),
m_bFirstRun(true),
+ m_bFirstRow(true),
m_bNeedPap(false),
m_aListTableSprms(),
m_aSettingsTableSprms(),
@@ -397,6 +398,11 @@ void RTFDocumentImpl::parBreak()
Mapper().endCharacterGroup();
Mapper().endParagraphGroup();
+ // If we are not in a table, then the next table row will be the first one.
+ RTFValue::Pointer_t pValue = m_aStates.top().aParagraphSprms.find(NS_sprm::LN_PFInTable);
+ if (!pValue.get())
+ m_bFirstRow = true;
+
// start new one
Mapper().startParagraphGroup();
}
@@ -1211,6 +1217,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
case RTF_ROW:
case RTF_NESTROW:
{
+ m_bFirstRow = false;
if (m_aStates.top().nCells)
{
// Make a backup before we start popping elements
@@ -1224,6 +1231,8 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
m_aStates.top().aTableCellsSprms = m_aStates.top().aTableInheritingCellsSprms;
m_aStates.top().aTableCellsAttributes = m_aStates.top().aTableInheritingCellsAttributes;
m_aStates.top().nCells = m_aStates.top().nInheritingCells;
+ // This can't be the first row, and we need cell width only there
+ while(m_aStates.top().aTableRowSprms.erase(NS_ooxml::LN_CT_TblGridBase_gridCol));
}
for (int i = 0; i < m_aStates.top().nCells; ++i)
{
@@ -1974,8 +1983,11 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
{
int nCellX = nParam - m_aStates.top().nCellX;
m_aStates.top().nCellX = nParam;
- RTFValue::Pointer_t pXValue(new RTFValue(nCellX));
- m_aStates.top().aTableRowSprms->push_back(make_pair(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue));
+ if (m_bFirstRow)
+ {
+ RTFValue::Pointer_t pXValue(new RTFValue(nCellX));
+ m_aStates.top().aTableRowSprms->push_back(make_pair(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue));
+ }
m_aStates.top().nCells++;
// Push cell properties.
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index f10a43417..edf7b734e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -332,6 +332,8 @@ namespace writerfilter {
/// Color index <-> RGB color value map
std::vector<sal_uInt32> m_aColorTable;
bool m_bFirstRun;
+ /// If this is the first row in a table - there we send cell widths.
+ bool m_bFirstRow;
/// If paragraph properties should be emitted on next run.
bool m_bNeedPap;
/// The list table and list override table combined.