1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
20 #define INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
22 #include <svtools/svtdllapi.h>
23 #include <rtl/ustring.hxx>
24 #include <svl/SfxBroadcaster.hxx>
25 #include <svl/lstner.hxx>
26 #include <tools/color.hxx>
32 class ExtendedColorConfig_Impl
;
34 class ExtendedColorConfigValue
37 OUString m_sDisplayName
;
39 Color m_nDefaultColor
;
41 ExtendedColorConfigValue() : m_nColor(0),m_nDefaultColor(0){}
42 ExtendedColorConfigValue(const OUString
& _sName
43 ,const OUString
& _sDisplayName
45 ,Color _nDefaultColor
)
47 ,m_sDisplayName(_sDisplayName
)
49 ,m_nDefaultColor(_nDefaultColor
)
52 const OUString
& getName() const { return m_sName
; }
53 const OUString
& getDisplayName() const { return m_sDisplayName
; }
54 Color
getColor() const { return m_nColor
; }
55 Color
getDefaultColor() const { return m_nDefaultColor
; }
57 void setColor(Color _nColor
) { m_nColor
= _nColor
; }
60 class SVT_DLLPUBLIC ExtendedColorConfig
: public SfxBroadcaster
, public SfxListener
62 friend class ExtendedColorConfig_Impl
;
64 static ExtendedColorConfig_Impl
* m_pImpl
;
66 ExtendedColorConfig();
67 virtual ~ExtendedColorConfig() override
;
69 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
71 // get the configured value
72 ExtendedColorConfigValue
GetColorValue(const OUString
& _sComponentName
,const OUString
& _sName
)const;
73 sal_Int32
GetComponentCount() const;
74 OUString
GetComponentName(sal_uInt32 _nPos
) const;
75 OUString
GetComponentDisplayName(const OUString
& _sComponentName
) const;
76 sal_Int32
GetComponentColorCount(const OUString
& _sName
) const;
77 ExtendedColorConfigValue
GetComponentColorConfigValue(const OUString
& _sComponentName
,sal_uInt32 _nPos
) const;
80 class SVT_DLLPUBLIC EditableExtendedColorConfig
82 std::unique_ptr
<ExtendedColorConfig_Impl
> m_pImpl
;
85 EditableExtendedColorConfig();
86 ~EditableExtendedColorConfig();
88 void DeleteScheme(const OUString
& rScheme
);
89 void AddScheme(const OUString
& rScheme
);
90 void LoadScheme(const OUString
& rScheme
);
91 void SetCurrentSchemeName(const OUString
& rScheme
);
93 sal_Int32
GetComponentCount() const;
94 OUString
GetComponentName(sal_uInt32 _nPos
) const;
95 sal_Int32
GetComponentColorCount(const OUString
& _sName
) const;
96 ExtendedColorConfigValue
GetComponentColorConfigValue(const OUString
& _sName
,sal_uInt32 _nPos
) const;
97 void SetColorValue(const OUString
& _sComponentName
, const ExtendedColorConfigValue
& rValue
);
99 void ClearModified() {m_bModified
= false;}
100 bool IsModified() const {return m_bModified
;}
103 void DisableBroadcast();
104 void EnableBroadcast();
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */