include/vcl/salvtables.hxx    |   43 +++++++++
 vcl/source/app/salvtables.cxx |  197 +++++++++++++++++++-----------------------
 2 files changed, 136 insertions(+), 104 deletions(-)

New commits:
commit 366e0278e3248d703fa044c0b772e700fa2276ed
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Jul 2 14:38:14 2020 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri Jul 3 07:38:55 2020 +0200

    Move SalInstanceTextView dect to header file
    
    Change-Id: I779f860fec5203db3493663ff61d7b06167ff685
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97763
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx
index 31ba8c564eb8..c2f1382ee0de 100644
--- a/include/vcl/salvtables.hxx
+++ b/include/vcl/salvtables.hxx
@@ -1056,4 +1056,47 @@ public:
     virtual ~SalInstanceToolbar() override;
 };
 
+class SalInstanceTextView : public SalInstanceContainer, public virtual 
weld::TextView
+{
+private:
+    VclPtr<VclMultiLineEdit> m_xTextView;
+    Link<ScrollBar*, void> m_aOrigVScrollHdl;
+
+    DECL_LINK(ChangeHdl, Edit&, void);
+    DECL_LINK(VscrollHdl, ScrollBar*, void);
+    DECL_LINK(CursorListener, VclWindowEvent&, void);
+
+public:
+    SalInstanceTextView(VclMultiLineEdit* pTextView, SalInstanceBuilder* 
pBuilder,
+                        bool bTakeOwnership);
+
+    virtual void set_text(const OUString& rText) override;
+
+    virtual void replace_selection(const OUString& rText) override;
+
+    virtual OUString get_text() const override;
+
+    bool get_selection_bounds(int& rStartPos, int& rEndPos) override;
+
+    virtual void select_region(int nStartPos, int nEndPos) override;
+
+    virtual void set_editable(bool bEditable) override;
+
+    virtual void set_monospace(bool bMonospace) override;
+
+    virtual void connect_cursor_position(const Link<TextView&, void>& rLink) 
override;
+
+    virtual int vadjustment_get_value() const override;
+
+    virtual void vadjustment_set_value(int value) override;
+
+    virtual int vadjustment_get_upper() const override;
+
+    virtual int vadjustment_get_lower() const override;
+
+    virtual int vadjustment_get_page_size() const override;
+
+    virtual ~SalInstanceTextView() override;
+};
+
 #endif
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 2219a3d72ebe..ce884b9f4aac 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5081,128 +5081,117 @@ std::unique_ptr<weld::Label> 
SalInstanceFrame::weld_label_widget() const
     return std::make_unique<SalInstanceLabel>(pLabel, m_pBuilder, false);
 }
 
-class SalInstanceTextView : public SalInstanceContainer, public virtual 
weld::TextView
+SalInstanceTextView::SalInstanceTextView(VclMultiLineEdit* pTextView, 
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+    : SalInstanceContainer(pTextView, pBuilder, bTakeOwnership)
+    , m_xTextView(pTextView)
 {
-private:
-    VclPtr<VclMultiLineEdit> m_xTextView;
-    Link<ScrollBar*,void> m_aOrigVScrollHdl;
+    m_xTextView->SetModifyHdl(LINK(this, SalInstanceTextView, ChangeHdl));
+    ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
+    m_aOrigVScrollHdl = rVertScrollBar.GetScrollHdl();
+    rVertScrollBar.SetScrollHdl(LINK(this, SalInstanceTextView, VscrollHdl));
+}
 
-    DECL_LINK(ChangeHdl, Edit&, void);
-    DECL_LINK(VscrollHdl, ScrollBar*, void);
-    DECL_LINK(CursorListener, VclWindowEvent&, void);
-public:
-    SalInstanceTextView(VclMultiLineEdit* pTextView, SalInstanceBuilder* 
pBuilder, bool bTakeOwnership)
-        : SalInstanceContainer(pTextView, pBuilder, bTakeOwnership)
-        , m_xTextView(pTextView)
-    {
-        m_xTextView->SetModifyHdl(LINK(this, SalInstanceTextView, ChangeHdl));
-        ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
-        m_aOrigVScrollHdl = rVertScrollBar.GetScrollHdl();
-        rVertScrollBar.SetScrollHdl(LINK(this, SalInstanceTextView, 
VscrollHdl));
-    }
+void SalInstanceTextView::set_text(const OUString& rText)
+{
+    disable_notify_events();
+    m_xTextView->SetText(rText);
+    enable_notify_events();
+}
 
-    virtual void set_text(const OUString& rText) override
-    {
-        disable_notify_events();
-        m_xTextView->SetText(rText);
-        enable_notify_events();
-    }
+void SalInstanceTextView::replace_selection(const OUString& rText)
+{
+    disable_notify_events();
+    m_xTextView->ReplaceSelected(rText);
+    enable_notify_events();
+}
 
-    virtual void replace_selection(const OUString& rText) override
-    {
-        disable_notify_events();
-        m_xTextView->ReplaceSelected(rText);
-        enable_notify_events();
-    }
+OUString SalInstanceTextView::get_text() const
+{
+    return m_xTextView->GetText();
+}
 
-    virtual OUString get_text() const override
-    {
-        return m_xTextView->GetText();
-    }
+bool SalInstanceTextView::get_selection_bounds(int& rStartPos, int &rEndPos)
+{
+    const Selection& rSelection = m_xTextView->GetSelection();
+    rStartPos = rSelection.Min();
+    rEndPos = rSelection.Max();
+    return rSelection.Len();
+}
 
-    bool get_selection_bounds(int& rStartPos, int &rEndPos) override
-    {
-        const Selection& rSelection = m_xTextView->GetSelection();
-        rStartPos = rSelection.Min();
-        rEndPos = rSelection.Max();
-        return rSelection.Len();
-    }
+void SalInstanceTextView::select_region(int nStartPos, int nEndPos)
+{
+    disable_notify_events();
+    m_xTextView->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX 
: nEndPos));
+    enable_notify_events();
+}
 
-    virtual void select_region(int nStartPos, int nEndPos) override
-    {
-        disable_notify_events();
-        m_xTextView->SetSelection(Selection(nStartPos, nEndPos < 0 ? 
SELECTION_MAX : nEndPos));
-        enable_notify_events();
-    }
+void SalInstanceTextView::set_editable(bool bEditable)
+{
+    m_xTextView->SetReadOnly(!bEditable);
+}
 
-    virtual void set_editable(bool bEditable) override
-    {
-        m_xTextView->SetReadOnly(!bEditable);
-    }
+void SalInstanceTextView::set_monospace(bool bMonospace)
+{
+    vcl::Font aOrigFont = m_xTextView->GetControlFont();
+    vcl::Font aFont;
+    if (bMonospace)
+        aFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_FIXED, 
LANGUAGE_DONTKNOW, GetDefaultFontFlags::OnlyOne, m_xTextView);
+    else
+        aFont = Application::GetSettings().GetStyleSettings().GetFieldFont();
+    aFont.SetFontHeight(aOrigFont.GetFontHeight());
+    m_xTextView->SetFont(aFont);
+    m_xTextView->SetControlFont(aFont);
+}
 
-    virtual void set_monospace(bool bMonospace) override
-    {
-        vcl::Font aOrigFont = m_xTextView->GetControlFont();
-        vcl::Font aFont;
-        if (bMonospace)
-            aFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_FIXED, 
LANGUAGE_DONTKNOW, GetDefaultFontFlags::OnlyOne, m_xTextView);
-        else
-            aFont = 
Application::GetSettings().GetStyleSettings().GetFieldFont();
-        aFont.SetFontHeight(aOrigFont.GetFontHeight());
-        m_xTextView->SetFont(aFont);
-        m_xTextView->SetControlFont(aFont);
-    }
+void SalInstanceTextView::connect_cursor_position(const Link<TextView&, void>& 
rLink)
+{
+    assert(!m_aCursorPositionHdl.IsSet());
+    m_xTextView->AddEventListener(LINK(this, SalInstanceTextView, 
CursorListener));
+    weld::TextView::connect_cursor_position(rLink);
+}
 
-    virtual void connect_cursor_position(const Link<TextView&, void>& rLink) 
override
-    {
-        assert(!m_aCursorPositionHdl.IsSet());
-        m_xTextView->AddEventListener(LINK(this, SalInstanceTextView, 
CursorListener));
-        weld::TextView::connect_cursor_position(rLink);
-    }
+int SalInstanceTextView::vadjustment_get_value() const
+{
+    ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
+    return rVertScrollBar.GetThumbPos();
+}
 
-    virtual int vadjustment_get_value() const override
-    {
-        ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
-        return rVertScrollBar.GetThumbPos();
-    }
+void SalInstanceTextView::vadjustment_set_value(int value)
+{
+    ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
+    rVertScrollBar.SetThumbPos(value);
+    m_aOrigVScrollHdl.Call(&rVertScrollBar);
+}
 
-    virtual void vadjustment_set_value(int value) override
-    {
-        ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
-        rVertScrollBar.SetThumbPos(value);
-        m_aOrigVScrollHdl.Call(&rVertScrollBar);
-    }
+int SalInstanceTextView::vadjustment_get_upper() const
+{
+    ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
+    return rVertScrollBar.GetRangeMax();
+}
 
-    virtual int vadjustment_get_upper() const override
-    {
-        ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
-        return rVertScrollBar.GetRangeMax();
-    }
+int SalInstanceTextView::vadjustment_get_lower() const
+{
+    ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
+    return rVertScrollBar.GetRangeMin();
+}
 
-    virtual int vadjustment_get_lower() const override
-    {
-        ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
-        return rVertScrollBar.GetRangeMin();
-    }
+int SalInstanceTextView::vadjustment_get_page_size() const
+{
+    ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
+    return rVertScrollBar.GetVisibleSize();
+}
 
-    virtual int vadjustment_get_page_size() const override
+SalInstanceTextView::~SalInstanceTextView()
+{
+    if (!m_xTextView->IsDisposed())
     {
+        if (m_aCursorPositionHdl.IsSet())
+            m_xTextView->RemoveEventListener(LINK(this, SalInstanceTextView, 
CursorListener));
+        m_xTextView->SetModifyHdl(Link<Edit&, void>());
         ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
-        return rVertScrollBar.GetVisibleSize();
-    }
-
-    virtual ~SalInstanceTextView() override
-    {
-        if (!m_xTextView->IsDisposed())
-        {
-            if (m_aCursorPositionHdl.IsSet())
-                m_xTextView->RemoveEventListener(LINK(this, 
SalInstanceTextView, CursorListener));
-            m_xTextView->SetModifyHdl(Link<Edit&, void>());
-            ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
-            rVertScrollBar.SetScrollHdl(m_aOrigVScrollHdl);
-        }
+        rVertScrollBar.SetScrollHdl(m_aOrigVScrollHdl);
     }
-};
+}
 
 IMPL_LINK(SalInstanceTextView, VscrollHdl, ScrollBar*, pScrollBar, void)
 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to