Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / i18npool / inc / calendarImpl.hxx
blob299bfe79bae2584cbae88e5db0d60b2374f12d3c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_I18NPOOL_INC_CALENDARIMPL_HXX
20 #define INCLUDED_I18NPOOL_INC_CALENDARIMPL_HXX
22 #include <com/sun/star/i18n/XCalendar4.hpp>
23 #include <cppuhelper/implbase.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <vector>
27 namespace com::sun::star::uno { class XComponentContext; }
29 // class CalendarImpl
32 namespace i18npool {
34 class CalendarImpl : public cppu::WeakImplHelper
36 css::i18n::XCalendar4,
37 css::lang::XServiceInfo
40 public:
42 // Constructors
43 CalendarImpl() {};
44 CalendarImpl(const css::uno::Reference < css::uno::XComponentContext >& rxContext);
46 /**
47 * Destructor
49 virtual ~CalendarImpl() override;
52 // Methods
53 virtual void SAL_CALL loadDefaultCalendar(const css::lang::Locale& rLocale) override;
54 virtual void SAL_CALL loadCalendar(const OUString& uniqueID, const css::lang::Locale& rLocale) override;
55 virtual css::i18n::Calendar SAL_CALL getLoadedCalendar() override;
56 virtual css::uno::Sequence < OUString > SAL_CALL getAllCalendars(const css::lang::Locale& rLocale) override;
57 virtual OUString SAL_CALL getUniqueID() override;
58 virtual void SAL_CALL setDateTime(double fTimeInDays) override;
59 virtual double SAL_CALL getDateTime() override;
60 virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) override;
61 virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) override;
62 virtual sal_Bool SAL_CALL isValid() override;
63 virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) override;
64 virtual sal_Int16 SAL_CALL getFirstDayOfWeek() override;
65 virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) override;
66 virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) override;
67 virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() override;
68 virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() override;
69 virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() override;
70 virtual css::uno::Sequence < css::i18n::CalendarItem > SAL_CALL getMonths() override;
71 virtual css::uno::Sequence < css::i18n::CalendarItem > SAL_CALL getDays() override;
72 virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override;
74 // Methods in XExtendedCalendar
75 virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) override;
77 // XCalendar3
78 virtual css::i18n::Calendar2 SAL_CALL getLoadedCalendar2() override;
79 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getDays2() override;
80 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getMonths2() override;
81 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getGenitiveMonths2() override;
82 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getPartitiveMonths2() override;
84 // XCalendar4
85 virtual void SAL_CALL setLocalDateTime(double TimeInDays) override;
86 virtual double SAL_CALL getLocalDateTime() override;
87 virtual void SAL_CALL loadDefaultCalendarTZ(const css::lang::Locale& rLocale, const OUString& rTimeZone) override;
88 virtual void SAL_CALL loadCalendarTZ(const OUString& uniqueID, const css::lang::Locale& rLocale, const OUString& rTimeZone) override;
90 //XServiceInfo
91 virtual OUString SAL_CALL getImplementationName() override;
92 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
93 virtual css::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() override;
95 private:
96 struct lookupTableItem {
97 lookupTableItem(const OUString& rCacheID, css::uno::Reference < css::i18n::XCalendar4 > const & _xCalendar)
98 : m_aCacheID(rCacheID), xCalendar(_xCalendar) {}
99 OUString m_aCacheID;
100 css::uno::Reference < css::i18n::XCalendar4 > xCalendar;
102 std::vector<lookupTableItem> lookupTable;
103 css::uno::Reference < css::uno::XComponentContext > m_xContext;
104 css::uno::Reference < css::i18n::XCalendar4 > xCalendar;
109 #endif
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */