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_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX
22 #include "ConfigItemListener.hxx"
23 #include "charttoolsdllapi.hxx"
24 #include <cppuhelper/implbase2.hxx>
25 #include <comphelper/uno3.hxx>
26 #include <com/sun/star/chart2/XColorScheme.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
35 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XColorScheme
> createConfigColorScheme(
36 const ::com::sun::star::uno::Reference
<
37 ::com::sun::star::uno::XComponentContext
> & xContext
);
41 class ChartConfigItem
;
44 class ConfigColorScheme
:
45 public ConfigItemListener
,
46 public ::cppu::WeakImplHelper2
<
47 ::com::sun::star::chart2::XColorScheme
,
48 ::com::sun::star::lang::XServiceInfo
>
51 explicit ConfigColorScheme(
52 const ::com::sun::star::uno::Reference
<
53 ::com::sun::star::uno::XComponentContext
> & xContext
);
54 SAL_DLLPRIVATE
virtual ~ConfigColorScheme();
56 /// establish methods for factory instatiation
57 static css::uno::Reference
< css::uno::XInterface
> SAL_CALL
create( css::uno::Reference
< css::uno::XComponentContext
> const & xContext
)
58 throw(css::uno::Exception
)
60 return (::cppu::OWeakObject
*)new ConfigColorScheme( xContext
);
62 /// declare XServiceInfo methods
63 virtual OUString SAL_CALL
getImplementationName()
64 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
65 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
66 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
67 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
68 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
70 static OUString
getImplementationName_Static();
71 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
74 // ____ XColorScheme ____
75 SAL_DLLPRIVATE
virtual ::sal_Int32 SAL_CALL
getColorByIndex( ::sal_Int32 nIndex
)
76 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
78 // ____ ConfigItemListener ____
79 SAL_DLLPRIVATE
virtual void notify( const OUString
& rPropertyName
) SAL_OVERRIDE
;
82 SAL_DLLPRIVATE
void retrieveConfigColors();
85 ::com::sun::star::uno::Reference
<
86 ::com::sun::star::uno::XComponentContext
> m_xContext
;
87 ::std::unique_ptr
< impl::ChartConfigItem
> m_apChartConfigItem
;
88 mutable ::com::sun::star::uno::Sequence
< sal_Int64
> m_aColorSequence
;
89 mutable sal_Int32 m_nNumberOfColors
;
95 // INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */