diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-11-06 10:35:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-06 15:01:21 +0100 |
commit | e40d28d65222ba462c20ede17da5ef54751932e3 (patch) | |
tree | c0189d51eab563f46a669f5e90071da67a05d030 | |
parent | c7d258d6e8b0ca78003b172806928443e9634416 (diff) |
ofz#27012 detect deletion of XFCell
Change-Id: I22aabfcbb43c09ab174176a2a2898b4bf0b55afc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105395
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | lotuswordpro/Library_lwpft.mk | 1 | ||||
-rw-r--r-- | lotuswordpro/inc/xfilter/xfcell.hxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.hxx | 30 |
4 files changed, 33 insertions, 2 deletions
diff --git a/lotuswordpro/Library_lwpft.mk b/lotuswordpro/Library_lwpft.mk index e7536e9f7a64..5965b385e1bc 100644 --- a/lotuswordpro/Library_lwpft.mk +++ b/lotuswordpro/Library_lwpft.mk @@ -27,6 +27,7 @@ $(eval $(call gb_Library_use_libraries,lwpft,\ i18nlangtag \ sfx \ sot \ + svl \ svt \ svxcore \ tl \ diff --git a/lotuswordpro/inc/xfilter/xfcell.hxx b/lotuswordpro/inc/xfilter/xfcell.hxx index 81ab8aa59028..1e75107019de 100644 --- a/lotuswordpro/inc/xfilter/xfcell.hxx +++ b/lotuswordpro/inc/xfilter/xfcell.hxx @@ -63,6 +63,7 @@ #include <xfilter/xfcontent.hxx> #include <xfilter/xfcontentcontainer.hxx> +#include <svl/SfxBroadcaster.hxx> class XFTable; class XFRow; @@ -71,6 +72,7 @@ class XFRow; * @descr Table cell object. */ class XFCell : public XFContentContainer + , public SfxBroadcaster { public: XFCell(); diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index b6a61d9198ce..f49c3f01dc68 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -1433,7 +1433,7 @@ XFCell* LwpTableLayout::GetCellsMap(sal_uInt16 nRow, sal_uInt8 nCol) if (results.begin() == results.end()) return nullptr; // return the last thing inserted for this position - return *std::prev(results.end()); + return std::prev(results.end())->GetCell(); } /** * @descr Get row layout by row id diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx b/lotuswordpro/source/filter/lwptablelayout.hxx index fe8312414587..ca4d46812e55 100644 --- a/lotuswordpro/source/filter/lwptablelayout.hxx +++ b/lotuswordpro/source/filter/lwptablelayout.hxx @@ -63,6 +63,8 @@ #include "lwplayout.hxx" #include <xfilter/xftable.hxx> +#include <svl/hint.hxx> +#include <svl/lstner.hxx> #include <mdds/rtree.hpp> @@ -96,6 +98,31 @@ struct TableConvertAttempt } }; +class XFCellListener : public SfxListener +{ +public: + XFCellListener(XFCell* pCell) + : m_pCell(pCell) + { + if (m_pCell) + StartListening(*m_pCell); + } + + XFCell* GetCell() + { + return m_pCell; + } + +private: + XFCell* m_pCell; + + virtual void Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) override + { + if (rHint.GetId() == SfxHintId::Dying) + m_pCell = nullptr; + } +}; + /** * @brief * VO_TABLELAYOUT object and functions for registering styles and converting tables @@ -167,11 +194,12 @@ private: rtl::Reference<XFTable> m_pXFTable; bool m_bConverted; - using rt_type = mdds::rtree<int, XFCell*>; + using rt_type = mdds::rtree<int, XFCellListener>; rt_type m_CellsMap; void PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID); }; + /** * @brief * VO_SUPERTABLELAYOUT object |