summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-08-04 01:14:22 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2013-08-04 06:51:31 +0000
commit8ee69b0ba13f74d1515fac71df92947eb6328ab1 (patch)
tree5d5e95bb877e5e961cd02eee47011548af94bca1 /xmloff
parentaa5683e18de07c9e86325595ead4574efa685c3a (diff)
fdo#67235 adapt form control code to time nanosecond API change, step 3
Change-Id: I4899c89ee5b2a54c9c05b531ab284365f1558e3d Reviewed-on: https://gerrit.libreoffice.org/5270 Tested-by: Lionel Elie Mamane <lionel@mamane.lu> Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/forms/handler/vcl_date_handler.cxx25
-rw-r--r--xmloff/source/forms/handler/vcl_time_handler.cxx28
2 files changed, 29 insertions, 24 deletions
diff --git a/xmloff/source/forms/handler/vcl_date_handler.cxx b/xmloff/source/forms/handler/vcl_date_handler.cxx
index a1ac74ec265b..b3ff4f744e8d 100644
--- a/xmloff/source/forms/handler/vcl_date_handler.cxx
+++ b/xmloff/source/forms/handler/vcl_date_handler.cxx
@@ -23,6 +23,7 @@
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
#include <sax/tools/converter.hxx>
@@ -37,6 +38,7 @@ namespace xmloff
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::makeAny;
using ::com::sun::star::util::DateTime;
+ using ::com::sun::star::util::Date;
//==================================================================================================================
//= VCLDateHandler
@@ -56,14 +58,13 @@ namespace xmloff
//------------------------------------------------------------------------------------------------------------------
OUString VCLDateHandler::getAttributeValue( const Any& i_propertyValue ) const
{
- sal_Int32 nVCLDate(0);
- OSL_VERIFY( i_propertyValue >>= nVCLDate );
- ::Date aVCLDate( nVCLDate );
+ Date aDate;
+ OSL_VERIFY( i_propertyValue >>= aDate );
DateTime aDateTime; // default-inited to 0
- aDateTime.Day = aVCLDate.GetDay();
- aDateTime.Month = aVCLDate.GetMonth();
- aDateTime.Year = aVCLDate.GetYear();
+ aDateTime.Day = aDate.Day;
+ aDateTime.Month = aDate.Month;
+ aDateTime.Year = aDate.Year;
OUStringBuffer aBuffer;
::sax::Converter::convertDateTime( aBuffer, aDateTime, 0, false );
@@ -73,25 +74,27 @@ namespace xmloff
//------------------------------------------------------------------------------------------------------------------
bool VCLDateHandler::getPropertyValues( const OUString i_attributeValue, PropertyValues& o_propertyValues ) const
{
- sal_Int32 nVCLDate(0);
-
DateTime aDateTime;
+ Date aDate;
if (::sax::Converter::parseDateTime( aDateTime, 0, i_attributeValue ))
{
- ::Date aVCLDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
- nVCLDate = aVCLDate.GetDate();
+ aDate.Day = aDateTime.Day;
+ aDate.Month = aDateTime.Month;
+ aDate.Year = aDateTime.Year;
}
else
{
// compatibility format, before we wrote those values in XML-schema compatible form
+ sal_Int32 nVCLDate(0);
if (!::sax::Converter::convertNumber(nVCLDate, i_attributeValue))
{
OSL_ENSURE( false, "VCLDateHandler::getPropertyValues: unknown date format (no XML-schema date, no legacy integer)!" );
return false;
}
+ aDate = ::Date(nVCLDate).GetUNODate();
}
- const Any aPropertyValue( makeAny( nVCLDate ) );
+ const Any aPropertyValue( makeAny( aDate ) );
OSL_ENSURE( o_propertyValues.size() == 1, "VCLDateHandler::getPropertyValues: date strings represent exactly one property - not more, not less!" );
for ( PropertyValues::iterator prop = o_propertyValues.begin();
diff --git a/xmloff/source/forms/handler/vcl_time_handler.cxx b/xmloff/source/forms/handler/vcl_time_handler.cxx
index b50806018661..bbf9698d7c49 100644
--- a/xmloff/source/forms/handler/vcl_time_handler.cxx
+++ b/xmloff/source/forms/handler/vcl_time_handler.cxx
@@ -23,6 +23,7 @@
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/util/Duration.hpp>
+#include <com/sun/star/util/Time.hpp>
#include <sax/tools/converter.hxx>
@@ -37,6 +38,7 @@ namespace xmloff
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::makeAny;
using ::com::sun::star::util::Duration;
+ using ::com::sun::star::util::Time;
//==================================================================================================================
//= VCLTimeHandler
@@ -56,15 +58,14 @@ namespace xmloff
//------------------------------------------------------------------------------------------------------------------
OUString VCLTimeHandler::getAttributeValue( const Any& i_propertyValue ) const
{
- sal_Int64 nVCLTime(0);
- OSL_VERIFY( i_propertyValue >>= nVCLTime );
- ::Time aVCLTime( nVCLTime );
+ Time aTime;
+ OSL_VERIFY( i_propertyValue >>= aTime );
Duration aDuration; // default-inited to 0
- aDuration.Hours = aVCLTime.GetHour();
- aDuration.Minutes = aVCLTime.GetMin();
- aDuration.Seconds = aVCLTime.GetSec();
- aDuration.NanoSeconds = aVCLTime.GetNanoSec();
+ aDuration.Hours = aTime.Hours;
+ aDuration.Minutes = aTime.Minutes;
+ aDuration.Seconds = aTime.Seconds;
+ aDuration.NanoSeconds = aTime.NanoSeconds;
OUStringBuffer aBuffer;
::sax::Converter::convertDuration( aBuffer, aDuration );
@@ -74,18 +75,18 @@ namespace xmloff
//------------------------------------------------------------------------------------------------------------------
bool VCLTimeHandler::getPropertyValues( const OUString i_attributeValue, PropertyValues& o_propertyValues ) const
{
- sal_Int64 nVCLTime(0);
-
Duration aDuration;
+ Time aTime;
if (::sax::Converter::convertDuration( aDuration, i_attributeValue ))
{
- ::Time aVCLTime(aDuration.Hours, aDuration.Minutes,
- aDuration.Seconds, aDuration.NanoSeconds);
- nVCLTime = aVCLTime.GetTime();
+ aTime = Time(aDuration.NanoSeconds, aDuration.Seconds,
+ aDuration.Minutes, aDuration.Hours,
+ false);
}
else
{
// compatibility format, before we wrote those values in XML-schema compatible form
+ sal_Int64 nVCLTime(0);
if (!::sax::Converter::convertNumber64(nVCLTime, i_attributeValue))
{
OSL_ENSURE( false, "VCLTimeHandler::getPropertyValues: unknown time format (no XML-schema time, no legacy integer)!" );
@@ -93,9 +94,10 @@ namespace xmloff
}
// legacy integer was in centiseconds
nVCLTime *= ::Time::nanoPerCenti;
+ aTime = ::Time(nVCLTime).GetUNOTime();
}
- const Any aPropertyValue( makeAny( nVCLTime ) );
+ const Any aPropertyValue( makeAny( aTime ) );
OSL_ENSURE( o_propertyValues.size() == 1, "VCLTimeHandler::getPropertyValues: time strings represent exactly one property - not more, not less!" );
for ( PropertyValues::iterator prop = o_propertyValues.begin();