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