LibreOffice Module scaddins (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ScaDateAddIn Class Reference

#include <datefunc.hxx>

Inheritance diagram for ScaDateAddIn:
[legend]
Collaboration diagram for ScaDateAddIn:
[legend]

Public Member Functions

 ScaDateAddIn ()
 
OUString ScaResId (TranslateId aId)
 
virtual OUString SAL_CALL getProgrammaticFuntionName (const OUString &aDisplayName) override
 
virtual OUString SAL_CALL getDisplayFunctionName (const OUString &aProgrammaticName) override
 
virtual OUString SAL_CALL getFunctionDescription (const OUString &aProgrammaticName) override
 
virtual OUString SAL_CALL getDisplayArgumentName (const OUString &aProgrammaticName, sal_Int32 nArgument) override
 
virtual OUString SAL_CALL getArgumentDescription (const OUString &aProgrammaticName, sal_Int32 nArgument) override
 
virtual OUString SAL_CALL getProgrammaticCategoryName (const OUString &aProgrammaticName) override
 
virtual OUString SAL_CALL getDisplayCategoryName (const OUString &aProgrammaticName) override
 
virtual css::uno::Sequence< css::sheet::LocalizedName > SAL_CALL getCompatibilityNames (const OUString &aProgrammaticName) override
 
virtual void SAL_CALL setLocale (const css::lang::Locale &eLocale) override
 
virtual css::lang::Locale SAL_CALL getLocale () override
 
virtual OUString SAL_CALL getServiceName () override
 
virtual OUString SAL_CALL getImplementationName () override
 
virtual sal_Bool SAL_CALL supportsService (const OUString &ServiceName) override
 
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override
 
virtual sal_Int32 SAL_CALL getDiffWeeks (const css::uno::Reference< css::beans::XPropertySet > &xOptions, sal_Int32 nEndDate, sal_Int32 nStartDate, sal_Int32 nMode) override
 Get week difference between 2 dates. More...
 
virtual sal_Int32 SAL_CALL getDiffMonths (const css::uno::Reference< css::beans::XPropertySet > &xOptions, sal_Int32 nEndDate, sal_Int32 nStartDate, sal_Int32 nMode) override
 Get month difference between 2 dates =Month(start, end, mode) Function for StarCalc. More...
 
virtual sal_Int32 SAL_CALL getDiffYears (const css::uno::Reference< css::beans::XPropertySet > &xOptions, sal_Int32 nEndDate, sal_Int32 nStartDate, sal_Int32 nMode) override
 Get Year difference between 2 dates. More...
 
virtual sal_Int32 SAL_CALL getIsLeapYear (const css::uno::Reference< css::beans::XPropertySet > &xOptions, sal_Int32 nDate) override
 Check if a Date is in a leap year in the Gregorian calendar. More...
 
virtual sal_Int32 SAL_CALL getDaysInMonth (const css::uno::Reference< css::beans::XPropertySet > &xOptions, sal_Int32 nDate) override
 Get the Number of Days in the month for a date. More...
 
virtual sal_Int32 SAL_CALL getDaysInYear (const css::uno::Reference< css::beans::XPropertySet > &xOptions, sal_Int32 nDate) override
 Get number of days in the year of a date specified. More...
 
virtual sal_Int32 SAL_CALL getWeeksInYear (const css::uno::Reference< css::beans::XPropertySet > &xOptions, sal_Int32 nDate) override
 Get number of weeks in the year for a date. More...
 
virtual OUString SAL_CALL getRot13 (const OUString &aSrcText) override
 Encrypt or decrypt a string using ROT13 algorithm. More...
 

Private Member Functions

void InitDefLocales ()
 
const css::lang::Locale & GetLocale (sal_uInt32 nIndex)
 
void InitData ()
 
OUString GetFuncDescrStr (const TranslateId *pResId, sal_uInt16 nStrIndex)
 

Private Attributes

css::lang::Locale aFuncLoc
 
std::unique_ptr< css::lang::Locale[] > pDefLocales
 
std::locale aResLocale
 
std::unique_ptr< ScaFuncDataListpFuncDataList
 

Detailed Description

Definition at line 99 of file datefunc.hxx.

Constructor & Destructor Documentation

◆ ScaDateAddIn()

ScaDateAddIn::ScaDateAddIn ( )

Definition at line 99 of file datefunc.cxx.

Member Function Documentation

◆ getArgumentDescription()

OUString SAL_CALL ScaDateAddIn::getArgumentDescription ( const OUString &  aProgrammaticName,
sal_Int32  nArgument 
)
overridevirtual

Definition at line 238 of file datefunc.cxx.

References GetFuncDescrStr(), and pFuncDataList.

◆ getCompatibilityNames()

uno::Sequence< sheet::LocalizedName > SAL_CALL ScaDateAddIn::getCompatibilityNames ( const OUString &  aProgrammaticName)
overridevirtual

Definition at line 289 of file datefunc.cxx.

References GetLocale(), nCount, nIndex, and pFuncDataList.

◆ getDaysInMonth()

sal_Int32 SAL_CALL ScaDateAddIn::getDaysInMonth ( const css::uno::Reference< css::beans::XPropertySet > &  xOptions,
sal_Int32  nDate 
)
overridevirtual

Get the Number of Days in the month for a date.

Definition at line 587 of file datefunc.cxx.

References DaysInMonth, DaysToDate, and GetNullDate.

◆ getDaysInYear()

sal_Int32 SAL_CALL ScaDateAddIn::getDaysInYear ( const css::uno::Reference< css::beans::XPropertySet > &  xOptions,
sal_Int32  nDate 
)
overridevirtual

Get number of days in the year of a date specified.

Definition at line 603 of file datefunc.cxx.

References DaysToDate, GetNullDate, and IsLeapYear.

◆ getDiffMonths()

sal_Int32 SAL_CALL ScaDateAddIn::getDiffMonths ( const css::uno::Reference< css::beans::XPropertySet > &  xOptions,
sal_Int32  nEndDate,
sal_Int32  nStartDate,
sal_Int32  nMode 
)
overridevirtual

Get month difference between 2 dates =Month(start, end, mode) Function for StarCalc.

two modes are provided

mode 0 is the interval between the dates in month

mode 1 is the difference in calendar month

Definition at line 496 of file datefunc.cxx.

References DaysToDate, and GetNullDate.

Referenced by getDiffYears().

◆ getDiffWeeks()

sal_Int32 SAL_CALL ScaDateAddIn::getDiffWeeks ( const css::uno::Reference< css::beans::XPropertySet > &  xOptions,
sal_Int32  nEndDate,
sal_Int32  nStartDate,
sal_Int32  nMode 
)
overridevirtual

Get week difference between 2 dates.

new Weeks(date1,date2,mode) function for StarCalc

Two modes of operation are provided. mode 0 is just a simple division by 7 calculation.

mode 1 calculates the difference by week adhering to ISO8601.

The International Standard IS-8601 states that Monday is the first day of the week. The Gregorian Calendar is used for all dates, proleptic in case of dates before 1582-10-15.

The (consecutive) week number of a date is std::floor( (date + NullDate - 1), 7.0 ), with weeks starting on Monday, and week 0 starting on Monday, 0001-01-01 Gregorian.

Weeks(d2,d1,m) is defined as -Weeks(d1,d2,m).

Definition at line 465 of file datefunc.cxx.

References GetNullDate.

◆ getDiffYears()

sal_Int32 SAL_CALL ScaDateAddIn::getDiffYears ( const css::uno::Reference< css::beans::XPropertySet > &  xOptions,
sal_Int32  nEndDate,
sal_Int32  nStartDate,
sal_Int32  nMode 
)
overridevirtual

Get Year difference between 2 dates.

two modes are provided

mode 0 is the interval between the dates in years

mode 1 is the difference in calendar years

Definition at line 544 of file datefunc.cxx.

References DaysToDate, getDiffMonths(), and GetNullDate.

◆ getDisplayArgumentName()

OUString SAL_CALL ScaDateAddIn::getDisplayArgumentName ( const OUString &  aProgrammaticName,
sal_Int32  nArgument 
)
overridevirtual

Definition at line 219 of file datefunc.cxx.

References GetFuncDescrStr(), and pFuncDataList.

◆ getDisplayCategoryName()

OUString SAL_CALL ScaDateAddIn::getDisplayCategoryName ( const OUString &  aProgrammaticName)
overridevirtual

Definition at line 282 of file datefunc.cxx.

References getProgrammaticCategoryName().

◆ getDisplayFunctionName()

OUString SAL_CALL ScaDateAddIn::getDisplayFunctionName ( const OUString &  aProgrammaticName)
overridevirtual

Definition at line 187 of file datefunc.cxx.

References pFuncDataList, and ScaResId().

◆ GetFuncDescrStr()

OUString ScaDateAddIn::GetFuncDescrStr ( const TranslateId pResId,
sal_uInt16  nStrIndex 
)
private
Exceptions
css::uno::RuntimeException

Definition at line 140 of file datefunc.cxx.

References ScaResId().

Referenced by getArgumentDescription(), getDisplayArgumentName(), and getFunctionDescription().

◆ getFunctionDescription()

OUString SAL_CALL ScaDateAddIn::getFunctionDescription ( const OUString &  aProgrammaticName)
overridevirtual

Definition at line 207 of file datefunc.cxx.

References GetFuncDescrStr(), and pFuncDataList.

◆ getImplementationName()

OUString SAL_CALL ScaDateAddIn::getImplementationName ( )
overridevirtual

Definition at line 153 of file datefunc.cxx.

References MY_IMPLNAME.

◆ getIsLeapYear()

sal_Int32 SAL_CALL ScaDateAddIn::getIsLeapYear ( const css::uno::Reference< css::beans::XPropertySet > &  xOptions,
sal_Int32  nDate 
)
overridevirtual

Check if a Date is in a leap year in the Gregorian calendar.

Definition at line 571 of file datefunc.cxx.

References DaysToDate, GetNullDate, and IsLeapYear.

◆ getLocale()

lang::Locale SAL_CALL ScaDateAddIn::getLocale ( )
overridevirtual

Definition at line 175 of file datefunc.cxx.

References aFuncLoc.

◆ GetLocale()

const lang::Locale & ScaDateAddIn::GetLocale ( sal_uInt32  nIndex)
private

Definition at line 118 of file datefunc.cxx.

References aFuncLoc, InitDefLocales(), nIndex, nNumOfLoc, and pDefLocales.

Referenced by getCompatibilityNames().

◆ getProgrammaticCategoryName()

OUString SAL_CALL ScaDateAddIn::getProgrammaticCategoryName ( const OUString &  aProgrammaticName)
overridevirtual

Definition at line 257 of file datefunc.cxx.

References DateTime, Finance, Inf, Math, pFuncDataList, Tech, and Text.

Referenced by getDisplayCategoryName().

◆ getProgrammaticFuntionName()

OUString SAL_CALL ScaDateAddIn::getProgrammaticFuntionName ( const OUString &  aDisplayName)
overridevirtual

Definition at line 180 of file datefunc.cxx.

◆ getRot13()

OUString SAL_CALL ScaDateAddIn::getRot13 ( const OUString &  aSrcString)
overridevirtual

Encrypt or decrypt a string using ROT13 algorithm.

This function rotates each character by 13 in the alphabet. Only the characters 'a' ... 'z' and 'A' ... 'Z' are modified.

Definition at line 660 of file datefunc.cxx.

References aBuffer, and nIndex.

◆ getServiceName()

OUString SAL_CALL ScaDateAddIn::getServiceName ( )
overridevirtual

Definition at line 146 of file datefunc.cxx.

References MY_SERVICE.

◆ getSupportedServiceNames()

uno::Sequence< OUString > SAL_CALL ScaDateAddIn::getSupportedServiceNames ( )
overridevirtual

Definition at line 163 of file datefunc.cxx.

References ADDIN_SERVICE, and MY_SERVICE.

◆ getWeeksInYear()

sal_Int32 SAL_CALL ScaDateAddIn::getWeeksInYear ( const css::uno::Reference< css::beans::XPropertySet > &  xOptions,
sal_Int32  nDate 
)
overridevirtual

Get number of weeks in the year for a date.

Most years have 52 weeks, but years that start on a Thursday and leap years that start on a Wednesday have 53 weeks

The International Standard IS-8601 has decreed that Monday shall be the first day of the week.

A WeekDay can be calculated by subtracting 1 and calculating the rest of a division by 7 from the internal date representation which gives a 0 - 6 value for Monday - Sunday

See also
IsLeapYear #WeekNumber

Definition at line 631 of file datefunc.cxx.

References DateToDays, DaysToDate, GetNullDate, and IsLeapYear.

◆ InitData()

void ScaDateAddIn::InitData ( )
private

Definition at line 126 of file datefunc.cxx.

References aFuncLoc, aResLocale, Translate::Create(), InitScaFuncDataList(), pDefLocales, and pFuncDataList.

Referenced by setLocale().

◆ InitDefLocales()

void ScaDateAddIn::InitDefLocales ( )
private

Definition at line 107 of file datefunc.cxx.

References nIndex, nNumOfLoc, pCoun, pDefLocales, and pLang.

Referenced by GetLocale().

◆ ScaResId()

OUString ScaDateAddIn::ScaResId ( TranslateId  aId)

Definition at line 683 of file datefunc.cxx.

References aResLocale, and Translate::get().

Referenced by getDisplayFunctionName(), and GetFuncDescrStr().

◆ setLocale()

void SAL_CALL ScaDateAddIn::setLocale ( const css::lang::Locale &  eLocale)
overridevirtual

Definition at line 169 of file datefunc.cxx.

References aFuncLoc, and InitData().

◆ supportsService()

sal_Bool SAL_CALL ScaDateAddIn::supportsService ( const OUString &  ServiceName)
overridevirtual

Definition at line 158 of file datefunc.cxx.

References cppu::supportsService().

Member Data Documentation

◆ aFuncLoc

css::lang::Locale ScaDateAddIn::aFuncLoc
private

Definition at line 108 of file datefunc.hxx.

Referenced by getLocale(), GetLocale(), InitData(), and setLocale().

◆ aResLocale

std::locale ScaDateAddIn::aResLocale
private

Definition at line 110 of file datefunc.hxx.

Referenced by InitData(), and ScaResId().

◆ pDefLocales

std::unique_ptr< css::lang::Locale[] > ScaDateAddIn::pDefLocales
private

Definition at line 109 of file datefunc.hxx.

Referenced by GetLocale(), InitData(), and InitDefLocales().

◆ pFuncDataList

std::unique_ptr< ScaFuncDataList > ScaDateAddIn::pFuncDataList
private

The documentation for this class was generated from the following files: