diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-08-05 15:50:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-08-05 16:07:12 +0200 |
commit | 700d1cab988524b28c7ce773cf473f42d7741001 (patch) | |
tree | 88073499bcdbdc08a5ce7c1453aa122ecf0ccac7 /toolkit | |
parent | 259aa8368453f07e68c2ed814edc703da3ba1353 (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
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/controls/unocontrolmodel.cxx | 28 |
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(); |