LibreOffice Module sw (master)  1
reffld.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 <com/sun/star/text/ReferenceFieldPart.hpp>
21 #include <com/sun/star/text/ReferenceFieldSource.hpp>
22 #include <o3tl/unreachable.hxx>
24 #include <unotools/charclass.hxx>
25 #include <doc.hxx>
28 #include <IDocumentMarkAccess.hxx>
29 #include <pam.hxx>
30 #include <cntfrm.hxx>
31 #include <pagefrm.hxx>
32 #include <rootfrm.hxx>
33 #include <modeltoviewhelper.hxx>
34 #include <fmtfld.hxx>
35 #include <txtfld.hxx>
36 #include <txtftn.hxx>
37 #include <fmtrfmrk.hxx>
38 #include <txtrfmrk.hxx>
39 #include <fmtftn.hxx>
40 #include <ndtxt.hxx>
41 #include <chpfld.hxx>
42 #include <reffld.hxx>
43 #include <expfld.hxx>
44 #include <txtfrm.hxx>
45 #include <flyfrm.hxx>
46 #include <pagedesc.hxx>
47 #include <IMark.hxx>
48 #include <crossrefbookmark.hxx>
49 #include <ftnidx.hxx>
50 #include <viewsh.hxx>
51 #include <unofldmid.h>
52 #include <SwStyleNameMapper.hxx>
53 #include <shellres.hxx>
54 #include <poolfmt.hxx>
55 #include <strings.hrc>
56 #include <numrule.hxx>
57 #include <SwNodeNum.hxx>
58 #include <calbck.hxx>
59 
60 #include <cstddef>
61 #include <memory>
62 #include <vector>
63 #include <set>
64 #include <map>
65 #include <algorithm>
66 
67 using namespace ::com::sun::star;
68 using namespace ::com::sun::star::text;
69 using namespace ::com::sun::star::lang;
70 
71 static std::pair<OUString, bool> MakeRefNumStr(SwRootFrame const* pLayout,
72  const SwTextNode& rTextNodeOfField,
73  const SwTextNode& rTextNodeOfReferencedItem,
74  sal_uInt32 nRefNumFormat);
75 
76 static void lcl_GetLayTree( const SwFrame* pFrame, std::vector<const SwFrame*>& rArr )
77 {
78  while( pFrame )
79  {
80  if( pFrame->IsBodyFrame() ) // unspectacular
81  pFrame = pFrame->GetUpper();
82  else
83  {
84  rArr.push_back( pFrame );
85 
86  // this is the last page
87  if( pFrame->IsPageFrame() )
88  break;
89 
90  if( pFrame->IsFlyFrame() )
91  pFrame = static_cast<const SwFlyFrame*>(pFrame)->GetAnchorFrame();
92  else
93  pFrame = pFrame->GetUpper();
94  }
95  }
96 }
97 
98 bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos,
99  const SwTextNode& rBehindNd, sal_Int32 nSttPos )
100 {
101  const SwTextFrame * pMyFrame = static_cast<SwTextFrame*>(rMyNd.getLayoutFrame(
102  rMyNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr));
103  const SwTextFrame * pFrame = static_cast<SwTextFrame*>(rBehindNd.getLayoutFrame(
104  rBehindNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr));
105 
106  if( !pFrame || !pMyFrame)
107  return false;
108 
109  TextFrameIndex const nMySttPosIndex(pMyFrame->MapModelToView(&rMyNd, nMySttPos));
110  TextFrameIndex const nSttPosIndex(pFrame->MapModelToView(&rBehindNd, nSttPos));
111  while (pFrame && !pFrame->IsInside(nSttPosIndex))
112  pFrame = pFrame->GetFollow();
113  while (pMyFrame && !pMyFrame->IsInside(nMySttPosIndex))
114  pMyFrame = pMyFrame->GetFollow();
115 
116  if( !pFrame || !pMyFrame || pFrame == pMyFrame )
117  return false;
118 
119  std::vector<const SwFrame*> aRefArr, aArr;
120  ::lcl_GetLayTree( pFrame, aRefArr );
121  ::lcl_GetLayTree( pMyFrame, aArr );
122 
123  size_t nRefCnt = aRefArr.size() - 1, nCnt = aArr.size() - 1;
124  bool bVert = false;
125  bool bR2L = false;
126 
127  // Loop as long as a frame does not equal?
128  while( nRefCnt && nCnt && aRefArr[ nRefCnt ] == aArr[ nCnt ] )
129  {
130  const SwFrame* pTmpFrame = aArr[ nCnt ];
131  bVert = pTmpFrame->IsVertical();
132  bR2L = pTmpFrame->IsRightToLeft();
133  --nCnt;
134  --nRefCnt;
135  }
136 
137  // If a counter overflows?
138  if( aRefArr[ nRefCnt ] == aArr[ nCnt ] )
139  {
140  if( nCnt )
141  --nCnt;
142  else
143  --nRefCnt;
144  }
145 
146  const SwFrame* pRefFrame = aRefArr[ nRefCnt ];
147  const SwFrame* pFieldFrame = aArr[ nCnt ];
148 
149  // different frames, check their Y-/X-position
150  bool bRefIsLower = false;
151  if( ( SwFrameType::Column | SwFrameType::Cell ) & pFieldFrame->GetType() ||
152  ( SwFrameType::Column | SwFrameType::Cell ) & pRefFrame->GetType() )
153  {
154  if( pFieldFrame->GetType() == pRefFrame->GetType() )
155  {
156  // here, the X-pos is more important
157  if( bVert )
158  {
159  if( bR2L )
160  bRefIsLower = pRefFrame->getFrameArea().Top() < pFieldFrame->getFrameArea().Top() ||
161  ( pRefFrame->getFrameArea().Top() == pFieldFrame->getFrameArea().Top() &&
162  pRefFrame->getFrameArea().Left() < pFieldFrame->getFrameArea().Left() );
163  else
164  bRefIsLower = pRefFrame->getFrameArea().Top() < pFieldFrame->getFrameArea().Top() ||
165  ( pRefFrame->getFrameArea().Top() == pFieldFrame->getFrameArea().Top() &&
166  pRefFrame->getFrameArea().Left() > pFieldFrame->getFrameArea().Left() );
167  }
168  else if( bR2L )
169  bRefIsLower = pRefFrame->getFrameArea().Left() > pFieldFrame->getFrameArea().Left() ||
170  ( pRefFrame->getFrameArea().Left() == pFieldFrame->getFrameArea().Left() &&
171  pRefFrame->getFrameArea().Top() < pFieldFrame->getFrameArea().Top() );
172  else
173  bRefIsLower = pRefFrame->getFrameArea().Left() < pFieldFrame->getFrameArea().Left() ||
174  ( pRefFrame->getFrameArea().Left() == pFieldFrame->getFrameArea().Left() &&
175  pRefFrame->getFrameArea().Top() < pFieldFrame->getFrameArea().Top() );
176  pRefFrame = nullptr;
177  }
178  else if( ( SwFrameType::Column | SwFrameType::Cell ) & pFieldFrame->GetType() )
179  pFieldFrame = aArr[ nCnt - 1 ];
180  else
181  pRefFrame = aRefArr[ nRefCnt - 1 ];
182  }
183 
184  if( pRefFrame ) // misuse as flag
185  {
186  if( bVert )
187  {
188  if( bR2L )
189  bRefIsLower = pRefFrame->getFrameArea().Left() < pFieldFrame->getFrameArea().Left() ||
190  ( pRefFrame->getFrameArea().Left() == pFieldFrame->getFrameArea().Left() &&
191  pRefFrame->getFrameArea().Top() < pFieldFrame->getFrameArea().Top() );
192  else
193  bRefIsLower = pRefFrame->getFrameArea().Left() > pFieldFrame->getFrameArea().Left() ||
194  ( pRefFrame->getFrameArea().Left() == pFieldFrame->getFrameArea().Left() &&
195  pRefFrame->getFrameArea().Top() < pFieldFrame->getFrameArea().Top() );
196  }
197  else if( bR2L )
198  bRefIsLower = pRefFrame->getFrameArea().Top() < pFieldFrame->getFrameArea().Top() ||
199  ( pRefFrame->getFrameArea().Top() == pFieldFrame->getFrameArea().Top() &&
200  pRefFrame->getFrameArea().Left() > pFieldFrame->getFrameArea().Left() );
201  else
202  bRefIsLower = pRefFrame->getFrameArea().Top() < pFieldFrame->getFrameArea().Top() ||
203  ( pRefFrame->getFrameArea().Top() == pFieldFrame->getFrameArea().Top() &&
204  pRefFrame->getFrameArea().Left() < pFieldFrame->getFrameArea().Left() );
205  }
206  return bRefIsLower;
207 }
208 
209 // tdf#115319 create alternative reference formats, if the user asked for it
210 // (ReferenceFieldLanguage attribute of the reference field is not empty), and
211 // language of the text and ReferenceFieldLanguage are the same.
212 // Right now only HUNGARIAN seems to need this (as in the related issue,
213 // the reversed caption order in autocaption, solved by #i61007#)
214 static void lcl_formatReferenceLanguage( OUString& rRefText,
215  bool bClosingParenthesis, LanguageType eLang,
216  const OUString& rReferenceLanguage)
217 {
218  if (eLang != LANGUAGE_HUNGARIAN || (rReferenceLanguage != "hu" && rReferenceLanguage != "Hu"))
219  return;
220 
221  // Add Hungarian definitive article (a/az) before references,
222  // similar to \aref, \apageref etc. of LaTeX Babel package.
223  //
224  // for example:
225  //
226  // "az 1. oldalon" ("on page 1"), but
227  // "a 2. oldalon" ("on page 2")
228  // "a fentebbi", "az alábbi" (above/below)
229  // "a Lorem", "az Ipsum"
230  //
231  // Support following numberings of EU publications:
232  //
233  // 1., 1a., a), (1), (1a), iii., III., IA.
234  //
235  // (http://publications.europa.eu/code/hu/hu-120700.htm,
236  // http://publications.europa.eu/code/hu/hu-4100600.htm)
237 
238  LanguageTag aLanguageTag(eLang);
239  CharClass aCharClass( aLanguageTag );
240  sal_Int32 nLen = rRefText.getLength();
241  sal_Int32 i;
242  // substring of rRefText starting with letter or number
243  OUString sNumbering;
244  // is article "az"?
245  bool bArticleAz = false;
246  // is numbering a number?
247  bool bNum = false;
248 
249  // search first member of the numbering (numbers or letters)
250  for (i=0; i<nLen && (sNumbering.isEmpty() ||
251  ((bNum && aCharClass.isDigit(rRefText, i)) ||
252  (!bNum && aCharClass.isLetter(rRefText, i)))); ++i)
253  {
254  // start of numbering within the field text
255  if (sNumbering.isEmpty() && aCharClass.isLetterNumeric(rRefText, i)) {
256  sNumbering = rRefText.copy(i);
257  bNum = aCharClass.isDigit(rRefText, i);
258  }
259  }
260 
261  // length of numbering
262  nLen = i - (rRefText.getLength() - sNumbering.getLength());
263 
264  if (bNum)
265  {
266  // az 1, 1000, 1000000, 1000000000...
267  // az 5, 50, 500...
268  if ((sNumbering.startsWith("1") && (nLen == 1 || nLen == 4 || nLen == 7 || nLen == 10)) ||
269  sNumbering.startsWith("5"))
270  bArticleAz = true;
271  }
272  else if (nLen == 1 && sNumbering[0] < 128)
273  {
274  // ASCII 1-letter numbering
275  // az a), e), f) ... x)
276  // az i., v. (but, a x.)
277  static const OUString sLettersStartingWithVowels = "aefilmnorsuxyAEFILMNORSUXY";
278  if (sLettersStartingWithVowels.indexOf(sNumbering[0]) != -1)
279  {
280  // x), X) are letters, but x. and X. etc. are Roman numbers
281  if (bClosingParenthesis ||
282  (sNumbering[0] != 'x' && sNumbering[0] != 'X'))
283  bArticleAz = true;
284  } else if ((sNumbering[0] == 'v' || sNumbering[0] == 'V') && !bClosingParenthesis)
285  // v), V) are letters, but v. and V. are Roman numbers
286  bArticleAz = true;
287  }
288  else
289  {
290  static const sal_Unicode sVowelsWithDiacritic[] = {
291  0x00E1, 0x00C1, 0x00E9, 0x00C9, 0x00ED, 0x00CD,
292  0x00F3, 0x00D3, 0x00F6, 0x00D6, 0x0151, 0x0150,
293  0x00FA, 0x00DA, 0x00FC, 0x00DC, 0x0171, 0x0170, 0 };
294  static OUString sVowels = OUStringLiteral("aAeEiIoOuU") + sVowelsWithDiacritic;
295 
296  // handle more than 1-letter long Roman numbers and
297  // their possible combinations with letters:
298  // az IA, a IIB, a IIIC., az Ia, a IIb., a iiic), az LVIII. szonett
299  bool bRomanNumber = false;
300  if (nLen > 1 && (nLen + 1 >= sNumbering.getLength() || sNumbering[nLen] == '.'))
301  {
302  sal_Unicode last = sNumbering[nLen - 1];
303  OUString sNumberingTrim;
304  if ((last >= 'A' && last < 'I') || (last >= 'a' && last < 'i'))
305  sNumberingTrim = sNumbering.copy(0, nLen - 1);
306  else
307  sNumberingTrim = sNumbering.copy(0, nLen);
308  bRomanNumber =
309  sNumberingTrim.replaceAll("i", "").replaceAll("v", "").replaceAll("x", "").replaceAll("l", "").replaceAll("c", "").isEmpty() ||
310  sNumberingTrim.replaceAll("I", "").replaceAll("V", "").replaceAll("X", "").replaceAll("L", "").replaceAll("C", "").isEmpty();
311  }
312 
313  if (
314  // Roman number and a letter optionally
315  ( bRomanNumber && (
316  (sNumbering[0] == 'i' && sNumbering[1] != 'i' && sNumbering[1] != 'v' && sNumbering[1] != 'x') ||
317  (sNumbering[0] == 'I' && sNumbering[1] != 'I' && sNumbering[1] != 'V' && sNumbering[1] != 'X') ||
318  (sNumbering[0] == 'v' && sNumbering[1] != 'i') ||
319  (sNumbering[0] == 'V' && sNumbering[1] != 'I') ||
320  (sNumbering[0] == 'l' && sNumbering[1] != 'x') ||
321  (sNumbering[0] == 'L' && sNumbering[1] != 'X')) ) ||
322  // a word starting with vowel (not Roman number)
323  ( !bRomanNumber && sVowels.indexOf(sNumbering[0]) != -1))
324  {
325  bArticleAz = true;
326  }
327  }
328  // not a title text starting already with a definitive article
329  if ( !sNumbering.startsWith("A ") && !sNumbering.startsWith("Az ") &&
330  !sNumbering.startsWith("a ") && !sNumbering.startsWith("az ") )
331  {
332  // lowercase, if rReferenceLanguage == "hu", not "Hu"
333  OUString sArticle;
334 
335  if ( rReferenceLanguage == "hu" )
336  sArticle = "a";
337  else
338  sArticle = "A";
339 
340  if (bArticleAz)
341  sArticle += "z";
342 
343  rRefText = sArticle + " " + rRefText;
344  }
345 }
346 
349  const OUString& rSetRef, const OUString& rSetReferenceLanguage, sal_uInt16 nSubTyp,
350  sal_uInt16 nSequenceNo, sal_uLong nFormat )
351  : SwField( pFieldType, nFormat ),
352  m_sSetRefName( rSetRef ),
353  m_sSetReferenceLanguage( rSetReferenceLanguage ),
354  m_nSubType( nSubTyp ),
355  m_nSeqNo( nSequenceNo )
356 {
357 }
358 
360 {
361 }
362 
364 {
365  return SwResId(STR_REFERENCE);
366 }
367 
368 sal_uInt16 SwGetRefField::GetSubType() const
369 {
370  return m_nSubType;
371 }
372 
373 void SwGetRefField::SetSubType( sal_uInt16 n )
374 {
375  m_nSubType = n;
376 }
377 
378 // #i81002#
380 {
381  return GetSubType() == REF_BOOKMARK &&
383 }
384 
386 {
387  return GetSubType() == REF_BOOKMARK &&
389 }
390 
392 {
393  SwGetRefFieldType *pTyp = dynamic_cast<SwGetRefFieldType*>(GetTyp());
394  if (!pTyp)
395  return nullptr;
396  sal_Int32 nDummy = -1;
398 }
399 
400 // #i85090#
402  SwRootFrame const& rLayout) const
403 {
404  const SwTextNode* pReferencedTextNode( GetReferencedTextNode() );
405  return pReferencedTextNode
406  ? sw::GetExpandTextMerged(&rLayout, *pReferencedTextNode, true, false, ExpandMode(0))
407  : OUString();
408 }
409 
410 void SwGetRefField::SetExpand( const OUString& rStr )
411 {
412  m_sText = rStr;
413  m_sTextRLHidden = rStr;
414 }
415 
416 OUString SwGetRefField::ExpandImpl(SwRootFrame const*const pLayout) const
417 {
418  return pLayout && pLayout->IsHideRedlines() ? m_sTextRLHidden : m_sText;
419 }
420 
422 {
423  const OUString aName = GetTyp()->GetName();
424  if ( !aName.isEmpty() || !m_sSetRefName.isEmpty() )
425  {
426  return aName + " " + m_sSetRefName;
427  }
428  return ExpandImpl(nullptr);
429 }
430 
431 
432 static void FilterText(OUString & rText, LanguageType const eLang,
433  OUString const& rSetReferenceLanguage)
434 {
435  // remove all special characters (replace them with blanks)
436  if (!rText.isEmpty())
437  {
438  rText = rText.replaceAll(u"\u00ad", "");
439  OUStringBuffer aBuf(rText);
440  const sal_Int32 l = aBuf.getLength();
441  for (sal_Int32 i = 0; i < l; ++i)
442  {
443  if (aBuf[i] < ' ')
444  {
445  aBuf[i] = ' ';
446  }
447  else if (aBuf[i] == 0x2011)
448  {
449  aBuf[i] = '-';
450  }
451  }
452  rText = aBuf.makeStringAndClear();
453  if (!rSetReferenceLanguage.isEmpty())
454  {
455  lcl_formatReferenceLanguage(rText, false, eLang, rSetReferenceLanguage);
456  }
457  }
458 }
459 
460 // #i81002# - parameter <pFieldTextAttr> added
461 void SwGetRefField::UpdateField( const SwTextField* pFieldTextAttr )
462 {
463  m_sText.clear();
464  m_sTextRLHidden.clear();
465 
466  SwDoc* pDoc = static_cast<SwGetRefFieldType*>(GetTyp())->GetDoc();
467  // finding the reference target (the number)
468  sal_Int32 nNumStart = -1;
469  sal_Int32 nNumEnd = -1;
471  pDoc, m_sSetRefName, m_nSubType, m_nSeqNo, &nNumStart, &nNumEnd
472  );
473  // not found?
474  if ( !pTextNd )
475  {
478  return ;
479  }
480 
481  SwRootFrame const* pLayout(nullptr);
482  SwRootFrame const* pLayoutRLHidden(nullptr);
483  for (SwRootFrame const*const pLay : pDoc->GetAllLayouts())
484  {
485  if (pLay->IsHideRedlines())
486  {
487  pLayoutRLHidden = pLay;
488  }
489  else
490  {
491  pLayout = pLay;
492  }
493  }
494 
495  // where is the category name (e.g. "Illustration")?
496  const OUString aText = pTextNd->GetText();
497  const sal_Int32 nCatStart = aText.indexOf(m_sSetRefName);
498  const bool bHasCat = nCatStart>=0;
499  const sal_Int32 nCatEnd = bHasCat ? nCatStart + m_sSetRefName.getLength() : -1;
500 
501  // length of the referenced text
502  const sal_Int32 nLen = aText.getLength();
503 
504  // which format?
505  switch( GetFormat() )
506  {
507  case REF_CONTENT:
508  case REF_ONLYNUMBER:
509  case REF_ONLYCAPTION:
510  case REF_ONLYSEQNO:
511  {
512  // needed part of Text
513  sal_Int32 nStart;
514  sal_Int32 nEnd;
515 
516  switch( m_nSubType )
517  {
518  case REF_SEQUENCEFLD:
519 
520  switch( GetFormat() )
521  {
522  // "Category and Number"
523  case REF_ONLYNUMBER:
524  if (bHasCat) {
525  nStart = std::min(nNumStart, nCatStart);
526  nEnd = std::max(nNumEnd, nCatEnd);
527  } else {
528  nStart = nNumStart;
529  nEnd = nNumEnd;
530  }
531  break;
532 
533  // "Caption Text"
534  case REF_ONLYCAPTION: {
535  // next alphanumeric character after category+number
536  if (const SwTextAttr* const pTextAttr =
537  pTextNd->GetTextAttrForCharAt(nNumStart, RES_TXTATR_FIELD)
538  ) {
539  // start searching from nFrom
540  const sal_Int32 nFrom = bHasCat
541  ? std::max(nNumStart + 1, nCatEnd)
542  : nNumStart + 1;
543  nStart = SwGetExpField::GetReferenceTextPos( pTextAttr->GetFormatField(), *pDoc, nFrom );
544  } else {
545  nStart = bHasCat ? std::max(nNumEnd, nCatEnd) : nNumEnd;
546  }
547  nEnd = nLen;
548  break;
549  }
550 
551  // "Numbering"
552  case REF_ONLYSEQNO:
553  nStart = nNumStart;
554  nEnd = std::min(nStart + 1, nLen);
555  break;
556 
557  // "Reference" (whole Text)
558  case REF_CONTENT:
559  nStart = 0;
560  nEnd = nLen;
561  break;
562 
563  default:
565  }
566  break;
567 
568  case REF_BOOKMARK:
569  nStart = nNumStart;
570  // text is spread across multiple nodes - get whole text or only until end of node?
571  nEnd = nNumEnd<0 ? nLen : nNumEnd;
572  break;
573 
574  case REF_OUTLINE:
575  nStart = nNumStart;
576  nEnd = nNumEnd;
577  break;
578 
579  case REF_FOOTNOTE:
580  case REF_ENDNOTE:
581  // get number or numString
582  for( size_t i = 0; i < pDoc->GetFootnoteIdxs().size(); ++i )
583  {
584  SwTextFootnote* const pFootnoteIdx = pDoc->GetFootnoteIdxs()[i];
585  if( m_nSeqNo == pFootnoteIdx->GetSeqRefNo() )
586  {
587  m_sText = pFootnoteIdx->GetFootnote().GetViewNumStr(*pDoc, nullptr);
588  m_sTextRLHidden = pFootnoteIdx->GetFootnote().GetViewNumStr(*pDoc, pLayoutRLHidden);
589  if (!m_sSetReferenceLanguage.isEmpty())
590  {
593  }
594  break;
595  }
596  }
597  return;
598 
599  case REF_SETREFATTR:
600  nStart = nNumStart;
601  nEnd = nNumEnd;
602  break;
603 
604  default:
606  }
607 
608  if( nStart != nEnd ) // a section?
609  {
610  m_sText = pTextNd->GetExpandText(pLayout, nStart, nEnd - nStart, false, false, false, ExpandMode(0));
611  if (m_nSubType == REF_OUTLINE
613  {
615  pLayoutRLHidden, *pTextNd, false, false, ExpandMode(0));
616  }
617  else
618  {
619  m_sTextRLHidden = pTextNd->GetExpandText(pLayoutRLHidden,
620  nStart, nEnd - nStart, false, false, false, ExpandMode::HideDeletions);
621  }
624  }
625  }
626  break;
627 
628  case REF_PAGE:
629  case REF_PAGE_PGDESC:
630  {
631  auto const func =
632  [this, pTextNd, nNumStart](OUString & rText, SwRootFrame const*const pLay)
633  {
634  SwTextFrame const* pFrame = static_cast<SwTextFrame*>(pTextNd->getLayoutFrame(pLay, nullptr, nullptr));
635  SwTextFrame const*const pSave = pFrame;
636  if (pFrame)
637  {
638  TextFrameIndex const nNumStartIndex(pFrame->MapModelToView(pTextNd, nNumStart));
639  while (pFrame && !pFrame->IsInside(nNumStartIndex))
640  pFrame = pFrame->GetFollow();
641  }
642 
643  if( pFrame || nullptr != ( pFrame = pSave ))
644  {
645  sal_uInt16 nPageNo = pFrame->GetVirtPageNum();
646  const SwPageFrame *pPage;
647  if( REF_PAGE_PGDESC == GetFormat() &&
648  nullptr != ( pPage = pFrame->FindPageFrame() ) &&
649  pPage->GetPageDesc() )
650  {
651  rText = pPage->GetPageDesc()->GetNumType().GetNumStr(nPageNo);
652  }
653  else
654  {
655  rText = OUString::number(nPageNo);
656  }
657 
658  if (!m_sSetReferenceLanguage.isEmpty())
660  }
661  };
662  // sw_redlinehide: currently only one of these layouts will exist,
663  // so the getLayoutFrame will use the same frame in both cases
664  func(m_sText, pLayout);
665  func(m_sTextRLHidden, pLayoutRLHidden);
666  }
667  break;
668 
669  case REF_CHAPTER:
670  {
671  auto const func =
672  [this, pTextNd](OUString & rText, SwRootFrame const*const pLay)
673  {
674  // a bit tricky: search any frame
675  SwFrame const*const pFrame = pTextNd->getLayoutFrame(pLay);
676  if( pFrame )
677  {
678  SwChapterFieldType aFieldTyp;
679  SwChapterField aField( &aFieldTyp, 0 );
680  aField.SetLevel( MAXLEVEL - 1 );
681  aField.ChangeExpansion( *pFrame, pTextNd, true );
682  rText = aField.GetNumber(pLay);
683 
684  if (!m_sSetReferenceLanguage.isEmpty())
686  }
687  };
688  func(m_sText, pLayout);
689  func(m_sTextRLHidden, pLayoutRLHidden);
690  }
691  break;
692 
693  case REF_UPDOWN:
694  {
695  // #i81002#
696  // simplified: use parameter <pFieldTextAttr>
697  if( !pFieldTextAttr || !pFieldTextAttr->GetpTextNode() )
698  break;
699 
700  LanguageTag aLanguageTag( GetLanguage());
701  LocaleDataWrapper aLocaleData( aLanguageTag );
702 
703  // first a "short" test - in case both are in the same node
704  if( pFieldTextAttr->GetpTextNode() == pTextNd )
705  {
706  m_sText = nNumStart < pFieldTextAttr->GetStart()
707  ? aLocaleData.getAboveWord()
708  : aLocaleData.getBelowWord();
710  break;
711  }
712 
713  m_sText = ::IsFrameBehind( *pFieldTextAttr->GetpTextNode(), pFieldTextAttr->GetStart(),
714  *pTextNd, nNumStart )
715  ? aLocaleData.getAboveWord()
716  : aLocaleData.getBelowWord();
717 
718  if (!m_sSetReferenceLanguage.isEmpty())
720 
722  }
723  break;
724  // #i81002#
725  case REF_NUMBER:
728  {
729  if ( pFieldTextAttr && pFieldTextAttr->GetpTextNode() )
730  {
731  auto result =
732  MakeRefNumStr(pLayout, pFieldTextAttr->GetTextNode(), *pTextNd, GetFormat());
733  m_sText = result.first;
734  // for differentiation of Roman numbers and letters in Hungarian article handling
735  bool bClosingParenthesis = result.second;
736  if (!m_sSetReferenceLanguage.isEmpty())
737  {
738  lcl_formatReferenceLanguage(m_sText, bClosingParenthesis, GetLanguage(), m_sSetReferenceLanguage);
739  }
740  result =
741  MakeRefNumStr(pLayoutRLHidden, pFieldTextAttr->GetTextNode(), *pTextNd, GetFormat());
742  m_sTextRLHidden = result.first;
743  bClosingParenthesis = result.second;
744  if (!m_sSetReferenceLanguage.isEmpty())
745  {
746  lcl_formatReferenceLanguage(m_sTextRLHidden, bClosingParenthesis, GetLanguage(), m_sSetReferenceLanguage);
747  }
748  }
749  }
750  break;
751 
752  default:
753  OSL_FAIL("<SwGetRefField::UpdateField(..)> - unknown format type");
754  }
755 }
756 
757 // #i81002#
758 static std::pair<OUString, bool> MakeRefNumStr(
759  SwRootFrame const*const pLayout,
760  const SwTextNode& i_rTextNodeOfField,
761  const SwTextNode& i_rTextNodeOfReferencedItem,
762  const sal_uInt32 nRefNumFormat)
763 {
764  SwTextNode const& rTextNodeOfField(pLayout
765  ? *sw::GetParaPropsNode(*pLayout, i_rTextNodeOfField)
766  : i_rTextNodeOfField);
767  SwTextNode const& rTextNodeOfReferencedItem(pLayout
768  ? *sw::GetParaPropsNode(*pLayout, i_rTextNodeOfReferencedItem)
769  : i_rTextNodeOfReferencedItem);
770  if ( rTextNodeOfReferencedItem.HasNumber() &&
771  rTextNodeOfReferencedItem.IsCountedInList() )
772  {
773  OSL_ENSURE( rTextNodeOfReferencedItem.GetNum(pLayout),
774  "<SwGetRefField::MakeRefNumStr(..)> - referenced paragraph has number, but no <SwNodeNum> instance!" );
775 
776  // Determine, up to which level the superior list labels have to be
777  // included - default is to include all superior list labels.
778  int nRestrictInclToThisLevel( 0 );
779  // Determine for format REF_NUMBER the level, up to which the superior
780  // list labels have to be restricted, if the text node of the reference
781  // field and the text node of the referenced item are in the same
782  // document context.
783  if ( nRefNumFormat == REF_NUMBER &&
784  rTextNodeOfField.FindFlyStartNode()
785  == rTextNodeOfReferencedItem.FindFlyStartNode() &&
786  rTextNodeOfField.FindFootnoteStartNode()
787  == rTextNodeOfReferencedItem.FindFootnoteStartNode() &&
788  rTextNodeOfField.FindHeaderStartNode()
789  == rTextNodeOfReferencedItem.FindHeaderStartNode() &&
790  rTextNodeOfField.FindFooterStartNode()
791  == rTextNodeOfReferencedItem.FindFooterStartNode() )
792  {
793  const SwNodeNum* pNodeNumForTextNodeOfField( nullptr );
794  if ( rTextNodeOfField.HasNumber() &&
795  rTextNodeOfField.GetNumRule() == rTextNodeOfReferencedItem.GetNumRule() )
796  {
797  pNodeNumForTextNodeOfField = rTextNodeOfField.GetNum(pLayout);
798  }
799  else
800  {
801  pNodeNumForTextNodeOfField =
802  rTextNodeOfReferencedItem.GetNum(pLayout)->GetPrecedingNodeNumOf(rTextNodeOfField);
803  }
804  if ( pNodeNumForTextNodeOfField )
805  {
806  const SwNumberTree::tNumberVector rFieldNumVec =
807  pNodeNumForTextNodeOfField->GetNumberVector();
808  const SwNumberTree::tNumberVector rRefItemNumVec =
809  rTextNodeOfReferencedItem.GetNum()->GetNumberVector();
810  std::size_t nLevel( 0 );
811  while ( nLevel < rFieldNumVec.size() && nLevel < rRefItemNumVec.size() )
812  {
813  if ( rRefItemNumVec[nLevel] == rFieldNumVec[nLevel] )
814  {
815  nRestrictInclToThisLevel = nLevel + 1;
816  }
817  else
818  {
819  break;
820  }
821  ++nLevel;
822  }
823  }
824  }
825 
826  // Determine, if superior list labels have to be included
827  const bool bInclSuperiorNumLabels(
828  ( nRestrictInclToThisLevel < rTextNodeOfReferencedItem.GetActualListLevel() &&
829  ( nRefNumFormat == REF_NUMBER || nRefNumFormat == REF_NUMBER_FULL_CONTEXT ) ) );
830 
831  OSL_ENSURE( rTextNodeOfReferencedItem.GetNumRule(),
832  "<SwGetRefField::MakeRefNumStr(..)> - referenced numbered paragraph has no numbering rule set!" );
833  return std::make_pair(
834  rTextNodeOfReferencedItem.GetNumRule()->MakeRefNumString(
835  *(rTextNodeOfReferencedItem.GetNum(pLayout)),
836  bInclSuperiorNumLabels,
837  nRestrictInclToThisLevel ),
838  rTextNodeOfReferencedItem.GetNumRule()->MakeNumString(
839  *(rTextNodeOfReferencedItem.GetNum(pLayout)),
840  true).endsWith(")") );
841  }
842 
843  return std::make_pair(OUString(), false);
844 }
845 
846 std::unique_ptr<SwField> SwGetRefField::Copy() const
847 {
848  std::unique_ptr<SwGetRefField> pField( new SwGetRefField( static_cast<SwGetRefFieldType*>(GetTyp()),
850  m_nSeqNo, GetFormat() ) );
851  pField->m_sText = m_sText;
852  pField->m_sTextRLHidden = m_sTextRLHidden;
853  return std::unique_ptr<SwField>(pField.release());
854 }
855 
857 OUString SwGetRefField::GetPar1() const
858 {
859  return m_sSetRefName;
860 }
861 
863 void SwGetRefField::SetPar1( const OUString& rName )
864 {
865  m_sSetRefName = rName;
866 }
867 
868 OUString SwGetRefField::GetPar2() const
869 {
870  return ExpandImpl(nullptr);
871 }
872 
873 bool SwGetRefField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
874 {
875  switch( nWhichId )
876  {
877  case FIELD_PROP_USHORT1:
878  {
879  sal_Int16 nPart = 0;
880  switch(GetFormat())
881  {
882  case REF_PAGE : nPart = ReferenceFieldPart::PAGE ; break;
883  case REF_CHAPTER : nPart = ReferenceFieldPart::CHAPTER ; break;
884  case REF_CONTENT : nPart = ReferenceFieldPart::TEXT ; break;
885  case REF_UPDOWN : nPart = ReferenceFieldPart::UP_DOWN ; break;
886  case REF_PAGE_PGDESC: nPart = ReferenceFieldPart::PAGE_DESC ; break;
887  case REF_ONLYNUMBER : nPart = ReferenceFieldPart::CATEGORY_AND_NUMBER ; break;
888  case REF_ONLYCAPTION: nPart = ReferenceFieldPart::ONLY_CAPTION ; break;
889  case REF_ONLYSEQNO : nPart = ReferenceFieldPart::ONLY_SEQUENCE_NUMBER; break;
890  // #i81002#
891  case REF_NUMBER: nPart = ReferenceFieldPart::NUMBER; break;
892  case REF_NUMBER_NO_CONTEXT: nPart = ReferenceFieldPart::NUMBER_NO_CONTEXT; break;
893  case REF_NUMBER_FULL_CONTEXT: nPart = ReferenceFieldPart::NUMBER_FULL_CONTEXT; break;
894  }
895  rAny <<= nPart;
896  }
897  break;
898  case FIELD_PROP_USHORT2:
899  {
900  sal_Int16 nSource = 0;
901  switch(m_nSubType)
902  {
903  case REF_SETREFATTR : nSource = ReferenceFieldSource::REFERENCE_MARK; break;
904  case REF_SEQUENCEFLD: nSource = ReferenceFieldSource::SEQUENCE_FIELD; break;
905  case REF_BOOKMARK : nSource = ReferenceFieldSource::BOOKMARK; break;
906  case REF_OUTLINE : OSL_FAIL("not implemented"); break;
907  case REF_FOOTNOTE : nSource = ReferenceFieldSource::FOOTNOTE; break;
908  case REF_ENDNOTE : nSource = ReferenceFieldSource::ENDNOTE; break;
909  }
910  rAny <<= nSource;
911  }
912  break;
913  case FIELD_PROP_PAR1:
914  {
915  OUString sTmp(GetPar1());
917  {
919  switch( nPoolId )
920  {
926  SwStyleNameMapper::FillProgName(nPoolId, sTmp) ;
927  break;
928  }
929  }
930  rAny <<= sTmp;
931  }
932  break;
933  case FIELD_PROP_PAR3:
934  rAny <<= ExpandImpl(nullptr);
935  break;
936  case FIELD_PROP_PAR4:
937  rAny <<= m_sSetReferenceLanguage;
938  break;
939  case FIELD_PROP_SHORT1:
940  rAny <<= static_cast<sal_Int16>(m_nSeqNo);
941  break;
942  default:
943  assert(false);
944  }
945  return true;
946 }
947 
948 bool SwGetRefField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
949 {
950  switch( nWhichId )
951  {
952  case FIELD_PROP_USHORT1:
953  {
954  sal_Int16 nPart = 0;
955  rAny >>= nPart;
956  switch(nPart)
957  {
958  case ReferenceFieldPart::PAGE: nPart = REF_PAGE; break;
959  case ReferenceFieldPart::CHAPTER: nPart = REF_CHAPTER; break;
960  case ReferenceFieldPart::TEXT: nPart = REF_CONTENT; break;
961  case ReferenceFieldPart::UP_DOWN: nPart = REF_UPDOWN; break;
962  case ReferenceFieldPart::PAGE_DESC: nPart = REF_PAGE_PGDESC; break;
963  case ReferenceFieldPart::CATEGORY_AND_NUMBER: nPart = REF_ONLYNUMBER; break;
964  case ReferenceFieldPart::ONLY_CAPTION: nPart = REF_ONLYCAPTION; break;
965  case ReferenceFieldPart::ONLY_SEQUENCE_NUMBER : nPart = REF_ONLYSEQNO; break;
966  // #i81002#
967  case ReferenceFieldPart::NUMBER: nPart = REF_NUMBER; break;
968  case ReferenceFieldPart::NUMBER_NO_CONTEXT: nPart = REF_NUMBER_NO_CONTEXT; break;
969  case ReferenceFieldPart::NUMBER_FULL_CONTEXT: nPart = REF_NUMBER_FULL_CONTEXT; break;
970  default: return false;
971  }
972  SetFormat(nPart);
973  }
974  break;
975  case FIELD_PROP_USHORT2:
976  {
977  sal_Int16 nSource = 0;
978  rAny >>= nSource;
979  switch(nSource)
980  {
981  case ReferenceFieldSource::REFERENCE_MARK : m_nSubType = REF_SETREFATTR ; break;
982  case ReferenceFieldSource::SEQUENCE_FIELD :
983  {
985  break;
988  }
989  break;
990  case ReferenceFieldSource::BOOKMARK : m_nSubType = REF_BOOKMARK ; break;
991  case ReferenceFieldSource::FOOTNOTE : m_nSubType = REF_FOOTNOTE ; break;
993  }
994  }
995  break;
996  case FIELD_PROP_PAR1:
997  {
998  OUString sTmpStr;
999  rAny >>= sTmpStr;
1000  SetPar1(sTmpStr);
1002  }
1003  break;
1004  case FIELD_PROP_PAR3:
1005  {
1006  OUString sTmpStr;
1007  rAny >>= sTmpStr;
1008  SetExpand( sTmpStr );
1009  }
1010  break;
1011  case FIELD_PROP_PAR4:
1012  rAny >>= m_sSetReferenceLanguage;
1013  break;
1014  case FIELD_PROP_SHORT1:
1015  {
1016  sal_Int16 nSetSeq = 0;
1017  rAny >>= nSetSeq;
1018  if(nSetSeq >= 0)
1019  m_nSeqNo = nSetSeq;
1020  }
1021  break;
1022  default:
1023  assert(false);
1024  }
1025  return true;
1026 }
1027 
1029 {
1030  if(GetTyp() && REF_SEQUENCEFLD == m_nSubType)
1031  {
1032  SwDoc* pDoc = static_cast<SwGetRefFieldType*>(GetTyp())->GetDoc();
1033  const OUString rPar1 = GetPar1();
1034  // don't convert when the name points to an existing field type
1035  if(!pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, rPar1, false))
1036  {
1038  const char* pResId = nullptr;
1039  switch( nPoolId )
1040  {
1042  pResId = STR_POOLCOLL_LABEL_ABB;
1043  break;
1045  pResId = STR_POOLCOLL_LABEL_TABLE;
1046  break;
1048  pResId = STR_POOLCOLL_LABEL_FRAME;
1049  break;
1051  pResId = STR_POOLCOLL_LABEL_DRAWING;
1052  break;
1054  pResId = STR_POOLCOLL_LABEL_FIGURE;
1055  break;
1056  }
1057  if (pResId)
1058  SetPar1(SwResId(pResId));
1059  }
1060  }
1061 }
1062 
1064  : SwFieldType( SwFieldIds::GetRef ), m_pDoc( pDc )
1065 {}
1066 
1067 std::unique_ptr<SwFieldType> SwGetRefFieldType::Copy() const
1068 {
1069  return std::make_unique<SwGetRefFieldType>( m_pDoc );
1070 }
1071 
1072 void SwGetRefFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
1073 {
1074  // update to all GetReference fields
1075  if( !pNew && !pOld )
1076  {
1078  for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() )
1079  {
1080  // update only the GetRef fields
1081  //JP 3.4.2001: Task 71231 - we need the correct language
1082  SwGetRefField* pGRef = static_cast<SwGetRefField*>(pFormatField->GetField());
1083  const SwTextField* pTField;
1084  if( !pGRef->GetLanguage() &&
1085  nullptr != ( pTField = pFormatField->GetTextField()) &&
1086  pTField->GetpTextNode() )
1087  {
1088  pGRef->SetLanguage( pTField->GetpTextNode()->GetLang(
1089  pTField->GetStart() ) );
1090  }
1091 
1092  // #i81002#
1093  pGRef->UpdateField( pFormatField->GetTextField() );
1094  }
1095  }
1096  // forward to text fields, they "expand" the text
1097  NotifyClients( pOld, pNew );
1098 }
1099 
1100 namespace sw {
1101 
1102 bool IsMarkHintHidden(SwRootFrame const& rLayout,
1103  SwTextNode const& rNode, SwTextAttrEnd const& rHint)
1104 {
1105  if (!rLayout.IsHideRedlines())
1106  {
1107  return false;
1108  }
1109  SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(
1110  rNode.getLayoutFrame(&rLayout)));
1111  if (!pFrame)
1112  {
1113  return true;
1114  }
1115  sal_Int32 const*const pEnd(rHint.GetEnd());
1116  if (pEnd)
1117  {
1118  return pFrame->MapModelToView(&rNode, rHint.GetStart())
1119  == pFrame->MapModelToView(&rNode, *pEnd);
1120  }
1121  else
1122  {
1123  assert(rHint.HasDummyChar());
1124  return pFrame->MapModelToView(&rNode, rHint.GetStart())
1125  == pFrame->MapModelToView(&rNode, rHint.GetStart() + 1);
1126  }
1127 }
1128 
1129 } // namespace sw
1130 
1131 SwTextNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
1132  sal_uInt16 nSubType, sal_uInt16 nSeqNo,
1133  sal_Int32* pStt, sal_Int32* pEnd,
1134  SwRootFrame const*const pLayout)
1135 {
1136  OSL_ENSURE( pStt, "Why did no one check the StartPos?" );
1137 
1139  SwTextNode* pTextNd = nullptr;
1140  switch( nSubType )
1141  {
1142  case REF_SETREFATTR:
1143  {
1144  const SwFormatRefMark *pRef = pDoc->GetRefMark( rRefMark );
1145  SwTextRefMark const*const pRefMark(pRef ? pRef->GetTextRefMark() : nullptr);
1146  if (pRefMark && (!pLayout || !sw::IsMarkHintHidden(*pLayout,
1147  pRefMark->GetTextNode(), *pRefMark)))
1148  {
1149  pTextNd = const_cast<SwTextNode*>(&pRef->GetTextRefMark()->GetTextNode());
1150  *pStt = pRef->GetTextRefMark()->GetStart();
1151  if( pEnd )
1152  *pEnd = pRef->GetTextRefMark()->GetAnyEnd();
1153  }
1154  }
1155  break;
1156 
1157  case REF_SEQUENCEFLD:
1158  {
1159  SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetFieldType( SwFieldIds::SetExp, rRefMark, false );
1160  if( pFieldType && pFieldType->HasWriterListeners() &&
1161  nsSwGetSetExpType::GSE_SEQ & static_cast<SwSetExpFieldType*>(pFieldType)->GetType() )
1162  {
1163  SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType );
1164  for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() )
1165  {
1166  SwTextField *const pTextField(pFormatField->GetTextField());
1167  if (pTextField && nSeqNo ==
1168  static_cast<SwSetExpField*>(pFormatField->GetField())->GetSeqNumber()
1169  && (!pLayout || !pLayout->IsHideRedlines()
1170  || !sw::IsFieldDeletedInModel(rIDRA, *pTextField)))
1171  {
1172  pTextNd = pTextField->GetpTextNode();
1173  *pStt = pTextField->GetStart();
1174  if( pEnd )
1175  *pEnd = (*pStt) + 1;
1176  break;
1177  }
1178  }
1179  }
1180  }
1181  break;
1182 
1183  case REF_BOOKMARK:
1184  {
1186  if (ppMark != pDoc->getIDocumentMarkAccess()->getAllMarksEnd()
1187  && (!pLayout || !pLayout->IsHideRedlines()
1188  || !sw::IsMarkHidden(*pLayout, **ppMark)))
1189  {
1190  const ::sw::mark::IMark* pBkmk = *ppMark;
1191  const SwPosition* pPos = &pBkmk->GetMarkStart();
1192 
1193  pTextNd = pPos->nNode.GetNode().GetTextNode();
1194  *pStt = pPos->nContent.GetIndex();
1195  if(pEnd)
1196  {
1197  if(!pBkmk->IsExpanded())
1198  {
1199  *pEnd = *pStt;
1200  // #i81002#
1201  if(dynamic_cast< ::sw::mark::CrossRefBookmark const *>(pBkmk))
1202  {
1203  OSL_ENSURE( pTextNd,
1204  "<SwGetRefFieldType::FindAnchor(..)> - node marked by cross-reference bookmark isn't a text node --> crash" );
1205  *pEnd = pTextNd->Len();
1206  }
1207  }
1208  else if(pBkmk->GetOtherMarkPos().nNode == pBkmk->GetMarkPos().nNode)
1209  *pEnd = pBkmk->GetMarkEnd().nContent.GetIndex();
1210  else
1211  *pEnd = -1;
1212  }
1213  }
1214  }
1215  break;
1216 
1217  case REF_OUTLINE:
1218  break;
1219 
1220  case REF_FOOTNOTE:
1221  case REF_ENDNOTE:
1222  {
1223  for( auto pFootnoteIdx : pDoc->GetFootnoteIdxs() )
1224  if( nSeqNo == pFootnoteIdx->GetSeqRefNo() )
1225  {
1226  if (pLayout && pLayout->IsHideRedlines()
1227  && sw::IsFootnoteDeleted(rIDRA, *pFootnoteIdx))
1228  {
1229  return nullptr;
1230  }
1231  // otherwise: the position at the start of the footnote
1232  // will be mapped to something visible at least...
1233  SwNodeIndex* pIdx = pFootnoteIdx->GetStartNode();
1234  if( pIdx )
1235  {
1236  SwNodeIndex aIdx( *pIdx, 1 );
1237  if( nullptr == ( pTextNd = aIdx.GetNode().GetTextNode()))
1238  pTextNd = static_cast<SwTextNode*>(pDoc->GetNodes().GoNext( &aIdx ));
1239  }
1240  *pStt = 0;
1241  if( pEnd )
1242  *pEnd = 0;
1243  break;
1244  }
1245  }
1246  break;
1247  }
1248 
1249  return pTextNd;
1250 }
1251 
1253 {
1254 private:
1255  OUString const aName;
1256  std::set<sal_uInt16> aIds;
1257  std::set<sal_uInt16> aDstIds;
1258  std::map<sal_uInt16, sal_uInt16> sequencedIds;
1259  bool bInit;
1260 
1261  void Init(SwDoc& rDoc, SwDoc& rDestDoc, bool bField );
1262  static void GetNoteIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds );
1263  void GetFieldIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds );
1264  void AddId( sal_uInt16 id, sal_uInt16 seqNum );
1265  static sal_uInt16 GetFirstUnusedId( std::set<sal_uInt16> &rIds );
1266 
1267 public:
1268  explicit RefIdsMap( const OUString& rName ) : aName( rName ), bInit( false ) {}
1269 
1270  void Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rField, bool bField );
1271 
1272  const OUString& GetName() const { return aName; }
1273 };
1274 
1278 void RefIdsMap::GetFieldIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds)
1279 {
1281 
1282  if (!pType)
1283  return;
1284 
1285  SwIterator<SwFormatField,SwFieldType> aIter( *pType );
1286  for (SwFormatField const* pF = aIter.First(); pF; pF = aIter.Next())
1287  {
1288  if (pF->GetTextField())
1289  {
1290  SwTextNode const*const pNd = pF->GetTextField()->GetpTextNode();
1291  if (pNd && pNd->GetNodes().IsDocNodes())
1292  {
1293  rIds.insert(static_cast<SwSetExpField const*>(pF->GetField())
1294  ->GetSeqNumber());
1295  }
1296  }
1297  }
1298 }
1299 
1303 void RefIdsMap::GetNoteIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds)
1304 {
1305  for( auto n = rDoc.GetFootnoteIdxs().size(); n; )
1306  rIds.insert( rDoc.GetFootnoteIdxs()[ --n ]->GetSeqRefNo() );
1307 }
1308 
1313 void RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, bool bField )
1314 {
1315  if( bInit )
1316  return;
1317 
1318  if( bField )
1319  {
1320  GetFieldIdsFromDoc( rDestDoc, aIds );
1321  GetFieldIdsFromDoc( rDoc, aDstIds );
1322 
1323  // Map all the new src fields to the next available unused id
1324  for (const auto& rId : aDstIds)
1325  AddId( GetFirstUnusedId(aIds), rId );
1326 
1327  // Change the Sequence number of all SetExp fields in the source document
1329  if( pType )
1330  {
1331  SwIterator<SwFormatField,SwFieldType> aIter( *pType );
1332  for( SwFormatField* pF = aIter.First(); pF; pF = aIter.Next() )
1333  if( pF->GetTextField() )
1334  {
1335  SwSetExpField *const pSetExp(
1336  static_cast<SwSetExpField *>(pF->GetField()));
1337  sal_uInt16 const n = pSetExp->GetSeqNumber();
1338  pSetExp->SetSeqNumber( sequencedIds[n] );
1339  }
1340  }
1341  }
1342  else
1343  {
1344  GetNoteIdsFromDoc( rDestDoc, aIds );
1345  GetNoteIdsFromDoc( rDoc, aDstIds );
1346 
1347  for (const auto& rId : aDstIds)
1348  AddId( GetFirstUnusedId(aIds), rId );
1349 
1350  // Change the footnotes/endnotes in the source doc to the new ID
1351  for ( const auto pFootnoteIdx : rDoc.GetFootnoteIdxs() )
1352  {
1353  sal_uInt16 const n = pFootnoteIdx->GetSeqRefNo();
1354  pFootnoteIdx->SetSeqNo(sequencedIds[n]);
1355  }
1356  }
1357  bInit = true;
1358 }
1359 
1363 sal_uInt16 RefIdsMap::GetFirstUnusedId( std::set<sal_uInt16> &rIds )
1364 {
1365  sal_uInt16 num(0);
1366 
1367  for( const auto& rId : rIds )
1368  {
1369  if( num != rId )
1370  {
1371  return num;
1372  }
1373  ++num;
1374  }
1375  return num;
1376 }
1377 
1381 void RefIdsMap::AddId( sal_uInt16 id, sal_uInt16 seqNum )
1382 {
1383  aIds.insert( id );
1384  sequencedIds[ seqNum ] = id;
1385 }
1386 
1387 void RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rField,
1388  bool bField )
1389 {
1390  Init( rDoc, rDestDoc, bField);
1391 
1392  sal_uInt16 const nSeqNo = rField.GetSeqNo();
1393 
1394  // check if it needs to be remapped
1395  // if sequencedIds doesn't contain the number, it means there is no
1396  // SetExp field / footnote in the source document: do not modify
1397  // the number, which works well for copy from/paste to same document
1398  // (and if it is not the same document, there's no "correct" result anyway)
1399  if (sequencedIds.count(nSeqNo))
1400  {
1401  rField.SetSeqNo( sequencedIds[nSeqNo] );
1402  }
1403 }
1404 
1413 {
1414  if( &rDestDoc != m_pDoc )
1415  {
1416  if (rDestDoc.IsClipBoard())
1417  {
1418  // when copying _to_ clipboard, expectation is that no fields exist
1419  // so no re-mapping is required to avoid collisions
1421  return; // don't modify the fields in the source doc
1422  }
1423 
1424  // then there are RefFields in the DescDox - so all RefFields in the SourceDoc
1425  // need to be converted to have unique IDs for both documents
1426  RefIdsMap aFntMap { OUString() };
1427  std::vector<std::unique_ptr<RefIdsMap>> aFieldMap;
1428 
1430  for( SwFormatField* pField = aIter.First(); pField; pField = aIter.Next() )
1431  {
1432  SwGetRefField& rRefField = *static_cast<SwGetRefField*>(pField->GetField());
1433  switch( rRefField.GetSubType() )
1434  {
1435  case REF_SEQUENCEFLD:
1436  {
1437  RefIdsMap* pMap = nullptr;
1438  for( auto n = aFieldMap.size(); n; )
1439  {
1440  if (aFieldMap[ --n ]->GetName() == rRefField.GetSetRefName())
1441  {
1442  pMap = aFieldMap[ n ].get();
1443  break;
1444  }
1445  }
1446  if( !pMap )
1447  {
1448  pMap = new RefIdsMap( rRefField.GetSetRefName() );
1449  aFieldMap.push_back(std::unique_ptr<RefIdsMap>(pMap));
1450  }
1451 
1452  pMap->Check( *m_pDoc, rDestDoc, rRefField, true );
1453  }
1454  break;
1455 
1456  case REF_FOOTNOTE:
1457  case REF_ENDNOTE:
1458  aFntMap.Check( *m_pDoc, rDestDoc, rRefField, false );
1459  break;
1460  }
1461  }
1462  }
1463 }
1464 
1465 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString GetNumStr(sal_Int32 nNo) const
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:234
Base class of the Writer layout elements.
Definition: frame.hxx:295
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
bool IsMarkHintHidden(SwRootFrame const &rLayout, SwTextNode const &rNode, SwTextAttrEnd const &rHint)
Definition: reffld.cxx:1102
static std::pair< OUString, bool > MakeRefNumStr(SwRootFrame const *pLayout, const SwTextNode &rTextNodeOfField, const SwTextNode &rTextNodeOfReferencedItem, sal_uInt32 nRefNumFormat)
Definition: reffld.cxx:758
OUString GetExpandedTextOfReferencedTextNode(SwRootFrame const &rLayout) const
Definition: reffld.cxx:401
OUString m_sTextRLHidden
result for layout with redlines hidden
Definition: reffld.hxx:91
void MergeWithOtherDoc(SwDoc &rDestDoc)
Definition: reffld.cxx:1412
const SwStartNode * FindHeaderStartNode() const
Definition: node.hxx:202
void AddId(sal_uInt16 id, sal_uInt16 seqNum)
Add a new ID and sequence number to the "occupied" collection.
Definition: reffld.cxx:1381
Marks a position in the document model.
Definition: pam.hxx:35
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr) const
Definition: ndtxt.cxx:3967
bool isDigit(const OUString &rStr, sal_Int32 nPos) const
virtual OUString GetPar2() const override
Definition: reffld.cxx:868
LanguageType GetLanguage() const
Language at field position.
Definition: fldbas.hxx:393
virtual ~SwGetRefField() override
Definition: reffld.cxx:359
OUString MakeRefNumString(const SwNodeNum &rNodeNum, const bool bInclSuperiorNumLabels, const int nRestrictInclToThisLevel) const
Definition: number.cxx:708
"Page"
Definition: reffld.hxx:48
OUString MakeNumString(const SwNodeNum &, bool bInclStrings=true) const
Definition: number.cxx:610
const OUString & GetText() const
Definition: ndtxt.hxx:210
const SwStartNode * FindFooterStartNode() const
Definition: node.hxx:204
virtual const SwRootFrame * GetCurrentLayout() const =0
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2493
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:388
"Caption Text"
Definition: reffld.hxx:54
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
SwNodeIndex nNode
Definition: pam.hxx:37
sal_uInt16 m_nSeqNo
reference to either a SwTextFootnote::m_nSeqNo or a SwSetExpField::mnSeqNo
Definition: reffld.hxx:94
SwFrameType GetType() const
Definition: frame.hxx:498
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
sal_uIntPtr sal_uLong
Base class of all fields.
Definition: fldbas.hxx:280
virtual OUString GetDescription() const override
Definition: reffld.cxx:363
#define FIELD_PROP_USHORT1
Definition: unofldmid.h:31
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1147
#define ENDNOTE
Definition: ftnfrm.cxx:42
Definition: doc.hxx:185
TElementType * Next()
Definition: calbck.hxx:373
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId) override
Definition: reffld.cxx:948
aBuf
bool IsMarkHidden(SwRootFrame const &rLayout,::sw::mark::IMark const &rMark)
Definition: crbm.cxx:127
bool IsFootnoteDeleted(IDocumentRedlineAccess const &rIDRA, SwTextFootnote const &rTextFootnote)
Definition: ftnidx.cxx:37
bool HasDummyChar() const
Definition: txatbase.hxx:101
SwNode & GetNode() const
Definition: ndindex.hxx:119
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: reffld.cxx:416
SwTextNode * GetpTextNode() const
Definition: txtfld.hxx:49
std::set< sal_uInt16 > aIds
Definition: reffld.cxx:1256
virtual OUString GetPar1() const override
get reference name
Definition: reffld.cxx:857
SwNumberTree::tNumberVector GetNumberVector() const
Returns level numbers of this node.
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1602
Dialog to specify the properties of date form field.
void SetLevel(sal_uInt8)
Definition: chpfld.cxx:80
virtual const sal_Int32 * GetEnd() const override
end position
Definition: txatbase.cxx:78
bool IsInside(TextFrameIndex nPos) const
Respect the Follows.
Definition: txtfrm.hxx:818
sal_Int32 GetAnyEnd() const
end (if available), else start
Definition: txatbase.hxx:153
bool HasNumber() const
Returns if this text node has a number.
Definition: ndtxt.cxx:3095
bool HasWriterListeners() const
Definition: calbck.hxx:208
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4097
static bool IsLegalName(const OUString &rName)
OUString GetViewNumStr(const SwDoc &rDoc, SwRootFrame const *pLayout, bool bInclStrings=false) const
Returns string to be displayed of footnote / endnote.
Definition: atrftn.cxx:213
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const override
Definition: reffld.cxx:873
virtual void SetSubType(sal_uInt16 n) override
Definition: reffld.cxx:373
#define LANGUAGE_HUNGARIAN
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
Definition: ndtxt.cxx:3059
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
sal_uInt16 sal_Unicode
bool IsFlyFrame() const
Definition: frame.hxx:1186
const SwTextNode & GetTextNode() const
Definition: txtrfmrk.hxx:44
"As Page Style"
Definition: reffld.hxx:52
static SwTextNode * FindAnchor(SwDoc *pDoc, const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_Int32 *pStt, sal_Int32 *pEnd=nullptr, SwRootFrame const *pLayout=nullptr)
Definition: reffld.cxx:1131
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
void Top(const long nTop)
Definition: swrect.hxx:202
void ConvertProgrammaticToUIName()
Definition: reffld.cxx:1028
SwIndex nContent
Definition: pam.hxx:38
const SwRect & getFrameArea() const
Definition: frame.hxx:175
"Chapter"
Definition: reffld.hxx:49
"Number (full context)"
Definition: reffld.hxx:60
void GetFieldIdsFromDoc(SwDoc &rDoc, std::set< sal_uInt16 > &rIds)
Get a sorted list of the field IDs from a document.
Definition: reffld.cxx:1278
static void lcl_GetLayTree(const SwFrame *pFrame, std::vector< const SwFrame * > &rArr)
Definition: reffld.cxx:76
void Init(SwDoc &rDoc, SwDoc &rDestDoc, bool bField)
Initialise the aIds and aDestIds collections from the source documents.
Definition: reffld.cxx:1313
OUString m_sSetRefName
Definition: reffld.hxx:88
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
const OUString & getAboveWord() const
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
static void lcl_formatReferenceLanguage(OUString &rRefText, bool bClosingParenthesis, LanguageType eLang, const OUString &rReferenceLanguage)
Definition: reffld.cxx:214
"Category and Number"
Definition: reffld.hxx:53
std::set< sal_uInt16 > aDstIds
Definition: reffld.cxx:1257
OUString m_sSetReferenceLanguage
Definition: reffld.hxx:89
size_type size() const
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: reffld.cxx:1067
sal_uInt16 GetSeqRefNo() const
Definition: txtftn.hxx:64
std::map< sal_uInt16, sal_uInt16 > sequencedIds
Definition: reffld.cxx:1258
SwDoc * GetDoc() const
Definition: reffld.hxx:75
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:844
sal_uInt16 GetSeqNumber() const
Definition: expfld.hxx:243
sal_uInt16 GetVirtPageNum() const
Definition: trvlfrm.cxx:1805
static void GetNoteIdsFromDoc(SwDoc &rDoc, std::set< sal_uInt16 > &rIds)
Get a sorted list of the footnote/endnote IDs from a document.
Definition: reffld.cxx:1303
static sal_Int32 GetReferenceTextPos(const SwFormatField &rFormat, SwDoc &rDoc, sal_Int32 nHint=0)
Find the index of the reference text following the current field.
Definition: expfld.cxx:974
bool IsRefToNumItemCrossRefBookmark() const
Definition: reffld.cxx:385
OUString GetExpandTextMerged(SwRootFrame const *const pLayout, SwTextNode const &rNode, bool const bWithNumber, bool const bWithSpacesForLevel, ExpandMode const i_mode)
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Overlay in order to update all ref-fields.
Definition: reffld.cxx:1072
#define O3TL_UNREACHABLE
SwPageFrame * FindPageFrame()
Definition: frame.hxx:658
const OUString & getBelowWord() const
const SwFormatRefMark * GetRefMark(const OUString &rName) const
Definition: doc.cxx:1060
TElementType * First()
Definition: calbck.hxx:342
MetadataImporterPluginType * result
int i
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:129
#define FIELD_PROP_USHORT2
Definition: unofldmid.h:32
SwFieldIds
Definition: fldbas.hxx:38
SwDoc * GetDoc()
Definition: node.hxx:702
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
float u
new reference format types for referencing bookmarks and set references
Definition: reffld.hxx:58
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2813
void SetFormat(sal_uInt32 const nSet)
Definition: fldbas.hxx:294
std::set< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1660
Label drawing objects.
Definition: poolfmt.hxx:358
const SwTextRefMark * GetTextRefMark() const
Definition: fmtrfmrk.hxx:64
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:693
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
SwDoc * m_pDoc
Definition: reffld.hxx:67
A page of the document layout.
Definition: pagefrm.hxx:40
SwGetRefFieldType(SwDoc *pDoc)
Definition: reffld.cxx:1063
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:200
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
OUString const aName
Definition: reffld.cxx:1255
#define FIELD_PROP_PAR3
Definition: unofldmid.h:25
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
Definition: txtfrm.cxx:336
SwFieldType * GetTyp() const
Definition: fldbas.hxx:383
void NotifyClients(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.cxx:167
std::vector< tSwNumTreeNumber > tNumberVector
RefIdsMap(const OUString &rName)
Definition: reffld.cxx:1268
void SetSeqNumber(sal_uInt16 n)
Logical number, sequence fields.
Definition: expfld.hxx:242
OUString const aGetRefField_RefItemNotFound
Definition: shellres.hxx:43
void Left(const long nLeft)
Definition: swrect.hxx:193
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
ExpandMode
Some helpers for converting model strings to view strings.
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
"Reference"
Definition: reffld.hxx:50
#define RES_TXTATR_FIELD
Definition: hintids.hxx:151
const SwGetSetExpType GSE_SEQ
Sequence.
Definition: fldbas.hxx:198
sal_uInt16 GetSeqNo() const
Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
Definition: reffld.hxx:132
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) const
add 4th optional parameter indicating, when that a spa...
Definition: ndtxt.cxx:3383
virtual void SetLanguage(LanguageType nLng)
Definition: fldbas.cxx:362
#define FIELD_PROP_PAR1
Definition: unofldmid.h:23
virtual OUString GetName() const
Only in derived classes.
Definition: fldbas.cxx:135
void ChangeExpansion(const SwFrame &, const SwContentNode *, bool bSrchNum=false)
Definition: chpfld.cxx:127
bool IsFieldDeletedInModel(IDocumentRedlineAccess const &rIDRA, SwTextField const &rTextField)
virtual OUString GetFieldName() const override
get name or content
Definition: reffld.cxx:421
bool IsRefToHeadingCrossRefBookmark() const
Definition: reffld.cxx:379
OUString m_sText
result
Definition: reffld.hxx:90
"Above/Below"
Definition: reffld.hxx:51
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
Definition: txtfrm.cxx:1251
sal_Int32 GetIndex() const
Definition: index.hxx:95
bool IsCountedInList() const
Definition: ndtxt.cxx:4240
bool IsClipBoard() const
Definition: doc.hxx:956
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
SwNodes & GetNodes()
Definition: doc.hxx:402
static void FilterText(OUString &rText, LanguageType const eLang, OUString const &rSetReferenceLanguage)
Definition: reffld.cxx:432
bool IsRightToLeft() const
Definition: frame.hxx:963
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3367
"Number (no context)"
Definition: reffld.hxx:59
bool IsPageFrame() const
Definition: frame.hxx:1154
sal_uInt16 m_nSubType
Definition: reffld.hxx:92
const OUString & GetSetRefName() const
Definition: reffld.hxx:107
Label illustration.
Definition: poolfmt.hxx:346
void SetSeqNo(sal_uInt16 n)
Definition: reffld.hxx:133
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding)...
Definition: rootfrm.hxx:416
Get reference.
Definition: reffld.hxx:65
void Check(SwDoc &rDoc, SwDoc &rDestDoc, SwGetRefField &rField, bool bField)
Definition: reffld.cxx:1387
const SvxPageUsage aArr[]
const OUString & GetNumber(SwRootFrame const *pLayout=nullptr) const
Definition: chpfld.cxx:86
const SwNodeNum * GetPrecedingNodeNumOf(const SwTextNode &rTextNode) const
determines the instance, which is preceding the given text node
Definition: SwNodeNum.cxx:356
OString const aName
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:198
"Numbering"
Definition: reffld.hxx:55
SwGetRefField(SwGetRefFieldType *, const OUString &rSetRef, const OUString &rReferenceLanguage, sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uLong nFormat)
get references
Definition: reffld.cxx:348
bool IsVertical() const
Definition: frame.hxx:949
const OUString & GetName() const
Definition: reffld.cxx:1272
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:627
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2334
#define FIELD_PROP_PAR4
Definition: unofldmid.h:36
bool IsFrameBehind(const SwTextNode &rMyNd, sal_Int32 nMySttPos, const SwTextNode &rBehindNd, sal_Int32 nSttPos)
Definition: reffld.cxx:98
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
void UpdateField(const SwTextField *pFieldTextAttr)
The instance, which represents the text attribute for the instance...
Definition: reffld.cxx:461
static bool IsLegalName(const OUString &rName)
static sal_uInt16 GetFirstUnusedId(std::set< sal_uInt16 > &rIds)
Get the lowest number unused in the passed set.
Definition: reffld.cxx:1363
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
virtual std::unique_ptr< SwField > Copy() const override
Definition: reffld.cxx:846
bool bInit
ID numbers sorted by sequence number.
Definition: reffld.cxx:1259
bool IsBodyFrame() const
Definition: frame.hxx:1182
void SetExpand(const OUString &rStr)
Definition: reffld.cxx:410
virtual sal_uInt16 GetSubType() const override
Get/set sub type.
Definition: reffld.cxx:368
bool isLetter(const OUString &rStr, sal_Int32 nPos) const
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1271
const SwStartNode * FindFootnoteStartNode() const
Definition: node.hxx:200
virtual void SetPar1(const OUString &rStr) override
set reference name
Definition: reffld.cxx:863
const SwTextNode * GetReferencedTextNode() const
Definition: reffld.cxx:391
static sal_uInt16 GetPoolIdFromProgName(const OUString &rName, SwGetPoolIdFromName)
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
void SAL_CALL last(const css::awt::SpinEvent &rEvent) override
#define FIELD_PROP_SHORT1
Definition: unofldmid.h:37
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:193