office-gobmx/i18npool/inc/calendar_gregorian.hxx
Stephan Bergmann 19691c3b68 Revert all the recent loplugin:unocast changes
...as obsoleted by ef53355355 "Rudimentary support
for dynamic_cast on UNO proxy objects".

This reverts all of:
4cfcc9ac37 "loplugin:unocast (framework::Desktop)"
03efbf72f4 "loplugin:unocast
 (vclcanvas::TextLayout)"
80099fdd51 "loplugin:unocast (SalGtkXWindow)"
cc147f576d "loplugin:unocast
 (sdext::presenter::CachablePresenterView)"
40db42be1d "loplugin:unocast
 (vclcanvas::CanvasFont)"
2d1e7995ea "loplugin:unocast (CairoColorSpace)"
4c0bbe4bd9 "loplugin:unocast
 (canvas::ParametricPolyPolygon)"
8980366662 "loplugin:unocast
 (vclcanas::CanvasBitmap)"
d5e0c2c8db "loplugin:unocast
 (sfx2::DigitalSignatures)"
c0c4519e0d "loplugin:unocast
 (VCLXAccessibleComponent)"
feb8b833a6 "loplugin:unocast (VCLXDialog)"
1fa58cc6cc "loplugin:unocast (VCLXMultiPage)"
f481f036de "loplugin:unocast
 (DocumentSettingsSerializer)"
73df933f5f "loplugin:unocast
 (css::embed::EmbeddedUpdate)"
