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