summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2024-07-17 15:51:46 -0400
committerJustin Luth <jluth@mail.com>2024-07-19 02:49:18 +0200
commit965d83d3a729b0c01c882e200d8bf18dd347c027 (patch)
tree0de5c73ee950d8f63d2ea1221fc368117b28743a /sw/source
parente3dfb54117f5325d8f38f58ef892c2808d601e54 (diff)
related tdf#125469 writerfilter: support negative exact and atLeast
When vmiklos added support for negative auto -> FIX, he indicated that there was no documentation for it. commit f575f70b8303ba187f6989920281ff02e7a431c9 Author: Miklos Vajna on Thu Jun 22 13:41:30 2017 +0200 tdf#108682 DOCX import: fix <w:spacing w:line=...> for negative I didn't find UI in Word to create In working on bug 125469, I hand-crafted a nasty example document which had negative exact and atLeast examples, and this patch matches what I saw happening in Word 2010. Too bad MS isn't completely consistent... Change-Id: Iaab32aa3f0bbe90dfd0ef8973f9aefd2d6ca3fcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170671 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/writerfilter/dmapper/DomainMapper.cxx3
-rw-r--r--sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx19
-rw-r--r--sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx2
3 files changed, 19 insertions, 5 deletions
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 13ffe529d09d..8854e7ed9ece 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -2423,7 +2423,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
else if (aInheritedSpacing.Mode == style::LineSpacingMode::MINIMUM)
nLineRule = NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast;
- m_pImpl->SetLineSpacing(NS_ooxml::LN_CT_Spacing_lineRule, nLineRule);
+ const bool bNegativeFlip = nLineRule != NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact;
+ m_pImpl->SetLineSpacing(NS_ooxml::LN_CT_Spacing_lineRule, nLineRule, bNegativeFlip);
}
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, u"spacing"_ustr, m_pImpl->m_aSubInteropGrabBag);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index df28343d3186..83a9301c0738 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -5092,7 +5092,7 @@ bool DomainMapper_Impl::IsDiscardHeaderFooter() const
return m_bDiscardHeaderFooter;
}
-void DomainMapper_Impl::SetLineSpacing(const Id nName, sal_Int32 nIntValue)
+void DomainMapper_Impl::SetLineSpacing(const Id nName, sal_Int32 nIntValue, bool bNegativeFlip)
{
static const int nSingleLineSpacing = 240;
@@ -5142,12 +5142,25 @@ void DomainMapper_Impl::SetLineSpacing(const Id nName, sal_Int32 nIntValue)
== NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast)
{
appendGrabBag(m_aSubInteropGrabBag, u"lineRule"_ustr, u"atLeast"_ustr);
- aSpacing.Mode = style::LineSpacingMode::MINIMUM;
+ if (aSpacing.Height < 0)
+ {
+ aSpacing.Mode = style::LineSpacingMode::FIX;
+ aSpacing.Height *= -1;
+ }
+ else
+ aSpacing.Mode = style::LineSpacingMode::MINIMUM;
}
else // NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact
{
appendGrabBag(m_aSubInteropGrabBag, u"lineRule"_ustr, u"exact"_ustr);
- aSpacing.Mode = style::LineSpacingMode::FIX;
+ if (aSpacing.Height < 0)
+ {
+ if (bNegativeFlip)
+ aSpacing.Mode = style::LineSpacingMode::MINIMUM;
+ aSpacing.Height *= -1;
+ }
+ else
+ aSpacing.Mode = style::LineSpacingMode::FIX;
}
}
if (pTopContext)
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
index e63c64778b09..5646d8cf13b2 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
@@ -1222,7 +1222,7 @@ public:
void SetSpacingHadLine(bool bSet) { m_bSpacingHadLine = bSet; }
bool GetSpacingHadLineRule() const { return m_bSpacingHadLineRule; }
void SetSpacingHadLineRule(bool bSet) { m_bSpacingHadLineRule = bSet; }
- void SetLineSpacing(const Id nName, sal_Int32 nIntValue);
+ void SetLineSpacing(const Id nName, sal_Int32 nIntValue, bool bNegativeFlip = true);
/// Forget about the previous paragraph, as it's not inside the same
/// start/end node.