1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_I18NPOOL_INC_CALENDAR_GREGORIAN_HXX
20 #define INCLUDED_I18NPOOL_INC_CALENDAR_GREGORIAN_HXX
22 #include "calendarImpl.hxx"
23 #include "nativenumbersupplier.hxx"
25 #include <unicode/calendar.h>
28 // class Calendar_gregorian
31 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
33 const sal_uInt8 kDisplayEraForcedLongYear
= 0x01;
42 const sal_Int16 FIELD_INDEX_COUNT
= CalendarFieldIndex::FIELD_COUNT2
;
44 class Calendar_gregorian
: public CalendarImpl
50 Calendar_gregorian(const Era
*_eraArray
);
51 void SAL_CALL
init(const Era
*_eraArray
);
56 virtual ~Calendar_gregorian();
58 // Methods in XCalendar
59 virtual void SAL_CALL
loadCalendar(const OUString
& uniqueID
, const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
60 virtual void SAL_CALL
setDateTime(double fTimeInDays
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
61 virtual double SAL_CALL
getDateTime() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
62 virtual void SAL_CALL
setValue( sal_Int16 nFieldIndex
, sal_Int16 nValue
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
63 virtual sal_Int16 SAL_CALL
getValue(sal_Int16 nFieldIndex
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
64 virtual void SAL_CALL
addValue(sal_Int16 nFieldIndex
, sal_Int32 nAmount
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
65 virtual sal_Bool SAL_CALL
isValid() throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
66 virtual Calendar SAL_CALL
getLoadedCalendar() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
67 virtual OUString SAL_CALL
getUniqueID() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
68 virtual sal_Int16 SAL_CALL
getFirstDayOfWeek() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
69 virtual void SAL_CALL
setFirstDayOfWeek(sal_Int16 nDay
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
70 virtual void SAL_CALL
setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
71 virtual sal_Int16 SAL_CALL
getMinimumNumberOfDaysForFirstWeek() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
72 virtual sal_Int16 SAL_CALL
getNumberOfMonthsInYear() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
73 virtual sal_Int16 SAL_CALL
getNumberOfDaysInWeek() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
74 virtual com::sun::star::uno::Sequence
< CalendarItem
> SAL_CALL
getMonths() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
75 virtual com::sun::star::uno::Sequence
< CalendarItem
> SAL_CALL
getDays() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
76 virtual OUString SAL_CALL
getDisplayName(sal_Int16 nCalendarDisplayIndex
, sal_Int16 nIdx
, sal_Int16 nNameType
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
78 // Methods in XExtendedCalendar
79 virtual OUString SAL_CALL
getDisplayString( sal_Int32 nCalendarDisplayCode
, sal_Int16 nNativeNumberMode
) throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
82 virtual Calendar2 SAL_CALL
getLoadedCalendar2() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
83 virtual com::sun::star::uno::Sequence
< CalendarItem2
> SAL_CALL
getDays2() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
84 virtual com::sun::star::uno::Sequence
< CalendarItem2
> SAL_CALL
getMonths2() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 virtual com::sun::star::uno::Sequence
< CalendarItem2
> SAL_CALL
getGenitiveMonths2() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual com::sun::star::uno::Sequence
< CalendarItem2
> SAL_CALL
getPartitiveMonths2() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 virtual void SAL_CALL
setLocalDateTime(double TimeInDays
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 virtual double SAL_CALL
getLocalDateTime() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual OUString SAL_CALL
getImplementationName() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 NativeNumberSupplierService aNatNum
;
101 const sal_Char
* cCalendar
;
102 com::sun::star::lang::Locale aLocale
;
104 sal_Int16 fieldValue
[FIELD_INDEX_COUNT
];
105 sal_Int16 fieldSetValue
[FIELD_INDEX_COUNT
];
107 virtual void mapToGregorian() throw(com::sun::star::uno::RuntimeException
);
108 virtual void mapFromGregorian() throw(com::sun::star::uno::RuntimeException
);
109 void getValue() throw(com::sun::star::uno::RuntimeException
);
111 OUString
getDisplayStringImpl( sal_Int32 nCalendarDisplayCode
, sal_Int16 nNativeNumberMode
, bool bEraMode
) throw (com::sun::star::uno::RuntimeException
);
116 /** Submit fieldSetValue array according to fieldSet. */
117 void submitFields() throw(com::sun::star::uno::RuntimeException
);
118 /** Submit fieldSetValue array according to fieldSet, plus YMDhms if >=0,
119 plus zone and DST if != 0 */
120 void submitValues( sal_Int32 nYear
, sal_Int32 nMonth
, sal_Int32 nDay
, sal_Int32 nHour
, sal_Int32 nMinute
, sal_Int32 nSecond
, sal_Int32 nMilliSecond
, sal_Int32 nZone
, sal_Int32 nDST
) throw(com::sun::star::uno::RuntimeException
);
121 /** Set fields internally. */
122 void setValue() throw(com::sun::star::uno::RuntimeException
);
123 /** Obtain combined field values for timezone offset (minutes+secondmillis)
124 in milliseconds and whether fields were set. */
125 bool getZoneOffset( sal_Int32
& o_nOffset
) const;
126 /** Obtain combined field values for DST offset (minutes+secondmillis) in
127 milliseconds and whether fields were set. */
128 bool getDSTOffset( sal_Int32
& o_nOffset
) const;
129 /** Used by getZoneOffset() and getDSTOffset(). Parent is
130 CalendarFieldIndex for offset in minutes, child is CalendarFieldIndex
131 for offset in milliseconds. */
132 bool getCombinedOffset( sal_Int32
& o_nOffset
, sal_Int16 nParentFieldIndex
, sal_Int16 nChildFieldIndex
) const;
136 // class Calendar_hanja
138 class Calendar_hanja
: public Calendar_gregorian
143 virtual void SAL_CALL
loadCalendar(const OUString
& uniqueID
, const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
144 virtual OUString SAL_CALL
getDisplayName(sal_Int16 nCalendarDisplayIndex
, sal_Int16 nIdx
, sal_Int16 nNameType
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
148 // class Calendar_gengou
150 class Calendar_gengou
: public Calendar_gregorian
158 // class Calendar_ROC
160 class Calendar_ROC
: public Calendar_gregorian
168 // class Calendar_buddhist
170 class Calendar_buddhist
: public Calendar_gregorian
176 // Methods in XExtendedCalendar
177 virtual OUString SAL_CALL
getDisplayString( sal_Int32 nCalendarDisplayCode
, sal_Int16 nNativeNumberMode
) throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */