summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2006-10-13 09:59:20 +0000
committerOliver Bolte <obo@openoffice.org>2006-10-13 09:59:20 +0000
commit2645971f63822377534d013058981383eab8b728 (patch)
treea53fa3d391f7afb3c213feea1777bcdb961c30f8
parent30b6adc99e1d2d007aed38035ae43d6caf87cb2b (diff)
INTEGRATION: CWS opofxmlstorage (1.42.28); FILE MERGED
2006/08/16 15:59:29 mav 1.42.28.1: #i68684# support iconified objects
-rw-r--r--xmloff/source/core/xmluconv.cxx53
1 files changed, 49 insertions, 4 deletions
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 6b4af449cc1a..c054716733fa 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: xmluconv.cxx,v $
*
- * $Revision: 1.44 $
+ * $Revision: 1.45 $
*
- * last change: $Author: obo $ $Date: 2006-10-12 14:39:47 $
+ * last change: $Author: obo $ $Date: 2006-10-13 10:59:20 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -710,7 +710,7 @@ void SvXMLUnitConverter::convertNumber( OUStringBuffer& rBuffer,
/** convert string to number with optional min and max values */
sal_Bool SvXMLUnitConverter::convertNumber( sal_Int32& rValue,
const OUString& rString,
- sal_Int32 /*nMin*/, sal_Int32 /*nMax*/ )
+ sal_Int32 nMin, sal_Int32 nMax )
{
sal_Bool bNeg = sal_False;
rValue = 0;
@@ -742,7 +742,52 @@ sal_Bool SvXMLUnitConverter::convertNumber( sal_Int32& rValue,
if( bNeg )
rValue *= -1;
- return nPos == nLen;
+ return ( nPos == nLen && rValue >= nMin && rValue <= nMax );
+}
+
+/** convert 64-bit number to string */
+void SvXMLUnitConverter::convertNumber64( OUStringBuffer& rBuffer,
+ sal_Int64 nNumber )
+{
+ rBuffer.append( nNumber );
+}
+
+/** convert string to 64-bit number with optional min and max values */
+sal_Bool SvXMLUnitConverter::convertNumber64( sal_Int64& rValue,
+ const OUString& rString,
+ sal_Int64 nMin, sal_Int64 nMax )
+{
+ sal_Bool bNeg = sal_False;
+ rValue = 0;
+
+ sal_Int32 nPos = 0L;
+ sal_Int32 nLen = rString.getLength();
+
+ // skip white space
+ while( (nPos < nLen) && (rString[nPos] <= sal_Unicode(' ')) )
+ nPos++;
+
+ if( nPos < nLen && sal_Unicode('-') == rString[nPos] )
+ {
+ bNeg = sal_True;
+ nPos++;
+ }
+
+ // get number
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rString[nPos] &&
+ sal_Unicode('9') >= rString[nPos] )
+ {
+ // TODO: check overflow!
+ rValue *= 10;
+ rValue += (rString[nPos] - sal_Unicode('0'));
+ nPos++;
+ }
+
+ if( bNeg )
+ rValue *= -1;
+
+ return ( nPos == nLen && rValue >= nMin && rValue <= nMax );
}
/** convert double number to string (using ::rtl::math) */