1*f7bd9df4SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f7bd9df4SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f7bd9df4SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f7bd9df4SAndrew Rist * distributed with this work for additional information 6*f7bd9df4SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f7bd9df4SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f7bd9df4SAndrew Rist * "License"); you may not use this file except in compliance 9*f7bd9df4SAndrew Rist * with the License. You may obtain a copy of the License at 10*f7bd9df4SAndrew Rist * 11*f7bd9df4SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f7bd9df4SAndrew Rist * 13*f7bd9df4SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f7bd9df4SAndrew Rist * software distributed under the License is distributed on an 15*f7bd9df4SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f7bd9df4SAndrew Rist * KIND, either express or implied. See the License for the 17*f7bd9df4SAndrew Rist * specific language governing permissions and limitations 18*f7bd9df4SAndrew Rist * under the License. 19*f7bd9df4SAndrew Rist * 20*f7bd9df4SAndrew Rist *************************************************************/ 21*f7bd9df4SAndrew Rist 22*f7bd9df4SAndrew Rist 23cdf0e10cSrcweir #ifndef _I18N_CALENDARIMPL_HXX_ 24cdf0e10cSrcweir #define _I18N_CALENDARIMPL_HXX_ 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/i18n/XExtendedCalendar.hpp> 27cdf0e10cSrcweir #include <com/sun/star/i18n/CalendarDisplayCode.hpp> 28cdf0e10cSrcweir #include <com/sun/star/i18n/CalendarFieldIndex.hpp> 29cdf0e10cSrcweir #include <com/sun/star/i18n/CalendarDisplayIndex.hpp> 30cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> // helper for implementations 31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 32cdf0e10cSrcweir #include <vector> 33cdf0e10cSrcweir 34cdf0e10cSrcweir // ---------------------------------------------------- 35cdf0e10cSrcweir // class CalendarImpl 36cdf0e10cSrcweir // ---------------------------------------------------- 37cdf0e10cSrcweir 38cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n { 39cdf0e10cSrcweir 40cdf0e10cSrcweir class CalendarImpl : public cppu::WeakImplHelper2 41cdf0e10cSrcweir < 42cdf0e10cSrcweir com::sun::star::i18n::XExtendedCalendar, 43cdf0e10cSrcweir com::sun::star::lang::XServiceInfo 44cdf0e10cSrcweir > 45cdf0e10cSrcweir { 46cdf0e10cSrcweir public: 47cdf0e10cSrcweir 48cdf0e10cSrcweir // Constructors CalendarImpl()49cdf0e10cSrcweir CalendarImpl() {}; 50cdf0e10cSrcweir CalendarImpl(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF); 51cdf0e10cSrcweir 52cdf0e10cSrcweir /** 53cdf0e10cSrcweir * Destructor 54cdf0e10cSrcweir */ 55cdf0e10cSrcweir ~CalendarImpl(); 56cdf0e10cSrcweir 57cdf0e10cSrcweir 58cdf0e10cSrcweir // Methods 59cdf0e10cSrcweir virtual void SAL_CALL loadDefaultCalendar(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); 60cdf0e10cSrcweir virtual void SAL_CALL loadCalendar(const rtl::OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); 61cdf0e10cSrcweir virtual Calendar SAL_CALL getLoadedCalendar() throw(com::sun::star::uno::RuntimeException); 62cdf0e10cSrcweir virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getAllCalendars(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); 63cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getUniqueID() throw(com::sun::star::uno::RuntimeException); 64cdf0e10cSrcweir virtual void SAL_CALL setDateTime(double nTimeInDays) throw(com::sun::star::uno::RuntimeException); 65cdf0e10cSrcweir virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException); 66cdf0e10cSrcweir virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) throw(com::sun::star::uno::RuntimeException); 67cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) throw(com::sun::star::uno::RuntimeException); 68cdf0e10cSrcweir virtual sal_Bool SAL_CALL isValid() throw (com::sun::star::uno::RuntimeException); 69cdf0e10cSrcweir virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) throw(com::sun::star::uno::RuntimeException); 70cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getFirstDayOfWeek() throw(com::sun::star::uno::RuntimeException); 71cdf0e10cSrcweir virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) throw(com::sun::star::uno::RuntimeException); 72cdf0e10cSrcweir virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) throw(com::sun::star::uno::RuntimeException); 73cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() throw(com::sun::star::uno::RuntimeException); 74cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() throw(com::sun::star::uno::RuntimeException); 75cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() throw(com::sun::star::uno::RuntimeException); 76cdf0e10cSrcweir virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getMonths() throw(com::sun::star::uno::RuntimeException); 77cdf0e10cSrcweir virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getDays() throw(com::sun::star::uno::RuntimeException); 78cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) throw(com::sun::star::uno::RuntimeException); 79cdf0e10cSrcweir 80cdf0e10cSrcweir // Methods in XExtendedCalendar 81cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException); 82cdf0e10cSrcweir 83cdf0e10cSrcweir //XServiceInfo 84cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); 85cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw(com::sun::star::uno::RuntimeException); 86cdf0e10cSrcweir virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); 87cdf0e10cSrcweir 88cdf0e10cSrcweir private: 89cdf0e10cSrcweir struct lookupTableItem { lookupTableItemcom::sun::star::i18n::CalendarImpl::lookupTableItem90cdf0e10cSrcweir lookupTableItem(const rtl::OUString& _uniqueID, com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedCalendar >& _xCalendar) : 91cdf0e10cSrcweir uniqueID(_uniqueID), xCalendar(_xCalendar) {} 92cdf0e10cSrcweir rtl::OUString uniqueID; 93cdf0e10cSrcweir com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedCalendar > xCalendar; 94cdf0e10cSrcweir }; 95cdf0e10cSrcweir std::vector<lookupTableItem*> lookupTable; 96cdf0e10cSrcweir com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; 97cdf0e10cSrcweir com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedCalendar > xCalendar; 98cdf0e10cSrcweir }; 99cdf0e10cSrcweir 100cdf0e10cSrcweir } } } } 101cdf0e10cSrcweir 102cdf0e10cSrcweir #endif 103