Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _I18N_CALENDARIMPL_HXX_
20 : #define _I18N_CALENDARIMPL_HXX_
21 :
22 : #include <com/sun/star/i18n/XCalendar3.hpp>
23 : #include <com/sun/star/i18n/CalendarDisplayCode.hpp>
24 : #include <com/sun/star/i18n/CalendarFieldIndex.hpp>
25 : #include <com/sun/star/i18n/CalendarDisplayIndex.hpp>
26 : #include <cppuhelper/implbase2.hxx> // helper for implementations
27 : #include <com/sun/star/lang/XServiceInfo.hpp>
28 : #include <vector>
29 :
30 : // ----------------------------------------------------
31 : // class CalendarImpl
32 : // ----------------------------------------------------
33 :
34 : namespace com { namespace sun { namespace star { namespace i18n {
35 :
36 : class CalendarImpl : public cppu::WeakImplHelper2
37 : <
38 : com::sun::star::i18n::XCalendar3,
39 : com::sun::star::lang::XServiceInfo
40 : >
41 : {
42 : public:
43 :
44 : // Constructors
45 32 : CalendarImpl() {};
46 : CalendarImpl(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF);
47 :
48 : /**
49 : * Destructor
50 : */
51 : ~CalendarImpl();
52 :
53 :
54 : // Methods
55 : virtual void SAL_CALL loadDefaultCalendar(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException);
56 : virtual void SAL_CALL loadCalendar(const rtl::OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException);
57 : virtual Calendar SAL_CALL getLoadedCalendar() throw(com::sun::star::uno::RuntimeException);
58 : virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getAllCalendars(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException);
59 : virtual rtl::OUString SAL_CALL getUniqueID() throw(com::sun::star::uno::RuntimeException);
60 : virtual void SAL_CALL setDateTime(double nTimeInDays) throw(com::sun::star::uno::RuntimeException);
61 : virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException);
62 : virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) throw(com::sun::star::uno::RuntimeException);
63 : virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) throw(com::sun::star::uno::RuntimeException);
64 : virtual sal_Bool SAL_CALL isValid() throw (com::sun::star::uno::RuntimeException);
65 : virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) throw(com::sun::star::uno::RuntimeException);
66 : virtual sal_Int16 SAL_CALL getFirstDayOfWeek() throw(com::sun::star::uno::RuntimeException);
67 : virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) throw(com::sun::star::uno::RuntimeException);
68 : virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) throw(com::sun::star::uno::RuntimeException);
69 : virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() throw(com::sun::star::uno::RuntimeException);
70 : virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() throw(com::sun::star::uno::RuntimeException);
71 : virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() throw(com::sun::star::uno::RuntimeException);
72 : virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getMonths() throw(com::sun::star::uno::RuntimeException);
73 : virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getDays() throw(com::sun::star::uno::RuntimeException);
74 : virtual rtl::OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) throw(com::sun::star::uno::RuntimeException);
75 :
76 : // Methods in XExtendedCalendar
77 : virtual rtl::OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException);
78 :
79 : // XCalendar3
80 : virtual Calendar2 SAL_CALL getLoadedCalendar2() throw(com::sun::star::uno::RuntimeException);
81 : virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getDays2() throw(com::sun::star::uno::RuntimeException);
82 : virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getMonths2() throw(com::sun::star::uno::RuntimeException);
83 : virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getGenitiveMonths2() throw(com::sun::star::uno::RuntimeException);
84 : virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getPartitiveMonths2() throw(com::sun::star::uno::RuntimeException);
85 :
86 : //XServiceInfo
87 : virtual rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
88 : virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw(com::sun::star::uno::RuntimeException);
89 : virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
90 :
91 : private:
92 18 : struct lookupTableItem {
93 32 : lookupTableItem(const rtl::OUString& _uniqueID, com::sun::star::uno::Reference < com::sun::star::i18n::XCalendar3 >& _xCalendar) :
94 32 : uniqueID(_uniqueID), xCalendar(_xCalendar) {}
95 : rtl::OUString uniqueID;
96 : com::sun::star::uno::Reference < com::sun::star::i18n::XCalendar3 > xCalendar;
97 : };
98 : std::vector<lookupTableItem*> lookupTable;
99 : com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
100 : com::sun::star::uno::Reference < com::sun::star::i18n::XCalendar3 > xCalendar;
101 : };
102 :
103 : } } } }
104 :
105 : #endif
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|