diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2017-05-31 00:03:06 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2017-06-10 20:02:52 +0200 |
commit | e3426d9a628fe3ba1cd2cb3d765c3199f9db4de7 (patch) | |
tree | 3c71d4873f95010bf600f3a6b62cd0a917fb0cf0 | |
parent | fdc9bdb8a7b4e432022079b593023b0e28746cae (diff) |
Watermark: VML export/import font size
Change-Id: I11409dfc621018a761c70a640938e18ae679d3f5
Reviewed-on: https://gerrit.libreoffice.org/38254
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | include/oox/vml/vmlformatting.hxx | 3 | ||||
-rw-r--r-- | oox/source/export/vmlexport.cxx | 7 | ||||
-rw-r--r-- | oox/source/vml/vmlformatting.cxx | 12 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/watermark-font.docx | bin | 10705 -> 18824 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport2.cxx | 5 |
6 files changed, 26 insertions, 3 deletions
diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx index efb0e6606887..7ec10d42b4ff 100644 --- a/include/oox/vml/vmlformatting.hxx +++ b/include/oox/vml/vmlformatting.hxx @@ -246,7 +246,8 @@ struct OOX_DLLPUBLIC TextpathModel TextpathModel(); /** Writes the properties to the passed property map. */ - void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const css::uno::Reference<css::drawing::XShape>& xShape) const; + void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const css::uno::Reference<css::drawing::XShape>& xShape, + const GraphicHelper& rGraphicHelper) const; }; } // namespace vml diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 8ba7d9fb492f..7b8bb01b8f6b 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -822,6 +822,13 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect OUString aTextPathFont = SvxMSDffManager::MSDFFReadZString(aStream, aFont.nPropSize, true); aStyle += "font-family:\"" + aTextPathFont + "\""; } + sal_uInt32 nSize; + if (rProps.GetOpt(ESCHER_Prop_gtextSize, nSize)) + { + float nSizeF = (sal_Int32)nSize / 65536; + OUString aSize = OUString::number(nSizeF); + aStyle += ";font-size:" + aSize + "pt"; + } if (!aStyle.isEmpty()) pAttrList->add(XML_style, OUStringToOString(aStyle, RTL_TEXTENCODING_UTF8)); m_pSerializer->singleElementNS(XML_v, XML_textpath, XFastAttributeListRef(pAttrList)); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index f37c15d181d6..253d9eb18dc1 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -855,7 +855,7 @@ beans::PropertyValue lcl_createTextpathProps() return aRet; } -void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Reference<drawing::XShape>& xShape) const +void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Reference<drawing::XShape>& xShape, const GraphicHelper& rGraphicHelper) const { if (moString.has()) { @@ -901,6 +901,16 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); xPropertySet->setPropertyValue("CharFontName", uno::makeAny(aValue)); } + else if (aName == "font-size") + { + oox::OptValue<OUString> aOptString(aValue); + sal_Int64 nEmu = lclGetEmu( rGraphicHelper, aOptString, 1 ); + // 1 point = 1/72 inch = 12,700 EMU + float nSize = nEmu / 12700; + + uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); + xPropertySet->setPropertyValue("CharHeight", uno::makeAny(nSize)); + } } } } diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 0b68675ae72e..a22da262281d 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -517,7 +517,7 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con } } else if (xSInfo->supportsService("com.sun.star.drawing.CustomShape")) - maTypeModel.maTextpathModel.pushToPropMap(aPropMap, rxShape); + maTypeModel.maTextpathModel.pushToPropMap(aPropMap, rxShape, rGraphicHelper); PropertySet( rxShape ).setProperties( aPropMap ); } diff --git a/sw/qa/extras/ooxmlexport/data/watermark-font.docx b/sw/qa/extras/ooxmlexport/data/watermark-font.docx Binary files differindex 82d7ec8a83fc..5a09dc9f788d 100644 --- a/sw/qa/extras/ooxmlexport/data/watermark-font.docx +++ b/sw/qa/extras/ooxmlexport/data/watermark-font.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index 636dd76643e6..db99b277daf4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -734,10 +734,15 @@ DECLARE_OOXMLEXPORT_TEST(testWatermarkFont, "watermark-font.docx") uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); OUString aFont; + float nFontSize; // Check font family CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CharFontName") >>= aFont); CPPUNIT_ASSERT_EQUAL(OUString("DejaVu Serif"), aFont); + + // Check font size + CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CharHeight") >>= nFontSize); + CPPUNIT_ASSERT_EQUAL((float)72, nFontSize); } DECLARE_OOXMLEXPORT_TEST(testFdo43093, "fdo43093.docx") |