summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--basic/source/runtime/methods1.cxx32
-rw-r--r--editeng/source/editeng/editeng.cxx6
-rw-r--r--i18npool/inc/calendarImpl.hxx4
-rw-r--r--i18npool/inc/calendar_gregorian.hxx4
-rw-r--r--i18npool/inc/localedata.hxx9
-rw-r--r--i18npool/source/calendar/calendarImpl.cxx26
-rw-r--r--i18npool/source/calendar/calendar_gregorian.cxx36
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx121
-rw-r--r--i18npool/source/localedata/data/locale.dtd8
-rw-r--r--i18npool/source/localedata/localedata.cxx84
-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
-rw-r--r--sc/source/core/tool/userlist.cxx2
-rw-r--r--sc/source/ui/docshell/impex.cxx2
-rw-r--r--svl/source/numbers/zforfind.cxx2
-rw-r--r--svl/source/numbers/zformat.cxx8
-rw-r--r--svtools/source/control/calendar.cxx7
-rw-r--r--svtools/workben/svdem.cxx4
-rw-r--r--sw/source/ui/docvw/edtwin.cxx2
-rw-r--r--unotools/inc/unotools/calendarwrapper.hxx6
-rw-r--r--unotools/inc/unotools/localedatawrapper.hxx4
-rw-r--r--unotools/source/i18n/calendarwrapper.cxx18
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx4
28 files changed, 431 insertions, 189 deletions
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 8802245b6498..64847d3981fd 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -62,7 +62,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/i18n/XCalendar.hpp>
+#include <com/sun/star/i18n/XCalendar3.hpp>
#include <com/sun/star/sheet/XFunctionAccess.hpp>
using namespace comphelper;
@@ -73,15 +73,15 @@ using namespace com::sun::star::i18n;
void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL );
-static Reference< XCalendar > getLocaleCalendar( void )
+static Reference< XCalendar3 > getLocaleCalendar( void )
{
- static Reference< XCalendar > xCalendar;
+ static Reference< XCalendar3 > xCalendar;
if( !xCalendar.is() )
{
Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
if( xSMgr.is() )
{
- xCalendar = Reference< XCalendar >( xSMgr->createInstance
+ xCalendar = Reference< XCalendar3 >( xSMgr->createInstance
( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.LocaleCalendar" )) ), UNO_QUERY );
}
}
@@ -1752,13 +1752,13 @@ RTLFUNC(MonthName)
return;
}
- Reference< XCalendar > xCalendar = getLocaleCalendar();
+ Reference< XCalendar3 > xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
StarBASIC::Error( SbERR_INTERNAL_ERROR );
return;
}
- Sequence< CalendarItem > aMonthSeq = xCalendar->getMonths();
+ Sequence< CalendarItem2 > aMonthSeq = xCalendar->getMonths2();
sal_Int32 nMonthCount = aMonthSeq.getLength();
sal_Int16 nVal = rPar.Get(1)->GetInteger();
@@ -1772,8 +1772,8 @@ RTLFUNC(MonthName)
if( nParCount == 3 )
bAbbreviate = rPar.Get(2)->GetBool();
- const CalendarItem* pCalendarItems = aMonthSeq.getConstArray();
- const CalendarItem& rItem = pCalendarItems[nVal - 1];
+ const CalendarItem2* pCalendarItems = aMonthSeq.getConstArray();
+ const CalendarItem2& rItem = pCalendarItems[nVal - 1];
::rtl::OUString aRetStr = ( bAbbreviate ? rItem.AbbrevName : rItem.FullName );
rPar.Get(0)->PutString( String(aRetStr) );
@@ -1792,14 +1792,14 @@ RTLFUNC(WeekdayName)
return;
}
- Reference< XCalendar > xCalendar = getLocaleCalendar();
+ Reference< XCalendar3 > xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
StarBASIC::Error( SbERR_INTERNAL_ERROR );
return;
}
- Sequence< CalendarItem > aDaySeq = xCalendar->getDays();
+ Sequence< CalendarItem2 > aDaySeq = xCalendar->getDays2();
sal_Int16 nDayCount = (sal_Int16)aDaySeq.getLength();
sal_Int16 nDay = rPar.Get(1)->GetInteger();
sal_Int16 nFirstDay = 0;
@@ -1830,8 +1830,8 @@ RTLFUNC(WeekdayName)
bAbbreviate = pPar2->GetBool();
}
- const CalendarItem* pCalendarItems = aDaySeq.getConstArray();
- const CalendarItem& rItem = pCalendarItems[nDay - 1];
+ const CalendarItem2* pCalendarItems = aDaySeq.getConstArray();
+ const CalendarItem2& rItem = pCalendarItems[nDay - 1];
::rtl::OUString aRetStr = ( bAbbreviate ? rItem.AbbrevName : rItem.FullName );
rPar.Get(0)->PutString( String(aRetStr) );
@@ -1860,7 +1860,7 @@ sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 n
}
if( nFirstDay == 0 )
{
- Reference< XCalendar > xCalendar = getLocaleCalendar();
+ Reference< XCalendar3 > xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
StarBASIC::Error( SbERR_INTERNAL_ERROR );
@@ -2189,7 +2189,7 @@ RTLFUNC(DateDiff)
}
if( nFirstDay == 0 )
{
- Reference< XCalendar > xCalendar = getLocaleCalendar();
+ Reference< XCalendar3 > xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
StarBASIC::Error( SbERR_INTERNAL_ERROR );
@@ -2249,7 +2249,7 @@ double implGetDateOfFirstDayInFirstWeek
if( nFirstWeek < 0 || nFirstWeek > 3 )
nError = SbERR_BAD_ARGUMENT;
- Reference< XCalendar > xCalendar;
+ Reference< XCalendar3 > xCalendar;
if( nFirstDay == 0 || nFirstWeek == 0 )
{
xCalendar = getLocaleCalendar();
@@ -2453,7 +2453,7 @@ RTLFUNC(FormatDateTime)
}
}
- Reference< XCalendar > xCalendar = getLocaleCalendar();
+ Reference< XCalendar3 > xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
StarBASIC::Error( SbERR_INTERNAL_ERROR );
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index b8c563fe2bee..cfbf1b845f63 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1051,9 +1051,9 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie
pImpEditEngine->xTransliterationWrapper.changeLocale( eLang);
const ::utl::TransliterationWrapper* pTransliteration = pImpEditEngine->xTransliterationWrapper.get();
- Sequence< i18n::CalendarItem > xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarDays();
+ Sequence< i18n::CalendarItem2 > xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarDays();
sal_Int32 nCount = xItem.getLength();
- const i18n::CalendarItem* pArr = xItem.getArray();
+ const i18n::CalendarItem2* pArr = xItem.getArray();
for( sal_Int32 n = 0; n <= nCount; ++n )
{
const ::rtl::OUString& rDay = pArr[n].FullName;
@@ -1068,7 +1068,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie
{
xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarMonths();
sal_Int32 nMonthCount = xItem.getLength();
- const i18n::CalendarItem* pMonthArr = xItem.getArray();
+ const i18n::CalendarItem2* pMonthArr = xItem.getArray();
for( sal_Int32 n = 0; n <= nMonthCount; ++n )
{
const ::rtl::OUString& rMon = pMonthArr[n].FullName;
diff --git a/i18npool/inc/calendarImpl.hxx b/i18npool/inc/calendarImpl.hxx
index d117e53a4a83..da69ef886a5a 100644
--- a/i18npool/inc/calendarImpl.hxx
+++ b/i18npool/inc/calendarImpl.hxx
@@ -87,7 +87,9 @@ public:
// XCalendar3
virtual Calendar2 SAL_CALL getLoadedCalendar2() throw(com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getGenitiveMonths() throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getDays2() throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getMonths2() throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getGenitiveMonths2() throw(com::sun::star::uno::RuntimeException);
//XServiceInfo
virtual rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx
index b95ab22630fb..42d7599d59d6 100644
--- a/i18npool/inc/calendar_gregorian.hxx
+++ b/i18npool/inc/calendar_gregorian.hxx
@@ -86,7 +86,9 @@ public:
// XCalendar3
virtual Calendar2 SAL_CALL getLoadedCalendar2() throw(com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getGenitiveMonths() throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getDays2() throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getMonths2() throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getGenitiveMonths2() throw(com::sun::star::uno::RuntimeException);
//XServiceInfo
virtual rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
diff --git a/i18npool/inc/localedata.hxx b/i18npool/inc/localedata.hxx
index dfdb826f12b6..a28f1049fab1 100644
--- a/i18npool/inc/localedata.hxx
+++ b/i18npool/inc/localedata.hxx
@@ -74,7 +74,7 @@ inline sal_Bool operator ==(const com::sun::star::lang::Locale& l1, const com::s
class LocaleData : public cppu::WeakImplHelper2
<
- XLocaleData3,
+ com::sun::star::i18n::XLocaleData3,
com::sun::star::lang::XServiceInfo
>
{
@@ -82,6 +82,9 @@ public:
LocaleData();
~LocaleData();
+ static com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem > downcastCalendarItems( const com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem2 > & rCi );
+ static com::sun::star::i18n::Calendar downcastCalendar( const com::sun::star::i18n::Calendar2 & rC );
+
virtual LanguageCountryInfo SAL_CALL getLanguageCountryInfo( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
virtual LocaleDataItem SAL_CALL getLocaleItem( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
virtual com::sun::star::uno::Sequence< Calendar2 > SAL_CALL getAllCalendars2( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
@@ -129,14 +132,14 @@ private :
sal_Unicode ** SAL_CALL getIndexArrayForAlgorithm(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rAlgorithm);
com::sun::star::i18n::Calendar2 ref_cal;
rtl::OUString ref_name;
- com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem > &
+ com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem2 > &
getCalendarItemByName(const rtl::OUString& name,
const com::sun::star::lang::Locale& rLocale,
const com::sun::star::uno::Sequence< com::sun::star::i18n::Calendar2 >& calendarsSeq,
sal_Int16 item) throw( com::sun::star::uno::RuntimeException );
/// Helper to obtain a sequence of days, months, gmonths or eras.
- com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem > getCalendarItems(
+ com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem2 > getCalendarItems(
sal_Unicode const * const * const allCalendars,
sal_Int16 & rnOffset,
const sal_Int16 nWhichItem,
diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx
index 52eea4ff0a44..aebc1d5accdc 100644
--- a/i18npool/source/calendar/calendarImpl.cxx
+++ b/i18npool/source/calendar/calendarImpl.cxx
@@ -292,11 +292,31 @@ CalendarImpl::getMonths() throw(RuntimeException)
}
-Sequence< CalendarItem > SAL_CALL
-CalendarImpl::getGenitiveMonths() throw(RuntimeException)
+Sequence< CalendarItem2 > SAL_CALL
+CalendarImpl::getDays2() throw(RuntimeException)
+{
+ if (xCalendar.is())
+ return xCalendar->getDays2();
+ else
+ throw ERROR ;
+}
+
+
+Sequence< CalendarItem2 > SAL_CALL
+CalendarImpl::getMonths2() throw(RuntimeException)
+{
+ if (xCalendar.is())
+ return xCalendar->getMonths2();
+ else
+ throw ERROR ;
+}
+
+
+Sequence< CalendarItem2 > SAL_CALL
+CalendarImpl::getGenitiveMonths2() throw(RuntimeException)
{
if (xCalendar.is())
- return xCalendar->getGenitiveMonths();
+ return xCalendar->getGenitiveMonths2();
else
throw ERROR ;
}
diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx
index 21a6b12bad95..23e95220b25b 100644
--- a/i18npool/source/calendar/calendar_gregorian.cxx
+++ b/i18npool/source/calendar/calendar_gregorian.cxx
@@ -132,6 +132,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using ::rtl::OUString;
+
namespace com { namespace sun { namespace star { namespace i18n {
#define ERROR RuntimeException()
@@ -281,8 +282,7 @@ Calendar_gregorian::getLoadedCalendar2() throw(RuntimeException)
com::sun::star::i18n::Calendar SAL_CALL
Calendar_gregorian::getLoadedCalendar() throw(RuntimeException)
{
- // gets "down-copy-constructed"
- return aCalendar;
+ return LocaleData::downcastCalendar( aCalendar);
}
OUString SAL_CALL
@@ -838,6 +838,7 @@ static sal_Int32 SAL_CALL DisplayCode2FieldIndex(sal_Int32 nCalendarDisplayCode)
return CalendarFieldIndex::DAY_OF_MONTH;
case CalendarDisplayCode::SHORT_DAY_NAME:
case CalendarDisplayCode::LONG_DAY_NAME:
+ case CalendarDisplayCode::NARROW_DAY_NAME:
return CalendarFieldIndex::DAY_OF_WEEK;
case CalendarDisplayCode::SHORT_QUARTER:
case CalendarDisplayCode::LONG_QUARTER:
@@ -845,8 +846,10 @@ static sal_Int32 SAL_CALL DisplayCode2FieldIndex(sal_Int32 nCalendarDisplayCode)
case CalendarDisplayCode::LONG_MONTH:
case CalendarDisplayCode::SHORT_MONTH_NAME:
case CalendarDisplayCode::LONG_MONTH_NAME:
+ case CalendarDisplayCode::NARROW_MONTH_NAME:
case CalendarDisplayCode::SHORT_GENITIVE_MONTH_NAME:
case CalendarDisplayCode::LONG_GENITIVE_MONTH_NAME:
+ case CalendarDisplayCode::NARROW_GENITIVE_MONTH_NAME:
return CalendarFieldIndex::MONTH;
case CalendarDisplayCode::SHORT_YEAR:
case CalendarDisplayCode::LONG_YEAR:
@@ -910,19 +913,33 @@ Calendar_gregorian::getNumberOfDaysInWeek() throw(RuntimeException)
Sequence< CalendarItem > SAL_CALL
Calendar_gregorian::getDays() throw(RuntimeException)
{
- return aCalendar.Days;
+ return LocaleData::downcastCalendarItems( aCalendar.Days);
}
Sequence< CalendarItem > SAL_CALL
Calendar_gregorian::getMonths() throw(RuntimeException)
{
+ return LocaleData::downcastCalendarItems( aCalendar.Months);
+}
+
+
+Sequence< CalendarItem2 > SAL_CALL
+Calendar_gregorian::getDays2() throw(RuntimeException)
+{
+ return aCalendar.Days;
+}
+
+
+Sequence< CalendarItem2 > SAL_CALL
+Calendar_gregorian::getMonths2() throw(RuntimeException)
+{
return aCalendar.Months;
}
-Sequence< CalendarItem > SAL_CALL
-Calendar_gregorian::getGenitiveMonths() throw(RuntimeException)
+Sequence< CalendarItem2 > SAL_CALL
+Calendar_gregorian::getGenitiveMonths2() throw(RuntimeException)
{
return aCalendar.GenitiveMonths;
}
@@ -943,18 +960,21 @@ Calendar_gregorian::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_I
if( idx >= aCalendar.Days.getLength() ) throw ERROR;
if (nameType == 0) aStr = aCalendar.Days[idx].AbbrevName;
else if (nameType == 1) aStr = aCalendar.Days[idx].FullName;
+ else if (nameType == 2) aStr = aCalendar.Days[idx].NarrowName;
else throw ERROR;
break;
case CalendarDisplayIndex::MONTH:
if( idx >= aCalendar.Months.getLength() ) throw ERROR;
if (nameType == 0) aStr = aCalendar.Months[idx].AbbrevName;
else if (nameType == 1) aStr = aCalendar.Months[idx].FullName;
+ else if (nameType == 2) aStr = aCalendar.Months[idx].NarrowName;
else throw ERROR;
break;
case CalendarDisplayIndex::GENITIVE_MONTH:
if( idx >= aCalendar.GenitiveMonths.getLength() ) throw ERROR;
if (nameType == 0) aStr = aCalendar.GenitiveMonths[idx].AbbrevName;
else if (nameType == 1) aStr = aCalendar.GenitiveMonths[idx].FullName;
+ else if (nameType == 2) aStr = aCalendar.GenitiveMonths[idx].NarrowName;
else throw ERROR;
break;
case CalendarDisplayIndex::ERA:
@@ -1035,14 +1055,20 @@ Calendar_gregorian::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16
return getDisplayName(CalendarDisplayIndex::DAY, value, 0);
case CalendarDisplayCode::LONG_DAY_NAME:
return getDisplayName(CalendarDisplayIndex::DAY, value, 1);
+ case CalendarDisplayCode::NARROW_DAY_NAME:
+ return getDisplayName(CalendarDisplayIndex::DAY, value, 2);
case CalendarDisplayCode::SHORT_MONTH_NAME:
return getDisplayName(CalendarDisplayIndex::MONTH, value, 0);
case CalendarDisplayCode::LONG_MONTH_NAME:
return getDisplayName(CalendarDisplayIndex::MONTH, value, 1);
+ case CalendarDisplayCode::NARROW_MONTH_NAME:
+ return getDisplayName(CalendarDisplayIndex::MONTH, value, 2);
case CalendarDisplayCode::SHORT_GENITIVE_MONTH_NAME:
return getDisplayName(CalendarDisplayIndex::GENITIVE_MONTH, value, 0);
case CalendarDisplayCode::LONG_GENITIVE_MONTH_NAME:
return getDisplayName(CalendarDisplayIndex::GENITIVE_MONTH, value, 1);
+ case CalendarDisplayCode::NARROW_GENITIVE_MONTH_NAME:
+ return getDisplayName(CalendarDisplayIndex::GENITIVE_MONTH, value, 2);
case CalendarDisplayCode::SHORT_ERA:
return getDisplayName(CalendarDisplayIndex::ERA, value, 0);
case CalendarDisplayCode::LONG_ERA:
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 0dbb77045a31..fac4583ad4ec 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -1134,6 +1134,64 @@ void LCIndexNode::generateCode (const OFileWriter &of) const
of.writeFunction("getFollowPageWords_", "nbOfPageWords", "FollowPageWordArray");
}
+
+static void lcl_writeAbbrFullNarrNames( const OFileWriter & of, const LocaleNode* currNode,
+ const sal_Char* elementTag, sal_Int16 i, sal_Int16 j )
+{
+ OUString aAbbrName = currNode->getChildAt(1)->getValue();
+ OUString aFullName = currNode->getChildAt(2)->getValue();
+ OUString aNarrName;
+ LocaleNode* p = (currNode->getNumberOfChildren() > 3 ? currNode->getChildAt(3) : 0);
+ if (p && p->getName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DefaultNarrowName")))
+ aNarrName = p->getValue();
+ else
+ {
+ sal_Int32 nIndex = 0;
+ sal_uInt32 nChar = aFullName.iterateCodePoints( &nIndex);
+ aNarrName = OUString( &nChar, 1);
+ }
+ of.writeParameter( elementTag, "DefaultAbbrvName", aAbbrName, i, j);
+ of.writeParameter( elementTag, "DefaultFullName", aFullName, i, j);
+ of.writeParameter( elementTag, "DefaultNarrowName", aNarrName, i, j);
+}
+
+static void lcl_writeTabTagString( const OFileWriter & of, const sal_Char* pTag, const sal_Char* pStr )
+{
+ of.writeAsciiString("\t");
+ of.writeAsciiString( pTag);
+ of.writeAsciiString( pStr);
+}
+
+static void lcl_writeTabTagStringNums( const OFileWriter & of,
+ const sal_Char* pTag, const sal_Char* pStr, sal_Int16 i, sal_Int16 j )
+{
+ lcl_writeTabTagString( of, pTag, pStr);
+ of.writeInt(i); of.writeInt(j); of.writeAsciiString(",\n");
+}
+
+static void lcl_writeAbbrFullNarrArrays( const OFileWriter & of, sal_Int16 nCount,
+ const sal_Char* elementTag, sal_Int16 i, bool bNarrow )
+{
+ if (nCount == 0)
+ {
+ lcl_writeTabTagString( of, elementTag, "Ref");
+ of.writeInt(i); of.writeAsciiString(",\n");
+ lcl_writeTabTagString( of, elementTag, "RefName");
+ of.writeInt(i); of.writeAsciiString(",\n");
+ }
+ else
+ {
+ for (sal_Int16 j = 0; j < nCount; j++)
+ {
+ lcl_writeTabTagStringNums( of, elementTag, "ID", i, j);
+ lcl_writeTabTagStringNums( of, elementTag, "DefaultAbbrvName", i, j);
+ lcl_writeTabTagStringNums( of, elementTag, "DefaultFullName", i, j);
+ if (bNarrow)
+ lcl_writeTabTagStringNums( of, elementTag, "DefaultNarrowName", i, j);
+ }
+ }
+}
+
void LCCalendarNode::generateCode (const OFileWriter &of) const
{
::rtl::OUString useLocale = getAttr().getValueByName("ref");
@@ -1192,8 +1250,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
of.writeParameter("dayID", dayID, i, j);
if (j == 0 && bGregorian && !dayID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "sun")))
incError( "First day of a week of a Gregorian calendar must be <DayID>sun</DayID>");
- of.writeParameter(elementTag, "DefaultAbbrvName",currNode->getChildAt(1)->getValue() ,i, j);
- of.writeParameter(elementTag, "DefaultFullName",currNode->getChildAt(2)->getValue() , i, j);
+ lcl_writeAbbrFullNarrNames( of, currNode, elementTag, i, j);
}
}
++nChild;
@@ -1225,8 +1282,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
of.writeParameter("monthID", monthID, i, j);
if (j == 0 && bGregorian && !monthID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "jan")))
incError( "First month of a year of a Gregorian calendar must be <MonthID>jan</MonthID>");
- of.writeParameter(elementTag, "DefaultAbbrvName",currNode->getChildAt(1)->getValue() ,i, j);
- of.writeParameter(elementTag, "DefaultFullName",currNode->getChildAt(2)->getValue() , i, j);
+ lcl_writeAbbrFullNarrNames( of, currNode, elementTag, i, j);
}
}
++nChild;
@@ -1261,8 +1317,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
of.writeParameter("genitiveMonthID", genitiveMonthID, i, j);
if (j == 0 && bGregorian && !genitiveMonthID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "jan")))
incError( "First genitive month of a year of a Gregorian calendar must be <MonthID>jan</MonthID>");
- of.writeParameter(elementTag, "DefaultAbbrvName",currNode->getChildAt(1)->getValue() ,i, j);
- of.writeParameter(elementTag, "DefaultFullName",currNode->getChildAt(2)->getValue() , i, j);
+ lcl_writeAbbrFullNarrNames( of, currNode, elementTag, i, j);
}
}
++nChild;
@@ -1377,56 +1432,10 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
of.writeAsciiString("\tdefaultCalendar");
of.writeInt(i);
of.writeAsciiString(",\n");
- if (nbOfDays[i] == 0) {
- of.writeAsciiString("\tdayRef");
- of.writeInt(i); of.writeAsciiString(",\n");
- of.writeAsciiString("\tdayRefName");
- of.writeInt(i); of.writeAsciiString(",\n");
- } else {
- for(j = 0; j < nbOfDays[i]; j++) {
- of.writeAsciiString("\tdayID");
- of.writeInt(i); of.writeInt(j); of.writeAsciiString(",\n");
- of.writeAsciiString("\tdayDefaultAbbrvName");
- of.writeInt(i); of.writeInt(j); of.writeAsciiString(",\n");
- of.writeAsciiString("\tdayDefaultFullName");of.writeInt(i); of.writeInt(j); of.writeAsciiString(",\n");
- }
- }
- if (nbOfMonths[i] == 0) {
- of.writeAsciiString("\tmonthRef");
- of.writeInt(i); of.writeAsciiString(",\n");
- of.writeAsciiString("\tmonthRefName");
- of.writeInt(i); of.writeAsciiString(",\n");
- } else {
- for(j = 0; j < nbOfMonths[i]; j++) {
- of.writeAsciiString("\tmonthID");of.writeInt(i);of.writeInt(j);of.writeAsciiString(",\n");
- of.writeAsciiString("\tmonthDefaultAbbrvName");of.writeInt(i);of.writeInt(j);of.writeAsciiString(",\n");
- of.writeAsciiString("\tmonthDefaultFullName");of.writeInt(i);of.writeInt(j);of.writeAsciiString(",\n");
- }
- }
- if (nbOfGenitiveMonths[i] == 0) {
- of.writeAsciiString("\tgenitiveMonthRef");
- of.writeInt(i); of.writeAsciiString(",\n");
- of.writeAsciiString("\tgenitiveMonthRefName");
- of.writeInt(i); of.writeAsciiString(",\n");
- } else {
- for(j = 0; j < nbOfGenitiveMonths[i]; j++) {
- of.writeAsciiString("\tgenitiveMonthID");of.writeInt(i);of.writeInt(j);of.writeAsciiString(",\n");
- of.writeAsciiString("\tgenitiveMonthDefaultAbbrvName");of.writeInt(i);of.writeInt(j);of.writeAsciiString(",\n");
- of.writeAsciiString("\tgenitiveMonthDefaultFullName");of.writeInt(i);of.writeInt(j);of.writeAsciiString(",\n");
- }
- }
- if (nbOfEras[i] == 0) {
- of.writeAsciiString("\teraRef");
- of.writeInt(i); of.writeAsciiString(",\n");
- of.writeAsciiString("\teraRefName");
- of.writeInt(i); of.writeAsciiString(",\n");
- } else {
- for(j = 0; j < nbOfEras[i]; j++) {
- of.writeAsciiString("\teraID"); of.writeInt(i); of.writeInt(j); of.writeAsciiString(",\n");
- of.writeAsciiString("\teraDefaultAbbrvName");of.writeInt(i);of.writeInt(j);of.writeAsciiString(",\n");
- of.writeAsciiString("\teraDefaultFullName");of.writeInt(i);of.writeInt(j);of.writeAsciiString(",\n");
- }
- }
+ lcl_writeAbbrFullNarrArrays( of, nbOfDays[i], "day", i, true);
+ lcl_writeAbbrFullNarrArrays( of, nbOfMonths[i], "month", i, true);
+ lcl_writeAbbrFullNarrArrays( of, nbOfGenitiveMonths[i], "genitiveMonth", i, true);
+ lcl_writeAbbrFullNarrArrays( of, nbOfEras[i], "era", i, false /*noNarrow*/);
of.writeAsciiString("\tstartDayOfWeek");of.writeInt(i); of.writeAsciiString(",\n");
of.writeAsciiString("\tminimalDaysInFirstWeek");of.writeInt(i); of.writeAsciiString(",\n");
}
diff --git a/i18npool/source/localedata/data/locale.dtd b/i18npool/source/localedata/data/locale.dtd
index 8a0a9e781a0d..ac0cfa739aff 100644
--- a/i18npool/source/localedata/data/locale.dtd
+++ b/i18npool/source/localedata/data/locale.dtd
@@ -269,13 +269,17 @@
<!-- All Day elements of a Calendar must be given if the RefLocale mechanism is not used! -->
<!ATTLIST DaysOfWeek %RefLocale;>
<!-- Sequence of days is important, MUST start with Sunday. -->
-<!ELEMENT Day (DayID, DefaultAbbrvName, DefaultFullName)>
+<!ELEMENT Day (DayID, DefaultAbbrvName, DefaultFullName, DefaultNarrowName*)>
<!ELEMENT DayID (#PCDATA)>
<!-- Preferably the lower case abbreviated English name like sun for Sunday. -->
<!ELEMENT DefaultAbbrvName (#PCDATA)>
<!-- The abbreviated day name, e.g. Sun for Sunday. -->
<!ELEMENT DefaultFullName (#PCDATA)>
<!-- The full day name, e.g. Sunday for Sunday. -->
+<!ELEMENT DefaultNarrowName (#PCDATA)>
+<!-- The narrow day name, e.g. S for Sunday.
+ If not specified, the first letter of the corresponding DefaultFullName is taken.
+ -->
<!ELEMENT MonthsOfYear (Month*)>
<!-- All Month elements of a Calendar must be given if the RefLocale mechanism is not used! -->
@@ -294,7 +298,7 @@
year, e.g. January in a Gregorian calendar.
-->
-<!ELEMENT Month (MonthID, DefaultAbbrvName, DefaultFullName)>
+<!ELEMENT Month (MonthID, DefaultAbbrvName, DefaultFullName, DefaultNarrowName*)>
<!ELEMENT MonthID (#PCDATA)>
<!-- Preferably the lower case abbreviated English name like jan for January. -->
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index c859da5c3cb7..9b87de6c7976 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -281,6 +281,36 @@ struct LocaleDataLookupTableItem
}
};
+
+// static
+Sequence< CalendarItem > LocaleData::downcastCalendarItems( const Sequence< CalendarItem2 > & rCi )
+{
+ sal_Int32 nSize = rCi.getLength();
+ Sequence< CalendarItem > aCi( nSize);
+ CalendarItem* p1 = aCi.getArray();
+ const CalendarItem2* p2 = rCi.getConstArray();
+ for (sal_Int32 i=0; i < nSize; ++i, ++p1, ++p2)
+ *p1 = *p2;
+ return aCi;
+}
+
+
+// static
+Calendar LocaleData::downcastCalendar( const Calendar2 & rC )
+{
+ Calendar aCal(
+ downcastCalendarItems( rC.Days),
+ downcastCalendarItems( rC.Months),
+ downcastCalendarItems( rC.Eras),
+ rC.StartOfWeek,
+ rC.MinimumNumberOfDaysForFirstWeek,
+ rC.Default,
+ rC.Name
+ );
+ return aCal;
+}
+
+
LocaleData::LocaleData()
{
}
@@ -467,7 +497,7 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName(
#define REF_ERAS 3
#define REF_OFFSET_COUNT 4
-Sequence< CalendarItem > &LocaleData::getCalendarItemByName(const OUString& name,
+Sequence< CalendarItem2 > &LocaleData::getCalendarItemByName(const OUString& name,
const Locale& rLocale, const Sequence< Calendar2 >& calendarsSeq, sal_Int16 item)
throw(RuntimeException)
{
@@ -517,13 +547,13 @@ Sequence< CalendarItem > &LocaleData::getCalendarItemByName(const OUString& name
}
-Sequence< CalendarItem > LocaleData::getCalendarItems(
+Sequence< CalendarItem2 > LocaleData::getCalendarItems(
sal_Unicode const * const * const allCalendars, sal_Int16 & rnOffset,
const sal_Int16 nWhichItem, const sal_Int16 nCalendar,
const Locale & rLocale, const Sequence< Calendar2 > & calendarsSeq )
throw(RuntimeException)
{
- Sequence< CalendarItem > aItems;
+ Sequence< CalendarItem2 > aItems;
if (OUString( allCalendars[rnOffset]).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ref")))
{
aItems = getCalendarItemByName( OUString( allCalendars[rnOffset+1]), rLocale, calendarsSeq, nWhichItem);
@@ -533,12 +563,32 @@ Sequence< CalendarItem > LocaleData::getCalendarItems(
{
sal_Int32 nSize = allCalendars[nWhichItem][nCalendar];
aItems.realloc( nSize);
- CalendarItem* pItem = aItems.getArray();
- for (sal_Int16 j = 0; j < nSize; ++j, ++pItem)
+ CalendarItem2* pItem = aItems.getArray();
+ switch (nWhichItem)
{
- CalendarItem day( allCalendars[rnOffset], allCalendars[rnOffset+1], allCalendars[rnOffset+2]);
- *pItem = day;
- rnOffset += 3;
+ case REF_DAYS:
+ case REF_MONTHS:
+ case REF_GMONTHS:
+ for (sal_Int16 j = 0; j < nSize; ++j, ++pItem)
+ {
+ CalendarItem2 item( allCalendars[rnOffset], allCalendars[rnOffset+1],
+ allCalendars[rnOffset+2], allCalendars[rnOffset+3]);
+ *pItem = item;
+ rnOffset += 4;
+ }
+ break;
+ case REF_ERAS:
+ // Absent narrow name.
+ for (sal_Int16 j = 0; j < nSize; ++j, ++pItem)
+ {
+ CalendarItem2 item( allCalendars[rnOffset], allCalendars[rnOffset+1],
+ allCalendars[rnOffset+2], OUString());
+ *pItem = item;
+ rnOffset += 3;
+ }
+ break;
+ default:
+ OSL_FAIL( "LocaleData::getCalendarItems: unhandled REF_* case");
}
}
return aItems;
@@ -564,20 +614,20 @@ LocaleData::getAllCalendars2( const Locale& rLocale ) throw(RuntimeException)
offset++;
sal_Bool defaultCalendar = sal::static_int_cast<sal_Bool>( allCalendars[offset][0] );
offset++;
- Sequence< CalendarItem > days = getCalendarItems( allCalendars, offset, REF_DAYS, i,
+ Sequence< CalendarItem2 > days = getCalendarItems( allCalendars, offset, REF_DAYS, i,
rLocale, calendarsSeq);
- Sequence< CalendarItem > months = getCalendarItems( allCalendars, offset, REF_MONTHS, i,
+ Sequence< CalendarItem2 > months = getCalendarItems( allCalendars, offset, REF_MONTHS, i,
rLocale, calendarsSeq);
- Sequence< CalendarItem > gmonths = getCalendarItems( allCalendars, offset, REF_GMONTHS, i,
+ Sequence< CalendarItem2 > gmonths = getCalendarItems( allCalendars, offset, REF_GMONTHS, i,
rLocale, calendarsSeq);
- Sequence< CalendarItem > eras = getCalendarItems( allCalendars, offset, REF_ERAS, i,
+ Sequence< CalendarItem2 > eras = getCalendarItems( allCalendars, offset, REF_ERAS, i,
rLocale, calendarsSeq);
OUString startOfWeekDay(allCalendars[offset]);
offset++;
sal_Int16 minimalDaysInFirstWeek = allCalendars[offset][0];
offset++;
- Calendar2 aCalendar(days, months, eras, startOfWeekDay,
- minimalDaysInFirstWeek, defaultCalendar, calendarID, gmonths);
+ Calendar2 aCalendar(days, months, gmonths, eras, startOfWeekDay,
+ minimalDaysInFirstWeek, defaultCalendar, calendarID);
calendarsSeq[i] = aCalendar;
}
return calendarsSeq;
@@ -592,14 +642,14 @@ LocaleData::getAllCalendars2( const Locale& rLocale ) throw(RuntimeException)
Sequence< Calendar > SAL_CALL
LocaleData::getAllCalendars( const Locale& rLocale ) throw(RuntimeException)
{
- Sequence< Calendar2 > aCal2( getAllCalendars2( rLocale));
+ const Sequence< Calendar2 > aCal2( getAllCalendars2( rLocale));
sal_Int32 nLen = aCal2.getLength();
Sequence< Calendar > aCal1( nLen);
- const Calendar2* p2 = aCal2.getArray();
+ const Calendar2* p2 = aCal2.getConstArray();
Calendar* p1 = aCal1.getArray();
for (sal_Int32 i=0; i < nLen; ++i, ++p1, ++p2)
{
- *p1 = *p2;
+ *p1 = downcastCalendar( *p2);
}
return aCal1;
}
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();
};
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index fed58cac3da8..72e65f71aec4 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -219,7 +219,7 @@ ScUserList::ScUserList()
using namespace ::com::sun::star;
sal_Unicode cDelimiter = ScGlobal::cListDelimiter;
- uno::Sequence< i18n::CalendarItem > xCal;
+ uno::Sequence< i18n::CalendarItem2 > xCal;
uno::Sequence< i18n::Calendar2 > xCalendars(
ScGlobal::pLocaleData->getAllCalendars() );
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index f7eb41a6f77a..712f696b4f30 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -983,7 +983,7 @@ static bool lcl_PutString(
{
static const String aSeptCorrect( RTL_CONSTASCII_USTRINGPARAM( "SEPT" ) );
static const String aSepShortened( RTL_CONSTASCII_USTRINGPARAM( "SEP" ) );
- uno::Sequence< i18n::CalendarItem > xMonths;
+ uno::Sequence< i18n::CalendarItem2 > xMonths;
sal_Int32 i, nMonthCount;
// first test all month names from local international
xMonths = rCalendar.getMonths();
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index a4086335562b..bb249be090a4 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2431,7 +2431,7 @@ void ImpSvNumberInputScan::InitText()
delete [] pUpperMonthText;
delete [] pUpperAbbrevMonthText;
- ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > xElems
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > xElems
= pCal->getMonths();
nElems = xElems.getLength();
pUpperMonthText = new String[nElems];
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index e6da6105f25e..a56abdc3b0dd 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3194,7 +3194,9 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber,
break;
case NF_KEY_MMMMM: // MMMMM
OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ).GetChar(0);
+ (ImpUseGenitiveMonth( nUseGenitiveMonth, NumFor[nIx]) ?
+ CalendarDisplayCode::NARROW_GENITIVE_MONTH_NAME :
+ CalendarDisplayCode::NARROW_MONTH_NAME), nNatNum );
break;
case NF_KEY_Q: // Q
OutString += rCal.getDisplayString(
@@ -3521,7 +3523,9 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber,
break;
case NF_KEY_MMMMM: // MMMMM
OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ).GetChar(0);
+ (ImpUseGenitiveMonth( nUseGenitiveMonth, NumFor[nIx]) ?
+ CalendarDisplayCode::NARROW_GENITIVE_MONTH_NAME :
+ CalendarDisplayCode::NARROW_MONTH_NAME), nNatNum );
break;
case NF_KEY_Q: // Q
OutString += rCal.getDisplayString(
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() );
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 0bb9dac241d6..78e9a69f2716 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -5605,7 +5605,7 @@ void QuickHelpData::FillStrArr( SwWrtShell& rSh, const String& rWord )
(*pCalendar)->LoadDefaultCalendar( rSh.GetCurLang() );
{
- uno::Sequence< i18n::CalendarItem > aNames(
+ uno::Sequence< i18n::CalendarItem2 > aNames(
(*pCalendar)->getMonths() );
for( int n = 0; n < 2; ++n )
{
diff --git a/unotools/inc/unotools/calendarwrapper.hxx b/unotools/inc/unotools/calendarwrapper.hxx
index e2785399e3cb..cc67696d0439 100644
--- a/unotools/inc/unotools/calendarwrapper.hxx
+++ b/unotools/inc/unotools/calendarwrapper.hxx
@@ -91,8 +91,6 @@ public:
void setMinimumNumberOfDaysForFirstWeek( sal_Int16 nDays );
sal_Int16 getNumberOfMonthsInYear() const;
sal_Int16 getNumberOfDaysInWeek() const;
- ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getMonths() const;
- ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDays() const;
String getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType ) const;
/** Convenience method to get timezone offset in milliseconds, taking both
@@ -110,8 +108,10 @@ public:
// wrapper implementations of XCalendar3
- ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getGenitiveMonths() const;
::com::sun::star::i18n::Calendar2 getLoadedCalendar() const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > getDays() const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > getMonths() const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > getGenitiveMonths() const;
// convenience methods
diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx
index 8564bfacfac4..0bfaa9768fe0 100644
--- a/unotools/inc/unotools/localedatawrapper.hxx
+++ b/unotools/inc/unotools/localedatawrapper.hxx
@@ -183,10 +183,10 @@ public:
const ::boost::shared_ptr< ::com::sun::star::i18n::Calendar2 > getDefaultCalendar() const;
/// Convenience method to obtain the day names of the default calendar.
- const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDefaultCalendarDays() const;
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > getDefaultCalendarDays() const;
/// Convenience method to obtain the month names of the default calendar.
- const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDefaultCalendarMonths() const;
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > getDefaultCalendarMonths() const;
/** Obtain digit grouping. The usually known grouping by thousands (#,###)
is actually only one of possible groupings. Another one, for example,
diff --git a/unotools/source/i18n/calendarwrapper.cxx b/unotools/source/i18n/calendarwrapper.cxx
index 5b7f4155eb58..6d7aa4bea94e 100644
--- a/unotools/source/i18n/calendarwrapper.cxx
+++ b/unotools/source/i18n/calendarwrapper.cxx
@@ -503,12 +503,12 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const
}
-::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > CalendarWrapper::getMonths() const
+::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > CalendarWrapper::getMonths() const
{
try
{
if ( xC.is() )
- return xC->getMonths();
+ return xC->getMonths2();
}
catch ( Exception& e )
{
@@ -520,16 +520,16 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const
(void)e;
#endif
}
- return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > (0);
+ return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > (0);
}
-::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > CalendarWrapper::getDays() const
+::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > CalendarWrapper::getDays() const
{
try
{
if ( xC.is() )
- return xC->getDays();
+ return xC->getDays2();
}
catch ( Exception& e )
{
@@ -541,7 +541,7 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const
(void)e;
#endif
}
- return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > (0);
+ return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > (0);
}
@@ -612,12 +612,12 @@ String CalendarWrapper::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_In
}
-::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > CalendarWrapper::getGenitiveMonths() const
+::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > CalendarWrapper::getGenitiveMonths() const
{
try
{
if ( xC.is() )
- return xC->getGenitiveMonths();
+ return xC->getGenitiveMonths2();
}
catch ( Exception& e )
{
@@ -629,7 +629,7 @@ String CalendarWrapper::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_In
(void)e;
#endif
}
- return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > (0);
+ return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > (0);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 81960aafff24..ee893b2d65d1 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -614,13 +614,13 @@ const ::boost::shared_ptr< ::com::sun::star::i18n::Calendar2 > LocaleDataWrapper
}
-const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > LocaleDataWrapper::getDefaultCalendarDays() const
+const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > LocaleDataWrapper::getDefaultCalendarDays() const
{
return getDefaultCalendar()->Days;
}
-const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > LocaleDataWrapper::getDefaultCalendarMonths() const
+const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > LocaleDataWrapper::getDefaultCalendarMonths() const
{
return getDefaultCalendar()->Months;
}