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