summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-08-15 12:39:05 -0400
committerJustin Luth <justin_luth@sil.org>2017-08-15 21:50:21 +0200
commit73e7619d903d5fc79ea339ab2c5b4c1ef3cf326e (patch)
tree4ef802462291822f96bc31e91ad4911d6ff5e7c4
parentb72766bc4d9be138063bedda00a7b98573505784 (diff)
tdf#109319 writerfilter: set DropCap.Distance
Change-Id: I3ec06e9a196897c095f227e9f765243c6c188898 Reviewed-on: https://gerrit.libreoffice.org/41185 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx6
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx3
2 files changed, 8 insertions, 1 deletions
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<beans::XPropertySet> xSet(getParagraph(1), uno::UNO_QUERY);
css::style::DropCapFormat aDropCap = getProperty<css::style::DropCapFormat>(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<css::style::DropCapFormat>(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<css::style::DropCapFormat>(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) );