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