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@suse.com> Tested-by: Noel Power <noel.power@suse.com>
This commit is contained in:
committed by
Noel Power
parent
20238b8fa6
commit
b31f33bcc1
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <basic/sbstar.hxx>
|
#include <basic/sbstar.hxx>
|
||||||
#include <sbunoobj.hxx>
|
#include <sbunoobj.hxx>
|
||||||
|
#include <basic/sbuno.hxx>
|
||||||
|
|
||||||
#include <limits.h> // USHRT_MAX
|
#include <limits.h> // USHRT_MAX
|
||||||
|
|
||||||
@@ -32,14 +33,6 @@ using namespace com::sun::star::lang;
|
|||||||
using namespace com::sun::star::beans;
|
using namespace com::sun::star::beans;
|
||||||
using namespace cppu;
|
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
|
#ifdef WNT
|
||||||
#define CDECL _cdecl
|
#define CDECL _cdecl
|
||||||
#endif
|
#endif
|
||||||
|
@@ -897,7 +897,7 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Converting of Sbx to Uno without a know target class for TypeClass_ANY
|
// 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();
|
Type aRetType = getCppuVoidType();
|
||||||
if( !pVal )
|
if( !pVal )
|
||||||
@@ -1026,11 +1026,8 @@ Type getUnoTypeForSbxValue( SbxValue* pVal )
|
|||||||
return aRetType;
|
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
|
// 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();
|
SbxDataType eBaseType = pVar->SbxValue::GetType();
|
||||||
if( eBaseType == SbxOBJECT )
|
if( eBaseType == SbxOBJECT )
|
||||||
@@ -1194,7 +1191,7 @@ static Any implRekMultiDimArrayToSequence( SbxDimArray* pArray,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Map old interface
|
// Map old interface
|
||||||
Any sbxToUnoValue( SbxVariable* pVar )
|
Any sbxToUnoValue( const SbxValue* pVar )
|
||||||
{
|
{
|
||||||
return sbxToUnoValueImpl( pVar );
|
return sbxToUnoValueImpl( pVar );
|
||||||
}
|
}
|
||||||
@@ -1223,7 +1220,7 @@ static bool implGetTypeByName( const OUString& rName, Type& rRetType )
|
|||||||
|
|
||||||
|
|
||||||
// converting of Sbx to Uno with known target class
|
// 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;
|
Any aRetVal;
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include <svl/brdcst.hxx>
|
#include <svl/brdcst.hxx>
|
||||||
#include <tools/shl.hxx>
|
#include <tools/shl.hxx>
|
||||||
#include <basic/sbx.hxx>
|
#include <basic/sbx.hxx>
|
||||||
|
#include <basic/sbuno.hxx>
|
||||||
#include "sbdiagnose.hxx"
|
#include "sbdiagnose.hxx"
|
||||||
#include "sb.hxx"
|
#include "sb.hxx"
|
||||||
#include <sbjsmeth.hxx>
|
#include <sbjsmeth.hxx>
|
||||||
@@ -87,8 +88,6 @@ using namespace com::sun::star::uno;
|
|||||||
|
|
||||||
typedef ::cppu::WeakImplHelper1< XInvocation > DocObjectWrapper_BASE;
|
typedef ::cppu::WeakImplHelper1< XInvocation > DocObjectWrapper_BASE;
|
||||||
typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
|
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
|
class DocObjectWrapper : public DocObjectWrapper_BASE
|
||||||
{
|
{
|
||||||
|
@@ -20,7 +20,15 @@
|
|||||||
#ifndef _SBDATE_HXX
|
#ifndef _SBDATE_HXX
|
||||||
#define _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 );
|
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 );
|
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 implGetMinute( double dDate );
|
||||||
sal_Int16 implGetSecond( 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
|
#endif
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <tools/date.hxx>
|
#include <tools/date.hxx>
|
||||||
#include <basic/sbxvar.hxx>
|
#include <basic/sbxvar.hxx>
|
||||||
|
#include <basic/sbuno.hxx>
|
||||||
#include <osl/process.h>
|
#include <osl/process.h>
|
||||||
#include <vcl/dibtools.hxx>
|
#include <vcl/dibtools.hxx>
|
||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
@@ -1857,6 +1858,177 @@ sal_Int16 implGetDateMonth( double aDate )
|
|||||||
return nRet;
|
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
|
// Function to convert date to ISO 8601 date format
|
||||||
RTLFUNC(CDateToIso)
|
RTLFUNC(CDateToIso)
|
||||||
{
|
{
|
||||||
@@ -1954,12 +2126,7 @@ RTLFUNC(TimeSerial)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Int32 nSeconds = nHour;
|
rPar.Get(0)->PutDate( implTimeSerial(nHour, nMinute, nSecond) ); // JSM
|
||||||
nSeconds *= 3600;
|
|
||||||
nSeconds += nMinute * 60;
|
|
||||||
nSeconds += nSecond;
|
|
||||||
double nDays = ((double)nSeconds) / (double)(86400.0);
|
|
||||||
rPar.Get(0)->PutDate( nDays ); // JSM
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RTLFUNC(DateValue)
|
RTLFUNC(DateValue)
|
||||||
@@ -4809,6 +4976,27 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double&
|
|||||||
return true;
|
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 )
|
sal_Int16 implGetMinute( double dDate )
|
||||||
{
|
{
|
||||||
if( dDate < 0.0 )
|
if( dDate < 0.0 )
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
#include <vcl/jobset.hxx>
|
#include <vcl/jobset.hxx>
|
||||||
#include <basic/sbobjmod.hxx>
|
#include <basic/sbobjmod.hxx>
|
||||||
|
#include <basic/sbuno.hxx>
|
||||||
|
|
||||||
#include "date.hxx"
|
#include "date.hxx"
|
||||||
#include "sbintern.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::sheet;
|
||||||
using namespace com::sun::star::uno;
|
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 > getLocaleCalendar( void )
|
||||||
{
|
{
|
||||||
static Reference< XCalendar3 > xCalendar;
|
static Reference< XCalendar3 > xCalendar;
|
||||||
|
@@ -347,6 +347,12 @@ extern RTLFUNC(GlobalScope);
|
|||||||
extern RTLFUNC(FileExists);
|
extern RTLFUNC(FileExists);
|
||||||
extern RTLFUNC(ConvertToUrl);
|
extern RTLFUNC(ConvertToUrl);
|
||||||
extern RTLFUNC(ConvertFromUrl);
|
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(CDateToIso);
|
||||||
extern RTLFUNC(CDateFromIso);
|
extern RTLFUNC(CDateFromIso);
|
||||||
extern RTLFUNC(CompatibilityMode);
|
extern RTLFUNC(CompatibilityMode);
|
||||||
|
@@ -108,6 +108,18 @@ static Methods aMethods[] = {
|
|||||||
{ "expression", SbxVARIANT, 0,NULL,0 },
|
{ "expression", SbxVARIANT, 0,NULL,0 },
|
||||||
{ "CDate", SbxDATE, 1 | _FUNCTION, RTLNAME(CDate),0 },
|
{ "CDate", SbxDATE, 1 | _FUNCTION, RTLNAME(CDate),0 },
|
||||||
{ "expression", SbxVARIANT, 0,NULL,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 },
|
{ "CDateFromIso", SbxDATE, 1 | _FUNCTION, RTLNAME(CDateFromIso),0 },
|
||||||
{ "IsoDate", SbxSTRING, 0,NULL,0 },
|
{ "IsoDate", SbxSTRING, 0,NULL,0 },
|
||||||
{ "CDateToIso", SbxSTRING, 1 | _FUNCTION, RTLNAME(CDateToIso),0 },
|
{ "CDateToIso", SbxSTRING, 1 | _FUNCTION, RTLNAME(CDateToIso),0 },
|
||||||
|
@@ -661,7 +661,7 @@ sal_Bool SbxValue::PutDecimal( com::sun::star::bridge::oleautomation::Decimal& r
|
|||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool SbxValue::fillAutomationDecimal
|
sal_Bool SbxValue::fillAutomationDecimal
|
||||||
( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec )
|
( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) const
|
||||||
{
|
{
|
||||||
SbxDecimal* pDecimal = GetDecimal();
|
SbxDecimal* pDecimal = GetDecimal();
|
||||||
if( pDecimal != NULL )
|
if( pDecimal != NULL )
|
||||||
|
@@ -20,6 +20,9 @@
|
|||||||
#ifndef _SB_SBUNO_HXX
|
#ifndef _SB_SBUNO_HXX
|
||||||
#define _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 <basic/sbxobj.hxx>
|
||||||
#include "basicdllapi.h"
|
#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 createAllObjectProperties( SbxObject* pObj );
|
||||||
BASIC_DLLPUBLIC void SetSbUnoObjectDfltPropName( 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 );
|
BASIC_DLLPUBLIC void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
|
||||||
|
|
||||||
|
@@ -189,7 +189,7 @@ public:
|
|||||||
// Special methods
|
// Special methods
|
||||||
sal_Bool PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
|
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 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& );
|
sal_Bool PutCurrency( const sal_Int64& );
|
||||||
// Interface for CDbl in Basic
|
// Interface for CDbl in Basic
|
||||||
static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );
|
static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );
|
||||||
|
@@ -129,7 +129,7 @@ Dim LocStockName as String
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
CurRate = TransactModel.txtRate.Value
|
CurRate = TransactModel.txtRate.Value
|
||||||
TransactDate = CDateFromISO(TransactModel.txtDate.Date)
|
TransactDate = CDateFromUNODate(TransactModel.txtDate.Date)
|
||||||
DlgTransaction.EndExecute()
|
DlgTransaction.EndExecute()
|
||||||
UnprotectSheets(oSheets)
|
UnprotectSheets(oSheets)
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ Dim LocStockName as String
|
|||||||
oMovementSheet.GetCellByPosition(SBCOLUMNQUANTITY2, iNewRow).Value = -TransactModel.txtQuantity.Value
|
oMovementSheet.GetCellByPosition(SBCOLUMNQUANTITY2, iNewRow).Value = -TransactModel.txtQuantity.Value
|
||||||
End If
|
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(SBCOLUMNRATE2, iNewRow).Value = TransactModel.txtRate.Value
|
||||||
oMovementSheet.GetCellByPosition(SBCOLUMNPROVPERCENT2, iNewRow).Value = TransactModel.txtCommission.EffectiveValue
|
oMovementSheet.GetCellByPosition(SBCOLUMNPROVPERCENT2, iNewRow).Value = TransactModel.txtCommission.EffectiveValue
|
||||||
oMovementSheet.GetCellByPosition(SBCOLUMNPROVMIN2, iNewRow).Value = TransactModel.txtMinimum.Value
|
oMovementSheet.GetCellByPosition(SBCOLUMNPROVMIN2, iNewRow).Value = TransactModel.txtMinimum.Value
|
||||||
@@ -290,7 +290,7 @@ Dim oModel as Object
|
|||||||
' Store entered values in variables
|
' Store entered values in variables
|
||||||
OldNumber = oModel.txtOldRate.Value
|
OldNumber = oModel.txtOldRate.Value
|
||||||
NewNumber = oModel.txtNewRate.Value
|
NewNumber = oModel.txtNewRate.Value
|
||||||
SplitDate = CDateFromISO(oModel.txtDate.Date)
|
SplitDate = CDateFromUNODate(oModel.txtDate.Date)
|
||||||
iRow = SBROWFIRSTTRANSACT2
|
iRow = SBROWFIRSTTRANSACT2
|
||||||
NoteText = cSplit & SplitDate & ", " & oModel.txtOldRate.Value & oModel.lblColon.Label & oModel.txtNewRate.Value
|
NoteText = cSplit & SplitDate & ", " & oModel.txtOldRate.Value & oModel.lblColon.Label & oModel.txtNewRate.Value
|
||||||
Do
|
Do
|
||||||
@@ -398,8 +398,8 @@ End Sub
|
|||||||
Sub SetupTransactionControls(CurStep as Integer)
|
Sub SetupTransactionControls(CurStep as Integer)
|
||||||
DlgReference = DlgTransaction
|
DlgReference = DlgTransaction
|
||||||
With TransactModel
|
With TransactModel
|
||||||
.txtDate.Date = CDateToISO(Date())
|
.txtDate.Date = CDateToUNODate(Date())
|
||||||
.txtDate.DateMax = CDateToISO(Date())
|
.txtDate.DateMax = CDateToUNODate(Date())
|
||||||
.txtStockID.Enabled = False
|
.txtStockID.Enabled = False
|
||||||
.lblStockID.Enabled = False
|
.lblStockID.Enabled = False
|
||||||
.lblStockID.Label = sCurStockIDLabel
|
.lblStockID.Label = sCurStockIDLabel
|
||||||
@@ -504,12 +504,12 @@ Sub InitializeStockRatesControls(CurStep as Integer)
|
|||||||
Case 2
|
Case 2
|
||||||
.txtOldRate.Value = 1
|
.txtOldRate.Value = 1
|
||||||
.txtNewRate.Value = 1
|
.txtNewRate.Value = 1
|
||||||
.txtDate.Date = CDateToISO(Date())
|
.txtDate.Date = CDateToUNODate(Date())
|
||||||
Case 3
|
Case 3
|
||||||
.txtStartDate.DateMax = CDateToISO(CDate(Date())-1)
|
.txtStartDate.DateMax = CDateToUNODate(CDate(Date())-1)
|
||||||
.txtEndDate.DateMax = CDateToISO(CDate(Date())-1)
|
.txtEndDate.DateMax = CDateToUNODate(CDate(Date())-1)
|
||||||
.txtStartDate.Date = CDateToISO(CDate(Date())-8)
|
.txtStartDate.Date = CDateToUNODate(CDate(Date())-8)
|
||||||
.txtEndDate.Date = CDateToISO(CDate(Date())-1)
|
.txtEndDate.Date = CDateToUNODate(CDate(Date())-1)
|
||||||
.optDaily.State = 1
|
.optDaily.State = 1
|
||||||
End Select
|
End Select
|
||||||
End With
|
End With
|
||||||
|
@@ -25,8 +25,8 @@ Function CheckHistoryControls()
|
|||||||
Dim bLocGoOn as Boolean
|
Dim bLocGoOn as Boolean
|
||||||
Dim Firstdate as Date
|
Dim Firstdate as Date
|
||||||
Dim LastDate as Date
|
Dim LastDate as Date
|
||||||
LastDate = CDateFromISO(StockRatesModel.txtEndDate.Date)
|
LastDate = CDateFromUNODate(StockRatesModel.txtEndDate.Date)
|
||||||
FirstDate = CDateFromISO(StockRatesModel.txtStartDate.Date)
|
FirstDate = CDateFromUNODate(StockRatesModel.txtStartDate.Date)
|
||||||
bLocGoOn = FirstDate <> 0 And LastDate <> 0
|
bLocGoOn = FirstDate <> 0 And LastDate <> 0
|
||||||
If bLocGoOn Then
|
If bLocGoOn Then
|
||||||
If FirstDate >= LastDate Then
|
If FirstDate >= LastDate Then
|
||||||
@@ -47,8 +47,8 @@ Dim oCell as Object
|
|||||||
Dim sStockID as String
|
Dim sStockID as String
|
||||||
Dim ChartSource as String
|
Dim ChartSource as String
|
||||||
If CheckHistoryControls() Then
|
If CheckHistoryControls() Then
|
||||||
StartDate = CDateFromISO(StockRatesModel.txtStartDate.Date)
|
StartDate = CDateFromUNODate(StockRatesModel.txtStartDate.Date)
|
||||||
EndDate = CDateFromISO(StockRatesModel.txtEndDate.Date)
|
EndDate = CDateFromUNODate(StockRatesModel.txtEndDate.Date)
|
||||||
DlgStockRates.EndExecute()
|
DlgStockRates.EndExecute()
|
||||||
If StockRatesModel.optDaily.State = 1 Then
|
If StockRatesModel.optDaily.State = 1 Then
|
||||||
sInterval = "d"
|
sInterval = "d"
|
||||||
|
Reference in New Issue
Block a user