From 4b030331f725c63bc5ef0f365091179f0e6a78e5 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sat, 19 Nov 2011 15:51:41 +0100 Subject: 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. --- svtools/source/control/calendar.cxx | 7 ++----- svtools/workben/svdem.cxx | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'svtools') diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 46101bc413a5..b49c53ced61a 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -467,12 +467,9 @@ void Calendar::ImplFormat() sal_Int16 nDay = maCalendarWrapper.getFirstDayOfWeek(); for ( sal_Int16 nDayOfWeek = 0; nDayOfWeek < 7; nDayOfWeek++ ) { - // Use first character of full name, since the abbreviated name may - // be roman digits or similar in some locales. Proper - // implementation would need narrow one letter month names defined - // in locale data. + // Use narrow name. String aDayOfWeek( maCalendarWrapper.getDisplayName( - i18n::CalendarDisplayIndex::DAY, nDay, 1).GetChar(0)); + i18n::CalendarDisplayIndex::DAY, nDay, 2)); long nOffX = (mnDayWidth-GetTextWidth( aDayOfWeek ))/2; if ( mnWinStyle & WB_BOLDTEXT ) nOffX++; diff --git a/svtools/workben/svdem.cxx b/svtools/workben/svdem.cxx index f459ab261e8a..3352e092125d 100644 --- a/svtools/workben/svdem.cxx +++ b/svtools/workben/svdem.cxx @@ -599,8 +599,8 @@ MyCalendar::MyCalendar( Window* pParent ) : aMenuBar.SetPopupMenu( 1, &aWeekStartMenu ); aMenuBar.SetPopupMenu( 2, &aWeekCountMenu ); sal_Int16 nDays = rCal.getNumberOfDaysInWeek(); - uno::Sequence< i18n::CalendarItem> xItems = rCal.getDays(); - const i18n::CalendarItem* pArr = xItems.getArray(); + uno::Sequence< i18n::CalendarItem2> xItems = rCal.getDays(); + const i18n::CalendarItem2* pArr = xItems.getArray(); for ( sal_Int16 i = 0; i < nDays; i++ ) aWeekStartMenu.InsertItem( 10+(sal_uInt16)i, pArr[i].FullName, MIB_AUTOCHECK | MIB_RADIOCHECK ); aWeekStartMenu.CheckItem( 10+(sal_uInt16)rCal.getFirstDayOfWeek() ); -- cgit