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