Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / i18npool / inc / calendarImpl.hxx
blob8d8f0d3afd230b5e088b0c080f3fb0e83caa9602
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 <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/implbase.hxx>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
29 #include <vector>
32 // class CalendarImpl
35 namespace i18npool {
37 class CalendarImpl : public cppu::WeakImplHelper
39 css::i18n::XCalendar4,
40 css::lang::XServiceInfo
43 public:
45 // Constructors
46 CalendarImpl() {};
47 CalendarImpl(const css::uno::Reference < css::uno::XComponentContext >& rxContext);
49 /**
50 * Destructor
52 virtual ~CalendarImpl() override;
55 // Methods
56 virtual void SAL_CALL loadDefaultCalendar(const css::lang::Locale& rLocale) override;
57 virtual void SAL_CALL loadCalendar(const OUString& uniqueID, const css::lang::Locale& rLocale) override;
58 virtual css::i18n::Calendar SAL_CALL getLoadedCalendar() override;
59 virtual css::uno::Sequence < OUString > SAL_CALL getAllCalendars(const css::lang::Locale& rLocale) override;
60 virtual OUString SAL_CALL getUniqueID() override;
61 virtual void SAL_CALL setDateTime(double fTimeInDays) override;
62 virtual double SAL_CALL getDateTime() override;
63 virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) override;
64 virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) override;
65 virtual sal_Bool SAL_CALL isValid() override;
66 virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) override;
67 virtual sal_Int16 SAL_CALL getFirstDayOfWeek() override;
68 virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) override;
69 virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) override;
70 virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() override;
71 virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() override;
72 virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() override;
73 virtual css::uno::Sequence < css::i18n::CalendarItem > SAL_CALL getMonths() override;
74 virtual css::uno::Sequence < css::i18n::CalendarItem > SAL_CALL getDays() override;
75 virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override;
77 // Methods in XExtendedCalendar
78 virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) override;
80 // XCalendar3
81 virtual css::i18n::Calendar2 SAL_CALL getLoadedCalendar2() override;
82 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getDays2() override;
83 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getMonths2() override;
84 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getGenitiveMonths2() override;
85 virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getPartitiveMonths2() override;
87 // XCalendar4
88 virtual void SAL_CALL setLocalDateTime(double TimeInDays) override;
89 virtual double SAL_CALL getLocalDateTime() override;
91 //XServiceInfo
92 virtual OUString SAL_CALL getImplementationName() override;
93 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
94 virtual css::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() override;
96 private:
97 struct lookupTableItem {
98 lookupTableItem(const OUString& _uniqueID, css::uno::Reference < css::i18n::XCalendar4 > const & _xCalendar)
99 : uniqueID(_uniqueID), xCalendar(_xCalendar) {}
100 OUString uniqueID;
101 css::uno::Reference < css::i18n::XCalendar4 > xCalendar;
103 std::vector<lookupTableItem> lookupTable;
104 css::uno::Reference < css::uno::XComponentContext > m_xContext;
105 css::uno::Reference < css::i18n::XCalendar4 > xCalendar;
110 #endif
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */