1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include <com/sun/star/i18n/XCalendar4.hpp>
22 #include <cppuhelper/implbase.hxx>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
26 namespace com::sun::star::uno
{ class XComponentContext
; }
32 class CalendarImpl
: public cppu::WeakImplHelper
34 css::i18n::XCalendar4
,
35 css::lang::XServiceInfo
42 CalendarImpl(const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
47 virtual ~CalendarImpl() override
;
51 virtual void SAL_CALL
loadDefaultCalendar(const css::lang::Locale
& rLocale
) override
;
52 virtual void SAL_CALL
loadCalendar(const OUString
& uniqueID
, const css::lang::Locale
& rLocale
) override
;
53 virtual css::i18n::Calendar SAL_CALL
getLoadedCalendar() override
;
54 virtual css::uno::Sequence
< OUString
> SAL_CALL
getAllCalendars(const css::lang::Locale
& rLocale
) override
;
55 virtual OUString SAL_CALL
getUniqueID() override
;
56 virtual void SAL_CALL
setDateTime(double fTimeInDays
) override
;
57 virtual double SAL_CALL
getDateTime() override
;
58 virtual void SAL_CALL
setValue( sal_Int16 nFieldIndex
, sal_Int16 nValue
) override
;
59 virtual sal_Int16 SAL_CALL
getValue(sal_Int16 nFieldIndex
) override
;
60 virtual sal_Bool SAL_CALL
isValid() override
;
61 virtual void SAL_CALL
addValue(sal_Int16 nFieldIndex
, sal_Int32 nAmount
) override
;
62 virtual sal_Int16 SAL_CALL
getFirstDayOfWeek() override
;
63 virtual void SAL_CALL
setFirstDayOfWeek(sal_Int16 nDay
) override
;
64 virtual void SAL_CALL
setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays
) override
;
65 virtual sal_Int16 SAL_CALL
getMinimumNumberOfDaysForFirstWeek() override
;
66 virtual sal_Int16 SAL_CALL
getNumberOfMonthsInYear() override
;
67 virtual sal_Int16 SAL_CALL
getNumberOfDaysInWeek() override
;
68 virtual css::uno::Sequence
< css::i18n::CalendarItem
> SAL_CALL
getMonths() override
;
69 virtual css::uno::Sequence
< css::i18n::CalendarItem
> SAL_CALL
getDays() override
;
70 virtual OUString SAL_CALL
getDisplayName(sal_Int16 nCalendarDisplayIndex
, sal_Int16 nIdx
, sal_Int16 nNameType
) override
;
72 // Methods in XExtendedCalendar
73 virtual OUString SAL_CALL
getDisplayString( sal_Int32 nCalendarDisplayCode
, sal_Int16 nNativeNumberMode
) override
;
76 virtual css::i18n::Calendar2 SAL_CALL
getLoadedCalendar2() override
;
77 virtual css::uno::Sequence
< css::i18n::CalendarItem2
> SAL_CALL
getDays2() override
;
78 virtual css::uno::Sequence
< css::i18n::CalendarItem2
> SAL_CALL
getMonths2() override
;
79 virtual css::uno::Sequence
< css::i18n::CalendarItem2
> SAL_CALL
getGenitiveMonths2() override
;
80 virtual css::uno::Sequence
< css::i18n::CalendarItem2
> SAL_CALL
getPartitiveMonths2() override
;
83 virtual void SAL_CALL
setLocalDateTime(double TimeInDays
) override
;
84 virtual double SAL_CALL
getLocalDateTime() override
;
85 virtual void SAL_CALL
loadDefaultCalendarTZ(const css::lang::Locale
& rLocale
, const OUString
& rTimeZone
) override
;
86 virtual void SAL_CALL
loadCalendarTZ(const OUString
& uniqueID
, const css::lang::Locale
& rLocale
, const OUString
& rTimeZone
) override
;
89 virtual OUString SAL_CALL
getImplementationName() override
;
90 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
91 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
94 struct lookupTableItem
{
95 lookupTableItem(const OUString
& rCacheID
, css::uno::Reference
< css::i18n::XCalendar4
> const & _xCalendar
)
96 : m_aCacheID(rCacheID
), xCalendar(_xCalendar
) {}
98 css::uno::Reference
< css::i18n::XCalendar4
> xCalendar
;
100 std::vector
<lookupTableItem
> lookupTable
;
101 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
102 css::uno::Reference
< css::i18n::XCalendar4
> xCalendar
;
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */