summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-10-16 13:51:54 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-15 15:10:00 +0100
commitfe1d3328997741b55202aca7b3dc566ca833a5f4 (patch)
tree7c574b532e3f70e08b843fc2ebc01fcf4984e1ea /sw
parent80ffd0d8cf638808ad73c8de69b8a0fa19b16604 (diff)
sw_redlinehide_3: add second footnote number
Add a separate footnote number to SwFormatFootnote for the case when the layout hides redlines. If the footnote is in a delete redline, the value will be an arbitrary number, let's use the same number as the last visible footnote for simplicity. Change-Id: Ic7fff9d1bb2c90f5ad811b859c6501a193b7ae70
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/fmtftn.hxx3
-rw-r--r--sw/inc/ftnidx.hxx10
-rw-r--r--sw/inc/txtftn.hxx2
-rw-r--r--sw/source/core/doc/docdesc.cxx2
-rw-r--r--sw/source/core/doc/docftn.cxx10
-rw-r--r--sw/source/core/doc/ftnidx.cxx176
-rw-r--r--sw/source/core/layout/ftnfrm.cxx26
-rw-r--r--sw/source/core/txtnode/atrftn.cxx7
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx2
9 files changed, 194 insertions, 44 deletions
diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx
index 1aa2e6f315d9..b6560544b12f 100644
--- a/sw/inc/fmtftn.hxx
+++ b/sw/inc/fmtftn.hxx
@@ -44,6 +44,7 @@ class SW_DLLPUBLIC SwFormatFootnote
SwTextFootnote* m_pTextAttr; ///< My TextAttribute.
OUString m_aNumber; ///< User-defined 'Number'.
sal_uInt16 m_nNumber; ///< automatic sequence number
+ sal_uInt16 m_nNumberRLHidden; ///< automatic sequence number (hidden redlines)
bool m_bEndNote; ///< Is it an End note?
css::uno::WeakReference<css::text::XFootnote> m_wXFootnote;
@@ -67,6 +68,7 @@ public:
const OUString& GetNumStr() const { return m_aNumber; }
sal_uInt16 GetNumber() const { return m_nNumber; }
+ sal_uInt16 GetNumberRLHidden() const { return m_nNumberRLHidden; }
bool IsEndNote() const { return m_bEndNote;}
void SetNumStr( const OUString& rStr ) { m_aNumber = rStr; }
@@ -75,6 +77,7 @@ public:
void SetNumber( const SwFormatFootnote& rFootnote )
{
m_nNumber = rFootnote.m_nNumber;
+ m_nNumberRLHidden = rFootnote.m_nNumberRLHidden;
m_aNumber = rFootnote.m_aNumber;
}
diff --git a/sw/inc/ftnidx.hxx b/sw/inc/ftnidx.hxx
index 41205a34b540..3dfb118a1f6b 100644
--- a/sw/inc/ftnidx.hxx
+++ b/sw/inc/ftnidx.hxx
@@ -23,6 +23,7 @@
#include <sal/types.h>
#include <o3tl/sorted_vector.hxx>
+class IDocumentRedlineAccess;
class SwTextFootnote;
class SwNodeIndex;
class SwSectionNode;
@@ -51,7 +52,7 @@ public:
class SwUpdFootnoteEndNtAtEnd
{
std::vector<const SwSectionNode*> aFootnoteSects, aEndSects;
- std::vector<sal_uInt16> aFootnoteNums, aEndNums;
+ std::vector<std::pair<sal_uInt16, sal_uInt16>> aFootnoteNums, aEndNums;
public:
SwUpdFootnoteEndNtAtEnd() : aFootnoteSects(), aEndSects() {}
@@ -59,8 +60,11 @@ public:
static const SwSectionNode* FindSectNdWithEndAttr(
const SwTextFootnote& rTextFootnote );
- sal_uInt16 GetNumber( const SwTextFootnote& rTextFootnote, const SwSectionNode& rNd );
- sal_uInt16 ChkNumber( const SwTextFootnote& rTextFootnote );
+ std::pair<sal_uInt16, sal_uInt16> GetNumber(
+ IDocumentRedlineAccess const&, const SwTextFootnote& rTextFootnote,
+ const SwSectionNode& rNd);
+ std::pair<sal_uInt16, sal_uInt16> ChkNumber(
+ IDocumentRedlineAccess const&, const SwTextFootnote& rTextFootnote);
};
#endif // INCLUDED_SW_INC_FTNIDX_HXX
diff --git a/sw/inc/txtftn.hxx b/sw/inc/txtftn.hxx
index 9349750e70ec..b18011444c90 100644
--- a/sw/inc/txtftn.hxx
+++ b/sw/inc/txtftn.hxx
@@ -40,7 +40,7 @@ public:
SwNodeIndex *GetStartNode() const { return m_pStartNode.get(); }
void SetStartNode( const SwNodeIndex *pNode, bool bDelNodes = true );
- void SetNumber( const sal_uInt16 nNumber, const OUString &sNumStr );
+ void SetNumber(sal_uInt16 nNumber, sal_uInt16 nNumberRLHidden, const OUString &sNumStr);
void CopyFootnote(SwTextFootnote & rDest, SwTextNode & rDestNode) const;
// Get and set TextNode pointer.
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index d64aeaccebc2..ac172c00a94c 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -424,7 +424,7 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged )
{
SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
- pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr());
+ pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rFootnote.GetNumStr());
}
}
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 49afc0c9d42b..2b911947ab53 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -228,7 +228,7 @@ void SwEndNoteInfo::SwClientNotify( const SwModify& rModify, const SfxHint& rHin
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
if ( rFootnote.IsEndNote() == m_bEndNote )
{
- pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr());
+ pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rFootnote.GetNumStr());
}
}
}
@@ -337,7 +337,7 @@ void SwDoc::SetFootnoteInfo(const SwFootnoteInfo& rInfo)
SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
if ( !rFootnote.IsEndNote() )
- pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr());
+ pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rFootnote.GetNumStr());
}
}
}
@@ -407,7 +407,7 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
if ( rFootnote.IsEndNote() )
- pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr());
+ pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rFootnote.GetNumStr());
}
}
}
@@ -473,7 +473,7 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
pUndo->GetHistory().Add( *pTextFootnote );
}
- pTextFootnote->SetNumber(rFootnote.GetNumber(), rNumStr);
+ pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rNumStr);
if( rFootnote.IsEndNote() != bIsEndNote )
{
const_cast<SwFormatFootnote&>(rFootnote).SetEndNote( bIsEndNote );
@@ -503,7 +503,7 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
pUndo->GetHistory().Add( *pTextFootnote );
}
- pTextFootnote->SetNumber(rFootnote.GetNumber(), rNumStr);
+ pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rNumStr);
if( rFootnote.IsEndNote() != bIsEndNote )
{
const_cast<SwFormatFootnote&>(rFootnote).SetEndNote( bIsEndNote );
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
index 5b753c56733c..d4aad90404bc 100644
--- a/sw/source/core/doc/ftnidx.cxx
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -22,6 +22,8 @@
#include <ftninfo.hxx>
#include <doc.hxx>
#include <IDocumentLayoutAccess.hxx>
+#include <IDocumentRedlineAccess.hxx>
+#include <redline.hxx>
#include <ftnidx.hxx>
#include <ndtxt.hxx>
#include <ndindex.hxx>
@@ -29,6 +31,18 @@
#include <fmtftntx.hxx>
#include <rootfrm.hxx>
+static bool IsFootnoteDeleted(IDocumentRedlineAccess const& rIDRA,
+ SwTextFootnote const& rTextFootnote)
+{
+ SwRedlineTable::size_type tmp;
+ SwPosition const pos(const_cast<SwTextNode&>(rTextFootnote.GetTextNode()),
+ rTextFootnote.GetStart());
+ SwRangeRedline const*const pRedline(rIDRA.GetRedline(pos, &tmp));
+ return (pRedline
+ && pRedline->GetType() == nsRedlineType_t::REDLINE_DELETE
+ && *pRedline->GetPoint() != *pRedline->GetMark());
+}
+
bool CompareSwFootnoteIdxs::operator()(SwTextFootnote* const& lhs, SwTextFootnote* const& rhs) const
{
sal_uLong nIdxLHS = SwTextFootnote_GetIndex( lhs );
@@ -49,6 +63,7 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
const SwFootnoteInfo& rFootnoteInfo = pDoc->GetFootnoteInfo();
+ IDocumentRedlineAccess const& rIDRA(pDoc->getIDocumentRedlineAccess());
// For normal foot notes we treat per-chapter and per-document numbering
// separately. For Endnotes we only have per-document numbering.
@@ -78,6 +93,7 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
size_t nPos = 0;
size_t nFootnoteNo = 1;
+ size_t nFootnoteNoHidden = 1;
if( SeekEntry( *pCapStt, &nPos ) && nPos )
{
// Step forward until the Index is not the same anymore
@@ -91,7 +107,13 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
return;
if( rOutlNds.empty() )
+ {
nFootnoteNo = nPos+1;
+ if (nPos)
+ {
+ nFootnoteNoHidden = (*this)[nPos - 1]->GetFootnote().GetNumberRLHidden() + 1;
+ }
+ }
for( ; nPos < size(); ++nPos )
{
@@ -103,7 +125,15 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
if( rFootnote.GetNumStr().isEmpty() && !rFootnote.IsEndNote() &&
!SwUpdFootnoteEndNtAtEnd::FindSectNdWithEndAttr( *pTextFootnote ))
{
- pTextFootnote->SetNumber( rFootnoteInfo.nFootnoteOffset + nFootnoteNo++, rFootnote.GetNumStr() );
+ pTextFootnote->SetNumber(
+ rFootnoteInfo.nFootnoteOffset + nFootnoteNo,
+ rFootnoteInfo.nFootnoteOffset + nFootnoteNoHidden,
+ rFootnote.GetNumStr() );
+ ++nFootnoteNo;
+ if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
+ {
+ ++nFootnoteNoHidden;
+ }
}
}
}
@@ -116,6 +146,8 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
size_t nPos;
size_t nFootnoteNo = 1;
size_t nEndNo = 1;
+ size_t nFootnoteNoHidden = 1;
+ size_t nEndNoHidden = 1;
sal_uLong nUpdNdIdx = rStt.GetIndex();
for( nPos = 0; nPos < size(); ++nPos )
{
@@ -126,12 +158,24 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
if( rFootnote.GetNumStr().isEmpty() )
{
- if( !aNumArr.ChkNumber( *pTextFootnote ) )
+ if (!aNumArr.ChkNumber(rIDRA, *pTextFootnote).first)
{
if( pTextFootnote->GetFootnote().IsEndNote() )
+ {
nEndNo++;
+ if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
+ {
+ ++nEndNoHidden;
+ }
+ }
else
+ {
nFootnoteNo++;
+ if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
+ {
+ ++nFootnoteNoHidden;
+ }
+ }
}
}
}
@@ -143,15 +187,34 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
if( rFootnote.GetNumStr().isEmpty() )
{
- sal_uInt16 nSectNo = aNumArr.ChkNumber( *pTextFootnote );
- if( !nSectNo && ( rFootnote.IsEndNote() || !bEndNoteOnly ))
- nSectNo = rFootnote.IsEndNote()
- ? rEndInfo.nFootnoteOffset + nEndNo++
- : rFootnoteInfo.nFootnoteOffset + nFootnoteNo++;
+ std::pair<sal_uInt16, sal_uInt16> nSectNo = aNumArr.ChkNumber(rIDRA, *pTextFootnote);
+ if (!nSectNo.first && (rFootnote.IsEndNote() || !bEndNoteOnly))
+ {
+ if (rFootnote.IsEndNote())
+ {
+ nSectNo.first = rEndInfo.nFootnoteOffset + nEndNo;
+ ++nEndNo;
+ nSectNo.second = rEndInfo.nFootnoteOffset + nEndNoHidden;
+ if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
+ {
+ ++nEndNoHidden;
+ }
+ }
+ else
+ {
+ nSectNo.first = rFootnoteInfo.nFootnoteOffset + nFootnoteNo;
+ ++nFootnoteNo;
+ nSectNo.second = rFootnoteInfo.nFootnoteOffset + nFootnoteNoHidden;
+ if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
+ {
+ ++nFootnoteNoHidden;
+ }
+ }
+ }
- if( nSectNo )
+ if (nSectNo.first)
{
- pTextFootnote->SetNumber( nSectNo, rFootnote.GetNumStr() );
+ pTextFootnote->SetNumber(nSectNo.first, nSectNo.second, rFootnote.GetNumStr());
}
}
}
@@ -167,6 +230,7 @@ void SwFootnoteIdxs::UpdateAllFootnote()
SwTextFootnote* pTextFootnote;
const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
const SwFootnoteInfo& rFootnoteInfo = pDoc->GetFootnoteInfo();
+ IDocumentRedlineAccess const& rIDRA(pDoc->getIDocumentRedlineAccess());
SwUpdFootnoteEndNtAtEnd aNumArr;
@@ -178,6 +242,7 @@ void SwFootnoteIdxs::UpdateAllFootnote()
{
const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
sal_uInt16 nNo = 1; // Number for the Footnotes
+ sal_uInt16 nNoNo = 1;
size_t nFootnoteIdx = 0; // Index into theFootnoteIdx array
for( size_t n = 0; n < rOutlNds.size(); ++n )
{
@@ -195,16 +260,25 @@ void SwFootnoteIdxs::UpdateAllFootnote()
if( !rFootnote.IsEndNote() && rFootnote.GetNumStr().isEmpty() &&
!SwUpdFootnoteEndNtAtEnd::FindSectNdWithEndAttr( *pTextFootnote ))
{
- pTextFootnote->SetNumber( rFootnoteInfo.nFootnoteOffset + nNo++, rFootnote.GetNumStr() );
+ pTextFootnote->SetNumber(
+ rFootnoteInfo.nFootnoteOffset + nNo,
+ rFootnoteInfo.nFootnoteOffset + nNoNo,
+ rFootnote.GetNumStr() );
+ ++nNo;
+ if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
+ {
+ ++nNoNo;
+ }
}
}
if( nFootnoteIdx >= size() )
break; // ok, everything is updated
nNo = 1;
+ nNoNo = 1;
}
}
- for( nNo = 1; nFootnoteIdx < size(); ++nFootnoteIdx )
+ for (nNo = 1, nNoNo = 1; nFootnoteIdx < size(); ++nFootnoteIdx)
{
// Endnotes are per-document
pTextFootnote = (*this)[ nFootnoteIdx ];
@@ -212,29 +286,59 @@ void SwFootnoteIdxs::UpdateAllFootnote()
if( !rFootnote.IsEndNote() && rFootnote.GetNumStr().isEmpty() &&
!SwUpdFootnoteEndNtAtEnd::FindSectNdWithEndAttr( *pTextFootnote ))
{
- pTextFootnote->SetNumber( rFootnoteInfo.nFootnoteOffset + nNo++, rFootnote.GetNumStr() );
+ pTextFootnote->SetNumber(
+ rFootnoteInfo.nFootnoteOffset + nNo,
+ rFootnoteInfo.nFootnoteOffset + nNoNo,
+ rFootnote.GetNumStr() );
+ ++nNo;
+ if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
+ {
+ ++nNoNo;
+ }
}
}
}
// We use bool here, so that we also iterate through the Endnotes with a chapter setting.
const bool bEndNoteOnly = FTNNUM_DOC != rFootnoteInfo.eNum;
- sal_uInt16 nFootnoteNo = 0, nEndNo = 0;
+ sal_uInt16 nFootnoteNo = 1;
+ sal_uInt16 nEndnoteNo = 1;
+ sal_uInt16 nFootnoteNoHidden = 1;
+ sal_uInt16 nEndnoteNoHidden = 1;
for( size_t nPos = 0; nPos < size(); ++nPos )
{
pTextFootnote = (*this)[ nPos ];
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
if( rFootnote.GetNumStr().isEmpty() )
{
- sal_uInt16 nSectNo = aNumArr.ChkNumber( *pTextFootnote );
- if( !nSectNo && ( rFootnote.IsEndNote() || !bEndNoteOnly ))
- nSectNo = rFootnote.IsEndNote()
- ? rEndInfo.nFootnoteOffset + (++nEndNo)
- : rFootnoteInfo.nFootnoteOffset + (++nFootnoteNo);
+ std::pair<sal_uInt16, sal_uInt16> nSectNo = aNumArr.ChkNumber(rIDRA, *pTextFootnote);
+ if (!nSectNo.first && (rFootnote.IsEndNote() || !bEndNoteOnly))
+ {
+ if (rFootnote.IsEndNote())
+ {
+ nSectNo.first = rEndInfo.nFootnoteOffset + nEndnoteNo;
+ ++nEndnoteNo;
+ nSectNo.second = rEndInfo.nFootnoteOffset + nEndnoteNoHidden;
+ if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
+ {
+ ++nEndnoteNoHidden;
+ }
+ }
+ else
+ {
+ nSectNo.first = rFootnoteInfo.nFootnoteOffset + nFootnoteNo;
+ ++nFootnoteNo;
+ nSectNo.second = rFootnoteInfo.nFootnoteOffset + nFootnoteNoHidden;
+ if (!IsFootnoteDeleted(rIDRA, *pTextFootnote))
+ {
+ ++nFootnoteNoHidden;
+ }
+ }
+ }
- if( nSectNo )
+ if (nSectNo.first)
{
- pTextFootnote->SetNumber( nSectNo, rFootnote.GetNumStr() );
+ pTextFootnote->SetNumber(nSectNo.first, nSectNo.second, rFootnote.GetNumStr());
}
}
}
@@ -296,12 +400,15 @@ const SwSectionNode* SwUpdFootnoteEndNtAtEnd::FindSectNdWithEndAttr(
return pNd;
}
-sal_uInt16 SwUpdFootnoteEndNtAtEnd::GetNumber( const SwTextFootnote& rTextFootnote,
+std::pair<sal_uInt16, sal_uInt16> SwUpdFootnoteEndNtAtEnd::GetNumber(
+ IDocumentRedlineAccess const& rIDRA,
+ const SwTextFootnote& rTextFootnote,
const SwSectionNode& rNd )
{
- sal_uInt16 nRet = 0, nWh;
+ std::pair<sal_uInt16, sal_uInt16> nRet(0, 0);
+ sal_uInt16 nWh;
std::vector<const SwSectionNode*>* pArr;
- std::vector<sal_uInt16> *pNum;
+ std::vector<std::pair<sal_uInt16, sal_uInt16>> *pNum;
if( rTextFootnote.GetFootnote().IsEndNote() )
{
pArr = &aEndSects;
@@ -318,25 +425,36 @@ sal_uInt16 SwUpdFootnoteEndNtAtEnd::GetNumber( const SwTextFootnote& rTextFootno
for( size_t n = pArr->size(); n; )
if( (*pArr)[ --n ] == &rNd )
{
- nRet = ++((*pNum)[ n ]);
+ nRet.first = ++((*pNum)[ n ].first);
+ nRet.second = ((*pNum)[ n ].second);
+ if (!IsFootnoteDeleted(rIDRA, rTextFootnote))
+ {
+ ++((*pNum)[ n ].second);
+ }
break;
}
- if( !nRet )
+ if (!nRet.first)
{
pArr->push_back( &rNd );
- nRet = static_cast<const SwFormatFootnoteEndAtTextEnd&>(rNd.GetSection().GetFormat()->
+ sal_uInt16 const tmp = static_cast<const SwFormatFootnoteEndAtTextEnd&>(
+ rNd.GetSection().GetFormat()->
GetFormatAttr( nWh )).GetOffset();
- ++nRet;
+ nRet.first = tmp + 1;
+ nRet.second = tmp + 1;
pNum->push_back( nRet );
}
return nRet;
}
-sal_uInt16 SwUpdFootnoteEndNtAtEnd::ChkNumber( const SwTextFootnote& rTextFootnote )
+std::pair<sal_uInt16, sal_uInt16> SwUpdFootnoteEndNtAtEnd::ChkNumber(
+ IDocumentRedlineAccess const& rIDRA,
+ const SwTextFootnote& rTextFootnote)
{
const SwSectionNode* pSectNd = FindSectNdWithEndAttr( rTextFootnote );
- return pSectNd ? GetNumber( rTextFootnote, *pSectNd ) : 0;
+ return pSectNd
+ ? GetNumber(rIDRA, rTextFootnote, *pSectNd)
+ : std::pair<sal_uInt16, sal_uInt16>(0, 0);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 542247a8500a..ef0d950e62b3 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2372,10 +2372,30 @@ void SwPageFrame::UpdateFootnoteNum()
SwTextFootnote* pTextFootnote = pFootnote->GetAttr();
if( !pTextFootnote->GetFootnote().IsEndNote() &&
pTextFootnote->GetFootnote().GetNumStr().isEmpty() &&
- !pFootnote->GetMaster() &&
- (pTextFootnote->GetFootnote().GetNumber() != ++nNum) )
+ !pFootnote->GetMaster())
{
- pTextFootnote->SetNumber( nNum, OUString() );
+ // sw_redlinehide: the layout can only keep one number
+ // up to date; depending on its setting, this is either
+ // the non-hidden or the hidden number; the other
+ // number will simply be preserved as-is (so in case
+ // there are 2 layouts, maybe both can be updated...)
+ ++nNum;
+ sal_uInt16 const nOldNum(pTextFootnote->GetFootnote().GetNumber());
+ sal_uInt16 const nOldNumRLHidden(pTextFootnote->GetFootnote().GetNumberRLHidden());
+ if (getRootFrame()->IsHideRedlines())
+ {
+ if (nNum != nOldNumRLHidden)
+ {
+ pTextFootnote->SetNumber(nOldNum, nNum, OUString());
+ }
+ }
+ else
+ {
+ if (nNum != nOldNum)
+ {
+ pTextFootnote->SetNumber(nNum, nOldNumRLHidden, OUString());
+ }
+ }
}
if ( pFootnote->GetNext() )
pFootnote = static_cast<SwFootnoteFrame*>(pFootnote->GetNext());
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index 9ab598e1ef5f..70ef5875f190 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -122,6 +122,7 @@ SwFormatFootnote::SwFormatFootnote( bool bEndNote )
, SwModify(nullptr)
, m_pTextAttr(nullptr)
, m_nNumber(0)
+ , m_nNumberRLHidden(0)
, m_bEndNote(bEndNote)
{
}
@@ -130,6 +131,7 @@ bool SwFormatFootnote::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
return m_nNumber == static_cast<const SwFormatFootnote&>(rAttr).m_nNumber &&
+ //FIXME?
m_aNumber == static_cast<const SwFormatFootnote&>(rAttr).m_aNumber &&
m_bEndNote == static_cast<const SwFormatFootnote&>(rAttr).m_bEndNote;
}
@@ -139,6 +141,7 @@ SfxPoolItem* SwFormatFootnote::Clone( SfxItemPool* ) const
SwFormatFootnote* pNew = new SwFormatFootnote;
pNew->m_aNumber = m_aNumber;
pNew->m_nNumber = m_nNumber;
+ pNew->m_nNumberRLHidden = m_nNumberRLHidden;
pNew->m_bEndNote = m_bEndNote;
return pNew;
}
@@ -325,7 +328,8 @@ void SwTextFootnote::SetStartNode( const SwNodeIndex *pNewNode, bool bDelNode )
}
}
-void SwTextFootnote::SetNumber( const sal_uInt16 nNewNum, const OUString &sNumStr )
+void SwTextFootnote::SetNumber(const sal_uInt16 nNewNum,
+ sal_uInt16 const nNumberRLHidden, const OUString &sNumStr)
{
SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(GetFootnote());
@@ -333,6 +337,7 @@ void SwTextFootnote::SetNumber( const sal_uInt16 nNewNum, const OUString &sNumSt
if ( sNumStr.isEmpty() )
{
rFootnote.m_nNumber = nNewNum;
+ rFootnote.m_nNumberRLHidden = nNumberRLHidden;
}
OSL_ENSURE( m_pTextNode, "SwTextFootnote: where is my TextNode?" );
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 2bb992ac8d95..f123fb2d207f 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -236,7 +236,7 @@ sal_uInt16 SwWW8ImplReader::End_Footnote()
// If no automatic numbering use the following char from the main text
// as the footnote number
if (!rDesc.mbAutoNum)
- static_cast<SwTextFootnote*>(pFN)->SetNumber(0, sChar);
+ static_cast<SwTextFootnote*>(pFN)->SetNumber(0, 0, sChar);
/*
Delete the footnote char from the footnote if its at the beginning