summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-04-10 00:16:15 +0200
committerEike Rathke <erack@redhat.com>2021-04-10 03:49:37 +0200
commit5d1042cbd25b22babaf8b30bc4edff6f70750b5e (patch)
tree1933c2e555902e67e707abeae0cad37fd4132150 /xmloff
parent807d059d99e7b99fe45a712428befa17ffa44858 (diff)
ODF load: use AAA/AAAA instead of NN/NNN(N) for implicit secondary calendar
For example ja-JP Gengou calendar. NN/NNN always worked because ja-JP Gregorian calendar defines the same day of week names so it never was apparent. Change-Id: Ief0d7ce7532b7ed7d58910bf150b190b7872db28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113900 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/xmlnumfi.cxx23
1 files changed, 19 insertions, 4 deletions
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 28dbe6574336..3928b6788af1 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -955,11 +955,26 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
// HasEra flag is set
break;
case SvXMLStyleTokens::DayOfWeek:
- rParent.UpdateCalendar( sCalendar );
//! I18N doesn't provide SYSTEM or extended date information yet
- rParent.AddNfKeyword(
- sal::static_int_cast< sal_uInt16 >(
- bEffLong ? NF_KEY_NNNN : NF_KEY_NN ) );
+ {
+ // Implicit secondary calendar uses A keyword, default and
+ // explicit calendar N keyword.
+ rParent.UpdateCalendar( sCalendar);
+ const SvXMLNumFormatContext::ImplicitCalendar eCal = rParent.GetImplicitCalendarState();
+ if (eCal == SvXMLNumFormatContext::ImplicitCalendar::SECONDARY
+ || eCal == SvXMLNumFormatContext::ImplicitCalendar::SECONDARY_FROM_OTHER)
+ {
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_AAAA : NF_KEY_AAA ) );
+ }
+ else
+ {
+ rParent.AddNfKeyword(
+ sal::static_int_cast< sal_uInt16 >(
+ bEffLong ? NF_KEY_NNNN : NF_KEY_NN ) );
+ }
+ }
break;
case SvXMLStyleTokens::WeekOfYear:
rParent.UpdateCalendar( sCalendar );