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 INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX
20 : #define INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX
21 :
22 : #include "ServiceMacros.hxx"
23 : #include "ConfigItemListener.hxx"
24 : #include "charttoolsdllapi.hxx"
25 : #include <cppuhelper/implbase2.hxx>
26 : #include <comphelper/uno3.hxx>
27 : #include <com/sun/star/chart2/XColorScheme.hpp>
28 : #include <com/sun/star/lang/XServiceInfo.hpp>
29 : #include <com/sun/star/uno/XComponentContext.hpp>
30 :
31 : #include <memory>
32 :
33 : namespace chart
34 : {
35 :
36 : OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme > createConfigColorScheme(
37 : const ::com::sun::star::uno::Reference<
38 : ::com::sun::star::uno::XComponentContext > & xContext );
39 :
40 : namespace impl
41 : {
42 : class ChartConfigItem;
43 : }
44 :
45 : class ConfigColorScheme :
46 : public ConfigItemListener,
47 : public ::cppu::WeakImplHelper2<
48 : ::com::sun::star::chart2::XColorScheme,
49 : ::com::sun::star::lang::XServiceInfo >
50 : {
51 : public:
52 : explicit ConfigColorScheme(
53 : const ::com::sun::star::uno::Reference<
54 : ::com::sun::star::uno::XComponentContext > & xContext );
55 : SAL_DLLPRIVATE virtual ~ConfigColorScheme();
56 :
57 : /// establish methods for factory instatiation
58 0 : APPHELPER_SERVICE_FACTORY_HELPER( ConfigColorScheme )
59 : /// declare XServiceInfo methods
60 : APPHELPER_XSERVICEINFO_DECL()
61 :
62 : protected:
63 : // ____ XColorScheme ____
64 : SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getColorByIndex( ::sal_Int32 nIndex )
65 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
66 :
67 : // ____ ConfigItemListener ____
68 : SAL_DLLPRIVATE virtual void notify( const OUString & rPropertyName ) SAL_OVERRIDE;
69 :
70 : private:
71 : SAL_DLLPRIVATE void retrieveConfigColors();
72 :
73 : // member variables
74 : ::com::sun::star::uno::Reference<
75 : ::com::sun::star::uno::XComponentContext > m_xContext;
76 : ::std::auto_ptr< impl::ChartConfigItem > m_apChartConfigItem;
77 : mutable ::com::sun::star::uno::Sequence< sal_Int64 > m_aColorSequence;
78 : mutable sal_Int32 m_nNumberOfColors;
79 : bool m_bNeedsUpdate;
80 : };
81 :
82 : } // namespace chart
83 :
84 : // INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX
85 : #endif
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|