LCOV - code coverage report
Current view: top level - i18npool/inc - calendar_gregorian.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 _I18N_CALENDAR_GREGORIAN_HXX_
      20             : #define _I18N_CALENDAR_GREGORIAN_HXX_
      21             : 
      22             : #include "calendarImpl.hxx"
      23             : #include "nativenumbersupplier.hxx"
      24             : 
      25             : #include <unicode/calendar.h>
      26             : 
      27             : 
      28             : //  class Calendar_gregorian
      29             : 
      30             : 
      31             : namespace com { namespace sun { namespace star { namespace i18n {
      32             : 
      33             : const sal_uInt8 kDisplayEraForcedLongYear = 0x01;
      34             : 
      35             : struct Era {
      36             :     sal_Int32 year;
      37             :     sal_Int32 month;
      38             :     sal_Int32 day;
      39             :     sal_uInt8 flags;
      40             : };
      41             : 
      42             : const sal_Int16 FIELD_INDEX_COUNT = CalendarFieldIndex::FIELD_COUNT2;
      43             : 
      44             : class Calendar_gregorian : public CalendarImpl
      45             : {
      46             : public:
      47             : 
      48             :     // Constructors
      49             :     Calendar_gregorian();
      50             :     Calendar_gregorian(const Era *_eraArray);
      51             :     void SAL_CALL init(const Era *_eraArray);
      52             : 
      53             :     /**
      54             :     * Destructor
      55             :     */
      56             :     virtual ~Calendar_gregorian();
      57             : 
      58             :     // Methods in XCalendar
      59             :     virtual void SAL_CALL loadCalendar(const OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      60             :     virtual void SAL_CALL setDateTime(double nTimeInDays) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      61             :     virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      62             :     virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      63             :     virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      64             :     virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      65             :     virtual sal_Bool SAL_CALL isValid() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      66             :     virtual Calendar SAL_CALL getLoadedCalendar() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      67             :     virtual OUString SAL_CALL getUniqueID() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      68             :     virtual sal_Int16 SAL_CALL getFirstDayOfWeek() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      69             :     virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      70             :     virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      71             :     virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      72             :     virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      73             :     virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      74             :     virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getMonths() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      75             :     virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getDays() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      76             :     virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      77             : 
      78             :     // Methods in XExtendedCalendar
      79             :     virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      80             : 
      81             :     // XCalendar3
      82             :     virtual Calendar2 SAL_CALL getLoadedCalendar2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      83             :     virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getDays2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      84             :     virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getMonths2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      85             :     virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getGenitiveMonths2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      86             :     virtual com::sun::star::uno::Sequence < CalendarItem2 > SAL_CALL getPartitiveMonths2() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      87             : 
      88             :     //XServiceInfo
      89             :     virtual OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      90             :     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      91             :     virtual com::sun::star::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             : 
      93             : protected:
      94             :     const Era *eraArray;
      95             :     icu::Calendar *body;
      96             :     NativeNumberSupplier aNatNum;
      97             :     const sal_Char* cCalendar;
      98             :     com::sun::star::lang::Locale aLocale;
      99             :     sal_uInt32 fieldSet;
     100             :     sal_Int16 fieldValue[FIELD_INDEX_COUNT];
     101             :     sal_Int16 fieldSetValue[FIELD_INDEX_COUNT];
     102             : 
     103             :     virtual void mapToGregorian() throw(com::sun::star::uno::RuntimeException);
     104             :     virtual void mapFromGregorian() throw(com::sun::star::uno::RuntimeException);
     105             :     void getValue() throw(com::sun::star::uno::RuntimeException);
     106             : 
     107             :     OUString getDisplayStringImpl( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode, bool bEraMode ) throw (com::sun::star::uno::RuntimeException);
     108             : 
     109             : private:
     110             :     Calendar2 aCalendar;
     111             : 
     112             :     /** Submit fieldSetValue array according to fieldSet. */
     113             :     void submitFields() throw(com::sun::star::uno::RuntimeException);
     114             :     /** Submit fieldSetValue array according to fieldSet, plus YMDhms if >=0,
     115             :         plus zone and DST if != 0 */
     116             :     void submitValues( sal_Int32 nYear, sal_Int32 nMonth, sal_Int32 nDay, sal_Int32 nHour, sal_Int32 nMinute, sal_Int32 nSecond, sal_Int32 nMilliSecond, sal_Int32 nZone, sal_Int32 nDST) throw(com::sun::star::uno::RuntimeException);
     117             :     /** Set fields internally. */
     118             :     void setValue() throw(com::sun::star::uno::RuntimeException);
     119             :     /** Obtain combined field values for timezone offset (minutes+secondmillis)
     120             :         in milliseconds and whether fields were set. */
     121             :     bool getZoneOffset( sal_Int32 & o_nOffset ) const;
     122             :     /** Obtain combined field values for DST offset (minutes+secondmillis) in
     123             :         milliseconds and whether fields were set. */
     124             :     bool getDSTOffset( sal_Int32 & o_nOffset ) const;
     125             :     /** Used by getZoneOffset() and getDSTOffset(). Parent is
     126             :         CalendarFieldIndex for offset in minutes, child is CalendarFieldIndex
     127             :         for offset in milliseconds. */
     128             :     bool getCombinedOffset( sal_Int32 & o_nOffset, sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) const;
     129             : };
     130             : 
     131             : 
     132             : //  class Calendar_hanja
     133             : 
     134           0 : class Calendar_hanja : public Calendar_gregorian
     135             : {
     136             : public:
     137             :     // Constructors
     138             :     Calendar_hanja();
     139             :     virtual void SAL_CALL loadCalendar(const OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             :     virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     141             : };
     142             : 
     143             : 
     144             : //  class Calendar_gengou
     145             : 
     146           0 : class Calendar_gengou : public Calendar_gregorian
     147             : {
     148             : public:
     149             :     // Constructors
     150             :     Calendar_gengou();
     151             : };
     152             : 
     153             : 
     154             : //  class Calendar_ROC
     155             : 
     156           0 : class Calendar_ROC : public Calendar_gregorian
     157             : {
     158             : public:
     159             :     // Constructors
     160             :     Calendar_ROC();
     161             : };
     162             : 
     163             : 
     164             : //  class Calendar_buddhist
     165             : 
     166           0 : class Calendar_buddhist : public Calendar_gregorian
     167             : {
     168             : public:
     169             :     // Constructors
     170             :     Calendar_buddhist();
     171             : 
     172             :     // Methods in XExtendedCalendar
     173             :     virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     174             : };
     175             : 
     176             : } } } }
     177             : 
     178             : #endif
     179             : 
     180             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10