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