Kaydet (Commit) 6e7e4d9f authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen Kaydeden (comit) Björn Michaelsen

dont use SwClient/SwModify in unocore: Bookmark

Change-Id: Iea03642c6b1de1160b98e3b61e831588bb6207b7
Reviewed-on: https://gerrit.libreoffice.org/54609Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@libreoffice.org>
üst 1e9304e2
......@@ -18,10 +18,16 @@
*/
#include <unobookmark.hxx>
#include <osl/mutex.hxx>
#include <comphelper/interfacecontainer2.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <osl/mutex.hxx>
#include <svl/itemprop.hxx>
#include <svl/listener.hxx>
#include <vcl/svapp.hxx>
#include <xmloff/odffields.hxx>
#include <TextCursorHelper.hxx>
#include <unotextrange.hxx>
......@@ -34,16 +40,12 @@
#include <docary.hxx>
#include <swundo.hxx>
#include <docsh.hxx>
#include <xmloff/odffields.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/sequence.hxx>
#include <svl/itemprop.hxx>
using namespace ::sw::mark;
using namespace ::com::sun::star;
class SwXBookmark::Impl
: public SwClient
: public SvtListener
{
private:
::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
......@@ -51,13 +53,12 @@ private:
public:
uno::WeakReference<uno::XInterface> m_wThis;
::comphelper::OInterfaceContainerHelper2 m_EventListeners;
SwDoc * m_pDoc;
::sw::mark::IMark * m_pRegisteredBookmark;
SwDoc* m_pDoc;
::sw::mark::IMark* m_pRegisteredBookmark;
OUString m_sMarkName;
Impl( SwDoc *const pDoc )
: SwClient()
, m_EventListeners(m_Mutex)
: m_EventListeners(m_Mutex)
, m_pDoc(pDoc)
, m_pRegisteredBookmark(nullptr)
{
......@@ -66,19 +67,14 @@ public:
void registerInMark(SwXBookmark & rThis, ::sw::mark::IMark *const pBkmk);
protected:
// SwClient
virtual void Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew) override;
virtual void Notify(const SfxHint&) override;
};
void SwXBookmark::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
void SwXBookmark::Impl::Notify(const SfxHint& rHint)
{
ClientModify(this, pOld, pNew);
if (GetRegisteredIn())
if(rHint.GetId() == SfxHintId::Dying)
{
return; // core object still alive
}
m_pRegisteredBookmark = nullptr;
m_pDoc = nullptr;
uno::Reference<uno::XInterface> const xThis(m_wThis);
......@@ -88,15 +84,17 @@ void SwXBookmark::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
}
lang::EventObject const ev(xThis);
m_EventListeners.disposeAndClear(ev);
}
}
void SwXBookmark::Impl::registerInMark(SwXBookmark & rThis,
::sw::mark::IMark *const pBkmk)
void SwXBookmark::Impl::registerInMark(SwXBookmark& rThis,
::sw::mark::IMark* const pBkmk)
{
const uno::Reference<text::XTextContent> xBookmark(& rThis);
const uno::Reference<text::XTextContent> xBookmark(&rThis);
if (pBkmk)
{
pBkmk->Add(this);
EndListeningAll();
StartListening(pBkmk->GetNotifier());
::sw::mark::MarkBase *const pMarkBase(dynamic_cast< ::sw::mark::MarkBase * >(pBkmk));
OSL_ENSURE(pMarkBase, "registerInMark: no MarkBase?");
if (pMarkBase)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment