summaryrefslogtreecommitdiff
path: root/sw/source/uibase/sidebar
diff options
context:
space:
mode:
authorShivam Kumar Singh <shivamhere247@gmail.com>2020-07-28 18:50:17 +0530
committerMike Kaganski <mike.kaganski@collabora.com>2020-07-28 21:19:03 +0200
commit3b8c893b487a3ee27bac710da74856225fb72950 (patch)
tree947e0ff2e0ebd4ae0001643386f1b09050bb3dd1 /sw/source/uibase/sidebar
parentcfc76db4318cd91ce69350d5214f80b2d6d5b1db (diff)
tdf#135178 tdf#135179 tdf#134820 Issue in SetChgLnk in Inspector
Change-Id: I39755d333506ffe3fa2b6302f9ec72c15cd9eff9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99629 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/uibase/sidebar')
-rw-r--r--sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx23
-rw-r--r--sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx9
2 files changed, 27 insertions, 5 deletions
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index b2c346353e52..4959f4b52344 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -58,9 +58,21 @@ WriterInspectorTextPanel::WriterInspectorTextPanel(vcl::Window* pParent,
: InspectorTextPanel(pParent, rxFrame)
{
SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current());
- SwWrtShell* pShell = pDocSh->GetWrtShell();
- if (pShell)
- pShell->SetChgLnk(LINK(this, WriterInspectorTextPanel, AttrChangedNotify));
+ m_pShell = pDocSh->GetWrtShell();
+ if (m_pShell)
+ {
+ m_oldLink = m_pShell->GetChgLnk();
+ m_pShell->SetChgLnk(LINK(this, WriterInspectorTextPanel, AttrChangedNotify));
+ }
+}
+
+WriterInspectorTextPanel::~WriterInspectorTextPanel() { disposeOnce(); }
+
+void WriterInspectorTextPanel::dispose()
+{
+ m_pShell->SetChgLnk(m_oldLink);
+
+ InspectorTextPanel::dispose();
}
static void InsertValues(const css::uno::Reference<css::uno::XInterface>& rSource,
@@ -188,8 +200,11 @@ static void UpdateTree(SwDocShell* pDocSh, std::vector<svx::sidebar::TreeNode>&
aStore.push_back(aDFNode);
}
-IMPL_LINK_NOARG(WriterInspectorTextPanel, AttrChangedNotify, LinkParamNone*, void)
+IMPL_LINK(WriterInspectorTextPanel, AttrChangedNotify, LinkParamNone*, pLink, void)
{
+ if (m_oldLink.IsSet())
+ m_oldLink.Call(pLink);
+
SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current());
std::vector<svx::sidebar::TreeNode> aStore;
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
index 43acb654411b..5fd3402af222 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
@@ -21,6 +21,8 @@
#include <sfx2/weldutils.hxx>
#include <svx/sidebar/InspectorTextPanel.hxx>
+class SwWrtShell;
+
namespace sw::sidebar
{
class WriterInspectorTextPanel final : public svx::sidebar::InspectorTextPanel
@@ -32,7 +34,12 @@ public:
WriterInspectorTextPanel(vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- // virtual ~WriterInspectorTextPanel();
+ virtual ~WriterInspectorTextPanel() override;
+ virtual void dispose() override;
+
+private:
+ SwWrtShell* m_pShell;
+ Link<LinkParamNone*, void> m_oldLink;
// attributes have changed
DECL_LINK(AttrChangedNotify, LinkParamNone*, void);