LibreOffice Module sw (master)  1
fldref.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 <swtypes.hxx>
21 #include <view.hxx>
22 #include <IMark.hxx>
23 #include <expfld.hxx>
24 #include <swmodule.hxx>
25 #include "fldref.hxx"
26 #include <reffld.hxx>
27 #include <wrtsh.hxx>
28 
29 #include <fldref.hrc>
30 #include <globals.hrc>
31 #include <strings.hrc>
32 #include <SwNodeNum.hxx>
33 #include <IDocumentMarkAccess.hxx>
34 #include <ndtxt.hxx>
35 #include <unotools/configmgr.hxx>
37 #include <unotools/charclass.hxx>
38 
39 #include <comphelper/string.hxx>
40 
41 #define REFFLDFLAG 0x4000
42 #define REFFLDFLAG_BOOKMARK 0x4800
43 #define REFFLDFLAG_FOOTNOTE 0x5000
44 #define REFFLDFLAG_ENDNOTE 0x6000
45 // #i83479#
46 #define REFFLDFLAG_HEADING 0x7100
47 #define REFFLDFLAG_NUMITEM 0x7200
48 
49 static sal_uInt16 nFieldDlgFormatSel = 0;
50 
51 #define USER_DATA_VERSION_1 "1"
52 #define USER_DATA_VERSION USER_DATA_VERSION_1
53 
55  : SwFieldPage(pParent, "modules/swriter/ui/fldrefpage.ui", "FieldRefPage", pCoreSet)
56  , maOutlineNodes()
57  , maNumItems()
58  , mpSavedSelectedTextNode(nullptr)
59  , mnSavedSelectedPos(0)
60  , m_xTypeLB(m_xBuilder->weld_tree_view("type"))
61  , m_xSelection(m_xBuilder->weld_widget("selectframe"))
62  , m_xSelectionLB(m_xBuilder->weld_tree_view("select"))
63  , m_xSelectionToolTipLB(m_xBuilder->weld_tree_view("selecttip"))
64  , m_xFormat(m_xBuilder->weld_widget("formatframe"))
65  , m_xFormatLB(m_xBuilder->weld_tree_view("format"))
66  , m_xNameFT(m_xBuilder->weld_label("nameft"))
67  , m_xNameED(m_xBuilder->weld_entry("name"))
68  , m_xValueED(m_xBuilder->weld_entry("value"))
69  , m_xFilterED(m_xBuilder->weld_entry("filter"))
70 {
71  m_xSelectionLB->make_sorted();
72  // #i83479#
73  for (size_t i = 0; i < SAL_N_ELEMENTS(FLD_REF_PAGE_TYPES); ++i)
74  {
75  m_xTypeLB->append_text(SwResId(FLD_REF_PAGE_TYPES[i]));
76  m_xFormatLB->append_text(SwResId(FLD_REF_PAGE_TYPES[i]));
77  }
78 
79  sBookmarkText = m_xTypeLB->get_text(0);
80  sFootnoteText = m_xTypeLB->get_text(1);
81  sEndnoteText = m_xTypeLB->get_text(2);
82  // #i83479#
83  sHeadingText = m_xTypeLB->get_text(3);
84  sNumItemText = m_xTypeLB->get_text(4);
85 
86  auto nHeight = m_xTypeLB->get_height_rows(8);
87  auto nWidth = LogicToPixel(Size(FIELD_COLUMN_WIDTH, 0), MapMode(MapUnit::MapAppFont)).Width();
88  m_xTypeLB->set_size_request(nWidth, nHeight);
89  m_xFormatLB->set_size_request(nWidth, nHeight);
90  m_xSelection->set_size_request(nWidth * 2, nHeight);
91  nHeight = m_xTypeLB->get_height_rows(20);
92  m_xSelectionToolTipLB->set_size_request(nHeight, nWidth*2);
93 
94  m_xTypeLB->clear();
95 
96  m_xNameED->connect_changed(LINK(this, SwFieldRefPage, ModifyHdl));
97  m_xFilterED->connect_changed( LINK( this, SwFieldRefPage, ModifyHdl_Impl ) );
98 
99  m_xTypeLB->connect_row_activated(LINK(this, SwFieldRefPage, TreeViewInsertHdl));
100  m_xTypeLB->connect_changed(LINK(this, SwFieldRefPage, TypeHdl));
101  m_xSelectionLB->connect_changed(LINK(this, SwFieldRefPage, SubTypeListBoxHdl));
102  m_xSelectionLB->connect_row_activated(LINK(this, SwFieldRefPage, TreeViewInsertHdl));
103  m_xFormatLB->connect_row_activated(LINK(this, SwFieldRefPage, TreeViewInsertHdl));
104 
105  // #i83479#
106  m_xSelectionToolTipLB->connect_changed( LINK(this, SwFieldRefPage, SubTypeTreeListBoxHdl) );
107  m_xSelectionToolTipLB->connect_row_activated( LINK(this, SwFieldRefPage, TreeViewInsertHdl) );
108  m_xFilterED->grab_focus();
109 }
110 
112 {
113  disposeOnce();
114 }
115 
117 {
118  UpdateSubType(comphelper::string::strip(m_xFilterED->get_text(), ' '));
119 }
120 
121 // #i83479#
123 {
124  mpSavedSelectedTextNode = nullptr;
125  mnSavedSelectedPos = 0;
126  if ( m_xSelectionToolTipLB->get_visible() )
127  {
128  int nEntry = m_xSelectionToolTipLB->get_selected_index();
129  if (nEntry != -1)
130  {
131  const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
132 
133  if ( nTypeId == REFFLDFLAG_HEADING )
134  {
135  mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
136  if ( mnSavedSelectedPos < maOutlineNodes.size() )
137  {
139  }
140  }
141  else if ( nTypeId == REFFLDFLAG_NUMITEM )
142  {
143  mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
144  if ( mnSavedSelectedPos < maNumItems.size() )
145  {
147  }
148  }
149  }
150  }
151 }
152 
154 {
155  if (!IsFieldEdit())
156  {
157  SavePos(*m_xTypeLB);
158  // #i83479#
160  }
161  SetSelectionSel(-1);
162  SetTypeSel(-1);
163  Init(); // general initialisation
164 
165  // initialise TypeListBox
166  m_xTypeLB->freeze();
167  m_xTypeLB->clear();
168 
169  // fill Type-Listbox
170 
171  // set/insert reference
173 
174  for (short i = rRg.nStart; i < rRg.nEnd; ++i)
175  {
176  const sal_uInt16 nTypeId = SwFieldMgr::GetTypeId(i);
177 
178  if (!IsFieldEdit() || nTypeId != TYP_SETREFFLD)
179  {
180  m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(i));
181  }
182  }
183 
184  // #i83479#
185  // entries for headings and numbered items
186  m_xTypeLB->append(OUString::number(REFFLDFLAG_HEADING), sHeadingText);
187  m_xTypeLB->append(OUString::number(REFFLDFLAG_NUMITEM), sNumItemText);
188 
189  // fill up with the sequence types
190  SwWrtShell *pSh = GetWrtShell();
191  if (!pSh)
192  pSh = ::GetActiveWrtShell();
193 
194  if (!pSh)
195  return;
196 
197  const size_t nFieldTypeCnt = pSh->GetFieldTypeCount(SwFieldIds::SetExp);
198 
199  OSL_ENSURE( nFieldTypeCnt < static_cast<size_t>(REFFLDFLAG), "<SwFieldRefPage::Reset> - Item index will overlap flags!" );
200 
201  for (size_t n = 0; n < nFieldTypeCnt; ++n)
202  {
203  SwSetExpFieldType* pType = static_cast<SwSetExpFieldType*>(pSh->GetFieldType(n, SwFieldIds::SetExp));
204 
205  if ((nsSwGetSetExpType::GSE_SEQ & pType->GetType()) && pType->HasWriterListeners() && pSh->IsUsed(*pType))
206  {
207  m_xTypeLB->append(OUString::number(REFFLDFLAG | n), pType->GetName());
208  }
209  }
210 
211  // text marks - now always (because of globaldocuments)
212  m_xTypeLB->append(OUString::number(REFFLDFLAG_BOOKMARK), sBookmarkText);
213 
214  // footnotes:
215  if( pSh->HasFootnotes() )
216  {
217  m_xTypeLB->append(OUString::number(REFFLDFLAG_FOOTNOTE), sFootnoteText);
218  }
219 
220  // endnotes:
221  if ( pSh->HasFootnotes(true) )
222  {
223  m_xTypeLB->append(OUString::number(REFFLDFLAG_ENDNOTE), sEndnoteText);
224  }
225 
226  m_xTypeLB->thaw();
227 
228  // select old Pos
229  if (!IsFieldEdit())
231 
232  nFieldDlgFormatSel = 0;
233 
234  sal_uInt16 nFormatBoxPosition = USHRT_MAX;
235  if( !IsRefresh() )
236  {
237  sal_Int32 nIdx{ 0 };
238  const OUString sUserData = GetUserData();
239  if(!IsRefresh() && sUserData.getToken(0, ';', nIdx).
240  equalsIgnoreAsciiCase(USER_DATA_VERSION_1))
241  {
242  const sal_uInt16 nVal = static_cast< sal_uInt16 >(sUserData.getToken(0, ';', nIdx).toInt32());
243  if(nVal != USHRT_MAX)
244  {
245  for(sal_Int32 i = 0, nEntryCount = m_xTypeLB->n_children(); i < nEntryCount; ++i)
246  {
247  if (nVal == m_xTypeLB->get_id(i).toUInt32())
248  {
249  m_xTypeLB->select(i);
250  break;
251  }
252  }
253  if (nIdx>=0 && nIdx<sUserData.getLength())
254  {
255  nFormatBoxPosition = static_cast< sal_uInt16 >(sUserData.getToken(0, ';', nIdx).toInt32());
256  }
257  }
258  }
259  }
260  TypeHdl(*m_xTypeLB);
261  if(nFormatBoxPosition != USHRT_MAX)
262  {
263  m_xFormatLB->select(nFormatBoxPosition);
264  }
265  if (IsFieldEdit())
266  {
267  m_xTypeLB->save_value();
268  m_xSelectionLB->save_value();
269  m_xFormatLB->save_value();
270  m_xNameED->save_value();
271  m_xValueED->save_value();
272  m_xFilterED->set_text(OUString());
273  }
274 }
275 
277 {
278  // save old ListBoxPos
279  const sal_Int32 nOld = GetTypeSel();
280 
281  // current ListBoxPos
282  SetTypeSel(m_xTypeLB->get_selected_index());
283 
284  if(GetTypeSel() == -1)
285  {
286  if (IsFieldEdit())
287  {
288  // select positions
289  OUString sName;
290  sal_uInt16 nFlag = 0;
291 
292  switch( GetCurField()->GetSubType() )
293  {
294  case REF_BOOKMARK:
295  {
296  // #i83479#
297  SwGetRefField* pRefField = dynamic_cast<SwGetRefField*>(GetCurField());
298  if ( pRefField &&
299  pRefField->IsRefToHeadingCrossRefBookmark() )
300  {
301  sName = sHeadingText;
302  nFlag = REFFLDFLAG_HEADING;
303  }
304  else if ( pRefField &&
305  pRefField->IsRefToNumItemCrossRefBookmark() )
306  {
307  sName = sNumItemText;
308  nFlag = REFFLDFLAG_NUMITEM;
309  }
310  else
311  {
312  sName = sBookmarkText;
313  nFlag = REFFLDFLAG_BOOKMARK;
314  }
315  }
316  break;
317 
318  case REF_FOOTNOTE:
319  sName = sFootnoteText;
320  nFlag = REFFLDFLAG_FOOTNOTE;
321  break;
322 
323  case REF_ENDNOTE:
324  sName = sEndnoteText;
325  nFlag = REFFLDFLAG_ENDNOTE;
326  break;
327 
328  case REF_SETREFATTR:
329  sName = SwResId(STR_GETREFFLD);
330  nFlag = REF_SETREFATTR;
331  break;
332 
333  case REF_SEQUENCEFLD:
334  sName = static_cast<SwGetRefField*>(GetCurField())->GetSetRefName();
335  nFlag = REFFLDFLAG;
336  break;
337  }
338 
339  if (m_xTypeLB->find_text(sName) == -1) // reference to deleted mark
340  {
341  m_xTypeLB->append(OUString::number(nFlag), sName);
342  }
343 
344  m_xTypeLB->select_text(sName);
345  SetTypeSel(m_xTypeLB->get_selected_index());
346  }
347  else
348  {
349  SetTypeSel(0);
350  m_xTypeLB->select(0);
351  }
352  }
353 
354  if (nOld == GetTypeSel())
355  return;
356 
357  sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
358 
359  // fill selection-ListBox
360  UpdateSubType(comphelper::string::strip(m_xFilterED->get_text(), ' '));
361 
362  bool bName = false;
363  nFieldDlgFormatSel = 0;
364 
365  if ( ( !IsFieldEdit() || m_xSelectionLB->n_children() ) &&
366  nOld != -1 )
367  {
368  m_xNameED->set_text(OUString());
369  m_xValueED->set_text(OUString());
370  m_xFilterED->set_text(OUString());
371  }
372 
373  switch (nTypeId)
374  {
375  case TYP_GETREFFLD:
376  if (REFFLDFLAG & m_xTypeLB->get_id(nOld).toUInt32())
377  // the old one stays
378  nFieldDlgFormatSel = m_xFormatLB->get_selected_index();
379  bName = true;
380  break;
381 
382  case TYP_SETREFFLD:
383  bName = true;
384  break;
385 
386  case REFFLDFLAG_BOOKMARK:
387  bName = true;
388  [[fallthrough]];
389  default:
390  if( REFFLDFLAG & nTypeId )
391  {
392  const sal_uInt16 nOldId = nOld != -1 ? m_xTypeLB->get_id(nOld).toUInt32() : 0;
393  if( nOldId & REFFLDFLAG || nOldId == TYP_GETREFFLD )
394  // then the old one stays
395  nFieldDlgFormatSel = m_xFormatLB->get_selected_index();
396  }
397  break;
398  }
399 
400  m_xNameED->set_sensitive(bName);
401  m_xNameFT->set_sensitive(bName);
402 
403  // fill Format-Listbox
404  sal_Int32 nSize = FillFormatLB(nTypeId);
405  bool bFormat = nSize != 0;
406  m_xFormat->set_sensitive(bFormat);
407 
408  SubTypeHdl();
409  ModifyHdl(*m_xNameED);
410  ModifyHdl(*m_xFilterED);
411 }
412 
413 IMPL_LINK_NOARG(SwFieldRefPage, SubTypeTreeListBoxHdl, weld::TreeView&, void)
414 {
415  SubTypeHdl();
416 }
417 
418 IMPL_LINK_NOARG(SwFieldRefPage, SubTypeListBoxHdl, weld::TreeView&, void)
419 {
420  SubTypeHdl();
421 }
422 
424 {
425  sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
426 
427  switch(nTypeId)
428  {
429  case TYP_GETREFFLD:
430  if (!IsFieldEdit() || m_xSelectionLB->get_selected_index() != -1)
431  {
432  m_xNameED->set_text(m_xSelectionLB->get_selected_text());
433  ModifyHdl(*m_xNameED);
434  }
435  break;
436 
437  case TYP_SETREFFLD:
438  {
439  SwWrtShell *pSh = GetWrtShell();
440  if(!pSh)
441  pSh = ::GetActiveWrtShell();
442  if(pSh)
443  {
444  m_xValueED->set_text(pSh->GetSelText());
445  }
446 
447  }
448  break;
449  // #i83479#
450  case REFFLDFLAG_HEADING:
451  case REFFLDFLAG_NUMITEM:
452  {
453  int nEntry = m_xSelectionToolTipLB->get_selected_index();
454  if (nEntry != -1)
455  m_xNameED->set_text(m_xSelectionToolTipLB->get_text(nEntry));
456  }
457  break;
458 
459  default:
460  if (!IsFieldEdit() || m_xSelectionLB->get_selected_index() != -1)
461  m_xNameED->set_text(m_xSelectionLB->get_selected_text());
462  break;
463  }
464 }
465 
466 // renew types in SelectionLB after filtering
467 void SwFieldRefPage::UpdateSubType(const OUString& filterString)
468 {
469  SwWrtShell *pSh = GetWrtShell();
470  if(!pSh)
471  pSh = ::GetActiveWrtShell();
472  SwGetRefField* pRefField = static_cast<SwGetRefField*>(GetCurField());
473  const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
474 
475  OUString sOldSel;
476  // #i83479#
477  if ( m_xSelectionLB->get_visible() )
478  {
479  const sal_Int32 nSelectionSel = m_xSelectionLB->get_selected_index();
480  if (nSelectionSel != -1)
481  sOldSel = m_xSelectionLB->get_text(nSelectionSel);
482  }
483  if (IsFieldEdit() && sOldSel.isEmpty())
484  sOldSel = OUString::number( pRefField->GetSeqNo() + 1 );
485 
486  m_xSelectionLB->freeze();
487  m_xSelectionLB->clear();
488  // #i83479#
489  m_xSelectionToolTipLB->freeze();
490  m_xSelectionToolTipLB->clear();
491  OUString m_sSelectionToolTipLBId;
492  bool bShowSelectionToolTipLB( false );
493 
494  if( REFFLDFLAG & nTypeId )
495  {
496  if (nTypeId == REFFLDFLAG_BOOKMARK) // text marks!
497  {
498  m_xSelectionLB->make_sorted();
499  // get all text marks
500  IDocumentMarkAccess* const pMarkAccess = pSh->getIDocumentMarkAccess();
501  for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
502  ppMark != pMarkAccess->getBookmarksEnd();
503  ++ppMark)
504  {
505  const ::sw::mark::IMark* pBkmk = *ppMark;
507  {
508  bool isSubstring = MatchSubstring(pBkmk->GetName(), filterString);
509  if(isSubstring)
510  {
511  m_xSelectionLB->append_text( pBkmk->GetName() );
512  }
513  }
514  }
515  if (IsFieldEdit())
516  sOldSel = pRefField->GetSetRefName();
517  }
518  else if (nTypeId == REFFLDFLAG_FOOTNOTE)
519  {
520  m_xSelectionLB->make_unsorted();
522  const size_t nCnt = pSh->GetSeqFootnoteList( aArr );
523 
524  for( size_t n = 0; n < nCnt; ++n )
525  {
526  bool isSubstring = MatchSubstring(aArr[ n ].sDlgEntry, filterString);
527  if(isSubstring)
528  {
529  m_xSelectionLB->append_text( aArr[ n ].sDlgEntry );
530  }
531  if (IsFieldEdit() && pRefField->GetSeqNo() == aArr[ n ].nSeqNo)
532  sOldSel = aArr[n].sDlgEntry;
533  }
534  }
535  else if (nTypeId == REFFLDFLAG_ENDNOTE)
536  {
537  m_xSelectionLB->make_unsorted();
539  const size_t nCnt = pSh->GetSeqFootnoteList( aArr, true );
540 
541  for( size_t n = 0; n < nCnt; ++n )
542  {
543  bool isSubstring = MatchSubstring(aArr[ n ].sDlgEntry, filterString);
544  if(isSubstring)
545  {
546  m_xSelectionLB->append_text( aArr[ n ].sDlgEntry );
547  }
548  if (IsFieldEdit() && pRefField->GetSeqNo() == aArr[ n ].nSeqNo)
549  sOldSel = aArr[n].sDlgEntry;
550  }
551  }
552  // #i83479#
553  else if ( nTypeId == REFFLDFLAG_HEADING )
554  {
555  bShowSelectionToolTipLB = true;
556 
559  bool bCertainTextNodeSelected( false );
560  for ( size_t nOutlIdx = 0; nOutlIdx < maOutlineNodes.size(); ++nOutlIdx )
561  {
562  if (!pIDoc->isOutlineInLayout(nOutlIdx, *pSh->GetLayout()))
563  {
564  continue; // skip it
565  }
566  bool isSubstring = MatchSubstring(pIDoc->getOutlineText(nOutlIdx, pSh->GetLayout(), true, true, false), filterString);
567  if(isSubstring)
568  {
569  OUString sId(OUString::number(nOutlIdx));
570  m_xSelectionToolTipLB->append(sId,
571  pIDoc->getOutlineText(nOutlIdx, pSh->GetLayout(), true, true, false));
572  if ( ( IsFieldEdit() &&
573  pRefField->GetReferencedTextNode() == maOutlineNodes[nOutlIdx] ) ||
575  {
576  m_sSelectionToolTipLBId = sId;
577  sOldSel.clear();
578  bCertainTextNodeSelected = true;
579  }
580  else if ( !bCertainTextNodeSelected && mnSavedSelectedPos == nOutlIdx )
581  {
582  m_sSelectionToolTipLBId = sId;
583  sOldSel.clear();
584  }
585  }
586  }
587  }
588  else if ( nTypeId == REFFLDFLAG_NUMITEM )
589  {
590  bShowSelectionToolTipLB = true;
591 
592  const IDocumentListItems* pIDoc( pSh->getIDocumentListItemsAccess() );
593  pIDoc->getNumItems( maNumItems );
594  bool bCertainTextNodeSelected( false );
595  for ( size_t nNumItemIdx = 0; nNumItemIdx < maNumItems.size(); ++nNumItemIdx )
596  {
597  if (!pIDoc->isNumberedInLayout(*maNumItems[nNumItemIdx], *pSh->GetLayout()))
598  {
599  continue; // skip it
600  }
601  bool isSubstring = MatchSubstring(pIDoc->getListItemText(*maNumItems[nNumItemIdx], *pSh->GetLayout()), filterString);
602  if(isSubstring)
603  {
604  OUString sId(OUString::number(nNumItemIdx));
605  m_xSelectionToolTipLB->append(sId,
606  pIDoc->getListItemText(*maNumItems[nNumItemIdx], *pSh->GetLayout()));
607  if ( ( IsFieldEdit() &&
608  pRefField->GetReferencedTextNode() == maNumItems[nNumItemIdx]->GetTextNode() ) ||
609  mpSavedSelectedTextNode == maNumItems[nNumItemIdx]->GetTextNode() )
610  {
611  m_sSelectionToolTipLBId = sId;
612  sOldSel.clear();
613  bCertainTextNodeSelected = true;
614  }
615  else if ( !bCertainTextNodeSelected && mnSavedSelectedPos == nNumItemIdx )
616  {
617  m_sSelectionToolTipLBId = sId;
618  sOldSel.clear();
619  }
620  }
621  }
622  }
623  else
624  {
625  m_xSelectionLB->make_sorted();
626  // get the fields to Seq-FieldType:
627 
628  SwSetExpFieldType* pType = static_cast<SwSetExpFieldType*>(pSh->GetFieldType(
629  nTypeId & ~REFFLDFLAG, SwFieldIds::SetExp ));
630  if( pType )
631  {
633  // old selection should be kept in non-edit mode
634  if(IsFieldEdit())
635  sOldSel.clear();
636 
637  const size_t nCnt = pType->GetSeqFieldList(aArr, pSh->GetLayout());
638  for( size_t n = 0; n < nCnt; ++n )
639  {
640  bool isSubstring = MatchSubstring(aArr[ n ].sDlgEntry, filterString);
641  if(isSubstring)
642  {
643  m_xSelectionLB->append_text( aArr[ n ].sDlgEntry );
644  }
645  if (IsFieldEdit() && sOldSel.isEmpty() &&
646  aArr[ n ].nSeqNo == pRefField->GetSeqNo())
647  sOldSel = aArr[ n ].sDlgEntry;
648  }
649 
650  if (IsFieldEdit() && sOldSel.isEmpty())
651  sOldSel = OUString::number( pRefField->GetSeqNo() + 1);
652  }
653  }
654  }
655  else
656  {
657  std::vector<OUString> aLst;
658  GetFieldMgr().GetSubTypes(nTypeId, aLst);
659  for(const OUString & i : aLst)
660  {
661  bool isSubstring = MatchSubstring( i , filterString );
662  if(isSubstring)
663  {
664  m_xSelectionLB->append_text(i);
665  }
666  }
667 
668  if (IsFieldEdit())
669  sOldSel = pRefField->GetSetRefName();
670  }
671 
672  // #i83479#
673  m_xSelectionLB->thaw();
674  m_xSelectionToolTipLB->thaw();
675  if (!m_sSelectionToolTipLBId.isEmpty())
676  m_xSelectionToolTipLB->select_id(m_sSelectionToolTipLBId);
677  m_xSelectionToolTipLB->set_visible( bShowSelectionToolTipLB );
678  m_xSelectionLB->set_visible( !bShowSelectionToolTipLB );
679  if ( bShowSelectionToolTipLB )
680  {
681  bool bEnable = m_xSelectionToolTipLB->n_children() != 0;
682  m_xSelection->set_sensitive( bEnable );
683 
684  int nEntry = m_xSelectionToolTipLB->get_selected_index();
685  if (nEntry != -1)
686  m_xSelectionToolTipLB->scroll_to_row(nEntry);
687 
688  if (IsFieldEdit() && nEntry == -1)
689  {
690  m_xNameED->set_text(sOldSel);
691  }
692  }
693  else
694  {
695  // enable or disable
696  bool bEnable = m_xSelectionLB->n_children() != 0;
697  m_xSelection->set_sensitive( bEnable );
698 
699  if ( bEnable )
700  {
701  m_xSelectionLB->select_text(sOldSel);
702  if (m_xSelectionLB->get_selected_index() == -1 && !IsFieldEdit())
703  m_xSelectionLB->select(0);
704  }
705 
706  if (IsFieldEdit() && m_xSelectionLB->get_selected_index() == -1) // in case the reference was already deleted...
707  m_xNameED->set_text(sOldSel);
708  }
709 }
710 
711 bool SwFieldRefPage::MatchSubstring( const OUString& rListString, const OUString& rSubstr )
712 {
713  if(rSubstr.isEmpty())
714  return true;
715  OUString aListString = GetAppCharClass().lowercase(rListString);
716  OUString aSubstr = GetAppCharClass().lowercase(rSubstr);
717  return aListString.indexOf(aSubstr) >= 0;
718 }
719 
721 {
733 };
734 
735 static const char* FMT_REF_ARY[] =
736 {
737  FMT_REF_PAGE,
738  FMT_REF_CHAPTER,
739  FMT_REF_TEXT,
740  FMT_REF_UPDOWN,
741  FMT_REF_PAGE_PGDSC,
742  FMT_REF_ONLYNUMBER,
743  FMT_REF_ONLYCAPTION,
744  FMT_REF_ONLYSEQNO,
745  FMT_REF_NUMBER,
746  FMT_REF_NUMBER_NO_CONTEXT,
747  FMT_REF_NUMBER_FULL_CONTEXT
748 };
749 
750 sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
751 {
752  OUString sOldSel;
753 
754  sal_Int32 nFormatSel = m_xFormatLB->get_selected_index();
755  if (nFormatSel != -1)
756  sOldSel = m_xFormatLB->get_text(nFormatSel);
757 
758  // fill Format-Listbox
759  m_xFormatLB->clear();
760 
761  // reference has less that the annotation
762  sal_uInt16 nSize( 0 );
763  bool bAddCrossRefFormats( false );
764  switch (nTypeId)
765  {
766  // #i83479#
767  case REFFLDFLAG_HEADING:
768  case REFFLDFLAG_NUMITEM:
769  bAddCrossRefFormats = true;
770  [[fallthrough]];
771 
772  case TYP_GETREFFLD:
773  case REFFLDFLAG_BOOKMARK:
774  case REFFLDFLAG_FOOTNOTE:
775  case REFFLDFLAG_ENDNOTE:
776  nSize = FMT_REF_PAGE_PGDSC_IDX + 1;
777  break;
778 
779  default:
780  // #i83479#
781 
782  if ( REFFLDFLAG & nTypeId )
783  {
784  nSize = FMT_REF_ONLYSEQNO_IDX + 1;
785  }
786  else
787  {
788  nSize = GetFieldMgr().GetFormatCount( nTypeId, IsFieldDlgHtmlMode() );
789  }
790  break;
791  }
792 
793  if (REFFLDFLAG & nTypeId)
794  nTypeId = TYP_GETREFFLD;
795 
796  for (sal_uInt16 i = 0; i < nSize; i++)
797  {
798  OUString sId(OUString::number(GetFieldMgr().GetFormatId( nTypeId, i )));
799  m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i));
800  }
801  // #i83479#
802 
803  sal_uInt16 nExtraSize( 0 );
804  if ( bAddCrossRefFormats )
805  {
806  sal_uInt16 nFormat = FMT_REF_NUMBER_IDX;
807  OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat)));
808  m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
810  sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
811  m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
813  sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
814  m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
815  nExtraSize = 3;
816  }
817 
818  // extra list items optionally, depending from reference-language
819  SvtSysLocaleOptions aSysLocaleOptions;
820  static const LanguageTag& rLang = aSysLocaleOptions.GetRealLanguageTag();
821 
822  if (rLang.getLanguage() == "hu")
823  {
824  for (sal_uInt16 i = 0; i < nSize; i++)
825  {
826  OUString sId(OUString::number(GetFieldMgr().GetFormatId( nTypeId, i + SAL_N_ELEMENTS(FMT_REF_ARY))));
827  m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, i ));
828  }
829  nExtraSize += nSize;
830 
831  if ( bAddCrossRefFormats )
832  {
833  sal_uInt16 nFormat = FMT_REF_NUMBER_IDX + SAL_N_ELEMENTS(FMT_REF_ARY);
834  OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat)));
835  m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
836  nFormat = FMT_REF_NUMBER_NO_CONTEXT_IDX + SAL_N_ELEMENTS(FMT_REF_ARY);
837  sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
838  m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
839  nFormat = FMT_REF_NUMBER_FULL_CONTEXT_IDX + SAL_N_ELEMENTS(FMT_REF_ARY);
840  sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
841  m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
842  nExtraSize += 3;
843  }
844  // uppercase article
845  for (sal_uInt16 i = 0; i < nSize; i++)
846  {
847  OUString sId(OUString::number(GetFieldMgr().GetFormatId( nTypeId, i + 2 * SAL_N_ELEMENTS(FMT_REF_ARY))));
848  m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, i ));
849  }
850  nExtraSize += nSize;
851  if ( bAddCrossRefFormats )
852  {
853  sal_uInt16 nFormat = FMT_REF_NUMBER_IDX + 2 * SAL_N_ELEMENTS(FMT_REF_ARY);
854  OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat)));
855  m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
856  nFormat = FMT_REF_NUMBER_NO_CONTEXT_IDX + 2 * SAL_N_ELEMENTS(FMT_REF_ARY);
857  sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
858  m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
859  nFormat = FMT_REF_NUMBER_FULL_CONTEXT_IDX + 2 * SAL_N_ELEMENTS(FMT_REF_ARY);
860  sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
861  m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
862  nExtraSize += 3;
863  }
864  }
865 
866  nSize += nExtraSize;
867 
868  // select a certain entry
869  if (nSize)
870  {
871  if (!IsFieldEdit())
872  m_xFormatLB->select_text(sOldSel);
873  else
874  m_xFormatLB->select_text(SwResId(FMT_REF_ARY[GetCurField()->GetFormat() % SAL_N_ELEMENTS(FMT_REF_ARY)]));
875 
876  if (m_xFormatLB->get_selected_index() == -1)
877  {
878  if (nFieldDlgFormatSel < m_xFormatLB->n_children())
880  else
881  m_xFormatLB->select(0);
882  }
883  }
884 
885  return nSize;
886 }
887 
888 // Modify
890 {
891  OUString aName(m_xNameED->get_text());
892  const bool bEmptyName = aName.isEmpty();
893 
894  bool bEnable = true;
895  sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
896 
897  if ((nTypeId == TYP_SETREFFLD && !GetFieldMgr().CanInsertRefMark(aName)) ||
898  (bEmptyName && (nTypeId == TYP_GETREFFLD || nTypeId == TYP_SETREFFLD ||
899  nTypeId == REFFLDFLAG_BOOKMARK)))
900  bEnable = false;
901 
902  EnableInsert(bEnable);
903 
904  m_xSelectionLB->select_text(aName);
905 }
906 
908 {
909  bool bModified = false;
910  sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
911 
912  sal_uInt16 nSubType = 0;
913  const sal_Int32 nEntryPos = m_xFormatLB->get_selected_index();
914  const sal_uLong nFormat = (nEntryPos == -1)
915  ? 0 : m_xFormatLB->get_id(nEntryPos).toUInt32();
916 
917  OUString aVal(m_xValueED->get_text());
918  OUString aName(m_xNameED->get_text());
919 
920  switch(nTypeId)
921  {
922  case TYP_GETREFFLD:
923  nSubType = REF_SETREFATTR;
924  break;
925 
926  case TYP_SETREFFLD:
927  {
929 
930  if(!pType) // Only insert when the name doesn't exist yet
931  {
932  m_xSelectionLB->append_text(aName);
933  m_xSelection->set_sensitive(true);
934  }
935  break;
936  }
937  }
938 
939  SwGetRefField* pRefField = static_cast<SwGetRefField*>(GetCurField());
940 
941  if (REFFLDFLAG & nTypeId)
942  {
943  SwWrtShell *pSh = GetWrtShell();
944  if(!pSh)
945  {
946  pSh = ::GetActiveWrtShell();
947  }
948  if (nTypeId == REFFLDFLAG_BOOKMARK) // text marks!
949  {
950  aName = m_xNameED->get_text();
951  nTypeId = TYP_GETREFFLD;
952  nSubType = REF_BOOKMARK;
953  }
954  else if (REFFLDFLAG_FOOTNOTE == nTypeId) // footnotes
955  {
957  SeqFieldLstElem aElem( m_xSelectionLB->get_selected_text(), 0 );
958 
959  size_t nPos = 0;
960 
961  nTypeId = TYP_GETREFFLD;
962  nSubType = REF_FOOTNOTE;
963  aName.clear();
964 
965  if (pSh->GetSeqFootnoteList(aArr) && aArr.SeekEntry(aElem, &nPos))
966  {
967  aVal = OUString::number( aArr[nPos].nSeqNo );
968 
969  if (IsFieldEdit() && aArr[nPos].nSeqNo == pRefField->GetSeqNo())
970  bModified = true; // can happen with fields of which the references were deleted
971  }
972  else if (IsFieldEdit())
973  aVal = OUString::number( pRefField->GetSeqNo() );
974  }
975  else if (REFFLDFLAG_ENDNOTE == nTypeId) // endnotes
976  {
978  SeqFieldLstElem aElem( m_xSelectionLB->get_selected_text(), 0 );
979 
980  size_t nPos = 0;
981 
982  nTypeId = TYP_GETREFFLD;
983  nSubType = REF_ENDNOTE;
984  aName.clear();
985 
986  if (pSh->GetSeqFootnoteList(aArr, true) && aArr.SeekEntry(aElem, &nPos))
987  {
988  aVal = OUString::number( aArr[nPos].nSeqNo );
989 
990  if (IsFieldEdit() && aArr[nPos].nSeqNo == pRefField->GetSeqNo())
991  bModified = true; // can happen with fields of which the reference was deleted
992  }
993  else if (IsFieldEdit())
994  aVal = OUString::number( pRefField->GetSeqNo() );
995  }
996  // #i83479#
997  else if ( nTypeId == REFFLDFLAG_HEADING )
998  {
999  int nEntry = m_xSelectionToolTipLB->get_selected_index();
1000  OSL_ENSURE( nEntry != -1,
1001  "<SwFieldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
1002  if (nEntry != -1)
1003  {
1004  const size_t nOutlIdx(m_xSelectionToolTipLB->get_id(nEntry).toUInt32());
1006  if ( nOutlIdx < maOutlineNodes.size() )
1007  {
1008  ::sw::mark::IMark const * const pMark = pSh->getIDocumentMarkAccess()->getMarkForTextNode(
1009  *(maOutlineNodes[nOutlIdx]),
1011  aName = pMark->GetName();
1012  nTypeId = TYP_GETREFFLD;
1013  nSubType = REF_BOOKMARK;
1014  }
1015  }
1016  }
1017  else if ( nTypeId == REFFLDFLAG_NUMITEM )
1018  {
1019  int nEntry = m_xSelectionToolTipLB->get_selected_index();
1020  OSL_ENSURE( nEntry != -1,
1021  "<SwFieldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
1022  if (nEntry != -1)
1023  {
1024  const size_t nNumItemIdx(m_xSelectionToolTipLB->get_id(nEntry).toUInt32());
1026  if ( nNumItemIdx < maNumItems.size() )
1027  {
1028  ::sw::mark::IMark const * const pMark = pSh->getIDocumentMarkAccess()->getMarkForTextNode(
1029  *(maNumItems[nNumItemIdx]->GetTextNode()),
1031  aName = pMark->GetName();
1032  nTypeId = TYP_GETREFFLD;
1033  nSubType = REF_BOOKMARK;
1034  }
1035  }
1036  }
1037  else // SequenceFields
1038  {
1039  // get fields for Seq-FieldType:
1040  SwSetExpFieldType* pType = static_cast<SwSetExpFieldType*>(pSh->GetFieldType(
1041  nTypeId & ~REFFLDFLAG, SwFieldIds::SetExp ));
1042  if( pType )
1043  {
1045  SeqFieldLstElem aElem( m_xSelectionLB->get_selected_text(), 0 );
1046 
1047  size_t nPos = 0;
1048 
1049  nTypeId = TYP_GETREFFLD;
1050  nSubType = REF_SEQUENCEFLD;
1051  aName = pType->GetName();
1052 
1053  if (pType->GetSeqFieldList(aArr, pSh->GetLayout())
1054  && aArr.SeekEntry(aElem, &nPos))
1055  {
1056  aVal = OUString::number( aArr[nPos].nSeqNo );
1057 
1058  if (IsFieldEdit() && aArr[nPos].nSeqNo == pRefField->GetSeqNo())
1059  bModified = true; // can happen with fields of which the reference was deleted
1060  }
1061  else if (IsFieldEdit())
1062  aVal = OUString::number( pRefField->GetSeqNo() );
1063  }
1064  }
1065  }
1066 
1067  if (IsFieldEdit() && nTypeId == TYP_GETREFFLD)
1068  {
1069  aVal = OUString::number(nSubType) + "|" + aVal;
1070  }
1071 
1072  if (!IsFieldEdit() || bModified ||
1073  m_xNameED->get_value_changed_from_saved() ||
1074  m_xValueED->get_value_changed_from_saved() ||
1075  m_xTypeLB->get_value_changed_from_saved() ||
1076  m_xSelectionLB->get_value_changed_from_saved() ||
1077  m_xFormatLB->get_value_changed_from_saved())
1078  {
1079  InsertField( nTypeId, nSubType, aName, aVal, nFormat );
1080  }
1081 
1082  ModifyHdl(*m_xNameED); // enable/disable insert if applicable
1083 
1084  return false;
1085 }
1086 
1088  const SfxItemSet *const pAttrSet)
1089 {
1090  return VclPtr<SwFieldRefPage>::Create( pParent, pAttrSet );
1091 }
1092 
1094 {
1095  return GRP_REF;
1096 }
1097 
1099 {
1100  const sal_Int32 nEntryPos = m_xTypeLB->get_selected_index();
1101  const sal_uInt16 nTypeSel = ( -1 == nEntryPos )
1102  ? USHRT_MAX
1103  : m_xTypeLB->get_id(nEntryPos).toUInt32();
1104  const sal_Int32 nFormatEntryPos = m_xFormatLB->get_selected_index();
1105  const sal_uInt32 nFormatSel = -1 == nFormatEntryPos ? USHRT_MAX : nFormatEntryPos;
1107  OUString::number( nTypeSel ) + ";" +
1108  OUString::number( nFormatSel ));
1109 }
1110 
1111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
Definition: edfld.cxx:68
SwFieldType * GetFieldType(SwFieldIds nResId, size_t nField=0) const
Definition: fldmgr.cxx:418
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:233
virtual void getNumItems(IDocumentListItems::tSortedNodeNumList &orNodeNumList) const =0
get vector of all list items, which are numbered
sal_uInt16 const nStart
Definition: fldmgr.hxx:63
IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl_Impl, weld::Entry &, void)
Definition: fldref.cxx:116
IDocumentListItems::tSortedNodeNumList maNumItems
Definition: fldref.hxx:39
virtual const OUString & GetName() const =0
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: fldref.cxx:1087
OUString sNumItemText
Definition: fldref.hxx:36
void RestorePos(weld::TreeView &rLst1)
Definition: fldpage.cxx:293
virtual sal_uInt16 GetGroup() override
Definition: fldref.cxx:1093
std::unique_ptr< weld::Entry > m_xValueED
Definition: fldref.hxx:56
void SetUserData(const OUString &rString)
#define REFFLDFLAG_ENDNOTE
Definition: fldref.cxx:44
#define USER_DATA_VERSION
Definition: fldref.cxx:52
const IDocumentOutlineNodes * getIDocumentOutlineNodesAccess() const
Definition: viewsh.cxx:2614
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
sal_uIntPtr sal_uLong
Provides numbered items of a document.
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:483
IDocumentOutlineNodes::tSortedOutlineNodeList maOutlineNodes
Definition: fldref.hxx:38
SwWrtShell * GetActiveWrtShell()
Definition: swmodul1.cxx:115
Provides access to the marks of a document.
void SubTypeHdl()
Definition: fldref.cxx:423
void SaveSelectedTextNode()
Definition: fldref.cxx:122
std::unique_ptr< weld::Entry > m_xFilterED
Definition: fldref.hxx:57
bool HasWriterListeners() const
Definition: calbck.hxx:211
#define REFFLDFLAG
Definition: fldref.cxx:41
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
virtual ~SwFieldRefPage() override
Definition: fldref.cxx:111
static sal_uInt16 GetTypeId(sal_uInt16 nPos)
Definition: fldmgr.cxx:528
static sal_uInt16 nFieldDlgFormatSel
Definition: fldref.cxx:49
SwFieldMgr & GetFieldMgr()
Definition: fldpage.hxx:83
std::unique_ptr< weld::Widget > m_xSelection
Definition: fldref.hxx:48
OUString getLanguage() const
virtual void getOutlineNodes(IDocumentOutlineNodes::tSortedOutlineNodeList &orOutlineNodeList) const =0
bool SeekEntry(const SeqFieldLstElem &rNew, size_t *pPos) const
Definition: expfld.cxx:755
const SwTextNode * mpSavedSelectedTextNode
Definition: fldref.hxx:43
sal_uInt16 GetFormatCount(sal_uInt16 nTypeId, bool bHtmlMode) const
Definition: fldmgr.cxx:677
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: fldref.cxx:907
void SetSelectionSel(sal_Int32 nSet)
Definition: fldpage.hxx:48
const OUString & GetUserData() const
#define REFFLDFLAG_NUMITEM
Definition: fldref.cxx:47
bool IsFieldDlgHtmlMode() const
Definition: fldpage.hxx:49
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2591
OString strip(const OString &rIn, sal_Char c)
#define SAL_N_ELEMENTS(arr)
std::unique_ptr< weld::TreeView > m_xSelectionToolTipLB
Definition: fldref.hxx:51
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
void GetSubTypes(sal_uInt16 nId, std::vector< OUString > &rToFill)
Definition: fldmgr.cxx:574
bool IsRefToNumItemCrossRefBookmark() const
Definition: reffld.cxx:389
#define REFFLDFLAG_BOOKMARK
Definition: fldref.cxx:42
void SavePos(const weld::TreeView &rLst1)
Definition: fldpage.cxx:283
static bool MatchSubstring(const OUString &list_string, const OUString &substr)
Definition: fldref.cxx:711
OUString sName
int i
void Init()
Definition: fldpage.cxx:66
size_t GetFieldTypeCount(SwFieldIds nResId=SwFieldIds::Unknown) const
count field types with a ResId, if SwFieldIds::Unknown count all
Definition: edfld.cxx:47
bool IsRefresh() const
Definition: fldpage.hxx:50
bool IsUsed(const SwModify &) const
Query if the paragraph-/character-/frame-/page-style is used.
Definition: edfmt.cxx:141
sal_Int32 GetTypeSel() const
Definition: fldpage.hxx:45
virtual void Reset(const SfxItemSet *rSet) override
Definition: fldref.cxx:153
size_t GetSeqFootnoteList(SwSeqFieldList &rList, bool bEndNotes=false)
Give a List of all footnotes and their beginning texts.
Definition: edattr.cxx:459
SwField * GetCurField()
Definition: fldpage.hxx:51
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
void UpdateSubType(const OUString &filterString)
Definition: fldref.cxx:467
OUString sFootnoteText
Definition: fldref.hxx:32
#define FIELD_COLUMN_WIDTH
Definition: fldpage.hxx:25
void InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUString &rPar1, const OUString &rPar2, sal_uInt32 nFormatId, sal_Unicode cDelim= ' ', bool bIsAutomaticLanguage=true)
Definition: fldpage.cxx:118
sal_uInt16 const nEnd
Definition: fldmgr.hxx:64
virtual OUString GetName() const override
Only in derived classes.
Definition: expfld.cxx:530
FMT_REF_IDX
Definition: fldref.cxx:720
OUString sBookmarkText
Definition: fldref.hxx:31
const LanguageTag & GetRealLanguageTag() const
OUString sHeadingText
Definition: fldref.hxx:35
SwWrtShell * GetWrtShell()
Definition: fldpage.hxx:52
const SwGetSetExpType GSE_SEQ
Sequence.
Definition: fldbas.hxx:197
sal_uInt16 GetSeqNo() const
Get/set SequenceNo (of interest only for REF_SEQUENCEFLD).
Definition: reffld.hxx:132
virtual ::sw::mark::IMark * getMarkForTextNode(const SwTextNode &rTextNode, MarkType eMark)=0
Returns a mark in the document for a paragraph.
bool IsRefToHeadingCrossRefBookmark() const
Definition: reffld.cxx:383
const IDocumentListItems * getIDocumentListItemsAccess() const
Definition: viewsh.cxx:2609
bool HasFootnotes(bool bEndNotes=false) const
Definition: edattr.cxx:446
std::unique_ptr< weld::TreeView > m_xFormatLB
Definition: fldref.hxx:53
Provides outline nodes of a document.
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2507
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
static VclPtr< reference_type > Create(Arg &&...arg)
SwFieldRefPage(TabPageParent pParent, const SfxItemSet *pSet)
Definition: fldref.cxx:54
virtual void FillUserData() override
Definition: fldref.cxx:1098
const OUString & GetSetRefName() const
Definition: reffld.hxx:107
const SvxPageUsage aArr[]
std::unique_ptr< weld::TreeView > m_xTypeLB
Definition: fldref.hxx:47
static const char * FMT_REF_ARY[]
Definition: fldref.cxx:735
OString const aName
static OUString GetTypeStr(sal_uInt16 nPos)
Definition: fldmgr.cxx:534
bool IsFieldEdit() const
Definition: fldpage.hxx:62
#define REFFLDFLAG_HEADING
Definition: fldref.cxx:46
sal_uInt16 GetType() const
Definition: expfld.hxx:194
static const SwFieldGroupRgn & GetGroupRange(bool bHtmlMode, sal_uInt16 nGrpId)
Definition: fldmgr.cxx:472
sal_Int32 FillFormatLB(sal_uInt16 nTypeId)
Definition: fldref.cxx:750
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2071
sal_Int32 nPos
CharClass & GetAppCharClass()
Definition: init.cxx:745
OUString sEndnoteText
Definition: fldref.hxx:33
size_t mnSavedSelectedPos
Definition: fldref.hxx:45
#define REFFLDFLAG_FOOTNOTE
Definition: fldref.cxx:43
std::unique_ptr< weld::TreeView > m_xSelectionLB
Definition: fldref.hxx:49
const SwTextNode * GetReferencedTextNode() const
Definition: reffld.cxx:395
void SetTypeSel(sal_Int32 nSet)
Definition: fldpage.hxx:46
size_t GetSeqFieldList(SwSeqFieldList &rList, SwRootFrame const *pLayout)
Definition: expfld.cxx:621
std::unique_ptr< weld::Entry > m_xNameED
Definition: fldref.hxx:55
OUString sId
#define USER_DATA_VERSION_1
Definition: fldref.cxx:51