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