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