1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: extcolorcfg.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
31 #define INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
33 #include "svtools/svtdllapi.h"
34 #include <rtl/ustring.hxx>
35 #include <tools/color.hxx>
36 #include <com/sun/star/uno/Sequence.h>
37 #include <svtools/brdcst.hxx>
38 #include <svtools/lstner.hxx>
40 //-----------------------------------------------------------------------------
42 /* -----------------------------22.03.2002 15:36------------------------------
44 ---------------------------------------------------------------------------*/
45 class ExtendedColorConfig_Impl
;
46 class ExtendedColorConfigValue
48 ::rtl::OUString m_sName
;
49 ::rtl::OUString m_sDisplayName
;
51 sal_Int32 m_nDefaultColor
;
53 ExtendedColorConfigValue() : m_nColor(0),m_nDefaultColor(0){}
54 ExtendedColorConfigValue(const ::rtl::OUString
& _sName
55 ,const ::rtl::OUString
& _sDisplayName
57 ,sal_Int32 _nDefaultColor
)
59 ,m_sDisplayName(_sDisplayName
)
61 ,m_nDefaultColor(_nDefaultColor
)
64 inline ::rtl::OUString
getName() const { return m_sName
; }
65 inline ::rtl::OUString
getDisplayName() const { return m_sDisplayName
; }
66 inline sal_Int32
getColor() const { return m_nColor
; }
67 inline sal_Int32
getDefaultColor() const { return m_nDefaultColor
; }
69 inline void setColor(sal_Int32 _nColor
) { m_nColor
= _nColor
; }
71 sal_Bool
operator !=(const ExtendedColorConfigValue
& rCmp
) const
72 { return m_nColor
!= rCmp
.m_nColor
;}
74 /* -----------------------------22.03.2002 15:36------------------------------
76 ---------------------------------------------------------------------------*/
77 class SVT_DLLPUBLIC ExtendedColorConfig
: public SfxBroadcaster
, public SfxListener
79 friend class ExtendedColorConfig_Impl
;
81 static ExtendedColorConfig_Impl
* m_pImpl
;
83 ExtendedColorConfig();
84 ~ExtendedColorConfig();
86 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
88 // get the configured value
89 ExtendedColorConfigValue
GetColorValue(const ::rtl::OUString
& _sComponentName
,const ::rtl::OUString
& _sName
)const;
90 sal_Int32
GetComponentCount() const;
91 ::rtl::OUString
GetComponentName(sal_uInt32 _nPos
) const;
92 ::rtl::OUString
GetComponentDisplayName(const ::rtl::OUString
& _sComponentName
) const;
93 sal_Int32
GetComponentColorCount(const ::rtl::OUString
& _sName
) const;
94 ExtendedColorConfigValue
GetComponentColorConfigValue(const ::rtl::OUString
& _sComponentName
,sal_uInt32 _nPos
) const;
96 /* -----------------------------22.03.2002 15:31------------------------------
98 ---------------------------------------------------------------------------*/
99 class SVT_DLLPUBLIC EditableExtendedColorConfig
101 ExtendedColorConfig_Impl
* m_pImpl
;
102 sal_Bool m_bModified
;
104 EditableExtendedColorConfig();
105 ~EditableExtendedColorConfig();
107 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> GetSchemeNames() const;
108 void DeleteScheme(const ::rtl::OUString
& rScheme
);
109 void AddScheme(const ::rtl::OUString
& rScheme
);
110 sal_Bool
LoadScheme(const ::rtl::OUString
& rScheme
);
111 const ::rtl::OUString
& GetCurrentSchemeName()const;
112 void SetCurrentSchemeName(const ::rtl::OUString
& rScheme
);
114 ExtendedColorConfigValue
GetColorValue(const ::rtl::OUString
& _sComponentName
,const ::rtl::OUString
& _sName
)const;
115 sal_Int32
GetComponentCount() const;
116 ::rtl::OUString
GetComponentName(sal_uInt32 _nPos
) const;
117 ::rtl::OUString
GetComponentDisplayName(const ::rtl::OUString
& _sComponentName
) const;
118 sal_Int32
GetComponentColorCount(const ::rtl::OUString
& _sName
) const;
119 ExtendedColorConfigValue
GetComponentColorConfigValue(const ::rtl::OUString
& _sName
,sal_uInt32 _nPos
) const;
120 void SetColorValue(const ::rtl::OUString
& _sComponentName
, const ExtendedColorConfigValue
& rValue
);
122 void ClearModified(){m_bModified
= sal_False
;}
123 sal_Bool
IsModified()const{return m_bModified
;}
126 void DisableBroadcast();
127 void EnableBroadcast();