diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-06-06 03:26:12 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-06-09 12:55:04 +0200 |
commit | c9a343935f6c480dcaf0145c2f27db08b4ae01a5 (patch) | |
tree | a37901451332aa328b3c637ce875c7e7d7c8cd82 /sw | |
parent | 50924ebfd40469204323134a3b20cb20591f4890 (diff) |
use UnoCursorPointer in SwXTextPortion
Change-Id: I8628fd1fecb3e2cf54704f9844ff921862da46e5
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/unoport.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unoport.cxx | 18 |
2 files changed, 4 insertions, 20 deletions
diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx index 4e6609725953..f6ee60e3454f 100644 --- a/sw/source/core/inc/unoport.hxx +++ b/sw/source/core/inc/unoport.hxx @@ -114,7 +114,7 @@ private: ::std::unique_ptr< ::com::sun::star::uno::Any > m_pRubyStyle; ::std::unique_ptr< ::com::sun::star::uno::Any > m_pRubyAdjust; ::std::unique_ptr< ::com::sun::star::uno::Any > m_pRubyIsAbove; - std::shared_ptr<SwUnoCrsr> m_pUnoCursor; + sw::UnoCursorPointer m_pUnoCursor; const SwDepend m_FrameDepend; SwFrameFormat * m_pFrameFormat; @@ -151,8 +151,6 @@ protected: //SwClient virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE; - virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) SAL_OVERRIDE; - public: SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const& rParent, SwTextPortionType eType ); @@ -242,7 +240,7 @@ public: SwTextPortionType GetTextPortionType() const { return m_ePortionType; } SwUnoCrsr* GetCursor() const - {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));} + { return const_cast<SwUnoCrsr*>(&(*m_pUnoCursor)); } }; class SwXTextPortionEnumeration diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 996f4ea200fa..22980fe6e4ad 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -69,7 +69,6 @@ void SwXTextPortion::init(const SwUnoCrsr* pPortionCursor) m_pUnoCursor->SetMark(); *m_pUnoCursor->GetMark() = *pPortionCursor->GetMark(); } - m_pUnoCursor->Add(this); } SwXTextPortion::SwXTextPortion( @@ -138,10 +137,7 @@ SwXTextPortion::SwXTextPortion( } SwXTextPortion::~SwXTextPortion() -{ - if(m_pUnoCursor) - m_pUnoCursor->Remove(this); -}; +{ } uno::Reference< text::XText > SwXTextPortion::getText() throw( uno::RuntimeException, std::exception ) @@ -922,17 +918,7 @@ void SwXTextPortion::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) ClientModify(this, pOld, pNew); if (!m_FrameDepend.GetRegisteredIn()) { - m_pFrameFormat = 0; - } -} - -void SwXTextPortion::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) -{ - SwClient::SwClientNotify(rModify, rHint); - if(m_pUnoCursor && typeid(rHint) == typeid(sw::DocDisposingHint)) - { - m_pUnoCursor->Remove(this); - m_pUnoCursor.reset(); + m_pFrameFormat = nullptr; } } |