summaryrefslogtreecommitdiff
path: root/unotools/source/config/misccfg.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-06-01 09:23:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-06-01 15:21:54 +0100
commit14b332dd4d069164f16e975dfab16bd781483696 (patch)
tree2c9ef7713541b738732b332534ce4e8c2b55b123 /unotools/source/config/misccfg.cxx
parent8e2ee35376825cbafd52d8736b28d1dd9c86d569 (diff)
this is overly static for little gain
Diffstat (limited to 'unotools/source/config/misccfg.cxx')
-rw-r--r--unotools/source/config/misccfg.cxx48
1 files changed, 20 insertions, 28 deletions
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