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>
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::XCalendar3,
40 : com::sun::star::lang::XServiceInfo
41 : >
42 : {
43 : public:
44 :
45 : // Constructors
46 0 : 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 nTimeInDays) 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 : //XServiceInfo
88 : virtual OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 : virtual com::sun::star::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 : private:
93 0 : struct lookupTableItem {
94 0 : lookupTableItem(const OUString& _uniqueID, com::sun::star::uno::Reference < com::sun::star::i18n::XCalendar3 >& _xCalendar) :
95 0 : uniqueID(_uniqueID), xCalendar(_xCalendar) {}
96 : OUString uniqueID;
97 : com::sun::star::uno::Reference < com::sun::star::i18n::XCalendar3 > xCalendar;
98 : };
99 : std::vector<lookupTableItem*> lookupTable;
100 : com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
101 : com::sun::star::uno::Reference < com::sun::star::i18n::XCalendar3 > xCalendar;
102 : };
103 :
104 : } } } }
105 :
106 : #endif
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|