xref: /aoo42x/main/i18npool/inc/calendar_hijri.hxx (revision f7bd9df4)
1*f7bd9df4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f7bd9df4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f7bd9df4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f7bd9df4SAndrew Rist  * distributed with this work for additional information
6*f7bd9df4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f7bd9df4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f7bd9df4SAndrew Rist  * "License"); you may not use this file except in compliance
9*f7bd9df4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f7bd9df4SAndrew Rist  *
11*f7bd9df4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f7bd9df4SAndrew Rist  *
13*f7bd9df4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f7bd9df4SAndrew Rist  * software distributed under the License is distributed on an
15*f7bd9df4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f7bd9df4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f7bd9df4SAndrew Rist  * specific language governing permissions and limitations
18*f7bd9df4SAndrew Rist  * under the License.
19*f7bd9df4SAndrew Rist  *
20*f7bd9df4SAndrew Rist  *************************************************************/
21*f7bd9df4SAndrew Rist 
22*f7bd9df4SAndrew Rist 
23cdf0e10cSrcweir #ifndef _I18N_CALENDAR_HIJRI_HXX_
24cdf0e10cSrcweir #define _I18N_CALENDAR_HIJRI_HXX_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "calendar_gregorian.hxx"
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir //	----------------------------------------------------
30cdf0e10cSrcweir //	class Calendar_hijri
31cdf0e10cSrcweir //	----------------------------------------------------
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n {
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class Calendar_hijri : public Calendar_gregorian
36cdf0e10cSrcweir {
37cdf0e10cSrcweir public:
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 	// Constructors
40cdf0e10cSrcweir 	Calendar_hijri();
41cdf0e10cSrcweir 
42cdf0e10cSrcweir protected:
43cdf0e10cSrcweir 	void mapToGregorian() throw(com::sun::star::uno::RuntimeException);
44cdf0e10cSrcweir 	void mapFromGregorian() throw(com::sun::star::uno::RuntimeException);
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 	// radians per degree (pi/180)
47cdf0e10cSrcweir 	static const double RadPerDeg;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 	// Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec
50cdf0e10cSrcweir 	static const double SynPeriod;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	static const double SynMonth;			// Solar days in a year/SynPeriod
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	// Julian day on Jan 1, 1900
55cdf0e10cSrcweir 	static const double jd1900;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 	// Reference point: September 1984 25d 3h 10m UT. == 1405 Hijri == 1048 Synodial month from 1900
58cdf0e10cSrcweir 	static const sal_Int32 SynRef;
59cdf0e10cSrcweir 	static const sal_Int32 GregRef;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	// Local time (Saudi Arabia)
62cdf0e10cSrcweir 	static const double SA_TimeZone;		// Time Zone
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	// Period between 1.30pm - 6:30pm
65cdf0e10cSrcweir 	static const double EveningPeriod;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	// "Leap" years
68cdf0e10cSrcweir 	static const sal_Int32 LeapYear[];
69cdf0e10cSrcweir 
70cdf0e10cSrcweir private:
71cdf0e10cSrcweir 	double NewMoon(sal_Int32 n);
72cdf0e10cSrcweir 	void getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year);
73cdf0e10cSrcweir 	void ToGregorian(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year);
74cdf0e10cSrcweir 	void getGregorianDay(sal_Int32 jd, sal_Int32 *pnDay, sal_Int32 *pnMonth, sal_Int32 *pnYear);
75cdf0e10cSrcweir 	double getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year);
76cdf0e10cSrcweir };
77cdf0e10cSrcweir 
78cdf0e10cSrcweir } } } }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir #endif
81