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>
This commit is contained in:
Shivam Kumar Singh 2020-07-28 18:50:17 +05:30 committed by Mike Kaganski
parent cfc76db431
commit 3b8c893b48
2 changed files with 27 additions and 5 deletions

View file

@ -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;

View file

@ -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);