diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-04-11 08:54:36 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-04-18 20:15:38 +0200 |
commit | 20765811a89cd37f978674e1188d949be31813ea (patch) | |
tree | 88688c30578552f42fc9b2ed57cf0800cc5e0343 /writerfilter | |
parent | d9db45db3f0741f1d7a6584e0b4d34efc236b717 (diff) |
tdf#106970 DOCX import: don't collapse para auto space for different nums
Commit 1bf7f6a1a50ee9f24a3687240fe6ae390b905a6b (tdf#106690 DOCX import:
fix automatic spacing before/after numbered para block, 2017-04-04) made
sure that autospacing is only collapsed in case the adjacent text nodes
both have a numbering rule.
It turns out there is an additional condition: even if both text nodes
have a numbering rule, do the collapsing only in case they have the same
numbering rule.
(cherry picked from commit e1c83d0514e6123faa50ad0a7aa6a9031b271c9a)
Change-Id: Idb7a2b24d7eaa9094cc36f86b8a483045a33d028
Reviewed-on: https://gerrit.libreoffice.org/36510
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
(cherry picked from commit e57873156d3c04ecc34bb5f38b186ebe29567f0c)
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 236436cbd362..a9473ef74c68 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1178,10 +1178,22 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap ) }); if (itNumberingRules != aProperties.end()) { - // This textnode has numbering. - if (m_xPreviousParagraph.is() && m_xPreviousParagraph->getPropertyValue("NumberingRules").hasValue()) + // This textnode has numbering. Look up the numbering style name of the current and previous paragraph. + OUString aCurrentNumberingRuleName; + uno::Reference<container::XNamed> xCurrentNumberingRules(itNumberingRules->Value, uno::UNO_QUERY); + if (xCurrentNumberingRules.is()) + aCurrentNumberingRuleName = xCurrentNumberingRules->getName(); + OUString aPreviousNumberingRuleName; + if (m_xPreviousParagraph.is()) { - // There was a previous textnode and it had numbering. + uno::Reference<container::XNamed> xPreviousNumberingRules(m_xPreviousParagraph->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + if (xPreviousNumberingRules.is()) + aPreviousNumberingRuleName = xPreviousNumberingRules->getName(); + } + + if (!aPreviousNumberingRuleName.isEmpty() && aCurrentNumberingRuleName == aPreviousNumberingRuleName) + { + // There was a previous textnode and it had the same numbering. if (m_bParaAutoBefore) { // This before spacing is set to auto, set before space to 0. |