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