diff options
author | Justin Luth <justin.luth@collabora.com> | 2018-07-12 23:24:25 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-07-20 15:25:13 +0200 |
commit | 7f697ec27b1175ed94228155935d9ccd3cd5606c (patch) | |
tree | c35ade1d77fbbd29613c9199e0847607c56c3c1b /writerfilter | |
parent | loplugin:useuniqueptr in HTMLTable (diff) | |
download | core-7f697ec27b1175ed94228155935d9ccd3cd5606c.tar.gz core-7f697ec27b1175ed94228155935d9ccd3cd5606c.zip |
tdf#103961 writerfilter: parentless styles need pPrDefault(s)
It is possible for paragraph styles to be based on -none-.
In those cases, the DocDefaults must be applied.
Change-Id: I5b3458384c6473f3aaf64e5f274372d291ff824d
Reviewed-on: https://gerrit.libreoffice.org/57371
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 15 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.hxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 4 |
3 files changed, 17 insertions, 10 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index a24ae3d41270..46b846289219 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -317,20 +317,23 @@ void PropertyMap::dumpXml() const } #endif -void PropertyMap::InsertProps( const PropertyMapPtr& rMap ) +void PropertyMap::InsertProps( const PropertyMapPtr& rMap, const bool bOverwrite ) { if ( rMap ) { for ( const auto& rPropPair : rMap->m_vMap ) - m_vMap[rPropPair.first] = rPropPair.second; + { + if ( bOverwrite || !m_vMap.count(rPropPair.first) ) + m_vMap[rPropPair.first] = rPropPair.second; + } - insertTableProperties( rMap.get() ); + insertTableProperties( rMap.get(), bOverwrite ); Invalidate(); } } -void PropertyMap::insertTableProperties( const PropertyMap* ) +void PropertyMap::insertTableProperties( const PropertyMap*, const bool ) { #ifdef DEBUG_WRITERFILTER TagLogger::getInstance().element( "PropertyMap.insertTableProperties" ); @@ -1825,7 +1828,7 @@ void TablePropertyMap::setValue( TablePropertyMapTarget eWhich, sal_Int32 nSet ) OSL_FAIL( "invalid TablePropertyMapTarget" ); } -void TablePropertyMap::insertTableProperties( const PropertyMap* pMap ) +void TablePropertyMap::insertTableProperties( const PropertyMap* pMap, const bool bOverwrite ) { #ifdef DEBUG_WRITERFILTER TagLogger::getInstance().startElement( "TablePropertyMap.insertTableProperties" ); @@ -1838,7 +1841,7 @@ void TablePropertyMap::insertTableProperties( const PropertyMap* pMap ) for ( sal_Int32 eTarget = TablePropertyMapTarget_START; eTarget < TablePropertyMapTarget_MAX; ++eTarget ) { - if ( pSource->m_aValidValues[eTarget].bValid ) + if ( pSource->m_aValidValues[eTarget].bValid && (bOverwrite || !m_aValidValues[eTarget].bValid) ) { m_aValidValues[eTarget].bValid = true; m_aValidValues[eTarget].nValue = pSource->m_aValidValues[eTarget].nValue; diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index c20951c624c9..91e182d3997f 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -141,8 +141,8 @@ public: // Remove a named property from *this, does nothing if the property id has not been set void Erase( PropertyIds eId); - // Imports properties from pMap, overwriting those with the same PropertyIds as the current map - void InsertProps( const tools::SvRef< PropertyMap >& rMap ); + // Imports properties from pMap + void InsertProps( const tools::SvRef< PropertyMap >& rMap, const bool bOverwrite = true ); // Returns a copy of the property if it exists, .first is its PropertyIds and .second is its Value (type css::uno::Any) boost::optional< Property > getProperty( PropertyIds eId ) const; @@ -154,7 +154,7 @@ public: void SetFootnote( const css::uno::Reference< css::text::XFootnote >& xF ) { m_xFootnote = xF; } - virtual void insertTableProperties( const PropertyMap* ); + virtual void insertTableProperties( const PropertyMap*, const bool bOverwrite = true ); const std::vector< RedlineParamsPtr >& Redlines() const { return m_aRedlines; } @@ -557,7 +557,7 @@ public: bool getValue( TablePropertyMapTarget eWhich, sal_Int32& nFill ); void setValue( TablePropertyMapTarget eWhich, sal_Int32 nSet ); - virtual void insertTableProperties( const PropertyMap* ) override; + virtual void insertTableProperties( const PropertyMap*, const bool bOverwrite = true ) override; }; typedef tools::SvRef< TablePropertyMap > TablePropertyMapPtr; diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index ad1aa6e148b5..4780ceefb829 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -994,6 +994,10 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) } else if( bParaStyle ) { + // Paragraph styles that don't inherit from some parent need to apply the DocDefaults + if ( sConvertedStyleName != "Standard" ) + pEntry->pProperties->InsertProps( m_pImpl->m_pDefaultParaProps, /*bAllowOverwrite=*/false ); + //now it's time to set the default parameters - for paragraph styles //Fonts: Western first entry in font table //CJK: second entry |