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 : virtual void ImplCommit() SAL_OVERRIDE;
76 :
77 : public:
78 : SvxChartOptions();
79 : virtual ~SvxChartOptions();
80 :
81 : const SvxChartColorTable& GetDefaultColors();
82 : void SetDefaultColors( const SvxChartColorTable& aCol );
83 :
84 : virtual void Notify( const com::sun::star::uno::Sequence< OUString >& _rPropertyNames) SAL_OVERRIDE;
85 : };
86 :
87 :
88 : // items
89 :
90 0 : class SvxChartColorTableItem : public SfxPoolItem
91 : {
92 : public:
93 : TYPEINFO_OVERRIDE();
94 : SvxChartColorTableItem( sal_uInt16 nWhich, const SvxChartColorTable& );
95 : SvxChartColorTableItem( const SvxChartColorTableItem& );
96 :
97 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
98 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
99 : void SetOptions( SvxChartOptions* pOpts ) const;
100 :
101 0 : const SvxChartColorTable & GetColorList() const { return m_aColorTable;}
102 0 : SvxChartColorTable & GetColorList() { return m_aColorTable;}
103 : void ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry );
104 :
105 : private:
106 : SvxChartColorTable m_aColorTable;
107 : };
108 :
109 : #endif // INCLUDED_CUI_SOURCE_OPTIONS_CFGCHART_HXX
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|