[Libreoffice-commits] core.git: Branch 'libreoffice-6-3-4' - include/vcl vcl/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 4 16:33:57 UTC 2019


 include/vcl/texteng.hxx      |    3 -
 include/vcl/vclmedit.hxx     |    5 --
 vcl/source/edit/texteng.cxx  |    7 +---
 vcl/source/edit/vclmedit.cxx |   74 ++++++++++++++++++++++++++++++-------------
 4 files changed, 58 insertions(+), 31 deletions(-)

New commits:
commit 09caf33cf8f83859f7e736e0bdac2d15682f4b2e
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Nov 26 14:39:30 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 4 17:33:07 2019 +0100

    tdf#127403 Revert "VCL keep / return the original set TextEngine font"
    
    This reverts commit cc223fa12a61ba0e580b884386a7f5d7efd0541f.
    
    All the other attenps to fix this seem to cause timeouts in the
    Jenkins clang_dbgutil build. I don't have one around and no time
    to investigate further, so let's see, if the revert passes.
    
    Change-Id: Ib915185eaf79073523351705baf28df3c62906f1
    Reviewed-on: https://gerrit.libreoffice.org/83654
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit b1e73fd49661e07e6085310f3f6ecc6ade2a3762)
    Reviewed-on: https://gerrit.libreoffice.org/83827
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
    (cherry picked from commit 13d777a0aa3802871cf01869d904ceec39096024)
    Reviewed-on: https://gerrit.libreoffice.org/83873
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 9b8d8ed2926ead0abb659749c04bcaf5286c7d2b)
    Reviewed-on: https://gerrit.libreoffice.org/83903
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 95da903bc1d4..7e6c9d452590 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -106,7 +106,6 @@ class VCL_DLLPUBLIC TextEngine : public SfxBroadcaster
     std::unique_ptr<LocaleDataWrapper> mpLocaleDataWrapper;
 
     vcl::Font           maFont;
-    vcl::Font           maOrigFont;  // original font from SetFont
     Color               maTextColor;
 
     sal_Int32           mnMaxTextLen;
@@ -221,7 +220,7 @@ public:
     sal_Int32           GetTextLen( const TextSelection& rSel ) const;
 
     void                SetFont( const vcl::Font& rFont );
-    const vcl::Font&    GetFont() const { return maOrigFont; }
+    const vcl::Font&    GetFont() const { return maFont; }
 
     void                SetLeftMargin( sal_uInt16 n );
 
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index 23381f5f8443..d52d040d028e 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -98,10 +98,7 @@ protected:
     TextView*       GetTextView() const;
     ExtTextEngine*  GetTextEngine() const;
 
-    void ApplySettings(vcl::RenderContext&) override;
-    void ApplyBackgroundSettings(vcl::RenderContext&, const StyleSettings&);
-    void ApplyFontSettings(vcl::RenderContext&, const StyleSettings&);
-
+    virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
 public:
                     VclMultiLineEdit( vcl::Window* pParent,
                                       WinBits nWinStyle );
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index cab426c8b001..fe2f0886a7cd 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -170,9 +170,8 @@ void TextEngine::SetActiveView( TextView* pTextView )
 
 void TextEngine::SetFont( const vcl::Font& rFont )
 {
-    if (rFont == maOrigFont)
+    if ( rFont == maFont )
         return;
-    maOrigFont = rFont;
 
     maFont = rFont;
     // #i40221# As the font's color now defaults to transparent (since i35764)
@@ -207,9 +206,9 @@ void TextEngine::SetFont( const vcl::Font& rFont )
     for ( auto nView = mpViews->size(); nView; )
     {
         TextView* pView = (*mpViews)[ --nView ];
-        pView->GetWindow()->SetInputContext(InputContext(maFont, !pView->IsReadOnly()
-            ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE));
+        pView->GetWindow()->SetInputContext( InputContext( GetFont(), !pView->IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) );
     }
+
 }
 
 void TextEngine::SetMaxTextLen( sal_Int32 nLen )
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 4d2ebb3e53be..b9e630e9db92 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -913,8 +913,36 @@ WinBits VclMultiLineEdit::ImplInitStyle( WinBits nStyle )
     return nStyle;
 }
 
