summaryrefslogtreecommitdiff
path: root/offapi
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-11-19 15:51:41 +0100
committerEike Rathke <erack@redhat.com>2011-11-19 16:15:22 +0100
commit4b030331f725c63bc5ef0f365091179f0e6a78e5 (patch)
treeb1ab159eb97161cab005297e8ef261bd20594c61 /offapi
parent769511019bd5a02a5a2c307c2c8558279742672c (diff)
add narrow (one letter) month names
While introducing Calendar2 and the XCalendar3 interface anyway, as well the "one letter" narrow month names sometimes needed in calendaring can be added. These are not always the first capitalized letters of the months in all locales, and might even not necessarily be just one character. Introduces a new struct css::i18n::Calendar2 that is not derived from css::i18n::Calendar because it uses a new struct css::i18n::CalendarItem2 to hold the NarrowName elements. In locale data the elements DaysOfMonth, MonthsOfYear and GenitiveMonths now have an optional element DefaultNarrowName. If not specified, the first character of DefaultFullName is taken. LocaleDataWrapper and CalendarWrapper use and return the new Calendar2 and sequences of CalendarItem2 structs. Application code adapted. The number formatter now displays narrow month names (genitive if applicable) for the MMMMM code, previously it displayed the first 16 bit code point of the full name (not even utf-16 aware). Narrow day names currently are not used, except in svtools' Calendar control.
Diffstat (limited to 'offapi')
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/i18n/Calendar2.idl40
-rw-r--r--offapi/com/sun/star/i18n/CalendarDisplayCode.idl90
-rw-r--r--offapi/com/sun/star/i18n/CalendarDisplayIndex.idl8
-rw-r--r--offapi/com/sun/star/i18n/CalendarItem2.idl63
-rw-r--r--offapi/com/sun/star/i18n/XCalendar.idl10
-rw-r--r--offapi/com/sun/star/i18n/XCalendar3.idl19
7 files changed, 178 insertions, 53 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 01d8eed8b26a..d02242952f88 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2561,6 +2561,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles,offapi,offapi/com/sun/star/i18n,\
CalendarDisplayIndex \
CalendarFieldIndex \
CalendarItem \
+ CalendarItem2 \
CharType \
CharacterIteratorMode \
CollatorOptions \
diff --git a/offapi/com/sun/star/i18n/Calendar2.idl b/offapi/com/sun/star/i18n/Calendar2.idl
index 0be7a22bae69..c06667883574 100644
--- a/offapi/com/sun/star/i18n/Calendar2.idl
+++ b/offapi/com/sun/star/i18n/Calendar2.idl
@@ -29,7 +29,7 @@
#ifndef __com_sun_star_i18n_Calendar2_idl__
#define __com_sun_star_i18n_Calendar2_idl__
-#include <com/sun/star/i18n/Calendar.idl>
+#include <com/sun/star/i18n/CalendarItem2.idl>
//=============================================================================
@@ -41,12 +41,17 @@ module com { module sun { module star { module i18n {
Calendar items as returned in a sequence by
<member>XLocaleData3::getAllCalendars2()</member>.
- <p> Derived from
+ <p> Similar to
<type scope="::com::sun::star::i18n">Calendar</type> this provides
an additional member with a sequence of possessive (genitive case)
month names for locales that use them, for example Slavic locales.
If a locale does not provide the possessive form, the names are
- identical to the nouns in <member>Calendar::Months</member>
+ identical to the nouns in <member>Calendar::Months</member> </p>
+
+ <p> The sequences are of type
+ <type scope="com::sun::star::i18n">CalendarItem2</type> instead of
+ <type scope="com::sun::star::i18n">CalendarItem</type>, with the
+ additional <member>NarrowName</member> member.
@see XLocaleData
for links to DTD of XML locale data files.
@@ -54,12 +59,31 @@ module com { module sun { module star { module i18n {
@since LibreOffice 3.5
*/
-published struct Calendar2 : com::sun::star::i18n::Calendar
+published struct Calendar2
{
- /** the months of the year in possessive genitive case, see also
- <type>CalendarItem</type>.
- */
- sequence< CalendarItem > GenitiveMonths;
+ /// The days of the week.
+ sequence< CalendarItem2 > Days;
+
+ /// The months of the year.
+ sequence< CalendarItem2 > Months;
+
+ /// The months of the year in possessive genitive case.
+ sequence< CalendarItem2 > GenitiveMonths;
+
+ /// The possible eras.
+ sequence< CalendarItem2 > Eras;
+
+ /// The ID of the day with which the week begins.
+ string StartOfWeek;
+
+ /// How many days must reside in the first week of a year.
+ short MinimumNumberOfDaysForFirstWeek;
+
+ /// If this is the default calendar for a given locale.
+ boolean Default;
+
+ /// The name of the calendar, for example, <b>Gregorian</b>.
+ string Name;
};
//=============================================================================
diff --git a/offapi/com/sun/star/i18n/CalendarDisplayCode.idl b/offapi/com/sun/star/i18n/CalendarDisplayCode.idl
index 5f77985951e6..e7ce30c798f1 100644
--- a/offapi/com/sun/star/i18n/CalendarDisplayCode.idl
+++ b/offapi/com/sun/star/i18n/CalendarDisplayCode.idl
@@ -47,51 +47,67 @@ module com { module sun { module star { module i18n {
*/
published constants CalendarDisplayCode
{
- /// Day of month, one or two digits, no leading zero.
- const long SHORT_DAY = 1;
- /// Day of month, two digits, with leading zero.
- const long LONG_DAY = 2;
- /// Day of week, abbreviated name.
- const long SHORT_DAY_NAME = 3;
- /// Day of week, full name.
- const long LONG_DAY_NAME = 4;
-
- /// Month of year, one or two digits, no leading zero.
- const long SHORT_MONTH = 5;
- /// Month of year, with leading zero.
- const long LONG_MONTH = 6;
- /// Full month name.
- const long SHORT_MONTH_NAME = 7;
- /// Abbreviated month name.
- const long LONG_MONTH_NAME = 8;
-
- /// Year, two digits.
- const long SHORT_YEAR = 9;
- /// Year, four digits.
- const long LONG_YEAR = 10;
- /// Full era name, for example, "Before Christ" or "Anno Dominus".
- const long SHORT_ERA = 11;
- /// Abbreviated era name, for example, BC or AD.
- const long LONG_ERA = 12;
- /// Combined short year and era, order depends on locale/calendar.
- const long SHORT_YEAR_AND_ERA = 13;
- /// Combined full year and era, order depends on locale/calendar.
- const long LONG_YEAR_AND_ERA = 14;
-
- /// Short quarter, for example, "Q1"
- const long SHORT_QUARTER = 15;
- /// Long quarter, for example, "1st quarter"
- const long LONG_QUARTER = 16;
+ /// Day of month, one or two digits, no leading zero.
+ const long SHORT_DAY = 1;
+ /// Day of month, two digits, with leading zero.
+ const long LONG_DAY = 2;
+ /// Day of week, abbreviated name.
+ const long SHORT_DAY_NAME = 3;
+ /// Day of week, full name.
+ const long LONG_DAY_NAME = 4;
+
+ /// Month of year, one or two digits, no leading zero.
+ const long SHORT_MONTH = 5;
+ /// Month of year, with leading zero.
+ const long LONG_MONTH = 6;
+ /// Full month name.
+ const long SHORT_MONTH_NAME = 7;
+ /// Abbreviated month name.
+ const long LONG_MONTH_NAME = 8;
+
+ /// Year, two digits.
+ const long SHORT_YEAR = 9;
+ /// Year, four digits.
+ const long LONG_YEAR = 10;
+ /// Full era name, for example, "Before Christ" or "Anno Dominus".
+ const long SHORT_ERA = 11;
+ /// Abbreviated era name, for example, BC or AD.
+ const long LONG_ERA = 12;
+ /// Combined short year and era, order depends on locale/calendar.
+ const long SHORT_YEAR_AND_ERA = 13;
+ /// Combined full year and era, order depends on locale/calendar.
+ const long LONG_YEAR_AND_ERA = 14;
+
+ /// Short quarter, for example, "Q1"
+ const long SHORT_QUARTER = 15;
+ /// Long quarter, for example, "1st quarter"
+ const long LONG_QUARTER = 16;
/** Abbreviated possessive genitive case month name.
@since LibreOffice 3.5
*/
- const long SHORT_GENITIVE_MONTH_NAME = 17;
+ const long SHORT_GENITIVE_MONTH_NAME = 17;
/** Full possessive genitive case month name.
@since LibreOffice 3.5
*/
- const long LONG_GENITIVE_MONTH_NAME = 18;
+ const long LONG_GENITIVE_MONTH_NAME = 18;
+
+ /** Narrow possessive genitive case month name.
+ @since LibreOffice 3.5
+ */
+ const long NARROW_GENITIVE_MONTH_NAME = 19;
+
+ /** Day of week, narrow name.
+ @since LibreOffice 3.5
+ */
+ const long NARROW_DAY_NAME = 20;
+
+ /** Narrow month name.
+ @since LibreOffice 3.5
+ */
+ const long NARROW_MONTH_NAME = 21;
+
};
//=============================================================================
diff --git a/offapi/com/sun/star/i18n/CalendarDisplayIndex.idl b/offapi/com/sun/star/i18n/CalendarDisplayIndex.idl
index 76f17e37c976..777f9fa36144 100644
--- a/offapi/com/sun/star/i18n/CalendarDisplayIndex.idl
+++ b/offapi/com/sun/star/i18n/CalendarDisplayIndex.idl
@@ -42,13 +42,13 @@ published constants CalendarDisplayIndex
{
/// name of an AM/PM value
const short AM_PM = 0;
- /// name of a day of week
+ /// name of a day of week
const short DAY = 1;
- /// name of a month
+ /// name of a month
const short MONTH = 2;
- /// name of a year (if used for a specific calendar)
+ /// name of a year (if used for a specific calendar)
const short YEAR = 3;
- /// name of an era, like BC/AD
+ /// name of an era, like BC/AD
const short ERA = 4;
/** name of a possessive genitive case month
diff --git a/offapi/com/sun/star/i18n/CalendarItem2.idl b/offapi/com/sun/star/i18n/CalendarItem2.idl
new file mode 100644
index 000000000000..a284441c279c
--- /dev/null
+++ b/offapi/com/sun/star/i18n/CalendarItem2.idl
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Eike Rathke <erack@redhat.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef __com_sun_star_i18n_CalendarItem2_idl__
+#define __com_sun_star_i18n_CalendarItem2_idl__
+
+#include <com/sun/star/i18n/CalendarItem.idl>
+
+//=============================================================================
+
+module com { module sun { module star { module i18n {
+
+//=============================================================================
+
+
+/**
+ One entry in a calendar, for example, a day of week or a month or an
+ era.
+
+ <p> Derived from <type scope="com::sun::star::i18n">CalendarItem</type>
+ this provides an additional member for narrow names. </p>
+
+ @since LibreOffice 3.5
+ */
+
+published struct CalendarItem2 : com::sun::star::i18n::CalendarItem
+{
+ /** The narrow name, for example, <b>"S"</b> for Sunday or
+ <b>"J"</b> for January.
+ */
+ string NarrowName;
+};
+
+//=============================================================================
+}; }; }; };
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/i18n/XCalendar.idl b/offapi/com/sun/star/i18n/XCalendar.idl
index 49ab4b690dd8..4dacf04e4bcb 100644
--- a/offapi/com/sun/star/i18n/XCalendar.idl
+++ b/offapi/com/sun/star/i18n/XCalendar.idl
@@ -209,12 +209,20 @@ published interface XCalendar : com::sun::star::uno::XInterface
@param nNameType
A value indicating whether to return the abbreviated or the
- full name.
+ full name, or the narrow name for some
+ <type>CalendarDisplayIndex</type> values.
<dl>
<dt> 0 </dt>
<dd>abbreviated name, e.g. <b>"Jan"</b></dd>
<dt> 1 </dt>
<dd>full name, e.g. <b>"January"</b></dd>
+ <dt> 2 </dt>
+ <dd>narrow name, e.g. <b>"J"</b> <br>
+ Valid only for <const>CalendarDisplayIndex::DAY</const>,
+ <const>CalendarDisplayIndex::MONTH</const> and
+ <const>CalendarDisplayIndex::GENITIVE_MONTH</const> <br>
+ @since LibreOffice 3.5
+ </dd>
<p> This parameter is not used if the
<em>nCalendarDisplayIndex</em> argument equals
diff --git a/offapi/com/sun/star/i18n/XCalendar3.idl b/offapi/com/sun/star/i18n/XCalendar3.idl
index 8de955031518..2ffe25b627a1 100644
--- a/offapi/com/sun/star/i18n/XCalendar3.idl
+++ b/offapi/com/sun/star/i18n/XCalendar3.idl
@@ -46,7 +46,8 @@ module com { module sun { module star { module i18n {
<p> It is derived from
<type scope="::com::sun::star::i18n">XExtendedCalendar</type> and
provides additional methods to obtain <type>Calendar2</type> items
- that include the possessive genitive case month names. </p>
+ that include the possessive genitive case month names and sequences
+ of <type>CalendarItem2</type> items.. </p>
@since LibreOffice 3.5
*/
@@ -57,10 +58,22 @@ published interface XCalendar3 : com::sun::star::i18n::XExtendedCalendar
Calendar2 getLoadedCalendar2();
//------------------------------------------------------------------------
- /** returns a sequence of <type>CalendarItem</type> describing the
+ /** returns a sequence of <type>CalendarItem2</type> describing the
+ day names.
+ */
+ sequence< CalendarItem2 > getDays2();
+
+ //------------------------------------------------------------------------
+ /** returns a sequence of <type>CalendarItem2</type> describing the
+ month names.
+ */
+ sequence< CalendarItem2 > getMonths2();
+
+ //------------------------------------------------------------------------
+ /** returns a sequence of <type>CalendarItem2</type> describing the
genitive case month names.
*/
- sequence< CalendarItem > getGenitiveMonths();
+ sequence< CalendarItem2 > getGenitiveMonths2();
};