summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-08-15 12:05:21 -0400
committerJustin Luth <justin_luth@sil.org>2017-08-15 21:16:56 +0200
commitddb8f498a336cb6a76a06bb65406579e50447d39 (patch)
tree9ddf380d75d3d12763c9b90b5ea342795d0fda5c
parentf9af8a35fc1aad055af2b5e6b6eab45a7d060719 (diff)
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@sil.org> Tested-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docxbin0 -> 13058 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx16
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx2
3 files changed, 17 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf109316_dropCaps.docx
Binary files 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)