Bump version to 4.1-6
[LibreOffice.git] / i18npool / inc / calendar_gregorian.hxx
blob691af7f9fca9e6c0b2ef05b8ffe123f47c8e50b6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _I18N_CALENDAR_GREGORIAN_HXX_
20 #define _I18N_CALENDAR_GREGORIAN_HXX_
22 #include "calendarImpl.hxx"
23 #include "nativenumbersupplier.hxx"
25 #include "warnings_guard_unicode_calendar.h"
27 // ----------------------------------------------------
28 // class Calendar_gregorian
29 // ----------------------------------------------------
31 namespace com { namespace sun { namespace star { namespace i18n {
33 const sal_uInt8 kDisplayEraForcedLongYear = 0x01;
35 struct Era {
36 sal_Int32 year;
37 sal_Int32 month;
38 sal_Int32 day;
39 sal_uInt8 flags;
42 const sal_Int16 FIELD_INDEX_COUNT = CalendarFieldIndex::FIELD_COUNT2;
44 class Calendar_gregorian : public CalendarImpl
46 public:
48 // Constructors
49 Calendar_gregorian();
50 Calendar_gregorian(Era *_eraArray);
51 void SAL_CALL init(Era *_eraArray);
53 /**
54 * Destructor
56 ~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);
60 virtual void SAL_CALL setDateTime(double nTimeInDays) throw(com::sun::star::uno::RuntimeException);
61 virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException);
62 virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) throw(com::sun::star::uno::RuntimeException);
63 virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) throw(com::sun::star::uno::RuntimeException);
64 virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) throw(com::sun::star::uno::RuntimeException);
65 virtual sal_Bool SAL_CALL isValid() throw (com::sun::star::uno::RuntimeException);
66 virtual Calendar SAL_CALL getLoadedCalendar() throw(com::sun::star::uno::RuntimeException);
67 virtual OUString SAL_CALL getUniqueID() throw(com::sun::star::uno::RuntimeException);
68 virtual sal_Int16 SAL_CALL getFirstDayOfWeek() throw(com::sun::star::uno::RuntimeException);
69 virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) throw(com::sun::star::uno::RuntimeException);
70 virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) throw(com::sun::star::uno::RuntimeException);
71 virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() throw(com::sun::star::uno::RuntimeException);
72 virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() throw(com::sun::star::uno::RuntimeException);
73 virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() throw(com::sun::star::uno::RuntimeException);
74 virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getMonths() throw(com::sun::star::uno::RuntimeException);
75 virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getDays() throw(com::sun::star::uno::RuntimeException);
76 virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) throw(com::sun::star::uno::RuntimeException);
78 // Methods in XExtendedCalendar
79 virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException);
81 // XCalendar3
82 virtual Calendar2 SAL_CALL getLoadedCalendar2() throw(com::sun::star::uno::RuntimeException);
83 virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getDays2() throw(com::sun::star::uno::RuntimeException);
84 virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getMonths2() throw(com::sun::star::uno::RuntimeException);
85 virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getGenitiveMonths2() throw(com::sun::star::uno::RuntimeException);
86 virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getPartitiveMonths2() throw(com::sun::star::uno::RuntimeException);
88 //XServiceInfo
89 virtual OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
90 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(com::sun::star::uno::RuntimeException);
91 virtual com::sun::star::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
93 protected:
94 Era *eraArray;
95 icu::Calendar *body;
96 NativeNumberSupplier aNatNum;
97 const sal_Char* cCalendar;
98 com::sun::star::lang::Locale aLocale;
99 sal_uInt32 fieldSet;
100 sal_Int16 fieldValue[FIELD_INDEX_COUNT];
101 sal_Int16 fieldSetValue[FIELD_INDEX_COUNT];
103 virtual void mapToGregorian() throw(com::sun::star::uno::RuntimeException);
104 virtual void mapFromGregorian() throw(com::sun::star::uno::RuntimeException);
105 void getValue() throw(com::sun::star::uno::RuntimeException);
107 OUString getDisplayStringImpl( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode, bool bEraMode ) throw (com::sun::star::uno::RuntimeException);
109 private:
110 Calendar2 aCalendar;
112 /** Submit fieldSetValue array according to fieldSet. */
113 void submitFields() throw(com::sun::star::uno::RuntimeException);
114 /** Submit fieldSetValue array according to fieldSet, plus YMDhms if >=0,
115 plus zone and DST if != 0 */
116 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);
117 /** Set fields internally. */
118 void setValue() throw(com::sun::star::uno::RuntimeException);
119 /** Obtain combined field values for timezone offset (minutes+secondmillis)
120 in milliseconds and whether fields were set. */
121 bool getZoneOffset( sal_Int32 & o_nOffset ) const;
122 /** Obtain combined field values for DST offset (minutes+secondmillis) in
123 milliseconds and whether fields were set. */
124 bool getDSTOffset( sal_Int32 & o_nOffset ) const;
125 /** Used by getZoneOffset() and getDSTOffset(). Parent is
126 CalendarFieldIndex for offset in minutes, child is CalendarFieldIndex
127 for offset in milliseconds. */
128 bool getCombinedOffset( sal_Int32 & o_nOffset, sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) const;
131 // ----------------------------------------------------
132 // class Calendar_hanja
133 // ----------------------------------------------------
134 class Calendar_hanja : public Calendar_gregorian
136 public:
137 // Constructors
138 Calendar_hanja();
139 virtual void SAL_CALL loadCalendar(const OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException);
140 virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) throw(com::sun::star::uno::RuntimeException);
143 // ----------------------------------------------------
144 // class Calendar_gengou
145 // ----------------------------------------------------
146 class Calendar_gengou : public Calendar_gregorian
148 public:
149 // Constructors
150 Calendar_gengou();
153 // ----------------------------------------------------
154 // class Calendar_ROC
155 // ----------------------------------------------------
156 class Calendar_ROC : public Calendar_gregorian
158 public:
159 // Constructors
160 Calendar_ROC();
163 // ----------------------------------------------------
164 // class Calendar_buddhist
165 // ----------------------------------------------------
166 class Calendar_buddhist : public Calendar_gregorian
168 public:
169 // Constructors
170 Calendar_buddhist();
172 // Methods in XExtendedCalendar
173 virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException);
176 } } } }
178 #endif
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */