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

#include <calendarwrapper.hxx>

Collaboration diagram for CalendarWrapper:
[legend]

Public Member Functions

 CalendarWrapper (const css::uno::Reference< css::uno::XComponentContext > &rxContext)
 
 ~CalendarWrapper ()
 
void loadDefaultCalendar (const css::lang::Locale &rLocale, bool bTimeZoneUTC=true)
 Load the default calendar of a locale. More...
 
void loadCalendar (const OUString &rUniqueID, const css::lang::Locale &rLocale, bool bTimeZoneUTC=true)
 This adds a bTimeZoneUTC parameter which is not part of the API. More...
 
css::uno::Sequence< OUString > getAllCalendars (const css::lang::Locale &rLocale) const
 
OUString getUniqueID () const
 
void setDateTime (double fTimeInDays)
 set UTC date/time More...
 
double getDateTime () const
 get UTC date/time More...
 
void setValue (sal_Int16 nFieldIndex, sal_Int16 nValue)
 
bool isValid () const
 
sal_Int16 getValue (sal_Int16 nFieldIndex) const
 
sal_Int16 getFirstDayOfWeek () const
 
sal_Int16 getNumberOfMonthsInYear () const
 
sal_Int16 getNumberOfDaysInWeek () const
 
OUString getDisplayName (sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) const
 
OUString getDisplayString (sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode) const
 
css::i18n::Calendar2 getLoadedCalendar () const
 
css::uno::Sequence< css::i18n::CalendarItem2 > getDays () const
 
css::uno::Sequence< css::i18n::CalendarItem2 > getMonths () const
 
css::uno::Sequence< css::i18n::CalendarItem2 > getGenitiveMonths () const
 
css::uno::Sequence< css::i18n::CalendarItem2 > getPartitiveMonths () const
 
void setLocalDateTime (double fTimeInDays)
 set local date/time More...
 
double getLocalDateTime () const
 get local date/time More...
 
const DateTimegetEpochStart () const
 get epoch start (should be 01Jan1970) More...
 
void setGregorianDateTime (const DateTime &rDateTime)
 set a local (!) Gregorian DateTime More...
 

Private Attributes

css::uno::Reference< css::i18n::XCalendar4 > xC
 
const DateTime aEpochStart
 

Detailed Description

Definition at line 33 of file calendarwrapper.hxx.

Constructor & Destructor Documentation

◆ CalendarWrapper()

CalendarWrapper::CalendarWrapper ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext)

Definition at line 30 of file calendarwrapper.cxx.

References xC.

◆ ~CalendarWrapper()

CalendarWrapper::~CalendarWrapper ( )

Definition at line 39 of file calendarwrapper.cxx.

Member Function Documentation

◆ getAllCalendars()

css::uno::Sequence< OUString > CalendarWrapper::getAllCalendars ( const css::lang::Locale &  rLocale) const

Definition at line 70 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getDateTime()

double CalendarWrapper::getDateTime ( ) const

get UTC date/time

Definition at line 112 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getDays()

css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getDays ( ) const

Definition at line 254 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getDisplayName()

OUString CalendarWrapper::getDisplayName ( sal_Int16  nCalendarDisplayIndex,
sal_Int16  nIdx,
sal_Int16  nNameType 
) const

Definition at line 268 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getDisplayString()

OUString CalendarWrapper::getDisplayString ( sal_Int32  nCalendarDisplayCode,
sal_Int16  nNativeNumberMode 
) const

Definition at line 284 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getEpochStart()

const DateTime & CalendarWrapper::getEpochStart ( ) const
inline

get epoch start (should be 01Jan1970)

Definition at line 113 of file calendarwrapper.hxx.

◆ getFirstDayOfWeek()

sal_Int16 CalendarWrapper::getFirstDayOfWeek ( ) const

Definition at line 198 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getGenitiveMonths()

css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getGenitiveMonths ( ) const

Definition at line 314 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getLoadedCalendar()

css::i18n::Calendar2 CalendarWrapper::getLoadedCalendar ( ) const

Definition at line 300 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getLocalDateTime()

double CalendarWrapper::getLocalDateTime ( ) const

get local date/time

Definition at line 141 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getMonths()

css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getMonths ( ) const

Definition at line 240 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getNumberOfDaysInWeek()

sal_Int16 CalendarWrapper::getNumberOfDaysInWeek ( ) const

Definition at line 226 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getNumberOfMonthsInYear()

sal_Int16 CalendarWrapper::getNumberOfMonthsInYear ( ) const

Definition at line 212 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getPartitiveMonths()

css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getPartitiveMonths ( ) const

Definition at line 328 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getUniqueID()

OUString CalendarWrapper::getUniqueID ( ) const

Definition at line 85 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ getValue()

sal_Int16 CalendarWrapper::getValue ( sal_Int16  nFieldIndex) const

Definition at line 184 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ isValid()

bool CalendarWrapper::isValid ( ) const

Definition at line 170 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ loadCalendar()

void CalendarWrapper::loadCalendar ( const OUString &  rUniqueID,
const css::lang::Locale &  rLocale,
bool  bTimeZoneUTC = true 
)

This adds a bTimeZoneUTC parameter which is not part of the API.

Definition at line 56 of file calendarwrapper.cxx.

References LanguageTag::convertToBcp47(), Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ loadDefaultCalendar()

void CalendarWrapper::loadDefaultCalendar ( const css::lang::Locale &  rLocale,
bool  bTimeZoneUTC = true 
)

Load the default calendar of a locale.

This adds a bool bTimeZoneUTC parameter which is not part of the UNO API to facilitate handling of non time zone aware data.

Parameters
bTimeZoneUTCDefault <TRUE>. If <FALSE>, the system's timezone is assigned to the calendar, including all DST quirks like not existing times on DST transition dates when switching to/from DST. As current implementations and number parser/formatter don't store or convert or calculate with time zones it is safer to use UTC, which is not DST afflicted, otherwise surprises are lurking (for example tdf#92503).

Definition at line 43 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ setDateTime()

void CalendarWrapper::setDateTime ( double  fTimeInDays)

set UTC date/time

Definition at line 99 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ setGregorianDateTime()

void CalendarWrapper::setGregorianDateTime ( const DateTime rDateTime)
inline

set a local (!) Gregorian DateTime

Definition at line 117 of file calendarwrapper.hxx.

References DateTime::Sub().

◆ setLocalDateTime()

void CalendarWrapper::setLocalDateTime ( double  fTimeInDays)

set local date/time

Definition at line 126 of file calendarwrapper.cxx.

References Exception, TOOLS_WARN_EXCEPTION, and xC.

◆ setValue()

void CalendarWrapper::setValue ( sal_Int16  nFieldIndex,
sal_Int16  nValue 
)

Definition at line 157 of file calendarwrapper.cxx.

References Exception, nValue, TOOLS_WARN_EXCEPTION, and xC.

Member Data Documentation

◆ aEpochStart

const DateTime CalendarWrapper::aEpochStart
private

Definition at line 37 of file calendarwrapper.hxx.

◆ xC

css::uno::Reference< css::i18n::XCalendar4 > CalendarWrapper::xC
private

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