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