summaryrefslogtreecommitdiff
path: root/sfx2/source/sidebar/ResourceManager.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-07-21 19:39:26 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-07-29 18:44:33 +0200
commit25b200ff79c71c831bc7e6fe8b1ec0b5315e96d6 (patch)
treeb8e7cc15bfe82b677fb1bfc791b3f2f5a50fdc79 /sfx2/source/sidebar/ResourceManager.cxx
parentc762e3859973355b31f6676a8e697c5fd78c9970 (diff)
Simplify Sequence iterations in sfx2
Use range-based loops, STL and comphelper functions Change-Id: I6a0d18493db7a25e8b41925f2d45cb221b5065a7 Reviewed-on: https://gerrit.libreoffice.org/76074 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'sfx2/source/sidebar/ResourceManager.cxx')
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx32
1 files changed, 10 insertions, 22 deletions
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index 1dfcd370794c..9c6f7f1f442a 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -255,11 +255,9 @@ void ResourceManager::ReadDeckList()
return;
const Sequence<OUString> aDeckNodeNames (aDeckRootNode.getNodeNames());
- const sal_Int32 nCount(aDeckNodeNames.getLength());
maDecks.clear();
- for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
+ for (const OUString& aDeckName : aDeckNodeNames)
{
- const OUString aDeckName = aDeckNodeNames[nReadIndex];
if (comphelper::LibreOfficeKit::isActive())
{
// Hide these decks in LOK as they aren't fully functional.
@@ -285,7 +283,7 @@ void ResourceManager::ReadDeckList()
rDeckDescriptor.mnOrderIndex = getInt32(aDeckNode, "OrderIndex");
rDeckDescriptor.mbExperimental = getBool(aDeckNode, "IsExperimental");
- rDeckDescriptor.msNodeName = aDeckNodeNames[nReadIndex];
+ rDeckDescriptor.msNodeName = aDeckName;
ReadContextList(
aDeckNode,
@@ -424,11 +422,10 @@ void ResourceManager::ReadPanelList()
return;
const Sequence<OUString> aPanelNodeNames (aPanelRootNode.getNodeNames());
- const sal_Int32 nCount (aPanelNodeNames.getLength());
maPanels.clear();
- for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
+ for (const auto& rPanelNodeName : aPanelNodeNames)
{
- const utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(aPanelNodeNames[nReadIndex]));
+ const utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(rPanelNodeName));
if (!aPanelNode.isValid())
continue;
@@ -448,7 +445,7 @@ void ResourceManager::ReadPanelList()
rPanelDescriptor.mbExperimental = getBool(aPanelNode, "IsExperimental");
const OUString sDefaultMenuCommand(getString(aPanelNode, "DefaultMenuCommand"));
- rPanelDescriptor.msNodeName = aPanelNodeNames[nReadIndex];
+ rPanelDescriptor.msNodeName = rPanelNodeName;
ReadContextList(aPanelNode, rPanelDescriptor.maContextList, sDefaultMenuCommand);
}
@@ -484,16 +481,11 @@ void ResourceManager::ReadContextList (
{
const Any aValue = rParentNode.getNodeValue("ContextList");
Sequence<OUString> aValues;
- sal_Int32 nCount;
- if (aValue >>= aValues)
- nCount = aValues.getLength();
- else
- nCount = 0;
+ if (!(aValue >>= aValues))
+ return;
- for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
+ for (const OUString& sValue : aValues)
{
- const OUString sValue (aValues[nIndex]);
-
sal_Int32 nCharacterIndex (0);
const OUString sApplicationName (sValue.getToken(0, ',', nCharacterIndex).trim());
if (nCharacterIndex < 0)
@@ -742,12 +734,8 @@ void ResourceManager::GetToolPanelNodeNames (
const utl::OConfigurationTreeRoot& aRoot)
{
Sequence<OUString> aChildNodeNames (aRoot.getNodeNames());
- const sal_Int32 nCount (aChildNodeNames.getLength());
- for (sal_Int32 nIndex(0); nIndex<nCount; ++nIndex)
- {
- if (aChildNodeNames[nIndex].startsWith( "private:resource/toolpanel/" ))
- rMatchingNames.push_back(aChildNodeNames[nIndex]);
- }
+ std::copy_if(aChildNodeNames.begin(), aChildNodeNames.end(), std::back_inserter(rMatchingNames),
+ [](const OUString& rChildNodeName) { return rChildNodeName.startsWith( "private:resource/toolpanel/" ); });
}
bool ResourceManager::IsDeckEnabled (