[Libreoffice-commits] core.git: sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jul 20 13:25:42 UTC 2018
sw/qa/extras/ooxmlexport/data/tdf117504_numberingIndent.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 6 ++++
writerfilter/source/dmapper/PropertyMap.cxx | 15 ++++++-----
writerfilter/source/dmapper/PropertyMap.hxx | 8 ++---
writerfilter/source/dmapper/StyleSheetTable.cxx | 4 ++
5 files changed, 23 insertions(+), 10 deletions(-)
New commits:
commit 7f697ec27b1175ed94228155935d9ccd3cd5606c
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Thu Jul 12 23:24:25 2018 +0300
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Fri Jul 20 15:25:13 2018 +0200
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 at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf117504_numberingIndent.docx b/sw/qa/extras/ooxmlexport/data/tdf117504_numberingIndent.docx
index 091718984540..d86b0b4f1a77 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf117504_numberingIndent.docx and b/sw/qa/extras/ooxmlexport/data/tdf117504_numberingIndent.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 852e63114769..d45284d67a4e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -727,6 +727,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf117504_numberingIndent, "tdf117504_numberingInde
{
OUString sName = getProperty<OUString>(getParagraph(1), "NumberingStyleName");
CPPUNIT_ASSERT_MESSAGE("Paragraph has numbering style", !sName.isEmpty());
+
+ uno::Reference<beans::XPropertySet> xPropertySet(
+ getStyles("ParagraphStyles")->getByName("Revision"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(353), getProperty<sal_Int32>(xPropertySet, "ParaBottomMargin"));
+ xPropertySet.set(getStyles("ParagraphStyles")->getByName("Body Note"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPropertySet, "ParaBottomMargin"));
}
DECLARE_OOXMLEXPORT_TEST(testWatermark, "watermark.docx")
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
More information about the Libreoffice-commits
mailing list