diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-01 09:23:41 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-01 15:21:54 +0100 |
commit | 14b332dd4d069164f16e975dfab16bd781483696 (patch) | |
tree | 2c9ef7713541b738732b332534ce4e8c2b55b123 /unotools | |
parent | 8e2ee35376825cbafd52d8736b28d1dd9c86d569 (diff) |
this is overly static for little gain
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/cacheoptions.cxx | 9 | ||||
-rw-r--r-- | unotools/source/config/extendedsecurityoptions.cxx | 6 | ||||
-rw-r--r-- | unotools/source/config/fontoptions.cxx | 6 | ||||
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 38 | ||||
-rw-r--r-- | unotools/source/config/localisationoptions.cxx | 7 | ||||
-rw-r--r-- | unotools/source/config/misccfg.cxx | 48 | ||||
-rw-r--r-- | unotools/source/config/printwarningoptions.cxx | 6 | ||||
-rw-r--r-- | unotools/source/config/securityoptions.cxx | 4 | ||||
-rw-r--r-- | unotools/source/config/startoptions.cxx | 6 | ||||
-rw-r--r-- | unotools/source/config/syslocaleoptions.cxx | 4 | ||||
-rw-r--r-- | unotools/source/config/workingsetoptions.cxx | 6 |
11 files changed, 61 insertions, 79 deletions
diff --git a/unotools/source/config/cacheoptions.cxx b/unotools/source/config/cacheoptions.cxx index a7dc14b6845b..3e2ce0251970 100644 --- a/unotools/source/config/cacheoptions.cxx +++ b/unotools/source/config/cacheoptions.cxx @@ -330,13 +330,10 @@ void SvtCacheOptions_Impl::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgr SetModified(); } -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames() { - // Build static list of configuration key names. - static const OUString pProperties[] = + // Build list of configuration key names. + const OUString pProperties[] = { PROPERTYNAME_WRITEROLE, PROPERTYNAME_DRAWINGOLE, @@ -345,7 +342,7 @@ Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames() PROPERTYNAME_GRFMGR_OBJECTRELEASE }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); // ... and return it. return seqPropertyNames; } diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx index fe5cc90d28cb..c93d85ed5fe7 100644 --- a/unotools/source/config/extendedsecurityoptions.cxx +++ b/unotools/source/config/extendedsecurityoptions.cxx @@ -412,13 +412,13 @@ void SvtExtendedSecurityOptions_Impl::FillExtensionHashMap( ExtensionHashMap& aH //***************************************************************************************************************** Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetPropertyNames() { - // Build static list of configuration key names. - static const OUString pProperties[] = + // Build list of configuration key names. + const OUString pProperties[] = { PROPERTYNAME_HYPERLINKS_OPEN }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); // ... and return it. return seqPropertyNames; } diff --git a/unotools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx index 9cb8a1831e97..7c32000a6a0d 100644 --- a/unotools/source/config/fontoptions.cxx +++ b/unotools/source/config/fontoptions.cxx @@ -369,15 +369,15 @@ void SvtFontOptions_Impl::EnableFontWYSIWYG( sal_Bool bState ) //***************************************************************************************************************** Sequence< OUString > SvtFontOptions_Impl::impl_GetPropertyNames() { - // Build static list of configuration key names. - static const OUString pProperties[] = + // Build list of configuration key names. + const OUString pProperties[] = { PROPERTYNAME_REPLACEMENTTABLE , PROPERTYNAME_FONTHISTORY , PROPERTYNAME_FONTWYSIWYG , }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); // ... and return it. return seqPropertyNames; } diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 9805c14c362d..fbea2ac97499 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -171,7 +171,7 @@ class SvtLinguConfigItem : public utl::ConfigItem SvtLinguConfigItem & operator = ( const SvtLinguConfigItem & ); static sal_Bool GetHdlByName( sal_Int32 &rnHdl, const OUString &rPropertyName, sal_Bool bFullPropName = sal_False ); - static const uno::Sequence< OUString > & GetPropertyNames(); + static const uno::Sequence< OUString > GetPropertyNames(); sal_Bool LoadOptions( const uno::Sequence< OUString > &rProperyNames ); sal_Bool SaveOptions( const uno::Sequence< OUString > &rProperyNames ); @@ -213,11 +213,12 @@ public: SvtLinguConfigItem::SvtLinguConfigItem() : utl::ConfigItem( String::CreateFromAscii( "Office.Linguistic" ) ) { - LoadOptions( GetPropertyNames() ); + const uno::Sequence< OUString > &rPropertyNames = GetPropertyNames(); + LoadOptions( rPropertyNames ); ClearModified(); // request notify events when properties change - EnableNotification( GetPropertyNames() ); + EnableNotification( rPropertyNames ); } @@ -289,31 +290,26 @@ static struct NamesToHdl }; -const uno::Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames() +const uno::Sequence< OUString > SvtLinguConfigItem::GetPropertyNames() { - static uno::Sequence< OUString > aNames; - static sal_Bool bInitialized = sal_False; + uno::Sequence< OUString > aNames; - if (!bInitialized) - { - sal_Int32 nMax = SAL_N_ELEMENTS(aNamesToHdl); + sal_Int32 nMax = SAL_N_ELEMENTS(aNamesToHdl); - aNames.realloc( nMax ); - OUString *pNames = aNames.getArray(); - sal_Int32 nIdx = 0; - for (sal_Int32 i = 0; i < nMax; ++i) - { - const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName; - if (pFullPropName) - pNames[ nIdx++ ] = ::rtl::OUString::createFromAscii( pFullPropName ); - } - aNames.realloc( nIdx ); - bInitialized = sal_True; + aNames.realloc( nMax ); + OUString *pNames = aNames.getArray(); + sal_Int32 nIdx = 0; + for (sal_Int32 i = 0; i < nMax; ++i) + { + const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName; + if (pFullPropName) + pNames[ nIdx++ ] = ::rtl::OUString::createFromAscii( pFullPropName ); } + aNames.realloc( nIdx ); + return aNames; } - sal_Bool SvtLinguConfigItem::GetHdlByName( sal_Int32 &rnHdl, const OUString &rPropertyName, diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx index d3392ea6cc92..e5e9577035e5 100644 --- a/unotools/source/config/localisationoptions.cxx +++ b/unotools/source/config/localisationoptions.cxx @@ -329,19 +329,16 @@ void SvtLocalisationOptions_Impl::SetDialogScale( sal_Int32 nScale ) SetModified(); } -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** Sequence< OUString > SvtLocalisationOptions_Impl::GetPropertyNames() { // Build static list of configuration key names. - static const OUString pProperties[] = + const OUString aProperties[] = { PROPERTYNAME_AUTOMNEMONIC , PROPERTYNAME_DIALOGSCALE , }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + Sequence< OUString > seqPropertyNames(aProperties, PROPERTYCOUNT); // ... and return it. return seqPropertyNames; } diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx index 733818d17132..903a3a8c2657 100644 --- a/unotools/source/config/misccfg.cxx +++ b/unotools/source/config/misccfg.cxx @@ -63,7 +63,7 @@ class SfxMiscCfg : public utl::ConfigItem sal_Bool bNotFound; sal_Int32 nYear2000; // two digit year representation - const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames(); + const com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); void Load(); public: @@ -132,37 +132,29 @@ void SfxMiscCfg::SetYear2000( sal_Int32 nSet ) nYear2000 = nSet; } -const Sequence<OUString>& SfxMiscCfg::GetPropertyNames() +const Sequence<OUString> SfxMiscCfg::GetPropertyNames() { - static Sequence<OUString> aNames; - if(!aNames.getLength()) + const OUString pProperties[] = { - static const char* aPropNames[] = - { - "Print/Warning/PaperSize", // 0 - "Print/Warning/PaperOrientation", // 1 - "Print/Warning/NotFound", // 2 - "DateFormat/TwoDigitYear", // 3 - }; - const int nCount = 4; - aNames.realloc(nCount); - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; i++) - pNames[i] = OUString::createFromAscii(aPropNames[i]); - } - return aNames; + OUString(RTL_CONSTASCII_USTRINGPARAM("Print/Warning/PaperSize")), + OUString(RTL_CONSTASCII_USTRINGPARAM("Print/Warning/PaperOrientation")), + OUString(RTL_CONSTASCII_USTRINGPARAM("Print/Warning/NotFound")), + OUString(RTL_CONSTASCII_USTRINGPARAM("DateFormat/TwoDigitYear")) + }; + const Sequence< OUString > seqPropertyNames( pProperties, 4 ); + return seqPropertyNames; } void SfxMiscCfg::Load() { - const Sequence<OUString>& aNames = GetPropertyNames(); - Sequence<Any> aValues = GetProperties(aNames); - EnableNotification(aNames); + const Sequence<OUString>& rNames = GetPropertyNames(); + Sequence<Any> aValues = GetProperties(rNames); + EnableNotification(rNames); const Any* pValues = aValues.getConstArray(); - DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); - if(aValues.getLength() == aNames.getLength()) + DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed"); + if(aValues.getLength() == rNames.getLength()) { - for(int nProp = 0; nProp < aNames.getLength(); nProp++) + for(int nProp = 0; nProp < rNames.getLength(); nProp++) { if(pValues[nProp].hasValue()) { @@ -185,12 +177,12 @@ void SfxMiscCfg::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& ) void SfxMiscCfg::Commit() { - const Sequence<OUString>& aNames = GetPropertyNames(); - Sequence<Any> aValues(aNames.getLength()); + const Sequence<OUString>& rNames = GetPropertyNames(); + Sequence<Any> aValues(rNames.getLength()); Any* pValues = aValues.getArray(); const Type& rType = ::getBooleanCppuType(); - for(int nProp = 0; nProp < aNames.getLength(); nProp++) + for(int nProp = 0; nProp < rNames.getLength(); nProp++) { switch(nProp) { @@ -200,7 +192,7 @@ void SfxMiscCfg::Commit() case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear", } } - PutProperties(aNames, aValues); + PutProperties(rNames, aValues); } // ----------------------------------------------------------------------- namespace diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx index 11b656334454..bf8b5738c818 100644 --- a/unotools/source/config/printwarningoptions.cxx +++ b/unotools/source/config/printwarningoptions.cxx @@ -244,8 +244,8 @@ void SvtPrintWarningOptions_Impl::Notify( const Sequence< rtl::OUString >& ) //***************************************************************************************************************** Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames() { - // Build static list of configuration key names. - static const OUString pProperties[] = + // Build list of configuration key names. + const OUString pProperties[] = { PROPERTYNAME_PAPERSIZE, PROPERTYNAME_PAPERORIENTATION, @@ -255,7 +255,7 @@ Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames() }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); return seqPropertyNames; } diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index 21914d1a402f..ef4689dc6922 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -1024,7 +1024,7 @@ sal_Bool SvtSecurityOptions_Impl::IsOptionEnabled( SvtSecurityOptions::EOption e Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames() { // Build static list of configuration key names. - static const OUString pProperties[] = + const OUString pProperties[] = { PROPERTYNAME_SECUREURL, PROPERTYNAME_STAROFFICEBASIC, @@ -1043,7 +1043,7 @@ Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames() PROPERTYNAME_MACRO_DISABLE }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); // ... and return it. return seqPropertyNames; } diff --git a/unotools/source/config/startoptions.cxx b/unotools/source/config/startoptions.cxx index c47b34946dd3..edeab14539c0 100644 --- a/unotools/source/config/startoptions.cxx +++ b/unotools/source/config/startoptions.cxx @@ -334,14 +334,14 @@ void SvtStartOptions_Impl::SetConnectionURL( const OUString& sURL ) //***************************************************************************************************************** Sequence< OUString > SvtStartOptions_Impl::impl_GetPropertyNames() { - // Build static list of configuration key names. - static const OUString pProperties[] = + // Build list of configuration key names. + const OUString pProperties[] = { PROPERTYNAME_SHOWINTRO , PROPERTYNAME_CONNECTIONURL , }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); // ... and return it. return seqPropertyNames; } diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx index 9c071cea2dd1..ae387930cd34 100644 --- a/unotools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -147,14 +147,14 @@ public: const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames() { - static const OUString pProperties[] = + const OUString pProperties[] = { PROPERTYNAME_LOCALE, PROPERTYNAME_UILOCALE, PROPERTYNAME_CURRENCY, PROPERTYNAME_DECIMALSEPARATOR }; - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); return seqPropertyNames; } diff --git a/unotools/source/config/workingsetoptions.cxx b/unotools/source/config/workingsetoptions.cxx index 39f2ebef773d..e465ac439981 100644 --- a/unotools/source/config/workingsetoptions.cxx +++ b/unotools/source/config/workingsetoptions.cxx @@ -290,13 +290,13 @@ void SvtWorkingSetOptions_Impl::SetWindowList( const Sequence< OUString >& seqWi //***************************************************************************************************************** Sequence< OUString > SvtWorkingSetOptions_Impl::GetPropertyNames() { - // Build static list of configuration key names. - static const OUString pProperties[] = + // Build list of configuration key names. + const OUString pProperties[] = { PROPERTYNAME_WINDOWLIST , }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); // ... and return it. return seqPropertyNames; } |