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