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 .
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>
35 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
37 class CalendarImpl
: public cppu::WeakImplHelper
39 css::i18n::XCalendar4
,
40 css::lang::XServiceInfo
47 CalendarImpl(const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
52 virtual ~CalendarImpl();
56 virtual void SAL_CALL
loadDefaultCalendar(const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
57 virtual void SAL_CALL
loadCalendar(const OUString
& uniqueID
, const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
58 virtual Calendar SAL_CALL
getLoadedCalendar() throw(css::uno::RuntimeException
, std::exception
) override
;
59 virtual css::uno::Sequence
< OUString
> SAL_CALL
getAllCalendars(const css::lang::Locale
& rLocale
) throw(css::uno::RuntimeException
, std::exception
) override
;
60 virtual OUString SAL_CALL
getUniqueID() throw(css::uno::RuntimeException
, std::exception
) override
;
61 virtual void SAL_CALL
setDateTime(double fTimeInDays
) throw(css::uno::RuntimeException
, std::exception
) override
;
62 virtual double SAL_CALL
getDateTime() throw(css::uno::RuntimeException
, std::exception
) override
;
63 virtual void SAL_CALL
setValue( sal_Int16 nFieldIndex
, sal_Int16 nValue
) throw(css::uno::RuntimeException
, std::exception
) override
;
64 virtual sal_Int16 SAL_CALL
getValue(sal_Int16 nFieldIndex
) throw(css::uno::RuntimeException
, std::exception
) override
;
65 virtual sal_Bool SAL_CALL
isValid() throw (css::uno::RuntimeException
, std::exception
) override
;
66 virtual void SAL_CALL
addValue(sal_Int16 nFieldIndex
, sal_Int32 nAmount
) throw(css::uno::RuntimeException
, std::exception
) override
;
67 virtual sal_Int16 SAL_CALL
getFirstDayOfWeek() throw(css::uno::RuntimeException
, std::exception
) override
;
68 virtual void SAL_CALL
setFirstDayOfWeek(sal_Int16 nDay
) throw(css::uno::RuntimeException
, std::exception
) override
;
69 virtual void SAL_CALL
setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays
) throw(css::uno::RuntimeException
, std::exception
) override
;
70 virtual sal_Int16 SAL_CALL
getMinimumNumberOfDaysForFirstWeek() throw(css::uno::RuntimeException
, std::exception
) override
;
71 virtual sal_Int16 SAL_CALL
getNumberOfMonthsInYear() throw(css::uno::RuntimeException
, std::exception
) override
;
72 virtual sal_Int16 SAL_CALL
getNumberOfDaysInWeek() throw(css::uno::RuntimeException
, std::exception
) override
;
73 virtual css::uno::Sequence
< CalendarItem
> SAL_CALL
getMonths() throw(css::uno::RuntimeException
, std::exception
) override
;
74 virtual css::uno::Sequence
< CalendarItem
> SAL_CALL
getDays() throw(css::uno::RuntimeException
, std::exception
) override
;
75 virtual OUString SAL_CALL
getDisplayName(sal_Int16 nCalendarDisplayIndex
, sal_Int16 nIdx
, sal_Int16 nNameType
) throw(css::uno::RuntimeException
, std::exception
) override
;
77 // Methods in XExtendedCalendar
78 virtual OUString SAL_CALL
getDisplayString( sal_Int32 nCalendarDisplayCode
, sal_Int16 nNativeNumberMode
) throw (css::uno::RuntimeException
, std::exception
) override
;
81 virtual Calendar2 SAL_CALL
getLoadedCalendar2() throw(css::uno::RuntimeException
, std::exception
) override
;
82 virtual css::uno::Sequence
< CalendarItem2
> SAL_CALL
getDays2() throw(css::uno::RuntimeException
, std::exception
) override
;
83 virtual css::uno::Sequence
< CalendarItem2
> SAL_CALL
getMonths2() throw(css::uno::RuntimeException
, std::exception
) override
;
84 virtual css::uno::Sequence
< CalendarItem2
> SAL_CALL
getGenitiveMonths2() throw(css::uno::RuntimeException
, std::exception
) override
;
85 virtual css::uno::Sequence
< CalendarItem2
> SAL_CALL
getPartitiveMonths2() throw(css::uno::RuntimeException
, std::exception
) override
;
88 virtual void SAL_CALL
setLocalDateTime(double TimeInDays
) throw(css::uno::RuntimeException
, std::exception
) override
;
89 virtual double SAL_CALL
getLocalDateTime() throw(css::uno::RuntimeException
, std::exception
) override
;
92 virtual OUString SAL_CALL
getImplementationName() throw(css::uno::RuntimeException
, std::exception
) override
;
93 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw(css::uno::RuntimeException
, std::exception
) override
;
94 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(css::uno::RuntimeException
, std::exception
) override
;
97 struct lookupTableItem
{
98 lookupTableItem(const OUString
& _uniqueID
, css::uno::Reference
< css::i18n::XCalendar4
>& _xCalendar
)
99 : uniqueID(_uniqueID
), xCalendar(_xCalendar
) {}
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
;
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */