diff options
author | Luke Deller <luke@deller.id.au> | 2014-04-04 21:58:16 +1100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-04-06 16:53:04 +0200 |
commit | c78f918a7cb267a713804b8feacc3425196d4428 (patch) | |
tree | 519790f5f31858c29226f79995791096f9f6d018 /sw/source/filter/ww8/wrtww8.cxx | |
parent | 5fa564d4a95160dee96604ffa2c2b82246ce09f4 (diff) |
Full colour table borders in .doc export
Currently LO writes table cell border information to .doc files as part
of the "sprmTDefTable" property, but this only supports the WW8 (Word '97)
BRC (BoRder Control) structure which can only select from 16 colours.
There is no newer version of this property.
This commit adds output of an alternate property "sprmTSetBrc" which
specifies border details for a sequence of cells. There is a WW9
(Word 2000) version of this property supporting full colours.
For LO I have used the constant name NS_sprm::LN_TSetBorder following
the existing naming convention here, which is to use *Border for the WW9
version because *Brc is taken for the WW8 version.
Conflicts:
include/filter/msfilter/sprmids.hxx
Change-Id: Ie091d91c6d187e1c2542f59f58cec9a373a23e11
Diffstat (limited to 'sw/source/filter/ww8/wrtww8.cxx')
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 343e47cac173..1a666d0bb15e 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1953,6 +1953,7 @@ void WW8AttributeOutput::TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTa TableVerticalCell( pTableTextNodeInfoInner ); TableOrientation( pTableTextNodeInfoInner ); TableSpacing( pTableTextNodeInfoInner ); + TableCellBorders( pTableTextNodeInfoInner ); } } } @@ -2413,6 +2414,38 @@ void WW8AttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointe } } +void WW8AttributeOutput::TableCellBorders( + ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + if (!m_rWW8Export.bWrtWW8) + return; + + const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); + const SwTableLine * pTabLine = pTabBox->GetUpper(); + const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); + sal_uInt8 nBoxes = std::min<size_t>(rTabBoxes.size(), 255); + const SvxBoxItem * pLastBox = 0; + sal_uInt8 nSeqStart = 0; // start of sequence of cells with same borders + + // Detect sequences of cells which have the same borders, and output + // a border description for each such cell range. + for ( unsigned n = 0; n <= nBoxes; ++n ) + { + const SvxBoxItem * pBox = (n == nBoxes) ? 0 : + &rTabBoxes[n]->GetFrmFmt()->GetBox(); + if( !pLastBox ) + pLastBox = pBox; + else if( !pBox || *pLastBox != *pBox ) + { + // This cell has different borders than the previous cell, + // so output the borders for the preceding cell range. + m_rWW8Export.Out_CellRangeBorders(pLastBox, nSeqStart, n); + nSeqStart = n; + pLastBox = pBox; + } + } +} + void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); |