420165ab0e "loplugin:unocast
 (canvas::tools' StandardColorSpace, StandardNoAlphaColorSpace)"
9abe8ee067 "loplugin:unocast (MutableTreeNode)"
9f3022ceb0 "loplugin:unocast (VCLXTabPage)"
1be70dda02 "loplugin:unocast
 (vcl::unotools::VclCanvasBitmap)"
d6a70bb641 "loplugin:unocast
 (basegfx::unotools::UnoPolyPolygon)"
5a14f009e6 "loplugin:unocast
 (xmlsecurity::Certificate)"
99009c9535 "loplugin:unocast (sd::Annotation)"
0c7585c5fa "loplugin:unocast (sd::TextApiObject)"
24e14afd1b "loplugin:unocast
 (SignatureVerifierImpl)"
1a7ad0c10d "loplugin:unocast
 (pcr::PropertyEventTranslation)"
a97e2d2702 "loplugin:unocast (RangePageBreaks)"
19dfdf86ad "iloplugin:unocast
 (pcr::OFormattedNumericControl)"
f9785ea595 "loplugin:unocast
 (frm::OInterfaceContainer)"
5e5f40a4a9 "loplugin:unocast (ScVbaShapes)"
27b35b2c21 "loplugin:unocast (ScVbaShapeRange)"
cb3108f860 "cid#1517812 Dereference null return
 value"
feba0ddb15 "loplugin:unocast
 (weld::TransportAsXWindow)"
4d6c232165 "loplugin:unocast
 (oox::ForumlaImExportBase)"
4844c096a8 "loplugin:unocast
 (cairocanvas::SurfaceProvider)"
9a0b523e0a "loplugin:unocast
 (cairocanvas::CanvasBitmap)"
8a5648d8e5 "loplugin:unocast
 (cairocanvas::TextLayout)"
28c27a0623 "loplugin:unocast
 (cairocanvas::CanvasFont)"
53bc223cb3 "loplugin:unocast
 (cairocanvas::RepaintTarget)"
5f70b0b9f6 "loplugin:unocast (SvXMLImport)"
068187a898 "loplugin:unocast (VCLXWindow)"
88b4f96620 "loplugin:unocast
 (sfx2::sidebar::SidebarController)"
f1b7a69b28 "loplugin:unocast
 (SvxLineStyleToolBoxControl)"
ba76f0ba7e "loplugin:unocast
 (i18npool::Calendar_gregorian)"
840154daf9 "loplugin:unocast
 (framework::AddonsToolBarWrapper)"
b0e9c4c5f0 "loplugin:unocast
 (GrammarCheckingIterator)"
8ee6cfc965 "loplugin:unocast
 (ucb::ucp::ext::Content)"
5b8cd77c11 "loplugin:unocast
 (basic::SfxScriptLibraryContainer)"
9e73ff9fce "loplugin:unocast
 (sdext::presenter::PresenterNotesView)"
a98acca8fb "loplugin:unocast
 (SelectionChangeHandler)"
c0b59ad6e3 "Consistently use
 comphelper::getSomethingImpl<I>(aIdentifier, this)"
276e3ccbdd "loplugin:unocast
 (vclcanvas::RepaintTarget)"

Change-Id: I37c73e3422a5154bf6cb647640d2d3f23db8bc34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145063
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-05 11:45:51 +00:00

204 lines
6.8 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include "calendarImpl.hxx"
#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
#include <unicode/calendar.h>
#include <rtl/ref.hxx>
#include <memory>
namespace i18npool { class NativeNumberSupplierService; }
namespace i18npool {
const sal_uInt8 kDisplayEraForcedLongYear = 0x01;
struct Era {
sal_Int32 year;
sal_Int32 month;
sal_Int32 day;
sal_uInt8 flags;
};
const sal_Int16 FIELD_INDEX_COUNT = css::i18n::CalendarFieldIndex::FIELD_COUNT2;
class Calendar_gregorian : public CalendarImpl
{
public:
// Constructors
Calendar_gregorian();
Calendar_gregorian(const Era *_eraArray);
void init(const Era *_eraArray);
bool setTimeZone( const OUString& rTimeZone );
/**
* Destructor
*/
virtual ~Calendar_gregorian() override;
// Methods in XCalendar
virtual void SAL_CALL loadCalendar(const OUString& uniqueID, const css::lang::Locale& rLocale) override;
virtual void SAL_CALL setDateTime(double fTimeInDays) override;
virtual double SAL_CALL getDateTime() override;
virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) override;
virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) override;
virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) override;
virtual sal_Bool SAL_CALL isValid() override;
virtual css::i18n:: Calendar SAL_CALL getLoadedCalendar() override;
virtual OUString SAL_CALL getUniqueID() override;
virtual sal_Int16 SAL_CALL getFirstDayOfWeek() override;
virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) override;
virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) override;
virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() override;
virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() override;
virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() override;
virtual css::uno::Sequence < css::i18n::CalendarItem > SAL_CALL getMonths() override;
virtual css::uno::Sequence < css::i18n::CalendarItem > SAL_CALL getDays() override;
virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override;
// Methods in XExtendedCalendar
virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) override;
// XCalendar3
virtual css::i18n::Calendar2 SAL_CALL getLoadedCalendar2() override;
virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getDays2() override;
virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getMonths2() override;
virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getGenitiveMonths2() override;
virtual css::uno::Sequence < css::i18n::CalendarItem2 > SAL_CALL getPartitiveMonths2() override;
// XCalendar4
virtual void SAL_CALL setLocalDateTime(double TimeInDays) override;
virtual double SAL_CALL getLocalDateTime() override;
//XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
virtual css::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames() override;
protected:
const Era *eraArray;
std::unique_ptr<icu::Calendar> body;
rtl::Reference<NativeNumberSupplierService> mxNatNum;
const char* cCalendar;
css::lang::Locale aLocale;
sal_uInt32 fieldSet;
sal_Int16 fieldValue[FIELD_INDEX_COUNT];
sal_Int16 fieldSetValue[FIELD_INDEX_COUNT];
/// @throws css::uno::RuntimeException
virtual void mapToGregorian();
/// @throws css::uno::RuntimeException
virtual void mapFromGregorian();
/// @throws css::uno::RuntimeException
void getValue();
/// @throws css::uno::RuntimeException
OUString getDisplayStringImpl( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode, bool bEraMode );
private:
css::i18n::Calendar2 aCalendar;
/** Submit fieldSetValue array according to fieldSet.
@throws css::uno::RuntimeException
*/
void submitFields();
/** Set fields internally.
@throws css::uno::RuntimeException
*/
void setValue();
/** Obtain combined field values for timezone offset (minutes+secondmillis)
in milliseconds and whether fields were set. */
bool getZoneOffset( sal_Int32 & o_nOffset ) const;
/** Obtain combined field values for DST offset (minutes+secondmillis) in
milliseconds and whether fields were set. */
bool getDSTOffset( sal_Int32 & o_nOffset ) const;
/** Used by getZoneOffset() and getDSTOffset(). Parent is
CalendarFieldIndex for offset in minutes, child is CalendarFieldIndex
for offset in milliseconds. */
bool getCombinedOffset( sal_Int32 & o_nOffset, sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) const;
};
class Calendar_hanja final : public Calendar_gregorian
{
public:
// Constructors
Calendar_hanja();
virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override;
};
class Calendar_hanja_yoil final : public Calendar_gregorian
{
public:
// Constructors
Calendar_hanja_yoil();
virtual OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) override;
};
class Calendar_gengou final : public Calendar_gregorian
{
public:
// Constructors
Calendar_gengou();
};
class Calendar_ROC final : public Calendar_gregorian
{
public:
// Constructors
Calendar_ROC();
};
class Calendar_dangi final : public Calendar_gregorian
{
public:
// Constructors
Calendar_dangi();
};
class Calendar_buddhist final : public Calendar_gregorian
{
public:
// Constructors
Calendar_buddhist();
// Methods in XExtendedCalendar
virtual OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) override;
};
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */