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 INCLUDED_I18NPOOL_INC_CALENDARIMPL_HXX
20 : #define INCLUDED_I18NPOOL_INC_CALENDARIMPL_HXX
21 :
22 : #include <com/sun/star/i18n/XCalendar4.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>
27 : #include <com/sun/star/lang/XServiceInfo.hpp>
28 : #include <com/sun/star/uno/XComponentContext.hpp>
29 : #include <vector>
30 :
31 :
32 : // class CalendarImpl
33 :
34 :
35 : namespace com { namespace sun { namespace star { namespace i18n {
36 :
37 : class CalendarImpl : public cppu::WeakImplHelper2
38 : <
39 : com::sun::star::i18n::XCalendar4,
40 : com::sun::star::lang::XServiceInfo
41 : >
42 : {
43 : public:
44 :
45 : // Constructors
46 230 : CalendarImpl() {};
47 : CalendarImpl(const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext);
48 :
49 : /**
50 : * Destructor
51 : */
52 : virtual ~CalendarImpl();
53 :
54 :
55 : // Methods
56 : virtual void SAL_CALL loadDefaultCalendar(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 : virtual void SAL_CALL loadCalendar(const OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
58 : virtual Calendar SAL_CALL getLoadedCalendar() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
59 : virtual com::sun::star::uno::Sequence < OUString > SAL_CALL getAllCalendars(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
60 : virtual OUString SAL_CALL getUniqueID() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
61 : virtual void SAL_CALL setDateTime(double fTimeInDays) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
62 : virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
63 : virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
64 : virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
65 : virtual sal_Bool SAL_CALL isValid() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
66 : virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
67 : virtual sal_Int16 SAL_CALL getFirstDayOfWeek() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 : virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 : virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 : virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 : virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 : virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 : virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getMonths() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 : virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getDays() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 : virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
76 :
77 : // Methods in XExtendedCalendar
78 : virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 :
80 : // XCalendar3
81 : virtual Calendar2 SAL_CALL getLoadedCalendar2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 : virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getDays2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 : virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getMonths2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 : virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getGenitiveMonths2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 : virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getPartitiveMonths2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 :
87 : // XCalendar4
88 : virtual void SAL_CALL setLocalDateTime(double TimeInDays) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual double SAL_CALL getLocalDateTime() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 :
91 : //XServiceInfo
92 : virtual OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual com::sun::star::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 :
96 : private:
97 188 : struct lookupTableItem {
98 230 : lookupTableItem(const OUString& _uniqueID, com::sun::star::uno::Reference < com::sun::star::i18n::XCalendar4 >& _xCalendar) :
99 230 : uniqueID(_uniqueID), xCalendar(_xCalendar) {}
100 : OUString uniqueID;
101 : com::sun::star::uno::Reference < com::sun::star::i18n::XCalendar4 > xCalendar;
102 : };
103 : std::vector<lookupTableItem*> lookupTable;
104 : com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
105 : com::sun::star::uno::Reference < com::sun::star::i18n::XCalendar4 > xCalendar;
106 : };
107 :
108 : } } } }
109 :
110 : #endif
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|