From 73e7619d903d5fc79ea339ab2c5b4c1ef3cf326e Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Tue, 15 Aug 2017 12:39:05 -0400 Subject: tdf#109319 writerfilter: set DropCap.Distance Change-Id: I3ec06e9a196897c095f227e9f765243c6c188898 Reviewed-on: https://gerrit.libreoffice.org/41185 Tested-by: Jenkins Reviewed-by: Justin Luth --- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 6 ++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index b030043eed24..2c2da5e9e7f3 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -731,14 +731,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf109316_dropCaps, "tdf109316_dropCaps.docx") uno::Reference xSet(getParagraph(1), uno::UNO_QUERY); css::style::DropCapFormat aDropCap = getProperty(xSet,"DropCapFormat"); CPPUNIT_ASSERT_EQUAL( sal_Int8(2), aDropCap.Lines ); + CPPUNIT_ASSERT_EQUAL( sal_Int8(1), aDropCap.Count ); + CPPUNIT_ASSERT_EQUAL( sal_Int16(1270), aDropCap.Distance ); xSet.set(getParagraph(2), uno::UNO_QUERY); aDropCap = getProperty(xSet,"DropCapFormat"); CPPUNIT_ASSERT_EQUAL( sal_Int8(3), aDropCap.Lines ); + CPPUNIT_ASSERT_EQUAL( sal_Int8(1), aDropCap.Count ); + CPPUNIT_ASSERT_EQUAL( sal_Int16(508), aDropCap.Distance ); xSet.set(getParagraph(3), uno::UNO_QUERY); aDropCap = getProperty(xSet,"DropCapFormat"); CPPUNIT_ASSERT_EQUAL( sal_Int8(4), aDropCap.Lines ); + CPPUNIT_ASSERT_EQUAL( sal_Int8(7), aDropCap.Count ); + CPPUNIT_ASSERT_EQUAL( sal_Int16(0), aDropCap.Distance ); } DECLARE_OOXMLIMPORT_TEST(lineWpsOnly, "line-wps-only.docx") diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 2c282ecc394a..589dbf1b6770 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1124,7 +1124,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap ) sal_Int32 nLines = rAppendContext.pLastParagraphProperties->GetLines(); aDrop.Lines = nLines > 0 && nLines < SAL_MAX_INT8 ? (sal_Int8)nLines : 2; aDrop.Count = rAppendContext.pLastParagraphProperties->GetDropCapLength(); - aDrop.Distance = 0; //TODO: find distance value + sal_Int32 nHSpace = rAppendContext.pLastParagraphProperties->GethSpace(); + aDrop.Distance = nHSpace > 0 && nHSpace < SAL_MAX_INT16 ? (sal_Int16)nHSpace : 0; //completes (5) if( pParaContext->IsFrameMode() ) pToBeSavedProperties.reset( new ParagraphProperties(*pParaContext) ); -- cgit v1.2.3