diff options
author | László Németh <nemeth@numbertext.org> | 2019-10-02 14:57:16 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-03-05 10:59:00 +0100 |
commit | 53a11d841a2860e51125ccc5deb09a338b892902 (patch) | |
tree | 464083adabaff3f1aeb68ac308cc7b7369be56d8 | |
parent | tdf#81100 DOCX: keep "repeat table header" table style setting (diff) | |
download | core-53a11d841a2860e51125ccc5deb09a338b892902.tar.gz core-53a11d841a2860e51125ccc5deb09a338b892902.zip |
tdf#81100 DOCX import: repeat header according to table style
Table style based repeating table header wasn't repeated,
only direct table formatting.
(cherry picked from commit f9aac900ada3d507526eeeed5b51fc7a10ab4cae)
Conflicts:
sw/source/filter/ww8/docxattributeoutput.cxx
Change-Id: I119e6d32bf22c6c85a84aa42ae4cd6c5f60166b2
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf81100.docx | bin | 19329 -> 29760 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 29 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/dmapper/TblStylePrHandler.cxx | 1 |
6 files changed, 38 insertions, 14 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf81100.docx b/sw/qa/extras/ooxmlexport/data/tdf81100.docx Binary files differindex 61038d190c7e..cd46100f0556 100644 --- a/sw/qa/extras/ooxmlexport/data/tdf81100.docx +++ b/sw/qa/extras/ooxmlexport/data/tdf81100.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 0736171dcfb0..e22b5ac0466f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -938,6 +938,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81100, "tdf81100.docx") return; // keep "repeat table header" setting of table styles assertXPath(pXmlDoc, "/w:styles/w:style/w:tblStylePr/w:trPr/w:tblHeader", 4); + + xmlDocPtr pDump = parseLayoutDump(); + CPPUNIT_ASSERT_EQUAL(3, getPages()); + + // table starts on page 1 and finished on page 2 + // and it has got only a single repeating header line + assertXPath(pDump, "/root/page[2]/body/tab[1]", 1); + assertXPath(pDump, "/root/page[2]/body/tab[1]/row", 2); + assertXPath(pDump, "/root/page[3]/body/tab", 1); + if (!mbExported) // TODO export tblHeader=false + assertXPath(pDump, "/root/page[3]/body/tab/row", 1); } DECLARE_OOXMLEXPORT_TEST(testTdf121597TrackedDeletionOfMultipleParagraphs, "tdf121597.odt") diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0438a1e54caf..69e73dc6474e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3573,7 +3573,7 @@ void DocxAttributeOutput::StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t c if ( pTable->GetRowsToRepeat( ) > pTableTextNodeInfoInner->getRow( ) ) m_pSerializer->singleElementNS( XML_w, XML_tblHeader, FSNS( XML_w, XML_val ), "true", - FSEND ); + FSEND ); // TODO to overwrite table style may need explicit false TableRowRedline( pTableTextNodeInfoInner ); TableHeight( pTableTextNodeInfoInner ); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 349cf28f4284..a0b077282885 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -49,6 +49,18 @@ using namespace ::com::sun::star; using namespace ::std; #define DEF_BORDER_DIST 190 //0,19cm +#define CNF_FIRST_ROW 0x800 +#define CNF_LAST_ROW 0x400 +#define CNF_FIRST_COLUMN 0x200 +#define CNF_LAST_COLUMN 0x100 +#define CNF_ODD_VBAND 0x080 +#define CNF_EVEN_VBAND 0x040 +#define CNF_ODD_HBAND 0x020 +#define CNF_EVEN_HBAND 0x010 +#define CNF_FIRST_ROW_LAST_COLUMN 0x008 +#define CNF_FIRST_ROW_FIRST_COLUMN 0x004 +#define CNF_LAST_ROW_LAST_COLUMN 0x002 +#define CNF_LAST_ROW_FIRST_COLUMN 0x001 DomainMapperTableHandler::DomainMapperTableHandler( css::uno::Reference<css::text::XTextAppendAndConvert> const& xText, @@ -429,6 +441,10 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo m_aTableProperties->dumpXml(); TagLogger::getInstance().endElement(); #endif + // apply tblHeader setting of the table style + PropertyMapPtr pHeaderStyleProps = pTableStyle->GetProperties(CNF_FIRST_ROW); + if ( pHeaderStyleProps->getProperty(PROP_HEADER_ROW_COUNT) ) + m_aTableProperties->Insert(PROP_HEADER_ROW_COUNT, uno::makeAny( sal_Int32(1)), false); } } @@ -632,19 +648,6 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo return pTableStyle; } -#define CNF_FIRST_ROW 0x800 -#define CNF_LAST_ROW 0x400 -#define CNF_FIRST_COLUMN 0x200 -#define CNF_LAST_COLUMN 0x100 -#define CNF_ODD_VBAND 0x080 -#define CNF_EVEN_VBAND 0x040 -#define CNF_ODD_HBAND 0x020 -#define CNF_EVEN_HBAND 0x010 -#define CNF_FIRST_ROW_LAST_COLUMN 0x008 -#define CNF_FIRST_ROW_FIRST_COLUMN 0x004 -#define CNF_LAST_ROW_LAST_COLUMN 0x002 -#define CNF_LAST_ROW_FIRST_COLUMN 0x001 - CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(TableInfo & rInfo, std::vector<HorizontallyMergedCell>& rMerges) { #ifdef DEBUG_WRITERFILTER diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index bc38207bbbc5..2ee0a892cbe5 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -226,7 +226,16 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) insertTableProps(pPropMap); } else + { + if ( nIntValue == 0 && m_nRow == 0 ) + { + // explicit tblHeader=0 in the first row must overwrite table style + TablePropertyMapPtr pPropMap( new TablePropertyMap ); + pPropMap->Insert( PROP_HEADER_ROW_COUNT, uno::makeAny(sal_Int32(0))); + insertTableProps(pPropMap); + } m_nHeaderRepeat = -1; + } if (nIntValue) { // Store the info that this is a header, we'll need that when we apply table styles. diff --git a/writerfilter/source/dmapper/TblStylePrHandler.cxx b/writerfilter/source/dmapper/TblStylePrHandler.cxx index cc4654d5de34..b4603e30482e 100644 --- a/writerfilter/source/dmapper/TblStylePrHandler.cxx +++ b/writerfilter/source/dmapper/TblStylePrHandler.cxx @@ -162,6 +162,7 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm) break; case NS_ooxml::LN_CT_TrPrBase_tblHeader: { + m_pProperties->Insert( PROP_HEADER_ROW_COUNT, uno::makeAny(sal_Int32(1))); beans::PropertyValue aValue; aValue.Name = "tblHeader"; aValue.Value <<= true; |