xmloff/source/style/xmlnumfi.cxx |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 5d1042cbd25b22babaf8b30bc4edff6f70750b5e
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Sat Apr 10 00:16:15 2021 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Sat Apr 10 03:49:37 2021 +0200

    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 <er...@redhat.com>
    Tested-by: Jenkins

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 );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to