diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx index fc97dc78413b..d31bb3b1f269 100644 --- a/include/oox/vml/vmltextbox.hxx +++ b/include/oox/vml/vmltextbox.hxx @@ -54,6 +54,7 @@ struct OOX_DLLPUBLIC TextFontModel OptValue< bool > mobBold; OptValue< bool > mobItalic; OptValue< bool > mobStrikeout; + OptValue monSpacing; explicit TextFontModel(); }; diff --git a/oox/source/vml/vmltextbox.cxx b/oox/source/vml/vmltextbox.cxx index 553b6f05a34c..fbd821727883 100644 --- a/oox/source/vml/vmltextbox.cxx +++ b/oox/source/vml/vmltextbox.cxx @@ -20,6 +20,7 @@ #include "oox/vml/vmltextbox.hxx" #include +#include #include #include #include @@ -92,6 +93,15 @@ void TextBox::convert(uno::Reference xShape) const aPropertyValue.Value = uno::makeAny(double(rFont.monSize.get()) / 2.); aPropVec.push_back(aPropertyValue); } + if (rFont.monSpacing.has()) + { + aPropertyValue.Name = "CharKerning"; + // Value is not converted to mm100: SvxKerningItem::PutValue() gets + // called with nMemberId = 0, so no mm100 -> twips conversion will + // be done there. + aPropertyValue.Value = uno::makeAny(sal_Int16(rFont.monSpacing.get())); + aPropVec.push_back(aPropertyValue); + } if (rParagraph.moParaAdjust.has()) { style::ParagraphAdjust eAdjust = style::ParagraphAdjust_LEFT; diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx index 2720450698a2..5c7e2f751ffb 100644 --- a/oox/source/vml/vmltextboxcontext.cxx +++ b/oox/source/vml/vmltextboxcontext.cxx @@ -132,6 +132,16 @@ void TextPortionContext::onStartElement(const AttributeList& rAttribs) case OOX_TOKEN(doc, color): maFont.moColor = rAttribs.getString( OOX_TOKEN(doc, val) ); break; + case OOX_TOKEN(doc, spacing): + maFont.monSpacing = rAttribs.getInteger(OOX_TOKEN(doc, val)); + break; + case OOX_TOKEN(doc, r): + case OOX_TOKEN(doc, rPr): + case OOX_TOKEN(doc, t): + break; + default: + SAL_INFO("oox", "unhandled: 0x" << std::hex<< getCurrentElement()); + break; } } diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx b/sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx new file mode 100755 index 000000000000..072984779d72 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 08b2bfcba189..b933e856b58d 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -132,6 +132,7 @@ public: void testTablePagebreak(); void testFdo68607(); void testVmlTextVerticalAdjust(); + void testGroupshapeSdt(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -230,6 +231,7 @@ void Test::run() {"table-pagebreak.docx", &Test::testTablePagebreak}, {"fdo68607.docx", &Test::testFdo68607}, {"vml-text-vertical-adjust.docx", &Test::testVmlTextVerticalAdjust}, + {"groupshape-sdt.docx", &Test::testGroupshapeSdt}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1551,6 +1553,20 @@ void Test::testVmlTextVerticalAdjust() CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty(xShape, "TextVerticalAdjust")); } +void Test::testGroupshapeSdt() +{ + // All problems here are due to the groupshape: we have a drawinglayer rectangle, not a writer textframe. + uno::Reference xOuterGroupShape(getShape(1), uno::UNO_QUERY); + uno::Reference xInnerGroupShape(xOuterGroupShape->getByIndex(0), uno::UNO_QUERY); + uno::Reference xShape(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY); + // Border distances were not implemented, this was 0. + CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty(xShape, "TextUpperDistance")); + // Sdt field result wasn't imported, this was "". + CPPUNIT_ASSERT_EQUAL(OUString("placeholder text"), xShape->getString()); + // w:spacing was ignored in oox, this was 0. + CPPUNIT_ASSERT_EQUAL(sal_Int32(20), getProperty(getRun(getParagraphOfText(1, xShape->getText()), 1), "CharKerning")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT();