summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2004-10-22 06:55:43 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2004-10-22 06:55:43 +0000
commit12cf5fe2736514b27fa28213307a44d43d003aff (patch)
treefec799d63c68f4f53626e3d957046d5fd951d9e5 /xmloff
parent610661b9f03f296b8814bc80e1cac9f9fafd2c52 (diff)
INTEGRATION: CWS calc23 (1.38.60); FILE MERGED
2004/10/08 10:32:57 nn 1.38.60.2: #i18114# handle fractions without integer part 2004/10/05 14:33:23 nn 1.38.60.1: #i20396# handle spaces from underscores in embedded-text elements
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/xmlnumfe.cxx43
1 files changed, 35 insertions, 8 deletions
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 652e7fd0f3..33dc1c13be 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlnumfe.cxx,v $
*
- * $Revision: 1.38 $
+ * $Revision: 1.39 $
*
- * last change: $Author: rt $ $Date: 2004-07-13 08:27:32 $
+ * last change: $Author: rt $ $Date: 2004-10-22 07:55:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -705,7 +705,16 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl(
sal_True, sal_False );
// text as element content
- rExport.Characters( pObj->aText );
+ rtl::OUString aContent( pObj->aText );
+ while ( nEntry+1 < nEntryCount && rEmbeddedEntries[nEntry+1]->nFormatPos == pObj->nFormatPos )
+ {
+ // The array can contain several elements for the same position in the number
+ // (for example, literal text and space from underscores). They must be merged
+ // into a single embedded-text element.
+ aContent += rEmbeddedEntries[nEntry+1]->aText;
+ ++nEntry;
+ }
+ rExport.Characters( aContent );
}
}
@@ -1316,13 +1325,20 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
nDigitsPassed += pElemStr->Len();
break;
case XMLNUM_SYMBOLTYPE_STRING:
+ case XMLNUM_SYMBOLTYPE_BLANK:
if ( nDigitsPassed > 0 && nDigitsPassed < nIntegerSymbols && pElemStr )
{
- // text within the integer part of a number:number element
+ // text (literal or underscore) within the integer part of a number:number element
+
+ String aEmbeddedStr;
+ if ( nElemType == XMLNUM_SYMBOLTYPE_STRING )
+ aEmbeddedStr = *pElemStr;
+ else
+ SvNumberformat::InsertBlanks( aEmbeddedStr, 0, pElemStr->GetChar(1) );
sal_Int32 nEmbedPos = nIntegerSymbols - nDigitsPassed;
- SvXMLEmbeddedTextEntry* pObj = new SvXMLEmbeddedTextEntry( nPos, nEmbedPos, *pElemStr );
+ SvXMLEmbeddedTextEntry* pObj = new SvXMLEmbeddedTextEntry( nPos, nEmbedPos, aEmbeddedStr );
aEmbeddedEntries.Insert( pObj, aEmbeddedEntries.Count() );
}
break;
@@ -1378,9 +1394,10 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
}
break;
case XMLNUM_SYMBOLTYPE_BLANK:
- if (pElemStr)
+ if ( pElemStr && !lcl_IsInEmbedded( aEmbeddedEntries, nPos ) )
{
// turn "_x" into the number of spaces used for x in InsertBlanks in the NumberFormat
+ // (#i20396# the spaces may also be in embedded-text elements)
String aBlanks;
SvNumberformat::InsertBlanks( aBlanks, 0, pElemStr->GetChar(1) );
@@ -1465,8 +1482,18 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
bAnyContent = sal_True;
break;
case NUMBERFORMAT_FRACTION:
- WriteFractionElement_Impl( nLeading, bThousand, nPrecision, nPrecision );
- bAnyContent = sal_True;
+ {
+ sal_Int32 nInteger = nLeading;
+ if ( pElemStr && pElemStr->GetChar(0) == '?' )
+ {
+ // If the first digit character is a question mark,
+ // the fraction doesn't have an integer part, and no
+ // min-integer-digits attribute must be written.
+ nInteger = -1;
+ }
+ WriteFractionElement_Impl( nInteger, bThousand, nPrecision, nPrecision );
+ bAnyContent = sal_True;
+ }
break;
}