diff options
author | Eike Rathke <erack@redhat.com> | 2021-07-03 11:46:49 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2021-07-05 10:30:01 +0200 |
commit | 96f2a6d16e6a6bf070e6875776b6153a70e75a7a (patch) | |
tree | 15d82e167aadc19f3ea71b58167307eb11fa8969 /include | |
parent | f9fab8cd5a7ebccc6b659dbc831385e3722d97d6 (diff) |
Resolves: tdf#125035 Use number formatter for long date in DateFormatter fields
Change-Id: Ib0cd55d9ad4e3abb4839d70c0086063a3f1a90f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118344
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 2cc8ec691cc37b07e4f134bf379164f375b8a481)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118310
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/formatter.hxx | 4 | ||||
-rw-r--r-- | include/vcl/toolkit/field.hxx | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/vcl/formatter.hxx b/include/vcl/formatter.hxx index e2879dc36076..2049d1e12a6f 100644 --- a/include/vcl/formatter.hxx +++ b/include/vcl/formatter.hxx @@ -85,7 +85,7 @@ enum class FORMAT_CHANGE_TYPE class VCL_DLLPUBLIC Formatter { -private: +public: // A SvNumberFormatter is very expensive (regarding time and space), it is a Singleton class StaticFormatter { @@ -95,7 +95,7 @@ private: StaticFormatter(); ~StaticFormatter(); - operator SvNumberFormatter* () { return GetFormatter(); } + operator SvNumberFormatter* () const { return GetFormatter(); } UNLESS_MERGELIBS(VCL_DLLPUBLIC) static SvNumberFormatter* GetFormatter(); }; diff --git a/include/vcl/toolkit/field.hxx b/include/vcl/toolkit/field.hxx index e30d16e55edc..d6ae05f51fc5 100644 --- a/include/vcl/toolkit/field.hxx +++ b/include/vcl/toolkit/field.hxx @@ -29,6 +29,7 @@ #include <tools/time.hxx> #include <vcl/toolkit/combobox.hxx> #include <vcl/toolkit/spinfld.hxx> +#include <vcl/formatter.hxx> namespace com::sun::star::lang { struct Locale; } @@ -391,6 +392,7 @@ public: class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DateFormatter : public FormatterBase { private: + Formatter::StaticFormatter maStaticFormatter; std::unique_ptr<CalendarWrapper> mxCalendarWrapper; Date maFieldDate; Date maLastDate; @@ -415,7 +417,7 @@ protected: SAL_DLLPRIVATE bool ImplAllowMalformedInput() const; public: - static OUString FormatDate(const Date& rNewDate, ExtDateFieldFormat eFormat, const LocaleDataWrapper& rLocaleData, CalendarWrapper& rCalendarWrapper); + static OUString FormatDate(const Date& rNewDate, ExtDateFieldFormat eFormat, const LocaleDataWrapper& rLocaleData, CalendarWrapper& rCalendarWrapper, const Formatter::StaticFormatter* pStaticFormatter = nullptr); static bool TextToDate(const OUString& rStr, Date& rTime, ExtDateFieldFormat eFormat, const LocaleDataWrapper& rLocaleDataWrapper, const CalendarWrapper& rCalendarWrapper); static int GetDateArea(ExtDateFieldFormat eFormat, const OUString& rText, int nCursor, const LocaleDataWrapper& rLocaleDataWrapper); |