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
 
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
 
Colorm_pLastOutputColor
 
bool m_bUseInputStringForFormatting
 
Link< sal_Int64 *, TriStatem_aInputHdl
 
Link< LinkParamNone *, bool > m_aOutputHdl
 

Detailed Description

Definition at line 84 of file formatter.hxx.

Member Enumeration Documentation

enum Formatter::valueState
protected
Enumerator
valueDirty 
valueString 
valueDouble 

Definition at line 118 of file formatter.hxx.

Constructor & Destructor Documentation

Formatter::Formatter ( )

Definition at line 255 of file fmtfield.cxx.

Formatter::~Formatter ( )
virtual

Definition at line 281 of file fmtfield.cxx.

Member Function Documentation

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

Reimplemented in weld::DoubleNumericFormatter.

Definition at line 300 of file formatter.hxx.

Referenced by ImplSetValue(), and Modify().

virtual void Formatter::ClearMaxValue ( )
inlinevirtual

Reimplemented in weld::EntryFormatter.

Definition at line 166 of file formatter.hxx.

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

virtual void Formatter::ClearMinValue ( )
inlinevirtual

Reimplemented in weld::EntryFormatter.

Definition at line 161 of file formatter.hxx.

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

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

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

Referenced by EntryLostFocus().

SvNumberFormatter* Formatter::CreateFormatter ( )
inlineprotected

Definition at line 309 of file formatter.hxx.

void Formatter::DisableRemainderFactor ( )

Definition at line 875 of file fmtfield.cxx.

References m_bDisableRemainderFactor.

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

void Formatter::EnableEmptyField ( bool  bEnable)

Definition at line 727 of file fmtfield.cxx.

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

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

References m_bEnableNaN.

void Formatter::EntryLostFocus ( )
virtual void Formatter::FieldModified ( )
pure virtual

Implemented in weld::EntryFormatter.

Referenced by Modify().

void Formatter::FormatChanged ( FORMAT_CHANGE_TYPE  nWhat)
virtual
sal_uInt16 Formatter::GetDecimalDigits ( ) const
const OUString& Formatter::GetDefaultText ( ) const
inline

Definition at line 247 of file formatter.hxx.

double Formatter::GetDefaultValue ( ) const
inline

Definition at line 184 of file formatter.hxx.

bool Formatter::GetDisableRemainderFactor ( ) const
inline

Definition at line 204 of file formatter.hxx.

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

virtual Selection Formatter::GetEntrySelection ( ) const
pure virtual

Implemented in weld::EntryFormatter.

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

virtual SelectionOptions Formatter::GetEntrySelectionOptions ( ) const
pure virtual

Implemented in weld::EntryFormatter.

Referenced by SetTextFormatted().

virtual OUString Formatter::GetEntryText ( ) const
pure virtual
OUString Formatter::GetFormat ( LanguageType eLang) const
sal_uLong Formatter::GetFormatKey ( ) const
inline

Definition at line 189 of file formatter.hxx.

Referenced by FormattedField::EventNotify().

SvNumberFormatter* Formatter::GetFormatter ( ) const
inline

Definition at line 194 of file formatter.hxx.

Color* Formatter::GetLastOutputColor ( ) const
inline

Definition at line 251 of file formatter.hxx.

double Formatter::GetMaxValue ( ) const
inline
double Formatter::GetMinValue ( ) const
inline
SvNumberFormatter* Formatter::GetOrCreateFormatter ( ) const
inline
double Formatter::GetSpinFirst ( ) const
inline

Definition at line 228 of file formatter.hxx.

double Formatter::GetSpinLast ( ) const
inline

Definition at line 231 of file formatter.hxx.

double Formatter::GetSpinSize ( ) const
inline
OUString const & Formatter::GetTextValue ( ) const

Definition at line 350 of file fmtfield.cxx.

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

Referenced by EntryLostFocus(), and ReFormat().

bool Formatter::GetThousandsSep ( ) const
double Formatter::GetValue ( )
bool Formatter::HasMaxValue ( ) const
inline

Definition at line 165 of file formatter.hxx.

Referenced by FormattedField::Last().

bool Formatter::HasMinValue ( ) const
inline

Definition at line 160 of file formatter.hxx.

Referenced by FormattedField::First().

bool Formatter::ImplGetValue ( double &  dNewVal)
protected
void Formatter::ImplSetFormatKey ( sal_uLong  nFormatKey)
protected
void Formatter::ImplSetTextImpl ( const OUString &  rNew,
Selection const *  pNewSel 
)
protected
void Formatter::ImplSetValue ( double  dValue,
bool  bForce 
)
protected
bool Formatter::IsEmptyFieldEnabled ( ) const
inline

Definition at line 178 of file formatter.hxx.

Referenced by EntryLostFocus(), and ReFormat().

bool Formatter::IsStrictFormat ( ) const
inline

Definition at line 220 of file formatter.hxx.

Referenced by Modify().

bool Formatter::IsUsingInputStringForFormatting ( ) const
inline

Definition at line 286 of file formatter.hxx.

Referenced by ImplSetValue(), and SetTextFormatted().

void Formatter::Modify ( bool  makeValueDirty = true)
void Formatter::ReFormat ( )
void Formatter::SetAutoColor ( bool  _bAutomatic)

Definition at line 368 of file fmtfield.cxx.

References m_bAutoColor, m_pLastOutputColor, and SetEntryTextColor().

void Formatter::SetDecimalDigits ( sal_uInt16  _nPrecision)
void Formatter::SetDefaultText ( const OUString &  rDefault)
inline

Definition at line 246 of file formatter.hxx.

void Formatter::SetDefaultValue ( double  dDefault)
inline

Definition at line 182 of file formatter.hxx.

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

Implemented in weld::EntryFormatter.

Referenced by ImplSetTextImpl(), and SetAutoColor().

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

Definition at line 285 of file fmtfield.cxx.

References m_ValueState, SetEntryText(), and valueDirty.

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

bool Formatter::SetFormat ( const OUString &  rFormatString,
LanguageType  eLang 
)
void Formatter::SetFormatKey ( sal_uLong  nFormatKey)

Definition at line 467 of file fmtfield.cxx.

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

Referenced by SetFormat().

void Formatter::SetFormatter ( SvNumberFormatter pFormatter,
bool  bResetFormat = true 
)
void Formatter::SetInputHdl ( const Link< sal_Int64 *, TriState > &  rLink)
inline
void Formatter::SetLastSelection ( const Selection rSelection)
inline

Definition at line 186 of file formatter.hxx.

Referenced by FormattedField::PreNotify().

void Formatter::SetMaxValue ( double  dMax)
virtual
void Formatter::SetMinValue ( double  dMin)
virtual
void Formatter::SetOutputHdl ( const Link< LinkParamNone *, bool > &  rLink)
inline
void Formatter::SetSpinFirst ( double  dFirst)
inline

Definition at line 227 of file formatter.hxx.

void Formatter::SetSpinLast ( double  dLast)
inline

Definition at line 230 of file formatter.hxx.

virtual void Formatter::SetSpinSize ( double  dStep)
inlinevirtual
void Formatter::SetStrictFormat ( bool  bEnable)
inline

Definition at line 221 of file formatter.hxx.

void Formatter::SetTextFormatted ( const OUString &  rText)
void Formatter::SetTextValue ( const OUString &  rText)

Definition at line 721 of file fmtfield.cxx.

References ReFormat(), and SetFieldText().

void Formatter::SetThousandsSep ( bool  _bUseSeparator)
void Formatter::SetValue ( double  dVal)
void Formatter::SetWrapOnLimits ( bool  bWrapOnLimits)
inline

Definition at line 206 of file formatter.hxx.

Referenced by FormattedField::set_property().

SvNumberFormatter* Formatter::StandardFormatter ( )
inline

Definition at line 212 of file formatter.hxx.

void Formatter::TreatAsNumber ( bool  bDoSo)
inline

Definition at line 234 of file formatter.hxx.

bool Formatter::TreatingAsNumber ( ) const
inline

Definition at line 233 of file formatter.hxx.

Referenced by EntryLostFocus(), and ReFormat().

virtual void Formatter::UpdateCurrentValue ( double  dCurrentValue)
inlineprotectedvirtual

Reimplemented in weld::EntryFormatter.

Definition at line 311 of file formatter.hxx.

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

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

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

Definition at line 143 of file formatter.hxx.

Referenced by ImplGetValue().

Selection Formatter::m_aLastSelection
protected

Definition at line 104 of file formatter.hxx.

Referenced by Modify().

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

Definition at line 144 of file formatter.hxx.

Referenced by ImplSetValue().

StaticFormatter Formatter::m_aStaticFormatter
protected

Definition at line 125 of file formatter.hxx.

bool Formatter::m_bAutoColor
protected

Definition at line 115 of file formatter.hxx.

Referenced by ImplSetTextImpl(), and SetAutoColor().

bool Formatter::m_bDisableRemainderFactor
protected

Definition at line 117 of file formatter.hxx.

Referenced by DisableRemainderFactor().

bool Formatter::m_bEnableEmptyField
protected

Definition at line 114 of file formatter.hxx.

Referenced by EnableEmptyField().

bool Formatter::m_bEnableNaN
protected

Definition at line 116 of file formatter.hxx.

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

bool Formatter::m_bHasMax
protected

Definition at line 109 of file formatter.hxx.

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

bool Formatter::m_bHasMin
protected

Definition at line 108 of file formatter.hxx.

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

bool Formatter::m_bStrictFormat
protected

Definition at line 112 of file formatter.hxx.

bool Formatter::m_bTreatAsNumber
protected

Definition at line 133 of file formatter.hxx.

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

bool Formatter::m_bUseInputStringForFormatting
protected

Definition at line 141 of file formatter.hxx.

Referenced by UseInputStringForFormatting().

bool Formatter::m_bWrapOnLimits
protected

Definition at line 111 of file formatter.hxx.

Referenced by ImplSetValue().

double Formatter::m_dCurrentValue
protected

Definition at line 120 of file formatter.hxx.

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

double Formatter::m_dDefaultValue
protected

Definition at line 121 of file formatter.hxx.

Referenced by GetValue(), and ImplGetValue().

double Formatter::m_dMaxValue
protected

Definition at line 107 of file formatter.hxx.

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

double Formatter::m_dMinValue
protected

Definition at line 106 of file formatter.hxx.

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

double Formatter::m_dSpinFirst
protected

Definition at line 128 of file formatter.hxx.

double Formatter::m_dSpinLast
protected

Definition at line 129 of file formatter.hxx.

double Formatter::m_dSpinSize
protected

Definition at line 127 of file formatter.hxx.

sal_uLong Formatter::m_nFormatKey
protected
SvNumberFormatter* Formatter::m_pFormatter
protected
Color* Formatter::m_pLastOutputColor
protected
OUString Formatter::m_sCurrentTextValue
protected

Definition at line 135 of file formatter.hxx.

Referenced by GetTextValue(), and SetTextFormatted().

OUString Formatter::m_sDefaultText
protected

Definition at line 136 of file formatter.hxx.

Referenced by EntryLostFocus().

OUString Formatter::m_sLastValidText
protected

Definition at line 101 of file formatter.hxx.

Referenced by Modify().

valueState Formatter::m_ValueState
protected

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