summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-10-21 12:42:16 +0200
committerNoel Grandin <noel@peralex.com>2015-10-21 14:17:56 +0200
commit2f3ea8dfbc7dedc785cd07ad0b681a0da3904a80 (patch)
tree533c450fb3e8e5b75d5ccdc9dc6c358da481513f /forms
parent54409159b8a12ca3d387e2ff2a2e1ff9dad1a2a3 (diff)
refactor out some com::sun::star typedefs
which mostly serve to make the code harder to read Change-Id: Ia2a83fee9f850ab6f0bea6305ce8600d6b785fe8
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/FormattedField.cxx31
-rw-r--r--forms/source/xforms/convert.cxx42
2 files changed, 31 insertions, 42 deletions
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index 3e3bb57013f8..4c4068e0cc50 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -71,13 +71,6 @@ using namespace css::lang;
using namespace css::util;
using namespace css::form::binding;
-namespace
-{
- typedef css::util::Date UNODate;
- typedef css::util::Time UNOTime;
- typedef css::util::DateTime UNODateTime;
-}
-
namespace frm
{
class StandardFormatsSupplier : protected SvNumberFormatsSupplierObj, public ::utl::ITerminationListener
@@ -899,21 +892,21 @@ Any OFormattedModel::translateExternalValueToControlValue( const Any& _rExternal
break;
default:
{
- if ( _rExternalValue.getValueType().equals( cppu::UnoType< UNODate >::get() ) )
+ if ( _rExternalValue.getValueType().equals( cppu::UnoType< css::util::Date >::get() ) )
{
- UNODate aDate;
+ css::util::Date aDate;
_rExternalValue >>= aDate;
aControlValue <<= DBTypeConversion::toDouble( aDate, m_aNullDate );
}
- else if ( _rExternalValue.getValueType().equals( cppu::UnoType< UNOTime >::get() ) )
+ else if ( _rExternalValue.getValueType().equals( cppu::UnoType< css::util::Time >::get() ) )
{
- UNOTime aTime;
+ css::util::Time aTime;
_rExternalValue >>= aTime;
aControlValue <<= DBTypeConversion::toDouble( aTime );
}
- else if ( _rExternalValue.getValueType().equals( cppu::UnoType< UNODateTime >::get() ) )
+ else if ( _rExternalValue.getValueType().equals( cppu::UnoType< css::util::DateTime >::get() ) )
{
- UNODateTime aDateTime;
+ css::util::DateTime aDateTime;
_rExternalValue >>= aDateTime;
aControlValue <<= DBTypeConversion::toDouble( aDateTime, m_aNullDate );
}
@@ -969,15 +962,15 @@ Any OFormattedModel::translateControlValueToExternalValue( ) const
// if this asserts ... well, the somebody set the TreatAsNumeric property to false,
// and the control value is a string. This implies some weird misconfiguration
// of the FormattedModel, so we won't care for it for the moment.
- if ( aExternalValueType.equals( cppu::UnoType< UNODate >::get() ) )
+ if ( aExternalValueType.equals( cppu::UnoType< css::util::Date >::get() ) )
{
aExternalValue <<= DBTypeConversion::toDate( fValue, m_aNullDate );
}
- else if ( aExternalValueType.equals( cppu::UnoType< UNOTime >::get() ) )
+ else if ( aExternalValueType.equals( cppu::UnoType< css::util::Time >::get() ) )
{
aExternalValue <<= DBTypeConversion::toTime( fValue );
}
- else if ( aExternalValueType.equals( cppu::UnoType< UNODateTime >::get() ) )
+ else if ( aExternalValueType.equals( cppu::UnoType< css::util::DateTime >::get() ) )
{
aExternalValue <<= DBTypeConversion::toDateTime( fValue, m_aNullDate );
}
@@ -1011,13 +1004,13 @@ Sequence< Type > OFormattedModel::getSupportedBindingTypes()
switch ( m_nKeyType & ~NumberFormat::DEFINED )
{
case NumberFormat::DATE:
- aTypes.push_front(cppu::UnoType< UNODate >::get() );
+ aTypes.push_front(cppu::UnoType< css::util::Date >::get() );
break;
case NumberFormat::TIME:
- aTypes.push_front(cppu::UnoType< UNOTime >::get() );
+ aTypes.push_front(cppu::UnoType< css::util::Time >::get() );
break;
case NumberFormat::DATETIME:
- aTypes.push_front(cppu::UnoType< UNODateTime >::get() );
+ aTypes.push_front(cppu::UnoType< css::util::DateTime >::get() );
break;
case NumberFormat::TEXT:
aTypes.push_front(cppu::UnoType< OUString >::get() );
diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx
index 9465093245da..36d76cba6b59 100644
--- a/forms/source/xforms/convert.cxx
+++ b/forms/source/xforms/convert.cxx
@@ -42,10 +42,6 @@ using namespace std;
using namespace o3tl;
using namespace utl;
-typedef com::sun::star::util::Date UNODate;
-typedef com::sun::star::util::Time UNOTime;
-typedef com::sun::star::util::DateTime UNODateTime;
-
Convert::Convert()
: maMap()
{
@@ -110,7 +106,7 @@ namespace
}
- OUString lcl_toXSD_UNODate_typed( const UNODate& rDate )
+ OUString lcl_toXSD_UNODate_typed( const css::util::Date& rDate )
{
OUStringBuffer sInfo;
@@ -126,15 +122,15 @@ namespace
OUString lcl_toXSD_UNODate( const Any& rAny )
{
- UNODate aDate;
+ css::util::Date aDate;
OSL_VERIFY( rAny >>= aDate );
return lcl_toXSD_UNODate_typed( aDate );
}
- UNODate lcl_toUNODate( const OUString& rString )
+ css::util::Date lcl_toUNODate( const OUString& rString )
{
- UNODate aDate( 1, 1, 1900 );
+ css::util::Date aDate( 1, 1, 1900 );
bool bWellformed = ISO8601parseDate(rString, aDate);
@@ -150,7 +146,7 @@ namespace
// all okay?
if ( !bWellformed )
- return UNODate( 1, 1, 1900 );
+ return css::util::Date( 1, 1, 1900 );
return aDate;
}
@@ -162,7 +158,7 @@ namespace
}
- OUString lcl_toXSD_UNOTime_typed( const UNOTime& rTime )
+ OUString lcl_toXSD_UNOTime_typed( const css::util::Time& rTime )
{
OUStringBuffer sInfo;
@@ -188,15 +184,15 @@ namespace
OUString lcl_toXSD_UNOTime( const Any& rAny )
{
- UNOTime aTime;
+ css::util::Time aTime;
OSL_VERIFY( rAny >>= aTime );
return lcl_toXSD_UNOTime_typed( aTime );
}
- UNOTime lcl_toUNOTime( const OUString& rString )
+ css::util::Time lcl_toUNOTime( const OUString& rString )
{
- UNOTime aTime;
+ css::util::Time aTime;
bool bWellformed = ISO8601parseTime(rString, aTime);
@@ -220,7 +216,7 @@ namespace
// all okay?
if ( !bWellformed )
- return UNOTime();
+ return css::util::Time();
return aTime;
}
@@ -234,13 +230,13 @@ namespace
OUString lcl_toXSD_UNODateTime( const Any& rAny )
{
- UNODateTime aDateTime;
+ css::util::DateTime aDateTime;
OSL_VERIFY( rAny >>= aDateTime );
- UNODate aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
+ css::util::Date aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
OUString sDate = lcl_toXSD_UNODate_typed( aDate );
- UNOTime const aTime( aDateTime.NanoSeconds, aDateTime.Seconds,
+ css::util::Time const aTime( aDateTime.NanoSeconds, aDateTime.Seconds,
aDateTime.Minutes, aDateTime.Hours, aDateTime.IsUTC);
OUString sTime = lcl_toXSD_UNOTime_typed( aTime );
@@ -256,8 +252,8 @@ namespace
if ( nDateTimeSep == -1 )
nDateTimeSep = rString.indexOf( 't' );
- UNODate aDate;
- UNOTime aTime;
+ css::util::Date aDate;
+ css::util::Time aTime;
if ( nDateTimeSep == -1 )
{ // no time part
aDate = lcl_toUNODate( rString );
@@ -267,7 +263,7 @@ namespace
aDate = lcl_toUNODate( rString.copy( 0, nDateTimeSep ) );
aTime = lcl_toUNOTime( rString.copy( nDateTimeSep + 1 ) );
}
- UNODateTime aDateTime(
+ css::util::DateTime aDateTime(
aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
aDate.Day, aDate.Month, aDate.Year, aTime.IsUTC
);
@@ -281,9 +277,9 @@ void Convert::init()
ADD_ENTRY( this, OUString );
ADD_ENTRY( this, bool );
ADD_ENTRY( this, double );
- ADD_ENTRY( this, UNODate );
- ADD_ENTRY( this, UNOTime );
- ADD_ENTRY( this, UNODateTime );
+ maMap[ cppu::UnoType<css::util::Date>::get() ] = Convert_t( &lcl_toXSD_UNODate, &lcl_toAny_UNODate );
+ maMap[ cppu::UnoType<css::util::Time>::get() ] = Convert_t( &lcl_toXSD_UNOTime, &lcl_toAny_UNOTime );
+ maMap[ cppu::UnoType<css::util::DateTime>::get() ] = Convert_t( &lcl_toXSD_UNODateTime, &lcl_toAny_UNODateTime );
}