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>
This commit is contained in:
Noel Grandin
2014-09-28 15:49:26 +02:00
committed by Noel Grandin
parent eb4811590c
commit fc04f76336
203 changed files with 676 additions and 778 deletions

View File

@@ -790,7 +790,7 @@ void ODatabaseForm::AppendComponent(HtmlSuccessfulObjList& rList, const Referenc
} break;
case FormComponentType::TIMEFIELD:
{
// <name>=<value> // Value is a Time with the format HH:MM:SS
// <name>=<value> // Value is a tools::Time with the format HH:MM:SS
// no value (NULL) means empty value
if( hasProperty(PROPERTY_TIME, xComponentSet) )
{
@@ -799,7 +799,7 @@ void ODatabaseForm::AppendComponent(HtmlSuccessfulObjList& rList, const Referenc
sal_Int32 nInt32Val = 0;
if (aVal >>= nInt32Val)
{
::Time aTime(nInt32Val);
::tools::Time aTime(nInt32Val);
OUStringBuffer aBuffer;
appendDigits( aTime.GetHour(), 2, aBuffer );
aBuffer.append( '-' );

View File

@@ -127,7 +127,7 @@ void OEditBaseModel::write(const Reference<XObjectOutputStream>& _rxOutStream) t
{
util::Time aTime;
OSL_VERIFY(m_aDefault >>= aTime);
_rxOutStream->writeHyper(::Time(aTime).GetTime());
_rxOutStream->writeHyper(::tools::Time(aTime).GetTime());
}
else if ((nAnyMask & DEFAULT_DATE) == DEFAULT_DATE)
{
@@ -193,7 +193,7 @@ void OEditBaseModel::read(const Reference<XObjectInputStream>& _rxInStream) thro
}
else if ((nAnyMask & DEFAULT_TIME) == DEFAULT_TIME)
{
m_aDefault <<= ::Time(_rxInStream->readHyper()).GetUNOTime();
m_aDefault <<= ::tools::Time(_rxInStream->readHyper()).GetUNOTime();
}
else if ((nAnyMask & DEFAULT_DATE) == DEFAULT_DATE)
{

View File

@@ -804,11 +804,11 @@ namespace xforms
{
Any aTypedValue = Convert::get().toAny( value, getCppuType() );
Time aValue;
css::util::Time aValue;
if ( !( aTypedValue >>= aValue ) )
return false;
::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.NanoSeconds );
::tools::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.NanoSeconds );
// no loss/rounding; IEEE 754 double-precision floating-point
// has a mantissa of 53 bits; we need at the very most 50 bits:
// format of aToolsTime.GetTime() is (in decimal) hhmmssnnnnnnnnn
@@ -830,9 +830,9 @@ namespace xforms
void OTimeType::normalizeValue( const Any& _rValue, double& _rDoubleValue ) const
{
Time aValue;
css::util::Time aValue;
OSL_VERIFY( _rValue >>= aValue );
::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.NanoSeconds );
::tools::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.NanoSeconds );
_rDoubleValue = aToolsTime.GetTime();
}
@@ -855,7 +855,7 @@ namespace xforms
{
::DateTime aToolsValue(
::Date( _rValue.Day, _rValue.Month, _rValue.Year ),
::Time( _rValue.Hours, _rValue.Minutes, _rValue.Seconds, _rValue.NanoSeconds )
::tools::Time( _rValue.Hours, _rValue.Minutes, _rValue.Seconds, _rValue.NanoSeconds )
);
double fValue = 0;

View File

@@ -233,7 +233,7 @@ void xforms_propertyFunction(xmlXPathParserContextPtr ctxt, int nargs)
xmlXPathReturnEmptyString(ctxt);
}
// Date and Time Functions
// Date and tools::Time Functions
static OString makeDateTimeString (const DateTime& aDateTime, bool bUTC = true)
{
@@ -277,7 +277,7 @@ void xforms_nowFunction(xmlXPathParserContextPtr ctxt, int /*nargs*/)
3.2.7.2 Canonical representation
The canonical representation for dateTime is defined by prohibiting certain options
from the Lexical representation (par.3.2.7.1). Specifically, either the time zone must
be omitted or, if present, the time zone must be Coordinated Universal Time (UTC)
be omitted or, if present, the time zone must be Coordinated Universal tools::Time (UTC)
indicated by a "Z".
*/
DateTime aDateTime( DateTime::SYSTEM );
@@ -317,7 +317,7 @@ static bool parseDateTime(const OUString& aString, DateTime& aDateTime)
sal_Int32 nSecond = aTimeString.getToken(0, ':', nIndex).toInt32();
Date tmpDate((sal_uInt16)nDay, (sal_uInt16)nMonth, (sal_uInt16)nYear);
Time tmpTime(nHour, nMinute, nSecond);
tools::Time tmpTime(nHour, nMinute, nSecond);
DateTime tmpDateTime(tmpDate, tmpTime);
if (aString.indexOf(aUTCString) < 0)
tmpDateTime.ConvertToUTC();