Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / i18npool / inc / calendarImpl.hxx
blob0580a878535e4bd32145bfcb8f15557f1ace6f27
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 #pragma once
21 #include <com/sun/star/i18n/XCalendar4.hpp>
22 #include <cppuhelper/implbase.hxx>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <utility>
25 #include <vector>
27 namespace com::sun::star::uno { class XComponentContext; }
31 namespace i18npool {
33 class CalendarImpl : public cppu::WeakImplHelper
35 css::i18n::XCalendar4,
36 css::lang::XServiceInfo
39 public:
41 // Constructors
42 CalendarImpl();
43 CalendarImpl(const css::uno::Reference < css::uno::XComponentContext >& rxContext);
45 /**
46 * Destructor
48 virtual ~CalendarImpl() override;
51 // Methods
52 virtual void SAL_CALL loadDefaultCalendar(const css::lang::Locale& rLocale) override;
53 virtual void SAL_CALL loadCalendar(const OUString& uniqueID, const css::lang::Locale& rLocale) override;
54 virtual css::i18n::Calendar SAL_CALL getLoadedCalendar() override;
55 virtual css::uno::Sequence < OUString > SAL_CALL getAllCalendars(const css::lang::Locale& rLocale) override;
56 virtual OUString SAL_CALL getUniqueID() override;
57 virtual void SAL_CALL setDateTime(double fTimeInDays) override;
58 virtual double SAL_CALL getDateTime() override;
59 virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) override;
60 virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) override;
61 virtual sal_Bool SAL_CALL isValid() override;
62 virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) override;
63 virtual sal_Int16 SAL_CALL getFirstDayOfWeek() override;
64 virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) override;
65 virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) override;
66 virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() override;
67 virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() override;
68 virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() override;
69 virtual css::uno::Sequence < css::i18n::CalendarItem > SAL_CALL getMonths() override;
70 virtual css::uno::Sequence < css::i18n::CalendarItem > SAL_CALL getDays() override;
71 virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override;
73 // Methods in XExtendedCalendar
74 virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) override;
76 // XCalendar3
77 virtual css::i18n::Calendar2 SAL_CALL getLoadedCalendar2() override;
78 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getDays2() override;
79 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getMonths2() override;
80 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getGenitiveMonths2() override;
81 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getPartitiveMonths2() override;
83 // XCalendar4
84 virtual void SAL_CALL setLocalDateTime(double TimeInDays) override;
85 virtual double SAL_CALL getLocalDateTime() override;
86 virtual void SAL_CALL loadDefaultCalendarTZ(const css::lang::Locale& rLocale, const OUString& rTimeZone) override;
87 virtual void SAL_CALL loadCalendarTZ(const OUString& uniqueID, const css::lang::Locale& rLocale, const OUString& rTimeZone) override;
89 //XServiceInfo
90 virtual OUString SAL_CALL getImplementationName() override;
91 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
92 virtual css::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() override;
94 private:
95 struct lookupTableItem {
96 lookupTableItem(OUString aCacheID, css::uno::Reference < css::i18n::XCalendar4 > _xCalendar)
97 : m_aCacheID(std::move(aCacheID)), xCalendar(std::move(_xCalendar)) {}
98 OUString m_aCacheID;
99 css::uno::Reference < css::i18n::XCalendar4 > xCalendar;
101 std::vector<lookupTableItem> lookupTable;
102 css::uno::Reference < css::uno::XComponentContext > m_xContext;
103 css::uno::Reference < css::i18n::XCalendar4 > xCalendar;
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */