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