LibreOffice Module sw (master)  1
fldfunc.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 <strings.hrc>
22 #include <fldbas.hxx>
23 #include <docufld.hxx>
24 #include <wrtsh.hxx>
25 #include <swmodule.hxx>
26 #include "fldfunc.hxx"
27 #include "flddinf.hxx"
28 #include <flddropdown.hxx>
29 #include <o3tl/string_view.hxx>
30 
31 #define USER_DATA_VERSION_1 "1"
32 #define USER_DATA_VERSION USER_DATA_VERSION_1
33 
34 using namespace ::com::sun::star;
35 
37  : SwFieldPage(pPage, pController, "modules/swriter/ui/fldfuncpage.ui", "FieldFuncPage", pCoreSet)
38  , nOldFormat(0)
39  , bDropDownLBChanged(false)
40  , m_xTypeLB(m_xBuilder->weld_tree_view("type"))
41  , m_xSelectionLB(m_xBuilder->weld_tree_view("select"))
42  , m_xFormat(m_xBuilder->weld_widget("formatframe"))
43  , m_xFormatLB(m_xBuilder->weld_tree_view("format"))
44  , m_xNameFT(m_xBuilder->weld_label("nameft"))
45  , m_xNameED(new ConditionEdit(m_xBuilder->weld_entry("condFunction")))
46  , m_xValueGroup(m_xBuilder->weld_widget("valuegroup"))
47  , m_xValueFT(m_xBuilder->weld_label("valueft"))
48  , m_xValueED(m_xBuilder->weld_entry("value"))
49  , m_xCond1FT(m_xBuilder->weld_label("cond1ft"))
50  , m_xCond1ED(new ConditionEdit(m_xBuilder->weld_entry("cond1")))
51  , m_xCond2FT(m_xBuilder->weld_label("cond2ft"))
52  , m_xCond2ED(new ConditionEdit(m_xBuilder->weld_entry("cond2")))
53  , m_xMacroBT(m_xBuilder->weld_button("macro"))
54  , m_xListGroup(m_xBuilder->weld_widget("listgroup"))
55  , m_xListItemFT(m_xBuilder->weld_label("itemft"))
56  , m_xListItemED(m_xBuilder->weld_entry("item"))
57  , m_xListAddPB(m_xBuilder->weld_button("add"))
58  , m_xListItemsFT(m_xBuilder->weld_label("listitemft"))
59  , m_xListItemsLB(m_xBuilder->weld_tree_view("listitems"))
60  , m_xListRemovePB(m_xBuilder->weld_button("remove"))
61  , m_xListUpPB(m_xBuilder->weld_button("up"))
62  , m_xListDownPB(m_xBuilder->weld_button("down"))
63  , m_xListNameFT(m_xBuilder->weld_label("listnameft"))
64  , m_xListNameED(m_xBuilder->weld_entry("listname"))
65 {
68  m_xListItemsLB->set_size_request(m_xListItemED->get_preferred_size().Width(),
69  m_xListItemsLB->get_height_rows(5));
70 
71  auto nWidth = m_xTypeLB->get_approximate_digit_width() * FIELD_COLUMN_WIDTH;
72  auto nHeight = m_xTypeLB->get_height_rows(10);
73  m_xTypeLB->set_size_request(nWidth, nHeight);
74  m_xFormatLB->set_size_request(nWidth, nHeight);
75 
76  m_xNameED->connect_changed(LINK(this, SwFieldFuncPage, ModifyHdl));
77 
78  m_sOldValueFT = m_xValueFT->get_label();
79  m_sOldNameFT = m_xNameFT->get_label();
80 
81  m_xCond1ED->ShowBrackets(false);
82  m_xCond2ED->ShowBrackets(false);
83 
84  // uitests
85  m_xTypeLB->set_buildable_name(m_xTypeLB->get_buildable_name() + "-func");
86  m_xValueED->set_buildable_name(m_xValueED->get_buildable_name() + "-func");
87  m_xSelectionLB->set_buildable_name(m_xSelectionLB->get_buildable_name() + "-func");
88  m_xFormatLB->set_buildable_name(m_xFormatLB->get_buildable_name() + "-func");
89 }
90 
92 {
93 }
94 
96 {
98  Init(); // general initialisation
99 
100  m_xTypeLB->freeze();
101  m_xTypeLB->clear();
102 
103  if (!IsFieldEdit())
104  {
105  // initialise TypeListBox
107 
108  // fill Typ-Listbox
109  for(sal_uInt16 i = rRg.nStart; i < rRg.nEnd; ++i)
110  {
111  const SwFieldTypesEnum nTypeId = SwFieldMgr::GetTypeId(i);
112  m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(i));
113  }
114  }
115  else
116  {
117  const SwFieldTypesEnum nTypeId = GetCurField()->GetTypeId();
118  m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
119 
120  if (nTypeId == SwFieldTypesEnum::Macro)
121  {
122  GetFieldMgr().SetMacroPath(GetCurField()->GetPar1());
123  }
124  }
125 
126  m_xTypeLB->connect_row_activated(LINK(this, SwFieldFuncPage, TreeViewInsertHdl));
127  m_xTypeLB->connect_changed(LINK(this, SwFieldFuncPage, TypeHdl));
128  m_xSelectionLB->connect_changed(LINK(this, SwFieldFuncPage, SelectHdl));
129  m_xSelectionLB->connect_row_activated(LINK(this, SwFieldFuncPage, InsertMacroHdl));
130  m_xFormatLB->connect_row_activated(LINK(this, SwFieldFuncPage, TreeViewInsertHdl));
131  m_xMacroBT->connect_clicked(LINK(this, SwFieldFuncPage, MacroHdl));
132  Link<weld::Button&,void> aListModifyLk( LINK(this, SwFieldFuncPage, ListModifyButtonHdl));
133  m_xListAddPB->connect_clicked(aListModifyLk);
134  m_xListRemovePB->connect_clicked(aListModifyLk);
135  m_xListUpPB->connect_clicked(aListModifyLk);
136  m_xListDownPB->connect_clicked(aListModifyLk);
137  m_xListItemED->connect_activate(LINK(this, SwFieldFuncPage, ListModifyReturnActionHdl));
138  Link<weld::Entry&,void> aListEnableLk = LINK(this, SwFieldFuncPage, ListEnableHdl);
139  m_xListItemED->connect_changed(aListEnableLk);
140  m_xListItemsLB->connect_changed(LINK(this, SwFieldFuncPage, ListEnableListBoxHdl));
141 
142  int nSelect = -1;
143  if( !IsRefresh() )
144  {
145  const OUString sUserData = GetUserData();
146  sal_Int32 nIdx{ 0 };
147  if(o3tl::equalsIgnoreAsciiCase(o3tl::getToken(sUserData, 0, ';', nIdx), u"" USER_DATA_VERSION_1))
148  {
149  const sal_uInt16 nVal = static_cast< sal_uInt16 >(o3tl::toInt32(o3tl::getToken(sUserData, 0, ';', nIdx)));
150  if(nVal != USHRT_MAX)
151  {
152  for (sal_Int32 i = 0, nEntryCount = m_xTypeLB->n_children(); i < nEntryCount; ++i)
153  {
154  if (nVal == m_xTypeLB->get_id(i).toUInt32())
155  {
156  nSelect = i;
157  break;
158  }
159  }
160  }
161  }
162  }
163 
164  m_xTypeLB->thaw();
165  if (nSelect != -1)
166  m_xTypeLB->select(nSelect);
167  else
168  {
169  // select old Pos
171  }
172  TypeHdl(*m_xTypeLB);
173 
174  if (IsFieldEdit())
175  {
176  m_xNameED->save_value();
177  m_xValueED->save_value();
178  m_xCond1ED->save_value();
179  m_xCond2ED->save_value();
181  }
182 }
183 
185 {
186  FMT_MARK_TEXT,
187  FMT_MARK_TABLE,
188  FMT_MARK_FRAME,
189  FMT_MARK_GRAFIC,
190  FMT_MARK_OLE
191 };
192 
194 {
195  // save old ListBoxPos
196  const sal_Int32 nOld = GetTypeSel();
197 
198  // current ListBoxPos
199  SetTypeSel(m_xTypeLB->get_selected_index());
200 
201  if(GetTypeSel() == -1)
202  {
203  SetTypeSel(0);
204  m_xTypeLB->select(0);
205  }
206 
207  if (nOld == GetTypeSel())
208  return;
209 
210  const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
211 
212  // fill Selection-Listbox
213  UpdateSubType();
214 
215  // fill Format-Listbox
216  m_xFormatLB->clear();
217 
218  const sal_uInt16 nSize = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
219 
220  for (sal_uInt16 i = 0; i < nSize; i++)
221  {
222  m_xFormatLB->append(OUString::number(GetFieldMgr().GetFormatId(nTypeId, i)),
223  GetFieldMgr().GetFormatStr(nTypeId, i));
224  }
225 
226  if (nSize)
227  {
228  if (IsFieldEdit() && nTypeId == SwFieldTypesEnum::JumpEdit)
229  m_xFormatLB->select_text(SwResId(FMT_MARK_ARY[GetCurField()->GetFormat()]));
230 
231  if (m_xFormatLB->get_selected_index() == -1)
232  m_xFormatLB->select(0);
233  }
234 
235  bool bValue = false, bName = false, bMacro = false, bInsert = true;
236  bool bFormat = nSize != 0;
237 
238  // two controls for conditional text
239  bool bDropDown = SwFieldTypesEnum::Dropdown == nTypeId;
240  bool bCondTextField = SwFieldTypesEnum::ConditionalText == nTypeId;
241 
242  m_xCond1FT->set_visible(!bDropDown && bCondTextField);
243  m_xCond1ED->set_visible(!bDropDown && bCondTextField);
244  m_xCond2FT->set_visible(!bDropDown && bCondTextField);
245  m_xCond2ED->set_visible(!bDropDown && bCondTextField);
246  m_xValueGroup->set_visible(!bDropDown && !bCondTextField);
247  m_xMacroBT->set_visible(!bDropDown);
248  m_xNameED->set_visible(!bDropDown);
249  m_xNameFT->set_visible(!bDropDown);
250 
251  m_xListGroup->set_visible(bDropDown);
252 
253  m_xNameED->SetDropEnable(false);
254 
255  if (IsFieldEdit())
256  {
257  if(bDropDown)
258  {
259  const SwDropDownField* pDrop = static_cast<const SwDropDownField*>(GetCurField());
260  const uno::Sequence<OUString> aItems = pDrop->GetItemSequence();
261  m_xListItemsLB->clear();
262  for (const OUString& rItem : aItems)
263  m_xListItemsLB->append_text(rItem);
264  m_xListItemsLB->select_text(pDrop->GetSelectedItem());
265  m_xListNameED->set_text(pDrop->GetPar2());
266  m_xListNameED->save_value();
267  bDropDownLBChanged = false;
268  }
269  else
270  {
271  m_xNameED->set_text(GetCurField()->GetPar1());
272  m_xValueED->set_text(GetCurField()->GetPar2());
273  }
274  }
275  else
276  {
277  m_xNameED->set_text(OUString());
278  m_xValueED->set_text(OUString());
279  }
280  if(bDropDown)
281  ListEnableHdl(*m_xListItemED);
282 
283  if (m_xNameFT->get_label() != m_sOldNameFT)
284  m_xNameFT->set_label(m_sOldNameFT);
285  if (m_xValueFT->get_label() != m_sOldValueFT)
286  m_xValueFT->set_label(m_sOldValueFT);
287 
288  switch (nTypeId)
289  {
291  bMacro = true;
292  if (!GetFieldMgr().GetMacroPath().isEmpty())
293  bValue = true;
294  else
295  bInsert = false;
296 
297  m_xNameFT->set_label(SwResId(STR_MACNAME));
298  m_xValueFT->set_label(SwResId(STR_PROMPT));
299  m_xNameED->set_text(GetFieldMgr().GetMacroName());
300  m_xNameED->set_accessible_name(m_xNameFT->get_label());
301  m_xValueED->set_accessible_name(m_xValueFT->get_label());
302  break;
303 
305  m_xNameFT->set_label(SwResId(STR_COND));
306  m_xNameED->SetDropEnable(true);
307  bName = true;
308  m_xNameED->set_accessible_name(m_xNameFT->get_label());
309  m_xValueED->set_accessible_name(m_xValueFT->get_label());
310  break;
311 
313  {
314  m_xNameFT->set_label(SwResId(STR_COND));
315  m_xNameED->SetDropEnable(true);
316  m_xValueFT->set_label(SwResId(STR_INSTEXT));
317  SwWrtShell* pSh = GetActiveWrtShell();
318  if (!IsFieldEdit() && pSh )
319  m_xValueED->set_text(pSh->GetSelText());
320  bName = bValue = true;
321  m_xNameED->set_accessible_name(m_xNameFT->get_label());
322  m_xValueED->set_accessible_name(m_xValueFT->get_label());
323  }
324  break;
325 
327  m_xNameFT->set_label(SwResId(STR_COND));
328  m_xNameED->SetDropEnable(true);
329  if (IsFieldEdit())
330  {
331  sal_Int32 nIdx{ 0 };
332  m_xCond1ED->set_text(GetCurField()->GetPar2().getToken(0, '|', nIdx));
333  m_xCond2ED->set_text(GetCurField()->GetPar2().getToken(0, '|', nIdx));
334  }
335 
336  bName = bValue = true;
337  m_xNameED->set_accessible_name(m_xNameFT->get_label());
338  m_xValueED->set_accessible_name(m_xValueFT->get_label());
339  break;
340 
342  m_xNameFT->set_label(SwResId(STR_JUMPEDITFLD));
343  m_xValueFT->set_label(SwResId(STR_PROMPT));
344  bName = bValue = true;
345  m_xNameED->set_accessible_name(m_xNameFT->get_label());
346  m_xValueED->set_accessible_name(m_xValueFT->get_label());
347  break;
348 
350  m_xValueFT->set_label(SwResId(STR_PROMPT));
351  bValue = true;
352  m_xNameED->set_accessible_name(m_xNameFT->get_label());
353  m_xValueED->set_accessible_name(m_xValueFT->get_label());
354  break;
355 
357  {
358  m_xNameFT->set_label(SwResId(STR_COMBCHRS_FT));
359  m_xNameED->SetDropEnable(true);
360  bName = true;
361 
362  const sal_Int32 nLen = m_xNameED->get_text().getLength();
363  if( !nLen || nLen > MAX_COMBINED_CHARACTERS )
364  bInsert = false;
365  m_xNameED->set_accessible_name(m_xNameFT->get_label());
366  m_xValueED->set_accessible_name(m_xValueFT->get_label());
367  }
368  break;
370  break;
371  default:
372  break;
373  }
374 
375  m_xSelectionLB->hide();
376 
377  m_xFormat->set_sensitive(bFormat);
378  m_xNameFT->set_sensitive(bName);
379  m_xNameED->set_sensitive(bName);
380  m_xValueGroup->set_sensitive(bValue);
381  m_xMacroBT->set_sensitive(bMacro);
382 
383  EnableInsert( bInsert );
384 }
385 
387 {
388  const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
389 
390  if( SwFieldTypesEnum::Macro == nTypeId )
391  m_xNameED->set_text( m_xSelectionLB->get_selected_text() );
392 }
393 
395 {
396  SelectHdl(*m_xSelectionLB);
397  InsertHdl(nullptr);
398  return true;
399 }
400 
401 IMPL_LINK(SwFieldFuncPage, ListModifyButtonHdl, weld::Button&, rControl, void)
402 {
403  ListModifyHdl(&rControl);
404 }
405 
406 IMPL_LINK(SwFieldFuncPage, ListModifyReturnActionHdl, weld::Entry&, rControl, bool)
407 {
408  ListModifyHdl(&rControl);
409  return true;
410 }
411 
413 {
414  if (pControl == m_xListAddPB.get() ||
415  (pControl == m_xListItemED.get() && m_xListAddPB->get_sensitive()))
416  {
417  const OUString sEntry(m_xListItemED->get_text());
418  m_xListItemsLB->append_text(sEntry);
419  m_xListItemsLB->select_text(sEntry);
420  }
421  else if (m_xListItemsLB->get_selected_index() != -1)
422  {
423  sal_Int32 nSelPos = m_xListItemsLB->get_selected_index();
424  if (pControl == m_xListRemovePB.get())
425  {
426  m_xListItemsLB->remove(nSelPos);
427  m_xListItemsLB->select(nSelPos ? nSelPos - 1 : 0);
428  }
429  else if (pControl == m_xListUpPB.get())
430  {
431  if(nSelPos)
432  {
433  const OUString sEntry = m_xListItemsLB->get_selected_text();
434  m_xListItemsLB->remove(nSelPos);
435  nSelPos--;
436  m_xListItemsLB->insert_text(nSelPos, sEntry);
437  m_xListItemsLB->select(nSelPos);
438  }
439  }
440  else if (pControl == m_xListDownPB.get())
441  {
442  if( nSelPos < m_xListItemsLB->n_children() - 1)
443  {
444  const OUString sEntry = m_xListItemsLB->get_selected_text();
445  m_xListItemsLB->remove(nSelPos);
446  nSelPos++;
447  m_xListItemsLB->insert_text(nSelPos, sEntry);
448  m_xListItemsLB->select(nSelPos);
449  }
450  }
451  }
452  bDropDownLBChanged = true;
453  ListEnableHdl(*m_xListItemED);
454 }
455 
456 IMPL_LINK_NOARG(SwFieldFuncPage, ListEnableListBoxHdl, weld::TreeView&, void)
457 {
458  ListEnableHdl(*m_xListItemED);
459 }
460 
462 {
463  //enable "Add" button when text is in the Edit that's not already member of the box
464  m_xListAddPB->set_sensitive(!m_xListItemED->get_text().isEmpty() &&
465  -1 == m_xListItemsLB->find_text(m_xListItemED->get_text()));
466  bool bEnableButtons = m_xListItemsLB->get_selected_index() != -1;
467  m_xListRemovePB->set_sensitive(bEnableButtons);
468  m_xListUpPB->set_sensitive(bEnableButtons && (m_xListItemsLB->get_selected_index() > 0));
469  m_xListDownPB->set_sensitive(bEnableButtons &&
470  (m_xListItemsLB->get_selected_index() < (m_xListItemsLB->n_children() - 1)));
471 }
472 
473 // renew types in SelectionBox
475 {
476  const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
477 
478  // fill Selection-Listbox
479  m_xSelectionLB->freeze();
480  m_xSelectionLB->clear();
481 
482  std::vector<OUString> aLst;
483  GetFieldMgr().GetSubTypes(nTypeId, aLst);
484  const size_t nCount = aLst.size();
485 
486  for (size_t i = 0; i < nCount; ++i)
487  m_xSelectionLB->append(OUString::number(i), aLst[i]);
488  m_xSelectionLB->thaw();
489 
490  bool bEnable = nCount != 0;
491 
492  m_xSelectionLB->set_sensitive( bEnable );
493 
494  if (bEnable)
495  m_xSelectionLB->select(0);
496 
497  if (nTypeId == SwFieldTypesEnum::Macro)
498  {
499  const bool bHasMacro = !GetFieldMgr().GetMacroPath().isEmpty();
500 
501  if (bHasMacro)
502  {
503  m_xNameED->set_text(GetFieldMgr().GetMacroName());
504  m_xValueGroup->set_sensitive(true);
505  }
506  EnableInsert(bHasMacro);
507  }
508 }
509 
510 // call MacroBrowser, fill Listbox with Macros
512 {
513  if (GetFieldMgr().ChooseMacro(GetFrameWeld()))
514  UpdateSubType();
515 }
516 
518 {
519  const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
520 
521  sal_uInt16 nSubType = 0;
522 
523  const sal_Int32 nEntryPos = m_xFormatLB->get_selected_index();
524  const sal_uLong nFormat = (nEntryPos == -1)
525  ? 0 : m_xFormatLB->get_id(nEntryPos).toUInt32();
526 
527  OUString aVal(m_xValueED->get_text());
528  OUString aName(m_xNameED->get_text());
529 
530  switch(nTypeId)
531  {
533  nSubType = INP_TXT;
534  // to prevent removal of CR/LF restore old content
535  if (!m_xNameED->get_value_changed_from_saved() && IsFieldEdit())
536  aName = GetCurField()->GetPar1();
537 
538  break;
539 
541  // use the full script URL, not the name in the Edit control
543  break;
544 
546  aVal = m_xCond1ED->get_text() + "|" + m_xCond2ED->get_text();
547  break;
549  {
550  aName = m_xListNameED->get_text();
551  for (sal_Int32 i = 0, nEntryCount = m_xListItemsLB->n_children(); i < nEntryCount; ++i)
552  {
553  if(i)
554  aVal += OUStringChar(DB_DELIM);
555  aVal += m_xListItemsLB->get_text(i);
556  }
557  }
558  break;
559  default:
560  break;
561  }
562 
563  if (!IsFieldEdit() ||
564  m_xNameED->get_value_changed_from_saved() ||
565  m_xValueED->get_value_changed_from_saved() ||
566  m_xCond1ED->get_value_changed_from_saved() ||
567  m_xCond2ED->get_value_changed_from_saved() ||
568  m_xListNameED->get_value_changed_from_saved() ||
570  nOldFormat != nFormat)
571  {
572  InsertField( nTypeId, nSubType, aName, aVal, nFormat );
573  }
574 
575  ModifyHdl(m_xNameED->get_widget()); // enable/disable Insert if applicable
576 
577  return false;
578 }
579 
580 std::unique_ptr<SfxTabPage> SwFieldFuncPage::Create( weld::Container* pPage, weld::DialogController* pController,
581  const SfxItemSet *const pAttrSet)
582 {
583  return std::make_unique<SwFieldFuncPage>(pPage, pController, pAttrSet);
584 }
585 
587 {
588  return GRP_FKT;
589 }
590 
592 {
593  const sal_Int32 nEntryPos = m_xTypeLB->get_selected_index();
594  const sal_uInt16 nTypeSel = ( -1 == nEntryPos )
595  ? USHRT_MAX
596  : m_xTypeLB->get_id(nEntryPos).toUInt32();
597  SetUserData(USER_DATA_VERSION ";" + OUString::number( nTypeSel ));
598 }
599 
601 {
602  const sal_Int32 nLen = m_xNameED->get_text().getLength();
603 
604  bool bEnable = true;
605  SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
606 
607  if( SwFieldTypesEnum::CombinedChars == nTypeId &&
608  (!nLen || nLen > MAX_COMBINED_CHARACTERS ))
609  bEnable = false;
610 
611  EnableInsert( bEnable );
612 }
613 
614 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Button > m_xListRemovePB
Definition: fldfunc.hxx:57
IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView &, void)
Definition: fldfunc.cxx:193
void RestorePos(weld::TreeView &rLst1)
Definition: fldpage.cxx:285
void ListModifyHdl(const weld::Widget *)
Definition: fldfunc.cxx:412
void SetUserData(const OUString &rString)
std::unique_ptr< weld::Button > m_xListDownPB
Definition: fldfunc.hxx:59
virtual sal_uInt16 GetGroup() override
Definition: fldfunc.cxx:586
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:403
std::unique_ptr< weld::TreeView > m_xTypeLB
Definition: fldfunc.hxx:35
sal_uIntPtr sal_uLong
SwWrtShell * GetActiveWrtShell()
Definition: swmodul1.cxx:108
std::unique_ptr< weld::Label > m_xNameFT
Definition: fldfunc.hxx:39
static const OUString & GetTypeStr(sal_uInt16 nPos)
Definition: fldmgr.cxx:532
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
sal_uLong nOldFormat
Definition: fldfunc.hxx:32
std::unique_ptr< weld::Label > m_xValueFT
Definition: fldfunc.hxx:42
static sal_uInt16 GetPos(SwFieldTypesEnum nTypeId)
Definition: fldmgr.cxx:554
IMPL_LINK(SwFieldFuncPage, ListModifyButtonHdl, weld::Button &, rControl, void)
Definition: fldfunc.cxx:401
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: fldfunc.cxx:517
Used by the UI to modify the document model.
Definition: wrtsh.hxx:96
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
virtual OUString GetPar1() const
Definition: fldbas.cxx:321
SwFieldMgr & GetFieldMgr()
Definition: fldpage.hxx:81
void SetMacroPath(const OUString &rPath)
Definition: fldmgr.cxx:1833
static SwFieldTypesEnum GetTypeId(sal_uInt16 nPos)
Definition: fldmgr.cxx:526
sal_uInt16 nEnd
Definition: fldmgr.hxx:63
std::unique_ptr< ConditionEdit > m_xCond1ED
Definition: fldfunc.hxx:45
void UpdateSubType()
Definition: fldfunc.cxx:474
virtual ~SwFieldFuncPage() override
Definition: fldfunc.cxx:91
int nCount
#define MAX_COMBINED_CHARACTERS
Definition: docufld.hxx:737
const OUString & GetSelectedItem() const
Returns the selected item.
const OUString & GetUserData() const
bool IsFieldDlgHtmlMode() const
Definition: fldpage.hxx:49
OUString m_sOldValueFT
Definition: fldfunc.hxx:29
std::unique_ptr< weld::TreeView > m_xListItemsLB
Definition: fldfunc.hxx:56
void FillFieldSelect(weld::TreeView &rListBox)
Definition: flddinf.cxx:47
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
virtual void Reset(const SfxItemSet *rSet) override
Definition: fldfunc.cxx:95
void EnableInsert(bool bEnable)
Definition: fldpage.cxx:317
const OUString & GetMacroPath() const
Definition: fldmgr.hxx:144
int i
void SavePos(const weld::TreeView &rLst1)
Definition: fldpage.cxx:275
SwFieldFuncPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *pSet)
Definition: fldfunc.cxx:36
#define USER_DATA_VERSION_1
Definition: fldfunc.cxx:31
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: fldfunc.cxx:580
SwFieldTypesEnum
List of FieldTypes at UI.
Definition: fldbas.hxx:94
void Init()
Definition: fldpage.cxx:64
bool IsRefresh() const
Definition: fldpage.hxx:50
#define USER_DATA_VERSION
Definition: fldfunc.cxx:32
float u
std::unique_ptr< ConditionEdit > m_xNameED
Definition: fldfunc.hxx:40
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
std::unique_ptr< weld::Entry > m_xListNameED
Definition: fldfunc.hxx:61
sal_Int32 GetTypeSel() const
Definition: fldpage.hxx:45
std::unique_ptr< weld::TreeView > m_xFormatLB
Definition: fldfunc.hxx:38
SwField * GetCurField()
Definition: fldpage.hxx:51
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
#define DB_DELIM
Definition: swtypes.hxx:130
#define FIELD_COLUMN_WIDTH
Definition: fldpage.hxx:25
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
Dropdown field.
Definition: flddropdown.hxx:58
sal_uInt16 nStart
Definition: fldmgr.hxx:62
std::unique_ptr< ConditionEdit > m_xCond2ED
Definition: fldfunc.hxx:47
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:257
const TranslateId FMT_MARK_ARY[]
Definition: fldfunc.cxx:184
std::unique_ptr< weld::Button > m_xMacroBT
Definition: fldfunc.hxx:48
virtual OUString GetPar2() const override
Returns the name of the field.
Definition: flddropdown.cxx:88
std::unique_ptr< weld::Entry > m_xListItemED
Definition: fldfunc.hxx:53
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
std::unique_ptr< weld::Entry > m_xValueED
Definition: fldfunc.hxx:43
OUString ChooseMacro(weld::Window *pParent, const css::uno::Reference< css::frame::XModel > &rxLimitToDocument, const css::uno::Reference< css::frame::XFrame > &xDocFrame, bool bChooseOnly)
std::unique_ptr< weld::TreeView > m_xSelectionLB
Definition: fldfunc.hxx:36
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2552
OUString aName
std::unique_ptr< weld::Widget > m_xValueGroup
Definition: fldfunc.hxx:41
OUString m_sOldNameFT
Definition: fldfunc.hxx:30
sal_Int32 getToken(const Context &rContext, const char *pToken)
std::unique_ptr< weld::Button > m_xListAddPB
Definition: fldfunc.hxx:54
bool IsFieldEdit() const
Definition: fldpage.hxx:62
bool bDropDownLBChanged
Definition: fldfunc.hxx:33
static const SwFieldGroupRgn & GetGroupRange(bool bHtmlMode, sal_uInt16 nGrpId)
Definition: fldmgr.cxx:470
std::unique_ptr< weld::Button > m_xListUpPB
Definition: fldfunc.hxx:58
virtual void FillUserData() override
Definition: fldfunc.cxx:591
css::uno::Sequence< OUString > GetItemSequence() const
Returns the items of the dropdown box.
bool m_bDetectedRangeSegmentation false
void GetSubTypes(SwFieldTypesEnum nId, std::vector< OUString > &rToFill)
Definition: fldmgr.cxx:573