1*c4eee24dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c4eee24dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c4eee24dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c4eee24dSAndrew Rist * distributed with this work for additional information 6*c4eee24dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c4eee24dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c4eee24dSAndrew Rist * "License"); you may not use this file except in compliance 9*c4eee24dSAndrew Rist * with the License. You may obtain a copy of the License at 10*c4eee24dSAndrew Rist * 11*c4eee24dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*c4eee24dSAndrew Rist * 13*c4eee24dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c4eee24dSAndrew Rist * software distributed under the License is distributed on an 15*c4eee24dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c4eee24dSAndrew Rist * KIND, either express or implied. See the License for the 17*c4eee24dSAndrew Rist * specific language governing permissions and limitations 18*c4eee24dSAndrew Rist * under the License. 19*c4eee24dSAndrew Rist * 20*c4eee24dSAndrew Rist *************************************************************/ 21*c4eee24dSAndrew Rist 22*c4eee24dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SVX_CFGCHART_HXX 25cdf0e10cSrcweir #define _SVX_CFGCHART_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir // header for TYPEINFO 28cdf0e10cSrcweir #include <tools/rtti.hxx> 29cdf0e10cSrcweir // header for ConfigItem 30cdf0e10cSrcweir #include <unotools/configitem.hxx> 31cdf0e10cSrcweir // header for SfxPoolItem 32cdf0e10cSrcweir #include <svl/poolitem.hxx> 33cdf0e10cSrcweir // header for XColorEntry 34cdf0e10cSrcweir #include <svx/xtable.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <vector> 37cdf0e10cSrcweir 38cdf0e10cSrcweir class SvxChartColorTable 39cdf0e10cSrcweir { 40cdf0e10cSrcweir private: 41cdf0e10cSrcweir ::std::vector< XColorEntry > m_aColorEntries; 42cdf0e10cSrcweir 43cdf0e10cSrcweir public: 44cdf0e10cSrcweir SvxChartColorTable(); 45cdf0e10cSrcweir explicit SvxChartColorTable( const SvxChartColorTable & _rSource ); 46cdf0e10cSrcweir 47cdf0e10cSrcweir // accessors 48cdf0e10cSrcweir size_t size() const; 49cdf0e10cSrcweir const XColorEntry & operator[]( size_t _nIndex ) const; 50cdf0e10cSrcweir ColorData getColorData( size_t _nIndex ) const; 51cdf0e10cSrcweir 52cdf0e10cSrcweir // mutators 53cdf0e10cSrcweir void clear(); 54cdf0e10cSrcweir void append( const XColorEntry & _rEntry ); 55cdf0e10cSrcweir void replace( size_t _nIndex, const XColorEntry & _rEntry ); 56cdf0e10cSrcweir void useDefault(); 57cdf0e10cSrcweir 58cdf0e10cSrcweir // comparison 59cdf0e10cSrcweir bool operator==( const SvxChartColorTable & _rOther ) const; 60cdf0e10cSrcweir }; 61cdf0e10cSrcweir 62cdf0e10cSrcweir // ==================== 63cdf0e10cSrcweir // all options 64cdf0e10cSrcweir // ==================== 65cdf0e10cSrcweir class SvxChartOptions : public ::utl::ConfigItem 66cdf0e10cSrcweir { 67cdf0e10cSrcweir private: 68cdf0e10cSrcweir SvxChartColorTable maDefColors; 69cdf0e10cSrcweir sal_Bool mbIsInitialized; 70cdf0e10cSrcweir 71cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > 72cdf0e10cSrcweir maPropertyNames; 73cdf0e10cSrcweir GetPropertyNames() const74cdf0e10cSrcweir inline ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPropertyNames() const 75cdf0e10cSrcweir { return maPropertyNames; } 76cdf0e10cSrcweir sal_Bool RetrieveOptions(); 77cdf0e10cSrcweir 78cdf0e10cSrcweir public: 79cdf0e10cSrcweir SvxChartOptions(); 80cdf0e10cSrcweir virtual ~SvxChartOptions(); 81cdf0e10cSrcweir 82cdf0e10cSrcweir const SvxChartColorTable& GetDefaultColors(); 83cdf0e10cSrcweir void SetDefaultColors( const SvxChartColorTable& aCol ); 84cdf0e10cSrcweir 85cdf0e10cSrcweir virtual void Commit(); 86cdf0e10cSrcweir virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); 87cdf0e10cSrcweir }; 88cdf0e10cSrcweir 89cdf0e10cSrcweir // ==================== 90cdf0e10cSrcweir // items 91cdf0e10cSrcweir // ==================== 92cdf0e10cSrcweir class SvxChartColorTableItem : public SfxPoolItem 93cdf0e10cSrcweir { 94cdf0e10cSrcweir public: 95cdf0e10cSrcweir TYPEINFO(); 96cdf0e10cSrcweir SvxChartColorTableItem( sal_uInt16 nWhich, const SvxChartColorTable& ); 97cdf0e10cSrcweir SvxChartColorTableItem( const SvxChartColorTableItem& ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 100cdf0e10cSrcweir virtual int operator==( const SfxPoolItem& ) const; 101cdf0e10cSrcweir void SetOptions( SvxChartOptions* pOpts ) const; 102cdf0e10cSrcweir 103cdf0e10cSrcweir const SvxChartColorTable & GetColorTable() const ; 104cdf0e10cSrcweir SvxChartColorTable & GetColorTable(); 105cdf0e10cSrcweir void ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir private: 108cdf0e10cSrcweir SvxChartColorTable m_aColorTable; 109cdf0e10cSrcweir }; 110cdf0e10cSrcweir 111cdf0e10cSrcweir #endif // _SVX_CFGCHART_HXX 112cdf0e10cSrcweir 113