Avoid potential negative array index access to cached text.
[LibreOffice.git] / i18npool / inc / defaultnumberingprovider.hxx
blob74f03b7e95e8ab8f55f93368039746c4bd53ab5b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
21 #include <com/sun/star/text/XDefaultNumberingProvider.hpp>
22 #include <com/sun/star/text/XNumberingFormatter.hpp>
23 #include <com/sun/star/text/XNumberingTypeInfo.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <cppuhelper/implbase.hxx>
26 #include <rtl/ref.hxx>
27 #include <map>
29 namespace com::sun::star::container { class XHierarchicalNameAccess; }
30 namespace com::sun::star::uno { class XComponentContext; }
31 namespace i18npool {
32 class TransliterationImpl;
33 class NativeNumberSupplierService;
34 struct Supported_NumberingType;
37 namespace i18npool {
39 class DefaultNumberingProvider final : public cppu::WeakImplHelper
41 css::text::XDefaultNumberingProvider,
42 css::text::XNumberingFormatter,
43 css::text::XNumberingTypeInfo,
44 css::lang::XServiceInfo
47 public:
48 DefaultNumberingProvider(
49 const css::uno::Reference < css::uno::XComponentContext >& rxContext );
50 virtual ~DefaultNumberingProvider() override;
52 //XDefaultNumberingProvider
53 virtual css::uno::Sequence< css::uno::Reference<
54 css::container::XIndexAccess > > SAL_CALL
55 getDefaultOutlineNumberings( const css::lang::Locale& aLocale ) override;
57 virtual css::uno::Sequence< css::uno::Sequence<
58 css::beans::PropertyValue > > SAL_CALL
59 getDefaultContinuousNumberingLevels( const css::lang::Locale& aLocale ) override;
61 //XNumberingFormatter
62 virtual OUString SAL_CALL makeNumberingString(
63 const css::uno::Sequence<
64 css::beans::PropertyValue >& aProperties,
65 const css::lang::Locale& aLocale ) override;
67 //XNumberingTypeInfo
68 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedNumberingTypes( ) override;
69 virtual sal_Int16 SAL_CALL getNumberingType( const OUString& NumberingIdentifier ) override;
70 virtual sal_Bool SAL_CALL hasNumberingType( const OUString& NumberingIdentifier ) override;
71 virtual OUString SAL_CALL getNumberingIdentifier( sal_Int16 NumberingType ) override;
73 //XServiceInfo
74 virtual OUString SAL_CALL getImplementationName() override;
75 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
76 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
77 private:
78 css::uno::Reference < css::uno::XComponentContext > m_xContext;
79 css::uno::Reference < css::container::XHierarchicalNameAccess > xHierarchicalNameAccess;
80 rtl::Reference<TransliterationImpl> translit;
81 rtl::Reference<NativeNumberSupplierService> mxNatNum;
82 std::map<OUString, const Supported_NumberingType*> maSupportedTypesCache;
84 /// @throws css::uno::RuntimeException
85 OUString makeNumberingIdentifier( sal_Int16 index );
86 /// @throws css::uno::RuntimeException
87 bool isScriptFlagEnabled(const OUString& aName );
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */