summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf108682.docxbin0 -> 12653 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx11
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx16
3 files changed, 24 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf108682.docx b/sw/qa/extras/ooxmlexport/data/tdf108682.docx
new file mode 100644
index 000000000000..1364025b826c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf108682.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 39af9d435af7..93f3f320f27d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -25,6 +25,8 @@
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/view/XViewSettingsSupplier.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
@@ -694,6 +696,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107618, "tdf107618.doc")
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPageStyle, "HeaderIsOn"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf108682, "tdf108682.docx")
+{
+ auto aLineSpacing = getProperty<style::LineSpacing>(getParagraph(1), "ParaLineSpacing");
+ // This was style::LineSpacingMode::PROP.
+ CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::FIX, aLineSpacing.Mode);
+ // 260 twips in mm100, this was a negative value.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(459), aLineSpacing.Height);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 67bd4648e42f..7253ae190581 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -453,9 +453,19 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
if( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_LineSpacingRule_auto)
{
m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "lineRule", "auto");
- aSpacing.Mode = style::LineSpacingMode::PROP;
- //reinterpret the already set value
- aSpacing.Height = sal_Int16( aSpacing.Height * 100 / ConversionHelper::convertTwipToMM100( nSingleLineSpacing ));
+ if (aSpacing.Height >= 0)
+ {
+ aSpacing.Mode = style::LineSpacingMode::PROP;
+ //reinterpret the already set value
+ aSpacing.Height = sal_Int16( aSpacing.Height * 100 / ConversionHelper::convertTwipToMM100( nSingleLineSpacing ));
+ }
+ else
+ {
+ // Negative value still means a positive height,
+ // just the mode is "exact".
+ aSpacing.Mode = style::LineSpacingMode::FIX;
+ aSpacing.Height *= -1;
+ }
}
else if( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast)
{