1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_FIELD_HXX
21 #define INCLUDED_VCL_FIELD_HXX
24 #include <vcl/dllapi.h>
25 #include <tools/link.hxx>
26 #include <tools/date.hxx>
27 #include <tools/time.hxx>
28 #include <vcl/spinfld.hxx>
29 #include <vcl/combobox.hxx>
30 #include <tools/fldunit.hxx>
32 namespace com
{ namespace sun
{ namespace star
{ namespace lang
{ struct Locale
; } } } }
34 class CalendarWrapper
;
35 class LocaleDataWrapper
;
39 class VCL_DLLPUBLIC FormatterBase
43 std::unique_ptr
<LocaleDataWrapper
>
47 bool mbEmptyFieldValue
;
48 bool mbEmptyFieldValueEnabled
;
51 SAL_DLLPRIVATE
void ImplSetText( const OUString
& rText
, Selection
const * pNewSel
= nullptr );
52 SAL_DLLPRIVATE
bool ImplGetEmptyFieldValue() const { return mbEmptyFieldValue
; }
54 void SetEmptyFieldValueData( bool bValue
) { mbEmptyFieldValue
= bValue
; }
56 SAL_DLLPRIVATE LocaleDataWrapper
& ImplGetLocaleDataWrapper() const;
58 Edit
* GetField() const { return mpField
; }
59 void ClearField() { mpField
.clear(); }
62 explicit FormatterBase(Edit
* pField
);
63 virtual ~FormatterBase();
65 const LocaleDataWrapper
& GetLocaleDataWrapper() const;
67 bool MustBeReformatted() const { return mbReformat
; }
68 void MarkToBeReformatted( bool b
) { mbReformat
= b
; }
70 void SetStrictFormat( bool bStrict
);
71 bool IsStrictFormat() const { return mbStrictFormat
; }
73 virtual void Reformat();
74 virtual void ReformatAll();
76 const css::lang::Locale
& GetLocale() const;
77 const LanguageTag
& GetLanguageTag() const;
79 void SetEmptyFieldValue();
80 bool IsEmptyFieldValue() const;
82 void EnableEmptyFieldValue( bool bEnable
) { mbEmptyFieldValueEnabled
= bEnable
; }
83 bool IsEmptyFieldValueEnabled() const { return mbEmptyFieldValueEnabled
; }
86 #define PATTERN_FORMAT_EMPTYLITERALS (sal_uInt16(0x0001))
88 class VCL_DLLPUBLIC PatternFormatter
: public FormatterBase
92 OUString maLiteralMask
;
94 bool mbInPattKeyInput
;
97 PatternFormatter(Edit
* pEdit
);
99 SAL_DLLPRIVATE
void ImplSetMask(const OString
& rEditMask
,
100 const OUString
& rLiteralMask
);
101 SAL_DLLPRIVATE
bool ImplIsSameMask() const { return mbSameMask
; }
102 SAL_DLLPRIVATE
bool& ImplGetInPattKeyInput() { return mbInPattKeyInput
; }
105 virtual ~PatternFormatter() override
;
107 virtual void Reformat() override
;
109 void SetMask(const OString
& rEditMask
, const OUString
& rLiteralMask
);
110 const OString
& GetEditMask() const { return m_aEditMask
; }
111 const OUString
& GetLiteralMask() const { return maLiteralMask
; }
113 void SetString( const OUString
& rStr
);
114 OUString
GetString() const;
118 class VCL_DLLPUBLIC NumericFormatter
: public FormatterBase
121 virtual ~NumericFormatter() override
;
123 virtual void Reformat() override
;
125 void SetMin( sal_Int64 nNewMin
);
126 sal_Int64
GetMin() const { return mnMin
; }
127 void SetMax( sal_Int64 nNewMax
);
128 sal_Int64
GetMax() const { return mnMax
; }
130 sal_Int64
ClipAgainstMinMax(sal_Int64 nValue
) const;
132 void SetFirst( sal_Int64 nNewFirst
) { mnFirst
= nNewFirst
; }
133 sal_Int64
GetFirst() const { return mnFirst
; }
134 void SetLast( sal_Int64 nNewLast
) { mnLast
= nNewLast
; }
135 sal_Int64
GetLast() const { return mnLast
; }
136 void SetSpinSize( sal_Int64 nNewSize
) { mnSpinSize
= nNewSize
; }
137 sal_Int64
GetSpinSize() const { return mnSpinSize
; }
139 void SetDecimalDigits( sal_uInt16 nDigits
);
140 sal_uInt16
GetDecimalDigits() const { return mnDecimalDigits
;}
142 void SetUseThousandSep( bool b
);
143 bool IsUseThousandSep() const { return mbThousandSep
; }
145 void SetShowTrailingZeros( bool bShowTrailingZeros
);
146 bool IsShowTrailingZeros() const { return mbShowTrailingZeros
; }
148 void SetUserValue( sal_Int64 nNewValue
);
149 virtual void SetValue( sal_Int64 nNewValue
);
150 sal_Int64
GetValue() const;
151 virtual OUString
CreateFieldText( sal_Int64 nValue
) const;
152 bool IsValueModified() const;
154 sal_Int64
Normalize( sal_Int64 nValue
) const;
155 sal_Int64
Denormalize( sal_Int64 nValue
) const;
158 sal_Int64 mnFieldValue
;
159 sal_Int64 mnLastValue
;
165 // the members below are used in all derivatives of NumericFormatter
166 // not in NumericFormatter itself.
167 sal_Int64 mnSpinSize
;
171 NumericFormatter(Edit
* pEdit
);
177 void FormatValue(Selection
const * pNewSelection
= nullptr);
179 SAL_DLLPRIVATE
void ImplNumericReformat();
180 SAL_DLLPRIVATE
void ImplNewFieldValue( sal_Int64 nNewValue
);
181 SAL_DLLPRIVATE
void ImplSetUserValue( sal_Int64 nNewValue
, Selection
const * pNewSelection
= nullptr );
183 virtual sal_Int64
GetValueFromString(const OUString
& rStr
) const;
186 sal_uInt16 mnDecimalDigits
;
188 bool mbShowTrailingZeros
;
193 class VCL_DLLPUBLIC MetricFormatter
: public NumericFormatter
196 virtual ~MetricFormatter() override
;
198 virtual void CustomConvert() = 0;
199 virtual void Reformat() override
;
201 virtual void SetUnit( FieldUnit meUnit
);
202 FieldUnit
GetUnit() const { return meUnit
; }
203 void SetCustomUnitText( const OUString
& rStr
);
204 const OUString
& GetCustomUnitText() const { return maCustomUnitText
; }
206 using NumericFormatter::SetMax
;
207 void SetMax( sal_Int64 nNewMax
, FieldUnit eInUnit
);
208 using NumericFormatter::GetMax
;
209 sal_Int64
GetMax( FieldUnit eOutUnit
) const;
210 using NumericFormatter::SetMin
;
211 void SetMin( sal_Int64 nNewMin
, FieldUnit eInUnit
);
212 using NumericFormatter::GetMin
;
213 sal_Int64
GetMin( FieldUnit eOutUnit
) const;
214 sal_Int64
GetBaseValue() const;
216 virtual void SetValue( sal_Int64 nNewValue
, FieldUnit eInUnit
);
217 virtual void SetValue( sal_Int64 nValue
) override
;
218 using NumericFormatter::SetUserValue
;
219 void SetUserValue( sal_Int64 nNewValue
, FieldUnit eInUnit
);
220 using NumericFormatter::GetValue
;
221 sal_Int64
GetValue( FieldUnit eOutUnit
) const;
222 virtual OUString
CreateFieldText( sal_Int64 nValue
) const override
;
223 sal_Int64
GetCorrectedValue( FieldUnit eOutUnit
) const;
225 static FieldUnit
StringToMetric(const OUString
&rMetricString
);
226 static bool TextToValue(const OUString
& rStr
, double& rValue
, sal_Int64 nBaseValue
, sal_uInt16 nDecDigits
, const LocaleDataWrapper
& rLocaleDataWrapper
, FieldUnit eUnit
);
229 sal_Int64 mnBaseValue
;
231 Link
<MetricFormatter
&,void> maCustomConvertLink
;
233 MetricFormatter(Edit
* pEdit
);
235 SAL_DLLPRIVATE
void ImplMetricReformat( const OUString
& rStr
, double& rValue
, OUString
& rOutStr
);
237 virtual sal_Int64
GetValueFromString(const OUString
& rStr
) const override
;
238 virtual sal_Int64
GetValueFromStringUnit(const OUString
& rStr
, FieldUnit eOutUnit
) const;
241 OUString maCustomUnitText
;
242 OUString maCurUnitText
;
246 class VCL_DLLPUBLIC CurrencyFormatter
: public NumericFormatter
249 CurrencyFormatter(Edit
* pEdit
);
250 SAL_DLLPRIVATE
void ImplCurrencyReformat( const OUString
& rStr
, OUString
& rOutStr
);
251 virtual sal_Int64
GetValueFromString(const OUString
& rStr
) const override
;
254 virtual ~CurrencyFormatter() override
;
256 virtual void Reformat() override
;
258 virtual void SetValue( sal_Int64 nNewValue
) override
;
259 virtual OUString
CreateFieldText( sal_Int64 nValue
) const override
;
263 class VCL_DLLPUBLIC DateFormatter
: public FormatterBase
266 std::unique_ptr
<CalendarWrapper
> mxCalendarWrapper
;
272 bool mbShowDateCentury
;
273 ExtDateFieldFormat mnExtDateFormat
;
274 bool mbEnforceValidValue
;
277 DateFormatter(Edit
* pEdit
);
279 SAL_DLLPRIVATE
const Date
& ImplGetFieldDate() const { return maFieldDate
; }
280 SAL_DLLPRIVATE
void ImplDateReformat( const OUString
& rStr
, OUString
& rOutStr
);
281 SAL_DLLPRIVATE
void ImplSetUserDate( const Date
& rNewDate
,
282 Selection
const * pNewSelection
= nullptr );
283 SAL_DLLPRIVATE OUString
ImplGetDateAsText( const Date
& rDate
) const;
284 SAL_DLLPRIVATE
void ImplNewFieldValue( const Date
& rDate
);
285 CalendarWrapper
& GetCalendarWrapper() const;
287 SAL_DLLPRIVATE
bool ImplAllowMalformedInput() const;
290 virtual ~DateFormatter() override
;
292 virtual void Reformat() override
;
293 virtual void ReformatAll() override
;
295 void SetExtDateFormat( ExtDateFieldFormat eFormat
);
296 ExtDateFieldFormat
GetExtDateFormat( bool bResolveSystemFormat
= false ) const;
298 void SetMin( const Date
& rNewMin
);
299 const Date
& GetMin() const { return maMin
; }
301 void SetMax( const Date
& rNewMax
);
302 const Date
& GetMax() const { return maMax
; }
305 // MT: Remove these methods too, ExtDateFormat should be enough!
306 // What should happen if using DDMMYYYY, but ShowCentury=false?
308 void SetLongFormat( bool bLong
);
309 bool IsLongFormat() const { return mbLongFormat
; }
310 void SetShowDateCentury( bool bShowCentury
);
311 bool IsShowDateCentury() const { return mbShowDateCentury
; }
314 void SetDate( const Date
& rNewDate
);
315 Date
GetDate() const;
317 bool IsEmptyDate() const;
319 void ResetLastDate() { maLastDate
= Date( Date::EMPTY
); }
321 static void ExpandCentury( Date
& rDate
);
322 static void ExpandCentury( Date
& rDate
, sal_uInt16 nTwoDigitYearStart
);
324 /** enables or disables the enforcement of valid values
326 If this is set to true (which is the default), then GetDate will always return a valid
327 date, no matter whether the current text can really be interpreted as date. (Note: this
328 is the compatible behavior).
330 If this is set to false, the GetDate will return GetInvalidDate, in case the current text
331 cannot be interpreted as date.
333 In addition, if this is set to false, the text in the field will \em not be corrected
334 when the control loses the focus - instead, the invalid input will be preserved.
336 void EnforceValidValue( bool _bEnforce
) { mbEnforceValidValue
= _bEnforce
; }
337 bool IsEnforceValidValue( ) const { return mbEnforceValidValue
; }
341 class VCL_DLLPUBLIC TimeFormatter
: public FormatterBase
344 tools::Time maLastTime
;
347 TimeFieldFormat meFormat
;
348 TimeFormat mnTimeFormat
;
350 bool mbEnforceValidValue
;
353 tools::Time maFieldTime
;
355 TimeFormatter(Edit
* pEdit
);
357 SAL_DLLPRIVATE
void ImplTimeReformat( const OUString
& rStr
, OUString
& rOutStr
);
358 SAL_DLLPRIVATE
void ImplNewFieldValue( const tools::Time
& rTime
);
359 SAL_DLLPRIVATE
void ImplSetUserTime( const tools::Time
& rNewTime
, Selection
const * pNewSelection
= nullptr );
360 SAL_DLLPRIVATE
bool ImplAllowMalformedInput() const;
363 static OUString
FormatTime(const tools::Time
& rNewTime
, TimeFieldFormat eFormat
, TimeFormat eHourFormat
, bool bDuration
, const LocaleDataWrapper
& rLocaleData
);
364 static bool TextToTime(const OUString
& rStr
, tools::Time
& rTime
, TimeFieldFormat eFormat
, bool bDuration
, const LocaleDataWrapper
& rLocaleDataWrapper
, bool _bSkipInvalidCharacters
= true);
365 static int GetTimeArea(TimeFieldFormat eFormat
, const OUString
& rText
, int nCursor
,
366 const LocaleDataWrapper
& rLocaleDataWrapper
);
367 static tools::Time
SpinTime(bool bUp
, const tools::Time
& rTime
, TimeFieldFormat eFormat
,
368 bool bDuration
, const OUString
& rText
, int nCursor
,
369 const LocaleDataWrapper
& rLocaleDataWrapper
);
371 virtual ~TimeFormatter() override
;
373 virtual void Reformat() override
;
374 virtual void ReformatAll() override
;
376 void SetMin( const tools::Time
& rNewMin
);
377 const tools::Time
& GetMin() const { return maMin
; }
378 void SetMax( const tools::Time
& rNewMax
);
379 const tools::Time
& GetMax() const { return maMax
; }
381 void SetTimeFormat( TimeFormat eNewFormat
);
382 TimeFormat
GetTimeFormat() const { return mnTimeFormat
;}
384 void SetFormat( TimeFieldFormat eNewFormat
);
385 TimeFieldFormat
GetFormat() const { return meFormat
; }
387 void SetDuration( bool mbDuration
);
388 bool IsDuration() const { return mbDuration
; }
390 void SetTime( const tools::Time
& rNewTime
);
391 void SetUserTime( const tools::Time
& rNewTime
);
392 tools::Time
GetTime() const;
393 void SetEmptyTime() { FormatterBase::SetEmptyFieldValue(); }
394 bool IsEmptyTime() const { return FormatterBase::IsEmptyFieldValue(); }
396 /** enables or disables the enforcement of valid values
398 If this is set to true (which is the default), then GetTime will always return a valid
399 time, no matter whether the current text can really be interpreted as time. (Note: this
400 is the compatible behavior).
402 If this is set to false, the GetTime will return GetInvalidTime, in case the current text
403 cannot be interpreted as time.
405 In addition, if this is set to false, the text in the field will <em>not</em> be corrected
406 when the control loses the focus - instead, the invalid input will be preserved.
408 void EnforceValidValue( bool _bEnforce
) { mbEnforceValidValue
= _bEnforce
; }
409 bool IsEnforceValidValue( ) const { return mbEnforceValidValue
; }
413 class VCL_DLLPUBLIC PatternField final
: public SpinField
, public PatternFormatter
416 explicit PatternField( vcl::Window
* pParent
, WinBits nWinStyle
);
418 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
419 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
420 virtual void Modify() override
;
421 virtual void dispose() override
;
425 class VCL_DLLPUBLIC NumericField
: public SpinField
, public NumericFormatter
428 explicit NumericField( vcl::Window
* pParent
, WinBits nWinStyle
);
430 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
431 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
432 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
434 virtual Size
CalcMinimumSize() const override
;
436 virtual void Modify() override
;
438 virtual void Up() override
;
439 virtual void Down() override
;
440 virtual void First() override
;
441 virtual void Last() override
;
442 virtual bool set_property(const OString
&rKey
, const OUString
&rValue
) override
;
443 virtual void dispose() override
;
445 virtual boost::property_tree::ptree
DumpAsPropertyTree() override
;
449 class VCL_DLLPUBLIC MetricField
: public SpinField
, public MetricFormatter
452 explicit MetricField( vcl::Window
* pParent
, WinBits nWinStyle
);
454 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
455 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
456 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
458 virtual Size
CalcMinimumSize() const override
;
460 virtual void Modify() override
;
462 virtual void Up() override
;
463 virtual void Down() override
;
464 virtual void First() override
;
465 virtual void Last() override
;
466 virtual void CustomConvert() override
;
468 virtual void SetUnit( FieldUnit meUnit
) override
;
470 void SetFirst( sal_Int64 nNewFirst
, FieldUnit eInUnit
);
471 void SetFirst(sal_Int64 first
) { SetFirst(first
, FieldUnit::NONE
); }
472 sal_Int64
GetFirst( FieldUnit eOutUnit
) const;
473 void SetLast( sal_Int64 nNewLast
, FieldUnit eInUnit
);
474 void SetLast(sal_Int64 last
) { SetLast(last
, FieldUnit::NONE
); }
475 sal_Int64
GetLast( FieldUnit eOutUnit
) const;
477 static sal_Int64
ConvertValue( sal_Int64 nValue
, sal_Int64 mnBaseValue
, sal_uInt16 nDecDigits
,
478 FieldUnit eInUnit
, FieldUnit eOutUnit
);
479 static sal_Int64
ConvertValue( sal_Int64 nValue
, sal_uInt16 nDecDigits
,
480 MapUnit eInUnit
, FieldUnit eOutUnit
);
482 // for backwards compatibility
483 // caution: conversion to double loses precision
484 static double ConvertDoubleValue( double nValue
, sal_Int64 mnBaseValue
, sal_uInt16 nDecDigits
,
485 FieldUnit eInUnit
, FieldUnit eOutUnit
);
486 static double ConvertDoubleValue( double nValue
, sal_uInt16 nDecDigits
,
487 FieldUnit eInUnit
, MapUnit eOutUnit
);
488 static double ConvertDoubleValue( double nValue
, sal_uInt16 nDecDigits
,
489 MapUnit eInUnit
, FieldUnit eOutUnit
);
491 // for backwards compatibility
492 // caution: conversion to double loses precision
493 static double ConvertDoubleValue( sal_Int64 nValue
, sal_Int64 nBaseValue
, sal_uInt16 nDecDigits
,
494 FieldUnit eInUnit
, FieldUnit eOutUnit
)
495 { return ConvertDoubleValue( static_cast<double>(nValue
), nBaseValue
, nDecDigits
, eInUnit
, eOutUnit
); }
496 static double ConvertDoubleValue( sal_Int64 nValue
, sal_uInt16 nDecDigits
,
497 FieldUnit eInUnit
, MapUnit eOutUnit
)
498 { return ConvertDoubleValue( static_cast<double>(nValue
), nDecDigits
, eInUnit
, eOutUnit
); }
499 static double ConvertDoubleValue( sal_Int64 nValue
, sal_uInt16 nDecDigits
,
500 MapUnit eInUnit
, FieldUnit eOutUnit
)
501 { return ConvertDoubleValue( static_cast<double>(nValue
), nDecDigits
, eInUnit
, eOutUnit
); }
503 virtual bool set_property(const OString
&rKey
, const OUString
&rValue
) override
;
504 virtual void dispose() override
;
506 virtual boost::property_tree::ptree
DumpAsPropertyTree() override
;
510 class VCL_DLLPUBLIC CurrencyField final
: public SpinField
, public CurrencyFormatter
513 CurrencyField( vcl::Window
* pParent
, WinBits nWinStyle
);
515 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
516 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
517 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
519 virtual void Modify() override
;
521 virtual void Up() override
;
522 virtual void Down() override
;
523 virtual void First() override
;
524 virtual void Last() override
;
525 virtual void dispose() override
;
529 class VCL_DLLPUBLIC DateField
: public SpinField
, public DateFormatter
536 SAL_DLLPRIVATE
void ImplDateSpinArea( bool bUp
);
539 explicit DateField( vcl::Window
* pParent
, WinBits nWinStyle
);
541 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
542 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
543 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
545 virtual void Modify() override
;
547 virtual void Up() override
;
548 virtual void Down() override
;
549 virtual void First() override
;
550 virtual void Last() override
;
552 void SetFirst( const Date
& rNewFirst
) { maFirst
= rNewFirst
; }
553 const Date
& GetFirst() const { return maFirst
; }
554 void SetLast( const Date
& rNewLast
) { maLast
= rNewLast
; }
555 const Date
& GetLast() const { return maLast
; }
556 virtual void dispose() override
;
560 class VCL_DLLPUBLIC TimeField final
: public SpinField
, public TimeFormatter
566 SAL_DLLPRIVATE
void ImplTimeSpinArea( bool bUp
);
569 explicit TimeField( vcl::Window
* pParent
, WinBits nWinStyle
);
571 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
572 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
573 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
575 virtual void Modify() override
;
577 virtual void Up() override
;
578 virtual void Down() override
;
579 virtual void First() override
;
580 virtual void Last() override
;
582 void SetFirst( const tools::Time
& rNewFirst
) { maFirst
= rNewFirst
; }
583 const tools::Time
& GetFirst() const { return maFirst
; }
584 void SetLast( const tools::Time
& rNewLast
) { maLast
= rNewLast
; }
585 const tools::Time
& GetLast() const { return maLast
; }
587 void SetExtFormat( ExtTimeFieldFormat eFormat
);
588 virtual void dispose() override
;
592 class VCL_DLLPUBLIC PatternBox final
: public ComboBox
, public PatternFormatter
595 PatternBox( vcl::Window
* pParent
, WinBits nWinStyle
);
597 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
598 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
600 virtual void Modify() override
;
602 virtual void ReformatAll() override
;
603 virtual void dispose() override
;
607 class VCL_DLLPUBLIC NumericBox
: public ComboBox
, public NumericFormatter
609 SAL_DLLPRIVATE
void ImplNumericReformat( const OUString
& rStr
, sal_Int64
& rValue
, OUString
& rOutStr
);
611 explicit NumericBox( vcl::Window
* pParent
, WinBits nWinStyle
);
613 virtual Size
CalcMinimumSize() const override
;
615 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
616 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
617 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
619 virtual void Modify() override
;
621 virtual void ReformatAll() override
;
623 void InsertValue( sal_Int64 nValue
, sal_Int32 nPos
= COMBOBOX_APPEND
);
624 virtual void dispose() override
;
628 class VCL_DLLPUBLIC MetricBox
: public ComboBox
, public MetricFormatter
631 explicit MetricBox( vcl::Window
* pParent
, WinBits nWinStyle
);
633 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
634 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
635 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
637 virtual Size
CalcMinimumSize() const override
;
639 virtual void Modify() override
;
641 virtual void CustomConvert() override
;
642 virtual void ReformatAll() override
;
644 void InsertValue( sal_Int64 nValue
, FieldUnit eInUnit
= FieldUnit::NONE
,
645 sal_Int32 nPos
= COMBOBOX_APPEND
);
647 // Needed, because GetValue() with nPos hide these functions
648 using MetricFormatter::GetValue
;
650 virtual void dispose() override
;
654 class VCL_DLLPUBLIC CurrencyBox final
: public ComboBox
, public CurrencyFormatter
657 explicit CurrencyBox( vcl::Window
* pParent
, WinBits nWinStyle
);
659 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
660 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
661 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
663 virtual void Modify() override
;
665 virtual void ReformatAll() override
;
667 virtual void dispose() override
;
671 class VCL_DLLPUBLIC DateBox final
: public ComboBox
, public DateFormatter
674 explicit DateBox( vcl::Window
* pParent
, WinBits nWinStyle
);
676 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
677 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
678 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
680 virtual void Modify() override
;
682 virtual void ReformatAll() override
;
683 virtual void dispose() override
;
687 class VCL_DLLPUBLIC TimeBox final
: public ComboBox
, public TimeFormatter
690 explicit TimeBox( vcl::Window
* pParent
, WinBits nWinStyle
);
692 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
693 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
694 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
696 virtual void Modify() override
;
698 virtual void ReformatAll() override
;
699 virtual void dispose() override
;
702 #endif // INCLUDED_VCL_FIELD_HXX
704 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */