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