diff options
author | Martin van Zijl <martin.vanzijl@gmail.com> | 2018-12-03 12:12:54 +1300 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-12-04 21:18:30 +0100 |
commit | 1c8eb8ba49340b7b59a9f1a5f28cd8bee06cd4d1 (patch) | |
tree | 6764e38e0f229caf116ebd4c614de23ca984d6a5 /oox | |
parent | 997284391747771288c73d5b52d75b822fe04904 (diff) |
tdf#118684 save correct font height in oox format
Use the correct defaults for font height, underline and
strike-through when saving to DOCX from Writer.
Change-Id: I1bee606e05daf9976488ea5db72af7320e51fc8f
Reviewed-on: https://gerrit.libreoffice.org/64478
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/ole/axcontrol.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 551f331c9bfa..fa1d19ef01ce 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -50,6 +50,9 @@ #include <rtl/tencinfo.h> #include <osl/diagnose.h> #include <sal/log.hxx> +#include <vcl/font.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> #include <oox/helper/attributelist.hxx> #include <oox/helper/binaryinputstream.hxx> #include <oox/helper/containerhelper.hxx> @@ -926,14 +929,21 @@ void AxFontDataModel::convertFromProperties( PropertySet& rPropSet, const Contro sal_Int16 nUnderLine = awt::FontUnderline::NONE; if ( rPropSet.getProperty( nUnderLine, PROP_FontUnderline ) ) - setFlag( maFontData.mnFontEffects, AxFontFlags::Underline, nUnderLine != awt::FontUnderline::NONE ); + setFlag( maFontData.mnFontEffects, AxFontFlags::Underline, nUnderLine != awt::FontUnderline::NONE && nUnderLine != awt::FontUnderline::DONTKNOW); sal_Int16 nStrikeout = awt::FontStrikeout::NONE ; if ( rPropSet.getProperty( nStrikeout, PROP_FontStrikeout ) ) - setFlag( maFontData.mnFontEffects, AxFontFlags::Strikeout, nStrikeout != awt::FontStrikeout::NONE ); + setFlag( maFontData.mnFontEffects, AxFontFlags::Strikeout, nStrikeout != awt::FontStrikeout::NONE && nStrikeout != awt::FontStrikeout::DONTKNOW); float fontHeight = 0.0; if ( rPropSet.getProperty( fontHeight, PROP_FontHeight ) ) + { + if ( fontHeight == 0 ) // tdf#118684 + { + vcl::Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont(); + fontHeight = static_cast< float >( aDefaultVCLFont.GetFontHeight() ); + } maFontData.setHeightPoints( static_cast< sal_Int16 >( fontHeight ) ); + } // TODO - handle textencoding sal_Int16 nAlign = 0; |