[Libreoffice-commits] core.git: oox/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 4 20:18:53 UTC 2018


 oox/source/ole/axcontrol.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 1c8eb8ba49340b7b59a9f1a5f28cd8bee06cd4d1
Author:     Martin van Zijl <martin.vanzijl at gmail.com>
AuthorDate: Mon Dec 3 12:12:54 2018 +1300
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Dec 4 21:18:30 2018 +0100

    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 at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

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;


More information about the Libreoffice-commits mailing list