summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-10-05 18:50:53 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-15 15:09:57 +0100
commit9933690d08667f410cdab34d4c698cf80f046a56 (patch)
treee9c846c1e7387598757c787be4655f8d5ea29649
parenta12bb53c861c878b53602c455f42f2b7e60e3c26 (diff)
sw_redlinehide_3: stop SwAccessibleParagraph listening at SwTextNode
The SwAccessibleParagraph is a client of SwTextNode, just so that it can dispose its mpParaChangeTrackInfo on any and all editing operations. This won't work with merged paragraphs, but on the other hand it's not necessary with merged paragraphs because the initChangeTrackTextMarkupLists() does nothing if IsHideRedlines(). However there is the problem that the node and the frame might become mis-matched if the frame is "moved around", so to avoid problems due to that, listen on the SwTextFrame instead of the node, and have the SwTextFrame relay any events it gets. Though the frame is only SwClient, this is now possible thanks to the SfxBroadcaster on the SwFrame class, so convert to SfxListener; also the Accessible lifetime is tied to SwTextFrame anyway. In UnHideRedlines(), send a dummy event too so that toggling Show/Hide disposes the mpParaChangeTrackInfo too, which previously happened as a side effect of moving the redlines around in the nodes-array. Change-Id: I4e5a7107cb55d408266ee42463f9fa2a4a8b721b
-rw-r--r--sw/source/core/access/accpara.cxx8
-rw-r--r--sw/source/core/access/accpara.hxx4
-rw-r--r--sw/source/core/layout/wsfrm.cxx1
-rw-r--r--sw/source/core/text/txtfrm.cxx2
4 files changed, 8 insertions, 7 deletions
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index d07f68d9951d..60b5a6e0bbf9 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -533,8 +533,7 @@ void SwAccessibleParagraph::InvalidateFocus_()
SwAccessibleParagraph::SwAccessibleParagraph(
std::shared_ptr<SwAccessibleMap> const& pInitMap,
const SwTextFrame& rTextFrame )
- : SwClient( const_cast<SwTextNode*>(rTextFrame.GetTextNode()) ) // #i108125#
- , SwAccessibleContext( pInitMap, AccessibleRole::PARAGRAPH, &rTextFrame )
+ : SwAccessibleContext( pInitMap, AccessibleRole::PARAGRAPH, &rTextFrame )
, m_sDesc()
, m_nOldCaretPos( -1 )
, m_bIsHeading( false )
@@ -544,6 +543,7 @@ SwAccessibleParagraph::SwAccessibleParagraph(
, mpParaChangeTrackInfo( new SwParaChangeTrackingInfo( rTextFrame ) ) // #i108125#
, m_bLastHasSelection(false) //To add TEXT_SELECTION_CHANGED event
{
+ StartListening(const_cast<SwTextFrame&>(rTextFrame));
m_bIsHeading = IsHeading();
//Get the real heading level, Heading1 ~ Heading10
m_nHeadingLevel = GetRealHeadingLevel();
@@ -3517,11 +3517,9 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
}
// #i108125#
-void SwAccessibleParagraph::Modify( const SfxPoolItem* pOld, const SfxPoolItem* /*pNew*/ )
+void SwAccessibleParagraph::Notify(SfxBroadcaster&, const SfxHint&)
{
mpParaChangeTrackInfo->reset();
-
- CheckRegistration( pOld );
}
bool SwAccessibleParagraph::GetSelectionAtIndex(
diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx
index 3179edacd458..ef5234f46ae8 100644
--- a/sw/source/core/access/accpara.hxx
+++ b/sw/source/core/access/accpara.hxx
@@ -53,7 +53,7 @@ typedef std::unordered_map< OUString,
css::beans::PropertyValue > tAccParaPropValMap;
class SwAccessibleParagraph :
- public SwClient, // #i108125#
+ public SfxListener,
public SwAccessibleContext,
public css::accessibility::XAccessibleEditableText,
public css::accessibility::XAccessibleSelection,
@@ -225,7 +225,7 @@ protected:
sal_Int32 nPos,
sal_Int16 aTextType );
- virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew) override;
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
public:
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index fa8c6be8254c..69f6b1185134 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4340,6 +4340,7 @@ static void UnHideRedlines(SwRootFrame & rLayout,
pFrame->SetMergedPara(nullptr);
}
}
+ pFrame->Broadcast(SfxHint()); // notify SwAccessibleParagraph
}
}
if (!rNode.IsCreateFrameWhenHidingRedlines())
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index fc94e79a8648..04d416a0b7c4 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1823,6 +1823,8 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
}
}
+ Broadcast(SfxHint()); // notify SwAccessibleParagraph
+
// while locked ignore all modifications
if( IsLocked() )
return;