use new UnoCursorPointer in SwXTextPortionEnumeration
Change-Id: If6b64c92d4f6f786767802cc046ccd96bd8367cb
This commit is contained in:
@@ -249,13 +249,12 @@ class SwXTextPortionEnumeration
|
|||||||
, ::com::sun::star::lang::XServiceInfo
|
, ::com::sun::star::lang::XServiceInfo
|
||||||
, ::com::sun::star::lang::XUnoTunnel
|
, ::com::sun::star::lang::XUnoTunnel
|
||||||
>
|
>
|
||||||
, public SwClient
|
|
||||||
{
|
{
|
||||||
TextRangeList_t m_Portions; // contains all portions, filled by ctor
|
TextRangeList_t m_Portions; // contains all portions, filled by ctor
|
||||||
std::shared_ptr<SwUnoCrsr> m_pUnoCrsr;
|
sw::UnoCursorPointer m_pUnoCrsr;
|
||||||
|
|
||||||
SwUnoCrsr* GetCursor() const
|
SwUnoCrsr* GetCursor() const
|
||||||
{return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
|
{return const_cast<SwUnoCrsr*>(&(*m_pUnoCrsr));}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~SwXTextPortionEnumeration();
|
virtual ~SwXTextPortionEnumeration();
|
||||||
@@ -292,10 +291,6 @@ public:
|
|||||||
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
|
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
|
||||||
getSupportedServiceNames()
|
getSupportedServiceNames()
|
||||||
throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
|
throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
|
||||||
protected:
|
|
||||||
//SwClient
|
|
||||||
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
|
|
||||||
virtual void SwClientNotify(const SwModify&, const SfxHint&) SAL_OVERRIDE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SwXRedlinePortion : public SwXTextPortion
|
class SwXRedlinePortion : public SwXTextPortion
|
||||||
|
@@ -364,7 +364,6 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
|
|||||||
: m_Portions()
|
: m_Portions()
|
||||||
{
|
{
|
||||||
m_pUnoCrsr = rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), false);
|
m_pUnoCrsr = rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), false);
|
||||||
m_pUnoCrsr->Add(this);
|
|
||||||
|
|
||||||
OSL_ENSURE(nEnd == -1 || (nStart <= nEnd &&
|
OSL_ENSURE(nEnd == -1 || (nStart <= nEnd &&
|
||||||
nEnd <= m_pUnoCrsr->Start()->nNode.GetNode().GetTextNode()->GetText().getLength()),
|
nEnd <= m_pUnoCrsr->Start()->nNode.GetNode().GetTextNode()->GetText().getLength()),
|
||||||
@@ -373,7 +372,7 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
|
|||||||
// find all frames, graphics and OLEs that are bound AT character in para
|
// find all frames, graphics and OLEs that are bound AT character in para
|
||||||
FrameClientSortList_t frames;
|
FrameClientSortList_t frames;
|
||||||
::CollectFrameAtNode(m_pUnoCrsr->GetPoint()->nNode, frames, true);
|
::CollectFrameAtNode(m_pUnoCrsr->GetPoint()->nNode, frames, true);
|
||||||
lcl_CreatePortions(m_Portions, xParentText, m_pUnoCrsr.get(), frames, nStart, nEnd);
|
lcl_CreatePortions(m_Portions, xParentText, GetCursor(), frames, nStart, nEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
SwXTextPortionEnumeration::SwXTextPortionEnumeration(
|
SwXTextPortionEnumeration::SwXTextPortionEnumeration(
|
||||||
@@ -382,14 +381,10 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
|
|||||||
: m_Portions( rPortions )
|
: m_Portions( rPortions )
|
||||||
{
|
{
|
||||||
m_pUnoCrsr = rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), false);
|
m_pUnoCrsr = rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), false);
|
||||||
m_pUnoCrsr->Add(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
|
SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
|
||||||
{
|
{ }
|
||||||
if(m_pUnoCrsr)
|
|
||||||
m_pUnoCrsr->Remove(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
sal_Bool SwXTextPortionEnumeration::hasMoreElements()
|
sal_Bool SwXTextPortionEnumeration::hasMoreElements()
|
||||||
throw( uno::RuntimeException, std::exception )
|
throw( uno::RuntimeException, std::exception )
|
||||||
@@ -1401,19 +1396,4 @@ static void lcl_CreatePortions(
|
|||||||
"CreatePortions: stack error" );
|
"CreatePortions: stack error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwXTextPortionEnumeration::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
|
|
||||||
{
|
|
||||||
ClientModify(this, pOld, pNew);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SwXTextPortionEnumeration::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
|
|
||||||
{
|
|
||||||
SwClient::SwClientNotify(rModify, rHint);
|
|
||||||
if(!GetRegisteredIn() || typeid(rHint) == typeid(sw::DocDisposingHint))
|
|
||||||
{
|
|
||||||
m_pUnoCrsr->Remove(this);
|
|
||||||
m_pUnoCrsr.reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Reference in New Issue
Block a user