LibreOffice Module sw (master) 1
atrftn.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <libxml/xmlwriter.h>
21#include <fmtftn.hxx>
22#include <doc.hxx>
25#include <cntfrm.hxx>
26#include <rootfrm.hxx>
27#include <pagefrm.hxx>
28#include <txtftn.hxx>
29#include <ftnidx.hxx>
30#include <ftninfo.hxx>
31#include <ndtxt.hxx>
32#include <poolfmt.hxx>
33#include <ftnfrm.hxx>
34#include <ndindex.hxx>
35#include <fmtftntx.hxx>
36#include <section.hxx>
37#include <calbck.hxx>
38#include <hints.hxx>
39#include <pam.hxx>
40#include <rtl/ustrbuf.hxx>
41#include <vcl/svapp.hxx>
42#include <unotextrange.hxx>
43#include <osl/diagnose.h>
44#include <unofootnote.hxx>
45
46namespace {
52 void lcl_FillUsedFootnoteRefNumbers(SwDoc &rDoc,
53 SwTextFootnote const *pExclude,
54 std::set<sal_uInt16> &rUsedRef,
55 std::vector<SwTextFootnote*> &rInvalid)
56 {
57 SwFootnoteIdxs& ftnIdxs = rDoc.GetFootnoteIdxs();
58
59 rInvalid.clear();
60
61 for( size_t n = 0; n < ftnIdxs.size(); ++n )
62 {
63 SwTextFootnote* pTextFootnote = ftnIdxs[ n ];
64 if ( pTextFootnote != pExclude )
65 {
66 if ( USHRT_MAX == pTextFootnote->GetSeqRefNo() )
67 {
68 rInvalid.push_back(pTextFootnote);
69 }
70 else
71 {
72 rUsedRef.insert( pTextFootnote->GetSeqRefNo() );
73 }
74 }
75 }
76 }
77
82 bool lcl_IsRefNumAvailable(std::set<sal_uInt16> const &rUsedNums,
83 sal_uInt16 requested)
84 {
85 if ( USHRT_MAX == requested )
86 return false; // Invalid sequence number.
87 if ( rUsedNums.count(requested) )
88 return false; // Number already used.
89 return true;
90 }
91
96 void lcl_FillUnusedSeqRefNums(std::vector<sal_uInt16> &rLowestUnusedNums,
97 const std::set<sal_uInt16> &rUsedNums,
98 size_t numRequired)
99 {
100 if (!numRequired)
101 return;
102
103 rLowestUnusedNums.reserve(numRequired);
104 sal_uInt16 newNum = 0;
105 //Start by using numbers from gaps in rUsedNums
106 for( const auto& rNum : rUsedNums )
107 {
108 while ( newNum < rNum )
109 {
110 rLowestUnusedNums.push_back( newNum++ );
111 if ( --numRequired == 0)
112 return;
113 }
114 newNum++;
115 }
116 //Filled in all gaps. Fill the rest of the list with new numbers.
117 do
118 {
119 rLowestUnusedNums.push_back( newNum++ );
120 }
121 while ( --numRequired > 0 );
122 }
123
124}
125
128 , sw::BroadcastingModify()
129 , m_pTextAttr(nullptr)
130 , m_nNumber(0)
131 , m_nNumberRLHidden(0)
132 , m_bEndNote(bEndNote)
133{
134}
135
137{ m_wXFootnote = xNote.get(); }
138
140{
141 assert(SfxPoolItem::operator==(rAttr));
142 return m_nNumber == static_cast<const SwFormatFootnote&>(rAttr).m_nNumber &&
143 //FIXME?
144 m_aNumber == static_cast<const SwFormatFootnote&>(rAttr).m_aNumber &&
145 m_bEndNote == static_cast<const SwFormatFootnote&>(rAttr).m_bEndNote;
146}
147
149{
151 pNew->m_aNumber = m_aNumber;
152 pNew->m_nNumber = m_nNumber;
154 pNew->m_bEndNote = m_bEndNote;
155 return pNew;
156}
157
159{
160 if (rHint.GetId() != SfxHintId::SwLegacyModify)
161 return;
162 auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
163 CallSwClientNotify(rHint);
164 if(RES_REMOVE_UNO_OBJECT == pLegacy->GetWhich())
165 SetXFootnote(nullptr);
166}
167
169{
171 &static_cast<sw::BroadcastingModify&>(*this)); // cast to base class (void*)
172 CallSwClientNotify(sw::LegacyModifyHint(&item, &item));
173}
174
176{
177 if ( b != m_bEndNote )
178 {
179 if ( GetTextFootnote() )
180 {
181 GetTextFootnote()->DelFrames(nullptr);
182 }
183 m_bEndNote = b;
184 }
185}
186
188{
189}
190
191OUString SwFormatFootnote::GetFootnoteText(SwRootFrame const& rLayout) const
192{
193 OUStringBuffer buf;
195 {
196 SwNodeIndex aIdx( *m_pTextAttr->GetStartNode(), 1 );
197 SwContentNode* pCNd = aIdx.GetNode().GetTextNode();
198 if( !pCNd )
199 pCNd = aIdx.GetNodes().GoNext( &aIdx );
200
201 if( pCNd->IsTextNode() ) {
202 buf.append(static_cast<SwTextNode*>(pCNd)->GetExpandText(&rLayout));
203
204 ++aIdx;
205 while ( !aIdx.GetNode().IsEndNode() ) {
206 if ( aIdx.GetNode().IsTextNode() )
207 {
208 buf.append(" " + aIdx.GetNode().GetTextNode()->GetExpandText(&rLayout));
209 }
210 ++aIdx;
211 }
212 }
213 }
214 return buf.makeStringAndClear();
215}
216
219 SwRootFrame const*const pLayout, bool bInclStrings) const
220{
221 OUString sRet( GetNumStr() );
222 if( sRet.isEmpty() )
223 {
224 // in this case the number is needed, get it via SwDoc's FootnoteInfo
225 bool bMakeNum = true;
226 const SwSectionNode* pSectNd = m_pTextAttr
228 : nullptr;
229 sal_uInt16 const nNumber(pLayout && pLayout->IsHideRedlines()
231 : GetNumber());
232
233 if( pSectNd )
234 {
235 const SwFormatFootnoteEndAtTextEnd& rFootnoteEnd = static_cast<const SwFormatFootnoteEndAtTextEnd&>(
236 pSectNd->GetSection().GetFormat()->GetFormatAttr(
237 IsEndNote() ?
238 o3tl::narrowing<sal_uInt16>(RES_END_AT_TXTEND) :
239 o3tl::narrowing<sal_uInt16>(RES_FTN_AT_TXTEND) ) );
240
241 if( FTNEND_ATTXTEND_OWNNUMANDFMT == rFootnoteEnd.GetValue() )
242 {
243 bMakeNum = false;
244 sRet = rFootnoteEnd.GetSwNumType().GetNumStr( nNumber );
245 if( bInclStrings )
246 {
247 sRet = rFootnoteEnd.GetPrefix() + sRet + rFootnoteEnd.GetSuffix();
248 }
249 }
250 }
251
252 if( bMakeNum )
253 {
254 const SwEndNoteInfo* pInfo;
255 if( IsEndNote() )
256 pInfo = &rDoc.GetEndNoteInfo();
257 else
258 pInfo = &rDoc.GetFootnoteInfo();
259 sRet = pInfo->m_aFormat.GetNumStr( nNumber );
260 if( bInclStrings )
261 {
262 sRet = pInfo->GetPrefix() + sRet + pInfo->GetSuffix();
263 }
264 }
265 }
266 return sRet;
267}
268
269uno::Reference<text::XTextRange> SwFormatFootnote::getAnchor(SwDoc& rDoc) const
270{
271 SolarMutexGuard aGuard;
272 if (!m_pTextAttr)
273 return uno::Reference<text::XTextRange>();
275 aPam.SetMark();
276 aPam.GetMark()->AdjustContent(+1);
278 SwXTextRange::CreateXTextRange(rDoc, *aPam.Start(), aPam.End());
279 return xRet;
280}
281
283{
284 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatFootnote"));
285 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
286 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("text-attr"), "%p", m_pTextAttr);
287 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("endnote"),
288 BAD_CAST(OString::boolean(m_bEndNote).getStr()));
289
290 SfxPoolItem::dumpAsXml(pWriter);
291
292 (void)xmlTextWriterEndElement(pWriter);
293}
294
296 : SwTextAttr( rAttr, nStartPos )
297 , m_pTextNode( nullptr )
298 , m_nSeqNo( USHRT_MAX )
299{
300 rAttr.m_pTextAttr = this;
301 SetHasDummyChar(true);
302}
303
305{
306 SetStartNode( nullptr );
307}
308
309void SwTextFootnote::SetStartNode( const SwNodeIndex *pNewNode, bool bDelNode )
310{
311 if( pNewNode )
312 {
313 m_oStartNode = *pNewNode;
314 }
315 else if ( m_oStartNode )
316 {
317 // need to do 2 things:
318 // 1) unregister footnotes at their pages
319 // 2) delete the footnote section in the Inserts of the nodes-array
320 SwDoc* pDoc;
321 if ( m_pTextNode )
322 {
323 pDoc = &m_pTextNode->GetDoc();
324 }
325 else
326 {
327 //JP 27.01.97: the sw3-Reader creates a StartNode but the
328 // attribute isn't anchored in the TextNode yet.
329 // If it is deleted (e.g. Insert File with footnote
330 // inside fly frame), the content must also be deleted.
331 pDoc = &m_oStartNode->GetNodes().GetDoc();
332 }
333
334 // If called from ~SwDoc(), must not delete the footnote nodes,
335 // and not necessary to delete the footnote frames.
336 if( !pDoc->IsInDtor() )
337 {
338 if( bDelNode )
339 {
340 // 2) delete the section for the footnote nodes
341 // it's possible that the Inserts have already been deleted (how???)
343 }
344 else
345 // If the nodes are not deleted, their frames must be removed
346 // from the page (deleted), there is nothing else that deletes
347 // them (particularly not Undo)
348 DelFrames( nullptr );
349 }
350 m_oStartNode.reset();
351
352 // remove the footnote from the SwDoc's array
353 for( size_t n = 0; n < pDoc->GetFootnoteIdxs().size(); ++n )
354 if( this == pDoc->GetFootnoteIdxs()[n] )
355 {
356 pDoc->GetFootnoteIdxs().erase( pDoc->GetFootnoteIdxs().begin() + n );
357 // if necessary, update following footnotes
358 if( !pDoc->IsInDtor() && n < pDoc->GetFootnoteIdxs().size() )
359 {
360 pDoc->GetFootnoteIdxs().UpdateFootnote( pDoc->GetFootnoteIdxs()[n]->GetTextNode() );
361 }
362 break;
363 }
364 }
365}
366
367void SwTextFootnote::SetNumber(const sal_uInt16 nNewNum,
368 sal_uInt16 const nNumberRLHidden, const OUString &sNumStr)
369{
370 SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(GetFootnote());
371
372 rFootnote.m_aNumber = sNumStr;
373 if ( sNumStr.isEmpty() )
374 {
375 rFootnote.m_nNumber = nNewNum;
376 rFootnote.m_nNumberRLHidden = nNumberRLHidden;
377 }
379}
380
382{
383 assert(m_pTextNode);
384 SwNodes &rNodes = m_pTextNode->GetDoc().GetNodes();
385 const sw::LegacyModifyHint aHint(nullptr, &GetFootnote());
387 if ( m_oStartNode )
388 {
389 // must iterate over all TextNodes because of footnotes on other pages
390 SwNodeOffset nSttIdx = m_oStartNode->GetIndex() + 1;
391 SwNodeOffset nEndIdx = m_oStartNode->GetNode().EndOfSectionIndex();
392 for( ; nSttIdx < nEndIdx; ++nSttIdx )
393 {
394 SwNode* pNd;
395 if( ( pNd = rNodes[ nSttIdx ] )->IsTextNode() )
396 static_cast<SwTextNode*>(pNd)->TriggerNodeUpdate(aHint);
397 }
398 }
399}
400
402 SwTextFootnote & rDest,
403 SwTextNode & rDestNode ) const
404{
405 if (m_oStartNode && !rDest.GetStartNode())
406 {
407 // dest missing node section? create it here!
408 // (happens in SwTextNode::CopyText if pDest == this)
409 rDest.MakeNewTextSection( rDestNode.GetNodes() );
410 }
411 if (m_oStartNode && rDest.GetStartNode())
412 {
413 // footnotes not necessarily in same document!
414 SwDoc& rDstDoc = rDestNode.GetDoc();
415 SwNodes &rDstNodes = rDstDoc.GetNodes();
416
417 // copy only the content of the section
418 SwNodeRange aRg( m_oStartNode->GetNode(), SwNodeOffset(1),
419 *m_oStartNode->GetNode().EndOfSectionNode() );
420
421 // insert at the end of rDest, i.e., the nodes are appended.
422 // nDestLen contains number of ContentNodes in rDest _before_ copy.
423 SwNodeIndex aStart( *(rDest.GetStartNode()) );
424 SwNodeIndex aEnd( *aStart.GetNode().EndOfSectionNode() );
425 SwNodeOffset nDestLen = aEnd.GetIndex() - aStart.GetIndex() - 1;
426
428
429 // in case the destination section was not empty, delete the old nodes
430 // before: Src: SxxxE, Dst: SnE
431 // now: Src: SxxxE, Dst: SnxxxE
432 // after: Src: SxxxE, Dst: SxxxE
433 ++aStart;
434 rDstNodes.Delete( aStart, nDestLen );
435 }
436
437 // also copy user defined number string
438 if( !GetFootnote().m_aNumber.isEmpty() )
439 {
440 const_cast<SwFormatFootnote &>(rDest.GetFootnote()).m_aNumber = GetFootnote().m_aNumber;
441 }
442}
443
446{
447 if ( m_oStartNode )
448 return;
449
450 // set the footnote style on the SwTextNode
451 SwTextFormatColl *pFormatColl;
452 const SwEndNoteInfo* pInfo;
453 sal_uInt16 nPoolId;
454
455 if( GetFootnote().IsEndNote() )
456 {
457 pInfo = &rNodes.GetDoc().GetEndNoteInfo();
458 nPoolId = RES_POOLCOLL_ENDNOTE;
459 }
460 else
461 {
462 pInfo = &rNodes.GetDoc().GetFootnoteInfo();
463 nPoolId = RES_POOLCOLL_FOOTNOTE;
464 }
465
466 pFormatColl = pInfo->GetFootnoteTextColl();
467 if( nullptr == pFormatColl )
468 pFormatColl = rNodes.GetDoc().getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolId );
469
470 SwStartNode* pSttNd = rNodes.MakeTextSection( rNodes.GetEndOfInserts(),
471 SwFootnoteStartNode, pFormatColl );
472 m_oStartNode = *pSttNd;
473}
474
476{
477 // delete the FootnoteFrames from the pages
478 OSL_ENSURE( m_pTextNode, "SwTextFootnote: where is my TextNode?" );
479 if ( !m_pTextNode )
480 return;
481
482 bool bFrameFnd = false;
483 {
485 for( SwContentFrame* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
486 {
487 if( pRoot != pFnd->getRootFrame() && pRoot )
488 continue;
489 SwPageFrame* pPage = pFnd->FindPageFrame();
490 if( pPage )
491 {
492 // note: we have found the correct frame only if the footnote
493 // was actually removed; in case this is called from
494 // SwTextFrame::DestroyImpl(), then that frame isn't connected
495 // to SwPageFrame any more, and RemoveFootnote on any follow
496 // must not prevent the fall-back to the !bFrameFnd code.
497 bFrameFnd = pPage->RemoveFootnote(pFnd, this);
498 }
499 }
500 }
501 //JP 13.05.97: if the layout is deleted before the footnotes are deleted,
502 // try to delete the footnote's frames by another way
503 if ( bFrameFnd || !m_oStartNode )
504 return;
505
506 SwNodeIndex aIdx( *m_oStartNode );
507 SwContentNode* pCNd = m_pTextNode->GetNodes().GoNext( &aIdx );
508 if( !pCNd )
509 return;
510
512 for( SwContentFrame* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
513 {
514 if( pRoot != pFnd->getRootFrame() && pRoot )
515 continue;
516 SwPageFrame* pPage = pFnd->FindPageFrame();
517
518 SwFrame *pFrame = pFnd->GetUpper();
519 while ( pFrame && !pFrame->IsFootnoteFrame() )
520 pFrame = pFrame->GetUpper();
521
522 SwFootnoteFrame *pFootnote = static_cast<SwFootnoteFrame*>(pFrame);
523 while ( pFootnote && pFootnote->GetMaster() )
524 pFootnote = pFootnote->GetMaster();
525 OSL_ENSURE( pFootnote->GetAttr() == this, "Footnote mismatch error." );
526
527 while ( pFootnote )
528 {
529 SwFootnoteFrame *pFoll = pFootnote->GetFollow();
530 pFootnote->Cut();
531 SwFrame::DestroyFrame(pFootnote);
532 pFootnote = pFoll;
533 }
534
535 // #i20556# During hiding of a section, the connection
536 // to the layout is already lost. pPage may be 0:
537 if ( pPage )
538 pPage->UpdateFootnoteNum();
539 }
540}
541
545{
546 if( !m_pTextNode )
547 return;
548
549 SwDoc& rDoc = m_pTextNode->GetDoc();
550 if( rDoc.IsInReading() )
551 return;
552
553 std::set<sal_uInt16> aUsedNums;
554 std::vector<SwTextFootnote*> badRefNums;
555 ::lcl_FillUsedFootnoteRefNumbers(rDoc, this, aUsedNums, badRefNums);
556 if ( ::lcl_IsRefNumAvailable(aUsedNums, m_nSeqNo) )
557 return;
558 std::vector<sal_uInt16> unused;
559 ::lcl_FillUnusedSeqRefNums(unused, aUsedNums, 1);
560 m_nSeqNo = unused[0];
561}
562
566{
567 std::set<sal_uInt16> aUsedNums;
568 std::vector<SwTextFootnote*> badRefNums;
569 ::lcl_FillUsedFootnoteRefNumbers(rDoc, nullptr, aUsedNums, badRefNums);
570 std::vector<sal_uInt16> aUnused;
571 ::lcl_FillUnusedSeqRefNums(aUnused, aUsedNums, badRefNums.size());
572
573 for (size_t i = 0; i < badRefNums.size(); ++i)
574 {
575 badRefNums[i]->m_nSeqNo = aUnused[i];
576 }
577}
578
580{
581 if( GetStartNode() )
582 static_cast<SwStartNode&>(GetStartNode()->GetNode()).CheckSectionCondColl();
583}
584
586{
587 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTextFootnote"));
588 SwTextAttr::dumpAsXml(pWriter);
589
590 if (m_oStartNode)
591 {
592 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_oStartNode"));
593 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
594 BAD_CAST(OString::number(sal_Int32(m_oStartNode->GetIndex())).getStr()));
595 (void)xmlTextWriterEndElement(pWriter);
596 }
597 if (m_pTextNode)
598 {
599 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_pTextNode"));
600 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
601 BAD_CAST(OString::number(sal_Int32(m_pTextNode->GetIndex())).getStr()));
602 (void)xmlTextWriterEndElement(pWriter);
603 }
604 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_nSeqNo"));
605 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
606 BAD_CAST(OString::number(m_nSeqNo).getStr()));
607 (void)xmlTextWriterEndElement(pWriter);
608
609 (void)xmlTextWriterEndElement(pWriter);
610}
611
612/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
EnumT GetValue() const
SfxHintId GetId() const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
OUString GetNumStr(sal_Int32 nNo) const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
Definition: doc.hxx:197
bool IsInReading() const
Definition: doc.hxx:969
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:645
bool IsInDtor() const
Definition: doc.hxx:417
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
SwNodes & GetNodes()
Definition: doc.hxx:422
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:649
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:647
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:440
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:339
const OUString & GetPrefix() const
Definition: ftninfo.hxx:70
const OUString & GetSuffix() const
Definition: ftninfo.hxx:71
SvxNumberType m_aFormat
Definition: ftninfo.hxx:46
SwTextFormatColl * GetFootnoteTextColl() const
Definition: ftninfo.hxx:55
bool RemoveFootnote(const SwContentFrame *, const SwTextFootnote *, bool bPrep=true)
Definition: ftnfrm.cxx:1736
Represents one footnote or endnote in the layout.
Definition: ftnfrm.hxx:84
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:120
virtual void Cut() override
Definition: ftnfrm.cxx:543
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:123
const SwTextFootnote * GetAttr() const
Definition: ftnfrm.hxx:126
void UpdateFootnote(const SwNode &rStt)
Definition: ftnidx.cxx:59
SfxPoolItem subclass that is a wrapper around an SwFootnoteEndPosEnum, i.e.
Definition: fmtftntx.hxx:43
const SvxNumberType & GetSwNumType() const
Definition: fmtftntx.hxx:77
const OUString & GetPrefix() const
Definition: fmtftntx.hxx:82
const OUString & GetSuffix() const
Definition: fmtftntx.hxx:85
SfxPoolItem subclass for footnotes and endnotes, stored in the anchor text node.
Definition: fmtftn.hxx:47
OUString m_aNumber
User-defined 'Number'.
Definition: fmtftn.hxx:50
css::uno::Reference< css::text::XTextRange > getAnchor(SwDoc &rDoc) const
Definition: atrftn.cxx:269
SwTextFootnote * m_pTextAttr
My TextAttribute.
Definition: fmtftn.hxx:49
sal_uInt16 GetNumber() const
Definition: fmtftn.hxx:73
sal_uInt16 m_nNumber
automatic sequence number
Definition: fmtftn.hxx:51
sal_uInt16 m_nNumberRLHidden
automatic sequence number (hidden redlines)
Definition: fmtftn.hxx:52
const OUString & GetNumStr() const
Definition: fmtftn.hxx:72
void SetXFootnote(rtl::Reference< SwXFootnote > const &xNote)
Definition: atrftn.cxx:136
void SetEndNote(bool b)
Definition: atrftn.cxx:175
virtual SwFormatFootnote * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrftn.cxx:148
OUString GetViewNumStr(const SwDoc &rDoc, SwRootFrame const *pLayout, bool bInclStrings=false) const
Returns string to be displayed of footnote / endnote.
Definition: atrftn.cxx:218
sal_uInt16 GetNumberRLHidden() const
Definition: fmtftn.hxx:74
bool IsEndNote() const
Definition: fmtftn.hxx:75
virtual ~SwFormatFootnote() override
Definition: atrftn.cxx:187
OUString GetFootnoteText(SwRootFrame const &rLayout) const
Definition: atrftn.cxx:191
const SwTextFootnote * GetTextFootnote() const
Definition: fmtftn.hxx:87
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: atrftn.cxx:158
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrftn.cxx:282
void InvalidateFootnote()
Definition: atrftn.cxx:168
SwFormatFootnote(const SwFormatFootnote &)=delete
bool m_bEndNote
Is it an End note?
Definition: fmtftn.hxx:53
unotools::WeakReference< SwXFootnote > m_wXFootnote
Definition: fmtftn.hxx:55
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrftn.cxx:139
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:366
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsFootnoteFrame() const
Definition: frame.hxx:1208
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
SwRootFrame * getRootFrame()
Definition: frame.hxx:685
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:390
TElementType * Next()
Definition: calbck.hxx:380
TElementType * First()
Definition: calbck.hxx:372
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwNodes & GetNodes() const
Definition: ndindex.hxx:119
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:706
SwDoc & GetDoc()
Definition: node.hxx:233
bool IsEndNode() const
Definition: node.hxx:189
bool IsTextNode() const
Definition: node.hxx:190
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
Definition: nodes.cxx:1070
SwStartNode * MakeTextSection(const SwNode &rWhere, SwStartNodeType eSttNdTyp, SwTextFormatColl *pColl)
Definition: nodes.cxx:1925
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1299
SwNode & GetEndOfInserts() const
Section for all footnotes.
Definition: ndarr.hxx:156
SwDoc & GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:307
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:643
const SwPosition * End() const
Definition: pam.hxx:263
const SwPosition * Start() const
Definition: pam.hxx:258
A page of the document layout.
Definition: pagefrm.hxx:60
void UpdateFootnoteNum()
Definition: ftnfrm.cxx:2433
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:434
A section node represents the start of a section on the UI, i.e.
Definition: node.hxx:575
const SwSection & GetSection() const
Definition: node.hxx:590
SwSectionFormat * GetFormat()
Definition: section.hxx:341
Starts a section of nodes in the document model.
Definition: node.hxx:348
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: txatbase.cxx:89
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:208
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
void SetHasDummyChar(const bool bFlag)
Definition: txatbase.hxx:78
SwTextAttr subclass for footnotes and endnotes.
Definition: txtftn.hxx:34
static void SetUniqueSeqRefNo(SwDoc &rDoc)
Set a unique sequential reference number for every footnote in the document.
Definition: atrftn.cxx:565
virtual ~SwTextFootnote() override
Definition: atrftn.cxx:304
void CheckCondColl()
Definition: atrftn.cxx:579
void InvalidateNumberInLayout()
Definition: atrftn.cxx:381
void MakeNewTextSection(SwNodes &rNodes)
create a new nodes-array section for the footnote
Definition: atrftn.cxx:445
void CopyFootnote(SwTextFootnote &rDest, SwTextNode &rDestNode) const
Definition: atrftn.cxx:401
void SetSeqRefNo()
Set the sequence number for the current footnote.
Definition: atrftn.cxx:544
SwTextFootnote(SwFormatFootnote &rAttr, sal_Int32 nStart)
Definition: atrftn.cxx:295
void SetNumber(sal_uInt16 nNumber, sal_uInt16 nNumberRLHidden, const OUString &sNumStr)
Definition: atrftn.cxx:367
const SwNodeIndex * GetStartNode() const
Definition: txtftn.hxx:43
void DelFrames(const SwRootFrame *)
Definition: atrftn.cxx:475
std::optional< SwNodeIndex > m_oStartNode
Definition: txtftn.hxx:35
sal_uInt16 m_nSeqNo
Definition: txtftn.hxx:37
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrftn.cxx:585
const SwTextNode & GetTextNode() const
Definition: txtftn.hxx:72
SwTextNode * m_pTextNode
Definition: txtftn.hxx:36
void SetStartNode(const SwNodeIndex *pNode, bool bDelNodes=true)
Definition: atrftn.cxx:309
sal_uInt16 GetSeqRefNo() const
Definition: txtftn.hxx:66
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
OUString GetExpandText(SwRootFrame const *pLayout, const sal_Int32 nIdx=0, const sal_Int32 nLen=-1, const bool bWithNum=false, const bool bAddSpaceAfterListLabelStr=false, const bool bWithSpacesForLevel=false, const ExpandMode eAdditionalMode=ExpandMode::ExpandFootnote|ExpandMode::HideFieldmarkCommands) const
add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating, when <bWithNum = true> that a spa...
Definition: ndtxt.cxx:3505
void TriggerNodeUpdate(const sw::LegacyModifyHint &)
for hanging TextFormatCollections somewhere else (Outline-Numbering!)
Definition: ndtxt.cxx:5449
static const SwSectionNode * FindSectNdWithEndAttr(const SwTextFootnote &rTextFootnote)
Definition: ftnidx.cxx:444
static rtl::Reference< SwXTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1221
const_iterator begin() const
size_type erase(const Value &x)
size_type size() const
std::pair< const_iterator, bool > insert(Value &&x)
void CopyWithFlyInFly(const SwNodeRange &rRg, SwNode &rInsPos, const std::pair< const SwPaM &, const SwPosition & > *pCopiedPaM=nullptr, bool bMakeNewFrames=true, bool bDelRedlines=true, bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
note: rRg/rInsPos exclude a partially selected start text node; pCopiedPaM includes a partially selec...
struct _xmlTextWriter * xmlTextWriterPtr
@ FTNEND_ATTXTEND_OWNNUMANDFMT
-""- and with own numberformat
Definition: fmtftntx.hxx:33
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(124)
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(123)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
sal_Int64 n
size
int i
Dialog to specify the properties of date form field.
@ SwFootnoteStartNode
Definition: ndtyp.hxx:55
@ RES_POOLCOLL_FOOTNOTE
Footnotes.
Definition: poolfmt.hxx:353
@ RES_POOLCOLL_ENDNOTE
Endnotes.
Definition: poolfmt.hxx:356
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:262