summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-01-22 11:09:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-01-22 12:58:29 +0100
commitf9fe988b7f463bc221dd3b67dcf0ed39309f921a (patch)
treedce6a289a49aac2cdbff0a90a07fcc315bb74175
parentce61c4952e7e6d8528c97d3defb9edfc25cf7ce7 (diff)
tdf#117935 Accessible text-attributes-changed signals...
... should only be emitted when the text attributes have changed [a11y] second attempt. This appears to have begin at commit 7d9bb549d498d6beed2c4050c402d09643febdfa Date: Mon Jun 2 15:00:50 2014 +0000 Related: #i124638# Second step of DrawingLayer FillAttributes... Which accidentally removed the aWhichSublist param from the SwUpdateAttr constructor in SwpHints::TryInsertHint. Change-Id: If435ea71e8d84e0d8497cd7106cfdbebcc6af7a0 Reviewed-on: https://gerrit.libreoffice.org/66719 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/inc/hints.hxx7
-rw-r--r--sw/source/core/attr/hints.cxx5
-rw-r--r--sw/source/core/text/txtfrm.cxx27
-rw-r--r--sw/source/core/txtnode/thints.cxx2
4 files changed, 37 insertions, 4 deletions
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 2519cf4700a9..984747dcf368 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -136,9 +136,11 @@ private:
sal_Int32 const m_nStart;
sal_Int32 const m_nEnd;
sal_uInt16 const m_nWhichAttr;
+ std::vector<sal_uInt16> m_aWhichFmtAttrs; // attributes changed inside RES_TXTATR_AUTOFMT
public:
SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW );
+ SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW );
sal_Int32 getStart() const
{
@@ -154,6 +156,11 @@ public:
{
return m_nWhichAttr;
}
+
+ const std::vector<sal_uInt16>& getFmtAttrs() const
+ {
+ return m_aWhichFmtAttrs;
+ }
};
/** SwRefMarkFieldUpdate is sent when the referencemarks should be updated.
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index 64d6d00639c8..91ab13c4d426 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -70,6 +70,11 @@ SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW )
{
}
+SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW )
+ : SwMsgPoolItem( RES_UPDATE_ATTR ), m_nStart( nS ), m_nEnd( nE ), m_nWhichAttr( nW ), m_aWhichFmtAttrs( aW )
+{
+}
+
SwRefMarkFieldUpdate::SwRefMarkFieldUpdate( OutputDevice* pOutput )
: SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
pOut( pOutput )
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 10a5b5e56270..557a5f226afb 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1875,6 +1875,15 @@ static bool isA11yRelevantAttribute(sal_uInt16 nWhich)
return nWhich != RES_CHRATR_RSID;
}
+static bool hasA11yRelevantAttribute( const std::vector<sal_uInt16>& rWhichFmtAttr )
+{
+ for( sal_uInt16 nWhich : rWhichFmtAttr )
+ if ( isA11yRelevantAttribute( nWhich ) )
+ return true;
+
+ return false;
+}
+
// Note: for now this overrides SwClient::SwClientNotify; the intermediary
// classes still override SwClient::Modify, which should continue to work
// as their implementation of SwClientNotify is SwClient's which calls Modify.
@@ -2132,8 +2141,10 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
break;
case RES_UPDATE_ATTR:
{
- sal_Int32 const nNPos = static_cast<const SwUpdateAttr*>(pNew)->getStart();
- sal_Int32 const nNLen = static_cast<const SwUpdateAttr*>(pNew)->getEnd() - nNPos;
+ const SwUpdateAttr* pNewUpdate = static_cast<const SwUpdateAttr*>(pNew);
+
+ sal_Int32 const nNPos = pNewUpdate->getStart();
+ sal_Int32 const nNLen = pNewUpdate->getEnd() - nNPos;
nPos = MapModelToView(&rNode, nNPos);
nLen = MapModelToView(&rNode, nNPos + nNLen) - nPos;
if( IsIdxInside( nPos, nLen ) )
@@ -2147,7 +2158,7 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
nLen = TextFrameIndex(1);
InvalidateRange_( SwCharRange( nPos, nLen) );
- const sal_uInt16 nTmp = static_cast<const SwUpdateAttr*>(pNew)->getWhichAttr();
+ const sal_uInt16 nTmp = pNewUpdate->getWhichAttr();
if( ! nTmp || RES_TXTATR_CHARFMT == nTmp || RES_TXTATR_INETFMT == nTmp || RES_TXTATR_AUTOFMT == nTmp ||
RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp )
@@ -2156,6 +2167,16 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
lcl_SetScriptInval( *this, nPos );
}
}
+
+ if( isA11yRelevantAttribute( pNewUpdate->getWhichAttr() ) &&
+ hasA11yRelevantAttribute( pNewUpdate->getFmtAttrs() ) )
+ {
+ SwViewShell* pViewSh = getRootFrame() ? getRootFrame()->GetCurrShell() : nullptr;
+ if ( pViewSh )
+ {
+ pViewSh->InvalidateAccessibleParaAttrs( *this );
+ }
+ }
}
break;
case RES_OBJECTDYING:
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 1d6860f4d959..2fe6bf53c462 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3253,7 +3253,7 @@ bool SwpHints::TryInsertHint(
// ... and notify listeners
if ( rNode.HasWriterListeners() )
{
- SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich);
+ SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich, aWhichSublist);
rNode.ModifyNotification( nullptr, &aHint );
}