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  return;
332 
333  // lowercase, if rReferenceLanguage == "hu", not "Hu"
334  OUString sArticle;
335 
336  if ( rReferenceLanguage == "hu" )
337  sArticle = "a";
338  else
339  sArticle = "A";
340 
341  if (bArticleAz)
342  sArticle += "z";
343 
344  rRefText = sArticle + " " + rRefText;
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  return;
438 
439  rText = rText.replaceAll(u"\u00ad", "");
440  OUStringBuffer aBuf(rText);
441  const sal_Int32 l = aBuf.getLength();
442  for (sal_Int32 i = 0; i < l; ++i)
443  {
444  if (aBuf[i] < ' ')
445  {
446  aBuf[i] = ' ';
447  }
448  else if (aBuf[i] == 0x2011)
449  {
450  aBuf[i] = '-';
451  }
452  }
453  rText = aBuf.makeStringAndClear();
454  if (!rSetReferenceLanguage.isEmpty())
455  {
456  lcl_formatReferenceLanguage(rText, false, eLang, rSetReferenceLanguage);
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  return;
1032 
1033  SwDoc* pDoc = static_cast<SwGetRefFieldType*>(GetTyp())->GetDoc();
1034  const OUString rPar1 = GetPar1();
1035  // don't convert when the name points to an existing field type
1036  if(pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, rPar1, false))
1037  return;
1038 
1040  const char* pResId = nullptr;
1041  switch( nPoolId )
1042  {
1044  pResId = STR_POOLCOLL_LABEL_ABB;
1045  break;
1047  pResId = STR_POOLCOLL_LABEL_TABLE;
1048  break;
1050  pResId = STR_POOLCOLL_LABEL_FRAME;
1051  break;
1053  pResId = STR_POOLCOLL_LABEL_DRAWING;
1054  break;
1056  pResId = STR_POOLCOLL_LABEL_FIGURE;
1057  break;
1058  }
1059  if (pResId)
1060  SetPar1(SwResId(pResId));
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  {
1077  std::vector<SwFormatField*> vFields;
1078  GatherFields(vFields, false);
1079  for(auto pFormatField: vFields)
1080  {
1081  // update only the GetRef fields
1082  //JP 3.4.2001: Task 71231 - we need the correct language
1083  SwGetRefField* pGRef = static_cast<SwGetRefField*>(pFormatField->GetField());
1084  const SwTextField* pTField;
1085  if( !pGRef->GetLanguage() &&
1086  nullptr != ( pTField = pFormatField->GetTextField()) &&
1087  pTField->GetpTextNode() )
1088  {
1089  pGRef->SetLanguage( pTField->GetpTextNode()->GetLang(
1090  pTField->GetStart() ) );
1091  }
1092 
1093  // #i81002#
1094  pGRef->UpdateField( pFormatField->GetTextField() );
1095  }
1096  }
1097  // forward to text fields, they "expand" the text
1098  NotifyClients( pOld, pNew );
1099 }
1100 
1101 namespace sw {
1102 
1103 bool IsMarkHintHidden(SwRootFrame const& rLayout,
1104  SwTextNode const& rNode, SwTextAttrEnd const& rHint)
1105 {
1106  if (!rLayout.IsHideRedlines())
1107  {
1108  return false;
1109  }
1110  SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(
1111  rNode.getLayoutFrame(&rLayout)));
1112  if (!pFrame)
1113  {
1114  return true;
1115  }
1116  sal_Int32 const*const pEnd(rHint.GetEnd());
1117  if (pEnd)
1118  {
1119  return pFrame->MapModelToView(&rNode, rHint.GetStart())
1120  == pFrame->MapModelToView(&rNode, *pEnd);
1121  }
1122  else
1123  {
1124  assert(rHint.HasDummyChar());
1125  return pFrame->MapModelToView(&rNode, rHint.GetStart())
1126  == pFrame->MapModelToView(&rNode, rHint.GetStart() + 1);
1127  }
1128 }
1129 
1130 } // namespace sw
1131 
1132 SwTextNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
1133  sal_uInt16 nSubType, sal_uInt16 nSeqNo,
1134  sal_Int32* pStt, sal_Int32* pEnd,
1135  SwRootFrame const*const pLayout)
1136 {
1137  OSL_ENSURE( pStt, "Why did no one check the StartPos?" );
1138 
1140  SwTextNode* pTextNd = nullptr;
1141  switch( nSubType )
1142  {
1143  case REF_SETREFATTR:
1144  {
1145  const SwFormatRefMark *pRef = pDoc->GetRefMark( rRefMark );
1146  SwTextRefMark const*const pRefMark(pRef ? pRef->GetTextRefMark() : nullptr);
1147  if (pRefMark && (!pLayout || !sw::IsMarkHintHidden(*pLayout,
1148  pRefMark->GetTextNode(), *pRefMark)))
1149  {
1150  pTextNd = const_cast<SwTextNode*>(&pRef->GetTextRefMark()->GetTextNode());
1151  *pStt = pRef->GetTextRefMark()->GetStart();
1152  if( pEnd )
1153  *pEnd = pRef->GetTextRefMark()->GetAnyEnd();
1154  }
1155  }
1156  break;
1157 
1158  case REF_SEQUENCEFLD:
1159  {
1160  SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetFieldType( SwFieldIds::SetExp, rRefMark, false );
1161  if( pFieldType && pFieldType->HasWriterListeners() &&
1162  nsSwGetSetExpType::GSE_SEQ & static_cast<SwSetExpFieldType*>(pFieldType)->GetType() )
1163  {
1164  std::vector<SwFormatField*> vFields;
1165  pFieldType->GatherFields(vFields, false);
1166  for(auto pFormatField: vFields)
1167  {
1168  SwTextField *const pTextField(pFormatField->GetTextField());
1169  if (pTextField && nSeqNo ==
1170  static_cast<SwSetExpField*>(pFormatField->GetField())->GetSeqNumber()
1171  && (!pLayout || !pLayout->IsHideRedlines()
1172  || !sw::IsFieldDeletedInModel(rIDRA, *pTextField)))
1173  {
1174  pTextNd = pTextField->GetpTextNode();
1175  *pStt = pTextField->GetStart();
1176  if( pEnd )
1177  *pEnd = (*pStt) + 1;
1178  break;
1179  }
1180  }
1181  }
1182  }
1183  break;
1184 
1185  case REF_BOOKMARK:
1186  {
1188  if (ppMark != pDoc->getIDocumentMarkAccess()->getAllMarksEnd()
1189  && (!pLayout || !pLayout->IsHideRedlines()
1190  || !sw::IsMarkHidden(*pLayout, **ppMark)))
1191  {
1192  const ::sw::mark::IMark* pBkmk = *ppMark;
1193  const SwPosition* pPos = &pBkmk->GetMarkStart();
1194 
1195  pTextNd = pPos->nNode.GetNode().GetTextNode();
1196  *pStt = pPos->nContent.GetIndex();
1197  if(pEnd)
1198  {
1199  if(!pBkmk->IsExpanded())
1200  {
1201  *pEnd = *pStt;
1202  // #i81002#
1203  if(dynamic_cast< ::sw::mark::CrossRefBookmark const *>(pBkmk))
1204  {
1205  OSL_ENSURE( pTextNd,
1206  "<SwGetRefFieldType::FindAnchor(..)> - node marked by cross-reference bookmark isn't a text node --> crash" );
1207  *pEnd = pTextNd->Len();
1208  }
1209  }
1210  else if(pBkmk->GetOtherMarkPos().nNode == pBkmk->GetMarkPos().nNode)
1211  *pEnd = pBkmk->GetMarkEnd().nContent.GetIndex();
1212  else
1213  *pEnd = -1;
1214  }
1215  }
1216  }
1217  break;
1218 
1219  case REF_OUTLINE:
1220  break;
1221 
1222  case REF_FOOTNOTE:
1223  case REF_ENDNOTE:
1224  {
1225  for( auto pFootnoteIdx : pDoc->GetFootnoteIdxs() )
1226  if( nSeqNo == pFootnoteIdx->GetSeqRefNo() )
1227  {
1228  if (pLayout && pLayout->IsHideRedlines()
1229  && sw::IsFootnoteDeleted(rIDRA, *pFootnoteIdx))
1230  {
1231  return nullptr;
1232  }
1233  // otherwise: the position at the start of the footnote
1234  // will be mapped to something visible at least...
1235  SwNodeIndex* pIdx = pFootnoteIdx->GetStartNode();
1236  if( pIdx )
1237  {
1238  SwNodeIndex aIdx( *pIdx, 1 );
1239  pTextNd = aIdx.GetNode().GetTextNode();
1240  if( nullptr == pTextNd )
1241  pTextNd = static_cast<SwTextNode*>(pDoc->GetNodes().GoNext( &aIdx ));
1242  }
1243  *pStt = 0;
1244  if( pEnd )
1245  *pEnd = 0;
1246  break;
1247  }
1248  }
1249  break;
1250  }
1251 
1252  return pTextNd;
1253 }
1254 
1255 namespace {
1256 
1257 struct RefIdsMap
1258 {
1259 private:
1260  OUString aName;
1261  std::set<sal_uInt16> aIds;
1262  std::set<sal_uInt16> aDstIds;
1263  std::map<sal_uInt16, sal_uInt16> sequencedIds;
1264  bool bInit;
1265 
1266  void Init(SwDoc& rDoc, SwDoc& rDestDoc, bool bField );
1267  static void GetNoteIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds );
1268  void GetFieldIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds );
1269  void AddId( sal_uInt16 id, sal_uInt16 seqNum );
1270  static sal_uInt16 GetFirstUnusedId( std::set<sal_uInt16> &rIds );
1271 
1272 public:
1273  explicit RefIdsMap( const OUString& rName ) : aName( rName ), bInit( false ) {}
1274 
1275  void Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rField, bool bField );
1276 
1277  const OUString& GetName() const { return aName; }
1278 };
1279 
1280 }
1281 
1285 void RefIdsMap::GetFieldIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds)
1286 {
1287  SwFieldType *const pType = rDoc.getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, aName, false);
1288  if (!pType)
1289  return;
1290  std::vector<SwFormatField*> vFields;
1291  pType->GatherFields(vFields);
1292  for(const auto pF: vFields)
1293  rIds.insert(static_cast<SwSetExpField const*>(pF->GetField())->GetSeqNumber());
1294 }
1295 
1299 void RefIdsMap::GetNoteIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds)
1300 {
1301  for( auto n = rDoc.GetFootnoteIdxs().size(); n; )
1302  rIds.insert( rDoc.GetFootnoteIdxs()[ --n ]->GetSeqRefNo() );
1303 }
1304 
1309 void RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, bool bField )
1310 {
1311  if( bInit )
1312  return;
1313 
1314  if( bField )
1315  {
1316  GetFieldIdsFromDoc( rDestDoc, aIds );
1317  GetFieldIdsFromDoc( rDoc, aDstIds );
1318 
1319  // Map all the new src fields to the next available unused id
1320  for (const auto& rId : aDstIds)
1321  AddId( GetFirstUnusedId(aIds), rId );
1322 
1323  // Change the Sequence number of all SetExp fields in the source document
1324  SwFieldType* pType = rDoc.getIDocumentFieldsAccess().GetFieldType( SwFieldIds::SetExp, aName, false );
1325  if(pType)
1326  {
1327  std::vector<SwFormatField*> vFields;
1328  pType->GatherFields(vFields, false);
1329  for(auto pF: vFields)
1330  {
1331  if(!pF->GetTextField())
1332  continue;
1333  SwSetExpField *const pSetExp(static_cast<SwSetExpField *>(pF->GetField()));
1334  sal_uInt16 const n = pSetExp->GetSeqNumber();
1335  pSetExp->SetSeqNumber(sequencedIds[n]);
1336  }
1337  }
1338  }
1339  else
1340  {
1341  GetNoteIdsFromDoc( rDestDoc, aIds );
1342  GetNoteIdsFromDoc( rDoc, aDstIds );
1343 
1344  for (const auto& rId : aDstIds)
1345  AddId( GetFirstUnusedId(aIds), rId );
1346 
1347  // Change the footnotes/endnotes in the source doc to the new ID
1348  for ( const auto pFootnoteIdx : rDoc.GetFootnoteIdxs() )
1349  {
1350  sal_uInt16 const n = pFootnoteIdx->GetSeqRefNo();
1351  pFootnoteIdx->SetSeqNo(sequencedIds[n]);
1352  }
1353  }
1354  bInit = true;
1355 }
1356 
1360 sal_uInt16 RefIdsMap::GetFirstUnusedId( std::set<sal_uInt16> &rIds )
1361 {
1362  sal_uInt16 num(0);
1363 
1364  for( const auto& rId : rIds )
1365  {
1366  if( num != rId )
1367  {
1368  return num;
1369  }
1370  ++num;
1371  }
1372  return num;
1373 }
1374 
1378 void RefIdsMap::AddId( sal_uInt16 id, sal_uInt16 seqNum )
1379 {
1380  aIds.insert( id );
1381  sequencedIds[ seqNum ] = id;
1382 }
1383 
1384 void RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rField,
1385  bool bField )
1386 {
1387  Init( rDoc, rDestDoc, bField);
1388 
1389  sal_uInt16 const nSeqNo = rField.GetSeqNo();
1390 
1391  // check if it needs to be remapped
1392  // if sequencedIds doesn't contain the number, it means there is no
1393  // SetExp field / footnote in the source document: do not modify
1394  // the number, which works well for copy from/paste to same document
1395  // (and if it is not the same document, there's no "correct" result anyway)
1396  if (sequencedIds.count(nSeqNo))
1397  {
1398  rField.SetSeqNo( sequencedIds[nSeqNo] );
1399  }
1400 }
1401 
1410 {
1411  if( &rDestDoc == m_pDoc )
1412  return;
1413 
1414  if (rDestDoc.IsClipBoard())
1415  {
1416  // when copying _to_ clipboard, expectation is that no fields exist
1417  // so no re-mapping is required to avoid collisions
1419  return; // don't modify the fields in the source doc
1420  }
1421 
1422  // then there are RefFields in the DescDox - so all RefFields in the SourceDoc
1423  // need to be converted to have unique IDs for both documents
1424  RefIdsMap aFntMap { OUString() };
1425  std::vector<std::unique_ptr<RefIdsMap>> aFieldMap;
1426 
1427  std::vector<SwFormatField*> vFields;
1428  GatherFields(vFields);
1429  for(auto pField: vFields)
1430  {
1431  SwGetRefField& rRefField = *static_cast<SwGetRefField*>(pField->GetField());
1432  switch( rRefField.GetSubType() )
1433  {
1434  case REF_SEQUENCEFLD:
1435  {
1436  RefIdsMap* pMap = nullptr;
1437  for( auto n = aFieldMap.size(); n; )
1438  {
1439  if (aFieldMap[ --n ]->GetName() == rRefField.GetSetRefName())
1440  {
1441  pMap = aFieldMap[ n ].get();
1442  break;
1443  }
1444  }
1445  if( !pMap )
1446  {
1447  pMap = new RefIdsMap( rRefField.GetSetRefName() );
1448  aFieldMap.push_back(std::unique_ptr<RefIdsMap>(pMap));
1449  }
1450 
1451  pMap->Check( *m_pDoc, rDestDoc, rRefField, true );
1452  }
1453  break;
1454 
1455  case REF_FOOTNOTE:
1456  case REF_ENDNOTE:
1457  aFntMap.Check( *m_pDoc, rDestDoc, rRefField, false );
1458  break;
1459  }
1460  }
1461 }
1462 
1463 /* 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:1103
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:1409
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:3960
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:406
virtual ~SwGetRefField() override
Definition: reffld.cxx:359
OUString MakeRefNumString(const SwNodeNum &rNodeNum, const bool bInclSuperiorNumLabels, const int nRestrictInclToThisLevel) const
Definition: number.cxx:748
"Page"
Definition: reffld.hxx:48
OUString MakeNumString(const SwNodeNum &, bool bInclStrings=true) const
Definition: number.cxx:613
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:2485
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
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: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:1190
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: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
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: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:3088
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:4109
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
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:193
SwDoc * m_pDoc
Definition: docbm.cxx:1190
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:3052
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: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:1132
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
void Top(const long nTop)
Definition: swrect.hxx:204
void ConvertProgrammaticToUIName()
Definition: reffld.cxx:1028
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:76
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
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1670
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
SwDoc * GetDoc() const
Definition: reffld.hxx:75
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: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.
int i
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Overlay in order to update all ref-fields.
Definition: reffld.cxx:1072
const char last[]
#define O3TL_UNREACHABLE
SwPageFrame * FindPageFrame()
Definition: frame.hxx:660
const OUString & getBelowWord() const
const SwFormatRefMark * GetRefMark(const OUString &rName) const
Definition: doc.cxx:1047
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:130
#define FIELD_PROP_USHORT2
Definition: unofldmid.h:32
const SvxPageUsage aArr[]
SwFieldIds
Definition: fldbas.hxx:44
SwDoc * GetDoc()
Definition: node.hxx:702
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:2806
void SetFormat(sal_uInt32 const nSet)
Definition: fldbas.hxx:307
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
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
SwDoc * m_pDoc
Definition: reffld.hxx:67
A page of the document layout.
Definition: pagefrm.hxx:41
SwGetRefFieldType(SwDoc *pDoc)
Definition: reffld.cxx:1063
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:200
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
#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
void Left(const long nLeft)
Definition: swrect.hxx:195
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:334
"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:3376
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: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:1244
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:91
bool IsCountedInList() const
Definition: ndtxt.cxx:4252
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:432
bool IsRightToLeft() const
Definition: frame.hxx:965
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3402
"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: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
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:348
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: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)
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
virtual std::unique_ptr< SwField > Copy() const override
Definition: reffld.cxx:846
bool IsBodyFrame() const
Definition: frame.hxx:1184
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:1283
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:844
#define FIELD_PROP_SHORT1
Definition: unofldmid.h:37
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:193