diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-07-21 23:16:19 +0200 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2018-12-21 20:05:23 +0100 |
commit | c503ba502a9b7ddc6ac41044fb04dc2e1f276891 (patch) | |
tree | 1ae431713ed404d70e553fd865fd8cd530252d64 | |
parent | 698dd87b8ae35a2a081d5fff49438bd9a3ea00ad (diff) |
tdf#98074, using the same builtinId maps the styles to the same one
Additionally, using customBuiltin for all styles is a bad idea as well.
Change-Id: I788a3c5b9164f79aa65ded2fc3e6a556e44ee0a8
Reviewed-on: https://gerrit.libreoffice.org/57807
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
(cherry picked from commit fa881095bc62c3646406c82a98d8503377288a54)
Reviewed-on: https://gerrit.libreoffice.org/57813
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit f67c6912e8612c5850a5728c2222971b4ec130b9)
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xestyle.cxx | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 4e50010fb8b9..7ecaba7a6d68 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3938,7 +3938,7 @@ void ScExportTest::testNatNumInNumberFormatXLSX() xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[DBNum2][$-804]General;[RED][DBNum2][$-804]General"); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", "[DBNum2][$-804]General;[RED][DBNum2][$-804]General"); xDocSh->DoClose(); } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 25cda7d56db7..8d882ed5a061 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -2333,13 +2333,19 @@ static const char* lcl_StyleNameFromId( sal_Int32 nStyleId ) void XclExpStyle::SaveXml( XclExpXmlStream& rStrm ) { + constexpr sal_Int32 CELL_STYLE_MAX_BUILTIN_ID = 54; OString sName; + OString sBuiltinId; + const char* pBuiltinId = nullptr; if( IsBuiltIn() ) { sName = OString( lcl_StyleNameFromId( mnStyleId ) ); + sBuiltinId = OString::number( std::min( static_cast<sal_Int32>( CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast <sal_Int32>( mnStyleId ) ) ); + pBuiltinId = sBuiltinId.getStr(); } else sName = XclXmlUtils::ToOString( maName ); + // get the index in sortedlist associated with the mnXId sal_Int32 nXFId = rStrm.GetRoot().GetXFBuffer().GetXFIndex( maXFId.mnXFId ); // get the style index associated with index into sortedlist @@ -2348,11 +2354,10 @@ void XclExpStyle::SaveXml( XclExpXmlStream& rStrm ) XML_name, sName.getStr(), XML_xfId, OString::number( nXFId ).getStr(), // builtinId of 54 or above is invalid according to OpenXML SDK validator. -#define CELL_STYLE_MAX_BUILTIN_ID 54 - XML_builtinId, OString::number( std::min( static_cast<sal_Int32>( CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast <sal_Int32>( mnStyleId ) ) ).getStr(), + XML_builtinId, pBuiltinId, // OOXTODO: XML_iLevel, // OOXTODO: XML_hidden, - XML_customBuiltin, ToPsz( ! IsBuiltIn() ), + // XML_customBuiltin, ToPsz( ! IsBuiltIn() ), FSEND ); // OOXTODO: XML_extLst } |