summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-08-05 15:50:45 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2013-08-06 12:19:10 +0200
commit14094d3753f8b4aa10a48d0f788d915c33630077 (patch)
tree0205bb370f29d79453eeb29ae7f70966d8ecd656
parente8059e4d37472c7db23e4522fcca0a48338b2f5e (diff)
Adapt UnoControlModel::read/write
...to 8ee69b0ba13f74d1515fac71df92947eb6328ab1 "fdo#67235 adapt form control code to time nanosecond API change, step 3." It is a bit unclear to me how exactly this code is used, so to be safe, just read and write in the old format (of using a single integer to represent a Date resp. Time) at least for now, loosing nanosecond precision and the UTC flag. Change-Id: Ib5148f750a420ad09366c79b68370ad0efd501f4
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 0578e2c81db0..782922bb5464 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -627,6 +627,21 @@ void UnoControlModel::write( const ::com::sun::star::uno::Reference< ::com::sun:
OutStream->writeBoolean( aFD.WordLineMode );
OutStream->writeShort( aFD.Type );
}
+ else if ( rType == cppu::UnoType<css::util::Date>::get() )
+ {
+ css::util::Date d;
+ rValue >>= d;
+ OutStream->writeLong(d.Day + 100 * d.Month + 10000 * d.Year);
+ // YYYYMMDD
+ }
+ else if ( rType == cppu::UnoType<css::util::Time>::get() )
+ {
+ css::util::Time t;
+ rValue >>= t;
+ OutStream->writeLong(
+ t.NanoSeconds / 1000000 + 100 * t.Seconds
+ + 10000 * t.Minutes + 1000000 * t.Hours); // HHMMSShh
+ }
else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence< OUString>*)0 ) )
{
::com::sun::star::uno::Sequence< OUString> aSeq;
@@ -829,6 +844,19 @@ void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun::
aFD.Type = InStream->readShort();
aValue <<= aFD;
}
+ else if ( *pType == cppu::UnoType<css::util::Date>::get() )
+ {
+ sal_Int32 n = InStream->readLong(); // YYYYMMDD
+ aValue <<= css::util::Date(
+ n % 100, (n / 100) % 100, n / 10000);
+ }
+ else if ( *pType == cppu::UnoType<css::util::Time>::get() )
+ {
+ sal_Int32 n = InStream->readLong(); // HHMMSShh
+ aValue <<= css::util::Time(
+ (n % 100) * 1000000, (n / 100) % 100, (n / 10000) % 100,
+ n / 1000000, false);
+ }
else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence< OUString>*)0 ) )
{
long nEntries = InStream->readLong();