vcl/inc/salvtables.hxx        |    6 ++----
 vcl/source/app/salvtables.cxx |   24 ++++++++----------------
 2 files changed, 10 insertions(+), 20 deletions(-)

New commits:
commit acb8d0a42c3e15e10438ae3accefcbc0c39dd9bd
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Jan 21 14:39:03 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu Jan 22 13:10:23 2026 +0100

    vcl weld: Deduplicate TextWidget::set_font_color impls
    
    The SalInstanceTextView and SalInstanceEntry
    implementations implement the same logic. Deduplicate
    them by moving the logic to the shared
    SalInstanceTextWidget base class.
    
    Change-Id: If83871eb1e0935aa5ee667e35ed572da84b082a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197752
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 0a10f18fca56..6d0d9f203c31 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -626,6 +626,8 @@ public:
     virtual void set_editable(bool bEditable) override;
     virtual bool get_editable() const override;
 
+    virtual void set_font_color(const Color& rColor) override;
+
 protected:
     virtual void do_set_text(const OUString& rText) override;
     virtual void do_set_position(int nCursorPos) override;
@@ -662,8 +664,6 @@ public:
 
     virtual void set_font(const vcl::Font& rFont) override;
 
-    virtual void set_font_color(const Color& rColor) override;
-
     virtual void set_placeholder_text(const OUString& rText) override;
 
     Edit& getEntry();
@@ -1439,8 +1439,6 @@ public:
 
     virtual void set_font(const vcl::Font& rFont) override;
 
-    virtual void set_font_color(const Color& rColor) override;
-
     virtual bool can_move_cursor_with_up() const override;
 
     virtual bool can_move_cursor_with_down() const override;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 8bdb23eb628e..886baa2756b4 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3348,6 +3348,14 @@ void SalInstanceTextWidget::set_editable(bool bEditable) 
{ m_pEntry->SetReadOnly
 
 bool SalInstanceTextWidget::get_editable() const { return 
!m_pEntry->IsReadOnly(); }
 
+void SalInstanceTextWidget::set_font_color(const Color& rColor)
+{
+    if (rColor == COL_AUTO)
+        m_pEntry->SetControlForeground();
+    else
+        m_pEntry->SetControlForeground(rColor);
+}
+
 SalInstanceEntry::SalInstanceEntry(Edit* pEntry, SalInstanceBuilder* pBuilder, 
bool bTakeOwnership)
     : SalInstanceTextWidget(pEntry, pBuilder, bTakeOwnership)
     , m_xEntry(pEntry)
@@ -3413,14 +3421,6 @@ void SalInstanceEntry::set_font(const vcl::Font& rFont)
     m_xEntry->Invalidate();
 }
 
-void SalInstanceEntry::set_font_color(const Color& rColor)
-{
-    if (rColor == COL_AUTO)
-        m_xEntry->SetControlForeground();
-    else
-        m_xEntry->SetControlForeground(rColor);
-}
-
 void SalInstanceEntry::set_placeholder_text(const OUString& rText)
 {
     m_xEntry->SetPlaceholderText(rText);
@@ -5638,14 +5638,6 @@ void SalInstanceTextView::set_monospace(bool bMonospace)
     set_font(aFont);
 }
 
-void SalInstanceTextView::set_font_color(const Color& rColor)
-{
-    if (rColor != COL_AUTO)
-        m_xTextView->SetControlForeground(rColor);
-    else
-        m_xTextView->SetControlForeground();
-}
-
 void SalInstanceTextView::set_font(const vcl::Font& rFont)
 {
     m_xTextView->SetFont(rFont);

Reply via email to