Kaydet (Commit) f9fe988b authored tarafından Noel Grandin's avatar Noel Grandin

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 7d9bb549
    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: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ce61c495
...@@ -136,9 +136,11 @@ private: ...@@ -136,9 +136,11 @@ private:
sal_Int32 const m_nStart; sal_Int32 const m_nStart;
sal_Int32 const m_nEnd; sal_Int32 const m_nEnd;
sal_uInt16 const m_nWhichAttr; sal_uInt16 const m_nWhichAttr;
std::vector<sal_uInt16> m_aWhichFmtAttrs; // attributes changed inside RES_TXTATR_AUTOFMT
public: public:
SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW ); 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 sal_Int32 getStart() const
{ {
...@@ -154,6 +156,11 @@ public: ...@@ -154,6 +156,11 @@ public:
{ {
return m_nWhichAttr; return m_nWhichAttr;
} }
const std::vector<sal_uInt16>& getFmtAttrs() const
{
return m_aWhichFmtAttrs;
}
}; };
/** SwRefMarkFieldUpdate is sent when the referencemarks should be updated. /** SwRefMarkFieldUpdate is sent when the referencemarks should be updated.
......
...@@ -70,6 +70,11 @@ SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW ) ...@@ -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 ) SwRefMarkFieldUpdate::SwRefMarkFieldUpdate( OutputDevice* pOutput )
: SwMsgPoolItem( RES_REFMARKFLD_UPDATE ), : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
pOut( pOutput ) pOut( pOutput )
......
...@@ -1875,6 +1875,15 @@ static bool isA11yRelevantAttribute(sal_uInt16 nWhich) ...@@ -1875,6 +1875,15 @@ static bool isA11yRelevantAttribute(sal_uInt16 nWhich)
return nWhich != RES_CHRATR_RSID; 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 // Note: for now this overrides SwClient::SwClientNotify; the intermediary
// classes still override SwClient::Modify, which should continue to work // classes still override SwClient::Modify, which should continue to work
// as their implementation of SwClientNotify is SwClient's which calls Modify. // as their implementation of SwClientNotify is SwClient's which calls Modify.
...@@ -2132,8 +2141,10 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) ...@@ -2132,8 +2141,10 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
break; break;
case RES_UPDATE_ATTR: case RES_UPDATE_ATTR:
{ {
sal_Int32 const nNPos = static_cast<const SwUpdateAttr*>(pNew)->getStart(); const SwUpdateAttr* pNewUpdate = static_cast<const SwUpdateAttr*>(pNew);
sal_Int32 const nNLen = static_cast<const SwUpdateAttr*>(pNew)->getEnd() - nNPos;
sal_Int32 const nNPos = pNewUpdate->getStart();
sal_Int32 const nNLen = pNewUpdate->getEnd() - nNPos;
nPos = MapModelToView(&rNode, nNPos); nPos = MapModelToView(&rNode, nNPos);
nLen = MapModelToView(&rNode, nNPos + nNLen) - nPos; nLen = MapModelToView(&rNode, nNPos + nNLen) - nPos;
if( IsIdxInside( nPos, nLen ) ) if( IsIdxInside( nPos, nLen ) )
...@@ -2147,7 +2158,7 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) ...@@ -2147,7 +2158,7 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
nLen = TextFrameIndex(1); nLen = TextFrameIndex(1);
InvalidateRange_( SwCharRange( nPos, nLen) ); 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 || if( ! nTmp || RES_TXTATR_CHARFMT == nTmp || RES_TXTATR_INETFMT == nTmp || RES_TXTATR_AUTOFMT == nTmp ||
RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp ) RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp )
...@@ -2156,6 +2167,16 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) ...@@ -2156,6 +2167,16 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
lcl_SetScriptInval( *this, nPos ); lcl_SetScriptInval( *this, nPos );
} }
} }
if( isA11yRelevantAttribute( pNewUpdate->getWhichAttr() ) &&
hasA11yRelevantAttribute( pNewUpdate->getFmtAttrs() ) )
{
SwViewShell* pViewSh = getRootFrame() ? getRootFrame()->GetCurrShell() : nullptr;
if ( pViewSh )
{
pViewSh->InvalidateAccessibleParaAttrs( *this );
}
}
} }
break; break;
case RES_OBJECTDYING: case RES_OBJECTDYING:
......
...@@ -3253,7 +3253,7 @@ bool SwpHints::TryInsertHint( ...@@ -3253,7 +3253,7 @@ bool SwpHints::TryInsertHint(
// ... and notify listeners // ... and notify listeners
if ( rNode.HasWriterListeners() ) if ( rNode.HasWriterListeners() )
{ {
SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich); SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich, aWhichSublist);
rNode.ModifyNotification( nullptr, &aHint ); rNode.ModifyNotification( nullptr, &aHint );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment