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 _I18N_CALENDARIMPL_HXX_
20 #define _I18N_CALENDARIMPL_HXX_
22 #include <com/sun/star/i18n/XCalendar3.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/implbase2.hxx> // helper for implementations
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
31 // ----------------------------------------------------
33 // ----------------------------------------------------
35 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
37 class CalendarImpl
: public cppu::WeakImplHelper2
39 com::sun::star::i18n::XCalendar3
,
40 com::sun::star::lang::XServiceInfo
47 CalendarImpl(const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& rxContext
);
56 virtual void SAL_CALL
loadDefaultCalendar(const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
57 virtual void SAL_CALL
loadCalendar(const OUString
& uniqueID
, const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
58 virtual Calendar SAL_CALL
getLoadedCalendar() throw(com::sun::star::uno::RuntimeException
);
59 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getAllCalendars(const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
);
60 virtual OUString SAL_CALL
getUniqueID() throw(com::sun::star::uno::RuntimeException
);
61 virtual void SAL_CALL
setDateTime(double nTimeInDays
) throw(com::sun::star::uno::RuntimeException
);
62 virtual double SAL_CALL
getDateTime() throw(com::sun::star::uno::RuntimeException
);
63 virtual void SAL_CALL
setValue( sal_Int16 nFieldIndex
, sal_Int16 nValue
) throw(com::sun::star::uno::RuntimeException
);
64 virtual sal_Int16 SAL_CALL
getValue(sal_Int16 nFieldIndex
) throw(com::sun::star::uno::RuntimeException
);
65 virtual sal_Bool SAL_CALL
isValid() throw (com::sun::star::uno::RuntimeException
);
66 virtual void SAL_CALL
addValue(sal_Int16 nFieldIndex
, sal_Int32 nAmount
) throw(com::sun::star::uno::RuntimeException
);
67 virtual sal_Int16 SAL_CALL
getFirstDayOfWeek() throw(com::sun::star::uno::RuntimeException
);
68 virtual void SAL_CALL
setFirstDayOfWeek(sal_Int16 nDay
) throw(com::sun::star::uno::RuntimeException
);
69 virtual void SAL_CALL
setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays
) throw(com::sun::star::uno::RuntimeException
);
70 virtual sal_Int16 SAL_CALL
getMinimumNumberOfDaysForFirstWeek() throw(com::sun::star::uno::RuntimeException
);
71 virtual sal_Int16 SAL_CALL
getNumberOfMonthsInYear() throw(com::sun::star::uno::RuntimeException
);
72 virtual sal_Int16 SAL_CALL
getNumberOfDaysInWeek() throw(com::sun::star::uno::RuntimeException
);
73 virtual com::sun::star::uno::Sequence
< CalendarItem
> SAL_CALL
getMonths() throw(com::sun::star::uno::RuntimeException
);
74 virtual com::sun::star::uno::Sequence
< CalendarItem
> SAL_CALL
getDays() throw(com::sun::star::uno::RuntimeException
);
75 virtual OUString SAL_CALL
getDisplayName(sal_Int16 nCalendarDisplayIndex
, sal_Int16 nIdx
, sal_Int16 nNameType
) throw(com::sun::star::uno::RuntimeException
);
77 // Methods in XExtendedCalendar
78 virtual OUString SAL_CALL
getDisplayString( sal_Int32 nCalendarDisplayCode
, sal_Int16 nNativeNumberMode
) throw (com::sun::star::uno::RuntimeException
);
81 virtual Calendar2 SAL_CALL
getLoadedCalendar2() throw(com::sun::star::uno::RuntimeException
);
82 virtual com::sun::star::uno::Sequence
< CalendarItem2
> SAL_CALL
getDays2() throw(com::sun::star::uno::RuntimeException
);
83 virtual com::sun::star::uno::Sequence
< CalendarItem2
> SAL_CALL
getMonths2() throw(com::sun::star::uno::RuntimeException
);
84 virtual com::sun::star::uno::Sequence
< CalendarItem2
> SAL_CALL
getGenitiveMonths2() throw(com::sun::star::uno::RuntimeException
);
85 virtual com::sun::star::uno::Sequence
< CalendarItem2
> SAL_CALL
getPartitiveMonths2() throw(com::sun::star::uno::RuntimeException
);
88 virtual OUString SAL_CALL
getImplementationName() throw(com::sun::star::uno::RuntimeException
);
89 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw(com::sun::star::uno::RuntimeException
);
90 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException
);
93 struct lookupTableItem
{
94 lookupTableItem(const OUString
& _uniqueID
, com::sun::star::uno::Reference
< com::sun::star::i18n::XCalendar3
>& _xCalendar
) :
95 uniqueID(_uniqueID
), xCalendar(_xCalendar
) {}
97 com::sun::star::uno::Reference
< com::sun::star::i18n::XCalendar3
> xCalendar
;
99 std::vector
<lookupTableItem
*> lookupTable
;
100 com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
> m_xContext
;
101 com::sun::star::uno::Reference
< com::sun::star::i18n::XCalendar3
> xCalendar
;
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */