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>
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 2519cf4..984747d 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -136,9 +136,11 @@
    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 @@
    {
        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 64d6d00..91ab13c 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, 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 10a5b5e..557a5f2 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1875,6 +1875,15 @@
    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 @@
        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 @@
                    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 @@
                    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 1d6860f..2fe6bf5 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3253,7 +3253,7 @@
    // ... and notify listeners
    if ( rNode.HasWriterListeners() )
    {
        SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich);
        SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich, aWhichSublist);

        rNode.ModifyNotification( nullptr, &aHint );
    }