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