Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
29 : : #define INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
30 : :
31 : : #include "svtools/svtdllapi.h"
32 : : #include <rtl/ustring.hxx>
33 : : #include <tools/color.hxx>
34 : : #include <com/sun/star/uno/Sequence.h>
35 : : #include <svl/brdcst.hxx>
36 : : #include <svl/lstner.hxx>
37 : :
38 : : //-----------------------------------------------------------------------------
39 : : namespace svtools{
40 : :
41 : : class ExtendedColorConfig_Impl;
42 : 0 : class ExtendedColorConfigValue
43 : : {
44 : : ::rtl::OUString m_sName;
45 : : ::rtl::OUString m_sDisplayName;
46 : : sal_Int32 m_nColor;
47 : : sal_Int32 m_nDefaultColor;
48 : : public:
49 : 0 : ExtendedColorConfigValue() : m_nColor(0),m_nDefaultColor(0){}
50 : 0 : ExtendedColorConfigValue(const ::rtl::OUString& _sName
51 : : ,const ::rtl::OUString& _sDisplayName
52 : : ,sal_Int32 _nColor
53 : : ,sal_Int32 _nDefaultColor)
54 : : : m_sName(_sName)
55 : : ,m_sDisplayName(_sDisplayName)
56 : : ,m_nColor(_nColor)
57 : 0 : ,m_nDefaultColor(_nDefaultColor)
58 : 0 : {}
59 : :
60 : 0 : inline ::rtl::OUString getName() const { return m_sName; }
61 : 0 : inline ::rtl::OUString getDisplayName() const { return m_sDisplayName; }
62 : 0 : inline sal_Int32 getColor() const { return m_nColor; }
63 : 0 : inline sal_Int32 getDefaultColor() const { return m_nDefaultColor; }
64 : :
65 : 0 : inline void setColor(sal_Int32 _nColor) { m_nColor = _nColor; }
66 : :
67 : : sal_Bool operator !=(const ExtendedColorConfigValue& rCmp) const
68 : : { return m_nColor != rCmp.m_nColor;}
69 : : };
70 : :
71 : : class SVT_DLLPUBLIC ExtendedColorConfig : public SfxBroadcaster, public SfxListener
72 : : {
73 : : friend class ExtendedColorConfig_Impl;
74 : : private:
75 : : static ExtendedColorConfig_Impl* m_pImpl;
76 : : public:
77 : : ExtendedColorConfig();
78 : : ~ExtendedColorConfig();
79 : :
80 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
81 : :
82 : : // get the configured value
83 : : ExtendedColorConfigValue GetColorValue(const ::rtl::OUString& _sComponentName,const ::rtl::OUString& _sName)const;
84 : : sal_Int32 GetComponentCount() const;
85 : : ::rtl::OUString GetComponentName(sal_uInt32 _nPos) const;
86 : : ::rtl::OUString GetComponentDisplayName(const ::rtl::OUString& _sComponentName) const;
87 : : sal_Int32 GetComponentColorCount(const ::rtl::OUString& _sName) const;
88 : : ExtendedColorConfigValue GetComponentColorConfigValue(const ::rtl::OUString& _sComponentName,sal_uInt32 _nPos) const;
89 : : };
90 : :
91 : : class SVT_DLLPUBLIC EditableExtendedColorConfig
92 : : {
93 : : ExtendedColorConfig_Impl* m_pImpl;
94 : : sal_Bool m_bModified;
95 : : public:
96 : : EditableExtendedColorConfig();
97 : : ~EditableExtendedColorConfig();
98 : :
99 : : void DeleteScheme(const ::rtl::OUString& rScheme );
100 : : void AddScheme(const ::rtl::OUString& rScheme );
101 : : sal_Bool LoadScheme(const ::rtl::OUString& rScheme );
102 : : void SetCurrentSchemeName(const ::rtl::OUString& rScheme);
103 : :
104 : : sal_Int32 GetComponentCount() const;
105 : : ::rtl::OUString GetComponentName(sal_uInt32 _nPos) const;
106 : : sal_Int32 GetComponentColorCount(const ::rtl::OUString& _sName) const;
107 : : ExtendedColorConfigValue GetComponentColorConfigValue(const ::rtl::OUString& _sName,sal_uInt32 _nPos) const;
108 : : void SetColorValue(const ::rtl::OUString& _sComponentName, const ExtendedColorConfigValue& rValue);
109 : : void SetModified();
110 : 0 : void ClearModified(){m_bModified = sal_False;}
111 : 0 : sal_Bool IsModified()const{return m_bModified;}
112 : : void Commit();
113 : :
114 : : void DisableBroadcast();
115 : : void EnableBroadcast();
116 : : };
117 : : }//namespace svtools
118 : : #endif
119 : :
120 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|