LibreOffice Module cui (master)  1
cfgchart.hxx
Go to the documentation of this file.
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 <unotools/configitem.hxx>
24 #include <svl/poolitem.hxx>
25 #include <svx/xtable.hxx>
26 
27 #include <vector>
28 
30 {
31 private:
32  std::vector< XColorEntry > m_aColorEntries;
33 
34 public:
35  // accessors
36  size_t size() const;
37  const XColorEntry & operator[]( size_t _nIndex ) const;
38  Color getColor( size_t _nIndex ) const;
39 
40  // mutators
41  void clear();
42  void append( const XColorEntry & _rEntry );
43  void remove( size_t _nIndex );
44  void replace( size_t _nIndex, const XColorEntry & _rEntry );
45  void useDefault();
46  static OUString getDefaultName(size_t _nIndex);
47 
48  // comparison
49  bool operator==( const SvxChartColorTable & _rOther ) const;
50 };
51 
52 
53 // all options
54 
56 {
57 private:
60 
61  css::uno::Sequence< OUString >
63 
64  const css::uno::Sequence< OUString >& GetPropertyNames() const
65  { return maPropertyNames; }
66  bool RetrieveOptions();
67 
68  virtual void ImplCommit() override;
69 
70 public:
72  virtual ~SvxChartOptions() override;
73 
75  void SetDefaultColors( const SvxChartColorTable& aCol );
76 
77  virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override;
78 };
79 
80 
81 // items
82 // Make Item read-only (no non-const access methods). Two reasons:
83 // (1) Preparation for Item refactor
84 // (2) Dangerous due to SfxItem may not be what you expect (e.g. when
85 // ::Set in SfxItemSet, not your instance may be used there, no control
86 // about what will happen without deep knowledge about SfxItems/SfxItemSets)
88 {
89 public:
90  SvxChartColorTableItem( sal_uInt16 nWhich, const SvxChartColorTable& );
91 
92  virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
93  virtual bool operator==( const SfxPoolItem& ) const override;
94 
95  const SvxChartColorTable & GetColorList() const { return m_aColorTable;}
96 
97 private:
99 };
100 
101 #endif // INCLUDED_CUI_SOURCE_OPTIONS_CFGCHART_HXX
102 
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void ImplCommit() override
Definition: cfgchart.cxx:232
static OUString getDefaultName(size_t _nIndex)
Definition: cfgchart.cxx:114
virtual ~SvxChartOptions() override
Definition: cfgchart.cxx:170
SvxChartColorTable m_aColorTable
Definition: cfgchart.hxx:98
void append(const XColorEntry &_rEntry)
Definition: cfgchart.cxx:65
size_t size() const
Definition: cfgchart.cxx:32
SvxChartColorTable maDefColors
Definition: cfgchart.hxx:58
bool mbIsInitialized
Definition: cfgchart.hxx:59
const css::uno::Sequence< OUString > & GetPropertyNames() const
Definition: cfgchart.hxx:64
const SvxChartColorTable & GetDefaultColors()
Definition: cfgchart.cxx:174
bool operator==(const SvxChartColorTable &_rOther) const
Definition: cfgchart.cxx:138
SvxChartColorTableItem(sal_uInt16 nWhich, const SvxChartColorTable &)
Definition: cfgchart.cxx:263
const XColorEntry & operator[](size_t _nIndex) const
Definition: cfgchart.cxx:37
virtual void Notify(const css::uno::Sequence< OUString > &_rPropertyNames) override
Definition: cfgchart.cxx:255
void replace(size_t _nIndex, const XColorEntry &_rEntry)
Definition: cfgchart.cxx:81
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgchart.cxx:274
const SvxChartColorTable & GetColorList() const
Definition: cfgchart.hxx:95
Color getColor(size_t _nIndex) const
Definition: cfgchart.cxx:48
bool RetrieveOptions()
Definition: cfgchart.cxx:187
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgchart.cxx:269
std::vector< XColorEntry > m_aColorEntries
Definition: cfgchart.hxx:32
void SetDefaultColors(const SvxChartColorTable &aCol)
Definition: cfgchart.cxx:181
css::uno::Sequence< OUString > maPropertyNames
Definition: cfgchart.hxx:62