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