Kaydet (Commit) fa881095 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

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: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst b86ef3b7
...@@ -3926,7 +3926,7 @@ void ScExportTest::testNatNumInNumberFormatXLSX() ...@@ -3926,7 +3926,7 @@ void ScExportTest::testNatNumInNumberFormatXLSX()
xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
CPPUNIT_ASSERT(pDoc); 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(); xDocSh->DoClose();
} }
......
...@@ -2342,13 +2342,19 @@ static const char* lcl_StyleNameFromId( sal_Int32 nStyleId ) ...@@ -2342,13 +2342,19 @@ static const char* lcl_StyleNameFromId( sal_Int32 nStyleId )
void XclExpStyle::SaveXml( XclExpXmlStream& rStrm ) void XclExpStyle::SaveXml( XclExpXmlStream& rStrm )
{ {
constexpr sal_Int32 CELL_STYLE_MAX_BUILTIN_ID = 54;
OString sName; OString sName;
OString sBuiltinId;
const char* pBuiltinId = nullptr;
if( IsBuiltIn() ) if( IsBuiltIn() )
{ {
sName = OString( lcl_StyleNameFromId( mnStyleId ) ); 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 else
sName = XclXmlUtils::ToOString( maName ); sName = XclXmlUtils::ToOString( maName );
// get the index in sortedlist associated with the mnXId // get the index in sortedlist associated with the mnXId
sal_Int32 nXFId = rStrm.GetRoot().GetXFBuffer().GetXFIndex( maXFId.mnXFId ); sal_Int32 nXFId = rStrm.GetRoot().GetXFBuffer().GetXFIndex( maXFId.mnXFId );
// get the style index associated with index into sortedlist // get the style index associated with index into sortedlist
...@@ -2357,11 +2363,10 @@ void XclExpStyle::SaveXml( XclExpXmlStream& rStrm ) ...@@ -2357,11 +2363,10 @@ void XclExpStyle::SaveXml( XclExpXmlStream& rStrm )
XML_name, sName.getStr(), XML_name, sName.getStr(),
XML_xfId, OString::number( nXFId ).getStr(), XML_xfId, OString::number( nXFId ).getStr(),
// builtinId of 54 or above is invalid according to OpenXML SDK validator. // builtinId of 54 or above is invalid according to OpenXML SDK validator.
#define CELL_STYLE_MAX_BUILTIN_ID 54 XML_builtinId, pBuiltinId,
XML_builtinId, OString::number( std::min( static_cast<sal_Int32>( CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast <sal_Int32>( mnStyleId ) ) ).getStr(),
// OOXTODO: XML_iLevel, // OOXTODO: XML_iLevel,
// OOXTODO: XML_hidden, // OOXTODO: XML_hidden,
XML_customBuiltin, ToPsz( ! IsBuiltIn() ), // XML_customBuiltin, ToPsz( ! IsBuiltIn() ),
FSEND ); FSEND );
// OOXTODO: XML_extLst // OOXTODO: XML_extLst
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment