1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef CHART2_CONFIG_COLOR_SCHEME_HXX 24 #define CHART2_CONFIG_COLOR_SCHEME_HXX 25 26 #include "ServiceMacros.hxx" 27 #include "ConfigItemListener.hxx" 28 #include "charttoolsdllapi.hxx" 29 #include <cppuhelper/implbase2.hxx> 30 #include <comphelper/uno3.hxx> 31 #include <com/sun/star/chart2/XColorScheme.hpp> 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 #include <com/sun/star/uno/XComponentContext.hpp> 34 35 #include <memory> 36 37 38 namespace chart 39 { 40 41 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme > createConfigColorScheme( 42 const ::com::sun::star::uno::Reference< 43 ::com::sun::star::uno::XComponentContext > & xContext ); 44 45 namespace impl 46 { 47 class ChartConfigItem; 48 } 49 50 class ConfigColorScheme : 51 public ConfigItemListener, 52 public ::cppu::WeakImplHelper2< 53 ::com::sun::star::chart2::XColorScheme, 54 ::com::sun::star::lang::XServiceInfo > 55 { 56 public: 57 explicit ConfigColorScheme( 58 const ::com::sun::star::uno::Reference< 59 ::com::sun::star::uno::XComponentContext > & xContext ); 60 SAL_DLLPRIVATE virtual ~ConfigColorScheme(); 61 62 /// establish methods for factory instatiation 63 APPHELPER_SERVICE_FACTORY_HELPER( ConfigColorScheme ) 64 /// declare XServiceInfo methods 65 APPHELPER_XSERVICEINFO_DECL() 66 67 protected: 68 // ____ XColorScheme ____ 69 SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getColorByIndex( ::sal_Int32 nIndex ) 70 throw (::com::sun::star::uno::RuntimeException); 71 72 // ____ ConfigItemListener ____ 73 SAL_DLLPRIVATE virtual void notify( const ::rtl::OUString & rPropertyName ); 74 75 private: 76 SAL_DLLPRIVATE void retrieveConfigColors(); 77 78 // member variables 79 ::com::sun::star::uno::Reference< 80 ::com::sun::star::uno::XComponentContext > m_xContext; 81 ::std::auto_ptr< impl::ChartConfigItem > m_apChartConfigItem; 82 mutable ::com::sun::star::uno::Sequence< sal_Int64 > m_aColorSequence; 83 mutable sal_Int32 m_nNumberOfColors; 84 bool m_bNeedsUpdate; 85 }; 86 87 } // namespace chart 88 89 // CHART2_CONFIG_COLOR_SCHEME_HXX 90 #endif 91