add SAL_WARN_UNUSED to sw::Ring and friends

Change-Id: Ic90e4357089c1f487dd5738f9c14862ce95d611d
Reviewed-on: https://gerrit.libreoffice.org/36408
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index fecfa98..8432021 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -34,7 +34,7 @@ class IMark;
}

/// Marks a character position inside a document model node.
class SW_DLLPUBLIC SwIndex
class SAL_WARN_UNUSED SW_DLLPUBLIC SwIndex
{
private:
    friend class SwIndexReg;
@@ -107,7 +107,7 @@ public:

SW_DLLPUBLIC std::ostream& operator <<(std::ostream& s, const SwIndex& index);

class SwIndexReg
class SAL_WARN_UNUSED SwIndexReg
{
    friend class SwIndex;
    friend bool sw_PosOk(const SwPosition & aPos);
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 2fe0e6a..380cc878 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -46,7 +46,7 @@ namespace utl {
}

/// Marks a position in the document model.
struct SW_DLLPUBLIC SwPosition
struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
{
    SwNodeIndex nNode;
    SwIndex nContent;
@@ -147,7 +147,7 @@ SW_DLLPUBLIC bool GoInContentSkipHidden( SwPaM&, SwMoveFnCollection const &);
SW_DLLPUBLIC bool GoInContentCellsSkipHidden( SwPaM&, SwMoveFnCollection const &);

/// PaM is Point and Mark: a selection of the document model.
class SW_DLLPUBLIC SwPaM : public sw::Ring<SwPaM>
class SAL_WARN_UNUSED SW_DLLPUBLIC SwPaM : public sw::Ring<SwPaM>
{
    SwPosition   m_Bound1;
    SwPosition   m_Bound2;
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index ad9cce5..a03db4c 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -36,7 +36,7 @@ namespace sw
     * @example sw/qa/core/uwriter.cxx
     */
    template <typename value_type>
    class Ring
    class SAL_WARN_UNUSED Ring
    {
        public:
            typedef typename std::add_const<value_type>::type const_value_type;
@@ -148,7 +148,7 @@ namespace sw
     * helper class that provides Svalue_typeL-style container iteration to the ring
     */
    template <typename value_type>
    class RingContainer final
    class SAL_WARN_UNUSED RingContainer final
    {
        private:
            /** the item in the ring where iteration starts */
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index e0df520..7f2d5fb 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1067,7 +1067,6 @@ void SwDocTest::randomTest()

        for( int i = 0; i < 2000; i++ )
        {
            SwPaM aPam(m_pDoc->GetNodes());
            SwCursor aCrs(getRandomPosition(m_pDoc, i/20), nullptr);
            aCrs.SetMark();

diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 5ec175e..722e2bb 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1416,8 +1416,6 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
    OUString strTypeName;
    SwFieldMgr aMgr;
    SwTextField* pTextField = nullptr;
    SwTextNode* pTextNd = const_cast<SwTextNode*>( GetTextNode() );
    SwIndex fldIndex( pTextNd, nIndex );
    sal_Int32 nFieldIndex = GetPortionData().GetFieldIndex(nIndex);
    if (nFieldIndex >= 0)
    {
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 2a26848..06fc61b 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1487,12 +1487,9 @@ bool SwDoc::HasInvisibleContent() const
    for( sal_uLong n = GetNodes().Count()-1; n; --n)
    {
        SwTextNode* pTextNd = GetNodes()[ n ]->GetTextNode();
        if ( pTextNd )
        {
            SwPaM aPam(*pTextNd, 0, *pTextNd, pTextNd->GetText().getLength());
            if( pTextNd->HasHiddenCharAttribute( true ) ||  ( pTextNd->HasHiddenCharAttribute( false ) ) )
                return true;
        }
        if ( pTextNd &&
             ( pTextNd->HasHiddenCharAttribute( true ) || pTextNd->HasHiddenCharAttribute( false ) ) )
            return true;
    }

    for(auto pSectFormat : GetSections())
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 314e4c8..0ccc138 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1431,7 +1431,6 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos)
                    }
                }

                SwPosition aEnd( *pEnd );
                *GetPoint() = *pEnd;
                *GetMark() = *pEnd;
                DeleteMark();
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 2cf915e..444f4de 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1045,9 +1045,6 @@ bool SwFEShell::Paste( SwDoc* pClpDoc )
                // **
                // ** Update SwDoc::Append, if you change the following code **
                // **

                SwPosition aInsertPosition( rInsPos );

                {
                    SwNodeIndex aIndexBefore(rInsPos.nNode);

diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index e248ae8..92d77dd 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -360,7 +360,6 @@ SwXFootnote::getAnchor()

    SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
    SwPaM aPam( pTextFootnote->GetTextNode(), pTextFootnote->GetStart() );
    SwPosition aMark( *aPam.Start() );
    aPam.SetMark();
    ++aPam.GetMark()->nContent;
    const uno::Reference< text::XTextRange > xRet =