summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.docbin0 -> 10240 bytes
-rw-r--r--sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.docbin0 -> 22528 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx28
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx11
4 files changed, 35 insertions, 4 deletions
diff --git a/sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.doc b/sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.doc
new file mode 100644
index 000000000000..101b02a0b679
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/testTdf107931_KERN_DocEnabled_disabledDefStyle.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.doc b/sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.doc
new file mode 100644
index 000000000000..35f6371fbc54
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/testTdf107931_KERN_enabledDefStyle.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index bb70ccff0be0..98116014f8d4 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -47,6 +47,34 @@ DECLARE_WW8EXPORT_TEST(testTdf49102_mergedCellNumbering, "tdf49102_mergedCellNum
CPPUNIT_ASSERT_EQUAL( OUString("2."), parseDump("/root/page/body/tab/row[4]/cell/txt/Special[@nType='POR_NUMBER']", "rText") );
}
+DECLARE_WW8EXPORT_TEST(testTdf107931_KERN_DocEnabled_disabledDefStyle, "testTdf107931_KERN_DocEnabled_disabledDefStyle.doc")
+{
+ // Paragraph 3: the default style has kerning disabled
+ CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(3), 1), "CharAutoKerning"));
+ // Paragraph 4: style with kerning disabled
+ CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(4), 1), "CharAutoKerning"));
+ // Paragraph 5: style with kerning enabled
+ CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(5), 1), "CharAutoKerning"));
+ // Paragraph 6: directly applied character properties: kerning disabled
+ CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(6), 1), "CharAutoKerning"));
+ // Paragraph 7: directly applied character properties: kerning enabled
+ CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(7), 1), "CharAutoKerning"));
+}
+
+DECLARE_WW8EXPORT_TEST(testTdf107931_KERN_enabledDefStyle, "testTdf107931_KERN_enabledDefStyle.doc")
+{
+ // Paragraph 3: the default style has kerning enabled
+ CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(3), 1), "CharAutoKerning"));
+ // Paragraph 4: style with kerning disabled
+ CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(4), 1), "CharAutoKerning"));
+ // Paragraph 5: style with kerning enabled
+ CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(5), 1), "CharAutoKerning"));
+ // Paragraph 6: directly applied character properties: kerning disabled
+ CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(6), 1), "CharAutoKerning"));
+ // Paragraph 7: directly applied character properties: kerning enabled
+ CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(7), 1), "CharAutoKerning"));
+}
+
DECLARE_WW8EXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.doc")
{
// the paragraph style should set table's text-flow break-before-page
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index e62807df07ad..e0af6f6d076b 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -3915,12 +3915,15 @@ void SwWW8ImplReader::Read_Kern( sal_uInt16, const sal_uInt8* pData, short nLen
NewAttr( SvxKerningItem( nKern, RES_CHRATR_KERNING ) );
}
-void SwWW8ImplReader::Read_FontKern( sal_uInt16, const sal_uInt8* , short nLen )
+void SwWW8ImplReader::Read_FontKern( sal_uInt16, const sal_uInt8* pData, short nLen )
{
- if (nLen < 0) // end of attribute
+ if (nLen < 2) // end of attribute
+ {
m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_AUTOKERN );
- else
- NewAttr(SvxAutoKernItem(true, RES_CHRATR_AUTOKERN));
+ return;
+ }
+ sal_Int16 nAutoKern = SVBT16ToShort( pData ); // Kerning in Twips
+ NewAttr(SvxAutoKernItem((bool)nAutoKern, RES_CHRATR_AUTOKERN));
}
void SwWW8ImplReader::Read_CharShadow( sal_uInt16, const sal_uInt8* pData, short nLen )