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
23 #include <vcl/dllapi.h>
24 #include <tools/link.hxx>
25 #include <tools/date.hxx>
26 #include <tools/time.hxx>
27 #include <vcl/spinfld.hxx>
28 #include <vcl/combobox.hxx>
29 #include <tools/fldunit.hxx>
31 namespace com
{ namespace sun
{ namespace star
{ namespace lang
{ struct Locale
; } } } }
33 class CalendarWrapper
;
34 class LocaleDataWrapper
;
41 class VCL_DLLPUBLIC FormatterBase
45 LocaleDataWrapper
* mpLocaleDataWrapper
;
48 sal_Bool mbStrictFormat
;
49 sal_Bool mbEmptyFieldValue
;
50 sal_Bool mbEmptyFieldValueEnabled
;
51 sal_Bool mbDefaultLocale
;
54 SAL_DLLPRIVATE
void ImplSetText( const OUString
& rText
, Selection
* pNewSel
= NULL
);
55 SAL_DLLPRIVATE sal_Bool
ImplGetEmptyFieldValue() const { return mbEmptyFieldValue
; }
57 void SetEmptyFieldValueData( sal_Bool bValue
) { mbEmptyFieldValue
= bValue
; }
59 SAL_DLLPRIVATE LocaleDataWrapper
& ImplGetLocaleDataWrapper() const;
60 sal_Bool
IsDefaultLocale() const { return mbDefaultLocale
; }
63 explicit FormatterBase( Edit
* pField
= NULL
);
64 virtual ~FormatterBase();
66 const LocaleDataWrapper
& GetLocaleDataWrapper() const;
68 void SetField( Edit
* pField
) { mpField
= pField
; }
69 Edit
* GetField() const { return mpField
; }
71 sal_Bool
MustBeReformatted() const { return mbReformat
; }
72 void MarkToBeReformatted( sal_Bool b
) { mbReformat
= b
; }
74 void SetStrictFormat( sal_Bool bStrict
);
75 sal_Bool
IsStrictFormat() const { return mbStrictFormat
; }
77 virtual void Reformat();
78 virtual void ReformatAll();
80 virtual void SetLocale( const ::com::sun::star::lang::Locale
& rLocale
);
81 const ::com::sun::star::lang::Locale
& GetLocale() const;
82 const LanguageTag
& GetLanguageTag() const;
84 const AllSettings
& GetFieldSettings() const;
86 void SetErrorHdl( const Link
& rLink
) { maErrorLink
= rLink
; }
87 const Link
& GetErrorHdl() const { return maErrorLink
; }
89 void SetEmptyFieldValue();
90 sal_Bool
IsEmptyFieldValue() const;
92 void EnableEmptyFieldValue( sal_Bool bEnable
) { mbEmptyFieldValueEnabled
= bEnable
; }
93 sal_Bool
IsEmptyFieldValueEnabled() const { return mbEmptyFieldValueEnabled
; }
97 // --------------------
98 // - PatternFormatter -
99 // --------------------
101 #define PATTERN_FORMAT_EMPTYLITERALS ((sal_uInt16)0x0001)
103 class VCL_DLLPUBLIC PatternFormatter
: public FormatterBase
107 OUString maFieldString
;
108 OUString maLiteralMask
;
109 sal_uInt16 mnFormatFlags
;
111 sal_Bool mbInPattKeyInput
;
116 SAL_DLLPRIVATE
void ImplSetMask(const OString
& rEditMask
,
117 const OUString
& rLiteralMask
);
118 SAL_DLLPRIVATE
bool ImplIsSameMask() const { return mbSameMask
; }
119 SAL_DLLPRIVATE sal_Bool
& ImplGetInPattKeyInput() { return mbInPattKeyInput
; }
122 virtual ~PatternFormatter();
124 virtual void Reformat();
126 void SetMask(const OString
& rEditMask
, const OUString
& rLiteralMask
);
127 const OString
& GetEditMask() const { return m_aEditMask
; }
128 const OUString
& GetLiteralMask() const { return maLiteralMask
; }
130 void SetFormatFlags( sal_uInt16 nFlags
) { mnFormatFlags
= nFlags
; }
131 sal_uInt16
GetFormatFlags() const { return mnFormatFlags
; }
133 void SetString( const OUString
& rStr
);
134 OUString
GetString() const;
135 sal_Bool
IsStringModified() const { return !(GetString() == maFieldString
); }
138 // --------------------
139 // - NumericFormatter -
140 // --------------------
142 class VCL_DLLPUBLIC NumericFormatter
: public FormatterBase
145 SAL_DLLPRIVATE
void ImplInit();
148 sal_Int64 mnFieldValue
;
149 sal_Int64 mnLastValue
;
152 sal_Int64 mnCorrectedValue
;
154 sal_uInt16 mnDecimalDigits
;
155 sal_Bool mbThousandSep
;
156 sal_Bool mbShowTrailingZeros
;
158 // the members below are used in all derivatives of NumericFormatter
159 // not in NumericFormatter itself.
160 sal_Int64 mnSpinSize
;
172 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
173 SAL_DLLPRIVATE sal_Bool
ImplNumericReformat( const OUString
& rStr
, sal_Int64
& rValue
, OUString
& rOutStr
);
174 SAL_DLLPRIVATE
void ImplNewFieldValue( sal_Int64 nNewValue
);
175 SAL_DLLPRIVATE
void ImplSetUserValue( sal_Int64 nNewValue
, Selection
* pNewSelection
= NULL
);
178 virtual ~NumericFormatter();
180 virtual void Reformat();
182 void SetMin( sal_Int64 nNewMin
);
183 sal_Int64
GetMin() const { return mnMin
; }
184 void SetMax( sal_Int64 nNewMax
);
185 sal_Int64
GetMax() const { return mnMax
; }
187 void SetFirst( sal_Int64 nNewFirst
) { mnFirst
= nNewFirst
; }
188 sal_Int64
GetFirst() const { return mnFirst
; }
189 void SetLast( sal_Int64 nNewLast
) { mnLast
= nNewLast
; }
190 sal_Int64
GetLast() const { return mnLast
; }
191 void SetSpinSize( sal_Int64 nNewSize
) { mnSpinSize
= nNewSize
; }
192 sal_Int64
GetSpinSize() const { return mnSpinSize
; }
194 void SetDecimalDigits( sal_uInt16 nDigits
);
195 sal_uInt16
GetDecimalDigits() const;
197 void SetUseThousandSep( sal_Bool b
);
198 sal_Bool
IsUseThousandSep() const { return mbThousandSep
; }
200 void SetShowTrailingZeros( sal_Bool bShowTrailingZeros
);
201 sal_Bool
IsShowTrailingZeros() const { return mbShowTrailingZeros
; }
204 void SetUserValue( sal_Int64 nNewValue
);
205 virtual void SetValue( sal_Int64 nNewValue
);
206 virtual sal_Int64
GetValue() const;
207 virtual OUString
CreateFieldText( sal_Int64 nValue
) const;
208 sal_Bool
IsValueModified() const;
209 sal_Int64
GetCorrectedValue() const { return mnCorrectedValue
; }
211 sal_Int64
Normalize( sal_Int64 nValue
) const;
212 sal_Int64
Denormalize( sal_Int64 nValue
) const;
215 // -------------------
216 // - MetricFormatter -
217 // -------------------
219 class VCL_DLLPUBLIC MetricFormatter
: public NumericFormatter
222 SAL_DLLPRIVATE
void ImplInit();
225 OUString maCustomUnitText
;
226 OUString maCurUnitText
;
227 sal_Int64 mnBaseValue
;
229 Link maCustomConvertLink
;
234 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
235 SAL_DLLPRIVATE sal_Bool
ImplMetricReformat( const OUString
& rStr
, double& rValue
, OUString
& rOutStr
);
238 virtual ~MetricFormatter();
240 virtual void CustomConvert() = 0;
241 virtual void Reformat();
243 virtual void SetUnit( FieldUnit meUnit
);
244 FieldUnit
GetUnit() const { return meUnit
; }
245 void SetCustomUnitText( const OUString
& rStr
);
246 const OUString
& GetCustomUnitText() const { return maCustomUnitText
; }
247 const OUString
& GetCurUnitText() const { return maCurUnitText
; }
249 using NumericFormatter::SetMax
;
250 void SetMax( sal_Int64 nNewMax
, FieldUnit eInUnit
);
251 using NumericFormatter::GetMax
;
252 sal_Int64
GetMax( FieldUnit eOutUnit
) const;
253 using NumericFormatter::SetMin
;
254 void SetMin( sal_Int64 nNewMin
, FieldUnit eInUnit
);
255 using NumericFormatter::GetMin
;
256 sal_Int64
GetMin( FieldUnit eOutUnit
) const;
257 void SetBaseValue( sal_Int64 nNewBase
, FieldUnit eInUnit
= FUNIT_NONE
);
258 sal_Int64
GetBaseValue( FieldUnit eOutUnit
= FUNIT_NONE
) const;
260 virtual void SetValue( sal_Int64 nNewValue
, FieldUnit eInUnit
);
261 virtual void SetValue( sal_Int64 nValue
);
262 using NumericFormatter::SetUserValue
;
263 void SetUserValue( sal_Int64 nNewValue
, FieldUnit eInUnit
);
264 virtual sal_Int64
GetValue( FieldUnit eOutUnit
) const;
265 virtual sal_Int64
GetValue() const;
266 virtual OUString
CreateFieldText( sal_Int64 nValue
) const;
267 using NumericFormatter::GetCorrectedValue
;
268 sal_Int64
GetCorrectedValue( FieldUnit eOutUnit
) const;
270 void SetCustomConvertHdl( const Link
& rLink
) { maCustomConvertLink
= rLink
; }
271 const Link
& GetCustomConvertHdl() const { return maCustomConvertLink
; }
275 // ---------------------
276 // - CurrencyFormatter -
277 // ---------------------
279 class VCL_DLLPUBLIC CurrencyFormatter
: public NumericFormatter
282 SAL_DLLPRIVATE
void ImplInit();
286 SAL_DLLPRIVATE sal_Bool
ImplCurrencyReformat( const OUString
& rStr
, OUString
& rOutStr
);
289 virtual ~CurrencyFormatter();
291 virtual void Reformat();
293 OUString
GetCurrencySymbol() const;
295 virtual void SetValue( sal_Int64 nNewValue
);
296 virtual sal_Int64
GetValue() const;
297 virtual OUString
CreateFieldText( sal_Int64 nValue
) const;
305 class VCL_DLLPUBLIC DateFormatter
: public FormatterBase
308 CalendarWrapper
* mpCalendarWrapper
;
313 Date maCorrectedDate
;
314 sal_Bool mbLongFormat
;
315 sal_Bool mbShowDateCentury
;
316 sal_uInt16 mnDateFormat
;
317 sal_uLong mnExtDateFormat
;
318 sal_Bool mbEnforceValidValue
;
320 SAL_DLLPRIVATE
void ImplInit();
325 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
326 SAL_DLLPRIVATE
const Date
& ImplGetFieldDate() const { return maFieldDate
; }
327 SAL_DLLPRIVATE sal_Bool
ImplDateReformat( const OUString
& rStr
, OUString
& rOutStr
,
328 const AllSettings
& rSettings
);
329 SAL_DLLPRIVATE
void ImplSetUserDate( const Date
& rNewDate
,
330 Selection
* pNewSelection
= NULL
);
331 SAL_DLLPRIVATE OUString
ImplGetDateAsText( const Date
& rDate
,
332 const AllSettings
& rSettings
) const;
333 SAL_DLLPRIVATE
void ImplNewFieldValue( const Date
& rDate
);
334 CalendarWrapper
& GetCalendarWrapper() const;
336 SAL_DLLPRIVATE sal_Bool
ImplAllowMalformedInput() const;
339 virtual ~DateFormatter();
341 virtual void Reformat();
342 virtual void ReformatAll();
344 virtual void SetLocale( const ::com::sun::star::lang::Locale
& rLocale
);
347 void SetExtDateFormat( ExtDateFieldFormat eFormat
);
348 ExtDateFieldFormat
GetExtDateFormat( sal_Bool bResolveSystemFormat
= sal_False
) const;
350 void SetMin( const Date
& rNewMin
);
351 const Date
& GetMin() const { return maMin
; }
353 void SetMax( const Date
& rNewMax
);
354 const Date
& GetMax() const { return maMax
; }
357 // --------------------------------------------------------------
358 // MT: Remove these methods too, ExtDateFormat should be enough!
359 // What should happen if using DDMMYYYY, but ShowCentury=sal_False?
360 // --------------------------------------------------------------
361 void SetLongFormat( sal_Bool bLong
);
362 sal_Bool
IsLongFormat() const { return mbLongFormat
; }
363 void SetShowDateCentury( sal_Bool bShowCentury
);
364 sal_Bool
IsShowDateCentury() const { return mbShowDateCentury
; }
365 // --------------------------------------------------------------
367 void SetDate( const Date
& rNewDate
);
368 void SetUserDate( const Date
& rNewDate
);
369 Date
GetDate() const;
371 sal_Bool
IsEmptyDate() const;
372 Date
GetCorrectedDate() const { return maCorrectedDate
; }
374 void ResetLastDate() { maLastDate
= Date( 0, 0, 0 ); }
376 static void ExpandCentury( Date
& rDate
);
377 static void ExpandCentury( Date
& rDate
, sal_uInt16 nTwoDigitYearStart
);
379 static Date
GetInvalidDate() { return Date( 0, 0, 0 ); }
381 /** enables or disables the enforcement of valid values
383 If this is set to <TRUE/> (which is the default), then GetDate will always return a valid
384 date, no matter whether the current text can really be interpreted as date. (Note: this
385 is the compatible bahavior).
387 If this is set to <FALSE/>, the GetDate will return GetInvalidDate, in case the current text
388 cannot be interpreted as date.
390 In addition, if this is set to <FALSE/>, the text in the field will <em>not</em> be corrected
391 when the control loses the focus - instead, the invalid input will be preserved.
393 void EnforceValidValue( sal_Bool _bEnforce
) { mbEnforceValidValue
= _bEnforce
; }
394 inline sal_Bool
IsEnforceValidValue( ) const { return mbEnforceValidValue
; }
402 class VCL_DLLPUBLIC TimeFormatter
: public FormatterBase
408 Time maCorrectedTime
;
409 TimeFieldFormat meFormat
;
410 sal_uInt16 mnTimeFormat
;
412 sal_Bool mbEnforceValidValue
;
414 SAL_DLLPRIVATE
void ImplInit();
421 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
422 SAL_DLLPRIVATE sal_Bool
ImplTimeReformat( const OUString
& rStr
, OUString
& rOutStr
);
423 SAL_DLLPRIVATE
void ImplNewFieldValue( const Time
& rTime
);
424 SAL_DLLPRIVATE
void ImplSetUserTime( const Time
& rNewTime
, Selection
* pNewSelection
= NULL
);
425 SAL_DLLPRIVATE sal_Bool
ImplAllowMalformedInput() const;
434 virtual ~TimeFormatter();
436 virtual void Reformat();
437 virtual void ReformatAll();
439 void SetMin( const Time
& rNewMin
);
440 const Time
& GetMin() const { return maMin
; }
441 void SetMax( const Time
& rNewMax
);
442 const Time
& GetMax() const { return maMax
; }
444 void SetTimeFormat( TimeFormat eNewFormat
);
445 TimeFormat
GetTimeFormat() const;
447 void SetFormat( TimeFieldFormat eNewFormat
);
448 TimeFieldFormat
GetFormat() const { return meFormat
; }
450 void SetDuration( sal_Bool mbDuration
);
451 sal_Bool
IsDuration() const { return mbDuration
; }
453 void SetTime( const Time
& rNewTime
);
454 void SetUserTime( const Time
& rNewTime
);
455 Time
GetTime() const;
456 void SetEmptyTime() { FormatterBase::SetEmptyFieldValue(); }
457 sal_Bool
IsEmptyTime() const { return FormatterBase::IsEmptyFieldValue(); }
458 Time
GetCorrectedTime() const { return maCorrectedTime
; }
460 static Time
GetInvalidTime() { return Time( 99, 99, 99 ); }
462 /** enables or disables the enforcement of valid values
464 If this is set to <TRUE/> (which is the default), then GetTime will always return a valid
465 time, no matter whether the current text can really be interpreted as time. (Note: this
466 is the compatible bahavior).
468 If this is set to <FALSE/>, the GetTime will return GetInvalidTime, in case the current text
469 cannot be interpreted as time.
471 In addition, if this is set to <FALSE/>, the text in the field will <em>not</em> be corrected
472 when the control loses the focus - instead, the invalid input will be preserved.
474 void EnforceValidValue( sal_Bool _bEnforce
) { mbEnforceValidValue
= _bEnforce
; }
475 inline sal_Bool
IsEnforceValidValue( ) const { return mbEnforceValidValue
; }
483 class VCL_DLLPUBLIC PatternField
: public SpinField
, public PatternFormatter
486 explicit PatternField( Window
* pParent
, WinBits nWinStyle
);
487 virtual ~PatternField();
489 virtual long PreNotify( NotifyEvent
& rNEvt
);
490 virtual long Notify( NotifyEvent
& rNEvt
);
491 virtual void Modify();
499 class VCL_DLLPUBLIC NumericField
: public SpinField
, public NumericFormatter
502 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
505 explicit NumericField( Window
* pParent
, WinBits nWinStyle
);
506 explicit NumericField( Window
* pParent
, const ResId
& );
507 virtual ~NumericField();
509 virtual long PreNotify( NotifyEvent
& rNEvt
);
510 virtual long Notify( NotifyEvent
& rNEvt
);
511 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
513 virtual Size
CalcMinimumSize() const;
515 virtual void Modify();
519 virtual void First();
521 virtual bool set_property(const OString
&rKey
, const OString
&rValue
);
529 class VCL_DLLPUBLIC MetricField
: public SpinField
, public MetricFormatter
532 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
535 explicit MetricField( Window
* pParent
, WinBits nWinStyle
);
536 explicit MetricField( Window
* pParent
, const ResId
& );
537 virtual ~MetricField();
539 virtual long PreNotify( NotifyEvent
& rNEvt
);
540 virtual long Notify( NotifyEvent
& rNEvt
);
541 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
543 virtual Size
CalcMinimumSize() const;
545 virtual void Modify();
549 virtual void First();
551 virtual void CustomConvert();
553 virtual void SetUnit( FieldUnit meUnit
);
555 void SetFirst( sal_Int64 nNewFirst
, FieldUnit eInUnit
);
556 inline void SetFirst(sal_Int64 first
) { SetFirst(first
, FUNIT_NONE
); }
557 sal_Int64
GetFirst( FieldUnit eOutUnit
) const;
558 inline sal_Int64
GetFirst() const { return GetFirst(FUNIT_NONE
); }
559 void SetLast( sal_Int64 nNewLast
, FieldUnit eInUnit
);
560 inline void SetLast(sal_Int64 last
) { SetLast(last
, FUNIT_NONE
); }
561 sal_Int64
GetLast( FieldUnit eOutUnit
) const;
562 inline sal_Int64
GetLast() const { return GetLast(FUNIT_NONE
); }
564 static void SetDefaultUnit( FieldUnit eDefaultUnit
);
565 static FieldUnit
GetDefaultUnit();
566 static sal_Int64
ConvertValue( sal_Int64 nValue
, sal_Int64 mnBaseValue
, sal_uInt16 nDecDigits
,
567 FieldUnit eInUnit
, FieldUnit eOutUnit
);
568 static sal_Int64
ConvertValue( sal_Int64 nValue
, sal_uInt16 nDecDigits
,
569 MapUnit eInUnit
, FieldUnit eOutUnit
);
571 // for backwards compatibility
572 // caution: conversion to double loses precision
573 static double ConvertDoubleValue( double nValue
, sal_Int64 mnBaseValue
, sal_uInt16 nDecDigits
,
574 FieldUnit eInUnit
, FieldUnit eOutUnit
);
575 static double ConvertDoubleValue( double nValue
, sal_uInt16 nDecDigits
,
576 FieldUnit eInUnit
, MapUnit eOutUnit
);
577 static double ConvertDoubleValue( double nValue
, sal_uInt16 nDecDigits
,
578 MapUnit eInUnit
, FieldUnit eOutUnit
);
580 // for backwards compatibility
581 // caution: conversion to double loses precision
582 static double ConvertDoubleValue( sal_Int64 nValue
, sal_Int64 nBaseValue
, sal_uInt16 nDecDigits
,
583 FieldUnit eInUnit
, FieldUnit eOutUnit
)
584 { return ConvertDoubleValue( static_cast<double>(nValue
), nBaseValue
, nDecDigits
, eInUnit
, eOutUnit
); }
585 static double ConvertDoubleValue( sal_Int64 nValue
, sal_uInt16 nDecDigits
,
586 FieldUnit eInUnit
, MapUnit eOutUnit
)
587 { return ConvertDoubleValue( static_cast<double>(nValue
), nDecDigits
, eInUnit
, eOutUnit
); }
588 static double ConvertDoubleValue( sal_Int64 nValue
, sal_uInt16 nDecDigits
,
589 MapUnit eInUnit
, FieldUnit eOutUnit
)
590 { return ConvertDoubleValue( static_cast<double>(nValue
), nDecDigits
, eInUnit
, eOutUnit
); }
592 virtual bool set_property(const OString
&rKey
, const OString
&rValue
);
600 class VCL_DLLPUBLIC CurrencyField
: public SpinField
, public CurrencyFormatter
603 CurrencyField( Window
* pParent
, WinBits nWinStyle
);
607 virtual long PreNotify( NotifyEvent
& rNEvt
);
608 virtual long Notify( NotifyEvent
& rNEvt
);
609 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
611 virtual void Modify();
615 virtual void First();
624 class VCL_DLLPUBLIC DateField
: public SpinField
, public DateFormatter
631 SAL_DLLPRIVATE
void ImplDateSpinArea( sal_Bool bUp
);
632 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
635 explicit DateField( Window
* pParent
, WinBits nWinStyle
);
636 explicit DateField( Window
* pParent
, const ResId
& );
637 virtual ~DateField();
639 virtual long PreNotify( NotifyEvent
& rNEvt
);
640 virtual long Notify( NotifyEvent
& rNEvt
);
641 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
643 virtual void Modify();
647 virtual void First();
650 void SetFirst( const Date
& rNewFirst
) { maFirst
= rNewFirst
; }
651 Date
GetFirst() const { return maFirst
; }
652 void SetLast( const Date
& rNewLast
) { maLast
= rNewLast
; }
653 Date
GetLast() const { return maLast
; }
660 class VCL_DLLPUBLIC TimeField
: public SpinField
, public TimeFormatter
667 SAL_DLLPRIVATE
void ImplTimeSpinArea( sal_Bool bUp
);
668 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
671 explicit TimeField( Window
* pParent
, WinBits nWinStyle
);
672 explicit TimeField( Window
* pParent
, const ResId
& );
673 virtual ~TimeField();
675 virtual long PreNotify( NotifyEvent
& rNEvt
);
676 virtual long Notify( NotifyEvent
& rNEvt
);
677 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
679 virtual void Modify();
683 virtual void First();
686 void SetFirst( const Time
& rNewFirst
) { maFirst
= rNewFirst
; }
687 Time
GetFirst() const { return maFirst
; }
688 void SetLast( const Time
& rNewLast
) { maLast
= rNewLast
; }
689 Time
GetLast() const { return maLast
; }
691 void SetExtFormat( ExtTimeFieldFormat eFormat
);
699 class VCL_DLLPUBLIC PatternBox
: public ComboBox
, public PatternFormatter
702 PatternBox( Window
* pParent
, WinBits nWinStyle
);
705 virtual long PreNotify( NotifyEvent
& rNEvt
);
706 virtual long Notify( NotifyEvent
& rNEvt
);
708 virtual void Modify();
710 virtual void ReformatAll();
718 class VCL_DLLPUBLIC NumericBox
: public ComboBox
, public NumericFormatter
721 explicit NumericBox( Window
* pParent
, WinBits nWinStyle
);
722 explicit NumericBox( Window
* pParent
, const ResId
& );
723 virtual ~NumericBox();
725 virtual Size
CalcMinimumSize() const;
727 virtual long PreNotify( NotifyEvent
& rNEvt
);
728 virtual long Notify( NotifyEvent
& rNEvt
);
729 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
731 virtual void Modify();
733 virtual void ReformatAll();
735 void InsertValue( sal_Int64 nValue
, sal_uInt16 nPos
= COMBOBOX_APPEND
);
743 class VCL_DLLPUBLIC MetricBox
: public ComboBox
, public MetricFormatter
746 explicit MetricBox( Window
* pParent
, WinBits nWinStyle
);
747 virtual ~MetricBox();
749 virtual long PreNotify( NotifyEvent
& rNEvt
);
750 virtual long Notify( NotifyEvent
& rNEvt
);
751 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
753 virtual Size
CalcMinimumSize() const;
755 virtual void Modify();
757 virtual void CustomConvert();
758 virtual void ReformatAll();
760 void InsertValue( sal_Int64 nValue
, FieldUnit eInUnit
= FUNIT_NONE
,
761 sal_uInt16 nPos
= COMBOBOX_APPEND
);
762 sal_Int64
GetValue( sal_uInt16 nPos
, FieldUnit eOutUnit
= FUNIT_NONE
) const;
763 sal_uInt16
GetValuePos( sal_Int64 nValue
,
764 FieldUnit eInUnit
= FUNIT_NONE
) const;
766 // Needed, because GetValue() with nPos hide these functions
767 virtual sal_Int64
GetValue( FieldUnit eOutUnit
) const;
768 virtual sal_Int64
GetValue() const;
776 class VCL_DLLPUBLIC CurrencyBox
: public ComboBox
, public CurrencyFormatter
779 explicit CurrencyBox( Window
* pParent
, WinBits nWinStyle
);
780 explicit CurrencyBox( Window
* pParent
, const ResId
& );
781 virtual ~CurrencyBox();
783 virtual long PreNotify( NotifyEvent
& rNEvt
);
784 virtual long Notify( NotifyEvent
& rNEvt
);
785 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
787 virtual void Modify();
789 virtual void ReformatAll();
791 virtual sal_Int64
GetValue() const;
798 class VCL_DLLPUBLIC DateBox
: public ComboBox
, public DateFormatter
801 explicit DateBox( Window
* pParent
, WinBits nWinStyle
);
804 virtual long PreNotify( NotifyEvent
& rNEvt
);
805 virtual long Notify( NotifyEvent
& rNEvt
);
806 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
808 virtual void Modify();
810 virtual void ReformatAll();
818 class VCL_DLLPUBLIC TimeBox
: public ComboBox
, public TimeFormatter
821 explicit TimeBox( Window
* pParent
, WinBits nWinStyle
);
824 virtual long PreNotify( NotifyEvent
& rNEvt
);
825 virtual long Notify( NotifyEvent
& rNEvt
);
826 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
828 virtual void Modify();
830 virtual void ReformatAll();
833 #endif // INCLUDED_VCL_FIELD_HXX
835 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */