Update ooo320-m1
[ooovba.git] / offapi / com / sun / star / i18n / XCalendar.idl
blobad3cee3d4c4a71e46cc963ef8b077293b5c8503a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XCalendar.idl,v $
10 * $Revision: 1.13 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __com_sun_star_i18n_XCalendar_idl__
32 #define __com_sun_star_i18n_XCalendar_idl__
34 #include <com/sun/star/lang/Locale.idl>
35 #include <com/sun/star/i18n/Calendar.idl>
36 #include <com/sun/star/i18n/CalendarItem.idl>
38 //============================================================================
40 module com { module sun { module star { module i18n {
42 //============================================================================
44 /**
45 Access to locale specific calendar systems.
48 published interface XCalendar : com::sun::star::uno::XInterface
50 //------------------------------------------------------------------------
51 /// Load the default calendar for the given locale.
52 void loadDefaultCalendar( [in] ::com::sun::star::lang::Locale rLocale );
54 //------------------------------------------------------------------------
55 /// Load a specific calendar for the given locale.
56 void loadCalendar( [in] string uniqueID,
57 [in] ::com::sun::star::lang::Locale rLocale );
59 //------------------------------------------------------------------------
60 /// Get the currently loaded <type>Calendar</type>.
61 Calendar getLoadedCalendar();
63 //------------------------------------------------------------------------
64 /// Returns all available calendars for the given locale.
65 sequence< string > getAllCalendars( [in] ::com::sun::star::lang::Locale rLocale );
67 //------------------------------------------------------------------------
68 /** Returns the ID string of the loaded calendar, for example,
69 <b>"gregorian"</b>
71 string getUniqueID();
73 //------------------------------------------------------------------------
74 /**
75 Set the date/time as an offset to the start of the calendar at
76 1-Jan-1970 00:00. The integer part represents the number of days
77 passed since start date. The fractional part represents
78 fractions of a day, thus 0.5 means 12 hours.
80 void setDateTime( [in] double nTimeInDays );
82 //------------------------------------------------------------------------
83 /**
84 Get the date/time as an offset to the start of the calendar at
85 1-Jan-1970 00:00. The integer part represents the number of days
86 passed since start date. The fractional part represents
87 fractions of a day, thus 0.5 means 12 hours.
89 double getDateTime();
91 //------------------------------------------------------------------------
92 /**
93 Set the value of a field.
95 @param nCalendarFieldIndex
96 One of <type>CalendarFieldIndex</type> values.
98 @param nValue
99 A value of the allowed range for the field index.
101 void setValue( [in] short nCalendarFieldIndex, [in] short nValue );
103 //------------------------------------------------------------------------
105 Get the value of a field.
107 @param nCalendarFieldIndex
108 One of <type>CalendarFieldIndex</type> values.
110 short getValue( [in] short nCalendarFieldIndex );
112 //------------------------------------------------------------------------
114 Verify if the date fields set by a combination of
115 <member>XCalendar::setValue()</member> calls is valid. It has a
116 side-effect because it will internally calculate the final value
117 for the date fields
119 boolean isValid();
121 //------------------------------------------------------------------------
123 Add an amount to a field.
125 @param nCalendarFieldIndex
126 One of <type>CalendarFieldIndex</type> values.
128 @param nAmount
129 The amount to add.
131 void addValue( [in] short nCalendarFieldIndex, [in] long nAmount );
133 //------------------------------------------------------------------------
134 /** returns the first day of a week, one of <type>Weekdays</type>
135 values.
137 short getFirstDayOfWeek();
139 //------------------------------------------------------------------------
140 /** Set the first day of a week, one of <type>Weekdays</type>
141 values.
143 void setFirstDayOfWeek( [in] short nDay );
145 //------------------------------------------------------------------------
146 /** Set how many days of a week must reside in the first week of a
147 year.
149 void setMinimumNumberOfDaysForFirstWeek( [in] short nDays );
151 //------------------------------------------------------------------------
152 /** returns how many days of a week must reside in the first week of
153 a year.
155 short getMinimumNumberOfDaysForFirstWeek();
157 //------------------------------------------------------------------------
158 /// returns the number of months in a year, e.g. <b>12</b>
159 short getNumberOfMonthsInYear();
161 //------------------------------------------------------------------------
162 /// returns the number of days in a week, e.g. <b>7</b>
163 short getNumberOfDaysInWeek();
165 //------------------------------------------------------------------------
166 /** returns a sequence of <type>CalendarItem</type> describing the
167 month names.
169 sequence< CalendarItem > getMonths();
171 //------------------------------------------------------------------------
172 /** returns a sequence of <type>CalendarItem</type> describing the
173 day names.
175 sequence< CalendarItem > getDays();
177 //------------------------------------------------------------------------
179 Returns a string (name to display) matching the given parameters.
181 @param nCalendarDisplayIndex
182 One of <type>CalendarDisplayIndex</type> values
184 @param nIdx
185 A value matching the <em>nCalendarDisplayIndex</em> type:
186 <dl>
187 <dt><const>CalendarDisplayIndex::AM_PM</const></dt>
188 <dd>one of <type>AmPmValue</type></dd>
189 <dt><const>CalendarDisplayIndex::DAY</const></dt>
190 <dd>one of <type>Weekdays</type> or a number used as
191 an offset into the corresponding
192 <member>Calendar::Days</member> sequence</dd>
193 <dt><const>CalendarDisplayIndex::MONTH</const></dt>
194 <dd>one of <type>Months</type> or a number used as
195 an offset into the corresponding
196 <member>Calendar::Months</member> sequence</dd>
197 <dt><const>CalendarDisplayIndex::YEAR</const></dt>
198 <dd>not used, empty string returned</dd>
199 <dt><const>CalendarDisplayIndex::ERA</const></dt>
200 <dd>a number used as an offset into the
201 corresponding <member>Calendar:Eras</member>
202 sequence</dd>
203 </dl>
205 <p> The value should be obtained by a previous call to
206 <member>XCalendar::getValue()</member> with an appropriate
207 <type>CalendarFieldIndex</type> argument. </p>
209 @param nNameType
210 A value indicating whether to return the abbreviated or the
211 full name.
212 <dl>
213 <dt> 0 </dt>
214 <dd>abbreviated name, e.g. <b>"Jan"</b></dd>
215 <dt> 1 </dt>
216 <dd>full name, e.g. <b>"January"</b></dd>
218 <p> This parameter is not used if the
219 <em>nCalendarDisplayIndex</em> argument equals
220 <const>CalendarDisplayIndex::AM_PM</const> </p>
223 string getDisplayName( [in] short nCalendarDisplayIndex,
224 [in] short nIdx,
225 [in] short nNameType );
228 //============================================================================
229 }; }; }; };
231 #endif