1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <swtypes.hxx>
23 #include <swmodule.hxx>
30 #include <strings.hrc>
31 #include <SwNodeNum.hxx>
32 #include <IDocumentMarkAccess.hxx>
33 #include <unotools/syslocaleoptions.hxx>
34 #include <unotools/charclass.hxx>
35 #include <osl/diagnose.h>
37 #include <comphelper/string.hxx>
38 #include <editeng/frmdiritem.hxx>
39 #include <o3tl/safeint.hxx>
40 #include <o3tl/string_view.hxx>
41 #include <vcl/settings.hxx>
44 static sal_uInt16 nFieldDlgFormatSel
= 0;
46 #define USER_DATA_VERSION_1 "1"
47 #define USER_DATA_VERSION USER_DATA_VERSION_1
54 FMT_REF_CHAPTER_IDX
= 1,
56 FMT_REF_UPDOWN_IDX
= 3,
57 FMT_REF_PAGE_PGDSC_IDX
= 4,
58 FMT_REF_ONLYNUMBER_IDX
= 5,
59 FMT_REF_ONLYCAPTION_IDX
= 6,
60 FMT_REF_ONLYSEQNO_IDX
= 7,
61 FMT_REF_NUMBER_IDX
= 8,
62 FMT_REF_NUMBER_NO_CONTEXT_IDX
= 9,
63 FMT_REF_NUMBER_FULL_CONTEXT_IDX
= 10
68 SwFieldRefPage::SwFieldRefPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*const pCoreSet
)
69 : SwFieldPage(pPage
, pController
, u
"modules/swriter/ui/fldrefpage.ui"_ustr
, u
"FieldRefPage"_ustr
, pCoreSet
)
70 , mpSavedSelectedTextNode(nullptr)
71 , mnSavedSelectedPos(0)
72 , m_xTypeLB(m_xBuilder
->weld_tree_view(u
"type"_ustr
))
73 , m_xSelection(m_xBuilder
->weld_widget(u
"selectframe"_ustr
))
74 , m_xSelectionLB(m_xBuilder
->weld_tree_view(u
"select"_ustr
))
75 , m_xSelectionToolTipLB(m_xBuilder
->weld_tree_view(u
"selecttip"_ustr
))
76 , m_xFormat(m_xBuilder
->weld_widget(u
"formatframe"_ustr
))
77 , m_xFormatLB(m_xBuilder
->weld_tree_view(u
"format"_ustr
))
78 , m_xNameFT(m_xBuilder
->weld_label(u
"nameft"_ustr
))
79 , m_xNameED(m_xBuilder
->weld_entry(u
"name"_ustr
))
80 , m_xValueED(m_xBuilder
->weld_entry(u
"value"_ustr
))
81 , m_xFilterED(m_xBuilder
->weld_entry(u
"filter"_ustr
))
82 , m_xStylerefFlags(m_xBuilder
->weld_widget(u
"stylerefflagsframe"_ustr
))
83 , m_xStylerefFromBottomCB(m_xBuilder
->weld_check_button(u
"stylereffrombottomcheckbox"_ustr
))
84 , m_xStylerefHideNonNumericalCB(m_xBuilder
->weld_check_button(u
"stylerefhidenonnumericalcheckbox"_ustr
))
86 m_xSelectionLB
->make_sorted();
88 for (auto const& aID
: FLD_REF_PAGE_TYPES
)
90 m_xTypeLB
->append_text(SwResId(aID
));
91 m_xFormatLB
->append_text(SwResId(aID
));
94 m_sBookmarkText
= m_xTypeLB
->get_text(0);
95 m_sFootnoteText
= m_xTypeLB
->get_text(1);
96 m_sEndnoteText
= m_xTypeLB
->get_text(2);
98 m_sHeadingText
= m_xTypeLB
->get_text(3);
99 m_sNumItemText
= m_xTypeLB
->get_text(4);
100 m_sStyleText
= m_xTypeLB
->get_text(5);
102 auto nHeight
= m_xTypeLB
->get_height_rows(8);
103 auto nWidth
= m_xTypeLB
->get_approximate_digit_width() * FIELD_COLUMN_WIDTH
;
104 m_xTypeLB
->set_size_request(nWidth
* 1.33, nHeight
);
105 m_xFormatLB
->set_size_request(nWidth
* 1.33, nHeight
);
106 m_xSelection
->set_size_request(nWidth
* 2, nHeight
);
107 nHeight
= m_xTypeLB
->get_height_rows(8);
108 m_xSelectionToolTipLB
->set_size_request(nHeight
, nWidth
*2);
112 m_xNameED
->connect_changed(LINK(this, SwFieldRefPage
, ModifyHdl
));
113 m_xFilterED
->connect_changed( LINK( this, SwFieldRefPage
, ModifyHdl_Impl
) );
115 m_xTypeLB
->connect_row_activated(LINK(this, SwFieldRefPage
, TreeViewInsertHdl
));
116 m_xTypeLB
->connect_selection_changed(LINK(this, SwFieldRefPage
, TypeHdl
));
117 m_xSelectionLB
->connect_selection_changed(LINK(this, SwFieldRefPage
, SubTypeListBoxHdl
));
118 m_xSelectionLB
->connect_row_activated(LINK(this, SwFieldRefPage
, TreeViewInsertHdl
));
119 m_xFormatLB
->connect_row_activated(LINK(this, SwFieldRefPage
, TreeViewInsertHdl
));
120 m_xFormatLB
->connect_selection_changed(LINK(this, SwFieldRefPage
, FormatHdl
));
123 m_xSelectionToolTipLB
->connect_selection_changed(
124 LINK(this, SwFieldRefPage
, SubTypeTreeListBoxHdl
));
125 m_xSelectionToolTipLB
->connect_row_activated( LINK(this, SwFieldRefPage
, TreeViewInsertHdl
) );
126 m_xFilterED
->grab_focus();
129 m_xTypeLB
->set_buildable_name(m_xTypeLB
->get_buildable_name() + "-ref");
130 m_xNameED
->set_buildable_name(m_xNameED
->get_buildable_name() + "-ref");
131 m_xValueED
->set_buildable_name(m_xValueED
->get_buildable_name() + "-ref");
132 m_xSelectionLB
->set_buildable_name(m_xSelectionLB
->get_buildable_name() + "-ref");
133 m_xFormatLB
->set_buildable_name(m_xFormatLB
->get_buildable_name() + "-ref");
136 SwFieldRefPage::~SwFieldRefPage()
140 IMPL_LINK_NOARG(SwFieldRefPage
, ModifyHdl_Impl
, weld::Entry
&, void)
142 UpdateSubType(comphelper::string::strip(m_xFilterED
->get_text(), ' '));
143 // tdf#135938 - refresh cross-reference name after filter selection has changed
148 void SwFieldRefPage::SaveSelectedTextNode()
150 mpSavedSelectedTextNode
= nullptr;
151 mnSavedSelectedPos
= 0;
152 if ( !m_xSelectionToolTipLB
->get_visible() )
155 int nEntry
= m_xSelectionToolTipLB
->get_selected_index();
159 const sal_uInt16 nTypeId
= m_xTypeLB
->get_id(GetTypeSel()).toUInt32();
161 if ( nTypeId
== REFFLDFLAG_HEADING
)
163 mnSavedSelectedPos
= m_xSelectionToolTipLB
->get_id(nEntry
).toUInt32();
164 if ( mnSavedSelectedPos
< maOutlineNodes
.size() )
166 mpSavedSelectedTextNode
= maOutlineNodes
[mnSavedSelectedPos
];
169 else if ( nTypeId
== REFFLDFLAG_NUMITEM
)
171 mnSavedSelectedPos
= m_xSelectionToolTipLB
->get_id(nEntry
).toUInt32();
172 if ( mnSavedSelectedPos
< maNumItems
.size() )
174 mpSavedSelectedTextNode
= maNumItems
[mnSavedSelectedPos
]->GetTextNode();
179 void SwFieldRefPage::Reset(const SfxItemSet
* )
185 SaveSelectedTextNode();
189 Init(); // general initialisation
191 // initialise TypeListBox
197 // set/insert reference
198 const SwFieldGroupRgn
& rRg
= SwFieldMgr::GetGroupRange(IsFieldDlgHtmlMode(), GetGroup());
200 for (short i
= rRg
.nStart
; i
< rRg
.nEnd
; ++i
)
202 const SwFieldTypesEnum nTypeId
= SwFieldMgr::GetTypeId(i
);
204 if (!IsFieldEdit() || nTypeId
!= SwFieldTypesEnum::SetRef
)
206 m_xTypeLB
->append(OUString::number(static_cast<sal_uInt16
>(nTypeId
)), SwFieldMgr::GetTypeStr(i
));
211 // entries for headings and numbered items
212 m_xTypeLB
->append(OUString::number(REFFLDFLAG_HEADING
), m_sHeadingText
);
213 m_xTypeLB
->append(OUString::number(REFFLDFLAG_NUMITEM
), m_sNumItemText
);
215 // fill up with the sequence types
216 SwWrtShell
*pSh
= GetWrtShell();
218 pSh
= ::GetActiveWrtShell();
222 // tdf#148432 in LTR UI override the navigator treeview direction based on
223 // the first page directionality
224 if (!AllSettings::GetLayoutRTL())
226 const SwPageDesc
& rDesc
= pSh
->GetPageDesc(0);
227 const SvxFrameDirectionItem
& rFrameDir
= rDesc
.GetMaster().GetFrameDir();
228 m_xSelectionToolTipLB
->set_direction(rFrameDir
.GetValue() == SvxFrameDirection::Horizontal_RL_TB
);
231 const size_t nFieldTypeCnt
= pSh
->GetFieldTypeCount(SwFieldIds::SetExp
);
233 OSL_ENSURE( nFieldTypeCnt
< o3tl::make_unsigned(REFFLDFLAG
), "<SwFieldRefPage::Reset> - Item index will overlap flags!" );
235 for (size_t n
= 0; n
< nFieldTypeCnt
; ++n
)
237 SwSetExpFieldType
* pType
= static_cast<SwSetExpFieldType
*>(pSh
->GetFieldType(n
, SwFieldIds::SetExp
));
239 if ((nsSwGetSetExpType::GSE_SEQ
& pType
->GetType()) && pType
->HasWriterListeners() && pSh
->IsUsed(*pType
))
241 m_xTypeLB
->append(OUString::number(REFFLDFLAG
| n
), pType
->GetName());
245 // text marks - now always (because of globaldocuments)
246 m_xTypeLB
->append(OUString::number(REFFLDFLAG_BOOKMARK
), m_sBookmarkText
);
249 if( pSh
->HasFootnotes() )
251 m_xTypeLB
->append(OUString::number(REFFLDFLAG_FOOTNOTE
), m_sFootnoteText
);
255 if ( pSh
->HasFootnotes(true) )
257 m_xTypeLB
->append(OUString::number(REFFLDFLAG_ENDNOTE
), m_sEndnoteText
);
261 m_xTypeLB
->append(OUString::number(REFFLDFLAG_STYLE
), m_sStyleText
);
267 RestorePos(*m_xTypeLB
);
269 nFieldDlgFormatSel
= 0;
271 sal_uInt16 nFormatBoxPosition
= USHRT_MAX
;
275 const OUString sUserData
= GetUserData();
276 if(!IsRefresh() && o3tl::equalsIgnoreAsciiCase(o3tl::getToken(sUserData
, 0, ';', nIdx
),
277 u
"" USER_DATA_VERSION_1
))
279 const sal_uInt16 nVal
= static_cast< sal_uInt16
>(o3tl::toInt32(o3tl::getToken(sUserData
, 0, ';', nIdx
)));
280 if(nVal
!= USHRT_MAX
)
282 for(sal_Int32 i
= 0, nEntryCount
= m_xTypeLB
->n_children(); i
< nEntryCount
; ++i
)
284 if (nVal
== m_xTypeLB
->get_id(i
).toUInt32())
286 m_xTypeLB
->select(i
);
290 if (nIdx
>=0 && nIdx
<sUserData
.getLength())
292 nFormatBoxPosition
= static_cast< sal_uInt16
>(o3tl::toInt32(o3tl::getToken(sUserData
, 0, ';', nIdx
)));
298 if (!IsFieldEdit() && nFormatBoxPosition
< m_xFormatLB
->n_children())
300 m_xFormatLB
->select(nFormatBoxPosition
);
304 m_xTypeLB
->save_value();
305 m_xSelectionLB
->save_value();
306 m_xFormatLB
->save_value();
307 m_xNameED
->save_value();
308 m_xValueED
->save_value();
309 m_xFilterED
->set_text(OUString());
310 m_xStylerefFromBottomCB
->save_state();
311 m_xStylerefHideNonNumericalCB
->save_state();
315 IMPL_LINK_NOARG(SwFieldRefPage
, TypeHdl
, weld::TreeView
&, void)
317 // save old ListBoxPos
318 const sal_Int32 nOld
= GetTypeSel();
320 // current ListBoxPos
321 SetTypeSel(m_xTypeLB
->get_selected_index());
323 if(GetTypeSel() == -1)
329 sal_uInt16 nFlag
= 0;
331 switch( GetCurField()->GetSubType() )
336 SwGetRefField
* pRefField
= dynamic_cast<SwGetRefField
*>(GetCurField());
338 pRefField
->IsRefToHeadingCrossRefBookmark() )
340 sName
= m_sHeadingText
;
341 nFlag
= REFFLDFLAG_HEADING
;
343 else if ( pRefField
&&
344 pRefField
->IsRefToNumItemCrossRefBookmark() )
346 sName
= m_sNumItemText
;
347 nFlag
= REFFLDFLAG_NUMITEM
;
351 sName
= m_sBookmarkText
;
352 nFlag
= REFFLDFLAG_BOOKMARK
;
358 sName
= m_sFootnoteText
;
359 nFlag
= REFFLDFLAG_FOOTNOTE
;
363 sName
= m_sEndnoteText
;
364 nFlag
= REFFLDFLAG_ENDNOTE
;
368 sName
= SwResId(STR_GETREFFLD
);
369 nFlag
= REF_SETREFATTR
;
372 case REF_SEQUENCEFLD
:
374 SwGetRefField
const*const pRefField(dynamic_cast<SwGetRefField
*>(GetCurField()));
377 sName
= pRefField
->GetSetRefName();
385 SwGetRefField
const*const pRefField(dynamic_cast<SwGetRefField
*>(GetCurField()));
388 sName
= pRefField
->GetPar1();
390 nFlag
= REFFLDFLAG_STYLE
;
395 if (m_xTypeLB
->find_text(sName
) == -1) // reference to deleted mark
397 m_xTypeLB
->append(OUString::number(nFlag
), sName
);
400 m_xTypeLB
->select_text(sName
);
401 SetTypeSel(m_xTypeLB
->get_selected_index());
406 m_xTypeLB
->select(0);
410 if (nOld
== GetTypeSel())
413 sal_uInt16 nTypeId
= m_xTypeLB
->get_id(GetTypeSel()).toUInt32();
416 nFieldDlgFormatSel
= 0;
418 if ( ( !IsFieldEdit() || m_xSelectionLB
->n_children() ) &&
421 m_xNameED
->set_text(OUString());
422 m_xValueED
->set_text(OUString());
423 m_xFilterED
->set_text(OUString());
426 // fill selection-ListBox
427 UpdateSubType(comphelper::string::strip(m_xFilterED
->get_text(), ' '));
431 case static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
):
432 if (nOld
!= -1 && REFFLDFLAG
& m_xTypeLB
->get_id(nOld
).toUInt32())
434 nFieldDlgFormatSel
= m_xFormatLB
->get_selected_index();
438 case static_cast<sal_uInt16
>(SwFieldTypesEnum::SetRef
):
442 case REFFLDFLAG_BOOKMARK
:
446 if( REFFLDFLAG
& nTypeId
)
448 const sal_uInt16 nOldId
= nOld
!= -1 ? m_xTypeLB
->get_id(nOld
).toUInt32() : 0;
449 if( nOldId
& REFFLDFLAG
|| nOldId
== static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
) )
450 // then the old one stays
451 nFieldDlgFormatSel
= m_xFormatLB
->get_selected_index();
456 m_xNameED
->set_sensitive(bName
);
457 m_xNameFT
->set_sensitive(bName
);
459 // fill Format-Listbox
460 sal_Int32 nSize
= FillFormatLB(nTypeId
);
461 bool bFormat
= nSize
!= 0;
462 m_xFormat
->set_sensitive(bFormat
);
465 ModifyHdl(*m_xNameED
);
466 ModifyHdl(*m_xFilterED
);
469 IMPL_LINK_NOARG(SwFieldRefPage
, SubTypeTreeListBoxHdl
, weld::TreeView
&, void)
474 IMPL_LINK_NOARG(SwFieldRefPage
, SubTypeListBoxHdl
, weld::TreeView
&, void)
479 IMPL_LINK_NOARG(SwFieldRefPage
, FormatHdl
, weld::TreeView
&, void)
484 void SwFieldRefPage::SubTypeHdl()
486 sal_uInt16 nTypeId
= m_xTypeLB
->get_id(GetTypeSel()).toUInt32();
488 sal_uInt16 nFormat
= m_xFormatLB
->get_selected_id().toUInt32();
489 m_xStylerefHideNonNumericalCB
->set_visible(nFormat
== FMT_REF_NUMBER_IDX
490 || nFormat
== FMT_REF_NUMBER_NO_CONTEXT_IDX
491 || nFormat
== FMT_REF_NUMBER_FULL_CONTEXT_IDX
);
492 m_xStylerefFlags
->set_visible(nTypeId
== REFFLDFLAG_STYLE
);
496 case static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
):
497 if (!IsFieldEdit() || m_xSelectionLB
->get_selected_index() != -1)
499 m_xNameED
->set_text(m_xSelectionLB
->get_selected_text());
500 ModifyHdl(*m_xNameED
);
504 case static_cast<sal_uInt16
>(SwFieldTypesEnum::SetRef
):
506 SwWrtShell
*pSh
= GetWrtShell();
508 pSh
= ::GetActiveWrtShell();
511 m_xValueED
->set_text(pSh
->GetSelText());
517 case REFFLDFLAG_HEADING
:
518 case REFFLDFLAG_NUMITEM
:
520 int nEntry
= m_xSelectionToolTipLB
->get_selected_index();
522 m_xNameED
->set_text(m_xSelectionToolTipLB
->get_text(nEntry
));
527 if (!IsFieldEdit() || m_xSelectionLB
->get_selected_index() != -1)
528 m_xNameED
->set_text(m_xSelectionLB
->get_selected_text());
533 // renew types in SelectionLB after filtering
534 void SwFieldRefPage::UpdateSubType(const OUString
& filterString
)
536 SwWrtShell
*pSh
= GetWrtShell();
538 pSh
= ::GetActiveWrtShell();
542 SwGetRefField
const*const pRefField(dynamic_cast<SwGetRefField
*>(GetCurField()));
543 const sal_uInt16 nTypeId
= m_xTypeLB
->get_id(GetTypeSel()).toUInt32();
547 if ( m_xSelectionLB
->get_visible() )
549 const sal_Int32 nSelectionSel
= m_xSelectionLB
->get_selected_index();
550 if (nSelectionSel
!= -1)
551 sOldSel
= m_xSelectionLB
->get_text(nSelectionSel
);
553 if (IsFieldEdit() && pRefField
&& sOldSel
.isEmpty())
554 sOldSel
= OUString::number( pRefField
->GetSeqNo() + 1 );
556 m_xSelectionLB
->freeze();
557 m_xSelectionLB
->clear();
559 if (REFFLDFLAG
& nTypeId
)
561 if (nTypeId
== REFFLDFLAG_FOOTNOTE
|| nTypeId
== REFFLDFLAG_ENDNOTE
)
563 m_xSelectionLB
->thaw();
564 m_xSelectionLB
->make_unsorted();
565 m_xSelectionLB
->freeze();
568 else if (nTypeId
!= REFFLDFLAG_HEADING
&& nTypeId
!= REFFLDFLAG_NUMITEM
)
570 m_xSelectionLB
->thaw();
571 m_xSelectionLB
->make_sorted();
572 m_xSelectionLB
->freeze();
577 m_xSelectionToolTipLB
->freeze();
578 m_xSelectionToolTipLB
->clear();
579 OUString m_sSelectionToolTipLBId
;
580 bool bShowSelectionToolTipLB( false );
582 if( REFFLDFLAG
& nTypeId
)
584 if (nTypeId
== REFFLDFLAG_BOOKMARK
) // text marks!
586 // get all text marks
587 IDocumentMarkAccess
* const pMarkAccess
= pSh
->getIDocumentMarkAccess();
588 for(auto ppMark
= pMarkAccess
->getBookmarksBegin();
589 ppMark
!= pMarkAccess
->getBookmarksEnd();
592 const ::sw::mark::MarkBase
* pBkmk
= *ppMark
;
593 if(IDocumentMarkAccess::MarkType::BOOKMARK
== IDocumentMarkAccess::GetType(*pBkmk
))
595 bool isSubstring
= MatchSubstring(pBkmk
->GetName(), filterString
);
598 m_xSelectionLB
->append_text( pBkmk
->GetName() );
602 if (IsFieldEdit() && pRefField
)
603 sOldSel
= pRefField
->GetSetRefName();
605 else if (nTypeId
== REFFLDFLAG_FOOTNOTE
)
608 const size_t nCnt
= pSh
->GetSeqFootnoteList( aArr
);
610 for( size_t n
= 0; n
< nCnt
; ++n
)
612 bool isSubstring
= MatchSubstring(aArr
[ n
].sDlgEntry
, filterString
);
615 m_xSelectionLB
->append_text( aArr
[ n
].sDlgEntry
);
617 if (IsFieldEdit() && pRefField
&& pRefField
->GetSeqNo() == aArr
[ n
].nSeqNo
)
618 sOldSel
= aArr
[n
].sDlgEntry
;
621 else if (nTypeId
== REFFLDFLAG_ENDNOTE
)
624 const size_t nCnt
= pSh
->GetSeqFootnoteList( aArr
, true );
626 for( size_t n
= 0; n
< nCnt
; ++n
)
628 bool isSubstring
= MatchSubstring(aArr
[ n
].sDlgEntry
, filterString
);
631 m_xSelectionLB
->append_text( aArr
[ n
].sDlgEntry
);
633 if (IsFieldEdit() && pRefField
&& pRefField
->GetSeqNo() == aArr
[ n
].nSeqNo
)
634 sOldSel
= aArr
[n
].sDlgEntry
;
638 else if ( nTypeId
== REFFLDFLAG_HEADING
)
640 bShowSelectionToolTipLB
= true;
642 const IDocumentOutlineNodes
* pIDoc( pSh
->getIDocumentOutlineNodesAccess() );
643 pIDoc
->getOutlineNodes( maOutlineNodes
);
644 bool bCertainTextNodeSelected( false );
645 for ( size_t nOutlIdx
= 0; nOutlIdx
< maOutlineNodes
.size(); ++nOutlIdx
)
647 if (!pIDoc
->isOutlineInLayout(nOutlIdx
, *pSh
->GetLayout()))
651 bool isSubstring
= MatchSubstring(pIDoc
->getOutlineText(nOutlIdx
, pSh
->GetLayout(), true, true, false), filterString
);
654 OUString
sId(OUString::number(nOutlIdx
));
655 m_xSelectionToolTipLB
->append(sId
,
656 pIDoc
->getOutlineText(nOutlIdx
, pSh
->GetLayout(), true, true, false));
657 if ((IsFieldEdit() && pRefField
658 && pRefField
->GetReferencedTextNode(nullptr, nullptr) == maOutlineNodes
[nOutlIdx
])
659 || mpSavedSelectedTextNode
== maOutlineNodes
[nOutlIdx
])
661 m_sSelectionToolTipLBId
= sId
;
663 bCertainTextNodeSelected
= true;
665 else if ( !bCertainTextNodeSelected
&& mnSavedSelectedPos
== nOutlIdx
)
667 m_sSelectionToolTipLBId
= sId
;
673 else if ( nTypeId
== REFFLDFLAG_NUMITEM
)
675 bShowSelectionToolTipLB
= true;
677 const IDocumentListItems
* pIDoc( pSh
->getIDocumentListItemsAccess() );
678 pIDoc
->getNumItems( maNumItems
);
679 bool bCertainTextNodeSelected( false );
680 for ( size_t nNumItemIdx
= 0; nNumItemIdx
< maNumItems
.size(); ++nNumItemIdx
)
682 if (!pIDoc
->isNumberedInLayout(*maNumItems
[nNumItemIdx
], *pSh
->GetLayout()))
686 bool isSubstring
= MatchSubstring(pIDoc
->getListItemText(*maNumItems
[nNumItemIdx
], *pSh
->GetLayout()), filterString
);
689 OUString
sId(OUString::number(nNumItemIdx
));
690 m_xSelectionToolTipLB
->append(sId
,
691 pIDoc
->getListItemText(*maNumItems
[nNumItemIdx
], *pSh
->GetLayout()));
692 if ((IsFieldEdit() && pRefField
693 && pRefField
->GetReferencedTextNode(nullptr, nullptr) == maNumItems
[nNumItemIdx
]->GetTextNode())
694 || mpSavedSelectedTextNode
== maNumItems
[nNumItemIdx
]->GetTextNode())
696 m_sSelectionToolTipLBId
= sId
;
698 bCertainTextNodeSelected
= true;
700 else if ( !bCertainTextNodeSelected
&& mnSavedSelectedPos
== nNumItemIdx
)
702 m_sSelectionToolTipLBId
= sId
;
708 else if (nTypeId
== REFFLDFLAG_STYLE
)
710 const IDocumentOutlineNodes
* pIDoc(pSh
->getIDocumentOutlineNodesAccess());
711 pIDoc
->getOutlineNodes(maOutlineNodes
);
713 SfxStyleSheetBasePool
* pStyleSheetPool
714 = pSh
->GetDoc()->GetDocShell()->GetStyleSheetPool();
715 auto stylesheetIterator
716 = pStyleSheetPool
->CreateIterator(SfxStyleFamily::Para
, SfxStyleSearchBits::Used
);
718 SfxStyleSheetBase
* pStyle
= stylesheetIterator
->First();
719 while (pStyle
!= nullptr)
721 bool isSubstring
= MatchSubstring(pStyle
->GetName(), filterString
);
725 m_xSelectionLB
->append_text(pStyle
->GetName());
728 pStyle
= stylesheetIterator
->Next();
731 if (IsFieldEdit() && pRefField
) {
732 sOldSel
= pRefField
->GetPar1();
733 m_xStylerefFromBottomCB
->set_active((pRefField
->GetFlags() & REFFLDFLAG_STYLE_FROM_BOTTOM
) == REFFLDFLAG_STYLE_FROM_BOTTOM
);
734 m_xStylerefHideNonNumericalCB
->set_active((pRefField
->GetFlags() & REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL
) == REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL
);
739 // get the fields to Seq-FieldType:
741 SwSetExpFieldType
* pType
= static_cast<SwSetExpFieldType
*>(pSh
->GetFieldType(
742 nTypeId
& ~REFFLDFLAG
, SwFieldIds::SetExp
));
746 // old selection should be kept in non-edit mode
750 const size_t nCnt
= pType
->GetSeqFieldList(aArr
, pSh
->GetLayout());
751 for( size_t n
= 0; n
< nCnt
; ++n
)
753 bool isSubstring
= MatchSubstring(aArr
[ n
].sDlgEntry
, filterString
);
756 m_xSelectionLB
->append_text( aArr
[ n
].sDlgEntry
);
758 if (IsFieldEdit() && pRefField
&& sOldSel
.isEmpty() &&
759 aArr
[ n
].nSeqNo
== pRefField
->GetSeqNo())
760 sOldSel
= aArr
[ n
].sDlgEntry
;
763 if (IsFieldEdit() && pRefField
&& sOldSel
.isEmpty())
764 sOldSel
= OUString::number( pRefField
->GetSeqNo() + 1);
770 std::vector
<OUString
> aLst
;
771 GetFieldMgr().GetSubTypes(static_cast<SwFieldTypesEnum
>(nTypeId
), aLst
);
772 for(const OUString
& i
: aLst
)
774 bool isSubstring
= MatchSubstring( i
, filterString
);
777 m_xSelectionLB
->append_text(i
);
781 if (IsFieldEdit() && pRefField
)
782 sOldSel
= pRefField
->GetSetRefName();
786 m_xSelectionLB
->thaw();
787 m_xSelectionToolTipLB
->thaw();
788 if (!m_sSelectionToolTipLBId
.isEmpty())
789 m_xSelectionToolTipLB
->select_id(m_sSelectionToolTipLBId
);
790 m_xSelectionToolTipLB
->set_visible( bShowSelectionToolTipLB
);
791 m_xSelectionLB
->set_visible( !bShowSelectionToolTipLB
);
792 if ( bShowSelectionToolTipLB
)
794 bool bHasChildren
= m_xSelectionToolTipLB
->n_children() != 0;
795 m_xSelection
->set_sensitive(bHasChildren
);
797 int nEntry
= m_xSelectionToolTipLB
->get_selected_index();
799 m_xSelectionToolTipLB
->scroll_to_row(nEntry
);
800 else if (bHasChildren
)
801 m_xSelectionToolTipLB
->select(0);
803 if (IsFieldEdit() && nEntry
== -1)
805 m_xNameED
->set_text(sOldSel
);
811 bool bEnable
= m_xSelectionLB
->n_children() != 0;
812 m_xSelection
->set_sensitive( bEnable
);
816 m_xSelectionLB
->select_text(sOldSel
);
817 if (m_xSelectionLB
->get_selected_index() == -1 && !IsFieldEdit())
818 m_xSelectionLB
->select(0);
821 if (IsFieldEdit() && m_xSelectionLB
->get_selected_index() == -1) // in case the reference was already deleted...
822 m_xNameED
->set_text(sOldSel
);
826 bool SwFieldRefPage::MatchSubstring( const OUString
& rListString
, const OUString
& rSubstr
)
828 if(rSubstr
.isEmpty())
830 OUString aListString
= GetAppCharClass().lowercase(rListString
);
831 OUString aSubstr
= GetAppCharClass().lowercase(rSubstr
);
832 return aListString
.indexOf(aSubstr
) >= 0;
835 const TranslateId FMT_REF_ARY
[] =
846 FMT_REF_NUMBER_NO_CONTEXT
,
847 FMT_REF_NUMBER_FULL_CONTEXT
850 sal_Int32
SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId
)
854 sal_Int32 nFormatSel
= m_xFormatLB
->get_selected_index();
855 if (nFormatSel
!= -1)
856 sOldSel
= m_xFormatLB
->get_text(nFormatSel
);
858 // fill Format-Listbox
859 m_xFormatLB
->clear();
861 // reference has less that the annotation
862 sal_uInt16
nSize( 0 );
863 sal_uInt16
nOffset( 0 );
864 bool bAddCrossRefFormats( false );
868 case REFFLDFLAG_HEADING
:
869 case REFFLDFLAG_NUMITEM
:
870 bAddCrossRefFormats
= true;
873 case static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
):
874 case REFFLDFLAG_BOOKMARK
:
875 case REFFLDFLAG_FOOTNOTE
:
876 case REFFLDFLAG_ENDNOTE
:
877 nSize
= FMT_REF_PAGE_PGDSC_IDX
+ 1;
879 case REFFLDFLAG_STYLE
:
880 nOffset
= FMT_REF_TEXT_IDX
;
881 nSize
= FMT_REF_UPDOWN_IDX
+ 1 - nOffset
;
882 bAddCrossRefFormats
= true;
888 if ( REFFLDFLAG
& nTypeId
)
890 nSize
= FMT_REF_ONLYSEQNO_IDX
+ 1;
894 nSize
= GetFieldMgr().GetFormatCount( static_cast<SwFieldTypesEnum
>(nTypeId
), IsFieldDlgHtmlMode() );
899 if (REFFLDFLAG
& nTypeId
)
900 nTypeId
= static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
);
902 SwFieldTypesEnum nFieldType
= static_cast<SwFieldTypesEnum
>(nTypeId
);
903 for (sal_uInt16 i
= nOffset
; i
< nSize
+ nOffset
; i
++)
905 OUString
sId(OUString::number(GetFieldMgr().GetFormatId( nFieldType
, i
)));
906 m_xFormatLB
->append(sId
, GetFieldMgr().GetFormatStr(nFieldType
, i
));
910 sal_uInt16
nExtraSize( 0 );
911 if ( bAddCrossRefFormats
)
913 sal_uInt16 nFormat
= FMT_REF_NUMBER_IDX
;
914 OUString
sId(OUString::number(GetFieldMgr().GetFormatId(nFieldType
, nFormat
)));
915 m_xFormatLB
->append(sId
, GetFieldMgr().GetFormatStr( nFieldType
, nFormat
));
916 nFormat
= FMT_REF_NUMBER_NO_CONTEXT_IDX
;
917 sId
= OUString::number(GetFieldMgr().GetFormatId(nFieldType
, nFormat
));
918 m_xFormatLB
->append(sId
, GetFieldMgr().GetFormatStr( nFieldType
, nFormat
));
919 nFormat
= FMT_REF_NUMBER_FULL_CONTEXT_IDX
;
920 sId
= OUString::number(GetFieldMgr().GetFormatId(nFieldType
, nFormat
));
921 m_xFormatLB
->append(sId
, GetFieldMgr().GetFormatStr( nFieldType
, nFormat
));
925 // extra list items optionally, depending from reference-language
926 SvtSysLocaleOptions aSysLocaleOptions
;
927 static const LanguageTag
& rLang
= aSysLocaleOptions
.GetRealLanguageTag();
929 if (rLang
.getLanguage() == "hu")
931 for (sal_uInt16 i
= 0; i
< nSize
; i
++)
933 OUString
sId(OUString::number(GetFieldMgr().GetFormatId( nFieldType
, i
+ std::size(FMT_REF_ARY
))));
934 m_xFormatLB
->append(sId
, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE
) + GetFieldMgr().GetFormatStr( nFieldType
, i
));
938 if ( bAddCrossRefFormats
)
940 sal_uInt16 nFormat
= FMT_REF_NUMBER_IDX
+ std::size(FMT_REF_ARY
);
941 OUString
sId(OUString::number(GetFieldMgr().GetFormatId(nFieldType
, nFormat
)));
942 m_xFormatLB
->append(sId
, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE
) + GetFieldMgr().GetFormatStr( nFieldType
, nFormat
% std::size(FMT_REF_ARY
)));
943 nFormat
= FMT_REF_NUMBER_NO_CONTEXT_IDX
+ std::size(FMT_REF_ARY
);
944 sId
= OUString::number(GetFieldMgr().GetFormatId(nFieldType
, nFormat
));
945 m_xFormatLB
->append(sId
, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE
) + GetFieldMgr().GetFormatStr( nFieldType
, nFormat
% std::size(FMT_REF_ARY
)));
946 nFormat
= FMT_REF_NUMBER_FULL_CONTEXT_IDX
+ std::size(FMT_REF_ARY
);
947 sId
= OUString::number(GetFieldMgr().GetFormatId(nFieldType
, nFormat
));
948 m_xFormatLB
->append(sId
, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE
) + GetFieldMgr().GetFormatStr( nFieldType
, nFormat
% std::size(FMT_REF_ARY
)));
952 for (sal_uInt16 i
= 0; i
< nSize
; i
++)
954 OUString
sId(OUString::number(GetFieldMgr().GetFormatId( nFieldType
, i
+ 2 * std::size(FMT_REF_ARY
))));
955 m_xFormatLB
->append(sId
, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE
) + GetFieldMgr().GetFormatStr( nFieldType
, i
));
958 if ( bAddCrossRefFormats
)
960 sal_uInt16 nFormat
= FMT_REF_NUMBER_IDX
+ 2 * std::size(FMT_REF_ARY
);
961 OUString
sId(OUString::number(GetFieldMgr().GetFormatId(nFieldType
, nFormat
)));
962 m_xFormatLB
->append(sId
, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE
) + GetFieldMgr().GetFormatStr( nFieldType
, nFormat
% std::size(FMT_REF_ARY
)));
963 nFormat
= FMT_REF_NUMBER_NO_CONTEXT_IDX
+ 2 * std::size(FMT_REF_ARY
);
964 sId
= OUString::number(GetFieldMgr().GetFormatId(nFieldType
, nFormat
));
965 m_xFormatLB
->append(sId
, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE
) + GetFieldMgr().GetFormatStr( nFieldType
, nFormat
% std::size(FMT_REF_ARY
)));
966 nFormat
= FMT_REF_NUMBER_FULL_CONTEXT_IDX
+ 2 * std::size(FMT_REF_ARY
);
967 sId
= OUString::number(GetFieldMgr().GetFormatId(nFieldType
, nFormat
));
968 m_xFormatLB
->append(sId
, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE
) + GetFieldMgr().GetFormatStr( nFieldType
, nFormat
% std::size(FMT_REF_ARY
)));
975 // select a certain entry
979 m_xFormatLB
->select_text(sOldSel
);
981 m_xFormatLB
->select_text(SwResId(FMT_REF_ARY
[GetCurField()->GetFormat() % std::size(FMT_REF_ARY
)]));
983 if (m_xFormatLB
->get_selected_index() == -1)
985 if (nFieldDlgFormatSel
< m_xFormatLB
->n_children())
986 m_xFormatLB
->select(nFieldDlgFormatSel
);
988 m_xFormatLB
->select(0);
996 IMPL_LINK_NOARG(SwFieldRefPage
, ModifyHdl
, weld::Entry
&, void)
998 OUString
aName(m_xNameED
->get_text());
999 const bool bEmptyName
= aName
.isEmpty();
1001 bool bEnable
= true;
1002 sal_uInt16 nTypeId
= m_xTypeLB
->get_id(GetTypeSel()).toUInt32();
1004 if ((nTypeId
== static_cast<sal_uInt16
>(SwFieldTypesEnum::SetRef
) && !GetFieldMgr().CanInsertRefMark(aName
)) ||
1005 (bEmptyName
&& (nTypeId
== static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
) || nTypeId
== static_cast<sal_uInt16
>(SwFieldTypesEnum::SetRef
) ||
1006 nTypeId
== REFFLDFLAG_BOOKMARK
)))
1009 EnableInsert(bEnable
, IsCurrentPage());
1011 m_xSelectionLB
->select_text(aName
);
1014 bool SwFieldRefPage::FillItemSet(SfxItemSet
* )
1016 bool bModified
= false;
1017 sal_uInt16 nTypeId
= m_xTypeLB
->get_id(GetTypeSel()).toUInt32();
1019 sal_uInt16 nSubType
= 0;
1020 const sal_Int32 nEntryPos
= m_xFormatLB
->get_selected_index();
1021 const sal_uInt32 nFormat
= (nEntryPos
== -1)
1022 ? 0 : m_xFormatLB
->get_id(nEntryPos
).toUInt32();
1024 OUString
aVal(m_xValueED
->get_text());
1025 OUString
aName(m_xNameED
->get_text());
1029 case static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
):
1030 nSubType
= REF_SETREFATTR
;
1033 case static_cast<sal_uInt16
>(SwFieldTypesEnum::SetRef
):
1035 SwFieldType
* pType
= GetFieldMgr().GetFieldType(SwFieldIds::SetExp
, aName
);
1037 if(!pType
) // Only insert when the name doesn't exist yet
1039 m_xSelectionLB
->append_text(aName
);
1040 m_xSelection
->set_sensitive(true);
1046 SwGetRefField
const*const pRefField(dynamic_cast<SwGetRefField
*>(GetCurField()));
1048 SwWrtShell
*pSh
= GetWrtShell();
1050 pSh
= ::GetActiveWrtShell();
1052 if (pSh
&& REFFLDFLAG
& nTypeId
)
1054 if (nTypeId
== REFFLDFLAG_BOOKMARK
) // text marks!
1056 aName
= m_xNameED
->get_text();
1057 nTypeId
= static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
);
1058 nSubType
= REF_BOOKMARK
;
1060 else if (REFFLDFLAG_FOOTNOTE
== nTypeId
) // footnotes
1062 SwSeqFieldList aArr
;
1063 SeqFieldLstElem
aElem( m_xSelectionLB
->get_selected_text(), 0 );
1067 nTypeId
= static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
);
1068 nSubType
= REF_FOOTNOTE
;
1071 if (pSh
->GetSeqFootnoteList(aArr
) && aArr
.SeekEntry(aElem
, &nPos
))
1073 aVal
= OUString::number( aArr
[nPos
].nSeqNo
);
1075 if (IsFieldEdit() && pRefField
&& aArr
[nPos
].nSeqNo
== pRefField
->GetSeqNo())
1076 bModified
= true; // can happen with fields of which the references were deleted
1078 else if (IsFieldEdit() && pRefField
)
1079 aVal
= OUString::number( pRefField
->GetSeqNo() );
1081 else if (REFFLDFLAG_ENDNOTE
== nTypeId
) // endnotes
1083 SwSeqFieldList aArr
;
1084 SeqFieldLstElem
aElem( m_xSelectionLB
->get_selected_text(), 0 );
1088 nTypeId
= static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
);
1089 nSubType
= REF_ENDNOTE
;
1092 if (pSh
->GetSeqFootnoteList(aArr
, true) && aArr
.SeekEntry(aElem
, &nPos
))
1094 aVal
= OUString::number( aArr
[nPos
].nSeqNo
);
1096 if (IsFieldEdit() && pRefField
&& aArr
[nPos
].nSeqNo
== pRefField
->GetSeqNo())
1097 bModified
= true; // can happen with fields of which the reference was deleted
1099 else if (IsFieldEdit() && pRefField
)
1100 aVal
= OUString::number( pRefField
->GetSeqNo() );
1103 else if ( nTypeId
== REFFLDFLAG_HEADING
)
1105 int nEntry
= m_xSelectionToolTipLB
->get_selected_index();
1106 OSL_ENSURE( nEntry
!= -1,
1107 "<SwFieldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
1110 const size_t nOutlIdx(m_xSelectionToolTipLB
->get_id(nEntry
).toUInt32());
1111 pSh
->getIDocumentOutlineNodesAccess()->getOutlineNodes( maOutlineNodes
);
1112 if ( nOutlIdx
< maOutlineNodes
.size() )
1114 ::sw::mark::MarkBase
const * const pMark
= pSh
->getIDocumentMarkAccess()->getMarkForTextNode(
1115 *(maOutlineNodes
[nOutlIdx
]),
1116 IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK
);
1117 aName
= pMark
->GetName();
1118 nTypeId
= static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
);
1119 nSubType
= REF_BOOKMARK
;
1123 else if ( nTypeId
== REFFLDFLAG_NUMITEM
)
1125 int nEntry
= m_xSelectionToolTipLB
->get_selected_index();
1126 OSL_ENSURE( nEntry
!= -1,
1127 "<SwFieldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
1130 const size_t nNumItemIdx(m_xSelectionToolTipLB
->get_id(nEntry
).toUInt32());
1131 pSh
->getIDocumentListItemsAccess()->getNumItems(maNumItems
);
1132 if ( nNumItemIdx
< maNumItems
.size() )
1134 ::sw::mark::MarkBase
const * const pMark
= pSh
->getIDocumentMarkAccess()->getMarkForTextNode(
1135 *(maNumItems
[nNumItemIdx
]->GetTextNode()),
1136 IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK
);
1137 aName
= pMark
->GetName();
1138 nTypeId
= static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
);
1139 nSubType
= REF_BOOKMARK
;
1143 else if (nTypeId
== REFFLDFLAG_STYLE
)
1145 int nEntry
= m_xSelectionLB
->get_selected_index();
1148 aName
= m_xSelectionLB
->get_text(nEntry
);
1149 nTypeId
= static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
);
1150 nSubType
= REF_STYLE
;
1151 sal_uInt16 nVal
= REFFLDFLAG_STYLE
;
1153 if (m_xStylerefFromBottomCB
->get_active()) {
1154 nVal
|= REFFLDFLAG_STYLE_FROM_BOTTOM
;
1157 if (m_xStylerefHideNonNumericalCB
->get_active()) {
1158 nVal
|= REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL
;
1161 aVal
= OUString::number(nVal
);
1163 SAL_WARN("sw.ui", "<SwFieldRefPage::FillItemSet(..)> no entry selected in selection listbox!");
1166 else // SequenceFields
1168 // get fields for Seq-FieldType:
1169 SwSetExpFieldType
* pType
= static_cast<SwSetExpFieldType
*>(pSh
->GetFieldType(
1170 nTypeId
& ~REFFLDFLAG
, SwFieldIds::SetExp
));
1173 SwSeqFieldList aArr
;
1174 SeqFieldLstElem
aElem( m_xSelectionLB
->get_selected_text(), 0 );
1178 nTypeId
= static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
);
1179 nSubType
= REF_SEQUENCEFLD
;
1180 aName
= pType
->GetName();
1182 if (pType
->GetSeqFieldList(aArr
, pSh
->GetLayout())
1183 && aArr
.SeekEntry(aElem
, &nPos
))
1185 aVal
= OUString::number( aArr
[nPos
].nSeqNo
);
1187 if (IsFieldEdit() && pRefField
&& aArr
[nPos
].nSeqNo
== pRefField
->GetSeqNo())
1188 bModified
= true; // can happen with fields of which the reference was deleted
1190 else if (IsFieldEdit() && pRefField
)
1191 aVal
= OUString::number( pRefField
->GetSeqNo() );
1196 if (IsFieldEdit() && nTypeId
== static_cast<sal_uInt16
>(SwFieldTypesEnum::GetRef
))
1198 aVal
= OUString::number(nSubType
) + "|" + aVal
;
1201 if (!IsFieldEdit() || bModified
||
1202 m_xNameED
->get_value_changed_from_saved() ||
1203 m_xValueED
->get_value_changed_from_saved() ||
1204 m_xTypeLB
->get_value_changed_from_saved() ||
1205 m_xSelectionLB
->get_value_changed_from_saved() ||
1206 m_xFormatLB
->get_value_changed_from_saved() ||
1207 (nSubType
== REF_STYLE
1208 && (m_xStylerefFromBottomCB
->get_state_changed_from_saved() || m_xStylerefHideNonNumericalCB
->get_state_changed_from_saved())))
1210 InsertField( static_cast<SwFieldTypesEnum
>(nTypeId
), nSubType
, aName
, aVal
, nFormat
);
1213 ModifyHdl(*m_xNameED
); // enable/disable insert if applicable
1218 std::unique_ptr
<SfxTabPage
> SwFieldRefPage::Create( weld::Container
* pPage
, weld::DialogController
* pController
,
1219 const SfxItemSet
*const pAttrSet
)
1221 return std::make_unique
<SwFieldRefPage
>(pPage
, pController
, pAttrSet
);
1224 sal_uInt16
SwFieldRefPage::GetGroup()
1229 void SwFieldRefPage::FillUserData()
1231 const sal_Int32 nEntryPos
= m_xTypeLB
->get_selected_index();
1232 const sal_uInt16 nTypeSel
= ( -1 == nEntryPos
)
1234 : m_xTypeLB
->get_id(nEntryPos
).toUInt32();
1235 const sal_Int32 nFormatEntryPos
= m_xFormatLB
->get_selected_index();
1236 const sal_uInt32 nFormatSel
= -1 == nFormatEntryPos
? USHRT_MAX
: nFormatEntryPos
;
1237 SetUserData( USER_DATA_VERSION
";" +
1238 OUString::number( nTypeSel
) + ";" +
1239 OUString::number( nFormatSel
));
1242 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */