From 97835320bfe7a2fa61f10f102feb961f81057118 Mon Sep 17 00:00:00 2001 From: László Németh Date: Thu, 11 Jun 2020 07:37:49 +0200 Subject: tdf#134035 sw: insert long date format for Hungarian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in Writer using Insert->Field->Date or the similar toolbar function. Note: the previously used short date format YYYY-MM-DD is rare in Hungarian text documents, and it is no longer mentioned in the last Hungarian orthographic standard (But it's still default in Calc, as standardized by (MSZ) ISO 8601.) Change-Id: I09f2f3314356e84c73a42be9f06ceaa6769e7338 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96112 Tested-by: Jenkins Reviewed-by: László Németh --- sw/source/uibase/shells/textfld.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sw/source') diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 929b731e6856..9b7d3b10a4fd 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -60,6 +60,7 @@ #include #include #include +#include using namespace nsSwDocInfoSubType; @@ -605,9 +606,19 @@ void SwTextShell::ExecField(SfxRequest &rReq) break; case FN_INSERT_FLD_DATE : + { nInsertType = SwFieldTypesEnum::Date; bIsText = false; + // use long date format for Hungarian + SwPaM* pCursorPos = rSh.GetCursor(); + if( pCursorPos ) + { + LanguageType nLang = pCursorPos->GetPoint()->nNode.GetNode().GetTextNode()->GetLang(pCursorPos->GetPoint()->nContent.GetIndex()); + if (nLang == LANGUAGE_HUNGARIAN) + nInsertFormat = rSh.GetNumberFormatter()->GetFormatIndex(NF_DATE_SYSTEM_LONG, nLang); + } goto FIELD_INSERT; + } case FN_INSERT_FLD_TIME : nInsertType = SwFieldTypesEnum::Time; bIsText = false; -- cgit