include/svtools/editbrowsebox.hxx     |    7 +++++++
 svtools/source/brwbox/ebbcontrols.cxx |    4 ++++
 svx/source/fmcomp/gridcell.cxx        |   30 +++++++++++++++++-------------
 3 files changed, 28 insertions(+), 13 deletions(-)

New commits:
commit 61050c6d7b8bceef2704eba0bfe4473ee75e669d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Sep 29 15:34:30 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Sep 30 10:04:54 2021 +0200

    tdf#141633 set correct font sizes in tableview child widgets
    
    Change-Id: Ic96a0ad8203bf3903546c0c2f07d96254ca01e4c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122832
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/svtools/editbrowsebox.hxx 
b/include/svtools/editbrowsebox.hxx
index 5b083454ff9e..d557634ad8c8 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -172,6 +172,8 @@ namespace svt
 
         virtual bool ProcessKey(const KeyEvent& rKEvt);
 
+        virtual void SetPointFont(const vcl::Font& rFont);
+
         // chain after the FocusInHdl
         void SetFocusInHdl(const Link<LinkParamNone*,void>& rHdl)
         {
@@ -224,6 +226,11 @@ namespace svt
             m_pEntry->set_editable(!bReadOnly);
         }
 
+        virtual void SetPointFont(const vcl::Font& rFont) override
+        {
+            m_pEntry->set_font(rFont);
+        }
+
         virtual void dispose() override;
 
         weld::Entry& get_widget() { return *m_pEntry; }
diff --git a/svtools/source/brwbox/ebbcontrols.cxx 
b/svtools/source/brwbox/ebbcontrols.cxx
index 5652a74b72af..9c1b438bb129 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -361,6 +361,10 @@ namespace svt
         return 
static_cast<BrowserDataWin*>(GetParent())->GetParent()->ProcessKey(rKEvt);
     }
 
+    void ControlBase::SetPointFont(const vcl::Font& /*rFont*/)
+    {
+    }
+
     IMPL_LINK(ControlBase, KeyInputHdl, const KeyEvent&, rKEvt, bool)
     {
         return ProcessKey(rKEvt);
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 0fe549bf651b..da5a387ad187 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -60,6 +60,7 @@
 #include <svx/dialmgr.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <tools/debug.hxx>
+#include <tools/fract.hxx>
 #include <tools/diagnose_ex.h>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
@@ -694,11 +695,11 @@ bool DbCellControl::Commit()
 
 void DbCellControl::ImplInitWindow( vcl::Window const & rParent, const 
InitWindowFacet _eInitWhat )
 {
-    vcl::Window* pWindows[] = { m_pPainter, m_pWindow };
+    svt::ControlBase* pWindows[] = { m_pPainter, m_pWindow };
 
     if (_eInitWhat & InitWindowFacet::WritingMode)
     {
-        for (vcl::Window* pWindow : pWindows)
+        for (svt::ControlBase* pWindow : pWindows)
         {
             if (pWindow)
                 pWindow->EnableRTL(rParent.IsRTLEnabled());
@@ -707,26 +708,29 @@ void DbCellControl::ImplInitWindow( vcl::Window const & 
rParent, const InitWindo
 
     if (_eInitWhat & InitWindowFacet::Font)
     {
-        for (vcl::Window* pWindow : pWindows)
+        const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
+        const Fraction& rZoom = rParent.GetZoom();
+
+        for (svt::ControlBase* pWindow : pWindows)
         {
             if (!pWindow)
                 continue;
 
-            pWindow->SetZoom(rParent.GetZoom());
-
-            const StyleSettings& rStyleSettings = 
pWindow->GetSettings().GetStyleSettings();
             vcl::Font aFont = rStyleSettings.GetFieldFont();
             aFont.SetTransparent(isTransparent());
 
             if (rParent.IsControlFont())
-            {
-                pWindow->SetControlFont(rParent.GetControlFont());
                 aFont.Merge(rParent.GetControlFont());
+
+            if (rZoom.GetNumerator() != rZoom.GetDenominator())
+            {
+                Size aSize = aFont.GetFontSize();
+                aSize.setWidth(std::round(double(aSize.Width() * rZoom)));
+                aSize.setHeight(std::round(double(aSize.Height() * rZoom)));
+                aFont.SetFontSize(aSize);
             }
-            else
-                pWindow->SetControlFont();
 
-            pWindow->SetZoomedPointFont(*pWindow->GetOutDev(), aFont); // 
FIXME RenderContext
+            pWindow->SetPointFont(aFont);
         }
     }
 
@@ -737,7 +741,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & 
rParent, const InitWindo
         bool bTextLineColor = rParent.IsTextLineColor();
         Color aTextLineColor(rParent.GetTextLineColor());
 
-        for (vcl::Window* pWindow : pWindows)
+        for (svt::ControlBase* pWindow : pWindows)
         {
             if (pWindow)
             {
@@ -759,7 +763,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & 
rParent, const InitWindo
     if (rParent.IsControlBackground())
     {
         Color aColor(rParent.GetControlBackground());
-        for (vcl::Window* pWindow : pWindows)
+        for (svt::ControlBase* pWindow : pWindows)
         {
             if (pWindow)
             {

Reply via email to