22#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23#error "don't use this in new code"
30#include <config_options.h>
48 mutable std::unique_ptr<LocaleDataWrapper>
56 SAL_DLLPRIVATE
void ImplSetText(
const OUString& rText,
Selection const * pNewSel =
nullptr );
63 SAL_DLLPRIVATE
void ImplResetLocaleDataWrapper()
const;
77 void SetStrictFormat(
bool bStrict );
80 virtual void Reformat();
81 virtual void ReformatAll();
83 const css::lang::Locale& GetLocale()
const;
86 void SetEmptyFieldValue();
87 bool IsEmptyFieldValue()
const;
96 virtual ~NumericFormatter()
override;
98 virtual void Reformat()
override;
100 void SetMin( sal_Int64 nNewMin );
101 sal_Int64 GetMin()
const {
return mnMin; }
102 void SetMax( sal_Int64 nNewMax );
103 sal_Int64 GetMax()
const {
return mnMax; }
105 sal_Int64 ClipAgainstMinMax(sal_Int64 nValue)
const;
107 void SetFirst( sal_Int64 nNewFirst ) { mnFirst = nNewFirst; }
108 sal_Int64 GetFirst()
const {
return mnFirst; }
109 void SetLast( sal_Int64 nNewLast ) { mnLast = nNewLast; }
110 sal_Int64 GetLast()
const {
return mnLast; }
111 void SetSpinSize( sal_Int64 nNewSize ) { mnSpinSize = nNewSize; }
112 sal_Int64 GetSpinSize()
const {
return mnSpinSize; }
114 void SetDecimalDigits( sal_uInt16 nDigits );
115 sal_uInt16 GetDecimalDigits()
const {
return mnDecimalDigits;}
117 void SetUseThousandSep(
bool b );
118 bool IsUseThousandSep()
const {
return mbThousandSep; }
120 void SetUserValue( sal_Int64 nNewValue );
121 virtual void SetValue( sal_Int64 nNewValue );
123 virtual OUString CreateFieldText( sal_Int64 nValue )
const;
125 sal_Int64 Normalize( sal_Int64 nValue )
const;
126 sal_Int64 Denormalize( sal_Int64 nValue )
const;
128 OUString GetValueString()
const;
129 void SetValueFromString(
const OUString& rStr);
132 sal_Int64 mnLastValue;
139 sal_Int64 mnSpinSize;
143 NumericFormatter(
Edit* pEdit);
149 void FormatValue(
Selection const * pNewSelection =
nullptr);
151 SAL_DLLPRIVATE
void ImplNumericReformat();
152 SAL_DLLPRIVATE
void ImplNewFieldValue( sal_Int64 nNewValue );
153 SAL_DLLPRIVATE
void ImplSetUserValue( sal_Int64 nNewValue,
Selection const * pNewSelection =
nullptr );
155 virtual sal_Int64 GetValueFromString(
const OUString& rStr)
const;
158 sal_uInt16 mnDecimalDigits;
168 virtual void Reformat()
override;
170 virtual void SetUnit(
FieldUnit meUnit );
172 void SetCustomUnitText(
const OUString& rStr );
175 using NumericFormatter::SetMax;
176 void SetMax( sal_Int64 nNewMax,
FieldUnit eInUnit );
177 using NumericFormatter::GetMax;
178 sal_Int64 GetMax(
FieldUnit eOutUnit )
const;
179 using NumericFormatter::SetMin;
180 void SetMin( sal_Int64 nNewMin,
FieldUnit eInUnit );
181 using NumericFormatter::GetMin;
182 sal_Int64 GetMin(
FieldUnit eOutUnit )
const;
185 virtual void SetValue( sal_Int64 nValue )
override;
186 using NumericFormatter::SetUserValue;
187 void SetUserValue( sal_Int64 nNewValue,
FieldUnit eInUnit );
188 using NumericFormatter::GetValue;
190 virtual OUString CreateFieldText( sal_Int64 nValue )
const override;
191 sal_Int64 GetCorrectedValue(
FieldUnit eOutUnit )
const;
198 SAL_DLLPRIVATE
void ImplMetricReformat(
const OUString& rStr,
double& rValue, OUString& rOutStr );
200 virtual sal_Int64 GetValueFromString(
const OUString& rStr)
const override;
201 sal_Int64 GetValueFromStringUnit(
const OUString& rStr,
FieldUnit eOutUnit)
const;
212 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
213 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
216 virtual Size CalcMinimumSize()
const override;
218 virtual void Modify()
override;
220 virtual void Up()
override;
221 virtual void Down()
override;
222 virtual void First()
override;
223 virtual void Last()
override;
225 virtual void SetUnit(
FieldUnit meUnit )
override;
227 void SetFirst( sal_Int64 nNewFirst,
FieldUnit eInUnit );
228 sal_Int64 GetFirst(
FieldUnit eOutUnit )
const;
229 void SetLast( sal_Int64 nNewLast,
FieldUnit eInUnit );
230 sal_Int64 GetLast(
FieldUnit eOutUnit )
const;
232 virtual bool set_property(
const OUString &rKey,
const OUString &rValue)
override;
233 virtual void dispose()
override;
244 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
245 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
248 virtual Size CalcMinimumSize()
const override;
250 virtual void Modify()
override;
252 virtual void ReformatAll()
override;
257 virtual void dispose()
override;
260class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyFormatter :
public NumericFormatter
263 CurrencyFormatter(
Edit* pEdit);
264 SAL_DLLPRIVATE
void ImplCurrencyReformat(
const OUString& rStr, OUString& rOutStr );
265 virtual sal_Int64 GetValueFromString(
const OUString& rStr)
const override;
268 virtual ~CurrencyFormatter()
override;
270 virtual void Reformat()
override;
272 virtual void SetValue( sal_Int64 nNewValue )
override;
273 virtual OUString CreateFieldText( sal_Int64 nValue )
const override;
276class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyField final :
public SpinField,
public CurrencyFormatter
281 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
282 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
285 virtual void Modify()
override;
287 virtual void Up()
override;
288 virtual void Down()
override;
289 virtual void First()
override;
290 virtual void Last()
override;
291 virtual void dispose()
override;
294class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TimeFormatter :
public FormatterBase
303 bool mbEnforceValidValue;
308 TimeFormatter(
Edit* pEdit);
310 SAL_DLLPRIVATE
void ImplTimeReformat( std::u16string_view rStr, OUString& rOutStr );
311 SAL_DLLPRIVATE
void ImplNewFieldValue(
const tools::Time& rTime );
312 SAL_DLLPRIVATE
void ImplSetUserTime(
const tools::Time& rNewTime,
Selection const * pNewSelection =
nullptr );
313 SAL_DLLPRIVATE
bool ImplAllowMalformedInput()
const;
318 static int GetTimeArea(
TimeFieldFormat eFormat, std::u16string_view rText,
int nCursor,
321 bool bDuration, std::u16string_view rText,
int nCursor,
324 virtual ~TimeFormatter()
override;
326 virtual void Reformat()
override;
327 virtual void ReformatAll()
override;
330 const tools::Time& GetMin()
const {
return maMin; }
332 const tools::Time& GetMax()
const {
return maMax; }
335 TimeFormat GetTimeFormat()
const {
return mnTimeFormat;}
340 void SetDuration(
bool mbDuration );
341 bool IsDuration()
const {
return mbDuration; }
361 void EnforceValidValue(
bool _bEnforce ) { mbEnforceValidValue = _bEnforce; }
362 bool IsEnforceValidValue( )
const {
return mbEnforceValidValue; }
365class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TimeField final :
public SpinField,
public TimeFormatter
371 SAL_DLLPRIVATE
void ImplTimeSpinArea(
bool bUp );
376 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
377 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
380 virtual void Modify()
override;
382 virtual void Up()
override;
383 virtual void Down()
override;
384 virtual void First()
override;
385 virtual void Last()
override;
387 void SetFirst(
const tools::Time& rNewFirst ) { maFirst = rNewFirst; }
388 const tools::Time& GetFirst()
const {
return maFirst; }
389 void SetLast(
const tools::Time& rNewLast ) { maLast = rNewLast; }
390 const tools::Time& GetLast()
const {
return maLast; }
393 virtual void dispose()
override;
396class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DateFormatter :
public FormatterBase
400 std::unique_ptr<CalendarWrapper> mxCalendarWrapper;
406 bool mbShowDateCentury;
408 bool mbEnforceValidValue;
411 DateFormatter(
Edit* pEdit);
413 SAL_DLLPRIVATE
const Date& ImplGetFieldDate()
const {
return maFieldDate; }
414 SAL_DLLPRIVATE
void ImplDateReformat(
const OUString& rStr, OUString& rOutStr );
415 SAL_DLLPRIVATE
void ImplSetUserDate(
const Date& rNewDate,
416 Selection const * pNewSelection =
nullptr );
417 SAL_DLLPRIVATE OUString ImplGetDateAsText(
const Date& rDate )
const;
418 SAL_DLLPRIVATE
void ImplNewFieldValue(
const Date& rDate );
421 SAL_DLLPRIVATE
bool ImplAllowMalformedInput()
const;
428 virtual ~DateFormatter()
override;
430 virtual void Reformat()
override;
431 virtual void ReformatAll()
override;
436 void SetMin(
const Date& rNewMin );
437 const Date& GetMin()
const {
return maMin; }
439 void SetMax(
const Date& rNewMax );
440 const Date& GetMax()
const {
return maMax; }
446 void SetLongFormat(
bool bLong );
447 bool IsLongFormat()
const {
return mbLongFormat; }
448 void SetShowDateCentury(
bool bShowCentury );
449 bool IsShowDateCentury()
const {
return mbShowDateCentury; }
452 void SetDate(
const Date& rNewDate );
453 Date GetDate()
const;
455 bool IsEmptyDate()
const;
459 static void ExpandCentury(
Date& rDate );
460 static void ExpandCentury(
Date& rDate, sal_uInt16 nTwoDigitYearStart );
474 void EnforceValidValue(
bool _bEnforce ) { mbEnforceValidValue = _bEnforce; }
475 bool IsEnforceValidValue( )
const {
return mbEnforceValidValue; }
485 void ImplDateSpinArea(
bool bUp );
490 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
491 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
494 virtual void Modify()
override;
496 virtual void Up()
override;
497 virtual void Down()
override;
498 virtual void First()
override;
499 virtual void Last()
override;
505 virtual void dispose()
override;
508class UNLESS_MERGELIBS(VCL_DLLPUBLIC) NumericBox final :
public ComboBox,
public NumericFormatter
510 SAL_DLLPRIVATE
void ImplNumericReformat(
const OUString& rStr, sal_Int64& rValue, OUString& rOutStr );
514 virtual Size CalcMinimumSize()
const override;
516 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
517 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
520 virtual void Modify()
override;
522 virtual void ReformatAll()
override;
524 virtual void dispose()
override;
527#define PATTERN_FORMAT_EMPTYLITERALS (sal_uInt16(0x0001))
529class UNLESS_MERGELIBS(VCL_DLLPUBLIC) PatternFormatter :
public FormatterBase
533 OUString maLiteralMask;
535 bool mbInPattKeyInput;
538 PatternFormatter(
Edit* pEdit);
540 SAL_DLLPRIVATE
bool ImplIsSameMask()
const {
return mbSameMask; }
541 SAL_DLLPRIVATE
bool& ImplGetInPattKeyInput() {
return mbInPattKeyInput; }
544 virtual ~PatternFormatter()
override;
546 virtual void Reformat()
override;
548 void SetMask(
const OString& rEditMask,
const OUString& rLiteralMask );
549 const OString& GetEditMask()
const {
return m_aEditMask; }
550 const OUString& GetLiteralMask()
const {
return maLiteralMask; }
556class UNLESS_MERGELIBS(VCL_DLLPUBLIC) PatternField final :
public SpinField,
public PatternFormatter
561 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
562 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
563 virtual void Modify()
override;
564 virtual void dispose()
override;
567class UNLESS_MERGELIBS(VCL_DLLPUBLIC) PatternBox final :
public ComboBox,
public PatternFormatter
572 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
573 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
575 virtual void Modify()
override;
577 virtual void ReformatAll()
override;
578 virtual void dispose()
override;
581class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyBox final :
public ComboBox,
public CurrencyFormatter
586 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
587 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
590 virtual void Modify()
override;
592 virtual void ReformatAll()
override;
594 virtual void dispose()
override;
597class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DateBox final :
public ComboBox,
public DateFormatter
602 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
603 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
606 virtual void Modify()
override;
608 virtual void ReformatAll()
override;
609 virtual void dispose()
override;
612class UNLESS_MERGELIBS(VCL_DLLPUBLIC) TimeBox final :
public ComboBox,
public TimeFormatter
617 virtual bool PreNotify(
NotifyEvent& rNEvt )
override;
618 virtual bool EventNotify(
NotifyEvent& rNEvt )
override;
621 virtual void Modify()
override;
623 virtual void ReformatAll()
override;
624 virtual void dispose()
override;
A widget used to choose from a list of items and which has an entry.
void SetFirst(const Date &rNewFirst)
const Date & GetFirst() const
void SetLast(const Date &rNewLast)
const Date & GetLast() const
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
virtual void SetValue(tools::Long nNew) override
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
OUString GetString(int nId)
void SetString(SwCursor &rCursor, std::u16string_view aString)
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
Any GetTime(const OUString &val)
class VCL_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") IPrioritable