xref: /aoo41x/main/offapi/com/sun/star/i18n/XCalendar.idl (revision d1766043)
1*d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*d1766043SAndrew Rist * distributed with this work for additional information
6*d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9*d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10*d1766043SAndrew Rist *
11*d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*d1766043SAndrew Rist *
13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d1766043SAndrew Rist * software distributed under the License is distributed on an
15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17*d1766043SAndrew Rist * specific language governing permissions and limitations
18*d1766043SAndrew Rist * under the License.
19*d1766043SAndrew Rist *
20*d1766043SAndrew Rist *************************************************************/
21*d1766043SAndrew Rist
22*d1766043SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir#ifndef __com_sun_star_i18n_XCalendar_idl__
25cdf0e10cSrcweir#define __com_sun_star_i18n_XCalendar_idl__
26cdf0e10cSrcweir
27cdf0e10cSrcweir#include <com/sun/star/lang/Locale.idl>
28cdf0e10cSrcweir#include <com/sun/star/i18n/Calendar.idl>
29cdf0e10cSrcweir#include <com/sun/star/i18n/CalendarItem.idl>
30cdf0e10cSrcweir
31cdf0e10cSrcweir//============================================================================
32cdf0e10cSrcweir
33cdf0e10cSrcweirmodule com { module sun { module star { module i18n {
34cdf0e10cSrcweir
35cdf0e10cSrcweir//============================================================================
36cdf0e10cSrcweir
37cdf0e10cSrcweir/**
38cdf0e10cSrcweir    Access to locale specific calendar systems.
39cdf0e10cSrcweir */
40cdf0e10cSrcweir
41cdf0e10cSrcweirpublished interface XCalendar : com::sun::star::uno::XInterface
42cdf0e10cSrcweir{
43cdf0e10cSrcweir    //------------------------------------------------------------------------
44cdf0e10cSrcweir    /// Load the default calendar for the given locale.
45cdf0e10cSrcweir    void    loadDefaultCalendar( [in] ::com::sun::star::lang::Locale rLocale );
46cdf0e10cSrcweir
47cdf0e10cSrcweir    //------------------------------------------------------------------------
48cdf0e10cSrcweir    /// Load a specific calendar for the given locale.
49cdf0e10cSrcweir    void    loadCalendar( [in] string uniqueID,
50cdf0e10cSrcweir                          [in] ::com::sun::star::lang::Locale rLocale );
51cdf0e10cSrcweir
52cdf0e10cSrcweir    //------------------------------------------------------------------------
53cdf0e10cSrcweir    /// Get the currently loaded <type>Calendar</type>.
54cdf0e10cSrcweir    Calendar    getLoadedCalendar();
55cdf0e10cSrcweir
56cdf0e10cSrcweir    //------------------------------------------------------------------------
57cdf0e10cSrcweir    /// Returns all available calendars for the given locale.
58cdf0e10cSrcweir    sequence< string >  getAllCalendars( [in] ::com::sun::star::lang::Locale rLocale );
59cdf0e10cSrcweir
60cdf0e10cSrcweir    //------------------------------------------------------------------------
61cdf0e10cSrcweir    /** Returns the ID string of the loaded calendar, for example,
62cdf0e10cSrcweir        <b>"gregorian"</b>
63cdf0e10cSrcweir     */
64cdf0e10cSrcweir    string  getUniqueID();
65cdf0e10cSrcweir
66cdf0e10cSrcweir    //------------------------------------------------------------------------
67cdf0e10cSrcweir    /**
68cdf0e10cSrcweir        Set the date/time as an offset to the start of the calendar at
69cdf0e10cSrcweir        1-Jan-1970 00:00. The integer part represents the number of days
70cdf0e10cSrcweir        passed since start date. The fractional part represents
71cdf0e10cSrcweir        fractions of a day, thus 0.5 means 12 hours.
72cdf0e10cSrcweir     */
73cdf0e10cSrcweir    void    setDateTime( [in] double nTimeInDays );
74cdf0e10cSrcweir
75cdf0e10cSrcweir    //------------------------------------------------------------------------
76cdf0e10cSrcweir    /**
77cdf0e10cSrcweir        Get the date/time as an offset to the start of the calendar at
78cdf0e10cSrcweir        1-Jan-1970 00:00. The integer part represents the number of days
79cdf0e10cSrcweir        passed since start date. The fractional part represents
80cdf0e10cSrcweir        fractions of a day, thus 0.5 means 12 hours.
81cdf0e10cSrcweir     */
82cdf0e10cSrcweir    double  getDateTime();
83cdf0e10cSrcweir
84cdf0e10cSrcweir    //------------------------------------------------------------------------
85cdf0e10cSrcweir    /**
86cdf0e10cSrcweir        Set the value of a field.
87cdf0e10cSrcweir
88cdf0e10cSrcweir        @param nCalendarFieldIndex
89cdf0e10cSrcweir            One of <type>CalendarFieldIndex</type> values.
90cdf0e10cSrcweir
91cdf0e10cSrcweir        @param nValue
92cdf0e10cSrcweir            A value of the allowed range for the field index.
93cdf0e10cSrcweir     */
94cdf0e10cSrcweir    void    setValue( [in] short nCalendarFieldIndex, [in] short nValue );
95cdf0e10cSrcweir
96cdf0e10cSrcweir    //------------------------------------------------------------------------
97cdf0e10cSrcweir    /**
98cdf0e10cSrcweir        Get the value of a field.
99cdf0e10cSrcweir
100cdf0e10cSrcweir        @param nCalendarFieldIndex
101cdf0e10cSrcweir            One of <type>CalendarFieldIndex</type> values.
102cdf0e10cSrcweir     */
103cdf0e10cSrcweir    short   getValue( [in] short nCalendarFieldIndex );
104cdf0e10cSrcweir
105cdf0e10cSrcweir    //------------------------------------------------------------------------
106cdf0e10cSrcweir    /**
107cdf0e10cSrcweir        Verify if the date fields set by a combination of
108cdf0e10cSrcweir        <member>XCalendar::setValue()</member> calls is valid. It has a
109cdf0e10cSrcweir        side-effect because it will internally calculate the final value
110cdf0e10cSrcweir        for the date fields
111cdf0e10cSrcweir     */
112cdf0e10cSrcweir    boolean isValid();
113cdf0e10cSrcweir
114cdf0e10cSrcweir    //------------------------------------------------------------------------
115cdf0e10cSrcweir    /**
116cdf0e10cSrcweir        Add an amount to a field.
117cdf0e10cSrcweir
118cdf0e10cSrcweir        @param nCalendarFieldIndex
119cdf0e10cSrcweir            One of <type>CalendarFieldIndex</type> values.
120cdf0e10cSrcweir
121cdf0e10cSrcweir        @param nAmount
122cdf0e10cSrcweir            The amount to add.
123cdf0e10cSrcweir     */
124cdf0e10cSrcweir    void    addValue( [in] short nCalendarFieldIndex, [in] long nAmount );
125cdf0e10cSrcweir
126cdf0e10cSrcweir    //------------------------------------------------------------------------
127cdf0e10cSrcweir    /** returns the first day of a week, one of <type>Weekdays</type>
128cdf0e10cSrcweir        values.
129cdf0e10cSrcweir     */
130cdf0e10cSrcweir    short   getFirstDayOfWeek();
131cdf0e10cSrcweir
132cdf0e10cSrcweir    //------------------------------------------------------------------------
133cdf0e10cSrcweir    /** Set the first day of a week, one of <type>Weekdays</type>
134cdf0e10cSrcweir        values.
135cdf0e10cSrcweir      */
136cdf0e10cSrcweir    void    setFirstDayOfWeek( [in] short nDay );
137cdf0e10cSrcweir
138cdf0e10cSrcweir    //------------------------------------------------------------------------
139cdf0e10cSrcweir    /** Set how many days of a week must reside in the first week of a
140cdf0e10cSrcweir        year.
141cdf0e10cSrcweir     */
142cdf0e10cSrcweir    void    setMinimumNumberOfDaysForFirstWeek( [in] short nDays );
143cdf0e10cSrcweir
144cdf0e10cSrcweir    //------------------------------------------------------------------------
145cdf0e10cSrcweir    /** returns how many days of a week must reside in the first week of
146cdf0e10cSrcweir        a year.
147cdf0e10cSrcweir     */
148cdf0e10cSrcweir    short   getMinimumNumberOfDaysForFirstWeek();
149cdf0e10cSrcweir
150cdf0e10cSrcweir    //------------------------------------------------------------------------
151cdf0e10cSrcweir    /// returns the number of months in a year, e.g. <b>12</b>
152cdf0e10cSrcweir    short   getNumberOfMonthsInYear();
153cdf0e10cSrcweir
154cdf0e10cSrcweir    //------------------------------------------------------------------------
155cdf0e10cSrcweir    /// returns the number of days in a week, e.g. <b>7</b>
156cdf0e10cSrcweir    short   getNumberOfDaysInWeek();
157cdf0e10cSrcweir
158cdf0e10cSrcweir    //------------------------------------------------------------------------
159cdf0e10cSrcweir    /** returns a sequence of <type>CalendarItem</type> describing the
160cdf0e10cSrcweir        month names.
161cdf0e10cSrcweir     */
162cdf0e10cSrcweir    sequence< CalendarItem >    getMonths();
163cdf0e10cSrcweir
164cdf0e10cSrcweir    //------------------------------------------------------------------------
165cdf0e10cSrcweir    /** returns a sequence of <type>CalendarItem</type> describing the
166cdf0e10cSrcweir        day names.
167cdf0e10cSrcweir     */
168cdf0e10cSrcweir    sequence< CalendarItem >    getDays();
169cdf0e10cSrcweir
170cdf0e10cSrcweir    //------------------------------------------------------------------------
171cdf0e10cSrcweir    /**
172cdf0e10cSrcweir        Returns a string (name to display) matching the given parameters.
173cdf0e10cSrcweir
174cdf0e10cSrcweir        @param nCalendarDisplayIndex
175cdf0e10cSrcweir            One of <type>CalendarDisplayIndex</type> values
176cdf0e10cSrcweir
177cdf0e10cSrcweir        @param nIdx
178cdf0e10cSrcweir            A value matching the <em>nCalendarDisplayIndex</em> type:
179cdf0e10cSrcweir            <dl>
180cdf0e10cSrcweir                <dt><const>CalendarDisplayIndex::AM_PM</const></dt>
181cdf0e10cSrcweir                    <dd>one of <type>AmPmValue</type></dd>
182cdf0e10cSrcweir                <dt><const>CalendarDisplayIndex::DAY</const></dt>
183cdf0e10cSrcweir                    <dd>one of <type>Weekdays</type> or a number used as
184cdf0e10cSrcweir                    an offset into the corresponding
185cdf0e10cSrcweir                    <member>Calendar::Days</member> sequence</dd>
186cdf0e10cSrcweir                <dt><const>CalendarDisplayIndex::MONTH</const></dt>
187cdf0e10cSrcweir                    <dd>one of <type>Months</type> or a number used as
188cdf0e10cSrcweir                    an offset into the corresponding
189cdf0e10cSrcweir                    <member>Calendar::Months</member> sequence</dd>
190cdf0e10cSrcweir                <dt><const>CalendarDisplayIndex::YEAR</const></dt>
191cdf0e10cSrcweir                    <dd>not used, empty string returned</dd>
192cdf0e10cSrcweir                <dt><const>CalendarDisplayIndex::ERA</const></dt>
193cdf0e10cSrcweir                    <dd>a number used as an offset into the
194cdf0e10cSrcweir                    corresponding <member>Calendar:Eras</member>
195cdf0e10cSrcweir                    sequence</dd>
196cdf0e10cSrcweir            </dl>
197cdf0e10cSrcweir
198cdf0e10cSrcweir            <p> The value should be obtained by a previous call to
199cdf0e10cSrcweir            <member>XCalendar::getValue()</member> with an appropriate
200cdf0e10cSrcweir            <type>CalendarFieldIndex</type> argument. </p>
201cdf0e10cSrcweir
202cdf0e10cSrcweir        @param nNameType
203cdf0e10cSrcweir            A value indicating whether to return the abbreviated or the
204cdf0e10cSrcweir            full name.
205cdf0e10cSrcweir            <dl>
206cdf0e10cSrcweir                <dt> 0 </dt>
207cdf0e10cSrcweir                    <dd>abbreviated name, e.g. <b>"Jan"</b></dd>
208cdf0e10cSrcweir                <dt> 1 </dt>
209cdf0e10cSrcweir                    <dd>full name, e.g. <b>"January"</b></dd>
210cdf0e10cSrcweir
211cdf0e10cSrcweir            <p> This parameter is not used if the
212cdf0e10cSrcweir            <em>nCalendarDisplayIndex</em> argument equals
213cdf0e10cSrcweir            <const>CalendarDisplayIndex::AM_PM</const> </p>
214cdf0e10cSrcweir     */
215cdf0e10cSrcweir
216cdf0e10cSrcweir    string  getDisplayName( [in] short nCalendarDisplayIndex,
217cdf0e10cSrcweir                            [in] short nIdx,
218cdf0e10cSrcweir                            [in] short nNameType );
219cdf0e10cSrcweir};
220cdf0e10cSrcweir
221cdf0e10cSrcweir//============================================================================
222cdf0e10cSrcweir}; }; }; };
223cdf0e10cSrcweir
224cdf0e10cSrcweir#endif
225