LibreOffice Module vcl (master)  1
field.hxx
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 #ifndef INCLUDED_VCL_FIELD_HXX
21 #define INCLUDED_VCL_FIELD_HXX
22 
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>
31 
32 namespace com { namespace sun { namespace star { namespace lang { struct Locale; } } } }
33 
34 class CalendarWrapper;
35 class LocaleDataWrapper;
36 class LanguageTag;
37 
38 
40 {
41 private:
43  std::unique_ptr<LocaleDataWrapper>
45  bool mbReformat;
49 
50 protected:
51  SAL_DLLPRIVATE void ImplSetText( const OUString& rText, Selection const * pNewSel = nullptr );
52  SAL_DLLPRIVATE bool ImplGetEmptyFieldValue() const { return mbEmptyFieldValue; }
53 
54  void SetEmptyFieldValueData( bool bValue ) { mbEmptyFieldValue = bValue; }
55 
56  SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const;
57 
58  Edit* GetField() const { return mpField; }
59  void ClearField() { mpField.clear(); }
60 
61 public:
62  explicit FormatterBase(Edit* pField);
63  virtual ~FormatterBase();
64 
66 
67  bool MustBeReformatted() const { return mbReformat; }
68  void MarkToBeReformatted( bool b ) { mbReformat = b; }
69 
70  void SetStrictFormat( bool bStrict );
71  bool IsStrictFormat() const { return mbStrictFormat; }
72 
73  virtual void Reformat();
74  virtual void ReformatAll();
75 
76  const css::lang::Locale& GetLocale() const;
77  const LanguageTag& GetLanguageTag() const;
78 
79  void SetEmptyFieldValue();
80  bool IsEmptyFieldValue() const;
81 
82  void EnableEmptyFieldValue( bool bEnable ) { mbEmptyFieldValueEnabled = bEnable; }
83  bool IsEmptyFieldValueEnabled() const { return mbEmptyFieldValueEnabled; }
84 };
85 
86 #define PATTERN_FORMAT_EMPTYLITERALS (sal_uInt16(0x0001))
87 
89 {
90 private:
91  OString m_aEditMask;
92  OUString maLiteralMask;
93  bool mbSameMask;
95 
96 protected:
97  PatternFormatter(Edit* pEdit);
98 
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; }
103 
104 public:
105  virtual ~PatternFormatter() override;
106 
107  virtual void Reformat() override;
108 
109  void SetMask(const OString& rEditMask, const OUString& rLiteralMask );
110  const OString& GetEditMask() const { return m_aEditMask; }
111  const OUString& GetLiteralMask() const { return maLiteralMask; }
112 
113  void SetString( const OUString& rStr );
114  OUString GetString() const;
115 };
116 
117 
119 {
120 public:
121  virtual ~NumericFormatter() override;
122 
123  virtual void Reformat() override;
124 
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; }
129 
130  sal_Int64 ClipAgainstMinMax(sal_Int64 nValue) const;
131 
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; }
138 
139  void SetDecimalDigits( sal_uInt16 nDigits );
140  sal_uInt16 GetDecimalDigits() const { return mnDecimalDigits;}
141 
142  void SetUseThousandSep( bool b );
143  bool IsUseThousandSep() const { return mbThousandSep; }
144 
145  void SetShowTrailingZeros( bool bShowTrailingZeros );
146  bool IsShowTrailingZeros() const { return mbShowTrailingZeros; }
147 
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;
153 
154  sal_Int64 Normalize( sal_Int64 nValue ) const;
155  sal_Int64 Denormalize( sal_Int64 nValue ) const;
156 
157 protected:
158  sal_Int64 mnFieldValue;
159  sal_Int64 mnLastValue;
160  sal_Int64 mnMin;
161  sal_Int64 mnMax;
164 
165  // the members below are used in all derivatives of NumericFormatter
166  // not in NumericFormatter itself.
167  sal_Int64 mnSpinSize;
168  sal_Int64 mnFirst;
169  sal_Int64 mnLast;
170 
171  NumericFormatter(Edit* pEdit);
172 
173  void FieldUp();
174  void FieldDown();
175  void FieldFirst();
176  void FieldLast();
177  void FormatValue(Selection const * pNewSelection = nullptr);
178 
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 );
182 
183  virtual sal_Int64 GetValueFromString(const OUString& rStr) const;
184 
185 private:
186  SAL_DLLPRIVATE void ImplInit();
187 
188  sal_uInt16 mnDecimalDigits;
191 
192 };
193 
194 
196 {
197 public:
198  virtual ~MetricFormatter() override;
199 
200  virtual void CustomConvert() = 0;
201  virtual void Reformat() override;
202 
203  virtual void SetUnit( FieldUnit meUnit );
204  FieldUnit GetUnit() const { return meUnit; }
205  void SetCustomUnitText( const OUString& rStr );
206  const OUString& GetCustomUnitText() const { return maCustomUnitText; }
207  const OUString& GetCurUnitText() const { return maCurUnitText; }
208 
210  void SetMax( sal_Int64 nNewMax, FieldUnit eInUnit );
212  sal_Int64 GetMax( FieldUnit eOutUnit ) const;
214  void SetMin( sal_Int64 nNewMin, FieldUnit eInUnit );
216  sal_Int64 GetMin( FieldUnit eOutUnit ) const;
217  void SetBaseValue( sal_Int64 nNewBase, FieldUnit eInUnit = FieldUnit::NONE );
218  sal_Int64 GetBaseValue() const;
219 
220  virtual void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit );
221  virtual void SetValue( sal_Int64 nValue ) override;
223  void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit );
225  sal_Int64 GetValue( FieldUnit eOutUnit ) const;
226  virtual OUString CreateFieldText( sal_Int64 nValue ) const override;
227  sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const;
228 
229  void SetCustomConvertHdl( const Link<MetricFormatter&,void>& rLink ) { maCustomConvertLink = rLink; }
230 
231  static FieldUnit StringToMetric(const OUString &rMetricString);
232  static bool TextToValue(const OUString& rStr, double& rValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper, FieldUnit eUnit);
233 
234 protected:
235  sal_Int64 mnBaseValue;
238 
239  MetricFormatter(Edit* pEdit);
240 
241  SAL_DLLPRIVATE void ImplMetricReformat( const OUString& rStr, double& rValue, OUString& rOutStr );
242 
243  virtual sal_Int64 GetValueFromString(const OUString& rStr) const override;
244  virtual sal_Int64 GetValueFromStringUnit(const OUString& rStr, FieldUnit eOutUnit) const;
245 
246 private:
247  SAL_DLLPRIVATE void ImplInit();
248 
250  OUString maCurUnitText;
251 };
252 
253 
255 {
256 protected:
257  CurrencyFormatter(Edit* pEdit);
258  SAL_DLLPRIVATE void ImplCurrencyReformat( const OUString& rStr, OUString& rOutStr );
259  virtual sal_Int64 GetValueFromString(const OUString& rStr) const override;
260 
261 public:
262  virtual ~CurrencyFormatter() override;
263 
264  virtual void Reformat() override;
265 
266  virtual void SetValue( sal_Int64 nNewValue ) override;
267  virtual OUString CreateFieldText( sal_Int64 nValue ) const override;
268 };
269 
270 
272 {
273 private:
274  std::unique_ptr<CalendarWrapper> mpCalendarWrapper;
283 
284  SAL_DLLPRIVATE void ImplInit();
285 
286 protected:
287  DateFormatter(Edit* pEdit);
288 
289  SAL_DLLPRIVATE const Date& ImplGetFieldDate() const { return maFieldDate; }
290  SAL_DLLPRIVATE void ImplDateReformat( const OUString& rStr, OUString& rOutStr );
291  SAL_DLLPRIVATE void ImplSetUserDate( const Date& rNewDate,
292  Selection const * pNewSelection = nullptr );
293  SAL_DLLPRIVATE OUString ImplGetDateAsText( const Date& rDate ) const;
294  SAL_DLLPRIVATE void ImplNewFieldValue( const Date& rDate );
295  CalendarWrapper& GetCalendarWrapper() const;
296 
297  SAL_DLLPRIVATE bool ImplAllowMalformedInput() const;
298 
299 public:
300  virtual ~DateFormatter() override;
301 
302  virtual void Reformat() override;
303  virtual void ReformatAll() override;
304 
305  void SetExtDateFormat( ExtDateFieldFormat eFormat );
306  ExtDateFieldFormat GetExtDateFormat( bool bResolveSystemFormat = false ) const;
307 
308  void SetMin( const Date& rNewMin );
309  const Date& GetMin() const { return maMin; }
310 
311  void SetMax( const Date& rNewMax );
312  const Date& GetMax() const { return maMax; }
313 
314 
315  // MT: Remove these methods too, ExtDateFormat should be enough!
316  // What should happen if using DDMMYYYY, but ShowCentury=false?
317 
318  void SetLongFormat( bool bLong );
319  bool IsLongFormat() const { return mbLongFormat; }
320  void SetShowDateCentury( bool bShowCentury );
321  bool IsShowDateCentury() const { return mbShowDateCentury; }
322 
323 
324  void SetDate( const Date& rNewDate );
325  Date GetDate() const;
326  void SetEmptyDate();
327  bool IsEmptyDate() const;
328 
329  void ResetLastDate() { maLastDate = Date( Date::EMPTY ); }
330 
331  static void ExpandCentury( Date& rDate );
332  static void ExpandCentury( Date& rDate, sal_uInt16 nTwoDigitYearStart );
333 
346  void EnforceValidValue( bool _bEnforce ) { mbEnforceValidValue = _bEnforce; }
347  bool IsEnforceValidValue( ) const { return mbEnforceValidValue; }
348 };
349 
350 
352 {
353 private:
361 
362  SAL_DLLPRIVATE void ImplInit();
363 
364 protected:
366 
367  TimeFormatter(Edit* pEdit);
368 
369  SAL_DLLPRIVATE void ImplTimeReformat( const OUString& rStr, OUString& rOutStr );
370  SAL_DLLPRIVATE void ImplNewFieldValue( const tools::Time& rTime );
371  SAL_DLLPRIVATE void ImplSetUserTime( const tools::Time& rNewTime, Selection const * pNewSelection = nullptr );
372  SAL_DLLPRIVATE bool ImplAllowMalformedInput() const;
373 
374 public:
375  static OUString FormatTime(const tools::Time& rNewTime, TimeFieldFormat eFormat, TimeFormat eHourFormat, bool bDuration, const LocaleDataWrapper& rLocaleData);
376  static bool TextToTime(const OUString& rStr, tools::Time& rTime, TimeFieldFormat eFormat, bool bDuration, const LocaleDataWrapper& rLocaleDataWrapper, bool _bSkipInvalidCharacters = true);
377  static int GetTimeArea(TimeFieldFormat eFormat, const OUString& rText, int nCursor,
378  const LocaleDataWrapper& rLocaleDataWrapper);
379  static tools::Time SpinTime(bool bUp, const tools::Time& rTime, TimeFieldFormat eFormat,
380  bool bDuration, const OUString& rText, int nCursor,
381  const LocaleDataWrapper& rLocaleDataWrapper);
382 
383  virtual ~TimeFormatter() override;
384 
385  virtual void Reformat() override;
386  virtual void ReformatAll() override;
387 
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; }
392 
393  void SetTimeFormat( TimeFormat eNewFormat );
394  TimeFormat GetTimeFormat() const { return mnTimeFormat;}
395 
396  void SetFormat( TimeFieldFormat eNewFormat );
397  TimeFieldFormat GetFormat() const { return meFormat; }
398 
399  void SetDuration( bool mbDuration );
400  bool IsDuration() const { return mbDuration; }
401 
402  void SetTime( const tools::Time& rNewTime );
403  void SetUserTime( const tools::Time& rNewTime );
404  tools::Time GetTime() const;
407 
420  void EnforceValidValue( bool _bEnforce ) { mbEnforceValidValue = _bEnforce; }
421  bool IsEnforceValidValue( ) const { return mbEnforceValidValue; }
422 };
423 
424 
426 {
427 public:
428  explicit PatternField( vcl::Window* pParent, WinBits nWinStyle );
429 
430  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
431  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
432  virtual void Modify() override;
433  virtual void dispose() override;
434 };
435 
436 
438 {
439 public:
440  explicit NumericField( vcl::Window* pParent, WinBits nWinStyle );
441 
442  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
443  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
444  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
445 
446  virtual Size CalcMinimumSize() const override;
447 
448  virtual void Modify() override;
449 
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;
456 };
457 
458 
460 {
461 public:
462  explicit MetricField( vcl::Window* pParent, WinBits nWinStyle );
463 
464  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
465  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
466  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
467 
468  virtual Size CalcMinimumSize() const override;
469 
470  virtual void Modify() override;
471 
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;
477 
478  virtual void SetUnit( FieldUnit meUnit ) override;
479 
480  void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit );
481  void SetFirst(sal_Int64 first) { SetFirst(first, FieldUnit::NONE); }
482  sal_Int64 GetFirst( FieldUnit eOutUnit ) const;
483  void SetLast( sal_Int64 nNewLast, FieldUnit eInUnit );
484  void SetLast(sal_Int64 last) { SetLast(last, FieldUnit::NONE); }
485  sal_Int64 GetLast( FieldUnit eOutUnit ) const;
486 
487  static void SetDefaultUnit( FieldUnit eDefaultUnit );
488  static FieldUnit GetDefaultUnit();
489  static sal_Int64 ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
490  FieldUnit eInUnit, FieldUnit eOutUnit );
491  static sal_Int64 ConvertValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
492  MapUnit eInUnit, FieldUnit eOutUnit );
493 
494  // for backwards compatibility
495  // caution: conversion to double loses precision
496  static double ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
497  FieldUnit eInUnit, FieldUnit eOutUnit );
498  static double ConvertDoubleValue( double nValue, sal_uInt16 nDecDigits,
499  FieldUnit eInUnit, MapUnit eOutUnit );
500  static double ConvertDoubleValue( double nValue, sal_uInt16 nDecDigits,
501  MapUnit eInUnit, FieldUnit eOutUnit );
502 
503  // for backwards compatibility
504  // caution: conversion to double loses precision
505  static double ConvertDoubleValue( sal_Int64 nValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits,
506  FieldUnit eInUnit, FieldUnit eOutUnit )
507  { return ConvertDoubleValue( static_cast<double>(nValue), nBaseValue, nDecDigits, eInUnit, eOutUnit ); }
508  static double ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
509  FieldUnit eInUnit, MapUnit eOutUnit )
510  { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); }
511  static double ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
512  MapUnit eInUnit, FieldUnit eOutUnit )
513  { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); }
514 
515  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
516  virtual void dispose() override;
517 };
518 
519 
521 {
522 public:
523  CurrencyField( vcl::Window* pParent, WinBits nWinStyle );
524 
525  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
526  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
527  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
528 
529  virtual void Modify() override;
530 
531  virtual void Up() override;
532  virtual void Down() override;
533  virtual void First() override;
534  virtual void Last() override;
535  virtual void dispose() override;
536 };
537 
538 
540 {
541 private:
544 
545 protected:
546  SAL_DLLPRIVATE void ImplDateSpinArea( bool bUp );
547 
548 public:
549  explicit DateField( vcl::Window* pParent, WinBits nWinStyle );
550 
551  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
552  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
553  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
554 
555  virtual void Modify() override;
556 
557  virtual void Up() override;
558  virtual void Down() override;
559  virtual void First() override;
560  virtual void Last() override;
561 
562  void SetFirst( const Date& rNewFirst ) { maFirst = rNewFirst; }
563  const Date& GetFirst() const { return maFirst; }
564  void SetLast( const Date& rNewLast ) { maLast = rNewLast; }
565  const Date& GetLast() const { return maLast; }
566  virtual void dispose() override;
567 };
568 
569 
571 {
572 private:
575 
576 protected:
577  SAL_DLLPRIVATE void ImplTimeSpinArea( bool bUp );
578 
579 public:
580  explicit TimeField( vcl::Window* pParent, WinBits nWinStyle );
581 
582  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
583  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
584  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
585 
586  virtual void Modify() override;
587 
588  virtual void Up() override;
589  virtual void Down() override;
590  virtual void First() override;
591  virtual void Last() override;
592 
593  void SetFirst( const tools::Time& rNewFirst ) { maFirst = rNewFirst; }
594  const tools::Time& GetFirst() const { return maFirst; }
595  void SetLast( const tools::Time& rNewLast ) { maLast = rNewLast; }
596  const tools::Time& GetLast() const { return maLast; }
597 
598  void SetExtFormat( ExtTimeFieldFormat eFormat );
599  virtual void dispose() override;
600 };
601 
602 
604 {
605 public:
606  PatternBox( vcl::Window* pParent, WinBits nWinStyle );
607 
608  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
609  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
610 
611  virtual void Modify() override;
612 
613  virtual void ReformatAll() override;
614  virtual void dispose() override;
615 };
616 
617 
619 {
620  SAL_DLLPRIVATE void ImplNumericReformat( const OUString& rStr, sal_Int64& rValue, OUString& rOutStr );
621 public:
622  explicit NumericBox( vcl::Window* pParent, WinBits nWinStyle );
623 
624  virtual Size CalcMinimumSize() const override;
625 
626  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
627  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
628  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
629 
630  virtual void Modify() override;
631 
632  virtual void ReformatAll() override;
633 
634  void InsertValue( sal_Int64 nValue, sal_Int32 nPos = COMBOBOX_APPEND );
635  virtual void dispose() override;
636 };
637 
638 
640 {
641 public:
642  explicit MetricBox( vcl::Window* pParent, WinBits nWinStyle );
643 
644  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
645  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
646  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
647 
648  virtual Size CalcMinimumSize() const override;
649 
650  virtual void Modify() override;
651 
652  virtual void CustomConvert() override;
653  virtual void ReformatAll() override;
654 
655  void InsertValue( sal_Int64 nValue, FieldUnit eInUnit = FieldUnit::NONE,
656  sal_Int32 nPos = COMBOBOX_APPEND );
657 
658  // Needed, because GetValue() with nPos hide these functions
660 
661  virtual void dispose() override;
662 };
663 
664 
666 {
667 public:
668  explicit CurrencyBox( vcl::Window* pParent, WinBits nWinStyle );
669 
670  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
671  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
672  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
673 
674  virtual void Modify() override;
675 
676  virtual void ReformatAll() override;
677 
678  virtual void dispose() override;
679 };
680 
681 
683 {
684 public:
685  explicit DateBox( vcl::Window* pParent, WinBits nWinStyle );
686 
687  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
688  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
689  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
690 
691  virtual void Modify() override;
692 
693  virtual void ReformatAll() override;
694  virtual void dispose() override;
695 };
696 
697 
699 {
700 public:
701  explicit TimeBox( vcl::Window* pParent, WinBits nWinStyle );
702 
703  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
704  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
705  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
706 
707  virtual void Modify() override;
708 
709  virtual void ReformatAll() override;
710  virtual void dispose() override;
711 };
712 
713 #endif // INCLUDED_VCL_FIELD_HXX
714 
715 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Date maFirst
Definition: field.hxx:542
sal_Int64 GetFirst() const
Definition: field.hxx:133
OUString maLiteralMask
Definition: field.hxx:92
FieldUnit
Link< MetricFormatter &, void > maCustomConvertLink
Definition: field.hxx:237
bool mbInPattKeyInput
Definition: field.hxx:94
SAL_DLLPRIVATE const Date & ImplGetFieldDate() const
Definition: field.hxx:289
const tools::Time & GetFirst() const
Definition: field.hxx:594
OString m_aEditMask
Definition: field.hxx:91
std::unique_ptr< CalendarWrapper > mpCalendarWrapper
Definition: field.hxx:274
void SetFirst(const Date &rNewFirst)
Definition: field.hxx:562
ExtTimeFieldFormat
Definition: vclenum.hxx:148
TimeFieldFormat
Definition: vclenum.hxx:28
void SetFirst(const tools::Time &rNewFirst)
Definition: field.hxx:593
void SetMax(sal_Int64 nNewMax)
Definition: field.cxx:508
bool mbFormatting
Definition: field.hxx:163
std::string GetValue
static FieldUnit eDefaultUnit
Definition: field.cxx:1042
TimeFormat GetTimeFormat() const
Definition: field.hxx:394
virtual void CustomConvert()=0
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
tools::Time maMin
Definition: field.hxx:355
sal_Int64 GetSpinSize() const
Definition: field.hxx:137
bool mbThousandSep
Definition: field.hxx:189
tools::Time maFieldTime
Definition: field.hxx:365
OUString maCurUnitText
Definition: field.hxx:250
Any GetTime(const OUString &val)
virtual OUString CreateFieldText(sal_Int64 nValue) const
Definition: field.cxx:544
void SetEmptyFieldValue()
Definition: field.cxx:444
tools::Time maFirst
Definition: field.hxx:573
Date maFieldDate
Definition: field.hxx:275
sal_Int64 mnFieldValue
Definition: field.hxx:158
sal_Int64 mnLastValue
Definition: field.hxx:159
virtual void SetUnit(FieldUnit meUnit)
Definition: field.cxx:1346
bool IsEmptyFieldValueEnabled() const
Definition: field.hxx:83
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: edit.cxx:176
virtual void Up()
Definition: spinfld.cxx:359
std::unique_ptr< LocaleDataWrapper > mpLocaleDataWrapper
Definition: field.hxx:44
sal_Int64 GetValue() const
Definition: field.cxx:576
bool mbEmptyFieldValueEnabled
Definition: field.hxx:48
virtual void ReformatAll() override
Definition: field2.cxx:2318
bool mbEnforceValidValue
Definition: field.hxx:282
bool MustBeReformatted() const
Definition: field.hxx:67
bool IsShowDateCentury() const
Definition: field.hxx:321
Date maLast
Definition: field.hxx:543
void ClearField()
Definition: field.hxx:59
void SetSpinSize(sal_Int64 nNewSize)
Definition: field.hxx:136
void SetMin(sal_Int64 nNewMin)
Definition: field.cxx:501
void SetString(SwCursor &rCursor, const OUString &rString)
bool IsEmptyTime() const
Definition: field.hxx:406
tools::Time maMax
Definition: field.hxx:356
OUString GetString(int nId)
bool IsEnforceValidValue() const
Definition: field.hxx:421
bool mbSameMask
Definition: field.hxx:93
sal_Int64 WinBits
Edit * GetField() const
Definition: field.hxx:58
sal_Int64 mnBaseValue
Definition: field.hxx:235
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: spinfld.cxx:352
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: combobox.cxx:118
TimeFormat mnTimeFormat
Definition: field.hxx:358
SAL_DLLPRIVATE bool ImplIsSameMask() const
Definition: field.hxx:101
TimeFormat
Definition: vclenum.hxx:143
FieldUnit GetUnit() const
Definition: field.hxx:204
OUString maCustomUnitText
Definition: field.hxx:249
bool mbEmptyFieldValue
Definition: field.hxx:47
sal_uInt16 GetDecimalDigits() const
Definition: field.hxx:140
void EnforceValidValue(bool _bEnforce)
enables or disables the enforcement of valid values
Definition: field.hxx:346
void SetLast(const Date &rNewLast)
Definition: field.hxx:564
const OUString & GetCurUnitText() const
Definition: field.hxx:207
bool IsEmptyFieldValue() const
Definition: field.cxx:451
bool IsLongFormat() const
Definition: field.hxx:319
Definition: edit.hxx:58
virtual void Down()
Definition: spinfld.cxx:364
sal_Int64 GetMin() const
Definition: field.hxx:126
ExtDateFieldFormat mnExtDateFormat
Definition: field.hxx:281
const Date & GetFirst() const
Definition: field.hxx:563
Date maMax
Definition: field.hxx:278
SAL_DLLPRIVATE void ImplInit()
Definition: field.cxx:469
bool mbStrictFormat
Definition: field.hxx:46
SAL_DLLPRIVATE bool & ImplGetInPattKeyInput()
Definition: field.hxx:102
FieldUnit meUnit
Definition: field.hxx:236
virtual void ReformatAll()
Definition: field.cxx:397
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: combobox.cxx:680
tools::Time maLast
Definition: field.hxx:574
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: spinfld.cxx:490
void clear()
Definition: vclptr.hxx:190
const Date & GetMax() const
Definition: field.hxx:312
void SetCustomConvertHdl(const Link< MetricFormatter &, void > &rLink)
Definition: field.hxx:229
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:51
bool mbDuration
Definition: field.hxx:359
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: combobox.cxx:702
virtual void Reformat()
Definition: field.cxx:393
bool mbReformat
Definition: field.hxx:45
bool IsStrictFormat() const
Definition: field.hxx:71
static double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, MapUnit eInUnit, FieldUnit eOutUnit)
Definition: field.hxx:511
void SetEmptyFieldValueData(bool bValue)
Definition: field.hxx:54
void SetLast(sal_Int64 last)
Definition: field.hxx:484
virtual void Modify()
Definition: edit.cxx:2320
void EnableEmptyFieldValue(bool bEnable)
Definition: field.hxx:82
const OUString & GetLiteralMask() const
Definition: field.hxx:111
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
const tools::Time & GetLast() const
Definition: field.hxx:596
bool mbShowDateCentury
Definition: field.hxx:280
bool mbShowTrailingZeros
Definition: field.hxx:190
SAL_DLLPRIVATE bool ImplGetEmptyFieldValue() const
Definition: field.hxx:52
const Date & GetLast() const
Definition: field.hxx:565
Date maLastDate
Definition: field.hxx:276
void ResetLastDate()
Definition: field.hxx:329
void SetEmptyTime()
Definition: field.hxx:405
const OString & GetEditMask() const
Definition: field.hxx:110
sal_Int64 mnLast
Definition: field.hxx:169
bool IsShowTrailingZeros() const
Definition: field.hxx:146
virtual void ReformatAll() override
Definition: field2.cxx:1463
bool mbEnforceValidValue
Definition: field.hxx:360
virtual void Reformat() override
Definition: field.cxx:621
ExtDateFieldFormat
Definition: vclenum.hxx:153
static double ConvertDoubleValue(sal_Int64 nValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit)
Definition: field.hxx:505
void MarkToBeReformatted(bool b)
Definition: field.hxx:68
sal_Int64 mnMax
Definition: field.hxx:161
virtual void First()
Definition: spinfld.cxx:369
virtual sal_Int64 GetValueFromString(const OUString &rStr) const
Definition: field.cxx:563
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: spinfld.cxx:813
void EnforceValidValue(bool _bEnforce)
enables or disables the enforcement of valid values
Definition: field.hxx:420
TimeFieldFormat GetFormat() const
Definition: field.hxx:397
bool IsEnforceValidValue() const
Definition: field.hxx:347
sal_Int64 GetMax() const
Definition: field.hxx:128
void SetFirst(sal_Int64 nNewFirst)
Definition: field.hxx:132
const tools::Time & GetMax() const
Definition: field.hxx:391
TimeFieldFormat meFormat
Definition: field.hxx:357
sal_Int64 GetLast() const
Definition: field.hxx:135
void SetFirst(sal_Int64 first)
Definition: field.hxx:481
virtual Size CalcMinimumSize() const override
Definition: spinfld.cxx:923
sal_Int64 mnSpinSize
Definition: field.hxx:167
sal_Int64 mnFirst
Definition: field.hxx:168
virtual void Last()
Definition: spinfld.cxx:374
SAL_DLLPRIVATE void ImplNumericReformat()
Definition: field.cxx:463
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: spinfld.cxx:835
A widget used to choose from a list of items and which has an entry.
Definition: combobox.hxx:34
bool IsUseThousandSep() const
Definition: field.hxx:143
MapUnit
const tools::Time & GetMin() const
Definition: field.hxx:389
sal_Int64 mnMin
Definition: field.hxx:160
bool mbWrapOnLimits
Definition: field.hxx:162
void SetLast(sal_Int64 nNewLast)
Definition: field.hxx:134
bool mbLongFormat
Definition: field.hxx:279
sal_Int32 nPos
void SetLast(const tools::Time &rNewLast)
Definition: field.hxx:595
void SetUserValue(sal_Int64 nNewValue)
Definition: field.cxx:558
Size CalcMinimumSize() const override
Definition: combobox.cxx:1043
const Date & GetMin() const
Definition: field.hxx:309
bool IsDuration() const
Definition: field.hxx:400
sal_uInt16 mnDecimalDigits
Definition: field.hxx:188
virtual void SetValue(sal_Int64 nNewValue)
Definition: field.cxx:537
void SetFormat(LotusContext &rContext, SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt8 nFormat, sal_uInt8 nSt)
tools::Time maLastTime
Definition: field.hxx:354
#define COMBOBOX_APPEND
Definition: combobox.hxx:27
VclPtr< Edit > mpField
Definition: field.hxx:42
static double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, MapUnit eOutUnit)
Definition: field.hxx:508
virtual void Modify() override
Definition: combobox.cxx:807
const OUString & GetCustomUnitText() const
Definition: field.hxx:206
Date maMin
Definition: field.hxx:277