Kaydet (Commit) f4a9ba4b authored tarafından Noel Grandin's avatar Noel Grandin

convert ConfigNameFormat to scoped enum

and drop unused constants
    CONFIG_NAME_PLAINTEXT_NAME
    CONFIG_NAME_FULL_PATH

Change-Id: Ibf7e88da0ae54516cb863b8efa995201f2a95268
üst cc96c1fd
...@@ -201,7 +201,7 @@ void HandlerCFGAccess::read( HandlerHash** ppHandler , ...@@ -201,7 +201,7 @@ void HandlerCFGAccess::read( HandlerHash** ppHandler ,
PatternHash** ppPattern ) PatternHash** ppPattern )
{ {
// list of all uno implementation names without encoding // 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 nSourceCount = lNames.getLength();
sal_Int32 nTargetCount = nSourceCount; sal_Int32 nTargetCount = nSourceCount;
// list of all full qualified path names of configuration entries // list of all full qualified path names of configuration entries
......
...@@ -58,12 +58,10 @@ namespace o3tl ...@@ -58,12 +58,10 @@ namespace o3tl
namespace utl namespace utl
{ {
enum ConfigNameFormat enum class ConfigNameFormat
{ {
CONFIG_NAME_PLAINTEXT_NAME, // unescaped local node name, for user display etc. LocalNode, // local node name, for use in XNameAccess etc. ("Item", "Q & A")
CONFIG_NAME_LOCAL_NAME, // 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']")
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']")
}; };
class ConfigChangeListener_Impl; class ConfigChangeListener_Impl;
......
...@@ -59,7 +59,7 @@ SvtFontSubstConfig::SvtFontSubstConfig() : ...@@ -59,7 +59,7 @@ SvtFontSubstConfig::SvtFontSubstConfig() :
bIsEnabled = *o3tl::doAccess<bool>(aValues.getConstArray()[0]); bIsEnabled = *o3tl::doAccess<bool>(aValues.getConstArray()[0]);
OUString sPropPrefix(cFontPairs); OUString sPropPrefix(cFontPairs);
Sequence<OUString> aNodeNames = GetNodeNames(sPropPrefix, CONFIG_NAME_LOCAL_PATH); Sequence<OUString> aNodeNames = GetNodeNames(sPropPrefix, ConfigNameFormat::LocalPath);
const OUString* pNodeNames = aNodeNames.getConstArray(); const OUString* pNodeNames = aNodeNames.getConstArray();
Sequence<OUString> aPropNames(aNodeNames.getLength() * 4); Sequence<OUString> aPropNames(aNodeNames.getLength() * 4);
OUString* pNames = aPropNames.getArray(); OUString* pNames = aPropNames.getArray();
......
...@@ -276,7 +276,7 @@ void SvtCommandOptions_Impl::EstablishFrameCallback(const css::uno::Reference< c ...@@ -276,7 +276,7 @@ void SvtCommandOptions_Impl::EstablishFrameCallback(const css::uno::Reference< c
Sequence< OUString > SvtCommandOptions_Impl::impl_GetPropertyNames() Sequence< OUString > SvtCommandOptions_Impl::impl_GetPropertyNames()
{ {
// First get ALL names of current existing list items in configuration! // 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 // Expand all keys
for (sal_Int32 i=0; i<lDisabledItems.getLength(); ++i ) for (sal_Int32 i=0; i<lDisabledItems.getLength(); ++i )
......
...@@ -575,37 +575,11 @@ static void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFor ...@@ -575,37 +575,11 @@ static void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFor
{ {
switch (_eFormat) switch (_eFormat)
{ {
case CONFIG_NAME_LOCAL_NAME: case ConfigNameFormat::LocalNode:
// unaltered - this is our input format // unaltered - this is our input format
break; break;
case CONFIG_NAME_FULL_PATH: case ConfigNameFormat::LocalPath:
{
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:
{ {
Reference<XTemplateContainer> xTypeContainer(_xParentNode, UNO_QUERY); Reference<XTemplateContainer> xTypeContainer(_xParentNode, UNO_QUERY);
if (xTypeContainer.is()) if (xTypeContainer.is())
...@@ -634,33 +608,12 @@ static void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFor ...@@ -634,33 +608,12 @@ static void lcl_normalizeLocalNames(Sequence< OUString >& _rNames, ConfigNameFor
} }
break; 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) 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); return GetNodeNames(rNode, eDefaultFormat);
} }
......
...@@ -201,7 +201,7 @@ void GlobalEventConfig_Impl::ImplCommit() ...@@ -201,7 +201,7 @@ void GlobalEventConfig_Impl::ImplCommit()
void GlobalEventConfig_Impl::initBindingInfo() void GlobalEventConfig_Impl::initBindingInfo()
{ {
// Get ALL names of current existing list items in configuration! // 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 ); OUString aSetNode( SETNODE_BINDINGS );
aSetNode += PATHDELIMITER; aSetNode += PATHDELIMITER;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment