LibreOffice Module vcl (master) 1
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Formatter Class Referenceabstract

#include <formatter.hxx>

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

Classes

class  StaticFormatter
 

Public Member Functions

 Formatter ()
 
virtual ~Formatter ()
 
void SetFieldText (const OUString &rText, const Selection &rNewSelection)
 
virtual Selection GetEntrySelection () const =0
 
virtual OUString GetEntryText () const =0
 
virtual SelectionOptions GetEntrySelectionOptions () const =0
 
virtual void SetEntryText (const OUString &rText, const Selection &rSel)=0
 
virtual void SetEntryTextColor (const Color *pColor)=0
 
virtual void FieldModified ()=0
 
bool HasMinValue () const
 
virtual void ClearMinValue ()
 
virtual void SetMinValue (double dMin)
 
double GetMinValue () const
 
bool HasMaxValue () const
 
virtual void ClearMaxValue ()
 
virtual void SetMaxValue (double dMax)
 
double GetMaxValue () const
 
void SetValue (double dVal)
 
double GetValue ()
 
void SetTextValue (const OUString &rText)
 
bool IsEmptyFieldEnabled () const
 
void EnableEmptyField (bool bEnable)
 
void SetDefaultValue (double dDefault)
 
double GetDefaultValue () const
 
void SetLastSelection (const Selection &rSelection)
 
sal_uLong GetFormatKey () const
 
void SetFormatKey (sal_uLong nFormatKey)
 
SvNumberFormatterGetOrCreateFormatter () const
 
SvNumberFormatterGetFormatter () const
 
void SetFormatter (SvNumberFormatter *pFormatter, bool bResetFormat=true)
 
bool GetThousandsSep () const
 
void SetThousandsSep (bool _bUseSeparator)
 
void DisableRemainderFactor ()
 
bool GetDisableRemainderFactor () const
 
void SetWrapOnLimits (bool bWrapOnLimits)
 
sal_uInt16 GetDecimalDigits () const
 
void SetDecimalDigits (sal_uInt16 _nPrecision)
 
SvNumberFormatterStandardFormatter ()
 
OUString GetFormat (LanguageType &eLang) const
 
bool SetFormat (const OUString &rFormatString, LanguageType eLang)
 
bool IsStrictFormat () const
 
void SetStrictFormat (bool bEnable)
 
virtual void SetSpinSize (double dStep)
 
double GetSpinSize () const
 
void SetSpinFirst (double dFirst)
 
double GetSpinFirst () const
 
void SetSpinLast (double dLast)
 
double GetSpinLast () const
 
bool TreatingAsNumber () const
 
void TreatAsNumber (bool bDoSo)
 
void SetInputHdl (const Link< sal_Int64 *, TriState > &rLink)
 
void SetOutputHdl (const Link< LinkParamNone *, bool > &rLink)
 
void SetTextFormatted (const OUString &rText)
 
OUString const & GetTextValue () const
 
void SetDefaultText (const OUString &rDefault)
 
const OUString & GetDefaultText () const
 
const ColorGetLastOutputColor () const
 
void Commit ()
 reformats the current text. More...
 
void SetAutoColor (bool _bAutomatic)
 
void EnableNotANumber (bool _bEnable)
 enables handling of not-a-number value. More...
 
void UseInputStringForFormatting ()
 When being set to true, the strings in the field are formatted using the InputLine format. More...
 
bool IsUsingInputStringForFormatting () const
 
void Modify (bool makeValueDirty=true)
 
void EntryLostFocus ()
 
void ReFormat ()
 
virtual void FormatChanged (FORMAT_CHANGE_TYPE nWhat)
 

Protected Types

enum  valueState {
  valueDirty ,
  valueString ,
  valueDouble
}
 

Protected Member Functions

virtual bool CheckText (const OUString &) const
 
void ImplSetTextImpl (const OUString &rNew, Selection const *pNewSel)
 
void ImplSetValue (double dValue, bool bForce)
 
bool ImplGetValue (double &dNewVal)
 
void ImplSetFormatKey (sal_uLong nFormatKey)
 
SvNumberFormatterCreateFormatter ()
 
virtual void UpdateCurrentValue (double dCurrentValue)
 

Protected Attributes

OUString m_sLastValidText
 
Selection m_aLastSelection
 
double m_dMinValue
 
double m_dMaxValue
 
bool m_bHasMin: 1
 
bool m_bHasMax: 1
 
bool m_bWrapOnLimits: 1
 
bool m_bStrictFormat: 1
 
bool m_bEnableEmptyField: 1
 
bool m_bAutoColor: 1
 
bool m_bEnableNaN: 1
 
bool m_bDisableRemainderFactor: 1
 
bool m_bDefaultValueSet: 1
 
valueState m_ValueState
 
double m_dCurrentValue
 
double m_dDefaultValue
 
sal_uLong m_nFormatKey
 
SvNumberFormatterm_pFormatter
 
StaticFormatter m_aStaticFormatter
 
double m_dSpinSize
 
double m_dSpinFirst
 
double m_dSpinLast
 
bool m_bTreatAsNumber
 
OUString m_sCurrentTextValue
 
OUString m_sDefaultText
 
const Colorm_pLastOutputColor
 
bool m_bUseInputStringForFormatting
 
Link< sal_Int64 *, TriStatem_aInputHdl
 
Link< LinkParamNone *, bool > m_aOutputHdl
 

Detailed Description

Definition at line 86 of file formatter.hxx.

Member Enumeration Documentation

◆ valueState

enum Formatter::valueState
protected
Enumerator
valueDirty 
valueString 
valueDouble 

Definition at line 121 of file formatter.hxx.

Constructor & Destructor Documentation

◆ Formatter()

Formatter::Formatter ( )

Definition at line 257 of file fmtfield.cxx.

◆ ~Formatter()

Formatter::~Formatter ( )
virtual

Definition at line 284 of file fmtfield.cxx.

Member Function Documentation

◆ CheckText()

virtual bool Formatter::CheckText ( const OUString &  ) const
inlineprotectedvirtual

Reimplemented in weld::DoubleNumericFormatter.

Definition at line 303 of file formatter.hxx.

Referenced by ImplSetValue(), and Modify().

◆ ClearMaxValue()

virtual void Formatter::ClearMaxValue ( )
inlinevirtual

Reimplemented in weld::EntryFormatter.

Definition at line 169 of file formatter.hxx.

Referenced by weld::EntryFormatter::ClearMaxValue().

◆ ClearMinValue()

virtual void Formatter::ClearMinValue ( )
inlinevirtual

Reimplemented in weld::EntryFormatter.

Definition at line 164 of file formatter.hxx.

Referenced by weld::EntryFormatter::ClearMinValue().

◆ Commit()

void Formatter::Commit ( )

reformats the current text.

Interesting if the user entered some text in an "input format", and this should be formatted in the "output format" (which may differ, e.g. by additional numeric digits or such).

Definition at line 669 of file fmtfield.cxx.

References GetEntryText(), Modify(), and ReFormat().

Referenced by EntryLostFocus().

◆ CreateFormatter()

SvNumberFormatter * Formatter::CreateFormatter ( )
inlineprotected

Definition at line 312 of file formatter.hxx.

◆ DisableRemainderFactor()

void Formatter::DisableRemainderFactor ( )

Definition at line 875 of file fmtfield.cxx.

References m_bDisableRemainderFactor.

Referenced by weld::TimeFormatter::Init().

◆ EnableEmptyField()

void Formatter::EnableEmptyField ( bool  bEnable)

Definition at line 730 of file fmtfield.cxx.

References GetEntryText(), ImplSetValue(), m_bEnableEmptyField, and m_dCurrentValue.

◆ EnableNotANumber()

void Formatter::EnableNotANumber ( bool  _bEnable)

enables handling of not-a-number value.

When this is set to <FALSE> (the default), then invalid inputs (i.e. text which cannot be interpreted, according to the current formatting) will be handled as if the default value has been entered. GetValue the will return this default value.

When set to <TRUE>, then GetValue will return NaN (not a number, see <method scope="rtl::math">isNan</method>) when the current input is invalid.

Note that setting this to <TRUE> implies that upon leaving the control, the input will not be corrected to a valid value. For example, if the user enters "foo" in the control, and then tabs out of it, the text "foo" will persist, and GetValue will return NaN in subsequent calls.

Definition at line 363 of file fmtfield.cxx.

References m_bEnableNaN.

◆ EntryLostFocus()

void Formatter::EntryLostFocus ( )

◆ FieldModified()

virtual void Formatter::FieldModified ( )
pure virtual

Implemented in weld::EntryFormatter.

Referenced by Modify().

◆ FormatChanged()

void Formatter::FormatChanged ( FORMAT_CHANGE_TYPE  nWhat)
virtual

◆ GetDecimalDigits()

sal_uInt16 Formatter::GetDecimalDigits ( ) const

◆ GetDefaultText()

const OUString & Formatter::GetDefaultText ( ) const
inline

Definition at line 250 of file formatter.hxx.

◆ GetDefaultValue()

double Formatter::GetDefaultValue ( ) const
inline

Definition at line 187 of file formatter.hxx.

◆ GetDisableRemainderFactor()

bool Formatter::GetDisableRemainderFactor ( ) const
inline

Definition at line 207 of file formatter.hxx.

Referenced by FormattedField::Down(), and FormattedField::Up().

◆ GetEntrySelection()

virtual Selection Formatter::GetEntrySelection ( ) const
pure virtual

Implemented in weld::EntryFormatter.

Referenced by ImplSetTextImpl(), Modify(), and SetTextFormatted().

◆ GetEntrySelectionOptions()

virtual SelectionOptions Formatter::GetEntrySelectionOptions ( ) const
pure virtual

Implemented in weld::EntryFormatter.

Referenced by SetTextFormatted().

◆ GetEntryText()

virtual OUString Formatter::GetEntryText ( ) const
pure virtual

◆ GetFormat()

OUString Formatter::GetFormat ( LanguageType eLang) const

◆ GetFormatKey()

sal_uLong Formatter::GetFormatKey ( ) const
inline

Definition at line 192 of file formatter.hxx.

Referenced by FormattedField::EventNotify().

◆ GetFormatter()

SvNumberFormatter * Formatter::GetFormatter ( ) const
inline

Definition at line 197 of file formatter.hxx.

◆ GetLastOutputColor()

const Color * Formatter::GetLastOutputColor ( ) const
inline

Definition at line 254 of file formatter.hxx.

◆ GetMaxValue()

double Formatter::GetMaxValue ( ) const
inline

◆ GetMinValue()

double Formatter::GetMinValue ( ) const
inline

◆ GetOrCreateFormatter()

SvNumberFormatter * Formatter::GetOrCreateFormatter ( ) const
inline

◆ GetSpinFirst()

double Formatter::GetSpinFirst ( ) const
inline

Definition at line 231 of file formatter.hxx.

◆ GetSpinLast()

double Formatter::GetSpinLast ( ) const
inline

Definition at line 234 of file formatter.hxx.

◆ GetSpinSize()

double Formatter::GetSpinSize ( ) const
inline

◆ GetTextValue()

OUString const & Formatter::GetTextValue ( ) const

Definition at line 353 of file fmtfield.cxx.

References GetEntryText(), m_sCurrentTextValue, m_ValueState, and valueString.

Referenced by EntryLostFocus(), and ReFormat().

◆ GetThousandsSep()

bool Formatter::GetThousandsSep ( ) const

◆ GetValue()

double Formatter::GetValue ( )

◆ HasMaxValue()

bool Formatter::HasMaxValue ( ) const
inline

Definition at line 168 of file formatter.hxx.

Referenced by FormattedField::Last().

◆ HasMinValue()

bool Formatter::HasMinValue ( ) const
inline

Definition at line 163 of file formatter.hxx.

Referenced by FormattedField::First().

◆ ImplGetValue()

bool Formatter::ImplGetValue ( double &  dNewVal)
protected

◆ ImplSetFormatKey()

void Formatter::ImplSetFormatKey ( sal_uLong  nFormatKey)
protected

◆ ImplSetTextImpl()

void Formatter::ImplSetTextImpl ( const OUString &  rNew,
Selection const *  pNewSel 
)
protected

◆ ImplSetValue()

void Formatter::ImplSetValue ( double  dValue,
bool  bForce 
)
protected

◆ IsEmptyFieldEnabled()

bool Formatter::IsEmptyFieldEnabled ( ) const
inline

Definition at line 181 of file formatter.hxx.

Referenced by EntryLostFocus(), and ReFormat().

◆ IsStrictFormat()

bool Formatter::IsStrictFormat ( ) const
inline

Definition at line 223 of file formatter.hxx.

Referenced by Modify().

◆ IsUsingInputStringForFormatting()

bool Formatter::IsUsingInputStringForFormatting ( ) const
inline

Definition at line 289 of file formatter.hxx.

Referenced by ImplSetValue(), and SetTextFormatted().

◆ Modify()

void Formatter::Modify ( bool  makeValueDirty = true)

◆ ReFormat()

void Formatter::ReFormat ( )

◆ SetAutoColor()

void Formatter::SetAutoColor ( bool  _bAutomatic)

Definition at line 371 of file fmtfield.cxx.

References m_bAutoColor, m_pLastOutputColor, and SetEntryTextColor().

◆ SetDecimalDigits()

void Formatter::SetDecimalDigits ( sal_uInt16  _nPrecision)

◆ SetDefaultText()

void Formatter::SetDefaultText ( const OUString &  rDefault)
inline

Definition at line 249 of file formatter.hxx.

◆ SetDefaultValue()

void Formatter::SetDefaultValue ( double  dDefault)
inline

