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 #ifndef INCLUDED_I18NPOOL_INC_CALENDARIMPL_HXX
20 #define INCLUDED_I18NPOOL_INC_CALENDARIMPL_HXX
21 
22 #include <com/sun/star/i18n/XCalendar4.hpp>
23 #include <cppuhelper/implbase.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <vector>
26 
27 namespace com::sun::star::uno { class XComponentContext; }
28 
29 
30 
31 namespace i18npool {
32 
33 class CalendarImpl : public cppu::WeakImplHelper
34 <
35  css::i18n::XCalendar4,
36  css::lang::XServiceInfo
37 >
38 {
39 public:
40 
41  // Constructors
42  CalendarImpl();
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 
94 private:
95  struct lookupTableItem {
96  lookupTableItem(const OUString& rCacheID, css::uno::Reference < css::i18n::XCalendar4 > const & _xCalendar)
97  : m_aCacheID(rCacheID), xCalendar(_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 #endif
109 
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL setLocalDateTime(double TimeInDays) override
virtual css::uno::Sequence< css::i18n::CalendarItem > SAL_CALL getDays() override
virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL loadCalendarTZ(const OUString &uniqueID, const css::lang::Locale &rLocale, const OUString &rTimeZone) override
virtual ~CalendarImpl() override
Destructor.
virtual void SAL_CALL loadDefaultCalendar(const css::lang::Locale &rLocale) override
virtual sal_Bool SAL_CALL isValid() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getMonths2() override
virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getPartitiveMonths2() override
virtual void SAL_CALL loadCalendar(const OUString &uniqueID, const css::lang::Locale &rLocale) override
virtual css::uno::Sequence< css::i18n::CalendarItem > SAL_CALL getMonths() override
virtual void SAL_CALL setDateTime(double fTimeInDays) override
virtual OUString SAL_CALL getUniqueID() override
virtual sal_Int16 SAL_CALL getFirstDayOfWeek() override
virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) override
virtual double SAL_CALL getDateTime() override
css::uno::Reference< css::i18n::XCalendar4 > xCalendar
unsigned char sal_Bool
virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) override
Constant values shared between i18npool and, for example, the number formatter.
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) override
virtual double SAL_CALL getLocalDateTime() override
virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::i18n::Calendar2 SAL_CALL getLoadedCalendar2() override
virtual void SAL_CALL loadDefaultCalendarTZ(const css::lang::Locale &rLocale, const OUString &rTimeZone) override
virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override
virtual css::i18n::Calendar SAL_CALL getLoadedCalendar() override
virtual css::uno::Sequence< OUString > SAL_CALL getAllCalendars(const css::lang::Locale &rLocale) override
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getGenitiveMonths2() override
css::uno::Reference< css::i18n::XCalendar4 > xCalendar
lookupTableItem(const OUString &rCacheID, css::uno::Reference< css::i18n::XCalendar4 > const &_xCalendar)
virtual css::uno::Sequence< css::i18n::CalendarItem2 > SAL_CALL getDays2() override
virtual OUString SAL_CALL getDisplayString(sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode) override
virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() override
virtual void SAL_CALL setValue(sal_Int16 nFieldIndex, sal_Int16 nValue) override
std::vector< lookupTableItem > lookupTable
sal_Int16 nValue