24#include <com/sun/star/i18n/CalendarDisplayCode.hpp>
25#include <com/sun/star/i18n/NativeNumberMode.hpp>
38 cCalendar =
"com.sun.star.i18n.Calendar_jewish";
56 return ((((7 *
year) + 1) % 19) < 7);
67 sal_Int32 MonthsElapsed =
68 (235 * ((
year - 1) / 19))
69 + (12 * ((
year - 1) % 19))
70 + (7 * ((
year - 1) % 19) + 1) / 19;
71 sal_Int32 PartsElapsed = 204 + 793 * (MonthsElapsed % 1080);
73 5 + 12 * MonthsElapsed + 793 * (MonthsElapsed / 1080)
74 + PartsElapsed / 1080;
75 sal_Int32 ConjunctionDay = 1 + 29 * MonthsElapsed + HoursElapsed / 24;
76 sal_Int32 ConjunctionParts = 1080 * (HoursElapsed % 24) + PartsElapsed % 1080;
77 sal_Int32 AlternativeDay;
79 if ((ConjunctionParts >= 19440)
80 || (((ConjunctionDay % 7) == 2)
81 && (ConjunctionParts >= 9924)
83 || (((ConjunctionDay % 7) == 1)
84 && (ConjunctionParts >= 16789)
87 AlternativeDay = ConjunctionDay + 1;
89 AlternativeDay = ConjunctionDay;
91 if (((AlternativeDay % 7) == 0)
92 || ((AlternativeDay % 7) == 3)
93 || ((AlternativeDay % 7) == 5))
95 return (1+ AlternativeDay);
97 return AlternativeDay;
140 HebrewDate(sal_Int32 m, sal_Int32 d, sal_Int32 y) :
year(
y),
month(
m),
day(
d) { }
142 explicit HebrewDate(sal_Int32 d) {
145 while (d >= HebrewDate(7,1,
year + 1).GetAbsoluteDate())
148 if (d < HebrewDate(1, 1,
year).GetAbsoluteDate())
158 int GetAbsoluteDate()
const {
159 sal_Int32 DayInYear =
day;
185 sal_Int32 GetMonth()
const {
return month; }
186 sal_Int32 GetDay()
const {
return day; }
187 sal_Int32 GetYear()
const {
return year; }
200 if ((((
year % 4) == 0) && ((
year % 100) != 0))
201 || ((
year % 400) == 0))
224 explicit GregorianDate(
int d) {
227 while (d >= GregorianDate(1,1,
year+1).GetAbsoluteDate())
236 int GetAbsoluteDate()
const {
238 for (
int m =
month - 1;
m > 0;
m--)
248 int GetMonth()
const {
return month; }
249 int GetDay()
const {
return day; }
250 int GetYear()
const {
return year; }
262 GregorianDate Temp(
fieldValue[CalendarFieldIndex::MONTH] + 1,
fieldValue[CalendarFieldIndex::DAY_OF_MONTH],
y);
263 HebrewDate hd(Temp.GetAbsoluteDate());
265 fieldValue[CalendarFieldIndex::ERA] = hd.GetYear() <= 0 ? 0 : 1;
266 fieldValue[CalendarFieldIndex::MONTH] = sal::static_int_cast<sal_Int16>( hd.GetMonth() - 1 );
267 fieldValue[CalendarFieldIndex::DAY_OF_MONTH] =
static_cast<sal_Int16
>(hd.GetDay());
268 fieldValue[CalendarFieldIndex::YEAR] =
static_cast<sal_Int16
>(hd.GetYear() <= 0 ? 1 - hd.GetYear() : hd.GetYear());
271#define FIELDS ((1 << CalendarFieldIndex::ERA) | (1 << CalendarFieldIndex::YEAR) | (1 << CalendarFieldIndex::MONTH) | (1 << CalendarFieldIndex::DAY_OF_MONTH))
282 GregorianDate gd(Temp.GetAbsoluteDate());
284 fieldSetValue[CalendarFieldIndex::ERA] = gd.GetYear() <= 0 ? 0 : 1;
285 fieldSetValue[CalendarFieldIndex::MONTH] = sal::static_int_cast<sal_Int16>( gd.GetMonth() - 1 );
286 fieldSetValue[CalendarFieldIndex::DAY_OF_MONTH] =
static_cast<sal_Int16
>(gd.GetDay());
287 fieldSetValue[CalendarFieldIndex::YEAR] =
static_cast<sal_Int16
>(gd.GetYear() <= 0 ? 1 - gd.GetYear() : gd.GetYear());
295 const sal_Int16 nNativeNumberMode = NativeNumberMode::NATNUM2;
297 if (nCalendarDisplayCode == CalendarDisplayCode::SHORT_YEAR) {
sal_Int16 fieldSetValue[FIELD_INDEX_COUNT]
rtl::Reference< NativeNumberSupplierService > mxNatNum
virtual OUString SAL_CALL getDisplayString(sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode) override
css::lang::Locale aLocale
sal_Int16 fieldValue[FIELD_INDEX_COUNT]
void mapToGregorian() override
virtual OUString SAL_CALL getDisplayString(sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode) override
void mapFromGregorian() override
Constant values shared between i18npool and, for example, the number formatter.
static sal_Int32 DaysInHebrewYear(sal_Int32 year)
static sal_Int32 LastDayOfHebrewMonth(sal_Int32 month, sal_Int32 year)
static bool LongHeshvan(sal_Int32 year)
static sal_Int32 LastMonthOfHebrewYear(sal_Int32 year)
static bool HebrewLeapYear(sal_Int32 year)
static sal_Int32 HebrewCalendarElapsedDays(sal_Int32 year)
static bool ShortKislev(sal_Int32 year)
static int LastDayOfGregorianMonth(int month, int year)