[Libreoffice-commits] .: xmloff/source
Tor Lillqvist
tml at kemper.freedesktop.org
Mon Feb 21 10:16:54 PST 2011
xmloff/source/core/xmluconv.cxx | 78 ++++++++++++++++++++--------------------
1 file changed, 40 insertions(+), 38 deletions(-)
New commits:
commit dd92152b1d329786dc34b3287e899ece52c45fb2
Author: Tor Lillqvist <tlillqvist at novell.com>
Date: Mon Feb 21 20:10:15 2011 +0200
Stop using namespace rtl
It causes compilation errors in MSVC when using precompiled headers
because of the ambiguity of Reference. Instead use explicit 'using
::rtl::OUString' and 'using ::rtl::OUStringBuffer'.
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 519db2b..c07b680 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -56,7 +56,6 @@
#include <com/sun/star/i18n/UnicodeType.hpp>
#include <basegfx/vector/b3dvector.hxx>
-using namespace rtl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -65,6 +64,9 @@ using namespace com::sun::star::style;
using namespace ::com::sun::star::i18n;
using namespace ::xmloff::token;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11;
const sal_Int8 XML_MAXDIGITSCOUNT_DATETIME = 6;
#define XML_NULLDATE "NullDate"
@@ -675,7 +677,7 @@ sal_Bool SvXMLUnitConverter::convertNumber64( sal_Int64& rValue,
}
/** convert double number to string (using ::rtl::math) */
-void SvXMLUnitConverter::convertDouble(::rtl::OUStringBuffer& rBuffer,
+void SvXMLUnitConverter::convertDouble(OUStringBuffer& rBuffer,
double fNumber, BOOL bWriteUnits) const
{
SvXMLUnitConverter::convertDouble(rBuffer, fNumber,
@@ -683,7 +685,7 @@ void SvXMLUnitConverter::convertDouble(::rtl::OUStringBuffer& rBuffer,
}
/** convert double number to string (using ::rtl::math) */
-void SvXMLUnitConverter::convertDouble( ::rtl::OUStringBuffer& rBuffer,
+void SvXMLUnitConverter::convertDouble( OUStringBuffer& rBuffer,
double fNumber, BOOL bWriteUnits, MapUnit eCoreUnit, MapUnit eDstUnit)
{
if(MAP_RELATIVE == eCoreUnit)
@@ -706,14 +708,14 @@ void SvXMLUnitConverter::convertDouble( ::rtl::OUStringBuffer& rBuffer,
}
/** convert double number to string (using ::rtl::math) */
-void SvXMLUnitConverter::convertDouble( ::rtl::OUStringBuffer& rBuffer, double fNumber)
+void SvXMLUnitConverter::convertDouble( OUStringBuffer& rBuffer, double fNumber)
{
::rtl::math::doubleToUStringBuffer( rBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True);
}
/** convert string to double number (using ::rtl::math) */
sal_Bool SvXMLUnitConverter::convertDouble(double& rValue,
- const ::rtl::OUString& rString, BOOL bLookForUnits) const
+ const OUString& rString, BOOL bLookForUnits) const
{
if(bLookForUnits)
{
@@ -730,7 +732,7 @@ sal_Bool SvXMLUnitConverter::convertDouble(double& rValue,
/** convert string to double number (using ::rtl::math) */
sal_Bool SvXMLUnitConverter::convertDouble(double& rValue,
- const ::rtl::OUString& rString, MapUnit eSrcUnit, MapUnit eCoreUnit)
+ const OUString& rString, MapUnit eSrcUnit, MapUnit eCoreUnit)
{
rtl_math_ConversionStatus eStatus;
rValue = ::rtl::math::stringToDouble( rString, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
@@ -747,7 +749,7 @@ sal_Bool SvXMLUnitConverter::convertDouble(double& rValue,
}
/** convert string to double number (using ::rtl::math) */
-sal_Bool SvXMLUnitConverter::convertDouble(double& rValue, const ::rtl::OUString& rString)
+sal_Bool SvXMLUnitConverter::convertDouble(double& rValue, const OUString& rString)
{
rtl_math_ConversionStatus eStatus;
rValue = ::rtl::math::stringToDouble( rString, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
@@ -761,13 +763,13 @@ sal_Bool SvXMLUnitConverter::setNullDate(const com::sun::star::uno::Reference <c
if (xNumberFormatsSupplier.is())
{
const com::sun::star::uno::Reference <com::sun::star::beans::XPropertySet> xPropertySet = xNumberFormatsSupplier->getNumberFormatSettings();
- return xPropertySet.is() && (xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_NULLDATE))) >>= aNullDate);
+ return xPropertySet.is() && (xPropertySet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_NULLDATE))) >>= aNullDate);
}
return sal_False;
}
/** convert double to ISO Time String; negative durations allowed */
-void SvXMLUnitConverter::convertTime( ::rtl::OUStringBuffer& rBuffer,
+void SvXMLUnitConverter::convertTime( OUStringBuffer& rBuffer,
const double& fTime)
{
@@ -826,7 +828,7 @@ void SvXMLUnitConverter::convertTime( ::rtl::OUStringBuffer& rBuffer,
rBuffer.append( sal_Int32( fSecsValue));
if (f100SecsValue > 0.0)
{
- ::rtl::OUString a100th( ::rtl::math::doubleToUString( fValue,
+ OUString a100th( ::rtl::math::doubleToUString( fValue,
rtl_math_StringFormat_F, XML_MAXDIGITSCOUNT_TIME - 5, '.',
sal_True));
if ( a100th.getLength() > 2 )
@@ -840,9 +842,9 @@ void SvXMLUnitConverter::convertTime( ::rtl::OUStringBuffer& rBuffer,
/** convert ISO Time String to double; negative durations allowed */
sal_Bool SvXMLUnitConverter::convertTime( double& fTime,
- const ::rtl::OUString& rString)
+ const OUString& rString)
{
- rtl::OUString aTrimmed = rString.trim().toAsciiUpperCase();
+ OUString aTrimmed = rString.trim().toAsciiUpperCase();
const sal_Unicode* pStr = aTrimmed.getStr();
// negative time duration?
@@ -856,7 +858,7 @@ sal_Bool SvXMLUnitConverter::convertTime( double& fTime,
if ( *(pStr++) != sal_Unicode('P') ) // duration must start with "P"
return sal_False;
- rtl::OUString sDoubleStr;
+ OUString sDoubleStr;
sal_Bool bSuccess = sal_True;
sal_Bool bDone = sal_False;
sal_Bool bTimePart = sal_False;
@@ -969,7 +971,7 @@ sal_Bool SvXMLUnitConverter::convertTime( double& fTime,
}
/** convert util::DateTime to ISO Time String */
-void SvXMLUnitConverter::convertTime( ::rtl::OUStringBuffer& rBuffer,
+void SvXMLUnitConverter::convertTime( OUStringBuffer& rBuffer,
const ::com::sun::star::util::DateTime& rDateTime )
{
double fHour = rDateTime.Hours;
@@ -985,7 +987,7 @@ void SvXMLUnitConverter::convertTime( ::rtl::OUStringBuffer& rBuffer,
/** convert ISO Time String to util::DateTime */
sal_Bool SvXMLUnitConverter::convertTime( ::com::sun::star::util::DateTime& rDateTime,
- const ::rtl::OUString& rString )
+ const OUString& rString )
{
double fCalculatedTime = 0.0;
if( convertTime( fCalculatedTime, rString ) )
@@ -1021,7 +1023,7 @@ sal_Bool SvXMLUnitConverter::convertTime( ::com::sun::star::util::DateTime& rDat
}
/** convert double to ISO Date Time String */
-void SvXMLUnitConverter::convertDateTime( ::rtl::OUStringBuffer& rBuffer,
+void SvXMLUnitConverter::convertDateTime( OUStringBuffer& rBuffer,
const double& fDateTime,
const com::sun::star::util::Date& aTempNullDate,
sal_Bool bAddTimeIf0AM )
@@ -1109,7 +1111,7 @@ void SvXMLUnitConverter::convertDateTime( ::rtl::OUStringBuffer& rBuffer,
rBuffer.append( sal_Int32( fSecsValue));
if (f100SecsValue > 0.0)
{
- ::rtl::OUString a100th( ::rtl::math::doubleToUString( fValue,
+ OUString a100th( ::rtl::math::doubleToUString( fValue,
rtl_math_StringFormat_F,
XML_MAXDIGITSCOUNT_TIME - nCount, '.', sal_True));
if ( a100th.getLength() > 2 )
@@ -1123,7 +1125,7 @@ void SvXMLUnitConverter::convertDateTime( ::rtl::OUStringBuffer& rBuffer,
/** convert ISO Date Time String to double */
sal_Bool SvXMLUnitConverter::convertDateTime( double& fDateTime,
- const ::rtl::OUString& rString, const com::sun::star::util::Date& aTempNullDate)
+ const OUString& rString, const com::sun::star::util::Date& aTempNullDate)
{
com::sun::star::util::DateTime aDateTime;
sal_Bool bSuccess = convertDateTime(aDateTime,rString);
@@ -1150,7 +1152,7 @@ sal_Bool SvXMLUnitConverter::convertDateTime( double& fDateTime,
/** convert util::DateTime to ISO Date String */
void SvXMLUnitConverter::convertDateTime(
- ::rtl::OUStringBuffer& rBuffer,
+ OUStringBuffer& rBuffer,
const com::sun::star::util::DateTime& rDateTime,
sal_Bool bAddTimeIf0AM )
{
@@ -1195,11 +1197,11 @@ void SvXMLUnitConverter::convertDateTime(
/** convert ISO Date String to util::DateTime */
sal_Bool SvXMLUnitConverter::convertDateTime( com::sun::star::util::DateTime& rDateTime,
- const ::rtl::OUString& rString )
+ const OUString& rString )
{
sal_Bool bSuccess = sal_True;
- rtl::OUString aDateStr, aTimeStr, sDoubleStr;
+ OUString aDateStr, aTimeStr, sDoubleStr;
sal_Int32 nPos = rString.indexOf( (sal_Unicode) 'T' );
sal_Int32 nPos2 = rString.indexOf( (sal_Unicode) ',' );
if (nPos2 < 0)
@@ -1487,7 +1489,7 @@ const
-void ThreeByteToFourByte (const sal_Int8* pBuffer, const sal_Int32 nStart, const sal_Int32 nFullLen, rtl::OUStringBuffer& sBuffer)
+void ThreeByteToFourByte (const sal_Int8* pBuffer, const sal_Int32 nStart, const sal_Int32 nFullLen, OUStringBuffer& sBuffer)
{
sal_Int32 nLen(nFullLen - nStart);
if (nLen > 3)
@@ -1540,21 +1542,21 @@ void ThreeByteToFourByte (const sal_Int8* pBuffer, const sal_Int32 nStart, const
sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]);
}
-void SvXMLUnitConverter::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence<sal_Int8>& aPass)
+void SvXMLUnitConverter::encodeBase64(OUStringBuffer& aStrBuffer, const uno::Sequence<sal_Int8>& aPass)
{
sal_Int32 i(0);
sal_Int32 nBufferLength(aPass.getLength());
const sal_Int8* pBuffer = aPass.getConstArray();
while (i < nBufferLength)
{
- rtl::OUStringBuffer sBuffer;
+ OUStringBuffer sBuffer;
ThreeByteToFourByte (pBuffer, i, nBufferLength, sBuffer);
aStrBuffer.append(sBuffer);
i += 3;
}
}
-void SvXMLUnitConverter::decodeBase64(uno::Sequence<sal_Int8>& aBuffer, const rtl::OUString& sBuffer)
+void SvXMLUnitConverter::decodeBase64(uno::Sequence<sal_Int8>& aBuffer, const OUString& sBuffer)
{
sal_Int32 nCharsDecoded = decodeBase64SomeChars( aBuffer, sBuffer );
OSL_ENSURE( nCharsDecoded == sBuffer.getLength(),
@@ -1564,7 +1566,7 @@ void SvXMLUnitConverter::decodeBase64(uno::Sequence<sal_Int8>& aBuffer, const rt
sal_Int32 SvXMLUnitConverter::decodeBase64SomeChars(
uno::Sequence<sal_Int8>& rOutBuffer,
- const rtl::OUString& rInBuffer)
+ const OUString& rInBuffer)
{
sal_Int32 nInBufferLen = rInBuffer.getLength();
sal_Int32 nMinOutBufferLen = (nInBufferLen / 4) * 3;
@@ -1797,10 +1799,10 @@ void SvXMLUnitConverter::convertPropertySet(uno::Reference<beans::XPropertySet>&
}
}
-void SvXMLUnitConverter::clearUndefinedChars(rtl::OUString& rTarget, const rtl::OUString& rSource)
+void SvXMLUnitConverter::clearUndefinedChars(OUString& rTarget, const OUString& rSource)
{
sal_uInt32 nLength(rSource.getLength());
- rtl::OUStringBuffer sBuffer(nLength);
+ OUStringBuffer sBuffer(nLength);
for (sal_uInt32 i = 0; i < nLength; i++)
{
sal_Unicode cChar = rSource[i];
@@ -1939,10 +1941,10 @@ OUString SvXMLUnitConverter::encodeStyleName(
}
// static
-rtl::OUString SvXMLUnitConverter::convertTimeDuration( const Time& rTime, sal_Int32 nSecondsFraction )
+OUString SvXMLUnitConverter::convertTimeDuration( const Time& rTime, sal_Int32 nSecondsFraction )
{
// return ISO time period string
- rtl::OUStringBuffer sTmp;
+ OUStringBuffer sTmp;
sTmp.append( sal_Unicode('P') ); // "period"
sal_uInt16 nHours = rTime.GetHour();
@@ -1975,7 +1977,7 @@ rtl::OUString SvXMLUnitConverter::convertTimeDuration( const Time& rTime, sal_In
if ( nSecondsFraction )
{
sTmp.append( sal_Unicode( '.' ) );
- ::rtl::OUStringBuffer aFractional;
+ OUStringBuffer aFractional;
convertNumber( aFractional, nSecondsFraction );
sTmp.append( aFractional.getStr() );
}
@@ -1985,9 +1987,9 @@ rtl::OUString SvXMLUnitConverter::convertTimeDuration( const Time& rTime, sal_In
}
// static
-bool SvXMLUnitConverter::convertTimeDuration( const rtl::OUString& rString, Time& rTime, sal_Int32* pSecondsFraction )
+bool SvXMLUnitConverter::convertTimeDuration( const OUString& rString, Time& rTime, sal_Int32* pSecondsFraction )
{
- rtl::OUString aTrimmed = rString.trim().toAsciiUpperCase();
+ OUString aTrimmed = rString.trim().toAsciiUpperCase();
const sal_Unicode* pStr = aTrimmed.getStr();
if ( *(pStr++) != sal_Unicode('P') ) // duration must start with "P"
@@ -2088,8 +2090,8 @@ bool SvXMLUnitConverter::convertTimeDuration( const rtl::OUString& rString, Time
return bSuccess;
}
-sal_Bool SvXMLUnitConverter::convertAny( ::rtl::OUStringBuffer& sValue,
- ::rtl::OUStringBuffer& sType ,
+sal_Bool SvXMLUnitConverter::convertAny( OUStringBuffer& sValue,
+ OUStringBuffer& sType ,
const com::sun::star::uno::Any& aValue)
{
sal_Bool bConverted = sal_False;
@@ -2142,7 +2144,7 @@ sal_Bool SvXMLUnitConverter::convertAny( ::rtl::OUStringBuffer& sValue,
case com::sun::star::uno::TypeClass_STRING :
{
- ::rtl::OUString sTempValue;
+ OUString sTempValue;
if (aValue >>= sTempValue)
{
sType.appendAscii("string");
@@ -2204,8 +2206,8 @@ sal_Bool SvXMLUnitConverter::convertAny( ::rtl::OUStringBuffer& sValue,
}
sal_Bool SvXMLUnitConverter::convertAny( com::sun::star::uno::Any& aValue,
- const ::rtl::OUString& sType ,
- const ::rtl::OUString& sValue)
+ const OUString& sType ,
+ const OUString& sValue)
{
sal_Bool bConverted = sal_False;
More information about the Libreoffice-commits
mailing list