summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric@lanedo.com>2013-01-22 17:20:02 +0100
committerPierre-Eric Pelloux-Prayer <pierre-eric@lanedo.com>2013-01-22 17:22:01 +0100
commitf88c296212ac39055d2179ecf6e19f9f3848a032 (patch)
tree9ce2079536c87511107a6f55f85ae96556ac9227 /sw
parentec8ff9ff68622a510319c404f4745a336e65d314 (diff)
docx export: fix table 'tblInd' attribute computation
Change-Id: I3980ad8e372290973ed89488eb540267136af491
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx17
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx2
2 files changed, 13 insertions, 6 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0e82f7fd3c89..89a72bbadfbc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1833,6 +1833,16 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
else
pJcVal = "start";
nIndent = sal_Int32( pTblFmt->GetLRSpace( ).GetLeft( ) );
+ // Table indentation has different meaning in Word, depending if the table is nested or not.
+ // If nested, tblInd is added to parent table's left spacing and defines left edge position
+ // If not nested, text position of left-most cell must be at absolute X = tblInd
+ // so, table_spacing + table_spacing_to_content = tblInd
+ if (m_nTableDepth == 0)
+ {
+ const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
+ const SwFrmFmt * pFrmFmt = pTabBox->GetFrmFmt();
+ nIndent += sal_Int32( pFrmFmt->GetBox( ).GetDistance( BOX_LINE_LEFT ) );
+ }
break;
}
}
@@ -1844,7 +1854,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
TableDefaultBorders( pTableTextNodeInfoInner );
// Output the default cell margins
- TableDefaultCellMargins( pTableTextNodeInfoInner, nIndent );
+ TableDefaultCellMargins( pTableTextNodeInfoInner );
TableBidi( pTableTextNodeInfoInner );
@@ -1886,7 +1896,7 @@ void DocxAttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Point
impl_pageBorders( m_pSerializer, pFrmFmt->GetBox( ), XML_tblBorders, !bEcma, true );
}
-void DocxAttributeOutput::TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner, sal_Int32& tblIndent )
+void DocxAttributeOutput::TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
const SwFrmFmt * pFrmFmt = pTabBox->GetFrmFmt();
@@ -1894,9 +1904,6 @@ void DocxAttributeOutput::TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::P
const bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
impl_cellMargins(m_pSerializer, rBox, XML_tblCellMar, !bEcma);
-
- // add table cell left margin to tblIndent
- tblIndent += sal_Int32( rBox.GetDistance( BOX_LINE_LEFT ) );
}
void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 26b43ac286fe..91539b5459c6 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -148,7 +148,7 @@ public:
virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
- virtual void TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner, sal_Int32& tblIndent );
+ virtual void TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );