diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-06 15:21:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-10 14:37:06 +0200 |
commit | 476ed0aed1c09055fa05209485919a026e5f014e (patch) | |
tree | 68c2cc8ca587dd7b47f97d800d32560339f546fc /include/vcl/field.hxx | |
parent | 7cee480efe22d48af9e9d96b49ad4358a4010690 (diff) |
weld SdStartPresentationDlg
to get duration spinbutton working need to know where the cursor
is in the spinbutton and to change the adjustment factor depending
on that, and need to additionally disable the vcl round to nearest base unit on
up/down
Change-Id: I6dd09e1639454cb4820d3aeb0c0c698fcebd417e
Reviewed-on: https://gerrit.libreoffice.org/54065
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/vcl/field.hxx')
-rw-r--r-- | include/vcl/field.hxx | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index 3af20ff93558..8f4bf5b07219 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -40,7 +40,6 @@ class VCL_DLLPUBLIC FormatterBase { private: VclPtr<Edit> mpField; - Link<Edit&, bool> maOutputHdl; std::unique_ptr<LocaleDataWrapper> mpLocaleDataWrapper; bool mbReformat; @@ -85,8 +84,6 @@ public: void EnableEmptyFieldValue( bool bEnable ) { mbEmptyFieldValueEnabled = bEnable; } bool IsEmptyFieldValueEnabled() const { return mbEmptyFieldValueEnabled; } - - void SetOutputHdl(const Link<Edit&, bool>& rLink) { maOutputHdl = rLink; } }; #define PATTERN_FORMAT_EMPTYLITERALS (sal_uInt16(0x0001)) @@ -152,6 +149,7 @@ public: void SetShowTrailingZeros( bool bShowTrailingZeros ); bool IsShowTrailingZeros() const { return mbShowTrailingZeros; } + void DisableRemainderFactor(); void SetUserValue( sal_Int64 nNewValue ); virtual void SetValue( sal_Int64 nNewValue ); @@ -163,12 +161,16 @@ public: sal_Int64 Normalize( sal_Int64 nValue ) const; sal_Int64 Denormalize( sal_Int64 nValue ) const; + void SetInputHdl(const Link<sal_Int64*,TriState>& rLink) { m_aInputHdl = rLink; } + void SetOutputHdl(const Link<Edit&, bool>& rLink) { m_aOutputHdl = rLink; } protected: sal_Int64 mnFieldValue; sal_Int64 mnLastValue; sal_Int64 mnMin; sal_Int64 mnMax; bool mbWrapOnLimits; + bool mbFormatting; + bool mbDisableRemainderFactor; // the members below are used in all derivatives of NumericFormatter // not in NumericFormatter itself. @@ -182,8 +184,9 @@ protected: void FieldDown(); void FieldFirst(); void FieldLast(); + void FormatValue(Selection const * pNewSelection = nullptr); - SAL_DLLPRIVATE void ImplNumericReformat( sal_Int64& rValue, OUString& rOutStr ); + SAL_DLLPRIVATE void ImplNumericReformat(); SAL_DLLPRIVATE void ImplNewFieldValue( sal_Int64 nNewValue ); SAL_DLLPRIVATE void ImplSetUserValue( sal_Int64 nNewValue, Selection const * pNewSelection = nullptr ); @@ -192,6 +195,8 @@ protected: private: SAL_DLLPRIVATE void ImplInit(); + Link<sal_Int64*, TriState> m_aInputHdl; + Link<Edit&, bool> m_aOutputHdl; sal_uInt16 mnDecimalDigits; bool mbThousandSep; bool mbShowTrailingZeros; @@ -358,12 +363,6 @@ public: class VCL_DLLPUBLIC TimeFormatter : public FormatterBase { -public: - enum class TimeFormat { - Hour12, - Hour24 - }; - private: tools::Time maLastTime; tools::Time maMin; @@ -386,6 +385,13 @@ protected: SAL_DLLPRIVATE bool ImplAllowMalformedInput() const; public: + 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); virtual ~TimeFormatter() override; |