diff options
author | Eike Rathke <erack@redhat.com> | 2017-10-04 23:50:31 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-10-05 09:26:30 +0200 |
commit | 5be8c9cc1b92101e6f9fe5685df86e77d3eee3cc (patch) | |
tree | 3ab94d8dde0cf5df515c46c4866c254b32a0c410 /xmloff | |
parent | 4fd81a26681063dcc0d8d2eae795d39c8d894cb8 (diff) |
Resolves: tdf#102075 support system [$-F400] time and [$-F800] long date
By substituting a (valid matching the type) format using these
special LCID modifier values with the current system locale's
format.
See ECMA-376-1:2016 18.8.31 numFmts (Number Formats) and
https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.numberingformats.aspx
which seems to be the only documentation available.
Change-Id: Ieca048a77d4ef473ae475e202557d1353ff5387d
Reviewed-on: https://gerrit.libreoffice.org/43148
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/xmlnumfe.cxx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index a1ee8d905804..c2f1920e8bda 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -1040,14 +1040,14 @@ static bool lcl_IsDefaultDateFormat( const SvNumberformat& rFormat, bool bSystem // export one part (condition) -void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, +void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey, sal_uInt16 nPart, bool bDefPart ) { //! for the default part, pass the conditions from the other parts! // element name - NfIndexTableOffset eBuiltIn = pFormatter->GetIndexTableOffset( nKey ); + NfIndexTableOffset eBuiltIn = pFormatter->GetIndexTableOffset( nRealKey ); short nFmtType = 0; bool bThousand = false; @@ -1768,7 +1768,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt // export one format -void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey ) +void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey ) { const sal_uInt16 XMLNUM_MAX_PARTS = 4; bool bParts[XMLNUM_MAX_PARTS] = { false, false, false, false }; @@ -1812,7 +1812,7 @@ void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uI if (bParts[nPart]) { bool bDefault = ( nPart+1 == nUsedParts ); // last = default - ExportPart_Impl( rFormat, nKey, nPart, bDefault ); + ExportPart_Impl( rFormat, nKey, nRealKey, nPart, bDefault ); } } } @@ -1829,9 +1829,12 @@ void SvXMLNumFmtExport::Export( bool bIsAutoStyle ) bool bNext(pUsedList->GetFirstUsed(nKey)); while(bNext) { - pFormat = pFormatter->GetEntry(nKey); + // ODF has its notation of system formats, so obtain the "real" already + // substituted format but use the original key for style name. + sal_uInt32 nRealKey = nKey; + pFormat = pFormatter->GetSubstitutedEntry( nKey, nRealKey); if(pFormat) - ExportFormat_Impl( *pFormat, nKey ); + ExportFormat_Impl( *pFormat, nKey, nRealKey ); bNext = pUsedList->GetNextUsed(nKey); } if (!bIsAutoStyle) @@ -1853,8 +1856,14 @@ void SvXMLNumFmtExport::Export( bool bIsAutoStyle ) if (!pUsedList->IsUsed(nKey)) { DBG_ASSERT((pFormat->GetType() & css::util::NumberFormat::DEFINED), "a not user defined numberformat found"); + sal_uInt32 nRealKey = nKey; + if (pFormat->IsSubstituted()) + { + pFormat = pFormatter->GetSubstitutedEntry( nKey, nRealKey); // export the "real" format + assert(pFormat); + } // user-defined and used formats are exported - ExportFormat_Impl( *pFormat, nKey ); + ExportFormat_Impl( *pFormat, nKey, nRealKey ); // if it is a user-defined Format it will be added else nothing will happen pUsedList->SetUsed(nKey); } |