Kaydet (Commit) 80ffd0d8 authored tarafından Michael Stahl's avatar Michael Stahl

sw_redlinehide_3: remove number parameter from SwDoc::SetCurFootnote

The number is pretty useless: none of the callers know what the proper
auto-counted number is going to be, so they either pass in the number
that the footnote already has, or 0.

It is particularly funny if the SwPaM is actually a range containing
multiple footnotes; fortunately such a call is apparently not possible
currently.

Just remove the parameter and use the existing footnote number directly.

Change-Id: I45dee999b8b0b630eff4347a563ccca2869f84cc
üst 3576d5b7
......@@ -622,9 +622,9 @@ public:
void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
SwFootnoteIdxs& GetFootnoteIdxs() { return *mpFootnoteIdxs; }
const SwFootnoteIdxs& GetFootnoteIdxs() const { return *mpFootnoteIdxs; }
// change footnotes in area
/// change footnotes in range
bool SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
sal_uInt16 nNumber, bool bIsEndNote );
bool bIsEndNote );
/** Operations on the content of the document e.g.
spell-checking/hyphenating/word-counting
......
......@@ -430,7 +430,7 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
}
bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
sal_uInt16 nNumber, bool bIsEndNote )
bool bIsEndNote)
{
SwFootnoteIdxs& rFootnoteArr = GetFootnoteIdxs();
SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout();
......@@ -448,7 +448,7 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
if (GetIDocumentUndoRedo().DoesUndo())
{
GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it
pUndo.reset(new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote ));
pUndo.reset(new SwUndoChangeFootNote( rPam, rNumStr, bIsEndNote ));
}
SwTextFootnote* pTextFootnote;
......@@ -473,7 +473,7 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
pUndo->GetHistory().Add( *pTextFootnote );
}
pTextFootnote->SetNumber( nNumber, rNumStr );
pTextFootnote->SetNumber(rFootnote.GetNumber(), 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( nNumber, rNumStr );
pTextFootnote->SetNumber(rFootnote.GetNumber(), rNumStr);
if( rFootnote.IsEndNote() != bIsEndNote )
{
const_cast<SwFormatFootnote&>(rFootnote).SetEndNote( bIsEndNote );
......
......@@ -419,7 +419,7 @@ bool SwEditShell::SetCurFootnote( const SwFormatFootnote& rFillFootnote )
for(SwPaM& rCursor : GetCursor()->GetRingContainer())
{
bChgd |=
mxDoc->SetCurFootnote( rCursor, rFillFootnote.GetNumStr(), rFillFootnote.GetNumber(), rFillFootnote.IsEndNote() );
mxDoc->SetCurFootnote(rCursor, rFillFootnote.GetNumStr(), rFillFootnote.IsEndNote());
}
......
......@@ -212,12 +212,11 @@ class SwUndoChangeFootNote : public SwUndo, private SwUndRng
{
const std::unique_ptr<SwHistory> m_pHistory;
const OUString m_Text;
const sal_uInt16 m_nNumber;
const bool m_bEndNote;
public:
SwUndoChangeFootNote( const SwPaM& rRange, const OUString& rText,
sal_uInt16 nNum, bool bIsEndNote );
bool bIsEndNote );
virtual ~SwUndoChangeFootNote() override;
virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
......
......@@ -340,8 +340,8 @@ public:
void ResetTurbo() { mpTurbo = nullptr; }
const SwContentFrame *GetTurbo() { return mpTurbo; }
/// Update the footernumbers of all Pages
void UpdateFootnoteNums(); // Only for page by page numnbering!
/// Update the footnote numbers of all Pages
void UpdateFootnoteNums(); // Only for page by page numbering!
/// Remove all footnotes (but no references)
void RemoveFootnotes( SwPageFrame *pPage = nullptr, bool bPageOnly = false,
......
......@@ -919,11 +919,10 @@ void SwUndoMoveLeftMargin::RepeatImpl(::sw::RepeatContext & rContext)
SwUndoChangeFootNote::SwUndoChangeFootNote(
const SwPaM& rRange, const OUString& rText,
sal_uInt16 nNum, bool bIsEndNote )
bool const bIsEndNote)
: SwUndo( SwUndoId::CHGFTN, rRange.GetDoc() ), SwUndRng( rRange )
, m_pHistory( new SwHistory() )
, m_Text( rText )
, m_nNumber( nNum )
, m_bEndNote( bIsEndNote )
{
}
......@@ -948,14 +947,14 @@ void SwUndoChangeFootNote::RedoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc & rDoc( rContext.GetDoc() );
SwPaM & rPaM = AddUndoRedoPaM(rContext);
rDoc.SetCurFootnote(rPaM, m_Text, m_nNumber, m_bEndNote);
rDoc.SetCurFootnote(rPaM, m_Text, m_bEndNote);
SetPaM(rPaM);
}
void SwUndoChangeFootNote::RepeatImpl(::sw::RepeatContext & rContext)
{
SwDoc & rDoc = rContext.GetDoc();
rDoc.SetCurFootnote( rContext.GetRepeatPaM(), m_Text, m_nNumber, m_bEndNote );
rDoc.SetCurFootnote(rContext.GetRepeatPaM(), m_Text, m_bEndNote);
}
SwUndoFootNoteInfo::SwUndoFootNoteInfo( const SwFootnoteInfo &rInfo, const SwDoc* pDoc )
......
......@@ -266,7 +266,7 @@ SwXFootnote::setLabel(const OUString& aLabel)
SwTextNode& rTextNode = const_cast<SwTextNode&>(pTextFootnote->GetTextNode());
SwPaM aPam(rTextNode, pTextFootnote->GetStart());
GetDoc()->SetCurFootnote(aPam, newLabel, pFormat->GetNumber(), pFormat->IsEndNote());
GetDoc()->SetCurFootnote(aPam, newLabel, pFormat->IsEndNote());
}
else if (m_pImpl->m_bIsDescriptor)
{
......
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