26#include <com/sun/star/uno/XComponentContext.hpp>
51 auto pCal = std::find_if(xC.begin(), xC.end(), [](
const Calendar2& rCal) { return rCal.Default; });
53 throw RuntimeException(
"CalendarImpl::loadDefaultCalendarTZ: no default calendar found for this locale");
60 Reference < XCalendar4 > xOldCalendar(
xCalendar );
61 const OUString aCacheID( uniqueID +
"_" + rTimeZone);
62 bool bTimeZone =
true;
65 for (
i = 0; i < sal::static_int_cast<sal_Int32>(
lookupTable.size());
i++) {
73 if (
i >= sal::static_int_cast<sal_Int32>(
lookupTable.size())) {
74 Reference < XInterface > xI =
m_xContext->getServiceManager()->createInstanceWithContext(
75 "com.sun.star.i18n.Calendar_" + uniqueID,
m_xContext);
80 if (std::any_of(xC.begin(), xC.end(), [&uniqueID](
const Calendar2& rCal) { return uniqueID == rCal.Name; }))
81 xI =
m_xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.i18n.Calendar_gregorian",
m_xContext);
85 throw RuntimeException(
"CalendarImpl::loadCalendarTZ: no calendar found for this locale");
88 if (!rTimeZone.isEmpty())
103 throw RuntimeException(
"CalendarImpl::loadCalendarTZ: no calendar found for this locale, should use old one?");
108 xCalendar->loadCalendar(uniqueID, rLocale);
118 throw RuntimeException(
"CalendarImpl::loadCalendarTZ: the calendar is usable but is not in the expected time zone");
129::css::i18n::Calendar SAL_CALL
137Sequence< OUString > SAL_CALL
141 Sequence< OUString > xSeq( xC.getLength() );
142 std::transform(xC.begin(), xC.end(), xSeq.getArray(),
143 [](
const Calendar2& rCal) { return rCal.Name; });
168 xCalendar->setLocalDateTime( fTimeInDays );
210 return xCalendar->getValue( fieldIndex );
218 xCalendar->addValue( fieldIndex, amount);
241 throw RuntimeException(
"CalendarImpl::setMinimumNumberOfDaysForFirstWeek: no calendar");
242 xCalendar->setMinimumNumberOfDaysForFirstWeek(days);
249 throw RuntimeException(
"CalendarImpl::getMinimumNumberOfDaysForFirstWeek: no calendar");
250 return xCalendar->getMinimumNumberOfDaysForFirstWeek();
259 return xCalendar->getDisplayName( displayIndex,
idx, nameType );
267 return xCalendar->getNumberOfMonthsInYear();
276 return xCalendar->getNumberOfDaysInWeek();
280Sequence< CalendarItem > SAL_CALL
289Sequence< CalendarItem > SAL_CALL
298Sequence< CalendarItem2 > SAL_CALL
307Sequence< CalendarItem2 > SAL_CALL
316Sequence< CalendarItem2 > SAL_CALL
325Sequence< CalendarItem2 > SAL_CALL
347 return xCalendar->getDisplayString(nCalendarDisplayCode, nNativeNumberMode);
353 return "com.sun.star.i18n.CalendarImpl";
362Sequence< OUString > SAL_CALL
365 return {
"com.sun.star.i18n.LocaleCalendar",
"com.sun.star.i18n.LocaleCalendar2" };
Reference< XComponentContext > m_xContext
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() override
virtual css::uno::Sequence< OUString > SAL_CALL getAllCalendars(const css::lang::Locale &rLocale) override
std::vector< lookupTableItem > lookupTable
css::uno::Reference< css::i18n::XCalendar4 > xCalendar
virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override
virtual sal_Bool SAL_CALL isValid() override
virtual double SAL_CALL getDateTime() override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getDays2() override
virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) override
virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) override
virtual void SAL_CALL loadDefaultCalendar(const css::lang::Locale &rLocale) override
virtual double SAL_CALL getLocalDateTime() override
virtual css::uno::Sequence< css::i18n::CalendarItem > SAL_CALL getDays() override
virtual OUString SAL_CALL getUniqueID() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::i18n::Calendar2 SAL_CALL getLoadedCalendar2() override
virtual css::i18n::Calendar SAL_CALL getLoadedCalendar() override
virtual ~CalendarImpl() override
Destructor.
virtual void SAL_CALL loadCalendar(const OUString &uniqueID, const css::lang::Locale &rLocale) override
virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) override
virtual void SAL_CALL setLocalDateTime(double TimeInDays) override
virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL loadDefaultCalendarTZ(const css::lang::Locale &rLocale, const OUString &rTimeZone) override
virtual sal_Int16 SAL_CALL getFirstDayOfWeek() override
virtual void SAL_CALL loadCalendarTZ(const OUString &uniqueID, const css::lang::Locale &rLocale, const OUString &rTimeZone) override
virtual void SAL_CALL setValue(sal_Int16 nFieldIndex, sal_Int16 nValue) override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getPartitiveMonths2() override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getGenitiveMonths2() override
virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getMonths2() override
virtual css::uno::Sequence< css::i18n::CalendarItem > SAL_CALL getMonths() override
virtual OUString SAL_CALL getDisplayString(sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode) override
virtual void SAL_CALL setDateTime(double fTimeInDays) override
virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() override
bool setTimeZone(const OUString &rTimeZone)
static rtl::Reference< LocaleDataImpl > get()
Reference< XComponentContext > getProcessComponentContext()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Constant values shared between i18npool and, for example, the number formatter.
css::uno::Reference< css::i18n::XCalendar4 > xCalendar