LibreOffice Module cui (master)  1
numfmt.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 <svl/eitem.hxx>
21 #include <svl/intitem.hxx>
22 #include <sfx2/objsh.hxx>
23 #include <vcl/svapp.hxx>
24 #include <vcl/settings.hxx>
25 #include <i18nlangtag/lang.h>
26 #include <svx/svxids.hrc>
27 #include <svtools/colorcfg.hxx>
28 
29 #include <numcategories.hrc>
30 #include <strings.hrc>
31 
32 #include <svx/numinf.hxx>
33 
34 #include <numfmt.hxx>
35 #include <svx/numfmtsh.hxx>
36 #include <dialmgr.hxx>
37 #include <sfx2/basedlgs.hxx>
38 #include <svx/flagsdef.hxx>
39 #include <vector>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <memory>
42 
43 using ::com::sun::star::uno::Reference;
44 using ::com::sun::star::lang::XServiceInfo;
45 using ::com::sun::star::uno::UNO_QUERY;
46 
47 #define NUMKEY_UNDEFINED SAL_MAX_UINT32
48 
49 // static ----------------------------------------------------------------
50 
51 const sal_uInt16 SvxNumberFormatTabPage::pRanges[] =
52 {
53  SID_ATTR_NUMBERFORMAT_VALUE,
54  SID_ATTR_NUMBERFORMAT_INFO,
55  SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
56  SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
57  SID_ATTR_NUMBERFORMAT_ONE_AREA,
58  SID_ATTR_NUMBERFORMAT_ONE_AREA,
59  SID_ATTR_NUMBERFORMAT_SOURCE,
60  SID_ATTR_NUMBERFORMAT_SOURCE,
61  0
62 };
63 
64 /*************************************************************************
65 #* Method: SvxNumberPreview
66 #*------------------------------------------------------------------------
67 #*
68 #* Class: SvxNumberPreview
69 #* Function: Constructor of the class SvxNumberPreview
70 #* Input: Window, Resource-ID
71 #* Output: ---
72 #*
73 #************************************************************************/
74 
76  : mnPos(-1)
77  , mnChar(0x0)
78 {
79 }
80 
81 /*************************************************************************
82 #* Method: NotifyChange
83 #*------------------------------------------------------------------------
84 #*
85 #* Class: SvxNumberPreview
86 #* Function: Function for changing the preview string
87 #* Input: String, color
88 #* Output: ---
89 #*
90 #************************************************************************/
91 
92 void SvxNumberPreview::NotifyChange( const OUString& rPrevStr,
93  const Color* pColor )
94 {
95  // detect and strip out '*' related placeholders
96  aPrevStr = rPrevStr;
97  mnPos = aPrevStr.indexOf( 0x1B );
98  if ( mnPos != -1 )
99  {
100  // Right during user input the star symbol is the very
101  // last character before the user enters another one.
102  if (mnPos < aPrevStr.getLength() - 1)
103  {
104  mnChar = aPrevStr[ mnPos + 1 ];
105  // delete placeholder and char to repeat
106  aPrevStr = aPrevStr.replaceAt( mnPos, 2, "" );
107  }
108  else
109  {
110  // delete placeholder
111  aPrevStr = aPrevStr.replaceAt( mnPos, 1, "" );
112  // do not attempt to draw a 0 fill character
113  mnPos = -1;
114  }
115  }
116  svtools::ColorConfig aColorConfig;
117  Color aWindowTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
118  aPrevCol = pColor ? *pColor : aWindowTextColor;
119  Invalidate();
120 }
121 
122 /*************************************************************************
123 #* Method: Paint
124 #*------------------------------------------------------------------------
125 #*
126 #* Class: SvxNumberPreview
127 #* Function: Function for repainting the window.
128 #* Input: ---
129 #* Output: ---
130 #*
131 #************************************************************************/
132 
133 void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
134 {
135  rRenderContext.Push(PushFlags::ALL);
136 
137  svtools::ColorConfig aColorConfig;
138  rRenderContext.SetTextColor(aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor);
139  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
140  rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
141 
142  vcl::Font aDrawFont = rRenderContext.GetFont();
143  Size aSzWnd(GetOutputSizePixel());
144  OUString aTmpStr( aPrevStr );
145  long nLeadSpace = (aSzWnd.Width() - rRenderContext.GetTextWidth(aTmpStr)) / 2;
146 
147  aDrawFont.SetTransparent(true);
148  aDrawFont.SetColor(aPrevCol);
149  rRenderContext.SetFont(aDrawFont);
150 
151  if (mnPos != -1)
152  {
153  long nCharWidth = rRenderContext.GetTextWidth(OUString(mnChar));
154 
155  int nNumCharsToInsert = 0;
156  if (nCharWidth > 0)
157  nNumCharsToInsert = nLeadSpace / nCharWidth;
158 
159  if (nNumCharsToInsert > 0)
160  {
161  for (int i = 0; i < nNumCharsToInsert; ++i)
162  aTmpStr = aTmpStr.replaceAt(mnPos, 0, OUString(mnChar));
163  }
164  }
165 
166  long nX = 0;
167  if (mnPos == -1 && nLeadSpace > 0) //tdf#122120 if it won't fit anyway, then left align it
168  {
169  nX = nLeadSpace;
170  }
171 
172  Point aPosText(nX, (aSzWnd.Height() - GetTextHeight()) / 2);
173  rRenderContext.DrawText(aPosText, aTmpStr);
174  rRenderContext.Pop();
175 }
176 
177 // class SvxNumberFormatTabPage ------------------------------------------
178 
179 #define REMOVE_DONTKNOW() \
180  if (!m_xFtLanguage->get_sensitive()) \
181  { \
182  m_xFtLanguage->set_sensitive(true); \
183  m_xLbLanguage->set_sensitive(true); \
184  m_xLbLanguage->set_active_id(pNumFmtShell->GetCurLanguage()); \
185  }
186 
187 #define HDL(hdl) LINK( this, SvxNumberFormatTabPage, hdl )
188 
190  const SfxItemSet& rCoreAttrs)
191  : SfxTabPage(pPage, pController, "cui/ui/numberingformatpage.ui", "NumberingFormatPage", &rCoreAttrs)
192  , nInitFormat(ULONG_MAX)
193  , bLegacyAutomaticCurrency(false)
194  , sAutomaticLangEntry(CuiResId(RID_SVXSTR_AUTO_ENTRY))
195  , m_xFtCategory(m_xBuilder->weld_label("categoryft"))
196  , m_xLbCategory(m_xBuilder->weld_tree_view("categorylb"))
197  , m_xFtFormat(m_xBuilder->weld_label("formatft"))
198  , m_xLbCurrency(m_xBuilder->weld_combo_box("currencylb"))
199  , m_xLbFormat(m_xBuilder->weld_tree_view("formatlb"))
200  , m_xFtLanguage(m_xBuilder->weld_label("languageft"))
201  , m_xCbSourceFormat(m_xBuilder->weld_check_button("sourceformat"))
202  , m_xFtOptions(m_xBuilder->weld_label("optionsft"))
203  , m_xFtDecimals(m_xBuilder->weld_label("decimalsft"))
204  , m_xEdDecimals(m_xBuilder->weld_spin_button("decimalsed"))
205  , m_xFtDenominator(m_xBuilder->weld_label("denominatorft"))
206  , m_xEdDenominator(m_xBuilder->weld_spin_button("denominatored"))
207  , m_xBtnNegRed(m_xBuilder->weld_check_button("negnumred"))
208  , m_xFtLeadZeroes(m_xBuilder->weld_label("leadzerosft"))
209  , m_xEdLeadZeroes(m_xBuilder->weld_spin_button("leadzerosed"))
210  , m_xBtnThousand(m_xBuilder->weld_check_button("thousands"))
211  , m_xBtnEngineering(m_xBuilder->weld_check_button("engineering"))
212  , m_xFormatCodeFrame(m_xBuilder->weld_widget("formatcode"))
213  , m_xEdFormat(m_xBuilder->weld_entry("formatted"))
214  , m_xIbAdd(m_xBuilder->weld_button("add"))
215  , m_xIbInfo(m_xBuilder->weld_button("edit"))
216  , m_xIbRemove(m_xBuilder->weld_button("delete"))
217  , m_xFtComment(m_xBuilder->weld_label("commentft"))
218  , m_xEdComment(m_xBuilder->weld_entry("commented"))
219  , m_xLbLanguage(new SvxLanguageBox(m_xBuilder->weld_combo_box("languagelb")))
220  , m_xWndPreview(new weld::CustomWeld(*m_xBuilder, "preview", m_aWndPreview))
221 {
222  for (size_t i = 0; i < SAL_N_ELEMENTS(NUM_CATEGORIES); ++i)
223  m_xLbCategory->append_text(CuiResId(NUM_CATEGORIES[i]));
224 
225  auto nWidth = m_xLbCategory->get_approximate_digit_width() * 22;
226  m_xLbCategory->set_size_request(nWidth, m_xLbCategory->get_height_rows(7));
227  m_xLbFormat->set_size_request(nWidth, m_xLbFormat->get_height_rows(5));
228  m_xLbCurrency->set_size_request(nWidth, -1); // force using (narrower) width of its LbFormat sibling
229 
230  // Initially remove the "Automatically" entry.
231  m_xLbCurrency->set_active(-1); // First ensure that nothing is selected.
232  sAutomaticCurrencyEntry = m_xLbCurrency->get_text(0);
233  m_xLbCurrency->remove(0);
234 
235  Init_Impl();
236  SetExchangeSupport(); // this page needs ExchangeSupport
237  nFixedCategory=-1;
238 }
239 
241 {
242  pNumFmtShell.reset();
243  pNumItem.reset();
244  m_xWndPreview.reset();
245  m_xLbLanguage.reset();
246 }
247 
249 {
250  bNumItemFlag=true;
251  bOneAreaFlag=false;
252 
253  m_xIbAdd->set_sensitive(false );
254  m_xIbRemove->set_sensitive(false );
255  m_xIbInfo->set_sensitive(false );
256 
257  m_xEdComment->set_text(m_xLbCategory->get_text(1)); // string for user defined
258 
259  m_xEdComment->hide();
260 
261  m_xCbSourceFormat->set_active( false );
262  m_xCbSourceFormat->set_sensitive(false);
263  m_xCbSourceFormat->hide();
264 
265  Link<weld::TreeView&,void> aLink2 = LINK(this, SvxNumberFormatTabPage, SelFormatTreeListBoxHdl_Impl);
266  Link<weld::ComboBox&,void> aLink3 = LINK(this, SvxNumberFormatTabPage, SelFormatListBoxHdl_Impl);
267  m_xLbCategory->connect_changed(aLink2);
268  m_xLbCategory->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
269  m_xLbFormat->connect_changed(aLink2);
270  m_xLbFormat->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
271  m_xLbLanguage->connect_changed(aLink3);
272  m_xLbLanguage->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
273  m_xLbCurrency->connect_changed(aLink3);
274  m_xLbCurrency->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
275  m_xCbSourceFormat->connect_clicked(LINK(this, SvxNumberFormatTabPage, SelFormatClickHdl_Impl));
276  m_xCbSourceFormat->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
277 
278  Link<weld::SpinButton&,void> aLink = LINK( this, SvxNumberFormatTabPage, OptEditHdl_Impl );
279 
280  m_xEdDecimals->connect_value_changed(aLink);
281  m_xEdDecimals->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
282  m_xEdDenominator->connect_value_changed(aLink);
283  m_xEdDenominator->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
284  m_xEdLeadZeroes->connect_value_changed(aLink);
285  m_xEdLeadZeroes->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
286 
287  m_xBtnNegRed->connect_clicked(LINK(this, SvxNumberFormatTabPage, OptClickHdl_Impl));
288  m_xBtnNegRed->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
289  m_xBtnThousand->connect_clicked(LINK(this, SvxNumberFormatTabPage, OptClickHdl_Impl));
290  m_xBtnThousand->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
291  m_xBtnEngineering->connect_clicked(LINK(this, SvxNumberFormatTabPage, OptClickHdl_Impl));
292  m_xBtnEngineering->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
293  m_xLbFormat->connect_row_activated(HDL(DoubleClickHdl_Impl));
294  m_xEdFormat->connect_changed(HDL(EditModifyHdl_Impl));
295  m_xEdFormat->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
296  m_xIbAdd->connect_clicked(HDL(ClickHdl_Impl));
297  m_xIbAdd->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
298  m_xIbRemove->connect_clicked(HDL(ClickHdl_Impl));
299  m_xIbRemove->connect_focus_in(LINK(this, SvxNumberFormatTabPage, LostFocusHdl_Impl));
300  m_xIbInfo->connect_clicked(HDL(ClickHdl_Impl));
303 
304  // initialize language ListBox
305 
306  m_xLbLanguage->SetLanguageList( SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN, false);
307  m_xLbLanguage->InsertLanguage( LANGUAGE_SYSTEM );
308 }
309 
310 std::unique_ptr<SfxTabPage> SvxNumberFormatTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
311  const SfxItemSet* rAttrSet )
312 {
313  return std::make_unique<SvxNumberFormatTabPage>(pPage, pController, *rAttrSet);
314 }
315 
316 
317 /*************************************************************************
318 #* Method: Reset
319 #*------------------------------------------------------------------------
320 #*
321 #* Class: SvxNumberFormatTabPage
322 #* Function: The dialog's attributes are reset
323 #* using the Itemset.
324 #* Input: SfxItemSet
325 #* Output: ---
326 #*
327 #************************************************************************/
328 
330 {
331  static_assert(SELPOS_NONE == -1, "SELPOS_NONE was -1 at time of writing");
332  if (nPos == 0 && !bLegacyAutomaticCurrency)
333  {
334  // Insert "Automatically" if currently used so it is selectable.
335  m_xLbCurrency->insert_text(0, sAutomaticCurrencyEntry);
337  }
338  if (nPos != -1 && !bLegacyAutomaticCurrency)
339  --nPos;
340  m_xLbCurrency->set_active(nPos);
341 }
342 
344 {
345  static_assert(SELPOS_NONE == -1, "SELPOS_NONE was -1 at time of writing");
346  sal_Int32 nCurrencyPos = m_xLbCurrency->get_active();
347  if (nCurrencyPos != -1 && !bLegacyAutomaticCurrency)
348  ++nCurrencyPos;
349  return nCurrencyPos;
350 }
351 
353 {
354  const SfxUInt32Item* pValFmtAttr = nullptr;
355  const SfxPoolItem* pItem = nullptr;
356  const SfxBoolItem* pAutoEntryAttr = nullptr;
357 
358  sal_uInt16 nCatLbSelPos = 0;
359  sal_uInt16 nFmtLbSelPos = 0;
360  LanguageType eLangType = LANGUAGE_DONTKNOW;
361  std::vector<OUString> aFmtEntryList;
362  SvxNumberValueType eValType = SvxNumberValueType::Undefined;
363  double nValDouble = 0;
364  OUString aValString;
365 
366  SfxItemState eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_NOLANGUAGE ),true,&pItem);
367 
368  if(eState==SfxItemState::SET)
369  {
370  const SfxBoolItem* pBoolLangItem = static_cast<const SfxBoolItem*>(
371  GetItem( *rSet, SID_ATTR_NUMBERFORMAT_NOLANGUAGE));
372 
373  if(pBoolLangItem!=nullptr && pBoolLangItem->GetValue())
374  {
375  HideLanguage();
376  }
377  else
378  {
379  HideLanguage(false);
380  }
381 
382  }
383 
384  eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_INFO ),true,&pItem);
385 
386  if(eState==SfxItemState::SET)
387  {
388  if(pNumItem==nullptr)
389  {
390  bNumItemFlag=true;
391  pNumItem.reset( static_cast<SvxNumberInfoItem *>(pItem->Clone()) );
392  }
393  else
394  {
395  bNumItemFlag=false;
396  }
397  }
398  else
399  {
400  bNumItemFlag=false;
401  }
402 
403 
404  eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ONE_AREA ));
405 
406  if(eState==SfxItemState::SET)
407  {
408  const SfxBoolItem* pBoolItem = static_cast<const SfxBoolItem*>(
409  GetItem( *rSet, SID_ATTR_NUMBERFORMAT_ONE_AREA));
410 
411  if(pBoolItem!=nullptr)
412  {
413  bOneAreaFlag= pBoolItem->GetValue();
414  }
415  }
416 
417  eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE ) );
418 
419  if ( eState == SfxItemState::SET )
420  {
421  const SfxBoolItem* pBoolItem = static_cast<const SfxBoolItem*>(
422  GetItem( *rSet, SID_ATTR_NUMBERFORMAT_SOURCE ));
423  if ( pBoolItem )
424  m_xCbSourceFormat->set_active(pBoolItem->GetValue());
425  else
426  m_xCbSourceFormat->set_active( false );
427  m_xCbSourceFormat->set_sensitive(true);
428  m_xCbSourceFormat->show();
429  }
430  else
431  {
432  bool bInit = false; // set to sal_True for debug test
433  m_xCbSourceFormat->set_active( bInit );
434  m_xCbSourceFormat->set_sensitive( bInit );
435  m_xCbSourceFormat->set_visible( bInit );
436  }
437 
438  // pNumItem must have been set from outside!
439  DBG_ASSERT( pNumItem, "No NumberInfo, no NumberFormatter, goodbye. CRASH. :-(" );
440 
441  eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ) );
442 
443  if ( SfxItemState::DONTCARE != eState )
444  pValFmtAttr = GetItem( *rSet, SID_ATTR_NUMBERFORMAT_VALUE );
445 
446  eValType = pNumItem->GetValueType();
447 
448  switch ( eValType )
449  {
450  case SvxNumberValueType::String:
451  aValString = pNumItem->GetValueString();
452  break;
453  case SvxNumberValueType::Number:
454  // #50441# string may be set in addition to the value
455  aValString = pNumItem->GetValueString();
456  nValDouble = pNumItem->GetValueDouble();
457  break;
458  case SvxNumberValueType::Undefined:
459  default:
460  break;
461  }
462 
463  pNumFmtShell.reset(); // delete old shell if applicable (== reset)
464 
465  nInitFormat = pValFmtAttr // memorize init key
466  ? pValFmtAttr->GetValue() // (for FillItemSet())
467  : ULONG_MAX; // == DONT_KNOW
468 
469 
470  if ( eValType == SvxNumberValueType::String )
472  pNumItem->GetNumberFormatter(),
473  pValFmtAttr ? nInitFormat : 0,
474  eValType,
475  aValString ) );
476  else
478  pNumItem->GetNumberFormatter(),
479  pValFmtAttr ? nInitFormat : 0,
480  eValType,
481  nValDouble,
482  &aValString ) );
483 
484 
485  bool bUseStarFormat = false;
487  if ( pDocSh )
488  {
489  // is this a calc document
490  Reference< XServiceInfo > xSI( pDocSh->GetModel(), UNO_QUERY );
491  if ( xSI.is() )
492  bUseStarFormat = xSI->supportsService("com.sun.star.sheet.SpreadsheetDocument");
493  }
494  pNumFmtShell->SetUseStarFormat( bUseStarFormat );
495 
496  FillCurrencyBox();
497 
498  OUString aPrevString;
499  Color* pDummy = nullptr;
500  pNumFmtShell->GetInitSettings( nCatLbSelPos, eLangType, nFmtLbSelPos,
501  aFmtEntryList, aPrevString, pDummy );
502 
503  if (nCatLbSelPos==CAT_CURRENCY)
504  set_active_currency(pNumFmtShell->GetCurrencySymbol());
505 
506  nFixedCategory=nCatLbSelPos;
507  if(bOneAreaFlag)
508  {
509  OUString sFixedCategory = m_xLbCategory->get_text(nFixedCategory);
510  m_xLbCategory->clear();
511  m_xLbCategory->append_text(sFixedCategory);
512  SetCategory(0);
513  }
514  else
515  {
516  SetCategory(nCatLbSelPos );
517  }
518  eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ADD_AUTO ) );
519  if(SfxItemState::SET == eState)
520  pAutoEntryAttr = static_cast<const SfxBoolItem*>(
521  GetItem( *rSet, SID_ATTR_NUMBERFORMAT_ADD_AUTO ));
522  // no_NO is an alias for nb_NO and normally isn't listed, we need it for
523  // backwards compatibility, but only if the format passed is of
524  // LanguageType no_NO.
525  if ( eLangType == LANGUAGE_NORWEGIAN )
526  {
527  m_xLbLanguage->remove_id(eLangType); // in case we're already called
528  m_xLbLanguage->InsertLanguage( eLangType );
529  }
530  m_xLbLanguage->set_active_id(eLangType);
531  if(pAutoEntryAttr)
532  AddAutomaticLanguage_Impl(eLangType, pAutoEntryAttr->GetValue());
533  UpdateFormatListBox_Impl(false,true);
534 
538 // SelFormatHdl_Impl(m_xLbCategory.get());
539 
540  if ( pValFmtAttr )
541  {
542  EditHdl_Impl(m_xEdFormat.get()); // UpdateOptions_Impl() as a side effect
543  }
544  else // DONT_KNOW
545  {
546  // everything disabled except direct input or changing the category
547  Obstructing();
548  }
549 
550  if ( m_xCbSourceFormat->get_active() )
551  {
552  // everything disabled except SourceFormat checkbox
554  }
555 }
556 
557 /*************************************************************************
558 #* Method: Obstructing
559 #*------------------------------------------------------------------------
560 #*
561 #* Class: SvxNumberFormatTabPage
562 #* Function: Disable the controls except from changing the category
563 #* and direct input.
564 #* Input: ---
565 #* Output: ---
566 #*
567 #************************************************************************/
569 {
570  m_xLbFormat->select(-1);
571  m_xLbLanguage->set_active(-1);
572  m_xFtLanguage->set_sensitive(false);
573  m_xLbLanguage->set_sensitive(false);
574 
575  m_xIbAdd->set_sensitive(false );
576  m_xIbRemove->set_sensitive(false );
577  m_xIbInfo->set_sensitive(false );
578 
579  m_xBtnNegRed->set_sensitive(false);
580  m_xBtnThousand->set_sensitive(false);
581  m_xBtnEngineering->set_sensitive(false);
582  m_xFtLeadZeroes->set_sensitive(false);
583  m_xFtDecimals->set_sensitive(false);
584  m_xFtDenominator->set_sensitive(false);
585  m_xEdLeadZeroes->set_sensitive(false);
586  m_xEdDecimals->set_sensitive(false);
587  m_xEdDenominator->set_sensitive(false);
588  m_xFtOptions->set_sensitive(false);
589  m_xEdDecimals->set_text( OUString() );
590  m_xEdLeadZeroes->set_text( OUString() );
591  m_xBtnNegRed->set_active( false );
592  m_xBtnThousand->set_active( false );
593  m_xBtnEngineering->set_active( false );
594  m_aWndPreview.NotifyChange( OUString() );
595 
596  m_xLbCategory->select(0);
597  m_xEdFormat->set_text( OUString() );
598  m_xFtComment->set_label( OUString() );
599  m_xEdComment->set_text(m_xLbCategory->get_text(1)); // string for user defined
600 
601  m_xEdFormat->grab_focus();
602 }
603 
604 
605 /*************************************************************************
606 #* Enable/Disable dialog parts depending on the value of the SourceFormat
607 #* checkbox.
608 #************************************************************************/
610 {
611  bool bEnable = !m_xCbSourceFormat->get_active();
612  if ( !bEnable )
613  m_xCbSourceFormat->grab_focus();
614  m_xFtCategory->set_sensitive( bEnable );
615  m_xLbCategory->set_sensitive( bEnable );
616  m_xFtFormat->set_sensitive( bEnable );
617  m_xLbCurrency->set_sensitive( bEnable );
618  m_xLbFormat->set_sensitive( bEnable );
619  m_xFtLanguage->set_sensitive( bEnable );
620  m_xLbLanguage->set_sensitive( bEnable );
621  m_xFtDecimals->set_sensitive( bEnable );
622  m_xEdDecimals->set_sensitive( bEnable );
623  m_xFtDenominator->set_sensitive( bEnable );
624  m_xEdDenominator->set_sensitive( bEnable );
625  m_xFtLeadZeroes->set_sensitive( bEnable );
626  m_xEdLeadZeroes->set_sensitive( bEnable );
627  m_xBtnNegRed->set_sensitive( bEnable );
628  m_xBtnThousand->set_sensitive( bEnable );
629  m_xBtnEngineering->set_sensitive( bEnable );
630  m_xFtOptions->set_sensitive( bEnable );
631  m_xFormatCodeFrame->set_sensitive( bEnable );
632 }
633 
634 
635 /*************************************************************************
636 #* Method: HideLanguage
637 #*------------------------------------------------------------------------
638 #*
639 #* Class: SvxNumberFormatTabPage
640 #* Function: Hides the language settings:
641 #* Input: sal_Bool nFlag
642 #* Output: ---
643 #*
644 #************************************************************************/
645 
647 {
648  m_xFtLanguage->set_visible(!bFlag);
649  m_xLbLanguage->set_visible(!bFlag);
650 }
651 
652 /*************************************************************************
653 #* Method: FillItemSet
654 #*------------------------------------------------------------------------
655 #*
656 #* Class: SvxNumberFormatTabPage
657 #* Function: Adjusts the attributes in the ItemSet,
658 #* and - if bNumItemFlag is not set - the
659 #* numItem in the DocShell.
660 #* Input: SfxItemSet
661 #* Output: ---
662 #*
663 #************************************************************************/
664 
666 {
667  bool bDataChanged = m_xFtLanguage->get_sensitive() || m_xCbSourceFormat->get_sensitive();
668  if ( bDataChanged )
669  {
670  const SfxItemSet& rMyItemSet = GetItemSet();
671  sal_uInt16 nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE );
672  SfxItemState eItemState = rMyItemSet.GetItemState( nWhich, false );
673 
674  // OK chosen - Is format code input entered already taken over?
675  // If not, simulate Add. Upon syntax error ignore input and prevent Put.
676  OUString aFormat = m_xEdFormat->get_text();
677  sal_uInt32 nCurKey = pNumFmtShell->GetCurNumFmtKey();
678 
679  if ( m_xIbAdd->get_sensitive() || pNumFmtShell->IsTmpCurrencyFormat(aFormat) )
680  { // #79599# It is not sufficient to just add the format code (or
681  // delete it in case of bOneAreaFlag and resulting category change).
682  // Upon switching tab pages we need all settings to be consistent
683  // in case this page will be redisplayed later.
684  bDataChanged = Click_Impl(*m_xIbAdd);
685  nCurKey = pNumFmtShell->GetCurNumFmtKey();
686  }
687  else if(nCurKey == NUMKEY_UNDEFINED)
688  { // something went wrong, e.g. in Writer #70281#
689  pNumFmtShell->FindEntry(aFormat, &nCurKey);
690  }
691 
692 
693  // Chosen format:
694 
695  if ( bDataChanged )
696  {
697  bDataChanged = ( nInitFormat != nCurKey );
698 
699  if (bDataChanged)
700  {
701  rCoreAttrs->Put( SfxUInt32Item( nWhich, nCurKey ) );
702  }
703  else if(SfxItemState::DEFAULT == eItemState)
704  {
705  rCoreAttrs->ClearItem( nWhich );
706  }
707  }
708 
709 
710  // List of changed user defined formats:
711 
712  std::vector<sal_uInt32> const & aDelFormats = pNumFmtShell->GetUpdateData();
713 
714  if ( !aDelFormats.empty() )
715  {
716 
717  pNumItem->SetDelFormats( aDelFormats );
718 
719  if(bNumItemFlag)
720  {
721  rCoreAttrs->Put( *pNumItem );
722  }
723  else
724  {
726 
727  DBG_ASSERT( pDocSh, "DocShell not found!" );
728 
729 
730  if ( pDocSh )
731  pDocSh->PutItem( *pNumItem );
732  }
733  }
734 
735 
736  // Whether source format is to be taken or not:
737 
738  if ( m_xCbSourceFormat->get_sensitive() )
739  {
740  sal_uInt16 _nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE );
741  SfxItemState _eItemState = rMyItemSet.GetItemState( _nWhich, false );
742  const SfxBoolItem* pBoolItem = static_cast<const SfxBoolItem*>(
743  GetItem( rMyItemSet, SID_ATTR_NUMBERFORMAT_SOURCE ));
744  bool bOld = pBoolItem && pBoolItem->GetValue();
745  rCoreAttrs->Put( SfxBoolItem( _nWhich, m_xCbSourceFormat->get_active() ) );
746  if ( !bDataChanged )
747  bDataChanged = (bOld != m_xCbSourceFormat->get_active() ||
748  _eItemState != SfxItemState::SET);
749  }
750 
751  // FillItemSet is only called on OK, here we can notify the
752  // NumberFormatShell that all new user defined formats are valid.
753  pNumFmtShell->ValidateNewEntries();
754  if(m_xLbLanguage->get_visible() &&
755  m_xLbLanguage->find_text(sAutomaticLangEntry) != -1)
756  rCoreAttrs->Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO,
757  m_xLbLanguage->get_active_text() == sAutomaticLangEntry));
758  }
759 
760  return bDataChanged;
761 }
762 
763 
765 {
766  if ( _pSet )
767  FillItemSet( _pSet );
768  return DeactivateRC::LeavePage;
769 }
770 
771 void SvxNumberFormatTabPage::FillFormatListBox_Impl( std::vector<OUString>& rEntries )
772 {
773  OUString aEntry;
774  OUString aTmpString;
775  size_t i = 0;
776  short nTmpCatPos;
777 
778  m_xLbFormat->clear();
779  if (rEntries.empty())
780  return;
781 
782  m_xLbFormat->freeze();
783 
784  if(bOneAreaFlag)
785  {
786  nTmpCatPos=nFixedCategory;
787  }
788  else
789  {
790  nTmpCatPos=m_xLbCategory->get_selected_index();
791  }
792 
793  switch (nTmpCatPos)
794  {
795  case CAT_ALL:
796  case CAT_TEXT:
797  case CAT_NUMBER: i=1;
798  aEntry=rEntries[0];
799  if (nTmpCatPos == CAT_TEXT)
800  aTmpString=aEntry;
801  else
802  aTmpString = pNumFmtShell->GetStandardName();
803  m_xLbFormat->append_text(aTmpString);
804  break;
805 
806  default: break;
807  }
808 
809  if(pNumFmtShell!=nullptr)
810  {
811  for ( ; i < rEntries.size(); ++i )
812  {
813  aEntry = rEntries[i];
814  short aPrivCat = pNumFmtShell->GetCategory4Entry( static_cast<short>(i) );
815  if(aPrivCat!=CAT_TEXT)
816  {
817  Color* pPreviewColor = nullptr;
818  OUString aPreviewString( GetExpColorString( pPreviewColor, aEntry, aPrivCat ) );
819  m_xLbFormat->append_text(aPreviewString);
820  if (pPreviewColor)
821  m_xLbFormat->set_font_color(m_xLbFormat->n_children() - 1, *pPreviewColor);
822  }
823  else
824  {
825  m_xLbFormat->append_text(aEntry);
826  }
827  }
828  }
829  m_xLbFormat->thaw();
830  rEntries.clear();
831 }
832 
833 /*************************************************************************
834 #* Method: UpdateOptions_Impl
835 #*------------------------------------------------------------------------
836 #*
837 #* Class: SvxNumberFormatTabPage
838 #* Function: Adjusts the options attributes
839 #* depending on the selected format.
840 #* Input: Flag, whether the category has changed.
841 #* Output: ---
842 #*
843 #************************************************************************/
844 
845 void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_False*/ )
846 {
847  OUString theFormat = m_xEdFormat->get_text();
848  sal_Int32 nCurCategory = m_xLbCategory->get_selected_index();
849  sal_uInt16 nCategory = static_cast<sal_uInt16>(nCurCategory);
850  sal_uInt16 nDecimals = 0;
851  sal_uInt16 nZeroes = 0;
852  bool bNegRed = false;
853  bool bThousand = false;
854  sal_Int32 nCurrencyPos = get_active_currency();
855 
856  if(bOneAreaFlag)
857  nCurCategory=nFixedCategory;
858 
859 
860  pNumFmtShell->GetOptions( theFormat,
861  bThousand, bNegRed,
862  nDecimals, nZeroes,
863  nCategory );
864  bool bDoIt=false;
865  if(nCategory==CAT_CURRENCY)
866  {
867  sal_uInt16 nTstPos=pNumFmtShell->FindCurrencyFormat(theFormat);
868  if(nCurrencyPos!=static_cast<sal_Int32>(nTstPos) && nTstPos!=sal_uInt16(-1))
869  {
870  set_active_currency(nTstPos);
871  pNumFmtShell->SetCurrencySymbol(nTstPos);
872  bDoIt=true;
873  }
874  }
875 
876  if ( nCategory != nCurCategory || bDoIt)
877  {
878  if ( bCheckCatChange )
879  {
880  if(bOneAreaFlag)
881  SetCategory(0);
882  else
883  SetCategory(nCategory );
884 
885  UpdateFormatListBox_Impl( true, false );
886  }
887  }
888  else if ( m_xLbFormat->n_children() > 0 )
889  {
890  sal_uInt32 nCurEntryKey=NUMKEY_UNDEFINED;
891  if(!pNumFmtShell->FindEntry( m_xEdFormat->get_text(),&nCurEntryKey))
892  {
893  m_xLbFormat->select(-1);
894  }
895  }
896  if(bOneAreaFlag)
897  {
898  nCategory=nFixedCategory;
899  }
900 
903  switch ( nCategory )
904  {
905  case CAT_SCIENTIFIC: // bThousand is for Engineering notation
906  {
907  sal_uInt16 nIntDigits = pNumFmtShell->GetFormatIntegerDigits(theFormat);
908  bThousand = (nIntDigits > 0) && (nIntDigits % 3 == 0);
909  m_xBtnEngineering->set_sensitive(true);
910  m_xBtnEngineering->set_active( bThousand );
911  }
912  [[fallthrough]];
913  case CAT_NUMBER:
914  case CAT_PERCENT:
915  case CAT_CURRENCY:
916  case CAT_FRACTION:
917  m_xFtOptions->set_sensitive(true);
918  if ( nCategory == CAT_FRACTION )
919  {
920  m_xFtDenominator->set_sensitive(true);
921  m_xEdDenominator->set_sensitive(true);
922  }
923  else
924  {
925  m_xFtDecimals->set_sensitive(true);
926  m_xEdDecimals->set_sensitive(true);
927  }
928  m_xFtLeadZeroes->set_sensitive(true);
929  m_xEdLeadZeroes->set_sensitive(true);
930  m_xBtnNegRed->set_sensitive(true);
931  if ( nCategory == CAT_NUMBER && m_xLbFormat->get_selected_index() == 0 )
932  m_xEdDecimals->set_text( "" ); //General format tdf#44399
933  else
934  if ( nCategory == CAT_FRACTION )
935  m_xEdDenominator->set_value( nDecimals );
936  else
937  m_xEdDecimals->set_value( nDecimals );
938  m_xEdLeadZeroes->set_value( nZeroes );
939  m_xBtnNegRed->set_active( bNegRed );
940  if ( nCategory != CAT_SCIENTIFIC )
941  {
942  m_xBtnThousand->set_sensitive(true);
943  m_xBtnThousand->set_active( bThousand );
944  }
945  break;
946 
947  case CAT_ALL:
948  case CAT_USERDEFINED:
949  case CAT_TEXT:
950  case CAT_DATE:
951  case CAT_TIME:
952  case CAT_BOOLEAN:
953  default:
954  m_xFtOptions->set_sensitive(false);
955  m_xFtDecimals->set_sensitive(false);
956  m_xEdDecimals->set_sensitive(false);
957  m_xFtDenominator->set_sensitive(false);
958  m_xEdDenominator->set_sensitive(false);
959  m_xFtLeadZeroes->set_sensitive(false);
960  m_xEdLeadZeroes->set_sensitive(false);
961  m_xBtnNegRed->set_sensitive(false);
962  m_xBtnThousand->set_sensitive(false);
963  m_xBtnEngineering->set_sensitive(false);
964  m_xEdDecimals->set_text( OUString() );
965  m_xEdLeadZeroes->set_text( OUString() );
966  m_xBtnNegRed->set_active( false );
967  m_xBtnThousand->set_active( false );
968  m_xBtnEngineering->set_active( false );
969  }
970 }
971 
972 
973 /*************************************************************************
974 #* Method: UpdateFormatListBox_Impl
975 #*------------------------------------------------------------------------
976 #*
977 #* Class: SvxNumberFormatTabPage
978 #* Function: Updates the format listbox and additionally the
979 #* string in the editbox is changed depending on
980 #* the bUpdateEdit flag.
981 #* Input: Flags for category and editbox.
982 #* Output: ---
983 #*
984 #************************************************************************/
985 
987  (
988  bool bCat, // Category or country/language ListBox?
989  bool bUpdateEdit
990  )
991 {
992  std::vector<OUString> aEntryList;
993  short nFmtLbSelPos = 0;
994  short nTmpCatPos;
995 
996  if(bOneAreaFlag)
997  {
998  nTmpCatPos=nFixedCategory;
999  }
1000  else
1001  {
1002  nTmpCatPos=m_xLbCategory->get_selected_index();
1003  }
1004 
1005 
1006  if ( bCat )
1007  {
1008  if(nTmpCatPos!=CAT_CURRENCY)
1009  m_xLbCurrency->hide();
1010  else
1011  m_xLbCurrency->show();
1012 
1013  pNumFmtShell->CategoryChanged(nTmpCatPos,nFmtLbSelPos, aEntryList);
1014  }
1015  else
1016  pNumFmtShell->LanguageChanged(m_xLbLanguage->get_active_id(),
1017  nFmtLbSelPos,aEntryList);
1018 
1019  REMOVE_DONTKNOW() // possibly UI-Enable
1020 
1021 
1022  if ( (!aEntryList.empty()) && (nFmtLbSelPos != SELPOS_NONE) )
1023  {
1024  if(bUpdateEdit)
1025  {
1026  OUString aFormat=aEntryList[nFmtLbSelPos];
1027  m_xEdFormat->set_text(aFormat);
1028  m_xFtComment->set_label(pNumFmtShell->GetComment4Entry(nFmtLbSelPos));
1029  }
1030 
1031  if(!bOneAreaFlag || !bCat)
1032  {
1033  FillFormatListBox_Impl( aEntryList );
1034  m_xLbFormat->select(nFmtLbSelPos);
1035 
1036  m_xFtComment->set_label(pNumFmtShell->GetComment4Entry(nFmtLbSelPos));
1037  if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos))
1038  {
1039  if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).isEmpty())
1040  {
1041  m_xFtComment->set_label(m_xLbCategory->get_text(1));
1042  }
1043  }
1044  ChangePreviewText( static_cast<sal_uInt16>(nFmtLbSelPos) );
1045  }
1046 
1047  }
1048  else
1049  {
1050  FillFormatListBox_Impl( aEntryList );
1051  if(nFmtLbSelPos != SELPOS_NONE)
1052  {
1053  m_xLbFormat->select(static_cast<sal_uInt16>(nFmtLbSelPos));
1054 
1055  m_xFtComment->set_label(pNumFmtShell->GetComment4Entry(nFmtLbSelPos));
1056  if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos))
1057  {
1058  if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).isEmpty())
1059  {
1060  m_xFtComment->set_label(m_xLbCategory->get_text(1));
1061  }
1062  }
1063  }
1064  else
1065  {
1066  m_xLbFormat->select(-1);
1067  }
1068 
1069  if ( bUpdateEdit )
1070  {
1071  m_xEdFormat->set_text( OUString() );
1072  m_aWndPreview.NotifyChange( OUString() );
1073  }
1074  }
1075 
1076  aEntryList.clear();
1077 }
1078 
1079 
1087 {
1088  bool bIsScientific = m_xLbCategory->get_selected_index() == CAT_SCIENTIFIC;
1089  m_xBtnThousand->set_visible( !bIsScientific );
1090  m_xBtnEngineering->set_visible( bIsScientific );
1091 }
1092 
1093 
1101 {
1102  bool bIsFraction = m_xLbCategory->get_selected_index() == CAT_FRACTION;
1103  m_xFtDecimals->set_visible( !bIsFraction );
1104  m_xEdDecimals->set_visible( !bIsFraction );
1105  m_xFtDenominator->set_visible( bIsFraction );
1106  m_xEdDenominator->set_visible( bIsFraction );
1107 }
1108 
1109 
1110 /*************************************************************************
1111 #* Handle: DoubleClickHdl_Impl
1112 #*------------------------------------------------------------------------
1113 #*
1114 #* Class: SvxNumberFormatTabPage
1115 #* Function: On a double click in the format listbox the
1116 #* value is adopted and the OK button pushed.
1117 #* Input: Pointer on the Listbox
1118 #* Output: ---
1119 #*
1120 #************************************************************************/
1121 IMPL_LINK(SvxNumberFormatTabPage, DoubleClickHdl_Impl, weld::TreeView&, rLb, bool)
1122 {
1123  SelFormatHdl_Impl(&rLb);
1124 
1125  SfxOkDialogController* pController = GetDialogController();
1126  assert(pController);
1127  weld::Button& rOkButton = pController->GetOKButton();
1128  rOkButton.clicked();
1129 
1130  return true;
1131 }
1132 
1133 /*************************************************************************
1134 #* Method: SelFormatHdl_Impl
1135 #*------------------------------------------------------------------------
1136 #*
1137 #* Class: SvxNumberFormatTabPage
1138 #* Function: Is called when the language, the category or the format
1139 #* is changed. Accordingly the settings are adjusted.
1140 #* Input: Pointer on the Listbox
1141 #* Output: ---
1142 #*
1143 #************************************************************************/
1144 
1145 IMPL_LINK(SvxNumberFormatTabPage, SelFormatClickHdl_Impl, weld::Button&, rLb, void)
1146 {
1147  SelFormatHdl_Impl(&rLb);
1148 }
1149 
1150 IMPL_LINK(SvxNumberFormatTabPage, SelFormatTreeListBoxHdl_Impl, weld::TreeView&, rLb, void)
1151 {
1152  SelFormatHdl_Impl(&rLb);
1153 }
1154 
1155 IMPL_LINK(SvxNumberFormatTabPage, SelFormatListBoxHdl_Impl, weld::ComboBox&, rLb, void)
1156 {
1157  SelFormatHdl_Impl(&rLb);
1158 }
1159 
1161 {
1162  if (pLb == m_xCbSourceFormat.get())
1163  {
1164  EnableBySourceFormat_Impl(); // enable/disable everything else
1165  if ( m_xCbSourceFormat->get_active() )
1166  return; // just disabled everything else
1167 
1168  // Reinit options enable/disable for current selection.
1169 
1170  // Current category may be UserDefined with no format entries defined.
1171  if (m_xLbFormat->get_selected_index() == -1)
1172  pLb = m_xLbCategory.get(); // continue with the current category selected
1173  else
1174  pLb = m_xLbFormat.get(); // continue with the current format selected
1175  }
1176 
1177  sal_Int32 nTmpCatPos;
1178 
1179  if(bOneAreaFlag)
1180  {
1181  nTmpCatPos=nFixedCategory;
1182  }
1183  else
1184  {
1185  nTmpCatPos=m_xLbCategory->get_selected_index();
1186  }
1187 
1188  if (nTmpCatPos==CAT_CURRENCY && pLb == m_xLbCurrency.get())
1189  pNumFmtShell->SetCurrencySymbol(get_active_currency());
1190 
1191  // Format-ListBox ----------------------------------------------------
1192  if (pLb == m_xLbFormat.get())
1193  {
1194  sal_uLong nSelPos = m_xLbFormat->get_selected_index();
1195  short nFmtLbSelPos = static_cast<short>(nSelPos);
1196 
1197  OUString aFormat = pNumFmtShell->GetFormat4Entry(nFmtLbSelPos);
1198  OUString aComment = pNumFmtShell->GetComment4Entry(nFmtLbSelPos);
1199 
1200  if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos))
1201  {
1202  if(aComment.isEmpty())
1203  {
1204  aComment = m_xLbCategory->get_text(1);
1205  }
1206  }
1207 
1208  if ( !aFormat.isEmpty() )
1209  {
1210  if (!m_xEdFormat->has_focus())
1211  m_xEdFormat->set_text( aFormat );
1212  m_xFtComment->set_label(aComment);
1213  ChangePreviewText( static_cast<sal_uInt16>(nSelPos) );
1214  }
1215 
1216  REMOVE_DONTKNOW() // possibly UI-Enable
1217 
1218  if ( pNumFmtShell->FindEntry( aFormat) )
1219  {
1220  m_xIbAdd->set_sensitive(false );
1221  bool bIsUserDef=pNumFmtShell->IsUserDefined( aFormat );
1222  m_xIbRemove->set_sensitive(bIsUserDef);
1223  m_xIbInfo->set_sensitive(bIsUserDef);
1224 
1225  }
1226  else
1227  {
1228  m_xIbAdd->set_sensitive(true);
1229  m_xIbInfo->set_sensitive(true);
1230  m_xIbRemove->set_sensitive(false );
1231  m_xFtComment->set_label(m_xEdComment->get_text());
1232 
1233  }
1234  UpdateOptions_Impl( false );
1235 
1236  return;
1237  }
1238 
1239 
1240  // category-ListBox -------------------------------------------------
1241  if (pLb == m_xLbCategory.get() || pLb == m_xLbCurrency.get())
1242  {
1243  UpdateFormatListBox_Impl( true, true );
1244  EditHdl_Impl( nullptr );
1245  UpdateOptions_Impl( false );
1246 
1247  return;
1248  }
1249 
1250 
1251  // language/country-ListBox ----------------------------------------------
1252  if (pLb == m_xLbLanguage->get_widget())
1253  {
1254  UpdateFormatListBox_Impl( false, true );
1255  EditHdl_Impl(m_xEdFormat.get());
1256 
1257  return;
1258  }
1259 }
1260 
1261 
1262 /*************************************************************************
1263 #* Method: ClickHdl_Impl, weld::Button& rIB
1264 #*------------------------------------------------------------------------
1265 #*
1266 #* Class: SvxNumberFormatTabPage
1267 #* Function: Called when the add or delete button is pushed,
1268 #* adjusts the number format list.
1269 #* Input: Toolbox- Button
1270 #* Output: ---
1271 #*
1272 #************************************************************************/
1273 
1274 IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, weld::Button&, rIB, void)
1275 {
1276  Click_Impl(rIB);
1277 }
1278 
1280 {
1281  sal_uLong nReturn = 0;
1282  const sal_uLong nReturnChanged = 0x1; // THE boolean return value
1283  const sal_uLong nReturnAdded = 0x2; // temp: format added
1284  const sal_uLong nReturnOneArea = 0x4; // temp: one area but category changed => ignored
1285 
1286  if (&rIB == m_xIbAdd.get())
1287  { // Also called from FillItemSet() if a temporary currency format has
1288  // to be added, not only if the Add button is enabled.
1289  OUString aFormat = m_xEdFormat->get_text();
1290  std::vector<OUString> aEntryList;
1291  std::vector<OUString> a2EntryList;
1292  sal_uInt16 nCatLbSelPos = 0;
1293  short nFmtLbSelPos = SELPOS_NONE;
1294  sal_Int32 nErrPos=0;
1295 
1296  pNumFmtShell->SetCurCurrencyEntry(nullptr);
1297  bool bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos,
1298  nCatLbSelPos, nFmtLbSelPos,
1299  aEntryList);
1300  if ( bAdded )
1301  nReturn |= nReturnChanged | nReturnAdded;
1302 
1303  if (m_xEdComment->get_visible())
1304  {
1305  m_xEdFormat->grab_focus();
1306  m_xEdComment->hide();
1307  m_xFtComment->show();
1308  m_xFtComment->set_label(m_xEdComment->get_text());
1309  }
1310 
1311  if ( !nErrPos ) // Syntax ok?
1312  {
1313  // May be sorted under a different locale if LCID was parsed.
1314  if (bAdded)
1315  m_xLbLanguage->set_active_id(pNumFmtShell->GetCurLanguage());
1316 
1317  if (nCatLbSelPos==CAT_CURRENCY)
1318  set_active_currency(pNumFmtShell->GetCurrencySymbol());
1319 
1320  if(bOneAreaFlag && (nFixedCategory!=nCatLbSelPos))
1321  {
1322  if(bAdded) aEntryList.clear();
1323  pNumFmtShell->RemoveFormat( aFormat,
1324  nCatLbSelPos,
1325  nFmtLbSelPos,
1326  a2EntryList);
1327  a2EntryList.clear();
1328  m_xEdFormat->grab_focus();
1329  m_xEdFormat->select_region(0, -1);
1330  nReturn |= nReturnOneArea;
1331  }
1332  else
1333  {
1334  if ( bAdded && (nFmtLbSelPos != SELPOS_NONE) )
1335  {
1336  // everything all right
1337  if(bOneAreaFlag) //@@ ???
1338  SetCategory(0);
1339  else
1340  SetCategory(nCatLbSelPos );
1341 
1342  FillFormatListBox_Impl( aEntryList );
1343  if (m_xEdComment->get_text()!=m_xLbCategory->get_text(1))
1344  {
1345  pNumFmtShell->SetComment4Entry(nFmtLbSelPos,
1346  m_xEdComment->get_text());
1347  }
1348  else
1349  {
1350  pNumFmtShell->SetComment4Entry(nFmtLbSelPos,
1351  OUString());
1352  }
1353  m_xLbFormat->select(static_cast<sal_uInt16>(nFmtLbSelPos));
1354  m_xEdFormat->set_text( aFormat );
1355 
1356  m_xEdComment->set_text(m_xLbCategory->get_text(1)); // String for user defined
1357 
1358  ChangePreviewText( static_cast<sal_uInt16>(nFmtLbSelPos) );
1359  }
1360  }
1361  }
1362  else // syntax error
1363  {
1364  m_xEdFormat->grab_focus();
1365  m_xEdFormat->select_region(nErrPos == -1 ? m_xEdFormat->get_text().getLength() : nErrPos, -1);
1366  }
1367  EditHdl_Impl(m_xEdFormat.get());
1368  nReturn = ((nReturn & nReturnOneArea) ? 0 : (nReturn & nReturnChanged));
1369 
1370  aEntryList.clear();
1371  a2EntryList.clear();
1372  }
1373  else if (&rIB == m_xIbRemove.get())
1374  {
1375  OUString aFormat = m_xEdFormat->get_text();
1376  std::vector<OUString> aEntryList;
1377  sal_uInt16 nCatLbSelPos = 0;
1378  short nFmtLbSelPos = SELPOS_NONE;
1379 
1380  pNumFmtShell->RemoveFormat( aFormat,
1381  nCatLbSelPos,
1382  nFmtLbSelPos,
1383  aEntryList );
1384 
1385  m_xEdComment->set_text(m_xLbCategory->get_text(1));
1386 
1387  if( nFmtLbSelPos>=0 && static_cast<size_t>(nFmtLbSelPos)<aEntryList.size() )
1388  {
1389  aFormat = aEntryList[nFmtLbSelPos];
1390  }
1391 
1392  FillFormatListBox_Impl( aEntryList );
1393 
1394  if ( nFmtLbSelPos != SELPOS_NONE )
1395  {
1396  if(bOneAreaFlag) //@@ ???
1397  SetCategory(0);
1398  else
1399  SetCategory(nCatLbSelPos );
1400 
1401  m_xLbFormat->select(static_cast<sal_uInt16>(nFmtLbSelPos));
1402  m_xEdFormat->set_text( aFormat );
1403  ChangePreviewText( static_cast<sal_uInt16>(nFmtLbSelPos) );
1404  }
1405  else
1406  {
1407  // set to "all/standard"
1408  SetCategory(0);
1410  }
1411 
1412  EditHdl_Impl(m_xEdFormat.get());
1413 
1414  aEntryList.clear();
1415  }
1416  else if (&rIB == m_xIbInfo.get())
1417  {
1418  if (!m_xEdComment->get_visible())
1419  {
1420  m_xEdComment->set_text(m_xFtComment->get_label());
1421  m_xEdComment->show();
1422  m_xFtComment->hide();
1423  m_xEdComment->grab_focus();
1424  }
1425  else
1426  {
1427  m_xEdFormat->grab_focus();
1428  m_xEdComment->hide();
1429  m_xFtComment->show();
1430  }
1431  }
1432 
1433  return nReturn;
1434 }
1435 
1436 
1437 /*************************************************************************
1438 #* Method: EditHdl_Impl
1439 #*------------------------------------------------------------------------
1440 #*
1441 #* Class: SvxNumberFormatTabPage
1442 #* Function: When the entry in the edit field is changed
1443 #* the preview is updated and
1444 #* Input: Pointer on Editbox
1445 #* Output: ---
1446 #*
1447 #************************************************************************/
1448 
1449 IMPL_LINK(SvxNumberFormatTabPage, EditModifyHdl_Impl, weld::Entry&, rEdit, void)
1450 {
1451  EditHdl_Impl(&rEdit);
1452 }
1453 
1455 {
1456  sal_uInt32 nCurKey = NUMKEY_UNDEFINED;
1457 
1458  if ( m_xEdFormat->get_text().isEmpty() )
1459  {
1460  m_xIbAdd->set_sensitive(false );
1461  m_xIbRemove->set_sensitive(false );
1462  m_xIbInfo->set_sensitive(false );
1463  m_xFtComment->set_label(OUString());
1464  }
1465  else
1466  {
1467  OUString aFormat = m_xEdFormat->get_text();
1468  MakePreviewText( aFormat );
1469 
1470  if ( pNumFmtShell->FindEntry( aFormat, &nCurKey ) )
1471  {
1472  m_xIbAdd->set_sensitive(false );
1473  bool bUserDef=pNumFmtShell->IsUserDefined( aFormat );
1474 
1475  m_xIbRemove->set_sensitive(bUserDef);
1476  m_xIbInfo->set_sensitive(bUserDef);
1477 
1478  if(bUserDef)
1479  {
1480  sal_uInt16 nTmpCurPos=pNumFmtShell->FindCurrencyFormat(aFormat );
1481  if (nTmpCurPos != sal_uInt16(-1))
1482  set_active_currency(nTmpCurPos);
1483  }
1484  short nPosi=pNumFmtShell->GetListPos4Entry( nCurKey, aFormat);
1485  if(nPosi>=0)
1486  m_xLbFormat->select(static_cast<sal_uInt16>(nPosi));
1487 
1488  }
1489  else
1490  {
1491 
1492  m_xIbAdd->set_sensitive(true);
1493  m_xIbInfo->set_sensitive(true);
1494  m_xIbRemove->set_sensitive(false );
1495 
1496  m_xFtComment->set_label(m_xEdComment->get_text());
1497 
1498  }
1499  }
1500 
1501  if (pEdFormat)
1502  {
1503  pNumFmtShell->SetCurNumFmtKey( nCurKey );
1504  UpdateOptions_Impl( true );
1505  }
1506 }
1507 
1508 
1509 /*************************************************************************
1510 #* Method: NotifyChange
1511 #*------------------------------------------------------------------------
1512 #*
1513 #* Class: SvxNumberFormatTabPage
1514 #* Function: Does changes in the number attributes.
1515 #* Input: Options- Controls
1516 #* Output: ---
1517 #*
1518 #************************************************************************/
1519 
1520 IMPL_LINK(SvxNumberFormatTabPage, OptClickHdl_Impl, weld::Button&, rOptCtrl, void)
1521 {
1522  OptHdl_Impl(&rOptCtrl);
1523 }
1524 
1525 IMPL_LINK(SvxNumberFormatTabPage, OptEditHdl_Impl, weld::SpinButton&, rEdit, void)
1526 {
1527  OptHdl_Impl(&rEdit);
1528 }
1529 
1531 {
1532  if ( pOptCtrl == m_xEdLeadZeroes.get()
1533  || pOptCtrl == m_xEdDecimals.get()
1534  || pOptCtrl == m_xEdDenominator.get()
1535  || pOptCtrl == m_xBtnNegRed.get()
1536  || pOptCtrl == m_xBtnThousand.get()
1537  || pOptCtrl == m_xBtnEngineering.get())
1538  {
1539  OUString aFormat;
1540  bool bThousand = ( m_xBtnThousand->get_visible() && m_xBtnThousand->get_sensitive() && m_xBtnThousand->get_active() )
1541  || ( m_xBtnEngineering->get_visible() && m_xBtnEngineering->get_sensitive() && m_xBtnEngineering->get_active() );
1542  bool bNegRed = m_xBtnNegRed->get_sensitive() && m_xBtnNegRed->get_active();
1543  sal_uInt16 nPrecision = (m_xEdDecimals->get_sensitive() && m_xEdDecimals->get_visible())
1544  ? static_cast<sal_uInt16>(m_xEdDecimals->get_value())
1545  : ( (m_xEdDenominator->get_sensitive() && m_xEdDenominator->get_visible())
1546  ? static_cast<sal_uInt16>(m_xEdDenominator->get_value())
1547  : sal_uInt16(0) );
1548  sal_uInt16 nLeadZeroes = (m_xEdLeadZeroes->get_sensitive())
1549  ? static_cast<sal_uInt16>(m_xEdLeadZeroes->get_value())
1550  : sal_uInt16(0);
1551  if ( pNumFmtShell->GetStandardName() == m_xEdFormat->get_text() )
1552  {
1553  m_xEdDecimals->set_value(nPrecision);
1554  }
1555 
1556  pNumFmtShell->MakeFormat( aFormat,
1557  bThousand, bNegRed,
1558  nPrecision, nLeadZeroes,
1559  static_cast<sal_uInt16>(m_xLbFormat->get_selected_index()) );
1560 
1561  m_xEdFormat->set_text( aFormat );
1562  MakePreviewText( aFormat );
1563 
1564  if ( pNumFmtShell->FindEntry( aFormat ) )
1565  {
1566  m_xIbAdd->set_sensitive(false );
1567  bool bUserDef=pNumFmtShell->IsUserDefined( aFormat );
1568  m_xIbRemove->set_sensitive(bUserDef);
1569  m_xIbInfo->set_sensitive(bUserDef);
1570  EditHdl_Impl(m_xEdFormat.get());
1571 
1572  }
1573  else
1574  {
1575  EditHdl_Impl( nullptr );
1576  m_xLbFormat->select(-1);
1577  }
1578  }
1579 }
1580 
1581 /*************************************************************************
1582 #* Method: LostFocusHdl_Impl
1583 #*------------------------------------------------------------------------
1584 #*
1585 #* Class: SvxNumberFormatTabPage
1586 #* Function: Does changes in the number attributes.
1587 #* Input: Options- Controls
1588 #* Output: ---
1589 #*
1590 #************************************************************************/
1591 
1593 {
1594  if (!pNumFmtShell)
1595  return;
1596  m_xFtComment->set_label(m_xEdComment->get_text());
1597  m_xEdComment->hide();
1598  m_xFtComment->show();
1599  if(!m_xIbAdd->get_sensitive())
1600  {
1601  sal_uInt16 nSelPos = m_xLbFormat->get_selected_index();
1602  pNumFmtShell->SetComment4Entry(nSelPos, m_xEdComment->get_text());
1603  // String for user defined, if present
1604  OUString sEntry = m_xLbCategory->n_children() > 1 ? m_xLbCategory->get_text(1) : OUString();
1605  m_xEdComment->set_text(sEntry);
1606  }
1607 }
1608 
1609 /*************************************************************************
1610 #* Method: NotifyChange
1611 #*------------------------------------------------------------------------
1612 #*
1613 #* Class: SvxNumberFormatTabPage
1614 #* Function: Does changes in the number attributes.
1615 #* Input: Options- Controls
1616 #* Output: ---
1617 #*
1618 #************************************************************************/
1619 
1621  Color*& rpPreviewColor, const OUString& rFormatStr, short nTmpCatPos)
1622 {
1624  switch (nTmpCatPos)
1625  {
1626  case CAT_ALL: i=SvxNumValCategory::Standard; break;
1627 
1628  case CAT_NUMBER: i=SvxNumValCategory::Standard; break;
1629 
1630  case CAT_PERCENT: i=SvxNumValCategory::Percent; break;
1631 
1632  case CAT_CURRENCY: i=SvxNumValCategory::Currency; break;
1633 
1634  case CAT_DATE: i=SvxNumValCategory::Date; break;
1635 
1636  case CAT_TIME: i=SvxNumValCategory::Time; break;
1637 
1638  case CAT_SCIENTIFIC: i=SvxNumValCategory::Scientific; break;
1639 
1640  case CAT_FRACTION: i=SvxNumValCategory::Fraction; break;
1641 
1642  case CAT_BOOLEAN: i=SvxNumValCategory::Boolean; break;
1643 
1644  case CAT_USERDEFINED: i=SvxNumValCategory::Standard; break;
1645 
1646  case CAT_TEXT:
1647  default: i=SvxNumValCategory::NoValue;break;
1648  }
1649  double fVal = fSvxNumValConst[i];
1650 
1651  OUString aPreviewString;
1652  pNumFmtShell->MakePrevStringFromVal( rFormatStr, aPreviewString, rpPreviewColor, fVal );
1653  return aPreviewString;
1654 }
1655 
1656 void SvxNumberFormatTabPage::MakePreviewText( const OUString& rFormat )
1657 {
1658  OUString aPreviewString;
1659  Color* pPreviewColor = nullptr;
1660  pNumFmtShell->MakePreviewString( rFormat, aPreviewString, pPreviewColor );
1661  m_aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
1662 }
1663 
1665 {
1666  OUString aPreviewString;
1667  Color* pPreviewColor = nullptr;
1668  pNumFmtShell->FormatChanged( nPos, aPreviewString, pPreviewColor );
1669  m_aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
1670 }
1671 
1673 {
1674  std::vector<OUString> aList;
1675 
1676  sal_uInt16 nSelPos=0;
1677  pNumFmtShell->GetCurrencySymbols(aList, &nSelPos);
1678 
1679  m_xLbCurrency->freeze();
1680  m_xLbCurrency->clear();
1681  bLegacyAutomaticCurrency = false;
1682  for (std::vector<OUString>::iterator i = aList.begin() + 1;i != aList.end(); ++i)
1683  m_xLbCurrency->append_text(*i);
1684  m_xLbCurrency->thaw();
1685 
1686  set_active_currency(nSelPos);
1687 }
1688 
1690 {
1691  int nCurCategory = m_xLbCategory->get_selected_index();
1692  sal_uInt16 nTmpCatPos;
1693 
1694  if (bOneAreaFlag)
1695  {
1696  nTmpCatPos=nFixedCategory;
1697  }
1698  else
1699  {
1700  nTmpCatPos=nPos;
1701  }
1702 
1703  if(m_xLbCategory->n_children()==1 || nCurCategory!=nPos)
1704  {
1705  if(nTmpCatPos!=CAT_CURRENCY)
1706  m_xLbCurrency->hide();
1707  else
1708  m_xLbCurrency->show();
1709  }
1710  m_xLbCategory->select(nPos);
1711 }
1712 
1713 /* to support Writer text field language handling an
1714  additional entry needs to be inserted into the ListBox
1715  which marks a certain language as automatically detected
1716  Additionally the "Default" language is removed
1717 */
1719 {
1720  m_xLbLanguage->remove_id(LANGUAGE_SYSTEM);
1721  m_xLbLanguage->append(eAutoLang, sAutomaticLangEntry);
1722  if (bSelect)
1723  m_xLbLanguage->set_active_id(eAutoLang);
1724 }
1725 
1727 {
1728  const SvxNumberInfoItem* pNumberInfoItem = aSet.GetItem<SvxNumberInfoItem>(SID_ATTR_NUMBERFORMAT_INFO, false);
1729  if (pNumberInfoItem && !pNumItem)
1730  pNumItem.reset( static_cast<SvxNumberInfoItem*>(pNumberInfoItem->Clone()) );
1731 }
1732 
1733 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GetValue() const
long Width() const
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
bool Click_Impl(weld::Button &rIB)
Definition: numfmt.cxx:1279
std::unique_ptr< weld::CustomWeld > m_xWndPreview
Definition: numfmt.hxx:116
std::unique_ptr< SvxNumberFormatShell > pNumFmtShell
Definition: numfmt.hxx:79
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: numfmt.cxx:133
std::unique_ptr< weld::Label > m_xFtOptions
Definition: numfmt.hxx:98
#define CAT_NUMBER
void HideLanguage(bool bFlag=true)
Definition: numfmt.cxx:646
static SvxNumberFormatShell * Create(SvNumberFormatter *pNumFormatter, sal_uInt32 nFormatKey, SvxNumberValueType eNumValType, const OUString &rNumStr)
std::unique_ptr< weld::Label > m_xFtLanguage
Definition: numfmt.hxx:96
Color aPrevCol
Definition: numfmt.hxx:39
OUString aPrevStr
Definition: numfmt.hxx:38
OUString sAutomaticCurrencyEntry
Definition: numfmt.hxx:88
long Height() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
std::unique_ptr< weld::Widget > m_xFormatCodeFrame
Definition: numfmt.hxx:108
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: numfmt.cxx:764
#define REMOVE_DONTKNOW()
Definition: numfmt.cxx:179
OUString GetExpColorString(Color *&rpPreviewColor, const OUString &aFormatStr, short nTmpCatPos)
Definition: numfmt.cxx:1620
sal_uIntPtr sal_uLong
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
std::unique_ptr< weld::CheckButton > m_xBtnNegRed
Definition: numfmt.hxx:103
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: numfmt.cxx:1726
void OptHdl_Impl(const weld::Widget *)
Definition: numfmt.cxx:1530
SvxNumberValueType
sal_uLong nInitFormat
Definition: numfmt.hxx:80
std::unique_ptr< weld::Button > m_xIbInfo
Definition: numfmt.hxx:111
static SfxObjectShell * Current()
css::uno::Reference< css::frame::XModel > GetModel() const
void EnableBySourceFormat_Impl()
Definition: numfmt.cxx:609
void PutItem(const SfxPoolItem &rItem)
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: numfmt.cxx:665
#define CAT_FRACTION
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
Size const & GetOutputSizePixel() const
void NotifyChange(const OUString &rPrevStr, const Color *pColor=nullptr)
Definition: numfmt.cxx:92
void SelFormatHdl_Impl(weld::Widget *)
Definition: numfmt.cxx:1160
void SetBackground()
static const sal_uInt16 pRanges[]
Definition: numfmt.hxx:60
#define SELPOS_NONE
const vcl::Font & GetFont() const
std::unique_ptr< SvxNumberInfoItem > pNumItem
Definition: numfmt.hxx:78
std::unique_ptr< weld::CheckButton > m_xBtnEngineering
Definition: numfmt.hxx:107
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: numfmt.cxx:310
#define CAT_TEXT
virtual weld::Button & GetOKButton() const =0
void SetExchangeSupport()
#define CAT_PERCENT
std::unique_ptr< weld::TreeView > m_xLbCategory
Definition: numfmt.hxx:92
const SfxItemSet & GetItemSet() const
#define LANGUAGE_NORWEGIAN
void FillFormatListBox_Impl(std::vector< OUString > &rEntries)
Definition: numfmt.cxx:771
#define SAL_N_ELEMENTS(arr)
void UpdateThousandEngineeringCheckBox()
Change visible checkbox according to category format if scientific format "Engineering notation" else...
Definition: numfmt.cxx:1086
std::unique_ptr< weld::CheckButton > m_xCbSourceFormat
Definition: numfmt.hxx:97
bool bNumItemFlag
for handling with DocShell
Definition: numfmt.hxx:82
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
std::unique_ptr< weld::Label > m_xFtComment
Definition: numfmt.hxx:113
#define DBG_ASSERT(sCon, aError)
#define NUMKEY_UNDEFINED
Definition: numfmt.cxx:47
std::unique_ptr< SvxLanguageBox > m_xLbLanguage
Definition: numfmt.hxx:115
std::unique_ptr< weld::ComboBox > m_xLbCurrency
Definition: numfmt.hxx:94
std::unique_ptr< weld::Entry > m_xEdFormat
Definition: numfmt.hxx:109
#define LANGUAGE_SYSTEM
const o3tl::enumarray< SvxNumValCategory, double > fSvxNumValConst
#define CAT_DATE
void SetCategory(sal_uInt16 nPos)
Definition: numfmt.cxx:1689
std::unique_ptr< weld::Label > m_xFtDecimals
Definition: numfmt.hxx:99
int i
void SetTextColor(const Color &rColor)
virtual void Reset(const SfxItemSet *rSet) override
Definition: numfmt.cxx:352
#define LANGUAGE_DONTKNOW
sal_Int32 mnPos
Definition: numfmt.hxx:40
#define CAT_ALL
#define CAT_BOOLEAN
std::unique_ptr< weld::Label > m_xFtFormat
Definition: numfmt.hxx:93
#define CAT_CURRENCY
OUString CuiResId(const char *pKey)
Definition: cuiresmgr.cxx:23
std::unique_ptr< weld::Button > m_xIbRemove
Definition: numfmt.hxx:112
std::unique_ptr< weld::Label > m_xFtCategory
Definition: numfmt.hxx:91
void SetColor(const Color &)
void MakePreviewText(const OUString &rFormat)
Definition: numfmt.cxx:1656
sal_Unicode mnChar
Definition: numfmt.hxx:41
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void set_active_currency(sal_Int32 nCurCurrencyEntryPos)
Definition: numfmt.cxx:329
SfxItemState
weld::Entry & rEdit
void EditHdl_Impl(const weld::Entry *)
Definition: numfmt.cxx:1454
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
std::unique_ptr< weld::CheckButton > m_xBtnThousand
Definition: numfmt.hxx:106
std::unique_ptr< weld::Button > m_xIbAdd
Definition: numfmt.hxx:110
void SetFont(const vcl::Font &rNewFont)
IMPL_LINK_NOARG(SvxNumberFormatTabPage, LostFocusHdl_Impl, weld::Widget &, void)
Definition: numfmt.cxx:1592
void clicked()
void SetTransparent(bool bTransparent)
std::unique_ptr< weld::Entry > m_xEdComment
Definition: numfmt.hxx:114
std::unique_ptr< weld::Label > m_xFtLeadZeroes
Definition: numfmt.hxx:104
std::unique_ptr< weld::SpinButton > m_xEdLeadZeroes
Definition: numfmt.hxx:105
#define CAT_USERDEFINED
const Color & GetWindowColor() const
#define CAT_TIME
long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
std::unique_ptr< weld::SpinButton > m_xEdDecimals
Definition: numfmt.hxx:100
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
IMPL_LINK(SvxNumberFormatTabPage, DoubleClickHdl_Impl, weld::TreeView &, rLb, bool)
Definition: numfmt.cxx:1121
DeactivateRC
bool bLegacyAutomaticCurrency
Definition: numfmt.hxx:84
sal_uInt32 GetValue() const
std::unique_ptr< weld::TreeView > m_xLbFormat
Definition: numfmt.hxx:95
void UpdateDecimalsDenominatorEditBox()
Change visible Edit box and Fixed text according to category format if fraction format "Denominator p...
Definition: numfmt.cxx:1100
SvxNumValCategory
sal_uInt32 get_active_currency() const
Definition: numfmt.cxx:343
#define HDL(hdl)
Definition: numfmt.cxx:187
void UpdateFormatListBox_Impl(bool bCat, bool bUpdateEdit)
Definition: numfmt.cxx:987
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
void UpdateOptions_Impl(bool bCheckCatChange)
Definition: numfmt.cxx:845
void Push(PushFlags nFlags=PushFlags::ALL)
SvxNumberFormatTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
Definition: numfmt.cxx:189
virtual ~SvxNumberFormatTabPage() override
Definition: numfmt.cxx:240
void AddAutomaticLanguage_Impl(LanguageType eAutoLang, bool bSelect)
Definition: numfmt.cxx:1718
OUString sAutomaticLangEntry
Definition: numfmt.hxx:87
#define CAT_SCIENTIFIC
SvxNumberPreview m_aWndPreview
Definition: numfmt.hxx:90
void ChangePreviewText(sal_uInt16 nPos)
Definition: numfmt.cxx:1664
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
std::unique_ptr< weld::Label > m_xFtDenominator
Definition: numfmt.hxx:101
std::unique_ptr< weld::SpinButton > m_xEdDenominator
Definition: numfmt.hxx:102