LibreOffice Module vcl (master)  1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
TimeFormatter Class Reference

#include <field.hxx>

Inheritance diagram for TimeFormatter:
[legend]
Collaboration diagram for TimeFormatter:
[legend]

Public Member Functions

virtual ~TimeFormatter () override
 
virtual void Reformat () override
 
virtual void ReformatAll () override
 
void SetMin (const tools::Time &rNewMin)
 
const tools::TimeGetMin () const
 
void SetMax (const tools::Time &rNewMax)
 
const tools::TimeGetMax () const
 
void SetTimeFormat (TimeFormat eNewFormat)
 
TimeFormat GetTimeFormat () const
 
void SetFormat (TimeFieldFormat eNewFormat)
 
TimeFieldFormat GetFormat () const
 
void SetDuration (bool mbDuration)
 
bool IsDuration () const
 
void SetTime (const tools::Time &rNewTime)
 
void SetUserTime (const tools::Time &rNewTime)
 
tools::Time GetTime () const
 
void SetEmptyTime ()
 
bool IsEmptyTime () const
 
void EnforceValidValue (bool _bEnforce)
 enables or disables the enforcement of valid values More...
 
bool IsEnforceValidValue () const
 
- Public Member Functions inherited from FormatterBase
 FormatterBase (Edit *pField)
 
virtual ~FormatterBase ()
 
const LocaleDataWrapperGetLocaleDataWrapper () const
 
bool MustBeReformatted () const
 
void MarkToBeReformatted (bool b)
 
void SetStrictFormat (bool bStrict)
 
bool IsStrictFormat () const
 
const css::lang::Locale & GetLocale () const
 
const LanguageTagGetLanguageTag () const
 
void SetEmptyFieldValue ()
 
bool IsEmptyFieldValue () const
 
void EnableEmptyFieldValue (bool bEnable)
 
bool IsEmptyFieldValueEnabled () const
 

Static Public Member Functions

static OUString FormatTime (const tools::Time &rNewTime, TimeFieldFormat eFormat, TimeFormat eHourFormat, bool bDuration, const LocaleDataWrapper &rLocaleData)
 
static bool TextToTime (const OUString &rStr, tools::Time &rTime, TimeFieldFormat eFormat, bool bDuration, const LocaleDataWrapper &rLocaleDataWrapper, bool _bSkipInvalidCharacters=true)
 
static int GetTimeArea (TimeFieldFormat eFormat, const OUString &rText, int nCursor, const LocaleDataWrapper &rLocaleDataWrapper)
 
static tools::Time SpinTime (bool bUp, const tools::Time &rTime, TimeFieldFormat eFormat, bool bDuration, const OUString &rText, int nCursor, const LocaleDataWrapper &rLocaleDataWrapper)
 

Protected Member Functions

 TimeFormatter (Edit *pEdit)
 
SAL_DLLPRIVATE void ImplTimeReformat (const OUString &rStr, OUString &rOutStr)
 
SAL_DLLPRIVATE void ImplNewFieldValue (const tools::Time &rTime)
 
SAL_DLLPRIVATE void ImplSetUserTime (const tools::Time &rNewTime, Selection const *pNewSelection=nullptr)
 
SAL_DLLPRIVATE bool ImplAllowMalformedInput () const
 
- Protected Member Functions inherited from FormatterBase
SAL_DLLPRIVATE void ImplSetText (const OUString &rText, Selection const *pNewSel=nullptr)
 
SAL_DLLPRIVATE bool ImplGetEmptyFieldValue () const
 
void SetEmptyFieldValueData (bool bValue)
 
SAL_DLLPRIVATE LocaleDataWrapperImplGetLocaleDataWrapper () const
 
EditGetField () const
 
void ClearField ()
 

Protected Attributes

tools::Time maFieldTime
 

Private Member Functions

SAL_DLLPRIVATE void ImplInit ()
 

Private Attributes

tools::Time maLastTime
 
tools::Time maMin
 
tools::Time maMax
 
TimeFieldFormat meFormat
 
TimeFormat mnTimeFormat
 
bool mbDuration
 
bool mbEnforceValidValue
 

Detailed Description

Definition at line 351 of file field.hxx.

Constructor & Destructor Documentation

TimeFormatter::TimeFormatter ( Edit pEdit)
protected

Definition at line 2303 of file field2.cxx.

References ImplInit().

TimeFormatter::~TimeFormatter ( )
overridevirtual

Definition at line 2314 of file field2.cxx.

Member Function Documentation

void TimeFormatter::EnforceValidValue ( bool  _bEnforce)
inline

enables or disables the enforcement of valid values

If this is set to true (which is the default), then GetTime will always return a valid time, no matter whether the current text can really be interpreted as time. (Note: this is the compatible behavior).

If this is set to false, the GetTime will return GetInvalidTime, in case the current text cannot be interpreted as time.

In addition, if this is set to false, the text in the field will not be corrected when the control loses the focus - instead, the invalid input will be preserved.

Definition at line 420 of file field.hxx.

OUString TimeFormatter::FormatTime ( const tools::Time rNewTime,
TimeFieldFormat  eFormat,
TimeFormat  eHourFormat,
bool  bDuration,
const LocaleDataWrapper rLocaleData 
)
static
TimeFieldFormat TimeFormatter::GetFormat ( ) const
inline
const tools::Time& TimeFormatter::GetMax ( ) const
inline

Definition at line 391 of file field.hxx.

Referenced by GetTime(), ImplSetUserTime(), and ImplTimeReformat().

const tools::Time& TimeFormatter::GetMin ( ) const
inline

Definition at line 389 of file field.hxx.

Referenced by GetTime(), ImplSetUserTime(), and ImplTimeReformat().

tools::Time TimeFormatter::GetTime ( ) const
int TimeFormatter::GetTimeArea ( TimeFieldFormat  eFormat,
const OUString &  rText,
int  nCursor,
const LocaleDataWrapper rLocaleDataWrapper 
)
static
TimeFormat TimeFormatter::GetTimeFormat ( ) const
inline

Definition at line 394 of file field.hxx.

Referenced by ImplSetUserTime(), and ImplTimeReformat().

bool TimeFormatter::ImplAllowMalformedInput ( ) const
protected

Definition at line 2198 of file field2.cxx.

References IsEnforceValidValue().

Referenced by TimeField::EventNotify(), and GetTime().

void TimeFormatter::ImplInit ( )
private

Definition at line 2296 of file field2.cxx.

References F_NONE, Hour24, mbDuration, meFormat, and mnTimeFormat.

Referenced by TimeFormatter().

void TimeFormatter::ImplNewFieldValue ( const tools::Time rTime)
protected
void TimeFormatter::ImplSetUserTime ( const tools::Time rNewTime,
Selection const *  pNewSelection = nullptr 
)
protected
void TimeFormatter::ImplTimeReformat ( const OUString &  rStr,
OUString &  rOutStr 
)
protected
bool TimeFormatter::IsDuration ( ) const
inline
bool TimeFormatter::IsEmptyTime ( ) const
inline

Definition at line 406 of file field.hxx.

References FormatterBase::IsEmptyFieldValue().

bool TimeFormatter::IsEnforceValidValue ( ) const
inline

Definition at line 421 of file field.hxx.

Referenced by ImplAllowMalformedInput().

void TimeFormatter::Reformat ( )
overridevirtual
void TimeFormatter::ReformatAll ( )
overridevirtual

Reimplemented from FormatterBase.

Reimplemented in TimeBox.

Definition at line 2318 of file field2.cxx.

References Reformat().

Referenced by TimeField::DataChanged(), SetDuration(), TimeField::SetExtFormat(), SetFormat(), SetMax(), and SetMin().

void TimeFormatter::SetDuration ( bool  mbDuration)

Definition at line 2349 of file field2.cxx.

References mbDuration, and ReformatAll().

Referenced by TimeField::SetExtFormat().

void TimeFormatter::SetEmptyTime ( )
inline

Definition at line 405 of file field.hxx.

References FormatterBase::SetEmptyFieldValue().

void TimeFormatter::SetFormat ( TimeFieldFormat  eNewFormat)

Definition at line 2343 of file field2.cxx.

References meFormat, and ReformatAll().

Referenced by TimeField::SetExtFormat().

void TimeFormatter::SetMax ( const tools::Time rNewMax)

Definition at line 2330 of file field2.cxx.

References FormatterBase::IsEmptyFieldValue(), maMax, and ReformatAll().

Referenced by VclBuilder::mungeAdjustment().

void TimeFormatter::SetMin ( const tools::Time rNewMin)

Definition at line 2323 of file field2.cxx.

References FormatterBase::IsEmptyFieldValue(), maMin, and ReformatAll().

Referenced by VclBuilder::mungeAdjustment().

void TimeFormatter::SetTime ( const tools::Time rNewTime)
void TimeFormatter::SetTimeFormat ( TimeFormat  eNewFormat)

Definition at line 2337 of file field2.cxx.

References mnTimeFormat.

Referenced by TimeField::SetExtFormat().

void TimeFormatter::SetUserTime ( const tools::Time rNewTime)

Definition at line 2454 of file field2.cxx.

References ImplSetUserTime().

Referenced by TimeField::SetExtFormat(), and SetTime().

tools::Time TimeFormatter::SpinTime ( bool  bUp,
const tools::Time rTime,
TimeFieldFormat  eFormat,
bool  bDuration,
const OUString &  rText,
int  nCursor,
const LocaleDataWrapper rLocaleDataWrapper 
)
static

Definition at line 2244 of file field2.cxx.

References GetTimeArea().

Referenced by TimeField::ImplTimeSpinArea().

bool TimeFormatter::TextToTime ( const OUString &  rStr,
tools::Time rTime,
TimeFieldFormat  eFormat,
bool  bDuration,
const LocaleDataWrapper rLocaleDataWrapper,
bool  _bSkipInvalidCharacters = true 
)
static

Member Data Documentation

tools::Time TimeFormatter::maFieldTime
protected

Definition at line 365 of file field.hxx.

Referenced by SetTime(), TimeBox::TimeBox(), and TimeField::TimeField().

tools::Time TimeFormatter::maLastTime
private

Definition at line 354 of file field.hxx.

Referenced by GetTime(), ImplNewFieldValue(), ImplSetUserTime(), Reformat(), and SetTime().

tools::Time TimeFormatter::maMax
private

Definition at line 356 of file field.hxx.

Referenced by SetMax().

tools::Time TimeFormatter::maMin
private

Definition at line 355 of file field.hxx.

Referenced by SetMin().

bool TimeFormatter::mbDuration
private

Definition at line 359 of file field.hxx.

Referenced by ImplInit(), ImplSetUserTime(), ImplTimeReformat(), and SetDuration().

bool TimeFormatter::mbEnforceValidValue
private

Definition at line 360 of file field.hxx.

TimeFieldFormat TimeFormatter::meFormat
private

Definition at line 357 of file field.hxx.

Referenced by ImplInit(), ImplSetUserTime(), ImplTimeReformat(), and SetFormat().

TimeFormat TimeFormatter::mnTimeFormat
private

Definition at line 358 of file field.hxx.

Referenced by ImplInit(), and SetTimeFormat().


The documentation for this class was generated from the following files: