summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-09-28 15:49:26 +0200
committerNoel Grandin <noelgrandin@gmail.com>2014-10-01 07:34:23 +0000
commitfc04f76336fdf8c96e35382cdeb497e2f939705c (patch)
tree70c9bbd054a34a9bca9d22bb7afbb9c4349beff0 /xmloff
parenteb4811590c85895ce531674596bdd6afb3397725 (diff)
fdo#82577: Handle Time
Put the TOOLS Time class in the tools namespace. Avoids clash with the X11 Time typedef. Change-Id: Iac57d5aef35e81ace1ee0d5e6d76cb278f8ad866 Reviewed-on: https://gerrit.libreoffice.org/11684 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmluconv.cxx16
-rw-r--r--xmloff/source/draw/propimp0.cxx6
-rw-r--r--xmloff/source/forms/elementexport.cxx2
-rw-r--r--xmloff/source/forms/handler/vcl_time_handler.cxx8
-rw-r--r--xmloff/source/forms/propertyexport.cxx16
-rw-r--r--xmloff/source/forms/propertyimport.cxx16
-rw-r--r--xmloff/source/text/txtlists.cxx2
7 files changed, 34 insertions, 32 deletions
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 5f3eb01c780c..ce2076e30cd2 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -305,21 +305,21 @@ bool SvXMLUnitConverter::setNullDate(const com::sun::star::uno::Reference <com::
return false;
}
-/** convert double to ISO Date Time String */
+/** convert double to ISO Date tools::Time String */
void SvXMLUnitConverter::convertDateTime(OUStringBuffer& rBuffer,
const double& fDateTime, bool const bAddTimeIf0AM)
{
convertDateTime(rBuffer, fDateTime, m_pImpl->m_aNullDate, bAddTimeIf0AM);
}
-/** convert ISO Date Time String to double */
+/** convert ISO Date tools::Time String to double */
bool SvXMLUnitConverter::convertDateTime(double& fDateTime,
const OUString& rString)
{
return convertDateTime(fDateTime, rString, m_pImpl->m_aNullDate);
}
-/** convert double to ISO Date Time String */
+/** convert double to ISO Date tools::Time String */
void SvXMLUnitConverter::convertDateTime( OUStringBuffer& rBuffer,
const double& fDateTime,
const com::sun::star::util::Date& aTempNullDate,
@@ -427,7 +427,7 @@ void SvXMLUnitConverter::convertDateTime( OUStringBuffer& rBuffer,
}
}
-/** convert ISO Date Time String to double */
+/** convert ISO Date tools::Time String to double */
bool SvXMLUnitConverter::convertDateTime( double& fDateTime,
const OUString& rString, const com::sun::star::util::Date& aTempNullDate)
{
@@ -444,10 +444,10 @@ bool SvXMLUnitConverter::convertDateTime( double& fDateTime,
double Min = aDateTime.Minutes;
double Sec = aDateTime.Seconds;
double NanoSec = aDateTime.NanoSeconds;
- fTempDateTime += Hour / ::Time::hourPerDay;
- fTempDateTime += Min / ::Time::minutePerDay;
- fTempDateTime += Sec / ::Time::secondPerDay;
- fTempDateTime += NanoSec / ::Time::nanoSecPerDay;
+ fTempDateTime += Hour / ::tools::Time::hourPerDay;
+ fTempDateTime += Min / ::tools::Time::minutePerDay;
+ fTempDateTime += Sec / ::tools::Time::secondPerDay;
+ fTempDateTime += NanoSec / ::tools::Time::nanoSecPerDay;
fDateTime = fTempDateTime;
}
return bSuccess;
diff --git a/xmloff/source/draw/propimp0.cxx b/xmloff/source/draw/propimp0.cxx
index 9c55aa18521e..8b7453f2602a 100644
--- a/xmloff/source/draw/propimp0.cxx
+++ b/xmloff/source/draw/propimp0.cxx
@@ -51,7 +51,9 @@ bool XMLDurationPropertyHdl::importXML(
::sax::Converter::convertDuration(aDuration, rStrImpValue);
const double fSeconds = ((aDuration.Days * 24 + aDuration.Hours) * 60
- + aDuration.Minutes) * 60 + aDuration.Seconds + aDuration.NanoSeconds / static_cast<double>(::Time::nanoSecPerSec);
+ + aDuration.Minutes) * 60
+ + aDuration.Seconds
+ + aDuration.NanoSeconds / static_cast<double>(::tools::Time::nanoSecPerSec);
rValue <<= fSeconds;
return true;
@@ -68,7 +70,7 @@ bool XMLDurationPropertyHdl::exportXML(
{
util::Duration aDuration;
aDuration.Seconds = static_cast<sal_uInt16>(nVal);
- aDuration.NanoSeconds = static_cast<sal_uInt32>((nVal - aDuration.Seconds) * ::Time::nanoSecPerSec);
+ aDuration.NanoSeconds = static_cast<sal_uInt32>((nVal - aDuration.Seconds) * ::tools::Time::nanoSecPerSec);
OUStringBuffer aOut;
::sax::Converter::convertDuration(aOut, aDuration);
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 4ce6534b2883..2734a3fd48b4 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -1109,7 +1109,7 @@ namespace xmloff
sal_Int32 nRepeatDelay = 0;
m_xProps->getPropertyValue( PROPERTY_REPEAT_DELAY ) >>= nRepeatDelay;
- Time aTime( Time::SYSTEM );
+ tools::Time aTime( tools::Time::SYSTEM );
aTime.MakeTimeFromMS( nRepeatDelay );
util::Duration aDuration;
aDuration.Hours = aTime.GetHour();
diff --git a/xmloff/source/forms/handler/vcl_time_handler.cxx b/xmloff/source/forms/handler/vcl_time_handler.cxx
index c02c2e6e2c1e..2bedb56cc775 100644
--- a/xmloff/source/forms/handler/vcl_time_handler.cxx
+++ b/xmloff/source/forms/handler/vcl_time_handler.cxx
@@ -50,7 +50,7 @@ namespace xmloff
OUString VCLTimeHandler::getAttributeValue( const Any& i_propertyValue ) const
{
- Time aTime;
+ css::util::Time aTime;
OSL_VERIFY( i_propertyValue >>= aTime );
Duration aDuration; // default-inited to 0
@@ -67,7 +67,7 @@ namespace xmloff
bool VCLTimeHandler::getPropertyValues( const OUString& i_attributeValue, PropertyValues& o_propertyValues ) const
{
Duration aDuration;
- Time aTime;
+ css::util::Time aTime;
if (::sax::Converter::convertDuration( aDuration, i_attributeValue ))
{
aTime = Time(aDuration.NanoSeconds, aDuration.Seconds,
@@ -84,8 +84,8 @@ namespace xmloff
return false;
}
// legacy integer was in centiseconds
- nVCLTime *= ::Time::nanoPerCenti;
- aTime = ::Time(nVCLTime).GetUNOTime();
+ nVCLTime *= ::tools::Time::nanoPerCenti;
+ aTime = ::tools::Time(nVCLTime).GetUNOTime();
}
const Any aPropertyValue( makeAny( aTime ) );
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx
index 9693e7db6087..bc41ab43d8c7 100644
--- a/xmloff/source/forms/propertyexport.cxx
+++ b/xmloff/source/forms/propertyexport.cxx
@@ -570,20 +570,20 @@ namespace xmloff
}
else if (_rValue >>= aTime)
{
- fValue = aTime.Hours / static_cast<double>(::Time::hourPerDay) +
- aTime.Minutes / static_cast<double>(::Time::minutePerDay) +
- aTime.Seconds / static_cast<double>(::Time::secondPerDay) +
- aTime.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay);
+ fValue = aTime.Hours / static_cast<double>(::tools::Time::hourPerDay) +
+ aTime.Minutes / static_cast<double>(::tools::Time::minutePerDay) +
+ aTime.Seconds / static_cast<double>(::tools::Time::secondPerDay) +
+ aTime.NanoSeconds / static_cast<double>(::tools::Time::nanoSecPerDay);
}
else if (_rValue >>= aDateTime)
{
DateTime aToolsDateTime( DateTime::EMPTY );
::utl::typeConvert(aDateTime, aToolsDateTime);
// the time part (the digits behind the comma)
- fValue = aTime.Hours / static_cast<double>(::Time::hourPerDay) +
- aTime.Minutes / static_cast<double>(::Time::minutePerDay) +
- aTime.Seconds / static_cast<double>(::Time::secondPerDay) +
- aTime.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay);
+ fValue = aTime.Hours / static_cast<double>(::tools::Time::hourPerDay) +
+ aTime.Minutes / static_cast<double>(::tools::Time::minutePerDay) +
+ aTime.Seconds / static_cast<double>(::tools::Time::secondPerDay) +
+ aTime.NanoSeconds / static_cast<double>(::tools::Time::nanoSecPerDay);
// plus the data part (the digits in front of the comma)
fValue += aToolsDateTime.GetDate();
}
diff --git a/xmloff/source/forms/propertyimport.cxx b/xmloff/source/forms/propertyimport.cxx
index 42bbe4f3873f..939574608756 100644
--- a/xmloff/source/forms/propertyimport.cxx
+++ b/xmloff/source/forms/propertyimport.cxx
@@ -61,13 +61,13 @@ namespace
::com::sun::star::util::Time lcl_getTime(double _nValue)
{
::com::sun::star::util::Time aTime;
- sal_uInt64 nIntValue = static_cast<sal_uInt64>(_nValue * ::Time::nanoSecPerDay);
- aTime.NanoSeconds = nIntValue % ::Time::nanoSecPerSec;
- nIntValue /= ::Time::nanoSecPerSec;
- aTime.Seconds = nIntValue % ::Time::secondPerMinute;
- nIntValue /= ::Time::secondPerMinute;
- aTime.Minutes = nIntValue % ::Time::minutePerHour;
- nIntValue /= ::Time::minutePerHour;
+ sal_uInt64 nIntValue = static_cast<sal_uInt64>(_nValue * ::tools::Time::nanoSecPerDay);
+ aTime.NanoSeconds = nIntValue % ::tools::Time::nanoSecPerSec;
+ nIntValue /= ::tools::Time::nanoSecPerSec;
+ aTime.Seconds = nIntValue % ::tools::Time::secondPerMinute;
+ nIntValue /= ::tools::Time::secondPerMinute;
+ aTime.Minutes = nIntValue % ::tools::Time::minutePerHour;
+ nIntValue /= ::tools::Time::minutePerHour;
OSL_ENSURE(nIntValue < 24, "lcl_getTime: more than a day?");
aTime.Hours = nIntValue;
@@ -199,7 +199,7 @@ Any PropertyConversion::convertString( const ::com::sun::star::uno::Type& _rExpe
case TYPE_TIME:
{
OSL_ENSURE(((sal_uInt32)nValue) == 0,
- "PropertyConversion::convertString: a Time value with more than a fractional part?");
+ "PropertyConversion::convertString: a tools::Time value with more than a fractional part?");
aReturn <<= lcl_getTime(nValue);
}
break;
diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx
index 71663660c83c..79a132589020 100644
--- a/xmloff/source/text/txtlists.cxx
+++ b/xmloff/source/text/txtlists.cxx
@@ -231,7 +231,7 @@ OUString XMLTextListsHelper::GenerateNewListId() const
else
{
// Value of xml:id in element <text:list> has to be a valid ID type (#i92478#)
- sal_Int64 n = Time( Time::SYSTEM ).GetTime();
+ sal_Int64 n = ::tools::Time( ::tools::Time::SYSTEM ).GetTime();
n += Date( Date::SYSTEM ).GetDate();
n += rand();
// Value of xml:id in element <text:list> has to be a valid ID type (#i92478#)