diff options
-rw-r--r-- | i18npool/inc/calendar_gregorian.hxx | 7 | ||||
-rw-r--r-- | i18npool/source/calendar/calendarImpl.cxx | 3 | ||||
-rw-r--r-- | i18npool/source/calendar/calendar_gregorian.cxx | 10 |
3 files changed, 18 insertions, 2 deletions
diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index 1ee7cabaab1e..1f29d63f9f02 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -21,7 +21,9 @@ #include "calendarImpl.hxx" #include <com/sun/star/i18n/CalendarFieldIndex.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/implbase.hxx> #include <unicode/calendar.h> #include <rtl/ref.hxx> @@ -44,7 +46,7 @@ struct Era { const sal_Int16 FIELD_INDEX_COUNT = css::i18n::CalendarFieldIndex::FIELD_COUNT2; -class Calendar_gregorian : public CalendarImpl +class Calendar_gregorian : public cppu::ImplInheritanceHelper<CalendarImpl, css::lang::XUnoTunnel> { public: @@ -98,6 +100,9 @@ public: virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; virtual css::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() override; + sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override; + static css::uno::Sequence<sal_Int8> const & getUnoTunnelId(); + protected: const Era *eraArray; std::unique_ptr<icu::Calendar> body; diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index 4e364696cf20..60391473f944 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -21,6 +21,7 @@ #include <calendar_gregorian.hxx> #include <localedata.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/uno/XComponentContext.hpp> @@ -90,7 +91,7 @@ CalendarImpl::loadCalendarTZ( const OUString& uniqueID, const css::lang::Locale& /* XXX NOTE: currently (2019-06-19) calendar implementations derive * from Calendar_gregorian, even Hijri and Jewish. If that should * change in future this should be adapted. */ - Calendar_gregorian* pCal = dynamic_cast<Calendar_gregorian*>(xCalendar.get()); + Calendar_gregorian* pCal = comphelper::getFromUnoTunnel<Calendar_gregorian>(xCalendar); bTimeZone = (pCal && pCal->setTimeZone(rTimeZone)); } diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index e586470a0c31..9e9b248a5b28 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/i18n/CalendarDisplayIndex.hpp> #include <com/sun/star/i18n/NativeNumberMode.hpp> #include <com/sun/star/i18n/reservedWords.hpp> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <o3tl/sprintf.hxx> #include <rtl/math.hxx> @@ -1077,6 +1078,15 @@ Calendar_gregorian::getSupportedServiceNames() return aRet; } +sal_Int64 Calendar_gregorian::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) { + return comphelper::getSomethingImpl(aIdentifier, this); +} + +css::uno::Sequence<sal_Int8> const & Calendar_gregorian::getUnoTunnelId() { + static comphelper::UnoIdInit const id; + return id.getSeq(); +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |