Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_CUI_SOURCE_OPTIONS_CFGCHART_HXX
21 : #define INCLUDED_CUI_SOURCE_OPTIONS_CFGCHART_HXX
22 :
23 : #include <tools/rtti.hxx>
24 : #include <unotools/configitem.hxx>
25 : #include <svl/poolitem.hxx>
26 : #include <svx/xtable.hxx>
27 :
28 : #include <vector>
29 :
30 0 : class SvxChartColorTable
31 : {
32 : private:
33 : ::std::vector< XColorEntry > m_aColorEntries;
34 : int nNextElementNumber;
35 : OUString sDefaultNamePrefix;
36 : OUString sDefaultNamePostfix;
37 :
38 : public:
39 : SvxChartColorTable();
40 : explicit SvxChartColorTable( const SvxChartColorTable & _rSource );
41 :
42 : // accessors
43 : size_t size() const;
44 : const XColorEntry & operator[]( size_t _nIndex ) const;
45 : ColorData getColorData( size_t _nIndex ) const;
46 :
47 : // mutators
48 : void clear();
49 : void append( const XColorEntry & _rEntry );
50 : void remove( size_t _nIndex );
51 : void replace( size_t _nIndex, const XColorEntry & _rEntry );
52 : void useDefault();
53 : OUString getDefaultName(size_t _nIndex);
54 :
55 : // comparison
56 : bool operator==( const SvxChartColorTable & _rOther ) const;
57 : };
58 :
59 :
60 : // all options
61 :
62 : class SvxChartOptions : public ::utl::ConfigItem
63 : {
64 : private:
65 : SvxChartColorTable maDefColors;
66 : bool mbIsInitialized;
67 :
68 : ::com::sun::star::uno::Sequence< OUString >
69 : maPropertyNames;
70 :
71 0 : inline ::com::sun::star::uno::Sequence< OUString > GetPropertyNames() const
72 0 : { return maPropertyNames; }
73 : bool RetrieveOptions();
74 :
75 : public:
76 : SvxChartOptions();
77 : virtual ~SvxChartOptions();
78 :
79 : const SvxChartColorTable& GetDefaultColors();
80 : void SetDefaultColors( const SvxChartColorTable& aCol );
81 :
82 : virtual void Commit() SAL_OVERRIDE;
83 : virtual void Notify( const com::sun::star::uno::Sequence< OUString >& _rPropertyNames) SAL_OVERRIDE;
84 : };
85 :
86 :
87 : // items
88 :
89 0 : class SvxChartColorTableItem : public SfxPoolItem
90 : {
91 : public:
92 : TYPEINFO_OVERRIDE();
93 : SvxChartColorTableItem( sal_uInt16 nWhich, const SvxChartColorTable& );
94 : SvxChartColorTableItem( const SvxChartColorTableItem& );
95 :
96 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
97 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
98 : void SetOptions( SvxChartOptions* pOpts ) const;
99 :
100 0 : const SvxChartColorTable & GetColorList() const { return m_aColorTable;}
101 0 : SvxChartColorTable & GetColorList() { return m_aColorTable;}
102 : void ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry );
103 :
104 : private:
105 : SvxChartColorTable m_aColorTable;
106 : };
107 :
108 : #endif // INCLUDED_CUI_SOURCE_OPTIONS_CFGCHART_HXX
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|