[Libreoffice-commits] core.git: include/xmloff svl/source xmloff/source
Eike Rathke
erack at redhat.com
Tue Jul 10 16:40:36 UTC 2018
include/xmloff/xmlnumfe.hxx | 6 +--
include/xmloff/xmlnumfi.hxx | 2 -
include/xmloff/xmltoken.hxx | 1
svl/source/numbers/zformat.cxx | 3 -
xmloff/source/core/xmltoken.cxx | 1
xmloff/source/style/xmlnumfe.cxx | 61 ++++++++-------------------------------
xmloff/source/style/xmlnumfi.cxx | 33 +--------------------
xmloff/source/token/tokens.txt | 1
8 files changed, 20 insertions(+), 88 deletions(-)
New commits:
commit 8ca6468f0f4900d4d3bb45e0e938fe35c308512c
Author: Eike Rathke <erack at redhat.com>
Date: Tue Jul 10 18:39:32 2018 +0200
Revert "tdf#118324 Extend ODF for blank in integer"
This reverts commit c290f692dd28094d41dff686f3faa1c4e14b556e.
Reverting because
a) makes builds fail with errors from the schema validator in saving unit tests
b) the loext:max-blank-integer-digits is now saved for some number formats where it is not necessary
For example, load sc/qa/unit/data/ods/tdf102370_ExponentWithoutSign.ods
save as .xlsx
reload the .xlsx
save as .ods
(which effectively is what the ScExportTest::testExponentWithoutSignFormatXLSX() unit test does and makes the schema validator stumble)
Change-Id: Iaac7e42b23317e7977876c9b5d545c76a1e2a4d2
Reviewed-on: https://gerrit.libreoffice.org/57240
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx
index b52136b8d677..75c3b133c036 100644
--- a/include/xmloff/xmlnumfe.hxx
+++ b/include/xmloff/xmlnumfe.hxx
@@ -64,12 +64,12 @@ private:
SAL_DLLPRIVATE void WriteColorElement_Impl( const Color& rColor );
SAL_DLLPRIVATE void WriteNumberElement_Impl( sal_Int32 nDecimals, sal_Int32 nMinDecimals,
- sal_Int32 nInteger, sal_Int32 nBlankInteger, const OUString& rDashStr,
+ sal_Int32 nInteger, const OUString& rDashStr,
bool bGrouping, sal_Int32 nTrailingThousands,
const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries );
- SAL_DLLPRIVATE void WriteScientificElement_Impl( sal_Int32 nDecimals, sal_Int32 nMinDecimals, sal_Int32 nInteger, sal_Int32 nBlankInteger,
+ SAL_DLLPRIVATE void WriteScientificElement_Impl( sal_Int32 nDecimals, sal_Int32 nMinDecimals, sal_Int32 nInteger,
bool bGrouping, sal_Int32 nExp, sal_Int32 nExpInterval, bool bExpSign );
- SAL_DLLPRIVATE void WriteFractionElement_Impl( sal_Int32 nInteger, sal_Int32 nBlankInteger, bool bGrouping,
+ SAL_DLLPRIVATE void WriteFractionElement_Impl( sal_Int32 nInteger, bool bGrouping,
const SvNumberformat& rFormat, sal_uInt16 nPart );
SAL_DLLPRIVATE void WriteCurrencyElement_Impl( const OUString& rString,
const OUString& rExt );
diff --git a/include/xmloff/xmlnumfi.hxx b/include/xmloff/xmlnumfi.hxx
index 7e01f6afb4f3..39d058fbaeed 100644
--- a/include/xmloff/xmlnumfi.hxx
+++ b/include/xmloff/xmlnumfi.hxx
@@ -157,7 +157,7 @@ class XMLOFF_DLLPUBLIC SvXMLNumFormatContext : public SvXMLStyleContext
public:
SvXMLNumFormatContext( SvXMLImport& rImport,
- sal_uInt16 nPrfx,
+ sal_uInt16 nPrfx,
const OUString& rLName,
SvXMLNumImpData* pNewData,
sal_uInt16 nNewType,
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 017af65a526b..862741d0a0eb 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3316,7 +3316,6 @@ namespace xmloff { namespace token {
XML_ZEROS_NUMERATOR_DIGITS,
XML_ZEROS_DENOMINATOR_DIGITS,
XML_INTEGER_FRACTION_DELIMITER,
- XML_MAX_BLANK_INTEGER_DIGITS,
// tdf#115319
XML_REFERENCE_LANGUAGE,
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 9b4ef9da027e..53e7a02e9acf 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -4755,10 +4755,9 @@ void SvNumberformat::GetNumForInfo( sal_uInt16 nNumFor, SvNumFormatType& rScanne
{
p++;
}
- while ( *p == '0' || *p == '?' )
+ while ( *p++ == '0' )
{
nLeadingCnt++;
- p++;
}
}
else if (nType == NF_SYMBOLTYPE_DECSEP
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 13e58baea38a..f32309b3e1a1 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3309,7 +3309,6 @@ namespace xmloff { namespace token {
TOKEN( "zeros-numerator-digits", XML_ZEROS_NUMERATOR_DIGITS ),
TOKEN( "zeros-denominator-digits", XML_ZEROS_DENOMINATOR_DIGITS ),
TOKEN( "integer-fraction-delimiter", XML_INTEGER_FRACTION_DELIMITER ),
- TOKEN( "max-blank-integer-digits", XML_MAX_BLANK_INTEGER_DIGITS ),
// for optional language-dependent reference formats
TOKEN( "reference-language", XML_REFERENCE_LANGUAGE ),
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 96cd44061b3f..52847a6a8784 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -542,7 +542,7 @@ void SvXMLNumFmtExport::WriteAMPMElement_Impl()
void SvXMLNumFmtExport::WriteNumberElement_Impl(
sal_Int32 nDecimals, sal_Int32 nMinDecimals,
- sal_Int32 nInteger, sal_Int32 nBlankInteger, const OUString& rDashStr,
+ sal_Int32 nInteger, const OUString& rDashStr,
bool bGrouping, sal_Int32 nTrailingThousands,
const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries )
{
@@ -555,10 +555,10 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl(
OUString::number( nDecimals ) );
}
- SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion();
if ( nMinDecimals >= 0 ) // negative = automatic
{
// Export only for 1.2 with extensions or 1.3 and later.
+ SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion();
if (eVersion > SvtSaveOptions::ODFSVER_012)
{
// For 1.2+ use loext namespace, for 1.3 use number namespace.
@@ -569,20 +569,13 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl(
}
}
- // integer digits: '0' and '?'
+ // integer digits
if ( nInteger >= 0 ) // negative = automatic
{
rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_MIN_INTEGER_DIGITS,
OUString::number( nInteger ) );
}
- // blank integer digits: '?'
- if ( nBlankInteger > 0 && ( (eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0 ) )
- {
- rExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_MAX_BLANK_INTEGER_DIGITS,
- OUString::number( nBlankInteger ) );
- }
-
// decimal replacement (dashes) or variable decimals (#)
if ( !rDashStr.isEmpty() || nMinDecimals < nDecimals )
{
@@ -639,7 +632,7 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl(
}
void SvXMLNumFmtExport::WriteScientificElement_Impl(
- sal_Int32 nDecimals, sal_Int32 nMinDecimals, sal_Int32 nInteger, sal_Int32 nBlankInteger,
+ sal_Int32 nDecimals, sal_Int32 nMinDecimals, sal_Int32 nInteger,
bool bGrouping, sal_Int32 nExp, sal_Int32 nExpInterval, bool bExpSign )
{
FinishTextElement_Impl();
@@ -672,13 +665,6 @@ void SvXMLNumFmtExport::WriteScientificElement_Impl(
OUString::number( nInteger ) );
}
- // blank integer digits '?'
- if ( nBlankInteger > 0 && ( (eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0 ) )
- {
- rExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_MAX_BLANK_INTEGER_DIGITS,
- OUString::number( nBlankInteger ) );
- }
-
// (automatic) grouping separator
if ( bGrouping )
{
@@ -722,7 +708,7 @@ void SvXMLNumFmtExport::WriteScientificElement_Impl(
}
void SvXMLNumFmtExport::WriteFractionElement_Impl(
- sal_Int32 nInteger, sal_Int32 nBlankInteger, bool bGrouping,
+ sal_Int32 nInteger, bool bGrouping,
const SvNumberformat& rFormat, sal_uInt16 nPart )
{
FinishTextElement_Impl();
@@ -761,14 +747,6 @@ void SvXMLNumFmtExport::WriteFractionElement_Impl(
OUString::number( nInteger ) );
}
- SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion();
- // blank integer digits '?'
- if ( nBlankInteger > 0 && ( (eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0 ) )
- {
- rExport.AddAttribute( XML_NAMESPACE_LO_EXT, XML_MAX_BLANK_INTEGER_DIGITS,
- OUString::number( nBlankInteger ) );
- }
-
// (automatic) grouping separator
if ( bGrouping )
{
@@ -776,6 +754,7 @@ void SvXMLNumFmtExport::WriteFractionElement_Impl(
}
// integer/fraction delimiter
+ SvtSaveOptions::ODFSaneDefaultVersion eVersion = rExport.getSaneDefaultVersion();
if ( !aIntegerFractionDelimiterString.isEmpty() && aIntegerFractionDelimiterString != " "
&& ((eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0) )
{ // Export only for 1.2 with extensions or 1.3 and later.
@@ -1281,7 +1260,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
if ( eBuiltIn == NF_NUMBER_STANDARD )
{
// default number format contains just one number element
- WriteNumberElement_Impl( -1, -1, 1, -1, OUString(), false, 0, aEmbeddedEntries );
+ WriteNumberElement_Impl( -1, -1, 1, OUString(), false, 0, aEmbeddedEntries );
bAnyContent = true;
}
else if ( eBuiltIn == NF_BOOLEAN )
@@ -1304,7 +1283,6 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
sal_Int32 nIntegerSymbols = 0; // for embedded-text, including "#"
sal_Int32 nTrailingThousands = 0; // thousands-separators after all digits
sal_Int32 nMinDecimals = nPrecision;
- sal_Int32 nBlankInteger = 0;
OUString sCurrExt;
OUString aCalendar;
sal_uInt16 nPos = 0;
@@ -1327,7 +1305,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
bDecDashes = true;
nMinDecimals = 0;
}
- else if ( nFmtType != SvNumFormatType::FRACTION && !bInInteger && pElemStr )
+ else if ( !bInInteger && pElemStr )
{
for ( sal_Int32 i = pElemStr->getLength()-1; i >= 0 ; i-- )
{
@@ -1343,18 +1321,10 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
}
}
if ( bInInteger && pElemStr )
- {
nIntegerSymbols += pElemStr->getLength();
- for ( sal_Int32 i = pElemStr->getLength()-1; i >= 0 ; i-- )
- {
- if ( (*pElemStr)[i] == '?' )
- nBlankInteger ++;
- }
- }
nTrailingThousands = 0;
break;
case NF_SYMBOLTYPE_DECSEP:
- case NF_SYMBOLTYPE_FRACBLANK:
bInInteger = false;
break;
case NF_SYMBOLTYPE_THSEP:
@@ -1503,7 +1473,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
}
break;
case NF_KEY_GENERAL :
- WriteNumberElement_Impl( -1, -1, 1, -1, OUString(), false, 0, aEmbeddedEntries );
+ WriteNumberElement_Impl( -1, -1, 1, OUString(), false, 0, aEmbeddedEntries );
break;
case NF_KEY_CCC:
if (pElemStr)
@@ -1561,10 +1531,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// only one built-in format has automatic integer digits
sal_Int32 nInteger = nLeading;
if ( eBuiltIn == NF_NUMBER_SYSTEM )
- {
nInteger = -1;
- nBlankInteger = -1;
- }
// string for decimal replacement
// has to be taken from nPrecision
@@ -1576,17 +1543,16 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
if (bDecAlign && nPrecision > 0)
sDashStr = " ";
- WriteNumberElement_Impl(nDecimals, nMinDecimals, nInteger, nBlankInteger, sDashStr.makeStringAndClear(),
+ WriteNumberElement_Impl(nDecimals, nMinDecimals, nInteger, sDashStr.makeStringAndClear(),
bThousand, nTrailingThousands, aEmbeddedEntries);
bAnyContent = true;
}
break;
case SvNumFormatType::SCIENTIFIC:
- // #i43959# for scientific numbers, count all integer symbols ("0", "?" and "#")
+ // #i43959# for scientific numbers, count all integer symbols ("0" and "#")
// as integer digits: use nIntegerSymbols instead of nLeading
// nIntegerSymbols represents exponent interval (for engineering notation)
- WriteScientificElement_Impl( nPrecision, nMinDecimals, nLeading, nBlankInteger,
- bThousand, nExpDigits, nIntegerSymbols, bExpSign );
+ WriteScientificElement_Impl( nPrecision, nMinDecimals, nLeading, bThousand, nExpDigits, nIntegerSymbols, bExpSign );
bAnyContent = true;
break;
case SvNumFormatType::FRACTION:
@@ -1598,9 +1564,8 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// the fraction doesn't have an integer part, and no
// min-integer-digits attribute must be written.
nInteger = -1;
- nBlankInteger = -1;
}
- WriteFractionElement_Impl( nInteger, nBlankInteger, bThousand, rFormat, nPart );
+ WriteFractionElement_Impl( nInteger, bThousand, rFormat, nPart );
bAnyContent = true;
}
break;
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 5d68358c2db5..e611c144f290 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -92,8 +92,7 @@ public:
struct SvXMLNumberInfo
{
sal_Int32 nDecimals;
- sal_Int32 nInteger; /// Total min number of digits in integer part ('0' + '?')
- sal_Int32 nBlankInteger; /// Number of '?' in integer part
+ sal_Int32 nInteger;
sal_Int32 nExpDigits;
sal_Int32 nExpInterval;
sal_Int32 nMinNumerDigits;
@@ -114,7 +113,7 @@ struct SvXMLNumberInfo
SvXMLNumberInfo()
{
- nDecimals = nInteger = nBlankInteger = nExpDigits = nExpInterval = nMinNumerDigits = nMinDenomDigits = nMaxNumerDigits = nMaxDenomDigits =
+ nDecimals = nInteger = nExpDigits = nExpInterval = nMinNumerDigits = nMinDenomDigits = nMaxNumerDigits = nMaxDenomDigits =
nFracDenominator = nMinDecimalDigits = nZerosNumerDigits = nZerosDenomDigits = -1;
bGrouping = bDecReplace = bDecAlign = false;
bExpSign = true;
@@ -254,7 +253,6 @@ enum SvXMLStyleElemAttrTokens
XML_TOK_ELEM_ATTR_DECIMAL_PLACES,
XML_TOK_ELEM_ATTR_MIN_DECIMAL_PLACES,
XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS,
- XML_TOK_ELEM_ATTR_MAX_BLANK_INTEGER_DIGITS,
XML_TOK_ELEM_ATTR_GROUPING,
XML_TOK_ELEM_ATTR_DISPLAY_FACTOR,
XML_TOK_ELEM_ATTR_DECIMAL_REPLACEMENT,
@@ -546,8 +544,6 @@ const SvXMLTokenMap& SvXMLNumImpData::GetStyleElemAttrTokenMap()
{ XML_NAMESPACE_LO_EXT, XML_MIN_DECIMAL_PLACES, XML_TOK_ELEM_ATTR_MIN_DECIMAL_PLACES },
{ XML_NAMESPACE_NUMBER, XML_MIN_DECIMAL_PLACES, XML_TOK_ELEM_ATTR_MIN_DECIMAL_PLACES },
{ XML_NAMESPACE_NUMBER, XML_MIN_INTEGER_DIGITS, XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS },
- { XML_NAMESPACE_LO_EXT, XML_MAX_BLANK_INTEGER_DIGITS,XML_TOK_ELEM_ATTR_MAX_BLANK_INTEGER_DIGITS },
- { XML_NAMESPACE_NUMBER, XML_MAX_BLANK_INTEGER_DIGITS,XML_TOK_ELEM_ATTR_MAX_BLANK_INTEGER_DIGITS },
{ XML_NAMESPACE_NUMBER, XML_GROUPING, XML_TOK_ELEM_ATTR_GROUPING },
{ XML_NAMESPACE_NUMBER, XML_DISPLAY_FACTOR, XML_TOK_ELEM_ATTR_DISPLAY_FACTOR },
{ XML_NAMESPACE_NUMBER, XML_DECIMAL_REPLACEMENT, XML_TOK_ELEM_ATTR_DECIMAL_REPLACEMENT },
@@ -935,10 +931,6 @@ SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport& rImport,
if (::sax::Converter::convertNumber( nAttrVal, sValue, 0 ))
aNumInfo.nInteger = nAttrVal;
break;
- case XML_TOK_ELEM_ATTR_MAX_BLANK_INTEGER_DIGITS:
- if (::sax::Converter::convertNumber( nAttrVal, sValue, 0 ))
- aNumInfo.nBlankInteger = nAttrVal;
- break;
case XML_TOK_ELEM_ATTR_GROUPING:
if (::sax::Converter::convertBool( bAttrBool, sValue ))
aNumInfo.bGrouping = bAttrBool;
@@ -1032,8 +1024,6 @@ SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport& rImport,
break;
}
}
- if ( aNumInfo.nBlankInteger > aNumInfo.nInteger )
- aNumInfo.nInteger = aNumInfo.nBlankInteger;
if ( aNumInfo.nMinDecimalDigits == -1)
{
if ( bVarDecimals || aNumInfo.bDecReplace )
@@ -1904,25 +1894,6 @@ void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
aNumStr.stripStart('#');
}
- if ( rInfo.nBlankInteger > 0 )
- {
- // Replace nBlankInteger '0' by '?'
- sal_Int32 nIndex = 0;
- sal_Int32 nBlanks = rInfo.nBlankInteger;
- sal_Int32 nIntegerEnd = aNumStr.indexOf( pFormatter->GetNumDecimalSep() );
- if ( nIntegerEnd < 0 )
- nIntegerEnd = aNumStr.getLength();
- while ( nIndex < nIntegerEnd && nBlanks > 0 )
- {
- if ( aNumStr[nIndex] == '0' )
- {
- aNumStr[nIndex] = '?';
- nBlanks--;
- }
- nIndex++;
- }
- }
-
if ( bGrouping && rInfo.nExpInterval > rInfo.nInteger )
{
sal_Int32 nIndex = 0;
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 4b1c8544b7a0..63e8b99015ab 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -3084,7 +3084,6 @@ max-numerator-digits
zeros-numerator-digits
zeros-denominator-digits
integer-fraction-delimiter
-max-blank-integer-digits
reference-language
newline
creator-initials
More information about the Libreoffice-commits
mailing list