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
 
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 120 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 283 of file fmtfield.cxx.

Member Function Documentation

◆ CheckText()

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

Reimplemented in weld::DoubleNumericFormatter.

Definition at line 302 of file formatter.hxx.

Referenced by ImplSetValue(), and Modify().

◆ ClearMaxValue()

virtual void Formatter::ClearMaxValue ( )
inlinevirtual

Reimplemented in weld::EntryFormatter.

Definition at line 168 of file formatter.hxx.

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

◆ ClearMinValue()

virtual void Formatter::ClearMinValue ( )
inlinevirtual

Reimplemented in weld::EntryFormatter.

Definition at line 163 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 668 of file fmtfield.cxx.

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

Referenced by EntryLostFocus().

◆ CreateFormatter()

SvNumberFormatter * Formatter::CreateFormatter ( )
inlineprotected

Definition at line 311 of file formatter.hxx.

◆ DisableRemainderFactor()

void Formatter::DisableRemainderFactor ( )

Definition at line 870 of file fmtfield.cxx.

References m_bDisableRemainderFactor.

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

◆ EnableEmptyField()

void Formatter::EnableEmptyField ( bool  bEnable)

Definition at line 729 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 362 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 249 of file formatter.hxx.

◆ GetDefaultValue()

double Formatter::GetDefaultValue ( ) const
inline

Definition at line 186 of file formatter.hxx.

◆ GetDisableRemainderFactor()

bool Formatter::GetDisableRemainderFactor ( ) const
inline

Definition at line 206 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 191 of file formatter.hxx.

Referenced by FormattedField::EventNotify().

◆ GetFormatter()

SvNumberFormatter * Formatter::GetFormatter ( ) const
inline

Definition at line 196 of file formatter.hxx.

◆ GetLastOutputColor()

const Color * Formatter::GetLastOutputColor ( ) const
inline

Definition at line 253 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 230 of file formatter.hxx.

◆ GetSpinLast()

double Formatter::GetSpinLast ( ) const
inline

Definition at line 233 of file formatter.hxx.

◆ GetSpinSize()

double Formatter::GetSpinSize ( ) const
inline

◆ GetTextValue()

OUString const & Formatter::GetTextValue ( ) const

Definition at line 352 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 167 of file formatter.hxx.

Referenced by FormattedField::Last().

◆ HasMinValue()

bool Formatter::HasMinValue ( ) const
inline

Definition at line 162 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 180 of file formatter.hxx.

Referenced by EntryLostFocus(), and ReFormat().

◆ IsStrictFormat()

bool Formatter::IsStrictFormat ( ) const
inline

Definition at line 222 of file formatter.hxx.

Referenced by Modify().

◆ IsUsingInputStringForFormatting()

bool Formatter::IsUsingInputStringForFormatting ( ) const
inline

Definition at line 288 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 370 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 248 of file formatter.hxx.

◆ SetDefaultValue()

void Formatter::SetDefaultValue ( double  dDefault)
inline

Definition at line 184 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 287 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 469 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 188 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 229 of file formatter.hxx.

◆ SetSpinLast()

void Formatter::SetSpinLast ( double  dLast)
inline

Definition at line 232 of file formatter.hxx.

◆ SetSpinSize()

virtual void Formatter::SetSpinSize ( double  dStep)
inlinevirtual

◆ SetStrictFormat()

void Formatter::SetStrictFormat ( bool  bEnable)
inline

Definition at line 223 of file formatter.hxx.

◆ SetTextFormatted()

void Formatter::SetTextFormatted ( const OUString &  rText)

◆ SetTextValue()

void Formatter::SetTextValue ( const OUString &  rText)

Definition at line 723 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 208 of file formatter.hxx.

Referenced by FormattedField::set_property().

◆ StandardFormatter()

SvNumberFormatter * Formatter::StandardFormatter ( )
inline

Definition at line 214 of file formatter.hxx.

◆ TreatAsNumber()

void Formatter::TreatAsNumber ( bool  bDoSo)
inline

Definition at line 236 of file formatter.hxx.

◆ TreatingAsNumber()

bool Formatter::TreatingAsNumber ( ) const
inline

Definition at line 235 of file formatter.hxx.

Referenced by EntryLostFocus(), and ReFormat().

◆ UpdateCurrentValue()

virtual void Formatter::UpdateCurrentValue ( double  dCurrentValue)
inlineprotectedvirtual

Reimplemented in weld::EntryFormatter.

Definition at line 313 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 875 of file fmtfield.cxx.

References m_bUseInputStringForFormatting.

Member Data Documentation

◆ m_aInputHdl

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

Definition at line 145 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 146 of file formatter.hxx.

Referenced by ImplSetValue().

◆ m_aStaticFormatter

StaticFormatter Formatter::m_aStaticFormatter
protected

Definition at line 127 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_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 135 of file formatter.hxx.

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

◆ m_bUseInputStringForFormatting

bool Formatter::m_bUseInputStringForFormatting
protected

Definition at line 143 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 122 of file formatter.hxx.

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

◆ m_dDefaultValue

double Formatter::m_dDefaultValue
protected

Definition at line 123 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 130 of file formatter.hxx.

◆ m_dSpinLast

double Formatter::m_dSpinLast
protected

Definition at line 131 of file formatter.hxx.

◆ m_dSpinSize

double Formatter::m_dSpinSize
protected

Definition at line 129 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 137 of file formatter.hxx.

Referenced by GetTextValue(), and SetTextFormatted().

◆ m_sDefaultText

OUString Formatter::m_sDefaultText
protected

Definition at line 138 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: