Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / field.hxx
blob763fe714d9f02a9a8b3a759e796f65d14dd6783c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include <memory>
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;
36 class LanguageTag;
39 class VCL_DLLPUBLIC FormatterBase
41 private:
42 VclPtr<Edit> mpField;
43 std::unique_ptr<LocaleDataWrapper>
44 mpLocaleDataWrapper;
45 bool mbReformat;
46 bool mbStrictFormat;
47 bool mbEmptyFieldValue;
48 bool mbEmptyFieldValueEnabled;
49 bool mbDefaultLocale;
51 protected:
52 SAL_DLLPRIVATE void ImplSetText( const OUString& rText, Selection* pNewSel = nullptr );
53 SAL_DLLPRIVATE bool ImplGetEmptyFieldValue() const { return mbEmptyFieldValue; }
55 void SetEmptyFieldValueData( bool bValue ) { mbEmptyFieldValue = bValue; }
57 SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const;
58 bool IsDefaultLocale() const { return mbDefaultLocale; }
60 public:
61 explicit FormatterBase();
62 virtual ~FormatterBase();
64 const LocaleDataWrapper& GetLocaleDataWrapper() const;
66 void SetField( Edit* pField ) { mpField = pField; }
67 Edit* GetField() const { return mpField; }
69 bool MustBeReformatted() const { return mbReformat; }
70 void MarkToBeReformatted( bool b ) { mbReformat = b; }
72 void SetStrictFormat( bool bStrict );
73 bool IsStrictFormat() const { return mbStrictFormat; }
75 virtual void Reformat();
76 virtual void ReformatAll();
78 virtual void SetLocale( const css::lang::Locale& rLocale );
79 const css::lang::Locale& GetLocale() const;
80 const LanguageTag& GetLanguageTag() const;
82 void SetEmptyFieldValue();
83 bool IsEmptyFieldValue() const;
85 void EnableEmptyFieldValue( bool bEnable ) { mbEmptyFieldValueEnabled = bEnable; }
86 bool IsEmptyFieldValueEnabled() const { return mbEmptyFieldValueEnabled; }
90 #define PATTERN_FORMAT_EMPTYLITERALS ((sal_uInt16)0x0001)
92 class VCL_DLLPUBLIC PatternFormatter : public FormatterBase
94 private:
95 OString m_aEditMask;
96 OUString maFieldString;
97 OUString maLiteralMask;
98 bool mbSameMask;
99 bool mbInPattKeyInput;
101 protected:
102 PatternFormatter();
104 SAL_DLLPRIVATE void ImplSetMask(const OString& rEditMask,
105 const OUString& rLiteralMask);
106 SAL_DLLPRIVATE bool ImplIsSameMask() const { return mbSameMask; }
107 SAL_DLLPRIVATE bool& ImplGetInPattKeyInput() { return mbInPattKeyInput; }
109 public:
110 virtual ~PatternFormatter() override;
112 virtual void Reformat() override;
114 void SetMask(const OString& rEditMask, const OUString& rLiteralMask );
115 const OString& GetEditMask() const { return m_aEditMask; }
116 const OUString& GetLiteralMask() const { return maLiteralMask; }
118 void SetString( const OUString& rStr );
119 OUString GetString() const;
123 class VCL_DLLPUBLIC NumericFormatter : public FormatterBase
125 public:
126 virtual ~NumericFormatter() override;
128 virtual void Reformat() override;
130 void SetMin( sal_Int64 nNewMin );
131 sal_Int64 GetMin() const { return mnMin; }
132 void SetMax( sal_Int64 nNewMax );
133 sal_Int64 GetMax() const { return mnMax; }
135 sal_Int64 ClipAgainstMinMax(sal_Int64 nValue) const;
137 void SetFirst( sal_Int64 nNewFirst ) { mnFirst = nNewFirst; }
138 sal_Int64 GetFirst() const { return mnFirst; }
139 void SetLast( sal_Int64 nNewLast ) { mnLast = nNewLast; }
140 sal_Int64 GetLast() const { return mnLast; }
141 void SetSpinSize( sal_Int64 nNewSize ) { mnSpinSize = nNewSize; }
142 sal_Int64 GetSpinSize() const { return mnSpinSize; }
144 void SetDecimalDigits( sal_uInt16 nDigits );
145 sal_uInt16 GetDecimalDigits() const { return mnDecimalDigits;}
147 void SetUseThousandSep( bool b );
148 bool IsUseThousandSep() const { return mbThousandSep; }
150 void SetShowTrailingZeros( bool bShowTrailingZeros );
151 bool IsShowTrailingZeros() const { return mbShowTrailingZeros; }
154 void SetUserValue( sal_Int64 nNewValue );
155 virtual void SetValue( sal_Int64 nNewValue );
156 virtual sal_Int64 GetValue() const;
157 virtual OUString CreateFieldText( sal_Int64 nValue ) const;
158 bool IsValueModified() const;
160 sal_Int64 Normalize( sal_Int64 nValue ) const;
161 sal_Int64 Denormalize( sal_Int64 nValue ) const;
163 protected:
164 sal_Int64 mnFieldValue;
165 sal_Int64 mnLastValue;
166 sal_Int64 mnMin;
167 sal_Int64 mnMax;
168 sal_uInt16 mnType;
169 bool mbWrapOnLimits;
171 // the members below are used in all derivatives of NumericFormatter
172 // not in NumericFormatter itself.
173 sal_Int64 mnSpinSize;
174 sal_Int64 mnFirst;
175 sal_Int64 mnLast;
177 NumericFormatter();
179 void FieldUp();
180 void FieldDown();
181 void FieldFirst();
182 void FieldLast();
184 SAL_DLLPRIVATE bool ImplNumericReformat( const OUString& rStr, sal_Int64& rValue, OUString& rOutStr );
185 SAL_DLLPRIVATE void ImplNewFieldValue( sal_Int64 nNewValue );
186 SAL_DLLPRIVATE void ImplSetUserValue( sal_Int64 nNewValue, Selection* pNewSelection = nullptr );
188 private:
189 SAL_DLLPRIVATE void ImplInit();
191 sal_uInt16 mnDecimalDigits;
192 bool mbThousandSep;
193 bool mbShowTrailingZeros;
198 class VCL_DLLPUBLIC MetricFormatter : public NumericFormatter
200 public:
201 virtual ~MetricFormatter() override;
203 virtual void CustomConvert() = 0;
204 virtual void Reformat() override;
206 virtual void SetUnit( FieldUnit meUnit );
207 FieldUnit GetUnit() const { return meUnit; }
208 void SetCustomUnitText( const OUString& rStr );
209 const OUString& GetCustomUnitText() const { return maCustomUnitText; }
210 const OUString& GetCurUnitText() const { return maCurUnitText; }
212 using NumericFormatter::SetMax;
213 void SetMax( sal_Int64 nNewMax, FieldUnit eInUnit );
214 using NumericFormatter::GetMax;
215 sal_Int64 GetMax( FieldUnit eOutUnit ) const;
216 using NumericFormatter::SetMin;
217 void SetMin( sal_Int64 nNewMin, FieldUnit eInUnit );
218 using NumericFormatter::GetMin;
219 sal_Int64 GetMin( FieldUnit eOutUnit ) const;
220 void SetBaseValue( sal_Int64 nNewBase, FieldUnit eInUnit = FUNIT_NONE );
221 sal_Int64 GetBaseValue() const;
223 virtual void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit );
224 virtual void SetValue( sal_Int64 nValue ) override;
225 using NumericFormatter::SetUserValue;
226 void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit );
227 virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const;
228 virtual sal_Int64 GetValue() const override;
229 virtual OUString CreateFieldText( sal_Int64 nValue ) const override;
230 sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const;
232 void SetCustomConvertHdl( const Link<MetricFormatter&,void>& rLink ) { maCustomConvertLink = rLink; }
234 static FieldUnit StringToMetric(const OUString &rMetricString);
235 protected:
236 sal_Int64 mnBaseValue;
237 FieldUnit meUnit;
238 Link<MetricFormatter&,void> maCustomConvertLink;
240 MetricFormatter();
242 SAL_DLLPRIVATE bool ImplMetricReformat( const OUString& rStr, double& rValue, OUString& rOutStr );
244 private:
245 SAL_DLLPRIVATE void ImplInit();
247 OUString maCustomUnitText;
248 OUString maCurUnitText;
252 class VCL_DLLPUBLIC CurrencyFormatter : public NumericFormatter
254 protected:
255 CurrencyFormatter();
256 SAL_DLLPRIVATE bool ImplCurrencyReformat( const OUString& rStr, OUString& rOutStr );
258 public:
259 virtual ~CurrencyFormatter() override;
261 virtual void Reformat() override;
263 virtual void SetValue( sal_Int64 nNewValue ) override;
264 virtual sal_Int64 GetValue() const override;
265 virtual OUString CreateFieldText( sal_Int64 nValue ) const override;
269 class VCL_DLLPUBLIC DateFormatter : public FormatterBase
271 private:
272 CalendarWrapper* mpCalendarWrapper;
273 Date maFieldDate;
274 Date maLastDate;
275 Date maMin;
276 Date maMax;
277 bool mbLongFormat;
278 bool mbShowDateCentury;
279 ExtDateFieldFormat mnExtDateFormat;
280 bool mbEnforceValidValue;
282 SAL_DLLPRIVATE void ImplInit();
284 protected:
285 DateFormatter();
287 SAL_DLLPRIVATE const Date& ImplGetFieldDate() const { return maFieldDate; }
288 SAL_DLLPRIVATE bool ImplDateReformat( const OUString& rStr, OUString& rOutStr );
289 SAL_DLLPRIVATE void ImplSetUserDate( const Date& rNewDate,
290 Selection* pNewSelection = nullptr );
291 SAL_DLLPRIVATE OUString ImplGetDateAsText( const Date& rDate ) const;
292 SAL_DLLPRIVATE void ImplNewFieldValue( const Date& rDate );
293 CalendarWrapper& GetCalendarWrapper() const;
295 SAL_DLLPRIVATE bool ImplAllowMalformedInput() const;
297 public:
298 virtual ~DateFormatter() override;
300 virtual void Reformat() override;
301 virtual void ReformatAll() override;
303 virtual void SetLocale( const css::lang::Locale& rLocale ) override;
306 void SetExtDateFormat( ExtDateFieldFormat eFormat );
307 ExtDateFieldFormat GetExtDateFormat( bool bResolveSystemFormat = false ) const;
309 void SetMin( const Date& rNewMin );
310 const Date& GetMin() const { return maMin; }
312 void SetMax( const Date& rNewMax );
313 const Date& GetMax() const { return maMax; }
316 // MT: Remove these methods too, ExtDateFormat should be enough!
317 // What should happen if using DDMMYYYY, but ShowCentury=false?
319 void SetLongFormat( bool bLong );
320 bool IsLongFormat() const { return mbLongFormat; }
321 void SetShowDateCentury( bool bShowCentury );
322 bool IsShowDateCentury() const { return mbShowDateCentury; }
325 void SetDate( const Date& rNewDate );
326 Date GetDate() const;
327 void SetEmptyDate();
328 bool IsEmptyDate() const;
330 void ResetLastDate() { maLastDate = Date( Date::EMPTY ); }
332 static void ExpandCentury( Date& rDate );
333 static void ExpandCentury( Date& rDate, sal_uInt16 nTwoDigitYearStart );
335 /** enables or disables the enforcement of valid values
337 If this is set to true (which is the default), then GetDate will always return a valid
338 date, no matter whether the current text can really be interpreted as date. (Note: this
339 is the compatible behavior).
341 If this is set to false, the GetDate will return GetInvalidDate, in case the current text
342 cannot be interpreted as date.
344 In addition, if this is set to false, the text in the field will \em not be corrected
345 when the control loses the focus - instead, the invalid input will be preserved.
347 void EnforceValidValue( bool _bEnforce ) { mbEnforceValidValue = _bEnforce; }
348 bool IsEnforceValidValue( ) const { return mbEnforceValidValue; }
352 class VCL_DLLPUBLIC TimeFormatter : public FormatterBase
354 public:
355 enum class TimeFormat {
356 Hour12,
357 Hour24
360 private:
361 tools::Time maLastTime;
362 tools::Time maMin;
363 tools::Time maMax;
364 TimeFieldFormat meFormat;
365 TimeFormat mnTimeFormat;
366 bool mbDuration;
367 bool mbEnforceValidValue;
369 SAL_DLLPRIVATE void ImplInit();
371 protected:
372 tools::Time maFieldTime;
374 TimeFormatter();
376 SAL_DLLPRIVATE bool ImplTimeReformat( const OUString& rStr, OUString& rOutStr );
377 SAL_DLLPRIVATE void ImplNewFieldValue( const tools::Time& rTime );
378 SAL_DLLPRIVATE void ImplSetUserTime( const tools::Time& rNewTime, Selection* pNewSelection = nullptr );
379 SAL_DLLPRIVATE bool ImplAllowMalformedInput() const;
381 public:
383 virtual ~TimeFormatter() override;
385 virtual void Reformat() override;
386 virtual void ReformatAll() override;
388 void SetMin( const tools::Time& rNewMin );
389 const tools::Time& GetMin() const { return maMin; }
390 void SetMax( const tools::Time& rNewMax );
391 const tools::Time& GetMax() const { return maMax; }
393 void SetTimeFormat( TimeFormat eNewFormat );
394 TimeFormat GetTimeFormat() const { return (TimeFormat)mnTimeFormat;}
396 void SetFormat( TimeFieldFormat eNewFormat );
397 TimeFieldFormat GetFormat() const { return meFormat; }
399 void SetDuration( bool mbDuration );
400 bool IsDuration() const { return mbDuration; }
402 void SetTime( const tools::Time& rNewTime );
403 void SetUserTime( const tools::Time& rNewTime );
404 tools::Time GetTime() const;
405 void SetEmptyTime() { FormatterBase::SetEmptyFieldValue(); }
406 bool IsEmptyTime() const { return FormatterBase::IsEmptyFieldValue(); }
408 /** enables or disables the enforcement of valid values
410 If this is set to true (which is the default), then GetTime will always return a valid
411 time, no matter whether the current text can really be interpreted as time. (Note: this
412 is the compatible behavior).
414 If this is set to false, the GetTime will return GetInvalidTime, in case the current text
415 cannot be interpreted as time.
417 In addition, if this is set to false, the text in the field will <em>not</em> be corrected
418 when the control loses the focus - instead, the invalid input will be preserved.
420 void EnforceValidValue( bool _bEnforce ) { mbEnforceValidValue = _bEnforce; }
421 bool IsEnforceValidValue( ) const { return mbEnforceValidValue; }
425 class VCL_DLLPUBLIC PatternField : public SpinField, public PatternFormatter
427 public:
428 explicit PatternField( vcl::Window* pParent, WinBits nWinStyle );
430 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
431 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
432 virtual void Modify() override;
433 virtual void dispose() override;
437 class VCL_DLLPUBLIC NumericField : public SpinField, public NumericFormatter
439 public:
440 explicit NumericField( vcl::Window* pParent, WinBits nWinStyle );
442 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
443 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
444 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
446 virtual Size CalcMinimumSize() const override;
448 virtual void Modify() override;
450 virtual void Up() override;
451 virtual void Down() override;
452 virtual void First() override;
453 virtual void Last() override;
454 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
455 virtual void dispose() override;
459 class VCL_DLLPUBLIC MetricField : public SpinField, public MetricFormatter
461 public:
462 explicit MetricField( vcl::Window* pParent, WinBits nWinStyle );
464 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
465 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
466 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
468 virtual Size CalcMinimumSize() const override;
470 virtual void Modify() override;
472 virtual void Up() override;
473 virtual void Down() override;
474 virtual void First() override;
475 virtual void Last() override;
476 virtual void CustomConvert() override;
478 virtual void SetUnit( FieldUnit meUnit ) override;
480 void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit );
481 void SetFirst(sal_Int64 first) { SetFirst(first, FUNIT_NONE); }
482 sal_Int64 GetFirst( FieldUnit eOutUnit ) const;
483 sal_Int64 GetFirst() const { return GetFirst(FUNIT_NONE); }
484 void SetLast( sal_Int64 nNewLast, FieldUnit eInUnit );
485 void SetLast(sal_Int64 last) { SetLast(last, FUNIT_NONE); }
486 sal_Int64 GetLast( FieldUnit eOutUnit ) const;
487 sal_Int64 GetLast() const { return GetLast(FUNIT_NONE); }
489 static void SetDefaultUnit( FieldUnit eDefaultUnit );
490 static FieldUnit GetDefaultUnit();
491 static sal_Int64 ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
492 FieldUnit eInUnit, FieldUnit eOutUnit );
493 static sal_Int64 ConvertValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
494 MapUnit eInUnit, FieldUnit eOutUnit );
496 // for backwards compatibility
497 // caution: conversion to double loses precision
498 static double ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
499 FieldUnit eInUnit, FieldUnit eOutUnit );
500 static double ConvertDoubleValue( double nValue, sal_uInt16 nDecDigits,
501 FieldUnit eInUnit, MapUnit eOutUnit );
502 static double ConvertDoubleValue( double nValue, sal_uInt16 nDecDigits,
503 MapUnit eInUnit, FieldUnit eOutUnit );
505 // for backwards compatibility
506 // caution: conversion to double loses precision
507 static double ConvertDoubleValue( sal_Int64 nValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits,
508 FieldUnit eInUnit, FieldUnit eOutUnit )
509 { return ConvertDoubleValue( static_cast<double>(nValue), nBaseValue, nDecDigits, eInUnit, eOutUnit ); }
510 static double ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
511 FieldUnit eInUnit, MapUnit eOutUnit )
512 { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); }
513 static double ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
514 MapUnit eInUnit, FieldUnit eOutUnit )
515 { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); }
517 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
518 virtual void dispose() override;
522 class VCL_DLLPUBLIC CurrencyField : public SpinField, public CurrencyFormatter
524 public:
525 CurrencyField( vcl::Window* pParent, WinBits nWinStyle );
527 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
528 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
529 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
531 virtual void Modify() override;
533 virtual void Up() override;
534 virtual void Down() override;
535 virtual void First() override;
536 virtual void Last() override;
537 virtual void dispose() override;
541 class VCL_DLLPUBLIC DateField : public SpinField, public DateFormatter
543 private:
544 Date maFirst;
545 Date maLast;
547 protected:
548 SAL_DLLPRIVATE void ImplDateSpinArea( bool bUp );
550 public:
551 explicit DateField( vcl::Window* pParent, WinBits nWinStyle );
553 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
554 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
555 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
557 virtual void Modify() override;
559 virtual void Up() override;
560 virtual void Down() override;
561 virtual void First() override;
562 virtual void Last() override;
564 void SetFirst( const Date& rNewFirst ) { maFirst = rNewFirst; }
565 const Date& GetFirst() const { return maFirst; }
566 void SetLast( const Date& rNewLast ) { maLast = rNewLast; }
567 const Date& GetLast() const { return maLast; }
568 virtual void dispose() override;
572 class VCL_DLLPUBLIC TimeField : public SpinField, public TimeFormatter
574 private:
575 tools::Time maFirst;
576 tools::Time maLast;
578 protected:
579 SAL_DLLPRIVATE void ImplTimeSpinArea( bool bUp );
581 public:
582 explicit TimeField( vcl::Window* pParent, WinBits nWinStyle );
584 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
585 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
586 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
588 virtual void Modify() override;
590 virtual void Up() override;
591 virtual void Down() override;
592 virtual void First() override;
593 virtual void Last() override;
595 void SetFirst( const tools::Time& rNewFirst ) { maFirst = rNewFirst; }
596 const tools::Time& GetFirst() const { return maFirst; }
597 void SetLast( const tools::Time& rNewLast ) { maLast = rNewLast; }
598 const tools::Time& GetLast() const { return maLast; }
600 void SetExtFormat( ExtTimeFieldFormat eFormat );
601 virtual void dispose() override;
605 class VCL_DLLPUBLIC PatternBox : public ComboBox, public PatternFormatter
607 public:
608 PatternBox( vcl::Window* pParent, WinBits nWinStyle );
610 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
611 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
613 virtual void Modify() override;
615 virtual void ReformatAll() override;
616 virtual void dispose() override;
620 class VCL_DLLPUBLIC NumericBox : public ComboBox, public NumericFormatter
622 public:
623 explicit NumericBox( vcl::Window* pParent, WinBits nWinStyle );
625 virtual Size CalcMinimumSize() const override;
627 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
628 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
629 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
631 virtual void Modify() override;
633 virtual void ReformatAll() override;
635 void InsertValue( sal_Int64 nValue, sal_Int32 nPos = COMBOBOX_APPEND );
636 virtual void dispose() override;
640 class VCL_DLLPUBLIC MetricBox : public ComboBox, public MetricFormatter
642 public:
643 explicit MetricBox( vcl::Window* pParent, WinBits nWinStyle );
645 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
646 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
647 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
649 virtual Size CalcMinimumSize() const override;
651 virtual void Modify() override;
653 virtual void CustomConvert() override;
654 virtual void ReformatAll() override;
656 void InsertValue( sal_Int64 nValue, FieldUnit eInUnit = FUNIT_NONE,
657 sal_Int32 nPos = COMBOBOX_APPEND );
658 sal_Int64 GetValue( sal_Int32 nPos ) const;
659 sal_Int32 GetValuePos( sal_Int64 nValue,
660 FieldUnit eInUnit = FUNIT_NONE ) const;
662 // Needed, because GetValue() with nPos hide these functions
663 virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const override;
664 virtual sal_Int64 GetValue() const override;
666 virtual void dispose() override;
670 class VCL_DLLPUBLIC CurrencyBox : public ComboBox, public CurrencyFormatter
672 public:
673 explicit CurrencyBox( vcl::Window* pParent, WinBits nWinStyle );
675 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
676 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
677 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
679 virtual void Modify() override;
681 virtual void ReformatAll() override;
683 virtual sal_Int64 GetValue() const override;
684 virtual void dispose() override;
688 class VCL_DLLPUBLIC DateBox : public ComboBox, public DateFormatter
690 public:
691 explicit DateBox( vcl::Window* pParent, WinBits nWinStyle );
693 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
694 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
695 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
697 virtual void Modify() override;
699 virtual void ReformatAll() override;
700 virtual void dispose() override;
704 class VCL_DLLPUBLIC TimeBox : public ComboBox, public TimeFormatter
706 public:
707 explicit TimeBox( vcl::Window* pParent, WinBits nWinStyle );
709 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
710 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
711 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
713 virtual void Modify() override;
715 virtual void ReformatAll() override;
716 virtual void dispose() override;
719 #endif // INCLUDED_VCL_FIELD_HXX
721 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */