Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_I18NPOOL_INC_CALENDAR_HIJRI_HXX
20 : #define INCLUDED_I18NPOOL_INC_CALENDAR_HIJRI_HXX
21 :
22 : #include "calendar_gregorian.hxx"
23 :
24 :
25 :
26 : // class Calendar_hijri
27 :
28 :
29 : namespace com { namespace sun { namespace star { namespace i18n {
30 :
31 0 : class Calendar_hijri : public Calendar_gregorian
32 : {
33 : public:
34 :
35 : // Constructors
36 : Calendar_hijri();
37 :
38 : protected:
39 : void mapToGregorian() throw(com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
40 : void mapFromGregorian() throw(com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
41 :
42 : // radians per degree (pi/180)
43 : static const double RadPerDeg;
44 :
45 : // Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec
46 : static const double SynPeriod;
47 :
48 : static const double SynMonth; // Solar days in a year/SynPeriod
49 :
50 : // Julian day on Jan 1, 1900
51 : static const double jd1900;
52 :
53 : // Reference point: September 1984 25d 3h 10m UT. == 1405 Hijri == 1048 Synodial month from 1900
54 : static const sal_Int32 SynRef;
55 : static const sal_Int32 GregRef;
56 :
57 : // Local time (Saudi Arabia)
58 : static const double SA_TimeZone; // Time Zone
59 :
60 : // Period between 1.30pm - 6:30pm
61 : static const double EveningPeriod;
62 :
63 : // "Leap" years
64 : static const sal_Int32 LeapYear[];
65 :
66 : private:
67 : static double NewMoon(sal_Int32 n);
68 : static void getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year);
69 : static void ToGregorian(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year);
70 : static void getGregorianDay(sal_Int32 jd, sal_Int32 *pnDay, sal_Int32 *pnMonth, sal_Int32 *pnYear);
71 : static double getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year);
72 : };
73 :
74 : } } } }
75 :
76 : #endif
77 :
78 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|