[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - basic/source include/basic wizards/source

Lionel Elie Mamane lionel at mamane.lu
Fri Sep 13 02:26:59 PDT 2013


 basic/source/classes/propacc.cxx  |    9 -
 basic/source/classes/sbunoobj.cxx |   11 --
 basic/source/classes/sbxmod.cxx   |    3 
 basic/source/inc/date.hxx         |   15 ++
 basic/source/runtime/methods.cxx  |  200 ++++++++++++++++++++++++++++++++++++--
 basic/source/runtime/methods1.cxx |    4 
 basic/source/runtime/rtlproto.hxx |    6 +
 basic/source/runtime/stdobj.cxx   |   12 ++
 basic/source/sbx/sbxvalue.cxx     |    2 
 include/basic/sbuno.hxx           |    6 -
 include/basic/sbxvar.hxx          |    2 
 wizards/source/depot/Depot.xba    |   20 +--
 wizards/source/depot/Internet.xba |    8 -
 13 files changed, 255 insertions(+), 43 deletions(-)

New commits:
commit c09bd7346f38b5c2f4048fa3e613883690b98c51
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Mon Sep 9 20:00:48 2013 +0200

    Easier conversion between Basic Date and UNO Date/Time
    
    Utility functions to convert between Basic Date type
    and the representations of Date and Time in UNO, namely:
     - com.sun.star.util.Date
     - com.sun.star.util.Time
     - com.sun.star.util.DateTime
    
    Name of new functions:
     - CDateToUnoDate
     - CDateFromUnoDate
     - CDateToUnoTime
     - CDateFromUnoTime
     - CDateToUnoDateTime
     - CDateFromUnoDateTime
    
    Change-Id: I2b971df20df1c0351d071023e042169b548894f1
    Reviewed-on: https://gerrit.libreoffice.org/5897
    Reviewed-by: Noel Power <noel.power at suse.com>
    Tested-by: Noel Power <noel.power at suse.com>
    Reviewed-on: https://gerrit.libreoffice.org/5919

diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 67cd65a..d4cc1e7 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -22,6 +22,7 @@
 
 #include <basic/sbstar.hxx>
 #include <sbunoobj.hxx>
+#include <basic/sbuno.hxx>
 
 using com::sun::star::uno::Reference;
 using namespace com::sun::star;
@@ -30,14 +31,6 @@ using namespace com::sun::star::lang;
 using namespace com::sun::star::beans;
 using namespace cppu;
 
-
-//========================================================================
-
-// Declaration conversion from Sbx to UNO with known target type
-Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty = NULL );
-
-//========================================================================
-
 #ifdef WNT
 #define CDECL _cdecl
 #endif
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 001df2a..fbc0f58 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -896,7 +896,7 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
 }
 
 // Converting of Sbx to Uno without a know target class for TypeClass_ANY
-Type getUnoTypeForSbxValue( SbxValue* pVal )
+Type getUnoTypeForSbxValue( const SbxValue* pVal )
 {
     Type aRetType = getCppuVoidType();
     if( !pVal )
@@ -1025,11 +1025,8 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
     return aRetType;
 }
 
-// Declaration converting of Sbx to Uno with known target class
-Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty = NULL );
-
 // converting of Sbx to Uno without known target class for TypeClass_ANY
-Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType = false )
+Any sbxToUnoValueImpl( const SbxValue* pVar, bool bBlockConversionToSmallestType = false )
 {
     SbxDataType eBaseType = pVar->SbxValue::GetType();
     if( eBaseType == SbxOBJECT )
@@ -1193,7 +1190,7 @@ static Any implRekMultiDimArrayToSequence( SbxDimArray* pArray,
 }
 
 // Map old interface
-Any sbxToUnoValue( SbxVariable* pVar )
+Any sbxToUnoValue( const SbxValue* pVar )
 {
     return sbxToUnoValueImpl( pVar );
 }
@@ -1222,7 +1219,7 @@ static bool implGetTypeByName( const OUString& rName, Type& rRetType )
 
 
 // converting of Sbx to Uno with known target class
-Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty )
+Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProperty )
 {
     Any aRetVal;
 
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 28d10e2..0a1e338 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -25,6 +25,7 @@
 #include <svl/brdcst.hxx>
 #include <tools/shl.hxx>
 #include <basic/sbx.hxx>
+#include <basic/sbuno.hxx>
 #include "sbdiagnose.hxx"
 #include "sb.hxx"
 #include <sbjsmeth.hxx>
@@ -86,8 +87,6 @@ using namespace com::sun::star::uno;
 
 typedef ::cppu::WeakImplHelper1< XInvocation > DocObjectWrapper_BASE;
 typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
-::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
-void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
 
 class DocObjectWrapper : public DocObjectWrapper_BASE
 {
diff --git a/basic/source/inc/date.hxx b/basic/source/inc/date.hxx
index cd38c89..cb70702 100644
--- a/basic/source/inc/date.hxx
+++ b/basic/source/inc/date.hxx
@@ -20,7 +20,15 @@
 #ifndef _SBDATE_HXX
 #define _SBDATE_HXX
 
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
 bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet );
+double implTimeSerial( sal_Int16 nHour, sal_Int16 nMinute, sal_Int16 nSecond);
+bool implDateTimeSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay,
+                         sal_Int16 nHour, sal_Int16 nMinute, sal_Int16 nSecond,
+                         double& rdRet );
 
 sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 );
 
@@ -32,6 +40,13 @@ sal_Int16 implGetHour( double dDate );
 sal_Int16 implGetMinute( double dDate );
 sal_Int16 implGetSecond( double dDate );
 
+::com::sun::star::util::Date SbxDateToUNODate( const SbxValue* );
+void SbxDateFromUNODate( SbxValue*, const ::com::sun::star::util::Date& );
+::com::sun::star::util::Time SbxDateToUNOTime( const SbxValue* );
+void SbxDateFromUNOTime( SbxValue*, const ::com::sun::star::util::Time& );
+::com::sun::star::util::DateTime SbxDateToUNODateTime( const SbxValue* );
+void SbxDateFromUNODateTime( SbxValue*, const ::com::sun::star::util::DateTime& );
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 4a94763..200b7b7 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -19,6 +19,7 @@
 
 #include <tools/date.hxx>
 #include <basic/sbxvar.hxx>
+#include <basic/sbuno.hxx>
 #include <osl/process.h>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
@@ -1856,6 +1857,177 @@ sal_Int16 implGetDateMonth( double aDate )
     return nRet;
 }
 
