diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/kern.docx (renamed from sw/qa/extras/ooxmlimport/data/kern.docx) | bin | 12832 -> 12832 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 18 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 7 |
4 files changed, 23 insertions, 9 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/kern.docx b/sw/qa/extras/ooxmlexport/data/kern.docx Binary files differindex b66130d38d03..b66130d38d03 100644 --- a/sw/qa/extras/ooxmlimport/data/kern.docx +++ b/sw/qa/extras/ooxmlexport/data/kern.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 7370fe83da3d..73077b4fe40a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -91,10 +91,25 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106970, "tdf106970.docx") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494), getProperty<sal_Int32>(getParagraph(4), "ParaBottomMargin")); } +DECLARE_OOXMLEXPORT_TEST(testKern, "kern.docx") +{ + CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(1), 1), "CharAutoKerning")); + // This failed: kerning was also enabled for the second paragraph. + CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(2), 1), "CharAutoKerning")); + + uno::Reference<beans::XPropertySet> xStyle(getStyles("ParagraphStyles")->getByName("Default Style"), uno::UNO_QUERY); + //tdf107801: kerning normally isn't enabled by default for .docx + CPPUNIT_ASSERT_EQUAL_MESSAGE("AutoKern should be false", false, getProperty<bool>(xStyle, "CharAutoKerning")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.docx") { // the paragraph style should set table's text-flow break-before-page CPPUNIT_ASSERT_EQUAL( 3, getPages() ); + + uno::Reference<beans::XPropertySet> xStyle(getStyles("ParagraphStyles")->getByName("Default Style"), uno::UNO_QUERY); + //tdf107801: kerning info wasn't exported previously. + CPPUNIT_ASSERT_EQUAL_MESSAGE("AutoKern should be true", true, getProperty<bool>(xStyle, "CharAutoKerning")); } DECLARE_OOXMLEXPORT_TEST(testTdf104420, "tdf104420_lostParagraph.docx") @@ -358,6 +373,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx") xTextField->getPropertyValue("Content") >>= sContent; // Comment in the first paragraph should not have smiley ( 0xf04a ). CPPUNIT_ASSERT_EQUAL( sal_Int32( -1 ) , sContent.indexOf( u'\xf04a' )); + + // this document has a w:kern setting in the DocDefault character properties. Ensure it applies. + CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(1), 1), "CharAutoKerning")); } DECLARE_OOXMLEXPORT_TEST(testTdf99227, "tdf99227.docx") diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index a314b212b81a..87ccce61d9b5 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -669,13 +669,6 @@ DECLARE_OOXMLIMPORT_TEST(testN820504, "n820504.docx") CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); } -DECLARE_OOXMLIMPORT_TEST(testKern, "kern.docx") -{ - CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(1), 1), "CharAutoKerning")); - // This failed: kerning was also enabled for the second paragraph. - CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(2), 1), "CharAutoKerning")); -} - DECLARE_OOXMLIMPORT_TEST(testFdo43641, "fdo43641.docx") { uno::Reference<container::XIndexAccess> xGroupShape(getShape(1), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 83dfe43b5372..f82667c6ed2c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6483,9 +6483,12 @@ void DocxAttributeOutput::CharWeight( const SvxWeightItem& rWeight ) m_pSerializer->singleElementNS( XML_w, XML_b, FSNS( XML_w, XML_val ), "false", FSEND ); } -void DocxAttributeOutput::CharAutoKern( const SvxAutoKernItem& ) +void DocxAttributeOutput::CharAutoKern( const SvxAutoKernItem& rAutoKern ) { - SAL_INFO("sw.ww8", "TODO DocxAttributeOutput::CharAutoKern()" ); + // auto kerning is bound to a minimum font size in Word - but is just a boolean in Writer :-( + // kerning is based on half-point sizes, so 2 enables kerning for fontsize 1pt or higher. (1 is treated as size 12, and 0 is treated as disabled.) + const OString sFontSize = OString::number( (sal_uInt32) rAutoKern.GetValue() * 2 ); + m_pSerializer->singleElementNS(XML_w, XML_kern, FSNS( XML_w, XML_val ), sFontSize.getStr(), FSEND ); } void DocxAttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink ) |