diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-22 11:09:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-22 12:58:29 +0100 |
commit | f9fe988b7f463bc221dd3b67dcf0ed39309f921a (patch) | |
tree | dce6a289a49aac2cdbff0a90a07fcc315bb74175 /sw/source/core/text/txtfrm.cxx | |
parent | ce61c4952e7e6d8528c97d3defb9edfc25cf7ce7 (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>
Diffstat (limited to 'sw/source/core/text/txtfrm.cxx')
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 27 |
1 files changed, 24 insertions, 3 deletions
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: |