+::com::sun::star::util::Date SbxDateToUNODate( const SbxValue* const pVal )
+{
+    double aDate = pVal->GetDate();
+
+    com::sun::star::util::Date aUnoDate;
+    aUnoDate.Day   = implGetDateDay  ( aDate );
+    aUnoDate.Month = implGetDateMonth( aDate );
+    aUnoDate.Year  = implGetDateYear ( aDate );
+
+    return aUnoDate;
+}
+
+void SbxDateFromUNODate( SbxValue *pVal, const ::com::sun::star::util::Date& aUnoDate)
+{
+    double dDate;
+    if( implDateSerial( aUnoDate.Year, aUnoDate.Month, aUnoDate.Day, dDate ) )
+    {
+        pVal->PutDate( dDate );
+    }
+}
+
+// Function to convert date to UNO date (com.sun.star.util.Date)
+RTLFUNC(CDateToUnoDate)
+{
+    (void)pBasic;
+    (void)bWrite;
+
+    if ( rPar.Count() != 2 )
+    {
+        StarBASIC::Error( SbERR_BAD_ARGUMENT );
+        return;
+    }
+
+    unoToSbxValue(rPar.Get(0), Any(SbxDateToUNODate(rPar.Get(1))));
+}
+
+// Function to convert date from UNO date (com.sun.star.util.Date)
+RTLFUNC(CDateFromUnoDate)
+{
+    (void)pBasic;
+    (void)bWrite;
+
+    if ( rPar.Count() != 2 || rPar.Get(1)->GetType() != SbxOBJECT )
+    {
+        StarBASIC::Error( SbERR_BAD_ARGUMENT );
+        return;
+    }
+
+    Any aAny (sbxToUnoValue(rPar.Get(1), ::getCppuType( (com::sun::star::util::Date*)0 )));
+    com::sun::star::util::Date aUnoDate;
+    if(aAny >>= aUnoDate)
+        SbxDateFromUNODate(rPar.Get(0), aUnoDate);
+    else
+        SbxBase::SetError( SbxERR_CONVERSION );
+}
+
+::com::sun::star::util::Time SbxDateToUNOTime( const SbxValue* const pVal )
+{
+    double aDate = pVal->GetDate();
+
+    com::sun::star::util::Time aUnoTime;
+    aUnoTime.Hours       = implGetHour      ( aDate );
+    aUnoTime.Minutes     = implGetMinute    ( aDate );
+    aUnoTime.Seconds     = implGetSecond    ( aDate );
+    aUnoTime.NanoSeconds = 0;
+
+    return aUnoTime;
+}
+
+void SbxDateFromUNOTime( SbxValue *pVal, const ::com::sun::star::util::Time& aUnoTime)
+{
+    pVal->PutDate( implTimeSerial(aUnoTime.Hours, aUnoTime.Minutes, aUnoTime.Seconds) );
+}
+
+// Function to convert date to UNO time (com.sun.star.util.Time)
+RTLFUNC(CDateToUnoTime)
+{
+    (void)pBasic;
+    (void)bWrite;
+
+    if ( rPar.Count() != 2 )
+    {
+        StarBASIC::Error( SbERR_BAD_ARGUMENT );
+        return;
+    }
+
+    unoToSbxValue(rPar.Get(0), Any(SbxDateToUNOTime(rPar.Get(1))));
+}
+
+// Function to convert date from UNO time (com.sun.star.util.Time)
+RTLFUNC(CDateFromUnoTime)
+{
+    (void)pBasic;
+    (void)bWrite;
+
+    if ( rPar.Count() != 2 || rPar.Get(1)->GetType() != SbxOBJECT )
+    {
+        StarBASIC::Error( SbERR_BAD_ARGUMENT );
+        return;
+    }
+
+    Any aAny (sbxToUnoValue(rPar.Get(1), ::getCppuType( (com::sun::star::util::Time*)0 )));
+    com::sun::star::util::Time aUnoTime;
+    if(aAny >>= aUnoTime)
+        SbxDateFromUNOTime(rPar.Get(0), aUnoTime);
+    else
+        SbxBase::SetError( SbxERR_CONVERSION );
+}
+
+::com::sun::star::util::DateTime SbxDateToUNODateTime( const SbxValue* const pVal )
+{
+    double aDate = pVal->GetDate();
+
+    com::sun::star::util::DateTime aUnoDT;
+    aUnoDT.Day   = implGetDateDay  ( aDate );
+    aUnoDT.Month = implGetDateMonth( aDate );
+    aUnoDT.Year  = implGetDateYear ( aDate );
+    aUnoDT.Hours       = implGetHour      ( aDate );
+    aUnoDT.Minutes     = implGetMinute    ( aDate );
+    aUnoDT.Seconds     = implGetSecond    ( aDate );
+    aUnoDT.NanoSeconds = 0;
+
+    return aUnoDT;
+}
+
+void SbxDateFromUNODateTime( SbxValue *pVal, const ::com::sun::star::util::DateTime& aUnoDT)
+{
+    double dDate;
+    if( implDateTimeSerial( aUnoDT.Year, aUnoDT.Month, aUnoDT.Day,
+                            aUnoDT.Hours, aUnoDT.Minutes, aUnoDT.Seconds,
+                            dDate ) )
+    {
+        pVal->PutDate( dDate );
+    }
+}
+
+// Function to convert date to UNO date (com.sun.star.util.Date)
+RTLFUNC(CDateToUnoDateTime)
+{
+    (void)pBasic;
+    (void)bWrite;
+
+    if ( rPar.Count() != 2 )
+    {
+        StarBASIC::Error( SbERR_BAD_ARGUMENT );
+        return;
+    }
+
+    unoToSbxValue(rPar.Get(0), Any(SbxDateToUNODateTime(rPar.Get(1))));
+}
+
+// Function to convert date from UNO date (com.sun.star.util.Date)
+RTLFUNC(CDateFromUnoDateTime)
+{
+    (void)pBasic;
+    (void)bWrite;
+
+    if ( rPar.Count() != 2 || rPar.Get(1)->GetType() != SbxOBJECT )
+    {
+        StarBASIC::Error( SbERR_BAD_ARGUMENT );
+        return;
+    }
+
+    Any aAny (sbxToUnoValue(rPar.Get(1), ::getCppuType( (com::sun::star::util::DateTime*)0 )));
+    com::sun::star::util::DateTime aUnoDT;
+    if(aAny >>= aUnoDT)
+        SbxDateFromUNODateTime(rPar.Get(0), aUnoDT);
+    else
+        SbxBase::SetError( SbxERR_CONVERSION );
+}
+
 // Function to convert date to ISO 8601 date format
 RTLFUNC(CDateToIso)
 {
@@ -1953,12 +2125,7 @@ RTLFUNC(TimeSerial)
         return;
     }
 
-    sal_Int32 nSeconds = nHour;
-    nSeconds *= 3600;
-    nSeconds += nMinute * 60;
-    nSeconds += nSecond;
-    double nDays = ((double)nSeconds) / (double)(86400.0);
-    rPar.Get(0)->PutDate( nDays ); // JSM
+    rPar.Get(0)->PutDate( implTimeSerial(nHour, nMinute, nSecond) ); // JSM
 }
 
 RTLFUNC(DateValue)
@@ -4805,6 +4972,27 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double&
     return true;
 }
 
+double implTimeSerial( sal_Int16 nHours, sal_Int16 nMinutes, sal_Int16 nSeconds )
+{
+    return
+        static_cast<double>( nHours * ::Time::secondPerHour +
+                             nMinutes * ::Time::secondPerMinute +
+                             nSeconds)
+        /
+        static_cast<double>( ::Time::secondPerDay );
+}
+
+bool implDateTimeSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay,
+                         sal_Int16 nHour, sal_Int16 nMinute, sal_Int16 nSecond,
+                         double& rdRet )
+{
+    double dDate;
+    if(!implDateSerial(nYear, nMonth, nDay, dDate))
+        return false;
+    rdRet += dDate + implTimeSerial(nHour, nMinute, nSecond);
+    return true;
+}
+
 sal_Int16 implGetMinute( double dDate )
 {
     if( dDate < 0.0 )
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 5847754..ae0c99a 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -33,6 +33,7 @@
 #include <osl/file.hxx>
 #include <vcl/jobset.hxx>
 #include <basic/sbobjmod.hxx>
+#include <basic/sbuno.hxx>
 
 #include "date.hxx"
 #include "sbintern.hxx"
@@ -60,9 +61,6 @@ using namespace com::sun::star::lang;
 using namespace com::sun::star::sheet;
 using namespace com::sun::star::uno;
 
-void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
-Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL );
-
 static Reference< XCalendar3 > getLocaleCalendar( void )
 {
     static Reference< XCalendar3 > xCalendar;
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index ccf0a3b..7a6a9d8 100644
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -347,6 +347,12 @@ extern RTLFUNC(GlobalScope);
 extern RTLFUNC(FileExists);
 extern RTLFUNC(ConvertToUrl);
 extern RTLFUNC(ConvertFromUrl);
+extern RTLFUNC(CDateToUnoDate);
+extern RTLFUNC(CDateFromUnoDate);
+extern RTLFUNC(CDateToUnoTime);
+extern RTLFUNC(CDateFromUnoTime);
+extern RTLFUNC(CDateToUnoDateTime);
+extern RTLFUNC(CDateFromUnoDateTime);
 extern RTLFUNC(CDateToIso);
 extern RTLFUNC(CDateFromIso);
 extern RTLFUNC(CompatibilityMode);
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 0815804..34d4582 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -108,6 +108,18 @@ static Methods aMethods[] = {
   { "expression",   SbxVARIANT, 0,NULL,0 },
 { "CDate",          SbxDATE,      1 | _FUNCTION, RTLNAME(CDate),0           },
   { "expression",   SbxVARIANT, 0,NULL,0 },
+{ "CDateFromUnoDate",   SbxDATE,      1 | _FUNCTION, RTLNAME(CDateFromUnoDate),0    },
+  { "UnoDate",      SbxOBJECT, 0,NULL,0 },
+{ "CDateToUnoDate", SbxOBJECT,    1 | _FUNCTION, RTLNAME(CDateToUnoDate),0      },
+  { "Date",         SbxDATE, 0,NULL,0 },
+{ "CDateFromUnoTime",   SbxDATE,      1 | _FUNCTION, RTLNAME(CDateFromUnoTime),0    },
+  { "UnoTime",      SbxOBJECT, 0,NULL,0 },
+{ "CDateToUnoTime", SbxOBJECT,    1 | _FUNCTION, RTLNAME(CDateToUnoTime),0      },
+  { "Time",         SbxDATE, 0,NULL,0 },
+{ "CDateFromUnoDateTime",   SbxDATE,      1 | _FUNCTION, RTLNAME(CDateFromUnoDateTime),0    },
+  { "UnoDateTime",      SbxOBJECT, 0,NULL,0 },
+{ "CDateToUnoDateTime", SbxOBJECT,    1 | _FUNCTION, RTLNAME(CDateToUnoDateTime),0      },
+  { "DateTime",         SbxDATE, 0,NULL,0 },
 { "CDateFromIso",   SbxDATE,      1 | _FUNCTION, RTLNAME(CDateFromIso),0    },
   { "IsoDate",      SbxSTRING, 0,NULL,0 },
 { "CDateToIso",     SbxSTRING,    1 | _FUNCTION, RTLNAME(CDateToIso),0      },
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 3efbdab..2f9e969 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -663,7 +663,7 @@ sal_Bool SbxValue::PutDecimal( com::sun::star::bridge::oleautomation::Decimal& r
 }
 
 sal_Bool SbxValue::fillAutomationDecimal
-    ( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec )
+    ( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) const
 {
     SbxDecimal* pDecimal = GetDecimal();
     if( pDecimal != NULL )
diff --git a/include/basic/sbuno.hxx b/include/basic/sbuno.hxx
index 55d487a..3014869 100644
--- a/include/basic/sbuno.hxx
+++ b/include/basic/sbuno.hxx
@@ -20,6 +20,9 @@
 #ifndef _SB_SBUNO_HXX
 #define _SB_SBUNO_HXX
 
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Type.hxx>
 #include <basic/sbxobj.hxx>
 #include "basicdllapi.h"
 
@@ -33,7 +36,8 @@ BASIC_DLLPUBLIC SbxObjectRef GetSbUnoObject( const OUString& aName, const com::s
 BASIC_DLLPUBLIC void createAllObjectProperties( SbxObject* pObj );
 BASIC_DLLPUBLIC void SetSbUnoObjectDfltPropName( SbxObject* pObj );
 
-BASIC_DLLPUBLIC ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
+BASIC_DLLPUBLIC ::com::sun::star::uno::Any sbxToUnoValue( const SbxValue* pVar );
+BASIC_DLLPUBLIC ::com::sun::star::uno::Any sbxToUnoValue( const SbxValue* pVar, const ::com::sun::star::uno::Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL );
 
 BASIC_DLLPUBLIC void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
 
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
index 4d4a8b6..a81836f 100644
--- a/include/basic/sbxvar.hxx
+++ b/include/basic/sbxvar.hxx
@@ -189,7 +189,7 @@ public:
             // Special methods
     sal_Bool PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
     sal_Bool PutDecimal( SbxDecimal* pDecimal ); // This function is needed for Windows build, don't remove
-    sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
+    sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) const;
     sal_Bool PutCurrency( const sal_Int64& );
             // Interface for CDbl in Basic
     static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );
diff --git a/wizards/source/depot/Depot.xba b/wizards/source/depot/Depot.xba
index 73f81a1..6a8b141 100644
--- a/wizards/source/depot/Depot.xba
+++ b/wizards/source/depot/Depot.xba
@@ -129,7 +129,7 @@ Dim LocStockName as String
 		End If
 	End If
 	CurRate = TransactModel.txtRate.Value
-	TransactDate = CDateFromISO(TransactModel.txtDate.Date)
+	TransactDate = CDateFromUNODate(TransactModel.txtDate.Date)
 	DlgTransaction.EndExecute()
 	UnprotectSheets(oSheets)
 
@@ -148,7 +148,7 @@ Dim LocStockName as String
 		oMovementSheet.GetCellByPosition(SBCOLUMNQUANTITY2, iNewRow).Value = -TransactModel.txtQuantity.Value
 	End If
 	
-	oMovementSheet.GetCellByPosition(SBCOLUMNDATE2, iNewRow).Value = CDateFromISO(TransactModel.txtDate.Date)
+	oMovementSheet.GetCellByPosition(SBCOLUMNDATE2, iNewRow).Value = CDateFromUNODate(TransactModel.txtDate.Date)
 	oMovementSheet.GetCellByPosition(SBCOLUMNRATE2, iNewRow).Value = TransactModel.txtRate.Value
 	oMovementSheet.GetCellByPosition(SBCOLUMNPROVPERCENT2, iNewRow).Value = TransactModel.txtCommission.EffectiveValue
 	oMovementSheet.GetCellByPosition(SBCOLUMNPROVMIN2, iNewRow).Value = TransactModel.txtMinimum.Value
@@ -290,7 +290,7 @@ Dim oModel as Object
 			' Store entered values in variables
 			OldNumber = oModel.txtOldRate.Value
 			NewNumber = oModel.txtNewRate.Value
-			SplitDate = CDateFromISO(oModel.txtDate.Date)
+			SplitDate = CDateFromUNODate(oModel.txtDate.Date)
 			iRow = SBROWFIRSTTRANSACT2
 			NoteText = cSplit & SplitDate & ", " & oModel.txtOldRate.Value & oModel.lblColon.Label & oModel.txtNewRate.Value
 			Do 
@@ -398,8 +398,8 @@ End Sub
 Sub SetupTransactionControls(CurStep as Integer)
 	DlgReference = DlgTransaction
 	With TransactModel
-		.txtDate.Date = CDateToISO(Date())
-		.txtDate.DateMax = CDateToISO(Date())
+		.txtDate.Date = CDateToUNODate(Date())
+		.txtDate.DateMax = CDateToUNODate(Date())
 		.txtStockID.Enabled = False
 		.lblStockID.Enabled = False
 		.lblStockID.Label = sCurStockIDLabel
@@ -504,12 +504,12 @@ Sub InitializeStockRatesControls(CurStep as Integer)
 			Case 2
 				.txtOldRate.Value = 1
 				.txtNewRate.Value = 1
-				.txtDate.Date = CDateToISO(Date())
+				.txtDate.Date = CDateToUNODate(Date())
 			Case 3
-				.txtStartDate.DateMax = CDateToISO(CDate(Date())-1)
-				.txtEndDate.DateMax = CDateToISO(CDate(Date())-1)
-				.txtStartDate.Date = CDateToISO(CDate(Date())-8)
-				.txtEndDate.Date = CDateToISO(CDate(Date())-1)
+				.txtStartDate.DateMax = CDateToUNODate(CDate(Date())-1)
+				.txtEndDate.DateMax = CDateToUNODate(CDate(Date())-1)
+				.txtStartDate.Date = CDateToUNODate(CDate(Date())-8)
+				.txtEndDate.Date = CDateToUNODate(CDate(Date())-1)
 				.optDaily.State = 1
 		End Select
 	End With
diff --git a/wizards/source/depot/Internet.xba b/wizards/source/depot/Internet.xba
index 3e57f0a..b4bcf57 100644
--- a/wizards/source/depot/Internet.xba
+++ b/wizards/source/depot/Internet.xba
@@ -25,8 +25,8 @@ Function CheckHistoryControls()
 Dim bLocGoOn as Boolean
 Dim Firstdate as Date
 Dim LastDate as Date
-	LastDate = CDateFromISO(StockRatesModel.txtEndDate.Date)
-	FirstDate = CDateFromISO(StockRatesModel.txtStartDate.Date)
+	LastDate = CDateFromUNODate(StockRatesModel.txtEndDate.Date)
+	FirstDate = CDateFromUNODate(StockRatesModel.txtStartDate.Date)
 	bLocGoOn = FirstDate <> 0 And LastDate <> 0
 	If bLocGoOn Then
 		If FirstDate >= LastDate Then
@@ -47,8 +47,8 @@ Dim oCell as Object
 Dim sStockID as String
 Dim ChartSource as String	
 	If CheckHistoryControls() Then
-		StartDate = CDateFromISO(StockRatesModel.txtStartDate.Date)
-		EndDate = CDateFromISO(StockRatesModel.txtEndDate.Date)
+		StartDate = CDateFromUNODate(StockRatesModel.txtStartDate.Date)
+		EndDate = CDateFromUNODate(StockRatesModel.txtEndDate.Date)
 		DlgStockRates.EndExecute()
 		If StockRatesModel.optDaily.State = 1 Then
 			sInterval = "d"


More information about the Libreoffice-commits mailing list