Kaydet (Commit) 29e4c61d authored tarafından Eike Rathke's avatar Eike Rathke

use new possessive genitive case month names locale data API

üst a7dbdbf8
......@@ -221,7 +221,7 @@ ScUserList::ScUserList()
sal_Unicode cDelimiter = ScGlobal::cListDelimiter;
uno::Sequence< i18n::CalendarItem > xCal;
uno::Sequence< i18n::Calendar > xCalendars(
uno::Sequence< i18n::Calendar2 > xCalendars(
ScGlobal::pLocaleData->getAllCalendars() );
for ( sal_Int32 j = 0; j < xCalendars.getLength(); ++j )
......
......@@ -58,7 +58,7 @@
#endif
#if NF_TEST_CALENDAR
#include <comphelper/processfactory.hxx>
#include <com/sun/star/i18n/XExtendedCalendar.hpp>
#include <com/sun/star/i18n/XCalendar3.hpp>
#endif
......@@ -1379,7 +1379,7 @@ input for the following reasons:
sal_Int32 nZoneInMillis, nDST1InMillis, nDST2InMillis;
uno::Reference< lang::XMultiServiceFactory > xSMgr =
::comphelper::getProcessServiceFactory();
uno::Reference< ::com::sun::star::i18n::XExtendedCalendar > xCal(
uno::Reference< ::com::sun::star::i18n::XCalendar3 > xCal(
xSMgr->createInstance( ::rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.i18n.LocaleCalendar" ) ) ),
......
......@@ -33,7 +33,7 @@
#include <tools/string.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/i18n/Calendar.hpp>
#include <com/sun/star/i18n/Calendar2.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include "unotools/unotoolsdllapi.h"
......@@ -45,7 +45,7 @@ namespace com { namespace sun { namespace star {
namespace com { namespace sun { namespace star {
namespace i18n {
class XExtendedCalendar;
class XCalendar3;
}
}}}
......@@ -53,7 +53,7 @@ namespace com { namespace sun { namespace star {
class UNOTOOLS_DLLPUBLIC CalendarWrapper
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XExtendedCalendar > xC;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCalendar3 > xC;
DateTime aEpochStart; // 1Jan1970
......@@ -68,7 +68,6 @@ public:
void loadDefaultCalendar( const ::com::sun::star::lang::Locale& rLocale );
void loadCalendar( const ::rtl::OUString& rUniqueID, const ::com::sun::star::lang::Locale& rLocale );
::com::sun::star::i18n::Calendar getLoadedCalendar() const;
::com::sun::star::uno::Sequence< ::rtl::OUString > getAllCalendars( const ::com::sun::star::lang::Locale& rLocale ) const;
::rtl::OUString getUniqueID() const;
/// set UTC date/time
......@@ -80,6 +79,7 @@ public:
/// convenience method to get local date/time
double getLocalDateTime() const;
// wrapper implementations of XCalendar
void setValue( sal_Int16 nFieldIndex, sal_Int16 nValue );
......@@ -102,11 +102,18 @@ public:
fields DST_OFFSET and DST_OFFSET_SECOND_MILLIS into account. */
sal_Int32 getDSTOffsetInMillis() const;
// wrapper implementations of XExtendedCalendar
String getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) const;
// wrapper implementations of XCalendar3
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getGenitiveMonths() const;
::com::sun::star::i18n::Calendar2 getLoadedCalendar() const;
// convenience methods
/// get epoch start (should be 01Jan1970)
......
......@@ -30,7 +30,7 @@
#define _UNOTOOLS_LOCALEDATAWRAPPER_HXX
#include <tools/string.hxx>
#include <com/sun/star/i18n/XLocaleData2.hpp>
#include <com/sun/star/i18n/XLocaleData3.hpp>
#include <com/sun/star/i18n/LocaleItem.hpp>
#include <com/sun/star/i18n/reservedWords.hpp>
#include <unotools/readwritemutexguard.hxx>
......@@ -67,9 +67,9 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
static sal_uInt8 nLocaleDataChecking; // 0:=dontknow, 1:=yes, 2:=no
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData2 > xLD;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData3 > xLD;
::com::sun::star::lang::Locale aLocale;
::boost::shared_ptr< ::com::sun::star::i18n::Calendar > xDefaultCalendar;
::boost::shared_ptr< ::com::sun::star::i18n::Calendar2 > xDefaultCalendar;
::com::sun::star::i18n::LocaleDataItem aLocaleDataItem;
::com::sun::star::uno::Sequence< ::rtl::OUString > aReservedWordSeq;
::com::sun::star::uno::Sequence< sal_Int32 > aGrouping;
......@@ -153,7 +153,8 @@ public:
::com::sun::star::i18n::LanguageCountryInfo getLanguageCountryInfo() const;
::com::sun::star::i18n::LocaleDataItem getLocaleItem() const;
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar > getAllCalendars() const;
/// NOTE: this wraps XLocaleData3::getAllCalendars2() in fact.
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar2 > getAllCalendars() const;
/// NOTE: this wraps XLocaleData2::getAllCurrencies2() in fact.
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency2 > getAllCurrencies() const;
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > getAllFormats() const;
......@@ -179,7 +180,7 @@ public:
MeasurementSystem mapMeasurementStringToEnum( const String& rMS ) const;
/// Convenience method to obtain the default calendar.
const ::boost::shared_ptr< ::com::sun::star::i18n::Calendar > getDefaultCalendar() const;
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;
......
......@@ -34,7 +34,7 @@
#include <tools/debug.hxx>
#include <instance.hxx>
#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
#include <com/sun/star/i18n/XExtendedCalendar.hpp>
#include <com/sun/star/i18n/XCalendar3.hpp>
#define CALENDAR_LIBRARYNAME "i18n"
#define CALENDAR_SERVICENAME "com.sun.star.i18n.LocaleCalendar"
......@@ -54,7 +54,7 @@ CalendarWrapper::CalendarWrapper(
xSMgr( xSF ),
aEpochStart( Date( 1, 1, 1970 ) )
{
xC = Reference< XExtendedCalendar >( intl_createInstance( xSMgr, CALENDAR_SERVICENAME, "CalendarWrapper" ), uno::UNO_QUERY );
xC = Reference< XCalendar3 >( intl_createInstance( xSMgr, CALENDAR_SERVICENAME, "CalendarWrapper" ), uno::UNO_QUERY );
}
CalendarWrapper::~CalendarWrapper()
......@@ -107,27 +107,6 @@ void CalendarWrapper::loadCalendar( const ::rtl::OUString& rUniqueID, const ::co
}
::com::sun::star::i18n::Calendar CalendarWrapper::getLoadedCalendar() const
{
try
{
if ( xC.is() )
return xC->getLoadedCalendar();
}
catch ( Exception& e )
{
#ifdef DBG_UTIL
ByteString aMsg( "getLoadedCalendar: Exception caught\n" );
aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
DBG_ERRORFILE( aMsg.GetBuffer() );
#else
(void)e;
#endif
}
return ::com::sun::star::i18n::Calendar();
}
::com::sun::star::uno::Sequence< ::rtl::OUString > CalendarWrapper::getAllCalendars( const ::com::sun::star::lang::Locale& rLocale ) const
{
try
......@@ -609,4 +588,48 @@ String CalendarWrapper::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_In
return String();
}
// --- XCalendar3 ------------------------------------------------------------
::com::sun::star::i18n::Calendar2 CalendarWrapper::getLoadedCalendar() const
{
try
{
if ( xC.is() )
return xC->getLoadedCalendar2();
}
catch ( Exception& e )
{
#ifdef DBG_UTIL
ByteString aMsg( "getLoadedCalendar2: Exception caught\n" );
aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
DBG_ERRORFILE( aMsg.GetBuffer() );
#else
(void)e;
#endif
}
return ::com::sun::star::i18n::Calendar2();
}
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > CalendarWrapper::getGenitiveMonths() const
{
try
{
if ( xC.is() )
return xC->getGenitiveMonths();
}
catch ( Exception& e )
{
#ifdef DBG_UTIL
ByteString aMsg( "getGenitiveMonths: Exception caught\n" );
aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
DBG_ERRORFILE( aMsg.GetBuffer() );
#else
(void)e;
#endif
}
return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > (0);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -84,7 +84,7 @@ LocaleDataWrapper::LocaleDataWrapper(
bReservedWordValid( sal_False )
{
setLocale( rLocale );
xLD = Reference< XLocaleData2 > (
xLD = Reference< XLocaleData3 > (
intl_createInstance( xSMgr, "com.sun.star.i18n.LocaleData",
"LocaleDataWrapper" ), uno::UNO_QUERY );
}
......@@ -182,27 +182,6 @@ void LocaleDataWrapper::invalidateData()
}
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar > LocaleDataWrapper::getAllCalendars() const
{
try
{
if ( xLD.is() )
return xLD->getAllCalendars( getLocale() );
}
catch ( Exception& e )
{
#ifdef DBG_UTIL
ByteString aMsg( "getAllCalendars: Exception caught\n" );
aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
DBG_ERRORFILE( aMsg.GetBuffer() );
#else
(void)e;
#endif
}
return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar >(0);
}
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency2 > LocaleDataWrapper::getAllCurrencies() const
{
try
......@@ -603,12 +582,12 @@ void LocaleDataWrapper::getDefaultCalendarImpl()
{
if (!xDefaultCalendar)
{
Sequence< Calendar > xCals = getAllCalendars();
Sequence< Calendar2 > xCals = getAllCalendars();
sal_Int32 nCount = xCals.getLength();
sal_Int32 nDef = 0;
if (nCount > 1)
{
const Calendar* pArr = xCals.getArray();
const Calendar2* pArr = xCals.getArray();
for (sal_Int32 i=0; i<nCount; ++i)
{
if (pArr[i].Default)
......@@ -618,12 +597,12 @@ void LocaleDataWrapper::getDefaultCalendarImpl()
}
}
}
xDefaultCalendar.reset( new Calendar( xCals[nDef]));
xDefaultCalendar.reset( new Calendar2( xCals[nDef]));
}
}
const ::boost::shared_ptr< ::com::sun::star::i18n::Calendar > LocaleDataWrapper::getDefaultCalendar() const
const ::boost::shared_ptr< ::com::sun::star::i18n::Calendar2 > LocaleDataWrapper::getDefaultCalendar() const
{
::utl::ReadWriteGuard aGuard( aMutex );
if (!xDefaultCalendar)
......@@ -1950,4 +1929,27 @@ void LocaleDataWrapper::evaluateLocaleDataChecking()
}
}
// --- XLocaleData3 ----------------------------------------------------------
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar2 > LocaleDataWrapper::getAllCalendars() const
{
try
{
if ( xLD.is() )
return xLD->getAllCalendars2( getLocale() );
}
catch ( Exception& e )
{
#ifdef DBG_UTIL
ByteString aMsg( "getAllCalendars: Exception caught\n" );
aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
DBG_ERRORFILE( aMsg.GetBuffer() );
#else
(void)e;
#endif
}
return ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar2 >(0);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment