merged tag ooo/OOO330_m14
[LibreOffice.git] / offapi / com / sun / star / i18n / XCalendar.idl
blob04fd12bf73e47f335a909cd9f31e2cb7b7338dee
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef __com_sun_star_i18n_XCalendar_idl__
29 #define __com_sun_star_i18n_XCalendar_idl__
31 #include <com/sun/star/lang/Locale.idl>
32 #include <com/sun/star/i18n/Calendar.idl>
33 #include <com/sun/star/i18n/CalendarItem.idl>
35 //============================================================================
37 module com { module sun { module star { module i18n {
39 //============================================================================
41 /**
42 Access to locale specific calendar systems.
45 published interface XCalendar : com::sun::star::uno::XInterface
47 //------------------------------------------------------------------------
48 /// Load the default calendar for the given locale.
49 void loadDefaultCalendar( [in] ::com::sun::star::lang::Locale rLocale );
51 //------------------------------------------------------------------------
52 /// Load a specific calendar for the given locale.
53 void loadCalendar( [in] string uniqueID,
54 [in] ::com::sun::star::lang::Locale rLocale );
56 //------------------------------------------------------------------------
57 /// Get the currently loaded <type>Calendar</type>.
58 Calendar getLoadedCalendar();
60 //------------------------------------------------------------------------
61 /// Returns all available calendars for the given locale.
62 sequence< string > getAllCalendars( [in] ::com::sun::star::lang::Locale rLocale );
64 //------------------------------------------------------------------------
65 /** Returns the ID string of the loaded calendar, for example,
66 <b>"gregorian"</b>
68 string getUniqueID();
70 //------------------------------------------------------------------------
71 /**
72 Set the date/time as an offset to the start of the calendar at
73 1-Jan-1970 00:00. The integer part represents the number of days
74 passed since start date. The fractional part represents
75 fractions of a day, thus 0.5 means 12 hours.
77 void setDateTime( [in] double nTimeInDays );
79 //------------------------------------------------------------------------
80 /**
81 Get the date/time as an offset to the start of the calendar at
82 1-Jan-1970 00:00. The integer part represents the number of days
83 passed since start date. The fractional part represents
84 fractions of a day, thus 0.5 means 12 hours.
86 double getDateTime();
88 //------------------------------------------------------------------------
89 /**
90 Set the value of a field.
92 @param nCalendarFieldIndex
93 One of <type>CalendarFieldIndex</type> values.
95 @param nValue
96 A value of the allowed range for the field index.
98 void setValue( [in] short nCalendarFieldIndex, [in] short nValue );
100 //------------------------------------------------------------------------
102 Get the value of a field.
104 @param nCalendarFieldIndex
105 One of <type>CalendarFieldIndex</type> values.
107 short getValue( [in] short nCalendarFieldIndex );
109 //------------------------------------------------------------------------
111 Verify if the date fields set by a combination of
112 <member>XCalendar::setValue()</member> calls is valid. It has a
113 side-effect because it will internally calculate the final value
114 for the date fields
116 boolean isValid();
118 //------------------------------------------------------------------------
120 Add an amount to a field.
122 @param nCalendarFieldIndex
123 One of <type>CalendarFieldIndex</type> values.
125 @param nAmount
126 The amount to add.
128 void addValue( [in] short nCalendarFieldIndex, [in] long nAmount );
130 //------------------------------------------------------------------------
131 /** returns the first day of a week, one of <type>Weekdays</type>
132 values.
134 short getFirstDayOfWeek();
136 //------------------------------------------------------------------------
137 /** Set the first day of a week, one of <type>Weekdays</type>
138 values.
140 void setFirstDayOfWeek( [in] short nDay );
142 //------------------------------------------------------------------------
143 /** Set how many days of a week must reside in the first week of a
144 year.
146 void setMinimumNumberOfDaysForFirstWeek( [in] short nDays );
148 //------------------------------------------------------------------------
149 /** returns how many days of a week must reside in the first week of
150 a year.
152 short getMinimumNumberOfDaysForFirstWeek();
154 //------------------------------------------------------------------------
155 /// returns the number of months in a year, e.g. <b>12</b>
156 short getNumberOfMonthsInYear();
158 //------------------------------------------------------------------------
159 /// returns the number of days in a week, e.g. <b>7</b>
160 short getNumberOfDaysInWeek();
162 //------------------------------------------------------------------------
163 /** returns a sequence of <type>CalendarItem</type> describing the
164 month names.
166 sequence< CalendarItem > getMonths();
168 //------------------------------------------------------------------------
169 /** returns a sequence of <type>CalendarItem</type> describing the
170 day names.
172 sequence< CalendarItem > getDays();
174 //------------------------------------------------------------------------
176 Returns a string (name to display) matching the given parameters.
178 @param nCalendarDisplayIndex
179 One of <type>CalendarDisplayIndex</type> values
181 @param nIdx
182 A value matching the <em>nCalendarDisplayIndex</em> type:
183 <dl>
184 <dt><const>CalendarDisplayIndex::AM_PM</const></dt>
185 <dd>one of <type>AmPmValue</type></dd>
186 <dt><const>CalendarDisplayIndex::DAY</const></dt>
187 <dd>one of <type>Weekdays</type> or a number used as
188 an offset into the corresponding
189 <member>Calendar::Days</member> sequence</dd>
190 <dt><const>CalendarDisplayIndex::MONTH</const></dt>
191 <dd>one of <type>Months</type> or a number used as
192 an offset into the corresponding
193 <member>Calendar::Months</member> sequence</dd>
194 <dt><const>CalendarDisplayIndex::YEAR</const></dt>
195 <dd>not used, empty string returned</dd>
196 <dt><const>CalendarDisplayIndex::ERA</const></dt>
197 <dd>a number used as an offset into the
198 corresponding <member>Calendar:Eras</member>
199 sequence</dd>
200 </dl>
202 <p> The value should be obtained by a previous call to
203 <member>XCalendar::getValue()</member> with an appropriate
204 <type>CalendarFieldIndex</type> argument. </p>
206 @param nNameType
207 A value indicating whether to return the abbreviated or the
208 full name.
209 <dl>
210 <dt> 0 </dt>
211 <dd>abbreviated name, e.g. <b>"Jan"</b></dd>
212 <dt> 1 </dt>
213 <dd>full name, e.g. <b>"January"</b></dd>
215 <p> This parameter is not used if the
216 <em>nCalendarDisplayIndex</em> argument equals
217 <const>CalendarDisplayIndex::AM_PM</const> </p>
220 string getDisplayName( [in] short nCalendarDisplayIndex,
221 [in] short nIdx,
222 [in] short nNameType );
225 //============================================================================
226 }; }; }; };
228 #endif