diff options
author | Eike Rathke <er@openoffice.org> | 2002-07-25 08:53:57 +0000 |
---|---|---|
committer | Eike Rathke <er@openoffice.org> | 2002-07-25 08:53:57 +0000 |
commit | 6f223401fd0b0981e49e3022ba2083bc9cde0777 (patch) | |
tree | b8a590a85be2fbeb12a160269954c4e1df920c0b /unotools | |
parent | dca247d28880d9887fd9f9006f26229f01992e3f (diff) |
#98695# add wrapper implementation of XExtendedCalendar::getDisplayString()
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/inc/unotools/calendarwrapper.hxx | 17 | ||||
-rw-r--r-- | unotools/source/i18n/calendarwrapper.cxx | 33 |
2 files changed, 39 insertions, 11 deletions
diff --git a/unotools/inc/unotools/calendarwrapper.hxx b/unotools/inc/unotools/calendarwrapper.hxx index eacb1fe30d5f..742a93cbfaa7 100644 --- a/unotools/inc/unotools/calendarwrapper.hxx +++ b/unotools/inc/unotools/calendarwrapper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: calendarwrapper.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: er $ $Date: 2001-08-27 15:18:38 $ + * last change: $Author: er $ $Date: 2002-07-25 09:53:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,16 +83,19 @@ namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } +}}} + +namespace drafts { namespace com { namespace sun { namespace star { namespace i18n { - class XCalendar; + class XExtendedCalendar; } -}}} +}}}} class CalendarWrapper { ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; - ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCalendar > xC; + ::com::sun::star::uno::Reference< ::drafts::com::sun::star::i18n::XExtendedCalendar > xC; DateTime aEpochStart; // 1Jan1970 @@ -126,6 +129,10 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDays() const; String getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType ) const; + // wrapper implementations of XExtendedCalendar + + String getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) const; + // convenience methods diff --git a/unotools/source/i18n/calendarwrapper.cxx b/unotools/source/i18n/calendarwrapper.cxx index 18c76c3596bd..feb2156697d7 100644 --- a/unotools/source/i18n/calendarwrapper.cxx +++ b/unotools/source/i18n/calendarwrapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: calendarwrapper.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: er $ $Date: 2002-03-08 16:56:32 $ + * last change: $Author: er $ $Date: 2002-07-25 09:53:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,8 +71,8 @@ #ifndef _COMPHELPER_COMPONENTFACTORY_HXX_ #include <comphelper/componentfactory.hxx> #endif -#ifndef _COM_SUN_STAR_I18N_XCALENDAR_HPP_ -#include <com/sun/star/i18n/XCalendar.hpp> +#ifndef _COM_SUN_STAR_I18N_XEXTENDEDCALENDAR_HPP_ +#include <drafts/com/sun/star/i18n/XExtendedCalendar.hpp> #endif #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -87,6 +87,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::i18n; +using namespace ::drafts::com::sun::star::i18n; using namespace ::com::sun::star::uno; @@ -101,7 +102,7 @@ CalendarWrapper::CalendarWrapper( { try { - xC = Reference< XCalendar > ( xSMgr->createInstance( + xC = Reference< XExtendedCalendar > ( xSMgr->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CALENDAR_SERVICENAME ) ) ), uno::UNO_QUERY ); } @@ -124,7 +125,7 @@ CalendarWrapper::CalendarWrapper( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CALENDAR_SERVICENAME ) ) ); if ( xI.is() ) { - Any x = xI->queryInterface( ::getCppuType((const Reference< XCalendar >*)0) ); + Any x = xI->queryInterface( ::getCppuType((const Reference< XExtendedCalendar >*)0) ); x >>= xC; } } @@ -523,3 +524,23 @@ String CalendarWrapper::getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int } +// --- XExtendedCalendar ----------------------------------------------------- + +String CalendarWrapper::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) const +{ + try + { + if ( xC.is() ) + return xC->getDisplayString( nCalendarDisplayCode, nNativeNumberMode ); + } + catch ( Exception& e ) + { +#ifndef PRODUCT + ByteString aMsg( "getDisplayString: Exception caught\n" ); + aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); + DBG_ERRORFILE( aMsg.GetBuffer() ); +#endif + } + return String(); +} + |