LibreOffice Module sw (master)  1
fldvar.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 <sfx2/linkmgr.hxx>
23 #include <usrfld.hxx>
24 #include <docufld.hxx>
25 #include <expfld.hxx>
26 #include <ddefld.hxx>
27 #include <view.hxx>
28 #include <wrtsh.hxx>
29 #include <doc.hxx>
30 #include <docary.hxx>
31 #include <swmodule.hxx>
32 #include "fldvar.hxx"
33 #include "flddinf.hxx"
34 #include <calc.hxx>
35 #include <svl/zformat.hxx>
36 #include <globals.hrc>
37 #include <strings.hrc>
38 
39 #define USER_DATA_VERSION_1 "1"
40 #define USER_DATA_VERSION USER_DATA_VERSION_1
41 
43  : SwFieldPage(pParent, "modules/swriter/ui/fldvarpage.ui", "FieldVarPage", pCoreSet)
44  , m_xTypeLB(m_xBuilder->weld_tree_view("type"))
45  , m_xSelection(m_xBuilder->weld_widget("selectframe"))
46  , m_xSelectionLB(m_xBuilder->weld_tree_view("select"))
47  , m_xNameFT(m_xBuilder->weld_label("nameft"))
48  , m_xNameED(m_xBuilder->weld_entry("name"))
49  , m_xValueFT(m_xBuilder->weld_label("valueft"))
50  , m_xValueED(new ConditionEdit(m_xBuilder->weld_entry("value")))
51  , m_xFormat(m_xBuilder->weld_widget("formatframe"))
52  , m_xNumFormatLB(new SwNumFormatTreeView(m_xBuilder->weld_tree_view("numformat")))
53  , m_xFormatLB(m_xBuilder->weld_tree_view("format"))
54  , m_xChapterFrame(m_xBuilder->weld_widget("chapterframe"))
55  , m_xChapterLevelLB(m_xBuilder->weld_combo_box("level"))
56  , m_xInvisibleCB(m_xBuilder->weld_check_button("invisible"))
57  , m_xSeparatorFT(m_xBuilder->weld_label("separatorft"))
58  , m_xSeparatorED(m_xBuilder->weld_entry("separator"))
59  , m_xNewPB(m_xBuilder->weld_button("apply"))
60  , m_xDelPB(m_xBuilder->weld_button("delete"))
61  , nOldFormat(0)
62  , bInit(true)
63 {
65  m_xSelectionLB->make_sorted();
67 
68  auto nWidth = LogicToPixel(Size(FIELD_COLUMN_WIDTH, 0), MapMode(MapUnit::MapAppFont)).Width();
69  auto nHeight = m_xTypeLB->get_height_rows(20);
70  m_xTypeLB->set_size_request(nWidth, nHeight);
71  m_xSelectionLB->set_size_request(nWidth, nHeight);
72  m_xFormatLB->set_size_request(nWidth, nHeight/2);
73 
74  sOldValueFT = m_xValueFT->get_label();
75  sOldNameFT = m_xNameFT->get_label();
76 
77  for (sal_uInt16 i = 1; i <= MAXLEVEL; i++)
78  m_xChapterLevelLB->append_text(OUString::number(i));
79 
80  m_xChapterLevelLB->set_active(0);
81  //enable 'active' language selection
82  m_xNumFormatLB->SetShowLanguageControl(true);
83 }
84 
86 {
87  disposeOnce();
88 }
89 
91 {
93 
94  Init(); // general initialisation
95 
96  m_xTypeLB->freeze();
97  m_xTypeLB->clear();
98 
99  sal_uInt16 nTypeId;
100 
101  if (!IsFieldEdit())
102  {
103  // initialise TypeListBox
105 
106  for (short i = rRg.nStart; i < rRg.nEnd; ++i)
107  {
108  nTypeId = SwFieldMgr::GetTypeId(i);
109  m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(i));
110  }
111  }
112  else
113  {
114  const SwField* pCurField = GetCurField();
115  assert(pCurField && "<SwFieldVarPage::Reset(..)> - <SwField> instance missing!");
116  nTypeId = pCurField->GetTypeId();
117  if (nTypeId == TYP_SETINPFLD)
118  nTypeId = TYP_INPUTFLD;
119  m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
120  m_xNumFormatLB->SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
121  SwWrtShell *pSh = GetWrtShell();
122  if(!pSh)
123  pSh = ::GetActiveWrtShell();
124  if(pSh)
125  {
126  const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
127  if(pFormat)
128  m_xNumFormatLB->SetLanguage(pFormat->GetLanguage());
129  }
130  }
131 
132  m_xTypeLB->thaw();
133 
134  // select old Pos
136 
137  m_xTypeLB->connect_row_activated(LINK(this, SwFieldVarPage, TreeViewInsertHdl));
138  m_xTypeLB->connect_changed(LINK(this, SwFieldVarPage, TypeHdl));
139  m_xSelectionLB->connect_changed(LINK(this, SwFieldVarPage, SubTypeListBoxHdl));
140  m_xSelectionLB->connect_row_activated(LINK(this, SwFieldVarPage, SubTypeInsertHdl));
141  m_xFormatLB->connect_row_activated(LINK(this, SwFieldVarPage, TreeViewInsertHdl));
142  m_xNumFormatLB->connect_row_activated(LINK(this, SwFieldVarPage, TreeViewInsertHdl));
143  m_xNameED->connect_changed(LINK(this, SwFieldVarPage, ModifyHdl));
144  m_xValueED->connect_changed(LINK(this, SwFieldVarPage, ModifyHdl));
145  m_xNewPB->connect_clicked(LINK(this, SwFieldVarPage, TBClickHdl));
146  m_xDelPB->connect_clicked(LINK(this, SwFieldVarPage, TBClickHdl));
147  m_xChapterLevelLB->connect_changed(LINK(this, SwFieldVarPage, ChapterHdl));
148  m_xSeparatorED->connect_changed(LINK(this, SwFieldVarPage, SeparatorHdl));
149 
150  if( !IsRefresh() )
151  {
152  OUString sUserData = GetUserData();
153  sal_Int32 nIdx{ 0 };
154  if(!IsRefresh() && sUserData.getToken(0, ';', nIdx).equalsIgnoreAsciiCase(USER_DATA_VERSION_1))
155  {
156  OUString sVal = sUserData.getToken(0, ';', nIdx);
157  sal_uInt16 nVal = static_cast<sal_uInt16>(sVal.toInt32());
158  if (USHRT_MAX != nVal)
159  {
160  for (sal_Int32 i = 0, nEntryCount = m_xTypeLB->n_children(); i < nEntryCount; i++)
161  {
162  if (nVal == m_xTypeLB->get_id(i).toUInt32())
163  {
164  m_xTypeLB->select(i);
165  break;
166  }
167  }
168  }
169  }
170  }
171  TypeHdl(*m_xTypeLB);
172 
173  if (IsFieldEdit())
174  {
175  m_xSelectionLB->save_value();
176  m_xFormatLB->save_value();
177  nOldFormat = m_xNumFormatLB->GetFormat();
178  m_xNameED->save_value();
179  m_xValueED->save_value();
180  m_xInvisibleCB->save_state();
181  m_xChapterLevelLB->save_value();
182  m_xSeparatorED->save_value();
183  }
184 }
185 
187 {
188  // save old ListBoxPos
189  const sal_Int32 nOld = GetTypeSel();
190 
191  // current ListBoxPos
192  SetTypeSel(m_xTypeLB->get_selected_index());
193 
194  if(GetTypeSel() == -1)
195  {
196  SetTypeSel(0);
197  m_xTypeLB->select(0);
198  }
199 
200  if (nOld != GetTypeSel() || nOld == -1)
201  {
202  bInit = true;
203  if (nOld != -1)
204  {
205  m_xNameED->set_text(OUString());
206  m_xValueED->set_text(OUString());
207  }
208 
209  m_xValueED->SetDropEnable(false);
210  UpdateSubType(); // initialise selection-listboxes
211  }
212 
213  bInit = false;
214 }
215 
216 IMPL_LINK( SwFieldVarPage, SubTypeListBoxHdl, weld::TreeView&, rBox, void )
217 {
218  SubTypeHdl(&rBox);
219 }
220 
222 {
223  sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
224  sal_Int32 nSelPos = m_xSelectionLB->get_selected_index();
225  size_t nSelData = SIZE_MAX;
226 
227  if (nSelPos != -1)
228  nSelData = m_xSelectionLB->get_id(nSelPos).toUInt32();
229 
230  if (IsFieldEdit() && (!pBox || bInit))
231  {
232  if (nTypeId != TYP_FORMELFLD)
233  m_xNameED->set_text(GetFieldMgr().GetCurFieldPar1());
234 
235  m_xValueED->set_text(GetFieldMgr().GetCurFieldPar2());
236  }
237 
238  if (m_xNameFT->get_label() != sOldNameFT)
239  m_xNameFT->set_label(sOldNameFT);
240  if (m_xValueFT->get_label() != sOldValueFT)
241  m_xValueFT->set_label(sOldValueFT);
242 
243  FillFormatLB(nTypeId);
244 
245  sal_Int32 nSize = m_xFormatLB->n_children();
246 
247  bool bValue = false, bName = false, bNumFormat = false,
248  bInvisible = false, bShowChapterFrame = false;
249  bool bFormat = nSize != 0;
250 
251  switch (nTypeId)
252  {
253  case TYP_USERFLD:
254  {
255  // change or create user type
256  SwUserFieldType* pType = static_cast<SwUserFieldType*>(
258 
259  if (pType)
260  {
261  if (!IsFieldEdit())
262  {
263  if (pBox || (bInit && !IsRefresh())) // only when interacting via mouse
264  {
265  m_xNameED->set_text(pType->GetName());
266 
267  if (pType->GetType() == UF_STRING)
268  {
269  m_xValueED->set_text(pType->GetContent());
270  m_xNumFormatLB->select(0);
271  }
272  else
273  m_xValueED->set_text(pType->GetContent());
274  }
275  }
276  else
277  m_xValueED->set_text(pType->GetContent());
278  }
279  else
280  {
281  if (pBox) // only when interacting via mouse
282  {
283  m_xNameED->set_text(OUString());
284  m_xValueED->set_text(OUString());
285  }
286  }
287  bValue = bName = bNumFormat = bInvisible = true;
288 
289  m_xValueED->SetDropEnable(true);
290  break;
291  }
292 
293  case TYP_SETFLD:
294  bValue = true;
295 
296  bNumFormat = bInvisible = true;
297 
298  if (!IsFieldDlgHtmlMode())
299  bName = true;
300  else
301  {
302  m_xNumFormatLB->clear();
303  m_xNumFormatLB->append(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND), SwResId(FMT_SETVAR_TEXT));
304  m_xNumFormatLB->select(0);
305  }
306  // is there a corresponding SetField
307  if (IsFieldEdit() || pBox) // only when interacting via mouse
308  {
309  if (nSelPos != -1)
310  {
311  OUString sName(m_xSelectionLB->get_selected_text());
312  m_xNameED->set_text(sName);
313 
314  if (!IsFieldDlgHtmlMode())
315  {
316  SwWrtShell *pSh = GetWrtShell();
317  if(!pSh)
318  pSh = ::GetActiveWrtShell();
319  if(pSh)
320  {
321  SwSetExpFieldType* pSetTyp = static_cast<SwSetExpFieldType*>(
323 
324  if (pSetTyp && pSetTyp->GetType() == nsSwGetSetExpType::GSE_STRING)
325  m_xNumFormatLB->select(0); // textual
326  }
327  }
328  }
329  }
330  if (GetCurField() != nullptr && IsFieldEdit())
331  {
332  // GetFormula leads to problems with date formats because
333  // only the numeric value without formatting is returned.
334  // It must be used though because otherwise in GetPar2 only
335  // the value calculated by Kalkulator would be displayed
336  // (instead of test2 = test + 1)
337  m_xValueED->set_text(static_cast<SwSetExpField*>(GetCurField())->GetFormula());
338  }
339  m_xValueED->SetDropEnable(true);
340  break;
341 
342  case TYP_FORMELFLD:
343  {
344  bValue = true;
345  bNumFormat = true;
346  m_xValueFT->set_label(SwResId(STR_FORMULA));
347  m_xValueED->SetDropEnable(true);
348  }
349  break;
350 
351  case TYP_GETFLD:
352  {
353  if (!IsFieldEdit())
354  {
355  m_xNameED->set_text(OUString());
356  m_xValueED->set_text(OUString());
357  }
358 
359  if (nSelPos != -1)
360  {
361  OUString sName(m_xSelectionLB->get_selected_text());
362  if (!IsFieldEdit())
363  m_xNameED->set_text(sName);
364 
365  // is there a corresponding SetField
366  SwWrtShell *pSh = GetWrtShell();
367  if(!pSh)
368  pSh = ::GetActiveWrtShell();
369  if(pSh)
370  {
371  SwSetExpFieldType* pSetTyp = static_cast<SwSetExpFieldType*>(
373 
374  if(pSetTyp)
375  {
376  if (pSetTyp->GetType() & nsSwGetSetExpType::GSE_STRING) // textual?
377  bFormat = true;
378  else // numeric
379  bNumFormat = true;
380  }
381  }
382  }
383  else
384  bFormat = false;
385 
386  EnableInsert(bFormat || bNumFormat);
387  }
388  break;
389 
390  case TYP_INPUTFLD:
391  m_xValueFT->set_label(SwResId(STR_PROMPT));
392 
393  if (nSelPos != -1)
394  {
395  bValue = bNumFormat = true;
396 
397  OUString sName = m_xSelectionLB->get_selected_text();
398  m_xNameED->set_text( sName );
399 
400  // User- or SetField ?
401  const sal_uInt16 nInpType = static_cast< sal_uInt16 >
403 
404  if (nInpType) // SETEXPFLD
405  {
406  // is there a corresponding SetField
407  SwSetExpFieldType* pSetTyp = static_cast<SwSetExpFieldType*>(
409 
410  if(pSetTyp)
411  {
412  if (pSetTyp->GetType() == nsSwGetSetExpType::GSE_STRING) // textual?
413  {
414  m_xNumFormatLB->clear();
415  m_xNumFormatLB->append(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND), SwResId(FMT_USERVAR_TEXT));
416  m_xNumFormatLB->select(0);
417  }
418  }
419  if (GetCurField() && IsFieldEdit() && (!pBox || bInit) )
420  m_xValueED->set_text(static_cast<SwSetExpField*>(GetCurField())->GetPromptText());
421  }
422  else // USERFLD
423  bFormat = bNumFormat = false;
424  }
425  break;
426 
427  case TYP_DDEFLD:
428  m_xValueFT->set_label(SwResId(STR_DDE_CMD));
429 
430  if (IsFieldEdit() || pBox) // only when interacting via mouse
431  {
432  if (nSelPos != -1)
433  {
434  SwDDEFieldType* pType =
435  static_cast<SwDDEFieldType*>( GetFieldMgr().GetFieldType(SwFieldIds::Dde, nSelData) );
436 
437  if(pType)
438  {
439  m_xNameED->set_text(pType->GetName());
440 
441  //JP 28.08.95: DDE-Topics/-Items can have blanks in their names!
442  // That's not considered here yet
443  OUString sCmd( pType->GetCmd() );
444  sal_Int32 nTmpPos = 0;
445  sCmd = sCmd.replaceFirst( OUStringLiteral1(sfx2::cTokenSeparator), " ", &nTmpPos );
446  sCmd = sCmd.replaceFirst( OUStringLiteral1(sfx2::cTokenSeparator), " ", &nTmpPos );
447 
448  m_xValueED->set_text( sCmd );
449  m_xFormatLB->select(static_cast<int>(pType->GetType()));
450  }
451  }
452  }
453  bName = bValue = true;
454  break;
455 
456  case TYP_SEQFLD:
457  {
458  bName = bValue = bShowChapterFrame = true;
459 
460  SwFieldType* pFieldTyp;
461  if( GetCurField() && IsFieldEdit() )
462  pFieldTyp = GetCurField()->GetTyp();
463  else
464  {
465  OUString sFieldTypeName(m_xSelectionLB->get_text(nSelPos));
466  if( !sFieldTypeName.isEmpty() )
468  sFieldTypeName );
469  else
470  pFieldTyp = nullptr;
471  }
472 
473  if( GetCurField() && IsFieldEdit() )
474  m_xValueED->set_text( static_cast<SwSetExpField*>(GetCurField())->
475  GetFormula() );
476 
477  if( IsFieldEdit() || pBox ) // only when interacting via mouse
478  m_xNameED->set_text( m_xSelectionLB->get_selected_text() );
479 
480  if( pFieldTyp )
481  {
482  sal_uInt8 nLevel = static_cast<SwSetExpFieldType*>(pFieldTyp)->GetOutlineLvl();
483  if( 0x7f == nLevel )
484  m_xChapterLevelLB->set_active(0);
485  else
486  m_xChapterLevelLB->set_active(nLevel + 1);
487  OUString sDelim = static_cast<SwSetExpFieldType*>(pFieldTyp)->GetDelimiter();
488  m_xSeparatorED->set_text( sDelim );
489  ChapterHdl(*m_xChapterLevelLB);
490  }
491  }
492  break;
493 
494  case TYP_SETREFPAGEFLD:
495  {
496  bValue = false;
497  m_xValueFT->set_label( SwResId( STR_OFFSET ));
498 
499  if (IsFieldEdit() || pBox) // only when interacting via mouse
500  m_xNameED->set_text(OUString());
501 
502  if (nSelData != 0 && nSelData != SIZE_MAX)
503  {
504  bValue = true; // SubType OFF - knows no Offset
505  if (GetCurField() && IsFieldEdit())
506  m_xValueED->set_text(OUString::number(static_cast<SwRefPageSetField*>(GetCurField())->GetOffset()));
507  }
508  }
509  break;
510 
511  case TYP_GETREFPAGEFLD:
512  m_xNameED->set_text(OUString());
513  m_xValueED->set_text(OUString());
514  break;
515  }
516 
517  m_xNumFormatLB->set_visible(bNumFormat);
518  m_xFormatLB->set_visible(!bNumFormat);
519 
520  if (IsFieldEdit())
521  bName = false;
522 
523  m_xFormat->set_sensitive(bFormat || bNumFormat);
524  m_xNameFT->set_sensitive(bName);
525  m_xNameED->set_sensitive(bName);
526  m_xValueFT->set_sensitive(bValue);
527  m_xValueED->set_sensitive(bValue);
528 
529  m_xInvisibleCB->set_visible(!bShowChapterFrame);
530  m_xChapterFrame->set_visible(bShowChapterFrame);
531  m_xInvisibleCB->set_sensitive(bInvisible);
532 
533  ModifyHdl(*m_xNameED); // apply/insert/delete status update
534 }
535 
536 IMPL_LINK(SwFieldVarPage, SubTypeInsertHdl, weld::TreeView&, rBox, void)
537 {
538  if (!bInit)
539  {
540  sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
541  if (nTypeId == TYP_FORMELFLD)
542  {
543  auto nSelPos = m_xSelectionLB->get_selected_index();
544  if (nSelPos != -1)
545  {
546  m_xValueED->replace_selection(m_xSelectionLB->get_text(nSelPos));
547  ModifyHdl(*m_xNameED);
548  return;
549  }
550  }
551  }
552  TreeViewInsertHdl(rBox);
553 }
554 
555 // renew types in SelectionBox
557 {
558  SetSelectionSel(m_xSelectionLB->get_selected_index());
559 
560  OUString sOldSel;
561  if (GetSelectionSel() != -1)
562  sOldSel = m_xSelectionLB->get_text(GetSelectionSel());
563 
564  // fill Selection-Listbox
565  m_xSelectionLB->freeze();
566  m_xSelectionLB->clear();
567 
568  const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
569  std::vector<OUString> aList;
570  GetFieldMgr().GetSubTypes(nTypeId, aList);
571  const size_t nCount = aList.size();
572  for (size_t i = 0; i < nCount; ++i)
573  {
574  if (nTypeId != TYP_INPUTFLD || i)
575  {
576  if (!IsFieldEdit())
577  {
578  m_xSelectionLB->append(OUString::number(i), aList[i]);
579  }
580  else
581  {
582  bool bInsert = false;
583 
584  switch (nTypeId)
585  {
586  case TYP_INPUTFLD:
587  if (GetCurField() && aList[i] == GetCurField()->GetPar1())
588  bInsert = true;
589  break;
590 
591  case TYP_FORMELFLD:
592  bInsert = true;
593  break;
594 
595  case TYP_GETFLD:
596  if (GetCurField() && aList[i] == static_cast<const SwFormulaField*>(GetCurField())->GetFormula())
597  bInsert = true;
598  break;
599 
600  case TYP_SETFLD:
601  case TYP_USERFLD:
602  if (GetCurField() && aList[i] == GetCurField()->GetTyp()->GetName())
603  {
604  bInsert = true;
605  if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE)
606  m_xInvisibleCB->set_active(true);
607  }
608  break;
609 
610  case TYP_SETREFPAGEFLD:
611  {
612  if (GetCurField() != nullptr
613  && ((static_cast<SwRefPageSetField*>(GetCurField())->IsOn()
614  && i) || (!static_cast<SwRefPageSetField*>(GetCurField())
615  ->IsOn() && !i)))
616  {
617  sOldSel = aList[i];
618  }
619 
620  // allow all entries for selection:
621  m_xSelectionLB->append(OUString::number(i), aList[i]);
622  break;
623  }
624  default:
625  if (GetCurField() && aList[i] == GetCurField()->GetPar1())
626  bInsert = true;
627  break;
628  }
629 
630  if (bInsert)
631  {
632  m_xSelectionLB->append(OUString::number(i), aList[i]);
633  if (nTypeId != TYP_FORMELFLD)
634  break;
635  }
636  }
637  }
638  }
639 
640  m_xSelectionLB->thaw();
641 
642  const bool bEnable = m_xSelectionLB->n_children() != 0;
643  weld::TreeView* pLB = nullptr;
644 
645  if (bEnable)
646  {
647  int nIndex = m_xSelectionLB->find_text(sOldSel);
648  if (nIndex != -1)
649  m_xSelectionLB->select(nIndex);
650  else
651  {
652  m_xSelectionLB->select(0);
653  pLB = m_xSelectionLB.get(); // newly initialise all controls
654  }
655  }
656 
657  m_xSelection->set_sensitive(bEnable);
658 
659  SubTypeHdl(pLB);
660 }
661 
662 void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
663 {
664  OUString sOldSel;
665  const sal_Int32 nFormatSel = m_xFormatLB->get_selected_index();
666  if (nFormatSel != -1)
667  sOldSel = m_xFormatLB->get_text(nFormatSel);
668 
669  weld::TreeView& rWidget = dynamic_cast<weld::TreeView&>(m_xNumFormatLB->get_widget());
670 
671  OUString sOldNumSel;
672  sal_uInt32 nOldNumFormat = 0;
673  sal_Int32 nNumFormatSel = rWidget.get_selected_index();
674  if (nNumFormatSel != -1)
675  {
676  sOldNumSel = rWidget.get_text(nNumFormatSel);
677  nOldNumFormat = m_xNumFormatLB->GetFormat();
678  }
679 
680  // fill Format-Listbox
681  m_xFormatLB->freeze();
682  m_xFormatLB->clear();
683  rWidget.clear();
684  bool bSpecialFormat = false;
685 
686  if( TYP_GETREFPAGEFLD != nTypeId )
687  {
688  if (GetCurField() != nullptr && IsFieldEdit())
689  {
690  bSpecialFormat = GetCurField()->GetFormat() == NUMBERFORMAT_ENTRY_NOT_FOUND;
691 
692  if (!bSpecialFormat)
693  {
694  m_xNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
695  sOldNumSel.clear();
696  }
697  else if (nTypeId == TYP_GETFLD || nTypeId == TYP_FORMELFLD)
698  {
699  m_xNumFormatLB->SetFormatType(SvNumFormatType::NUMBER);
700  }
701  }
702  else
703  {
704  if (nOldNumFormat && nOldNumFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
705  m_xNumFormatLB->SetDefFormat(nOldNumFormat);
706  else
707  m_xNumFormatLB->SetFormatType(SvNumFormatType::NUMBER);
708  }
709  }
710 
711  switch (nTypeId)
712  {
713  case TYP_USERFLD:
714  {
715  if (!IsFieldEdit() || bSpecialFormat)
716  {
717  rWidget.append(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND), SwResId(FMT_MARK_TEXT));
718  rWidget.append(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND), SwResId(FMT_USERVAR_CMD));
719  }
720  }
721  break;
722 
723  case TYP_SETFLD:
724  {
725  if (!IsFieldEdit() || bSpecialFormat)
726  {
727  rWidget.append(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND), SwResId(FMT_SETVAR_TEXT));
728  }
729  }
730  break;
731 
732  case TYP_FORMELFLD:
733  {
734  rWidget.append(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND), SwResId(FMT_GETVAR_NAME));
735  }
736  break;
737 
738  case TYP_GETFLD:
739  {
740  rWidget.append(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND), SwResId(FMT_GETVAR_NAME));
741  }
742  break;
743  }
744 
745  if (IsFieldEdit() && bSpecialFormat)
746  {
747  if (nTypeId == TYP_USERFLD && (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_CMD))
748  rWidget.select(1);
749  else
750  rWidget.select(0);
751  }
752  else
753  {
754  if (!nOldNumFormat && (nNumFormatSel = rWidget.find_text(sOldNumSel)) != -1)
755  rWidget.select(nNumFormatSel);
756  else if (nOldNumFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
757  rWidget.select_text(sOldSel);
758  }
759 
760  const sal_uInt16 nSize = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
761 
762  OUString sSelectId;
763 
764  for (sal_uInt16 i = 0; i < nSize; i++)
765  {
766  const sal_uInt16 nFieldId = GetFieldMgr().GetFormatId( nTypeId, i );
767  OUString sId(OUString::number(nFieldId));
768  m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i));
769  if (IsFieldEdit() && GetCurField() && nFieldId == GetCurField()->GetFormat())
770  sSelectId = sId;
771  }
772 
773  m_xFormatLB->thaw();
774  if (!sSelectId.isEmpty())
775  m_xFormatLB->select_id(sSelectId);
776 
777  if (nSize && (!IsFieldEdit() || m_xFormatLB->get_selected_index() == -1))
778  {
779  int nIndex = m_xFormatLB->find_text(sOldSel);
780  if (nIndex == -1)
781  nIndex = m_xFormatLB->find_text(SwResId(FMT_NUM_PAGEDESC));
782  if (nIndex == -1)
783  nIndex = m_xFormatLB->find_text(SwResId(FMT_NUM_ARABIC));
784  if (nIndex == -1)
785  nIndex = 0;
786  m_xFormatLB->select(nIndex);
787  }
788 }
789 
790 // Modify
792 {
793  OUString sValue(m_xValueED->get_text());
794  bool bHasValue = !sValue.isEmpty();
795  const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
796  bool bInsert = false, bApply = false, bDelete = false;
797 
798  OUString sName( m_xNameED->get_text() );
799  sal_Int32 nLen = sName.getLength();
800 
801  switch( nTypeId )
802  {
803  case TYP_DDEFLD:
804  case TYP_USERFLD:
805  case TYP_SETFLD:
806  case TYP_SEQFLD:
808  if ( sName.getLength() != nLen )
809  {
810  nLen = sName.getLength();
811  int nStartPos, nEndPos;
812  m_xNameED->get_selection_bounds(nStartPos, nEndPos);
813  m_xNameED->set_text( sName );
814  m_xNameED->select_region(nStartPos, nEndPos); // restore Cursorpos
815  }
816  break;
817  }
818 
819  // check buttons
820  switch (nTypeId)
821  {
822  case TYP_DDEFLD:
823  if( nLen )
824  {
825  // is there already a corresponding type
826  bInsert = bApply = true;
827 
828  SwFieldType* pType = GetFieldMgr().GetFieldType(SwFieldIds::Dde, sName);
829 
830  SwWrtShell *pSh = GetWrtShell();
831  if(!pSh)
832  pSh = ::GetActiveWrtShell();
833  if(pSh && pType)
834  bDelete = !pSh->IsUsed( *pType );
835  }
836  break;
837 
838  case TYP_USERFLD:
839  if( nLen )
840  {
841  // is there already a corresponding type
842  SwFieldType* pType = GetFieldMgr().GetFieldType(SwFieldIds::User, sName);
843 
844  SwWrtShell *pSh = GetWrtShell();
845  if(!pSh)
846  pSh = ::GetActiveWrtShell();
847  if(pSh && pType)
848  bDelete = !pSh->IsUsed( *pType );
849 
850  pType = GetFieldMgr().GetFieldType(SwFieldIds::SetExp, sName);
851  if (!pType) // no name conflict with variables
852  {
853  // user fields can also be inserted without content!
854  // Bug #56845
855  bInsert = bApply = true;
856  }
857  }
858  break;
859 
860  default:
861  bInsert = true;
862 
863  if (nTypeId == TYP_SETFLD || nTypeId == TYP_SEQFLD)
864  {
865  SwSetExpFieldType* pFieldType = static_cast<SwSetExpFieldType*>(
866  GetFieldMgr().GetFieldType(SwFieldIds::SetExp, sName));
867 
868  if (pFieldType)
869  {
870 
871  SwWrtShell *pSh = GetWrtShell();
872  if(!pSh)
873  pSh = ::GetActiveWrtShell();
874  if(pSh)
875  {
877  sal_uInt16 i;
878 
879  for (i = 0; i < INIT_FLDTYPES; i++)
880  {
881  SwFieldType* pType = (*p)[ i ].get();
882  if (pType == pFieldType)
883  break;
884  }
885 
886  if (i >= INIT_FLDTYPES && !pSh->IsUsed(*pFieldType))
887  bDelete = true;
888 
889  if (nTypeId == TYP_SEQFLD && !(pFieldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
890  bInsert = false;
891 
892  if (nTypeId == TYP_SETFLD && (pFieldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
893  bInsert = false;
894  }
895  }
896  if (GetFieldMgr().GetFieldType(SwFieldIds::User, sName))
897  bInsert = false;
898  }
899 
900  if (!nLen && (nTypeId == TYP_SETFLD || nTypeId == TYP_INPUTFLD ||
901  (!IsFieldEdit() && nTypeId == TYP_GETFLD ) ) )
902  bInsert = false;
903 
904  if( (nTypeId == TYP_SETFLD || nTypeId == TYP_FORMELFLD) &&
905  !bHasValue )
906  bInsert = false;
907  break;
908  }
909 
910  m_xNewPB->set_sensitive(bApply);
911  m_xDelPB->set_sensitive(bDelete);
912  EnableInsert(bInsert);
913 }
914 
915 IMPL_LINK(SwFieldVarPage, TBClickHdl, weld::Button&, rBox, void)
916 {
917  const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
918 
919  if (&rBox == m_xDelPB.get())
920  {
921  if( nTypeId == TYP_USERFLD )
922  GetFieldMgr().RemoveFieldType(SwFieldIds::User, m_xSelectionLB->get_selected_text());
923  else
924  {
925  SwFieldIds nWhich;
926 
927  switch(nTypeId)
928  {
929  case TYP_SETFLD:
930  case TYP_SEQFLD:
931  nWhich = SwFieldIds::SetExp;
932  break;
933  default:
934  nWhich = SwFieldIds::Dde;
935  break;
936  }
937 
938  GetFieldMgr().RemoveFieldType(nWhich, m_xSelectionLB->get_selected_text());
939  }
940 
941  UpdateSubType();
942  SwWrtShell *pSh = GetWrtShell();
943  if(!pSh)
944  pSh = ::GetActiveWrtShell();
945  if(pSh)
946  {
947  pSh->SetModified();
948  }
949  }
950  else if (&rBox == m_xNewPB.get())
951  {
952  OUString sName(m_xNameED->get_text()), sValue(m_xValueED->get_text());
953  SwFieldType* pType = nullptr;
955  sal_Int32 nNumFormatPos = m_xNumFormatLB->get_selected_index();
956 
957  switch (nTypeId)
958  {
959  case TYP_USERFLD: nId = SwFieldIds::User; break;
960  case TYP_DDEFLD: nId = SwFieldIds::Dde; break;
961  case TYP_SETFLD: nId = SwFieldIds::SetExp;break;
962  }
963  pType = GetFieldMgr().GetFieldType(nId, sName);
964 
965  int nFormat = m_xFormatLB->get_selected_index();
966  if (nFormat != -1)
967  nFormat = m_xFormatLB->get_id(nFormat).toUInt32();
968 
969  if (pType) // change
970  {
971  SwWrtShell *pSh = GetWrtShell();
972  if(!pSh)
973  pSh = ::GetActiveWrtShell();
974  if(pSh)
975  {
976  pSh->StartAllAction();
977 
978  if (nTypeId == TYP_USERFLD)
979  {
980  if (nNumFormatPos != -1)
981  {
982  sal_uLong nNumberFormat = nNumFormatPos == 0 ? 0 : m_xNumFormatLB->GetFormat();
983  if (nNumberFormat)
984  { // Switch language to office-language because Kalkulator expects
985  // String in office format and it should be fed into dialog like
986  // that
987  nNumberFormat = SwValueField::GetSystemFormat(pSh->GetNumberFormatter(), nNumberFormat);
988  }
989  static_cast<SwUserFieldType*>(pType)->SetContent(m_xValueED->get_text(), nNumberFormat);
990  static_cast<SwUserFieldType*>(pType)->SetType(
992  }
993  }
994  else
995  {
996  if (nFormat != -1)
997  {
998  // DDE-Topics/-Items can have blanks in their names!
999  // That's not being considered here yet.
1000  sal_Int32 nTmpPos = 0;
1001  sValue = sValue.replaceFirst( " ", OUStringLiteral1(sfx2::cTokenSeparator), &nTmpPos );
1002  sValue = sValue.replaceFirst( " ", OUStringLiteral1(sfx2::cTokenSeparator), &nTmpPos );
1003  static_cast<SwDDEFieldType*>(pType)->SetCmd(sValue);
1004  static_cast<SwDDEFieldType*>(pType)->SetType(static_cast<SfxLinkUpdateMode>(nFormat));
1005  }
1006  }
1007  pType->UpdateFields();
1008 
1009  pSh->EndAllAction();
1010  }
1011  }
1012  else // new
1013  {
1014  if(nTypeId == TYP_USERFLD)
1015  {
1016  SwWrtShell *pSh = GetWrtShell();
1017  if(!pSh)
1018  pSh = ::GetActiveWrtShell();
1019  if(pSh)
1020  {
1021  SwUserFieldType aType( pSh->GetDoc(), sName );
1022 
1023  if (nNumFormatPos != -1)
1024  {
1026  aType.SetContent( sValue, nNumFormatPos == 0 ? 0 : m_xNumFormatLB->GetFormat() );
1027  m_xSelectionLB->append_text(sName);
1028  m_xSelectionLB->select_text(sName);
1029  GetFieldMgr().InsertFieldType( aType ); // Userfld new
1030  }
1031  }
1032  }
1033  else
1034  {
1035  if (nFormat != -1)
1036  {
1037  // DDE-Topics/-Items can have blanks in their names!
1038  // That's not being considered here yet.
1039  sal_Int32 nTmpPos = 0;
1040  sValue = sValue.replaceFirst( " ", OUStringLiteral1(sfx2::cTokenSeparator), &nTmpPos );
1041  sValue = sValue.replaceFirst( " ", OUStringLiteral1(sfx2::cTokenSeparator), &nTmpPos );
1042 
1043  SwDDEFieldType aType(sName, sValue, static_cast<SfxLinkUpdateMode>(nFormat));
1044  m_xSelectionLB->append_text(sName);
1045  m_xSelectionLB->select_text(sName);
1046  GetFieldMgr().InsertFieldType(aType); // DDE-Field new
1047  }
1048  }
1049  }
1050  if (IsFieldEdit())
1051  GetFieldMgr().GetCurField(); // update FieldManager
1052 
1053  UpdateSubType();
1054  }
1055 }
1056 
1058 {
1059  bool bEnable = m_xChapterLevelLB->get_active() != 0;
1060 
1061  m_xSeparatorED->set_sensitive(bEnable);
1062  m_xSeparatorFT->set_sensitive(bEnable);
1063  SeparatorHdl(*m_xSeparatorED);
1064 }
1065 
1067 {
1068  bool bEnable = !m_xSeparatorED->get_text().isEmpty() ||
1069  m_xChapterLevelLB->get_active() == 0;
1070  EnableInsert(bEnable);
1071 }
1072 
1074 {
1075  const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
1076 
1077  OUString aVal(m_xValueED->get_text());
1078  OUString aName(m_xNameED->get_text());
1079 
1080  const sal_Int32 nSubPos = m_xSelectionLB->get_selected_index();
1081  sal_uInt16 nSubType = (nSubPos == -1) ? 0 : m_xSelectionLB->get_id(nSubPos).toUInt32();
1082 
1083  sal_uInt32 nFormat;
1084 
1085  if (!m_xNumFormatLB->get_visible())
1086  {
1087  sal_Int32 nFormatPos = m_xFormatLB->get_selected_index();
1088 
1089  if(nFormatPos == -1)
1090  nFormat = 0;
1091  else
1092  nFormat = m_xFormatLB->get_id(nFormatPos).toUInt32();
1093  }
1094  else
1095  {
1096  nFormat = m_xNumFormatLB->GetFormat();
1097 
1098  if (nFormat && nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND && m_xNumFormatLB->IsAutomaticLanguage())
1099  {
1100  // Switch language to office language because Kalkulator expects
1101  // String in office format and it should be fed into the dialog
1102  // like that
1103  SwWrtShell *pSh = GetWrtShell();
1104  if(!pSh)
1105  pSh = ::GetActiveWrtShell();
1106  if(pSh)
1107  {
1108  nFormat = SwValueField::GetSystemFormat(pSh->GetNumberFormatter(), nFormat);
1109  }
1110  }
1111  }
1112  sal_Unicode cSeparator = ' ';
1113  switch (nTypeId)
1114  {
1115  case TYP_USERFLD:
1116  {
1118 
1119  if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND && m_xNumFormatLB->get_selected_text() == SwResId(FMT_USERVAR_CMD))
1120  nSubType |= nsSwExtendedSubType::SUB_CMD;
1121 
1122  if (m_xInvisibleCB->get_active())
1124  break;
1125  }
1126  case TYP_FORMELFLD:
1127  {
1128  nSubType = nsSwGetSetExpType::GSE_FORMULA;
1129  if (m_xNumFormatLB->get_visible() && nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
1130  nSubType |= nsSwExtendedSubType::SUB_CMD;
1131  break;
1132  }
1133  case TYP_GETFLD:
1134  {
1135  nSubType &= 0xff00;
1136  if (m_xNumFormatLB->get_visible() && nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
1137  nSubType |= nsSwExtendedSubType::SUB_CMD;
1138  break;
1139  }
1140  case TYP_INPUTFLD:
1141  {
1143  nSubType = static_cast< sal_uInt16 >((nSubType & 0xff00) | (pType ? INP_USR : INP_VAR));
1144  break;
1145  }
1146 
1147  case TYP_SETFLD:
1148  {
1149  if (IsFieldDlgHtmlMode())
1150  {
1151  nSubType = 0x0100;
1152  nSubType = (nSubType & 0xff00) | nsSwGetSetExpType::GSE_STRING;
1153  }
1154  else
1155  nSubType = (nSubType & 0xff00) | ((nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND) ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR);
1156 
1157  if (m_xInvisibleCB->get_active())
1159  break;
1160  }
1161  case TYP_SEQFLD:
1162  {
1163  nSubType = static_cast< sal_uInt16 >(m_xChapterLevelLB->get_active());
1164  if (nSubType == 0)
1165  nSubType = 0x7f;
1166  else
1167  {
1168  nSubType--;
1169  OUString sSeparator(m_xSeparatorED->get_text()[0]);
1170  cSeparator = !sSeparator.isEmpty() ? sSeparator[0] : ' ';
1171  }
1172  break;
1173  }
1174  case TYP_GETREFPAGEFLD:
1175  if( SVX_NUM_CHAR_SPECIAL == nFormat )
1176  aVal = m_xValueED->get_text();
1177  break;
1178  }
1179 
1180  if (!IsFieldEdit() ||
1181  m_xNameED->get_value_changed_from_saved() ||
1182  m_xValueED->get_value_changed_from_saved() ||
1183  m_xSelectionLB->get_value_changed_from_saved() ||
1184  m_xFormatLB->get_value_changed_from_saved() ||
1185  nOldFormat != m_xNumFormatLB->GetFormat() ||
1186  m_xInvisibleCB->get_state_changed_from_saved() ||
1187  m_xChapterLevelLB->get_value_changed_from_saved() ||
1188  m_xSeparatorED->get_value_changed_from_saved())
1189  {
1190  InsertField( nTypeId, nSubType, aName, aVal, nFormat,
1191  cSeparator, m_xNumFormatLB->IsAutomaticLanguage() );
1192  }
1193 
1194  UpdateSubType();
1195 
1196  return false;
1197 }
1198 
1200  const SfxItemSet *const pAttrSet)
1201 {
1202  return VclPtr<SwFieldVarPage>::Create( pParent, pAttrSet );
1203 }
1204 
1206 {
1207  return GRP_VAR;
1208 }
1209 
1211 {
1212  OUString sData(USER_DATA_VERSION);
1213  sData += ";";
1214  sal_Int32 nTypeSel = m_xTypeLB->get_selected_index();
1215  if( -1 == nTypeSel )
1216  nTypeSel = USHRT_MAX;
1217  else
1218  nTypeSel = m_xTypeLB->get_id(nTypeSel).toUInt32();
1219  sData += OUString::number( nTypeSel );
1220  SetUserData(sData);
1221 }
1222 
1223 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
Definition: edfld.cxx:68
SwFieldType * GetFieldType(SwFieldIds nResId, size_t nField=0) const
Definition: fldmgr.cxx:418
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:233
sal_uInt16 const nStart
Definition: fldmgr.hxx:62
The shared part of a user field.
Definition: usrfld.hxx:35
void RestorePos(weld::TreeView &rLst1)
Definition: fldpage.cxx:296
virtual OUString GetName() const override
Only in derived classes.
Definition: usrfld.cxx:216
virtual sal_uInt16 GetGroup() override
Definition: fldvar.cxx:1205
void SetUserData(const OUString &rString)
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:387
const SwExtendedSubType SUB_INVISIBLE
Invisible.
Definition: fldbas.hxx:205
sal_uInt16 GetType() const
Definition: usrfld.hxx:86
virtual void Reset(const SfxItemSet *rSet) override
Definition: fldvar.cxx:90
sal_uInt16 GetFormatId(sal_uInt16 nTypeId, sal_uInt32 nFormatId) const
Definition: fldmgr.cxx:774
std::unique_ptr< weld::TreeView > m_xTypeLB
Definition: fldvar.hxx:37
sal_uIntPtr sal_uLong
const sal_Unicode cTokenSeparator
Base class of all fields.
Definition: fldbas.hxx:279
SwWrtShell * GetActiveWrtShell()
Definition: swmodul1.cxx:115
virtual void FillUserData() override
Definition: fldvar.cxx:1210
SfxLinkUpdateMode GetType() const
Definition: ddefld.hxx:83
sal_uInt16 GetTypeId() const
Definition: fldbas.cxx:209
sal_Int16 nId
virtual void clear()=0
void SetModified()
Definition: edws.cxx:69
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: fldvar.cxx:1073
IMPL_LINK(SwFieldVarPage, SubTypeListBoxHdl, weld::TreeView &, rBox, void)
Definition: fldvar.cxx:216
void EndAllAction()
Definition: edws.cxx:96
For old documents the Field-Which IDs must be preserved !!!
OUString sOldValueFT
Definition: fldvar.hxx:55
std::unique_ptr< weld::Entry > m_xSeparatorED
Definition: fldvar.hxx:51
void UpdateFields() const
Definition: fldbas.hxx:271
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
OUString const & GetCmd() const
Definition: ddefld.cxx:233
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:389
static sal_uInt16 GetTypeId(sal_uInt16 nPos)
Definition: fldmgr.cxx:528
sal_uInt16 sal_Unicode
SwFieldMgr & GetFieldMgr()
Definition: fldpage.hxx:83
#define USER_DATA_VERSION_1
Definition: fldvar.cxx:39
std::unique_ptr< ConditionEdit > m_xValueED
Definition: fldvar.hxx:43
std::unique_ptr< weld::Label > m_xValueFT
Definition: fldvar.hxx:42
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND
sal_uInt16 GetFormatCount(sal_uInt16 nTypeId, bool bHtmlMode) const
Definition: fldmgr.cxx:677
void SetSelectionSel(sal_Int32 nSet)
Definition: fldpage.hxx:48
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
void UpdateSubType()
Definition: fldvar.cxx:556
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
bool IsFieldDlgHtmlMode() const
Definition: fldpage.hxx:49
std::unique_ptr< weld::TreeView > m_xFormatLB
Definition: fldvar.hxx:46
const SwGetSetExpType GSE_EXPR
Expression.
Definition: fldbas.hxx:196
sal_uInt32 nOldFormat
Definition: fldvar.hxx:58
void FillFieldSelect(weld::TreeView &rListBox)
Definition: flddinf.cxx:48
SVX_NUM_CHAR_SPECIAL
void FillFormatLB(sal_uInt16 nTypeId)
Definition: fldvar.cxx:662
std::unique_ptr< weld::ComboBox > m_xChapterLevelLB
Definition: fldvar.hxx:48
void GetSubTypes(sal_uInt16 nId, std::vector< OUString > &rToFill)
Definition: fldmgr.cxx:574
std::unique_ptr< weld::Button > m_xNewPB
Definition: fldvar.hxx:52
void EnableInsert(bool bEnable)
Definition: fldpage.cxx:327
const SwExtendedSubType SUB_CMD
Show command.
Definition: fldbas.hxx:204
void SavePos(const weld::TreeView &rLst1)
Definition: fldpage.cxx:286
virtual ~SwFieldVarPage() override
Definition: fldvar.cxx:85
sal_Int32 GetSelectionSel() const
Definition: fldpage.hxx:47
virtual int get_selected_index() const =0
OUString sName
int i
void Init()
Definition: fldpage.cxx:67
SwFieldIds
Definition: fldbas.hxx:38
bool IsRefresh() const
Definition: fldpage.hxx:50
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: fldvar.cxx:1199
bool IsUsed(const SwModify &) const
Query if the paragraph-/character-/frame-/page-style is used.
Definition: edfmt.cxx:141
std::unique_ptr< weld::Widget > m_xSelection
Definition: fldvar.hxx:38
sal_Int32 GetTypeSel() const
Definition: fldpage.hxx:45
virtual OUString get_text(int row, int col=-1) const =0
virtual const SwFieldTypes * GetFieldTypes() const =0
SwField * GetCurField()
Definition: fldpage.hxx:51
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
bool IsAutomaticLanguage() const
Definition: fldbas.hxx:369
#define FIELD_COLUMN_WIDTH
Definition: fldpage.hxx:25
void InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUString &rPar1, const OUString &rPar2, sal_uInt32 nFormatId, sal_Unicode cDelim= ' ', bool bIsAutomaticLanguage=true)
Definition: fldpage.cxx:121
virtual int find_text(const OUString &rText) const =0
sal_uInt16 const nEnd
Definition: fldmgr.hxx:63
SwFieldType * GetTyp() const
Definition: fldbas.hxx:382
static SW_DLLPUBLIC bool IsValidVarName(const OUString &rStr, OUString *pValidName=nullptr)
Definition: calc.cxx:1364
void SubTypeHdl(const weld::TreeView *)
Definition: fldvar.cxx:221
std::unique_ptr< weld::Widget > m_xChapterFrame
Definition: fldvar.hxx:47
#define INIT_FLDTYPES
Definition: swtypes.hxx:118
std::unique_ptr< weld::TreeView > m_xSelectionLB
Definition: fldvar.hxx:39
virtual void select(int pos)=0
SwWrtShell * GetWrtShell()
Definition: fldpage.hxx:52
const SwGetSetExpType GSE_SEQ
Sequence.
Definition: fldbas.hxx:197
const OUString & GetUserData()
void select_text(const OUString &rText)
std::unique_ptr< SwNumFormatTreeView > m_xNumFormatLB
Definition: fldvar.hxx:45
unsigned char sal_uInt8
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
static VclPtr< reference_type > Create(Arg &&...arg)
OUString sOldNameFT
Definition: fldvar.hxx:56
SwFieldVarPage(TabPageParent pParent, const SfxItemSet *pSet)
Definition: fldvar.cxx:42
const SwGetSetExpType GSE_FORMULA
Formula.
Definition: fldbas.hxx:198
OUString GetContent(sal_uInt32 nFormat=0)
Definition: usrfld.cxx:272
#define USER_DATA_VERSION
Definition: fldvar.cxx:40
std::unique_ptr< weld::Widget > m_xFormat
Definition: fldvar.hxx:44
void append(TreeIter *pRet=nullptr)
OString const aName
static OUString GetTypeStr(sal_uInt16 nPos)
Definition: fldmgr.cxx:534
static sal_uInt32 GetSystemFormat(SvNumberFormatter *pFormatter, sal_uInt32 nFormat)
get format in office language
Definition: fldbas.cxx:594
bool IsFieldEdit() const
Definition: fldpage.hxx:62
static sal_uInt16 GetPos(sal_uInt16 nTypeId)
Definition: fldmgr.cxx:556
std::unique_ptr< weld::Button > m_xDelPB
Definition: fldvar.hxx:53
const SwGetSetExpType GSE_STRING
String.
Definition: fldbas.hxx:195
sal_uInt16 GetType() const
Definition: expfld.hxx:194
static const SwFieldGroupRgn & GetGroupRange(bool bHtmlMode, sal_uInt16 nGrpId)
Definition: fldmgr.cxx:472
std::unique_ptr< weld::Label > m_xNameFT
Definition: fldvar.hxx:40
void StartAllAction()
For all views of this document.
Definition: edws.cxx:85
virtual OUString GetName() const override
Only in derived classes.
Definition: ddefld.cxx:217
std::unique_ptr< weld::Entry > m_xNameED
Definition: fldvar.hxx:41
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
Definition: editsh.cxx:750
void SetType(sal_uInt16)
Definition: usrfld.hxx:89
IMPL_LINK_NOARG(SwFieldVarPage, TypeHdl, weld::TreeView &, void)
Definition: fldvar.cxx:186
std::unique_ptr< weld::CheckButton > m_xInvisibleCB
Definition: fldvar.hxx:49
LanguageType GetLanguage() const
OUString sId