[Libreoffice-commits] core.git: sw/qa writerfilter/source
Justin Luth
justin_luth at sil.org
Tue Aug 15 19:18:25 UTC 2017
sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 16 ++++++++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 +-
3 files changed, 17 insertions(+), 1 deletion(-)
New commits:
commit ddb8f498a336cb6a76a06bb65406579e50447d39
Author: Justin Luth <justin_luth at sil.org>
Date: Tue Aug 15 12:05:21 2017 -0400
tdf#109318 writerfilter: don't increment DropCap lines
I have no idea why the original implementation used ++nLines
when setting aDrop.Lines. Unchanged since mass import from OOo in
2008 commit 614f53dda31f14fe89303dc1809fc29350c1ba29.
Change-Id: If427dcea815e91d2cccb2c11044cdb393bff09e3
Reviewed-on: https://gerrit.libreoffice.org/41184
Reviewed-by: Justin Luth <justin_luth at sil.org>
Tested-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docx b/sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docx
new file mode 100644
index 000000000000..207c789a2db7
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 796f1234dd3e..b030043eed24 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/style/BreakType.hpp>
+#include <com/sun/star/style/DropCapFormat.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
@@ -725,6 +726,21 @@ DECLARE_OOXMLIMPORT_TEST(testTdf75573_lostTable, "tdf75573_lostTable.docx")
CPPUNIT_ASSERT_EQUAL_MESSAGE("# of pages", 3, getPages() );
}
+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 );
+
+ xSet.set(getParagraph(2), uno::UNO_QUERY);
+ aDropCap = getProperty<css::style::DropCapFormat>(xSet,"DropCapFormat");
+ CPPUNIT_ASSERT_EQUAL( sal_Int8(3), aDropCap.Lines );
+
+ xSet.set(getParagraph(3), uno::UNO_QUERY);
+ aDropCap = getProperty<css::style::DropCapFormat>(xSet,"DropCapFormat");
+ CPPUNIT_ASSERT_EQUAL( sal_Int8(4), aDropCap.Lines );
+}
+
DECLARE_OOXMLIMPORT_TEST(lineWpsOnly, "line-wps-only.docx")
{
uno::Reference<drawing::XShape> xShape = getShape(1);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f94d3687e149..2c282ecc394a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1122,7 +1122,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
//handles (4) and part of (5)
//create a DropCap property, add it to the property sequence of finishParagraph
sal_Int32 nLines = rAppendContext.pLastParagraphProperties->GetLines();
- aDrop.Lines = nLines > 0 && nLines < 254 ? (sal_Int8)++nLines : 2;
+ aDrop.Lines = nLines > 0 && nLines < SAL_MAX_INT8 ? (sal_Int8)nLines : 2;
aDrop.Count = rAppendContext.pLastParagraphProperties->GetDropCapLength();
aDrop.Distance = 0; //TODO: find distance value
//completes (5)
More information about the Libreoffice-commits
mailing list