1/************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 28#ifndef __com_sun_star_i18n_XCalendar_idl__ 29#define __com_sun_star_i18n_XCalendar_idl__ 30 31#include <com/sun/star/lang/Locale.idl> 32#include <com/sun/star/i18n/Calendar.idl> 33#include <com/sun/star/i18n/CalendarItem.idl> 34 35//============================================================================ 36 37module com { module sun { module star { module i18n { 38 39//============================================================================ 40 41/** 42 Access to locale specific calendar systems. 43 */ 44 45published interface XCalendar : com::sun::star::uno::XInterface 46{ 47 //------------------------------------------------------------------------ 48 /// Load the default calendar for the given locale. 49 void loadDefaultCalendar( [in] ::com::sun::star::lang::Locale rLocale ); 50 51 //------------------------------------------------------------------------ 52 /// Load a specific calendar for the given locale. 53 void loadCalendar( [in] string uniqueID, 54 [in] ::com::sun::star::lang::Locale rLocale ); 55 56 //------------------------------------------------------------------------ 57 /// Get the currently loaded <type>Calendar</type>. 58 Calendar getLoadedCalendar(); 59 60 //------------------------------------------------------------------------ 61 /// Returns all available calendars for the given locale. 62 sequence< string > getAllCalendars( [in] ::com::sun::star::lang::Locale rLocale ); 63 64 //------------------------------------------------------------------------ 65 /** Returns the ID string of the loaded calendar, for example, 66 <b>"gregorian"</b> 67 */ 68 string getUniqueID(); 69 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. 76 */ 77 void setDateTime( [in] double nTimeInDays ); 78 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. 85 */ 86 double getDateTime(); 87 88 //------------------------------------------------------------------------ 89 /** 90 Set the value of a field. 91 92 @param nCalendarFieldIndex 93 One of <type>CalendarFieldIndex</type> values. 94 95 @param nValue 96 A value of the allowed range for the field index. 97 */ 98 void setValue( [in] short nCalendarFieldIndex, [in] short nValue ); 99 100 //------------------------------------------------------------------------ 101 /** 102 Get the value of a field. 103 104 @param nCalendarFieldIndex 105 One of <type>CalendarFieldIndex</type> values. 106 */ 107 short getValue( [in] short nCalendarFieldIndex ); 108 109 //------------------------------------------------------------------------ 110 /** 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 115 */ 116 boolean isValid(); 117 118 //------------------------------------------------------------------------ 119 /** 120 Add an amount to a field. 121 122 @param nCalendarFieldIndex 123 One of <type>CalendarFieldIndex</type> values. 124 125 @param nAmount 126 The amount to add. 127 */ 128 void addValue( [in] short nCalendarFieldIndex, [in] long nAmount ); 129 130 //------------------------------------------------------------------------ 131 /** returns the first day of a week, one of <type>Weekdays</type> 132 values. 133 */ 134 short getFirstDayOfWeek(); 135 136 //------------------------------------------------------------------------ 137 /** Set the first day of a week, one of <type>Weekdays</type> 138 values. 139 */ 140 void setFirstDayOfWeek( [in] short nDay ); 141 142 //------------------------------------------------------------------------ 143 /** Set how many days of a week must reside in the first week of a 144 year. 145 */ 146 void setMinimumNumberOfDaysForFirstWeek( [in] short nDays ); 147 148 //------------------------------------------------------------------------ 149 /** returns how many days of a week must reside in the first week of 150 a year. 151 */ 152 short getMinimumNumberOfDaysForFirstWeek(); 153 154 //------------------------------------------------------------------------ 155 /// returns the number of months in a year, e.g. <b>12</b> 156 short getNumberOfMonthsInYear(); 157 158 //------------------------------------------------------------------------ 159 /// returns the number of days in a week, e.g. <b>7</b> 160 short getNumberOfDaysInWeek(); 161 162 //------------------------------------------------------------------------ 163 /** returns a sequence of <type>CalendarItem</type> describing the 164 month names. 165 */ 166 sequence< CalendarItem > getMonths(); 167 168 //------------------------------------------------------------------------ 169 /** returns a sequence of <type>CalendarItem</type> describing the 170 day names. 171 */ 172 sequence< CalendarItem > getDays(); 173 174 //------------------------------------------------------------------------ 175 /** 176 Returns a string (name to display) matching the given parameters. 177 178 @param nCalendarDisplayIndex 179 One of <type>CalendarDisplayIndex</type> values 180 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> 201 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> 205 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> 214 215 <p> This parameter is not used if the 216 <em>nCalendarDisplayIndex</em> argument equals 217 <const>CalendarDisplayIndex::AM_PM</const> </p> 218 */ 219 220 string getDisplayName( [in] short nCalendarDisplayIndex, 221 [in] short nIdx, 222 [in] short nNameType ); 223}; 224 225//============================================================================ 226}; }; }; }; 227 228#endif 229