[Libreoffice-commits] core.git: toolkit/source
Stephan Bergmann
sbergman at redhat.com
Mon Aug 5 07:07:55 PDT 2013
toolkit/source/controls/unocontrolmodel.cxx | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
New commits:
commit 700d1cab988524b28c7ce773cf473f42d7741001
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Aug 5 15:50:45 2013 +0200
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
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 0578e2c..782922b 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();
More information about the Libreoffice-commits
mailing list