diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-05-18 18:48:38 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-05-23 10:12:25 +0200 |
commit | 281fba83860c9635ac7b9b00286b68270abf3c27 (patch) | |
tree | 1cfc20c2f434e091fb5aa040354edcb8689bf3a5 /filter | |
parent | 20bf87c6a3a076fe78f938b7a3086146336976e7 (diff) |
tdf#35798: Hide empty Database fields' paragraphs (+ compat option)
With this change, Database fields that expand to empty values behave
as if they are "Hidden Paragraph" fields.
A compatibility option to enable this behaviour is added. The option is
enabled by default, and for any non-native documents (for compatibility
with other office suites). For existing (F)ODT documents, the option is
disabled for those documents that don't have this setting set, to keep
the layout of legacy documents.
Change-Id: Ic5e8cb15a3a7d1a765a984eef4b0d97666df7dfd
Reviewed-on: https://gerrit.libreoffice.org/54552
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/54661
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx index 88d829dead0b..bf1b0b2ea427 100644 --- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx +++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx @@ -96,12 +96,25 @@ bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< css::beans::Property PropertyMapEntry aImportInfoMap[] = { { OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, + { OUString("DefaultDocumentSettings"), 0, + ::cppu::UnoType<Sequence<PropertyValue>>::get(), PropertyAttribute::MAYBEVOID, 0 }, { OUString(), 0, css::uno::Type(), 0, 0 } }; Reference< XPropertySet > xInfoSet( GenericPropertySet_CreateInstance( new PropertySetInfo( aImportInfoMap ) ) ); xInfoSet->setPropertyValue( "BaseURI", makeAny( aBaseURI )); + + OUString aFilterName; + auto It = aMediaMap.find(OUString("FilterName")); + if (It != aMediaMap.end() && (It->second >>= aFilterName) + && aFilterName == "OpenDocument Text Flat XML") + { + PropertyValue EmptyDbFieldHidesPara("EmptyDbFieldHidesPara", 0, Any(false), + PropertyState::PropertyState_DIRECT_VALUE); + Sequence<PropertyValue> aSettings{ EmptyDbFieldHidesPara }; + xInfoSet->setPropertyValue("DefaultDocumentSettings", makeAny(aSettings)); + } aAnys[0] <<= xInfoSet; |