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 : #ifndef INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
20 : #define INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
21 :
22 : #include <svtools/svtdllapi.h>
23 : #include <rtl/ustring.hxx>
24 : #include <tools/color.hxx>
25 : #include <com/sun/star/uno/Sequence.h>
26 : #include <svl/SfxBroadcaster.hxx>
27 : #include <svl/lstner.hxx>
28 :
29 :
30 : namespace svtools {
31 :
32 : class ExtendedColorConfig_Impl;
33 :
34 0 : class ExtendedColorConfigValue
35 : {
36 : OUString m_sName;
37 : OUString m_sDisplayName;
38 : sal_Int32 m_nColor;
39 : sal_Int32 m_nDefaultColor;
40 : public:
41 0 : ExtendedColorConfigValue() : m_nColor(0),m_nDefaultColor(0){}
42 0 : ExtendedColorConfigValue(const OUString& _sName
43 : ,const OUString& _sDisplayName
44 : ,sal_Int32 _nColor
45 : ,sal_Int32 _nDefaultColor)
46 : : m_sName(_sName)
47 : ,m_sDisplayName(_sDisplayName)
48 : ,m_nColor(_nColor)
49 0 : ,m_nDefaultColor(_nDefaultColor)
50 0 : {}
51 :
52 0 : inline OUString getName() const { return m_sName; }
53 0 : inline OUString getDisplayName() const { return m_sDisplayName; }
54 0 : inline sal_Int32 getColor() const { return m_nColor; }
55 0 : inline sal_Int32 getDefaultColor() const { return m_nDefaultColor; }
56 :
57 0 : inline void setColor(sal_Int32 _nColor) { m_nColor = _nColor; }
58 :
59 : bool operator !=(const ExtendedColorConfigValue& rCmp) const
60 : { return m_nColor != rCmp.m_nColor;}
61 : };
62 :
63 : class SVT_DLLPUBLIC ExtendedColorConfig : public SfxBroadcaster, public SfxListener
64 : {
65 : friend class ExtendedColorConfig_Impl;
66 : private:
67 : static ExtendedColorConfig_Impl* m_pImpl;
68 : public:
69 : ExtendedColorConfig();
70 : virtual ~ExtendedColorConfig();
71 :
72 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
73 :
74 : // get the configured value
75 : ExtendedColorConfigValue GetColorValue(const OUString& _sComponentName,const OUString& _sName)const;
76 : sal_Int32 GetComponentCount() const;
77 : OUString GetComponentName(sal_uInt32 _nPos) const;
78 : OUString GetComponentDisplayName(const OUString& _sComponentName) const;
79 : sal_Int32 GetComponentColorCount(const OUString& _sName) const;
80 : ExtendedColorConfigValue GetComponentColorConfigValue(const OUString& _sComponentName,sal_uInt32 _nPos) const;
81 : };
82 :
83 : class SVT_DLLPUBLIC EditableExtendedColorConfig
84 : {
85 : ExtendedColorConfig_Impl* m_pImpl;
86 : bool m_bModified;
87 : public:
88 : EditableExtendedColorConfig();
89 : ~EditableExtendedColorConfig();
90 :
91 : void DeleteScheme(const OUString& rScheme );
92 : void AddScheme(const OUString& rScheme );
93 : bool LoadScheme(const OUString& rScheme );
94 : void SetCurrentSchemeName(const OUString& rScheme);
95 :
96 : sal_Int32 GetComponentCount() const;
97 : OUString GetComponentName(sal_uInt32 _nPos) const;
98 : sal_Int32 GetComponentColorCount(const OUString& _sName) const;
99 : ExtendedColorConfigValue GetComponentColorConfigValue(const OUString& _sName,sal_uInt32 _nPos) const;
100 : void SetColorValue(const OUString& _sComponentName, const ExtendedColorConfigValue& rValue);
101 : void SetModified();
102 0 : void ClearModified() {m_bModified = false;}
103 0 : bool IsModified() const {return m_bModified;}
104 : void Commit();
105 :
106 : void DisableBroadcast();
107 : void EnableBroadcast();
108 : };
109 : }//namespace svtools
110 : #endif
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|