diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-11-25 16:59:56 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-11-25 17:32:36 +0100 |
commit | 74bf915fb48c660bd1e3a04bec6c3a20c754b6af (patch) | |
tree | b8d253c03e97329d4ae26d28bca80e55f4cb52fe /writerfilter | |
parent | 1581b1fc3ac82a7bd62df968226e98604a4ca52d (diff) |
DOCX import: tblHeader implies firstRow
If a table row is marked as tblHeader, then the firstRow section of the
table style should be applied, even if that row is in fact not the first
row.
Change-Id: I10605f404160e72c620e9204503203fea1c6d6d8
Diffstat (limited to 'writerfilter')
4 files changed, 17 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index a8e51b079cb5..1a9ad2d063dc 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -562,6 +562,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl //it's a uno::Sequence< beans::PropertyValues >* RowPropertyValuesSeq_t* pCellProperties = aCellProperties.getArray(); + PropertyMapVector1::const_iterator aRowIter = m_aRowProperties.begin(); while( aRowOfCellsIterator != aRowOfCellsIteratorEnd ) { //aRowOfCellsIterator points to a vector of PropertyMapPtr @@ -580,6 +581,8 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl if(rInfo.nTblLook&0x40) nRowStyleMask |= CNF_LAST_ROW; // last row style used } + else if (aRowIter->get() && aRowIter->get()->find(PROP_TBL_HEADER) != aRowIter->get()->end()) + nRowStyleMask |= CNF_FIRST_ROW; // table header implies first row if(!nRowStyleMask) // if no row style used yet { // banding used only if not first and or last row style used @@ -729,6 +732,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl #endif ++nRow; ++aRowOfCellsIterator; + ++aRowIter; } #ifdef DEBUG_DMAPPER_TABLE_HANDLER @@ -758,6 +762,10 @@ RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties() //set default to 'break across pages" if( aRowIter->get()->find(PROP_IS_SPLIT_ALLOWED) == aRowIter->get()->end()) aRowIter->get()->Insert( PROP_IS_SPLIT_ALLOWED, uno::makeAny(sal_True ) ); + // tblHeader is only our property, remove before the property map hits UNO + PropertyMap::const_iterator aIter = aRowIter->get()->find(PROP_TBL_HEADER); + if (aIter != aRowIter->get()->end()) + aRowIter->get()->erase(aIter); aRowProperties[nRow] = (*aRowIter)->GetPropertyValues(); #ifdef DEBUG_DMAPPER_TABLE_HANDLER diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index ac75e073fc85..7db941d07ad8 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -201,6 +201,13 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) } else m_nHeaderRepeat = -1; + if (nIntValue) + { + // Store the info that this is a header, we'll need that when we apply table styles. + TablePropertyMapPtr pPropMap( new TablePropertyMap ); + pPropMap->Insert( PROP_TBL_HEADER, uno::makeAny(nIntValue)); + insertRowProps(pPropMap); + } break; case 0xd608: // TDefTable { diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index b2848552308a..4b05efae8419 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -344,6 +344,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_SURROUND_TEXT_WRAP_SMALL: sName = "SurroundTextWrapSmall"; break; case PROP_PARA_SHADOW_FORMAT: sName = "ParaShadowFormat"; break; case PROP_FOOTNOTE_LINE_RELATIVE_WIDTH: sName = "FootnoteLineRelativeWidth"; break; + case PROP_TBL_HEADER: sName = "TblHeader"; break; } ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index ee5045db6b3a..0de35ceea569 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -315,6 +315,7 @@ enum PropertyIds ,PROP_FOOTNOTE_LINE_RELATIVE_WIDTH ,PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING ,PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING + ,PROP_TBL_HEADER }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier |