[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - vcl/inc vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue May 12 08:38:53 UTC 2020


 vcl/inc/salvtables.hxx        |   37 +++++++++
 vcl/source/app/salvtables.cxx |  159 +++++++++++++++++++-----------------------
 2 files changed, 110 insertions(+), 86 deletions(-)

New commits:
commit 4c4f4ad7be7f8300f07a0bcad4f7465eb3e94bec
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Mar 4 16:03:01 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue May 12 10:38:20 2020 +0200

    Move SalInstanceNotebook to header file
    
    Change-Id: Id14b6fca6f12f49691a621f636300f9da320834c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93975
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index a4a2fd9f3a45..5f78e8c09904 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -11,6 +11,8 @@
 #include <vcl/spinfld.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/lstbox.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/layout.hxx>
 
 class SalInstanceBuilder : public weld::Builder
 {
@@ -655,4 +657,39 @@ public:
     virtual ~SalInstanceButton() override;
 };
 
+class SalInstanceNotebook : public SalInstanceContainer, public virtual weld::Notebook
+{
+private:
+    VclPtr<TabControl> m_xNotebook;
+    mutable std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages;
+    std::vector<VclPtr<TabPage>> m_aAddedPages;
+    std::vector<VclPtr<VclGrid>> m_aAddedGrids;
+
+    DECL_LINK(DeactivatePageHdl, TabControl*, bool);
+    DECL_LINK(ActivatePageHdl, TabControl*, void);
+
+public:
+    SalInstanceNotebook(TabControl* pNotebook, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+
+    virtual int get_current_page() const override;
+
+    virtual OString get_current_page_ident() const override;
+
+    virtual weld::Container* get_page(const OString& rIdent) const override;
+
+    virtual void set_current_page(int nPage) override;
+
+    virtual void set_current_page(const OString& rIdent) override;
+
+    virtual void remove_page(const OString& rIdent) override;
+
+    virtual void append_page(const OString& rIdent, const OUString& rLabel) override;
+
+    virtual int get_n_pages() const override;
+
+    virtual OUString get_tab_label_text(const OString& rIdent) const override;
+
+    virtual ~SalInstanceNotebook() override;
+};
+
 #endif
\ No newline at end of file
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 2eb158148349..30de704cb0c0 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1064,103 +1064,90 @@ IMPL_LINK_NOARG(SalInstanceScrolledWindow, VscrollHdl, ScrollBar*, void)
         m_aOrigVScrollHdl.Call(&m_xScrolledWindow->getVertScrollBar());
 }
 
-class SalInstanceNotebook : public SalInstanceContainer, public virtual weld::Notebook
+SalInstanceNotebook::SalInstanceNotebook(TabControl* pNotebook, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+    : SalInstanceContainer(pNotebook, pBuilder, bTakeOwnership)
+    , m_xNotebook(pNotebook)
 {
-private:
-    VclPtr<TabControl> m_xNotebook;
-    mutable std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages;
-    std::vector<VclPtr<TabPage>> m_aAddedPages;
-    std::vector<VclPtr<VclGrid>> m_aAddedGrids;
-
-    DECL_LINK(DeactivatePageHdl, TabControl*, bool);
-    DECL_LINK(ActivatePageHdl, TabControl*, void);
-
-public:
-    SalInstanceNotebook(TabControl* pNotebook, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
-        : SalInstanceContainer(pNotebook, pBuilder, bTakeOwnership)
-        , m_xNotebook(pNotebook)
-    {
-        m_xNotebook->SetActivatePageHdl(LINK(this, SalInstanceNotebook, ActivatePageHdl));
-        m_xNotebook->SetDeactivatePageHdl(LINK(this, SalInstanceNotebook, DeactivatePageHdl));
-    }
+    m_xNotebook->SetActivatePageHdl(LINK(this, SalInstanceNotebook, ActivatePageHdl));
+    m_xNotebook->SetDeactivatePageHdl(LINK(this, SalInstanceNotebook, DeactivatePageHdl));
+}
 
-    virtual int get_current_page() const override
-    {
-        return m_xNotebook->GetPagePos(m_xNotebook->GetCurPageId());
-    }
+int SalInstanceNotebook::get_current_page() const
+{
+    return m_xNotebook->GetPagePos(m_xNotebook->GetCurPageId());
+}
 
-    virtual OString get_current_page_ident() const override
-    {
-        return m_xNotebook->GetPageName(m_xNotebook->GetCurPageId());
-    }
+OString SalInstanceNotebook::get_current_page_ident() const
+{
+    return m_xNotebook->GetPageName(m_xNotebook->GetCurPageId());
+}
 
-    virtual weld::Container* get_page(const OString& rIdent) const override
-    {
-        sal_uInt16 nPageId = m_xNotebook->GetPageId(rIdent);
-        sal_uInt16 nPageIndex = m_xNotebook->GetPagePos(nPageId);
-        if (nPageIndex == TAB_PAGE_NOTFOUND)
-            return nullptr;
-        TabPage* pPage = m_xNotebook->GetTabPage(nPageId);
-        vcl::Window* pChild = pPage->GetChild(0);
-        if (m_aPages.size() < nPageIndex + 1U)
-            m_aPages.resize(nPageIndex + 1U);
-        if (!m_aPages[nPageIndex])
-            m_aPages[nPageIndex].reset(new SalInstanceContainer(pChild, m_pBuilder, false));
-        return m_aPages[nPageIndex].get();
-    }
+weld::Container* SalInstanceNotebook::get_page(const OString& rIdent) const
+{
+    sal_uInt16 nPageId = m_xNotebook->GetPageId(rIdent);
+    sal_uInt16 nPageIndex = m_xNotebook->GetPagePos(nPageId);
+    if (nPageIndex == TAB_PAGE_NOTFOUND)
+        return nullptr;
+    TabPage* pPage = m_xNotebook->GetTabPage(nPageId);
+    vcl::Window* pChild = pPage->GetChild(0);
+    if (m_aPages.size() < nPageIndex + 1U)
+        m_aPages.resize(nPageIndex + 1U);
+    if (!m_aPages[nPageIndex])
+        m_aPages[nPageIndex].reset(new SalInstanceContainer(pChild, m_pBuilder, false));
+    return m_aPages[nPageIndex].get();
+}
 
-    virtual void set_current_page(int nPage) override
-    {
-        m_xNotebook->SetCurPageId(m_xNotebook->GetPageId(nPage));
-    }
+void SalInstanceNotebook::set_current_page(int nPage)
+{
+    m_xNotebook->SetCurPageId(m_xNotebook->GetPageId(nPage));
+}
 
-    virtual void set_current_page(const OString& rIdent) override
-    {
-        m_xNotebook->SetCurPageId(m_xNotebook->GetPageId(rIdent));
-    }
+void SalInstanceNotebook::set_current_page(const OString& rIdent)
+{
+    m_xNotebook->SetCurPageId(m_xNotebook->GetPageId(rIdent));
+}
 
-    virtual void remove_page(const OString& rIdent) override
-    {
-        m_xNotebook->RemovePage(m_xNotebook->GetPageId(rIdent));
-    }
+void SalInstanceNotebook::remove_page(const OString& rIdent)
+{
+    m_xNotebook->RemovePage(m_xNotebook->GetPageId(rIdent));
+}
 
-    virtual void append_page(const OString& rIdent, const OUString& rLabel) override
-    {
-        sal_uInt16 nNewPageCount = m_xNotebook->GetPageCount() + 1;
-        sal_uInt16 nNewPageId = nNewPageCount;
-        m_xNotebook->InsertPage(nNewPageId, rLabel);
-        VclPtrInstance<TabPage> xPage(m_xNotebook);
-        VclPtrInstance<VclGrid> xGrid(xPage);
-        xPage->Show();
-        xGrid->set_hexpand(true);
-        xGrid->set_vexpand(true);
-        xGrid->Show();
-        m_xNotebook->SetTabPage(nNewPageId, xPage);
-        m_xNotebook->SetPageName(nNewPageId, rIdent);
-        m_aAddedPages.push_back(xPage);
-        m_aAddedGrids.push_back(xGrid);
-    }
+void SalInstanceNotebook::append_page(const OString& rIdent, const OUString& rLabel)
+{
+    sal_uInt16 nNewPageCount = m_xNotebook->GetPageCount() + 1;
+    sal_uInt16 nNewPageId = nNewPageCount;
+    m_xNotebook->InsertPage(nNewPageId, rLabel);
+    VclPtrInstance<TabPage> xPage(m_xNotebook);
+    VclPtrInstance<VclGrid> xGrid(xPage);
+    xPage->Show();
+    xGrid->set_hexpand(true);
+    xGrid->set_vexpand(true);
+    xGrid->Show();
+    m_xNotebook->SetTabPage(nNewPageId, xPage);
+    m_xNotebook->SetPageName(nNewPageId, rIdent);
+    m_aAddedPages.push_back(xPage);
+    m_aAddedGrids.push_back(xGrid);
+}
 
-    virtual int get_n_pages() const override
-    {
-        return m_xNotebook->GetPageCount();
-    }
+int SalInstanceNotebook::get_n_pages() const
+{
+    return m_xNotebook->GetPageCount();
+}
 
-    virtual OUString get_tab_label_text(const OString& rIdent) const override
-    {
-        return m_xNotebook->GetPageText(m_xNotebook->GetPageId(rIdent));
-    }
+OUString SalInstanceNotebook::get_tab_label_text(const OString& rIdent) const
+{
+    return m_xNotebook->GetPageText(m_xNotebook->GetPageId(rIdent));
+}
 
-    virtual ~SalInstanceNotebook() override
-    {
-        for (auto &rGrid : m_aAddedGrids)
-            rGrid.disposeAndClear();
-        for (auto &rPage : m_aAddedPages)
-            rPage.disposeAndClear();
-        m_xNotebook->SetActivatePageHdl(Link<TabControl*,void>());
-        m_xNotebook->SetDeactivatePageHdl(Link<TabControl*,bool>());
-    }
-};
+SalInstanceNotebook::~SalInstanceNotebook()
+{
+    for (auto &rGrid : m_aAddedGrids)
+        rGrid.disposeAndClear();
+    for (auto &rPage : m_aAddedPages)
+        rPage.disposeAndClear();
+    m_xNotebook->SetActivatePageHdl(Link<TabControl*,void>());
+    m_xNotebook->SetDeactivatePageHdl(Link<TabControl*,bool>());
+}
 
 IMPL_LINK_NOARG(SalInstanceNotebook, DeactivatePageHdl, TabControl*, bool)
 {


More information about the Libreoffice-commits mailing list