-void VclMultiLineEdit::ApplyBackgroundSettings(vcl::RenderContext& rRenderContext, const StyleSettings& rStyleSettings)
+void VclMultiLineEdit::ApplySettings(vcl::RenderContext& rRenderContext)
 {
+    const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+
+    // The Font has to be adjusted, as the TextEngine does not take care of
+    // TextColor/Background
+
+    Color aTextColor = rStyleSettings.GetFieldTextColor();
+    if (IsControlForeground())
+        aTextColor = GetControlForeground();
+
+    if (!IsEnabled())
+        aTextColor = rStyleSettings.GetDisableColor();
+
+    vcl::Font aFont = rStyleSettings.GetFieldFont();
+    aFont.SetTransparent(IsPaintTransparent());
+    ApplyControlFont(rRenderContext, aFont);
+
+    vcl::Font theFont = rRenderContext.GetFont();
+    theFont.SetColor(aTextColor);
+    if (IsPaintTransparent())
+        theFont.SetFillColor(COL_TRANSPARENT);
+    else
+        theFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor());
+
+    pImpVclMEdit->GetTextWindow()->SetFont(theFont);
+    // FIXME: next call causes infinite invalidation loop, rethink how to properly fix this situation
+    // pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(theFont);
+    pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
+
     if (IsPaintTransparent())
     {
         pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true);
@@ -934,8 +962,10 @@ void VclMultiLineEdit::ApplyBackgroundSettings(vcl::RenderContext& rRenderContex
     }
 }
 
-void VclMultiLineEdit::ApplyFontSettings(vcl::RenderContext& rRenderContext, const StyleSettings& rStyleSettings)
+void VclMultiLineEdit::ImplInitSettings(bool bBackground)
 {
+    const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
     // The Font has to be adjusted, as the TextEngine does not take care of
     // TextColor/Background
 
@@ -947,36 +977,38 @@ void VclMultiLineEdit::ApplyFontSettings(vcl::RenderContext& rRenderContext, con
 
     vcl::Font aFont = rStyleSettings.GetFieldFont();
     aFont.SetTransparent(IsPaintTransparent());
-    ApplyControlFont(rRenderContext, aFont);
+    ApplyControlFont(*this, aFont);
 
-    vcl::Font TheFont = rRenderContext.GetFont();
+    vcl::Font TheFont = GetFont();
     TheFont.SetColor(aTextColor);
     if (IsPaintTransparent())
         TheFont.SetFillColor(COL_TRANSPARENT);
     else
         TheFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor());
-
     pImpVclMEdit->GetTextWindow()->SetFont(TheFont);
     pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(TheFont);
     pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
-}
-
-void VclMultiLineEdit::ApplySettings(vcl::RenderContext& rRenderContext)
-{
-    const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
-
-    ApplyFontSettings(rRenderContext, rStyleSettings);
-    ApplyBackgroundSettings(rRenderContext, rStyleSettings);
-}
-
-void VclMultiLineEdit::ImplInitSettings(bool bBackground)
-{
-    const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
-    ApplyFontSettings(*this, rStyleSettings);
 
     if (bBackground)
-        ApplyBackgroundSettings(*this, rStyleSettings);
+    {
+        if (IsPaintTransparent())
+        {
+            pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true);
+            pImpVclMEdit->GetTextWindow()->SetBackground();
+            pImpVclMEdit->GetTextWindow()->SetControlBackground();
+            SetBackground();
+            SetControlBackground();
+        }
+        else
+        {
+            if (IsControlBackground())
+                pImpVclMEdit->GetTextWindow()->SetBackground(GetControlBackground());
+            else
+                pImpVclMEdit->GetTextWindow()->SetBackground(rStyleSettings.GetFieldColor());
+            // also adjust for VclMultiLineEdit as the TextComponent might hide Scrollbars
+            SetBackground(pImpVclMEdit->GetTextWindow()->GetBackground());
+        }
+    }
 }
 
 void VclMultiLineEdit::Modify()


More information about the Libreoffice-commits mailing list