diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2007-11-20 18:16:30 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2007-11-20 18:16:30 +0000 |
commit | 13537fcab53ba3e0a3d70738eb2c5a75bd7cc205 (patch) | |
tree | 4916833a6ad375ce9a1edaf2667dbffd0ef2f6f1 /svtools | |
parent | INTEGRATION: CWS beppec56pdflinks (1.49.18); FILE MERGED (diff) | |
download | core-13537fcab53ba3e0a3d70738eb2c5a75bd7cc205.tar.gz core-13537fcab53ba3e0a3d70738eb2c5a75bd7cc205.zip |
INTEGRATION: CWS reportdesign01 (1.3.84); FILE MERGED
2007/09/25 10:01:21 oj 1.3.84.1: new default values
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/extcolorcfg.hxx | 31 | ||||
-rw-r--r-- | svtools/source/config/extcolorcfg.cxx | 62 |
2 files changed, 58 insertions, 35 deletions
diff --git a/svtools/inc/extcolorcfg.hxx b/svtools/inc/extcolorcfg.hxx index a37a0e1f83db..b1d0b94d213d 100644 --- a/svtools/inc/extcolorcfg.hxx +++ b/svtools/inc/extcolorcfg.hxx @@ -4,9 +4,9 @@ * * $RCSfile: extcolorcfg.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: rt $ $Date: 2007-07-09 07:13:40 $ + * last change: $Author: ihi $ $Date: 2007-11-20 19:16:18 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,14 +61,33 @@ namespace svtools{ ---------------------------------------------------------------------------*/ class ExtendedColorConfig_Impl; -struct ExtendedColorConfigValue +class ExtendedColorConfigValue { ::rtl::OUString m_sName; ::rtl::OUString m_sDisplayName; - sal_Int32 nColor; - ExtendedColorConfigValue() : nColor(0) {} + sal_Int32 m_nColor; + sal_Int32 m_nDefaultColor; +public: + ExtendedColorConfigValue() : m_nColor(0),m_nDefaultColor(0){} + ExtendedColorConfigValue(const ::rtl::OUString& _sName + ,const ::rtl::OUString& _sDisplayName + ,sal_Int32 _nColor + ,sal_Int32 _nDefaultColor) + : m_sName(_sName) + ,m_sDisplayName(_sDisplayName) + ,m_nColor(_nColor) + ,m_nDefaultColor(_nDefaultColor) + {} + + inline ::rtl::OUString getName() const { return m_sName; } + inline ::rtl::OUString getDisplayName() const { return m_sDisplayName; } + inline sal_Int32 getColor() const { return m_nColor; } + inline sal_Int32 getDefaultColor() const { return m_nDefaultColor; } + + inline void setColor(sal_Int32 _nColor) { m_nColor = _nColor; } + sal_Bool operator !=(const ExtendedColorConfigValue& rCmp) const - { return nColor != rCmp.nColor;} + { return m_nColor != rCmp.m_nColor;} }; /* -----------------------------22.03.2002 15:36------------------------------ diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 203689cccfeb..a503d9c82d31 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -4,9 +4,9 @@ * * $RCSfile: extcolorcfg.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: rt $ $Date: 2007-07-09 07:14:03 $ + * last change: $Author: ihi $ $Date: 2007-11-20 19:16:30 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -396,7 +396,7 @@ void ExtendedColorConfig_Impl::Load(const rtl::OUString& rScheme) // ----------------------------------------------------------------------------- void ExtendedColorConfig_Impl::FillComponentColors(uno::Sequence < ::rtl::OUString >& _rComponents,const TDisplayNames& _rDisplayNames) { - ::rtl::OUString sColorEntries(RTL_CONSTASCII_USTRINGPARAM("/Entries")); + const ::rtl::OUString sColorEntries(RTL_CONSTASCII_USTRINGPARAM("/Entries")); ::rtl::OUString* pIter = _rComponents.getArray(); ::rtl::OUString* pEnd = pIter + _rComponents.getLength(); for(;pIter != pEnd;++pIter) @@ -408,11 +408,19 @@ void ExtendedColorConfig_Impl::FillComponentColors(uno::Sequence < ::rtl::OUStri sEntry += sColorEntries; uno::Sequence < ::rtl::OUString > aColorNames = GetPropertyNames(sEntry); + uno::Sequence < ::rtl::OUString > aDefaultColorNames = aColorNames; - ::rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("/Color")); - lcl_addString(aColorNames,sName); + const ::rtl::OUString sColor(RTL_CONSTASCII_USTRINGPARAM("/Color")); + const ::rtl::OUString sDefaultColor(RTL_CONSTASCII_USTRINGPARAM("/DefaultColor")); + lcl_addString(aColorNames,sColor); + lcl_addString(aDefaultColorNames,sDefaultColor); uno::Sequence< uno::Any > aColors = GetProperties( aColorNames ); const uno::Any* pColors = aColors.getConstArray(); + + uno::Sequence< uno::Any > aDefaultColors = GetProperties( aDefaultColorNames ); + bool bDefaultColorFound = aDefaultColors.getLength() != 0; + const uno::Any* pDefaultColors = aDefaultColors.getConstArray(); + ::rtl::OUString* pColorIter = aColorNames.getArray(); ::rtl::OUString* pColorEnd = pColorIter + aColorNames.getLength(); @@ -423,22 +431,28 @@ void ExtendedColorConfig_Impl::FillComponentColors(uno::Sequence < ::rtl::OUStri { if ( aConfigValues.find(*pColorIter) == aConfigValues.end() ) { - ExtendedColorConfigValue aValue; sal_Int32 nIndex = 0; pColorIter->getToken(2,'/',nIndex); - aValue.m_sName = pColorIter->copy(nIndex); - ::rtl::OUString sTemp = aValue.m_sName.copy(0,aValue.m_sName.lastIndexOf(sName)); + ::rtl::OUString sName(pColorIter->copy(nIndex)),sDisplayName; + ::rtl::OUString sTemp = sName.copy(0,sName.lastIndexOf(sColor)); TDisplayNames::const_iterator aFind = _rDisplayNames.find(sTemp); nIndex = 0; - aValue.m_sName = aValue.m_sName.getToken(2,'/',nIndex); + sName = sName.getToken(2,'/',nIndex); OSL_ENSURE(aFind != _rDisplayNames.end(),"DisplayName is not in EntryNames config list!"); if ( aFind != _rDisplayNames.end() ) - aValue.m_sDisplayName = aFind->second; + sDisplayName = aFind->second; OSL_ENSURE(pColors[i].hasValue(),"Color config entry has NIL as color value set!"); - pColors[i] >>= aValue.nColor; - aConfigValuesPos.push_back(aConfigValues.insert(TConfigValues::value_type(aValue.m_sName,aValue)).first); + OSL_ENSURE(pDefaultColors[i].hasValue(),"Color config entry has NIL as color value set!"); + sal_Int32 nColor = 0,nDefaultColor = 0; + pColors[i] >>= nColor; + if ( bDefaultColorFound ) + pDefaultColors[i] >>= nDefaultColor; + else + nDefaultColor = nColor; + ExtendedColorConfigValue aValue(sName,sDisplayName,nColor,nDefaultColor); + aConfigValuesPos.push_back(aConfigValues.insert(TConfigValues::value_type(sName,aValue)).first); } } // for(int i = 0; pColorIter != pColorEnd; ++pColorIter ,++i) } @@ -468,21 +482,17 @@ void ExtendedColorConfig_Impl::Commit() { if ( !m_sLoadedScheme.getLength() ) return; - ::rtl::OUString sColorEntries(RTL_CONSTASCII_USTRINGPARAM("Entries")); - ::rtl::OUString sColor(RTL_CONSTASCII_USTRINGPARAM("/Color")); + const ::rtl::OUString sColorEntries(RTL_CONSTASCII_USTRINGPARAM("Entries")); + const ::rtl::OUString sColor(RTL_CONSTASCII_USTRINGPARAM("/Color")); + const ::rtl::OUString sDefaultColor(RTL_CONSTASCII_USTRINGPARAM("/DefaultColor")); ::rtl::OUString sBase(RTL_CONSTASCII_USTRINGPARAM("ExtendedColorScheme/ColorSchemes/")); - ::rtl::OUString s_sSep(RTL_CONSTASCII_USTRINGPARAM("/")); + const ::rtl::OUString s_sSep(RTL_CONSTASCII_USTRINGPARAM("/")); sBase += m_sLoadedScheme; TComponents::iterator aIter = m_aConfigValues.begin(); TComponents::iterator aEnd = m_aConfigValues.end(); for( ;aIter != aEnd;++aIter ) - //uno::Sequence < ::rtl::OUString > aComponents = GetPropertyNames(sBase); - //::rtl::OUString* pCompIter = aComponents.getArray(); - //::rtl::OUString* pCompEnd = pCompIter + aComponents.getLength(); - //for(;pCompIter != pCompEnd;++pCompIter) { - //::rtl::OUString sEntry = *pCompIter; ::rtl::OUString sEntry = aIter->first; sEntry += sColorEntries; @@ -500,18 +510,12 @@ void ExtendedColorConfig_Impl::Commit() TConfigValues::iterator aConIter = aIter->second.first.begin(); TConfigValues::iterator aConEnd = aIter->second.first.end(); for (; aConIter != aConEnd; ++aConIter,++pPropValues) - - /*uno::Sequence < ::rtl::OUString > aColorNames = GetPropertyNames(sEntry); - const ::rtl::OUString* pColorNames = aColorNames.getConstArray(); - const ::rtl::OUString* pEnd = pColorNames + aColorNames.getLength(); - for(int i = 0; pColorNames != pEnd ; ++i,++pColorNames)*/ { - //pPropValues->Name = *pColorNames; pPropValues->Name = sNode + s_sSep + aConIter->first; ConfigItem::AddNode(sNode, aConIter->first); - pPropValues->Name += sColor; - pPropValues->Value <<= aConIter->second.nColor; + pPropValues->Value <<= aConIter->second.getColor(); + // the default color will never be changed } ::rtl::OUString s(RTL_CONSTASCII_USTRINGPARAM("ExtendedColorScheme/ColorSchemes")); SetSetProperties(s, aPropValues); @@ -554,7 +558,7 @@ void ExtendedColorConfig_Impl::SetColorConfigValue(const ::rtl::OUString& _sName TComponents::iterator aFind = m_aConfigValues.find(_sName); if ( aFind != m_aConfigValues.end() ) { - TConfigValues::iterator aFind2 = aFind->second.first.find(rValue.m_sName); + TConfigValues::iterator aFind2 = aFind->second.first.find(rValue.getName()); if ( aFind2 != aFind->second.first.end() ) aFind2->second = rValue; SetModified(); |