summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-09 13:50:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-10 08:08:45 +0200
commitf4a9ba4b484480ddacc62a47f68b02e449d72880 (patch)
tree63c46455796508142a9a49a90c8f7101a1a0522c
parentcc96c1fdc1b62f8b61567f5df63e892953c87f10 (diff)
convert ConfigNameFormat to scoped enum
and drop unused constants CONFIG_NAME_PLAINTEXT_NAME CONFIG_NAME_FULL_PATH Change-Id: Ibf7e88da0ae54516cb863b8efa995201f2a95268
-rw-r--r--framework/source/fwi/classes/protocolhandlercache.cxx2
-rw-r--r--include/unotools/configitem.hxx8
-rw-r--r--svtools/source/config/fontsubstconfig.cxx2
-rw-r--r--unotools/source/config/cmdoptions.cxx2
-rw-r--r--unotools/source/config/configitem.cxx53
-rw-r--r--unotools/source/config/eventcfg.cxx2
6 files changed, 10 insertions, 59 deletions
diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx
index dc7c3b4966e0..0837083172c4 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -201,7 +201,7 @@ void HandlerCFGAccess::read( HandlerHash** ppHandler ,
PatternHash** ppPattern )
{
// list of all uno implementation names without encoding
- css::uno::Sequence< OUString > lNames = GetNodeNames( SETNAME_HANDLER, ::utl::CONFIG_NAME_LOCAL_PATH );
+ css::uno::Sequence< OUString > lNames = GetNodeNames( SETNAME_HANDLER, ::utl::ConfigNameFormat::LocalPath );
sal_Int32 nSourceCount = lNames.getLength();
sal_Int32 nTargetCount = nSourceCount;
// list of all full qualified path names of configuration entries
diff --git a/include/unotools/configitem.hxx b/include/unotools/configitem.hxx
index 54a57d896f5e..41c8b62a007d 100644
--- a/include/unotools/configitem.hxx
+++ b/include/unotools/configitem.hxx
@@ -58,12 +58,10 @@ namespace o3tl
namespace utl
{
- enum ConfigNameFormat
+ enum class ConfigNameFormat
{
- CONFIG_NAME_PLAINTEXT_NAME, // unescaped local node name, for user display etc.
- CONFIG_NAME_LOCAL_NAME, // local node name, for use in XNameAccess etc. ("Item", "Q & A")
- CONFIG_NAME_LOCAL_PATH, // one-level relative path, for use when building paths etc. ("Item", "Typ['Q &amp; A']")
- CONFIG_NAME_FULL_PATH // full absolute path. ("/org.openoffice.Sample/Group/Item", "/org.openoffice.Sample/Set/Typ['Q &amp; A']")
+ LocalNode, // local node name, for use in XNameAccess etc. ("Item", "Q & A")
+ LocalPath, // one-level relative path, for use when building paths etc. ("Item", "Typ['Q &amp; A']")
};
class ConfigChangeListener_Impl;
diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx
index bb4533f0538d..a9b42a6ffc52 100644
--- a/svtools/source/config/fontsubstconfig.cxx
+++ b/svtools/source/config/fontsubstconfig.cxx
@@ -59,7 +59,7 @@ SvtFontSubstConfig::SvtFontSubstConfig() :
bIsEnabled = *o3tl::doAccess<bool>(aValues.getConstArray()[0]);
OUString sPropPrefix(cFontPairs);
- Sequence<OUString> aNodeNames = GetNodeNames(sPropPrefix, CONFIG_NAME_LOCAL_PATH);
+ Sequence<OUString> aNodeNames = GetNodeNames(sPropPrefix, ConfigNameFormat::LocalPath);
const OUString* pNodeNames = aNodeNames.getConstArray();
Sequence<OUString> aPropNames(aNodeNames.getLength() * 4);
OUString* pNames = aPropNames.getArray();
diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx
index ff2f6445424c..b569e12041a2 100644
--- a/unotools/source/config/cmdoptions.cxx
+++ b/unotools/source/config/cmdoptions.cxx
@@ -276,7 +276,7 @@ void SvtCommandOptions_Impl::EstablishFrameCallback(const css::uno::Reference< c
Sequence< OUString > SvtCommandOptions_Impl::impl_GetPropertyNames()
{
// First get ALL names of current existing list items in configuration!
- Sequence< OUString > lDisabledItems = GetNodeNames( SETNODE_DISABLED, utl::CONFIG_NAME_LOCAL_PATH );
+ Sequence< OUString > lDisabledItems = GetNodeNames( SETNODE_DISABLED, utl::ConfigNameFormat::LocalPath );
// Expand all keys
for (sal_Int32 i=0; i<lDisabledItems.getLength(); ++i )
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index ae468e78d701..1de221b4fa19 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -575,37 +575,11 @@ static void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFor
{
switch (_eFormat)
{
- case CONFIG_NAME_LOCAL_NAME:
+ case ConfigNameFormat::LocalNode:
// unaltered - this is our input format
break;
- case CONFIG_NAME_FULL_PATH:
- {
- Reference<XHierarchicalName> xFormatter(_xParentNode, UNO_QUERY);
- if (xFormatter.is())
- {
- OUString * pNames = _rNames.getArray();
- for(int i = 0; i<_rNames.getLength(); ++i)
- {
- try
- {
- pNames[i] = xFormatter->composeHierarchicalName(pNames[i]);
- }
- catch (css::uno::Exception & e)
- {
- SAL_WARN(
- "unotools.config",
- "Exception from composeHierarchicalName(): "
- << e.Message);
- }
- }
- break;
- }
- }
- OSL_FAIL("Cannot create absolute paths: missing interface");
- SAL_FALLTHROUGH; // make local paths instaed
-
- case CONFIG_NAME_LOCAL_PATH:
+ case ConfigNameFormat::LocalPath:
{
Reference<XTemplateContainer> xTypeContainer(_xParentNode, UNO_QUERY);
if (xTypeContainer.is())
@@ -634,33 +608,12 @@ static void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFor
}
break;
- case CONFIG_NAME_PLAINTEXT_NAME:
- {
- Reference<XStringEscape> xEscaper(_xParentNode, UNO_QUERY);
- if (xEscaper.is())
- {
- OUString * pNames = _rNames.getArray();
- for(int i = 0; i<_rNames.getLength(); ++i)
- try
- {
- pNames[i] = xEscaper->unescapeString(pNames[i]);
- }
- catch (css::uno::Exception & e)
- {
- SAL_WARN(
- "unotools.config",
- "Exception from unescapeString(): " << e.Message);
- }
- }
- }
- break;
-
}
}
Sequence< OUString > ConfigItem::GetNodeNames(const OUString& rNode)
{
- ConfigNameFormat const eDefaultFormat = CONFIG_NAME_LOCAL_NAME; // CONFIG_NAME_DEFAULT;
+ ConfigNameFormat const eDefaultFormat = ConfigNameFormat::LocalNode; // CONFIG_NAME_DEFAULT;
return GetNodeNames(rNode, eDefaultFormat);
}
diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx
index 138df08a62f2..998c4312f837 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -201,7 +201,7 @@ void GlobalEventConfig_Impl::ImplCommit()
void GlobalEventConfig_Impl::initBindingInfo()
{
// Get ALL names of current existing list items in configuration!
- Sequence< OUString > lEventNames = GetNodeNames( SETNODE_BINDINGS, utl::CONFIG_NAME_LOCAL_PATH );
+ Sequence< OUString > lEventNames = GetNodeNames( SETNODE_BINDINGS, utl::ConfigNameFormat::LocalPath );
OUString aSetNode( SETNODE_BINDINGS );
aSetNode += PATHDELIMITER;