LibreOffice Module i18npool (master) 1
calendarImpl.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <com/sun/star/i18n/XCalendar4.hpp>
23#include <com/sun/star/lang/XServiceInfo.hpp>
24#include <utility>
25#include <vector>
26
27namespace com::sun::star::uno { class XComponentContext; }
28
29
30
31namespace i18npool {
32
33class CalendarImpl : public cppu::WeakImplHelper
34<
35 css::i18n::XCalendar4,
36 css::lang::XServiceInfo
37>
38{
39public:
40
41 // Constructors
43 CalendarImpl(const css::uno::Reference < css::uno::XComponentContext >& rxContext);
44
48 virtual ~CalendarImpl() override;
49
50
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;
72
73 // Methods in XExtendedCalendar
74 virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) override;
75
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;
82
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;
88
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;
93
94private:
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;
100 };
101 std::vector<lookupTableItem> lookupTable;
102 css::uno::Reference < css::uno::XComponentContext > m_xContext;
103 css::uno::Reference < css::i18n::XCalendar4 > xCalendar;
104};
105
106}
107
108/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CalendarImpl(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() override
virtual css::uno::Sequence< OUString > SAL_CALL getAllCalendars(const css::lang::Locale &rLocale) override
std::vector< lookupTableItem > lookupTable
css::uno::Reference< css::i18n::XCalendar4 > xCalendar
virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override
virtual sal_Bool SAL_CALL isValid() override
virtual double SAL_CALL getDateTime() override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getDays2() override
virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) override
virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) override
virtual void SAL_CALL loadDefaultCalendar(const css::lang::Locale &rLocale) override
virtual double SAL_CALL getLocalDateTime() override
virtual css::uno::Sequence< css::i18n::CalendarItem > SAL_CALL getDays() override
virtual OUString SAL_CALL getUniqueID() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::i18n::Calendar2 SAL_CALL getLoadedCalendar2() override
virtual css::i18n::Calendar SAL_CALL getLoadedCalendar() override
virtual ~CalendarImpl() override
Destructor.
virtual void SAL_CALL loadCalendar(const OUString &uniqueID, const css::lang::Locale &rLocale) override
virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) override
virtual void SAL_CALL setLocalDateTime(double TimeInDays) override
virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL loadDefaultCalendarTZ(const css::lang::Locale &rLocale, const OUString &rTimeZone) override
virtual sal_Int16 SAL_CALL getFirstDayOfWeek() override
virtual void SAL_CALL loadCalendarTZ(const OUString &uniqueID, const css::lang::Locale &rLocale, const OUString &rTimeZone) override
virtual void SAL_CALL setValue(sal_Int16 nFieldIndex, sal_Int16 nValue) override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getPartitiveMonths2() override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getGenitiveMonths2() override
virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getMonths2() override
virtual css::uno::Sequence< css::i18n::CalendarItem > SAL_CALL getMonths() override
virtual OUString SAL_CALL getDisplayString(sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode) override
virtual void SAL_CALL setDateTime(double fTimeInDays) override
virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() override
Constant values shared between i18npool and, for example, the number formatter.
lookupTableItem(OUString aCacheID, css::uno::Reference< css::i18n::XCalendar4 > _xCalendar)
css::uno::Reference< css::i18n::XCalendar4 > xCalendar
unsigned char sal_Bool