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 28 #ifndef _SVX_CFGCHART_HXX 29 #define _SVX_CFGCHART_HXX 30 31 // header for TYPEINFO 32 #include <tools/rtti.hxx> 33 // header for ConfigItem 34 #include <unotools/configitem.hxx> 35 // header for SfxPoolItem 36 #include <svl/poolitem.hxx> 37 // header for XColorEntry 38 #include <svx/xtable.hxx> 39 40 #include <vector> 41 42 class SvxChartColorTable 43 { 44 private: 45 ::std::vector< XColorEntry > m_aColorEntries; 46 47 public: 48 SvxChartColorTable(); 49 explicit SvxChartColorTable( const SvxChartColorTable & _rSource ); 50 51 // accessors 52 size_t size() const; 53 const XColorEntry & operator[]( size_t _nIndex ) const; 54 ColorData getColorData( size_t _nIndex ) const; 55 56 // mutators 57 void clear(); 58 void append( const XColorEntry & _rEntry ); 59 void replace( size_t _nIndex, const XColorEntry & _rEntry ); 60 void useDefault(); 61 62 // comparison 63 bool operator==( const SvxChartColorTable & _rOther ) const; 64 }; 65 66 // ==================== 67 // all options 68 // ==================== 69 class SvxChartOptions : public ::utl::ConfigItem 70 { 71 private: 72 SvxChartColorTable maDefColors; 73 sal_Bool mbIsInitialized; 74 75 ::com::sun::star::uno::Sequence< ::rtl::OUString > 76 maPropertyNames; 77 78 inline ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPropertyNames() const 79 { return maPropertyNames; } 80 sal_Bool RetrieveOptions(); 81 82 public: 83 SvxChartOptions(); 84 virtual ~SvxChartOptions(); 85 86 const SvxChartColorTable& GetDefaultColors(); 87 void SetDefaultColors( const SvxChartColorTable& aCol ); 88 89 virtual void Commit(); 90 virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); 91 }; 92 93 // ==================== 94 // items 95 // ==================== 96 class SvxChartColorTableItem : public SfxPoolItem 97 { 98 public: 99 TYPEINFO(); 100 SvxChartColorTableItem( sal_uInt16 nWhich, const SvxChartColorTable& ); 101 SvxChartColorTableItem( const SvxChartColorTableItem& ); 102 103 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 104 virtual int operator==( const SfxPoolItem& ) const; 105 void SetOptions( SvxChartOptions* pOpts ) const; 106 107 const SvxChartColorTable & GetColorTable() const ; 108 SvxChartColorTable & GetColorTable(); 109 void ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry ); 110 111 private: 112 SvxChartColorTable m_aColorTable; 113 }; 114 115 #endif // _SVX_CFGCHART_HXX 116 117