Definition at line 185 of file formatter.hxx.

◆ SetEntryText()

virtual void Formatter::SetEntryText ( const OUString &  rText,
const Selection rSel 
)
pure virtual

◆ SetEntryTextColor()

virtual void Formatter::SetEntryTextColor ( const Color pColor)
pure virtual

Implemented in weld::EntryFormatter.

Referenced by ImplSetTextImpl(), and SetAutoColor().

◆ SetFieldText()

void Formatter::SetFieldText ( const OUString &  rText,
const Selection rNewSelection 
)

Definition at line 288 of file fmtfield.cxx.

References m_ValueState, SetEntryText(), and valueDirty.

Referenced by FormattedField::SetText(), and SetTextValue().

◆ SetFormat()

bool Formatter::SetFormat ( const OUString &  rFormatString,
LanguageType  eLang 
)

◆ SetFormatKey()

void Formatter::SetFormatKey ( sal_uLong  nFormatKey)

Definition at line 470 of file fmtfield.cxx.

References FormatChanged(), FORMATTER, ImplSetFormatKey(), KEYONLY, and m_pFormatter.

Referenced by SetFormat().

◆ SetFormatter()

void Formatter::SetFormatter ( SvNumberFormatter pFormatter,
bool  bResetFormat = true 
)

◆ SetInputHdl()

void Formatter::SetInputHdl ( const Link< sal_Int64 *, TriState > &  rLink)
inline

◆ SetLastSelection()

void Formatter::SetLastSelection ( const Selection rSelection)
inline

Definition at line 189 of file formatter.hxx.

Referenced by FormattedField::PreNotify().

◆ SetMaxValue()

void Formatter::SetMaxValue ( double  dMax)
virtual

◆ SetMinValue()

void Formatter::SetMinValue ( double  dMin)
virtual

◆ SetOutputHdl()

void Formatter::SetOutputHdl ( const Link< LinkParamNone *, bool > &  rLink)
inline

◆ SetSpinFirst()

void Formatter::SetSpinFirst ( double  dFirst)
inline

Definition at line 230 of file formatter.hxx.

◆ SetSpinLast()

void Formatter::SetSpinLast ( double  dLast)
inline

Definition at line 233 of file formatter.hxx.

◆ SetSpinSize()

virtual void Formatter::SetSpinSize ( double  dStep)
inlinevirtual

◆ SetStrictFormat()

void Formatter::SetStrictFormat ( bool  bEnable)
inline

Definition at line 224 of file formatter.hxx.

◆ SetTextFormatted()

void Formatter::SetTextFormatted ( const OUString &  rText)

◆ SetTextValue()

void Formatter::SetTextValue ( const OUString &  rText)

Definition at line 724 of file fmtfield.cxx.

References ReFormat(), and SetFieldText().

◆ SetThousandsSep()

void Formatter::SetThousandsSep ( bool  _bUseSeparator)

◆ SetValue()

void Formatter::SetValue ( double  dVal)

◆ SetWrapOnLimits()

void Formatter::SetWrapOnLimits ( bool  bWrapOnLimits)
inline

Definition at line 209 of file formatter.hxx.

Referenced by FormattedField::set_property().

◆ StandardFormatter()

SvNumberFormatter * Formatter::StandardFormatter ( )
inline

Definition at line 215 of file formatter.hxx.

◆ TreatAsNumber()

void Formatter::TreatAsNumber ( bool  bDoSo)
inline

Definition at line 237 of file formatter.hxx.

◆ TreatingAsNumber()

bool Formatter::TreatingAsNumber ( ) const
inline

Definition at line 236 of file formatter.hxx.

Referenced by EntryLostFocus(), and ReFormat().

◆ UpdateCurrentValue()

virtual void Formatter::UpdateCurrentValue ( double  dCurrentValue)
inlineprotectedvirtual

Reimplemented in weld::EntryFormatter.

Definition at line 314 of file formatter.hxx.

Referenced by GetValue(), ImplSetValue(), and weld::EntryFormatter::UpdateCurrentValue().

◆ UseInputStringForFormatting()

void Formatter::UseInputStringForFormatting ( )

When being set to true, the strings in the field are formatted using the InputLine format.

That's also what you get in Calc when you edit a cell using F2

Definition at line 880 of file fmtfield.cxx.

References m_bUseInputStringForFormatting.

Member Data Documentation

◆ m_aInputHdl

Link<sal_Int64*, TriState> Formatter::m_aInputHdl
protected

Definition at line 146 of file formatter.hxx.

Referenced by ImplGetValue().

◆ m_aLastSelection

Selection Formatter::m_aLastSelection
protected

Definition at line 106 of file formatter.hxx.

Referenced by Modify().

◆ m_aOutputHdl

Link<LinkParamNone*, bool> Formatter::m_aOutputHdl
protected

Definition at line 147 of file formatter.hxx.

Referenced by ImplSetValue().

◆ m_aStaticFormatter

StaticFormatter Formatter::m_aStaticFormatter
protected

Definition at line 128 of file formatter.hxx.

Referenced by weld::DateFormatter::FormatNumber().

◆ m_bAutoColor

bool Formatter::m_bAutoColor
protected

Definition at line 117 of file formatter.hxx.

Referenced by ImplSetTextImpl(), and SetAutoColor().

◆ m_bDefaultValueSet

bool Formatter::m_bDefaultValueSet
protected

Definition at line 120 of file formatter.hxx.

Referenced by ImplGetValue().

◆ m_bDisableRemainderFactor

bool Formatter::m_bDisableRemainderFactor
protected

Definition at line 119 of file formatter.hxx.

Referenced by DisableRemainderFactor().

◆ m_bEnableEmptyField

bool Formatter::m_bEnableEmptyField
protected

Definition at line 116 of file formatter.hxx.

Referenced by EnableEmptyField().

◆ m_bEnableNaN

bool Formatter::m_bEnableNaN
protected

Definition at line 118 of file formatter.hxx.

Referenced by EnableNotANumber(), GetValue(), and ReFormat().

◆ m_bHasMax

bool Formatter::m_bHasMax
protected

Definition at line 111 of file formatter.hxx.

Referenced by ImplGetValue(), ImplSetValue(), and SetMaxValue().

◆ m_bHasMin

bool Formatter::m_bHasMin
protected

Definition at line 110 of file formatter.hxx.

Referenced by ImplGetValue(), ImplSetValue(), and SetMinValue().

◆ m_bStrictFormat

bool Formatter::m_bStrictFormat
protected

Definition at line 114 of file formatter.hxx.

◆ m_bTreatAsNumber

bool Formatter::m_bTreatAsNumber
protected

Definition at line 136 of file formatter.hxx.

Referenced by ImplGetValue(), SetMaxValue(), and SetMinValue().

◆ m_bUseInputStringForFormatting

bool Formatter::m_bUseInputStringForFormatting
protected

Definition at line 144 of file formatter.hxx.

Referenced by UseInputStringForFormatting().

◆ m_bWrapOnLimits

bool Formatter::m_bWrapOnLimits
protected

Definition at line 113 of file formatter.hxx.

Referenced by ImplSetValue().

◆ m_dCurrentValue

double Formatter::m_dCurrentValue
protected

Definition at line 123 of file formatter.hxx.

Referenced by EnableEmptyField(), EntryLostFocus(), GetValue(), and ImplGetValue().

◆ m_dDefaultValue

double Formatter::m_dDefaultValue
protected

Definition at line 124 of file formatter.hxx.

Referenced by GetValue(), and ImplGetValue().

◆ m_dMaxValue

double Formatter::m_dMaxValue
protected

Definition at line 109 of file formatter.hxx.

Referenced by ImplGetValue(), ImplSetValue(), and SetMaxValue().

◆ m_dMinValue

double Formatter::m_dMinValue
protected

Definition at line 108 of file formatter.hxx.

Referenced by ImplGetValue(), ImplSetValue(), and SetMinValue().

◆ m_dSpinFirst

double Formatter::m_dSpinFirst
protected

Definition at line 131 of file formatter.hxx.

◆ m_dSpinLast

double Formatter::m_dSpinLast
protected

Definition at line 132 of file formatter.hxx.

◆ m_dSpinSize

double Formatter::m_dSpinSize
protected

Definition at line 130 of file formatter.hxx.

◆ m_nFormatKey

sal_uLong Formatter::m_nFormatKey
protected

◆ m_pFormatter

SvNumberFormatter* Formatter::m_pFormatter
protected

◆ m_pLastOutputColor

const Color* Formatter::m_pLastOutputColor
protected

◆ m_sCurrentTextValue

OUString Formatter::m_sCurrentTextValue
protected

Definition at line 138 of file formatter.hxx.

Referenced by GetTextValue(), and SetTextFormatted().

◆ m_sDefaultText

OUString Formatter::m_sDefaultText
protected

Definition at line 139 of file formatter.hxx.

Referenced by EntryLostFocus().

◆ m_sLastValidText

OUString Formatter::m_sLastValidText
protected

Definition at line 103 of file formatter.hxx.

Referenced by Modify().

◆ m_ValueState

valueState Formatter::m_ValueState
protected

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