1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef CHART2_CONFIG_COLOR_SCHEME_HXX 28 #define CHART2_CONFIG_COLOR_SCHEME_HXX 29 30 #include "ServiceMacros.hxx" 31 #include "ConfigItemListener.hxx" 32 #include "charttoolsdllapi.hxx" 33 #include <cppuhelper/implbase2.hxx> 34 #include <comphelper/uno3.hxx> 35 #include <com/sun/star/chart2/XColorScheme.hpp> 36 #include <com/sun/star/lang/XServiceInfo.hpp> 37 #include <com/sun/star/uno/XComponentContext.hpp> 38 39 #include <memory> 40 41 42 namespace chart 43 { 44 45 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme > createConfigColorScheme( 46 const ::com::sun::star::uno::Reference< 47 ::com::sun::star::uno::XComponentContext > & xContext ); 48 49 namespace impl 50 { 51 class ChartConfigItem; 52 } 53 54 class ConfigColorScheme : 55 public ConfigItemListener, 56 public ::cppu::WeakImplHelper2< 57 ::com::sun::star::chart2::XColorScheme, 58 ::com::sun::star::lang::XServiceInfo > 59 { 60 public: 61 explicit ConfigColorScheme( 62 const ::com::sun::star::uno::Reference< 63 ::com::sun::star::uno::XComponentContext > & xContext ); 64 SAL_DLLPRIVATE virtual ~ConfigColorScheme(); 65 66 /// establish methods for factory instatiation 67 APPHELPER_SERVICE_FACTORY_HELPER( ConfigColorScheme ) 68 /// declare XServiceInfo methods 69 APPHELPER_XSERVICEINFO_DECL() 70 71 protected: 72 // ____ XColorScheme ____ 73 SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getColorByIndex( ::sal_Int32 nIndex ) 74 throw (::com::sun::star::uno::RuntimeException); 75 76 // ____ ConfigItemListener ____ 77 SAL_DLLPRIVATE virtual void notify( const ::rtl::OUString & rPropertyName ); 78 79 private: 80 SAL_DLLPRIVATE void retrieveConfigColors(); 81 82 // member variables 83 ::com::sun::star::uno::Reference< 84 ::com::sun::star::uno::XComponentContext > m_xContext; 85 ::std::auto_ptr< impl::ChartConfigItem > m_apChartConfigItem; 86 mutable ::com::sun::star::uno::Sequence< sal_Int64 > m_aColorSequence; 87 mutable sal_Int32 m_nNumberOfColors; 88 bool m_bNeedsUpdate; 89 }; 90 91 } // namespace chart 92 93 // CHART2_CONFIG_COLOR_SCHEME_HXX 94 #endif 95