[Libreoffice-commits] core.git: 2 commits - sfx2/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Tue Apr 21 02:15:37 PDT 2015


 sfx2/source/sidebar/ResourceManager.cxx |  330 +++++++++++++-------------------
 sfx2/source/sidebar/ResourceManager.hxx |   79 +++----
 2 files changed, 176 insertions(+), 233 deletions(-)

New commits:
commit 9d9eb01e4abb22d4442c7e5e882a5f78187734d0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Apr 21 18:08:55 2015 +0900

    simplify gathering XML conf. data in sidebar ResourceManager
    
    Change-Id: I218698079d205690b596f3d36ff7dedea08c92fa

diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index cb4d715..fcadbc9b 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -37,6 +37,24 @@ using namespace css::uno;
 
 namespace sfx2 { namespace sidebar {
 
+namespace
+{
+
+OUString getString(utl::OConfigurationNode aNode, const char* pNodeName)
+{
+    return comphelper::getString(aNode.getNodeValue(pNodeName));
+}
+sal_Int32 getInt32(utl::OConfigurationNode aNode, const char* pNodeName)
+{
+    return comphelper::getINT32(aNode.getNodeValue(pNodeName));
+}
+bool getBool(utl::OConfigurationNode aNode, const char* pNodeName)
+{
+    return comphelper::getBOOL(aNode.getNodeValue(pNodeName));
+}
+
+} //end anonymous namespace
+
 ResourceManager& ResourceManager::Instance()
 {
     static ResourceManager maInstance;
@@ -194,26 +212,17 @@ void ResourceManager::ReadDeckList()
 
         DeckDescriptor& rDeckDescriptor (maDecks[nWriteIndex++]);
 
-        rDeckDescriptor.msTitle = ::comphelper::getString(
-            aDeckNode.getNodeValue("Title"));
-        rDeckDescriptor.msId = ::comphelper::getString(
-            aDeckNode.getNodeValue("Id"));
-        rDeckDescriptor.msIconURL = ::comphelper::getString(
-            aDeckNode.getNodeValue("IconURL"));
-        rDeckDescriptor.msHighContrastIconURL = ::comphelper::getString(
-            aDeckNode.getNodeValue("HighContrastIconURL"));
-        rDeckDescriptor.msTitleBarIconURL = ::comphelper::getString(
-            aDeckNode.getNodeValue("TitleBarIconURL"));
-        rDeckDescriptor.msHighContrastTitleBarIconURL = ::comphelper::getString(
-            aDeckNode.getNodeValue("HighContrastTitleBarIconURL"));
-        rDeckDescriptor.msHelpURL = ::comphelper::getString(
-            aDeckNode.getNodeValue("HelpURL"));
+        rDeckDescriptor.msTitle = getString(aDeckNode, "Title");
+        rDeckDescriptor.msId = getString(aDeckNode, "Id");
+        rDeckDescriptor.msIconURL = getString(aDeckNode, "IconURL");
+        rDeckDescriptor.msHighContrastIconURL = getString(aDeckNode, "HighContrastIconURL");
+        rDeckDescriptor.msTitleBarIconURL = getString(aDeckNode, "TitleBarIconURL");
+        rDeckDescriptor.msHighContrastTitleBarIconURL = getString(aDeckNode, "HighContrastTitleBarIconURL");
+        rDeckDescriptor.msHelpURL = getString(aDeckNode, "HelpURL");
         rDeckDescriptor.msHelpText = rDeckDescriptor.msTitle;
         rDeckDescriptor.mbIsEnabled = true;
-        rDeckDescriptor.mnOrderIndex = ::comphelper::getINT32(
-            aDeckNode.getNodeValue("OrderIndex"));
-        rDeckDescriptor.mbExperimental = ::comphelper::getBOOL(
-            aDeckNode.getNodeValue("IsExperimental"));
+        rDeckDescriptor.mnOrderIndex = getInt32(aDeckNode, "OrderIndex");
+        rDeckDescriptor.mbExperimental = getBool(aDeckNode, "IsExperimental");
 
         ReadContextList(
             aDeckNode,
@@ -248,32 +257,19 @@ void ResourceManager::ReadPanelList()
 
         PanelDescriptor& rPanelDescriptor (maPanels[nWriteIndex++]);
 
-        rPanelDescriptor.msTitle = ::comphelper::getString(
-            aPanelNode.getNodeValue("Title"));
-        rPanelDescriptor.mbIsTitleBarOptional = ::comphelper::getBOOL(
-            aPanelNode.getNodeValue("TitleBarIsOptional"));
-        rPanelDescriptor.msId = ::comphelper::getString(
-            aPanelNode.getNodeValue("Id"));
-        rPanelDescriptor.msDeckId = ::comphelper::getString(
-            aPanelNode.getNodeValue("DeckId"));
-        rPanelDescriptor.msTitleBarIconURL = ::comphelper::getString(
-            aPanelNode.getNodeValue("TitleBarIconURL"));
-        rPanelDescriptor.msHighContrastTitleBarIconURL = ::comphelper::getString(
-            aPanelNode.getNodeValue("HighContrastTitleBarIconURL"));
-        rPanelDescriptor.msHelpURL = ::comphelper::getString(
-            aPanelNode.getNodeValue("HelpURL"));
-        rPanelDescriptor.msImplementationURL = ::comphelper::getString(
-            aPanelNode.getNodeValue("ImplementationURL"));
-        rPanelDescriptor.mnOrderIndex = ::comphelper::getINT32(
-            aPanelNode.getNodeValue("OrderIndex"));
-        rPanelDescriptor.mbShowForReadOnlyDocuments = ::comphelper::getBOOL(
-            aPanelNode.getNodeValue("ShowForReadOnlyDocument"));
-        rPanelDescriptor.mbWantsCanvas = ::comphelper::getBOOL(
-            aPanelNode.getNodeValue("WantsCanvas"));
-        rPanelDescriptor.mbExperimental = ::comphelper::getBOOL(
-            aPanelNode.getNodeValue("IsExperimental"));
-        const OUString sDefaultMenuCommand (::comphelper::getString(
-                aPanelNode.getNodeValue("DefaultMenuCommand")));
+        rPanelDescriptor.msTitle = getString(aPanelNode, "Title");
+        rPanelDescriptor.mbIsTitleBarOptional = getBool(aPanelNode, "TitleBarIsOptional");
+        rPanelDescriptor.msId = getString(aPanelNode, "Id");
+        rPanelDescriptor.msDeckId = getString(aPanelNode, "DeckId");
+        rPanelDescriptor.msTitleBarIconURL = getString(aPanelNode, "TitleBarIconURL");
+        rPanelDescriptor.msHighContrastTitleBarIconURL = getString(aPanelNode, "HighContrastTitleBarIconURL");
+        rPanelDescriptor.msHelpURL = getString(aPanelNode, "HelpURL");
+        rPanelDescriptor.msImplementationURL = getString(aPanelNode, "ImplementationURL");
+        rPanelDescriptor.mnOrderIndex = getInt32(aPanelNode, "OrderIndex");
+        rPanelDescriptor.mbShowForReadOnlyDocuments = getBool(aPanelNode, "ShowForReadOnlyDocument");
+        rPanelDescriptor.mbWantsCanvas = getBool(aPanelNode, "WantsCanvas");
+        rPanelDescriptor.mbExperimental = getBool(aPanelNode, "IsExperimental");
+        const OUString sDefaultMenuCommand(getString(aPanelNode, "DefaultMenuCommand"));
 
         ReadContextList(aPanelNode, rPanelDescriptor.maContextList, sDefaultMenuCommand);
     }
@@ -474,26 +470,26 @@ void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
           continue;
 
         DeckDescriptor& rDeckDescriptor (maDecks[nDeckWriteIndex++]);
-        rDeckDescriptor.msTitle = ::comphelper::getString(aChildNode.getNodeValue("UIName"));
+        rDeckDescriptor.msTitle = getString(aChildNode, "UIName");
         rDeckDescriptor.msId = rsNodeName;
-        rDeckDescriptor.msIconURL = ::comphelper::getString(aChildNode.getNodeValue("ImageURL"));
+        rDeckDescriptor.msIconURL = getString(aChildNode, "ImageURL");
         rDeckDescriptor.msHighContrastIconURL = rDeckDescriptor.msIconURL;
         rDeckDescriptor.msTitleBarIconURL.clear();
         rDeckDescriptor.msHighContrastTitleBarIconURL.clear();
-        rDeckDescriptor.msHelpURL = ::comphelper::getString(aChildNode.getNodeValue("HelpURL"));
+        rDeckDescriptor.msHelpURL = getString(aChildNode, "HelpURL");
         rDeckDescriptor.msHelpText = rDeckDescriptor.msTitle;
         rDeckDescriptor.mbIsEnabled = true;
         rDeckDescriptor.mnOrderIndex = 100000 + nReadIndex;
         rDeckDescriptor.maContextList.AddContextDescription(Context(sModuleName, OUString("any")), true, OUString());
 
         PanelDescriptor& rPanelDescriptor (maPanels[nPanelWriteIndex++]);
-        rPanelDescriptor.msTitle = ::comphelper::getString(aChildNode.getNodeValue("UIName"));
+        rPanelDescriptor.msTitle = getString(aChildNode, "UIName");
         rPanelDescriptor.mbIsTitleBarOptional = true;
         rPanelDescriptor.msId = rsNodeName;
         rPanelDescriptor.msDeckId = rsNodeName;
         rPanelDescriptor.msTitleBarIconURL.clear();
         rPanelDescriptor.msHighContrastTitleBarIconURL.clear();
-        rPanelDescriptor.msHelpURL = ::comphelper::getString(aChildNode.getNodeValue("HelpURL"));
+        rPanelDescriptor.msHelpURL = getString(aChildNode, "HelpURL");
         rPanelDescriptor.msImplementationURL = rsNodeName;
         rPanelDescriptor.mnOrderIndex = 100000 + nReadIndex;
         rPanelDescriptor.mbShowForReadOnlyDocuments = false;
commit 9a2fc94475d899c7d5e793de89a7e52a2301ae04
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Apr 21 17:53:47 2015 +0900

    cleanup ResourceManager
    
    Change-Id: Ic07e0a9eb72fc78c23d65c82420daa57dbeb44f7

diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index b998e24..cb4d715 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -32,7 +32,6 @@
 
 #include <map>
 
-using ::rtl::OUString;
 using namespace css;
 using namespace css::uno;
 
@@ -56,18 +55,12 @@ ResourceManager::ResourceManager()
 
 ResourceManager::~ResourceManager()
 {
-    maPanels.clear();
-    maDecks.clear();
 }
 
-const DeckDescriptor* ResourceManager::GetDeckDescriptor (
-    const ::rtl::OUString& rsDeckId) const
+const DeckDescriptor* ResourceManager::GetDeckDescriptor(const OUString& rsDeckId) const
 {
-    for (DeckContainer::const_iterator
-             iDeck(maDecks.begin()),
-             iEnd(maDecks.end());
-         iDeck!=iEnd;
-         ++iDeck)
+    DeckContainer::const_iterator iDeck;
+    for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
     {
         if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
             continue;
@@ -77,14 +70,10 @@ const DeckDescriptor* ResourceManager::GetDeckDescriptor (
     return NULL;
 }
 
-const PanelDescriptor* ResourceManager::GetPanelDescriptor (
-    const ::rtl::OUString& rsPanelId) const
+const PanelDescriptor* ResourceManager::GetPanelDescriptor(const OUString& rsPanelId) const
 {
-    for (PanelContainer::const_iterator
-             iPanel(maPanels.begin()),
-             iEnd(maPanels.end());
-         iPanel!=iEnd;
-         ++iPanel)
+    PanelContainer::const_iterator iPanel;
+    for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
     {
         if (iPanel->msId.equals(rsPanelId))
             return &*iPanel;
@@ -92,15 +81,10 @@ const PanelDescriptor* ResourceManager::GetPanelDescriptor (
     return NULL;
 }
 
-void ResourceManager::SetIsDeckEnabled (
-    const ::rtl::OUString& rsDeckId,
-    const bool bIsEnabled)
+void ResourceManager::SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsEnabled)
 {
-    for (DeckContainer::iterator
-             iDeck(maDecks.begin()),
-             iEnd(maDecks.end());
-         iDeck!=iEnd;
-         ++iDeck)
+    DeckContainer::iterator iDeck;
+    for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
     {
         if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
             continue;
@@ -113,19 +97,16 @@ void ResourceManager::SetIsDeckEnabled (
 }
 
 const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatchingDecks (
-    DeckContextDescriptorContainer& rDecks,
-    const Context& rContext,
-    const bool bIsDocumentReadOnly,
-    const Reference<frame::XFrame>& rxFrame)
+                                                            DeckContextDescriptorContainer& rDecks,
+                                                            const Context& rContext,
+                                                            const bool bIsDocumentReadOnly,
+                                                            const Reference<frame::XFrame>& rxFrame)
 {
     ReadLegacyAddons(rxFrame);
 
-    ::std::multimap<sal_Int32,DeckContextDescriptor> aOrderedIds;
-    for (DeckContainer::const_iterator
-             iDeck(maDecks.begin()),
-             iEnd (maDecks.end());
-         iDeck!=iEnd;
-         ++iDeck)
+    std::multimap<sal_Int32,DeckContextDescriptor> aOrderedIds;
+    DeckContainer::const_iterator iDeck;
+    for (iDeck = maDecks.begin(); iDeck != maDecks.end(); ++iDeck)
     {
         if (iDeck->mbExperimental && !maMiscOptions.IsExperimentalMode())
             continue;
@@ -142,11 +123,8 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch
                 aDeckContextDescriptor));
     }
 
-    for (::std::multimap<sal_Int32,DeckContextDescriptor>::const_iterator
-             iId(aOrderedIds.begin()),
-             iEnd(aOrderedIds.end());
-         iId!=iEnd;
-         ++iId)
+    std::multimap<sal_Int32,DeckContextDescriptor>::const_iterator iId;
+    for (iId = aOrderedIds.begin(); iId != aOrderedIds.end(); ++iId)
     {
         rDecks.push_back(iId->second);
     }
@@ -155,19 +133,16 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch
 }
 
 const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatchingPanels (
-    PanelContextDescriptorContainer& rPanelIds,
-    const Context& rContext,
-    const ::rtl::OUString& rsDeckId,
-    const Reference<frame::XFrame>& rxFrame)
+                                                            PanelContextDescriptorContainer& rPanelIds,
+                                                            const Context& rContext,
+                                                            const OUString& rsDeckId,
+                                                            const Reference<frame::XFrame>& rxFrame)
 {
     ReadLegacyAddons(rxFrame);
 
-    ::std::multimap<sal_Int32,PanelContextDescriptor> aOrderedIds;
-    for (PanelContainer::const_iterator
-             iPanel(maPanels.begin()),
-             iEnd(maPanels.end());
-         iPanel!=iEnd;
-         ++iPanel)
+    std::multimap<sal_Int32, PanelContextDescriptor> aOrderedIds;
+    PanelContainer::const_iterator iPanel;
+    for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
     {
         const PanelDescriptor& rPanelDescriptor (*iPanel);
         if (rPanelDescriptor.mbExperimental && !maMiscOptions.IsExperimentalMode())
@@ -184,16 +159,13 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc
         aPanelContextDescriptor.msMenuCommand = pEntry->msMenuCommand;
         aPanelContextDescriptor.mbIsInitiallyVisible = pEntry->mbIsInitiallyVisible;
         aPanelContextDescriptor.mbShowForReadOnlyDocuments = rPanelDescriptor.mbShowForReadOnlyDocuments;
-        aOrderedIds.insert(::std::multimap<sal_Int32,PanelContextDescriptor>::value_type(
-                rPanelDescriptor.mnOrderIndex,
-                aPanelContextDescriptor));
+        aOrderedIds.insert(std::multimap<sal_Int32, PanelContextDescriptor>::value_type(
+                                                    rPanelDescriptor.mnOrderIndex,
+                                                    aPanelContextDescriptor));
     }
 
-    for (::std::multimap<sal_Int32,PanelContextDescriptor>::const_iterator
-             iId(aOrderedIds.begin()),
-             iEnd(aOrderedIds.end());
-         iId!=iEnd;
-         ++iId)
+    std::multimap<sal_Int32,PanelContextDescriptor>::const_iterator iId;
+    for (iId = aOrderedIds.begin(); iId != aOrderedIds.end(); ++iId)
     {
         rPanelIds.push_back(iId->second);
     }
@@ -203,21 +175,21 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc
 
 void ResourceManager::ReadDeckList()
 {
-    const ::utl::OConfigurationTreeRoot aDeckRootNode (
-        ::comphelper::getProcessComponentContext(),
-        OUString("org.openoffice.Office.UI.Sidebar/Content/DeckList"),
-        false);
-    if ( ! aDeckRootNode.isValid() )
+    const utl::OConfigurationTreeRoot aDeckRootNode(
+                                        comphelper::getProcessComponentContext(),
+                                        OUString("org.openoffice.Office.UI.Sidebar/Content/DeckList"),
+                                        false);
+    if (!aDeckRootNode.isValid())
         return;
 
     const Sequence<OUString> aDeckNodeNames (aDeckRootNode.getNodeNames());
-    const sal_Int32 nCount (aDeckNodeNames.getLength());
+    const sal_Int32 nCount(aDeckNodeNames.getLength());
     maDecks.resize(nCount);
     sal_Int32 nWriteIndex(0);
     for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
     {
-        const ::utl::OConfigurationNode aDeckNode (aDeckRootNode.openNode(aDeckNodeNames[nReadIndex]));
-        if ( ! aDeckNode.isValid())
+        const utl::OConfigurationNode aDeckNode(aDeckRootNode.openNode(aDeckNodeNames[nReadIndex]));
+        if (!aDeckNode.isValid())
             continue;
 
         DeckDescriptor& rDeckDescriptor (maDecks[nWriteIndex++]);
@@ -257,11 +229,11 @@ void ResourceManager::ReadDeckList()
 
 void ResourceManager::ReadPanelList()
 {
-    const ::utl::OConfigurationTreeRoot aPanelRootNode (
-        ::comphelper::getProcessComponentContext(),
-        OUString("org.openoffice.Office.UI.Sidebar/Content/PanelList"),
-        false);
-    if ( ! aPanelRootNode.isValid() )
+    const utl::OConfigurationTreeRoot aPanelRootNode(
+                                        comphelper::getProcessComponentContext(),
+                                        OUString("org.openoffice.Office.UI.Sidebar/Content/PanelList"),
+                                        false);
+    if (!aPanelRootNode.isValid())
         return;
 
     const Sequence<OUString> aPanelNodeNames (aPanelRootNode.getNodeNames());
@@ -270,8 +242,8 @@ void ResourceManager::ReadPanelList()
     sal_Int32 nWriteIndex (0);
     for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
     {
-        const ::utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(aPanelNodeNames[nReadIndex]));
-        if ( ! aPanelNode.isValid())
+        const utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(aPanelNodeNames[nReadIndex]));
+        if (!aPanelNode.isValid())
             continue;
 
         PanelDescriptor& rPanelDescriptor (maPanels[nWriteIndex++]);
@@ -303,10 +275,7 @@ void ResourceManager::ReadPanelList()
         const OUString sDefaultMenuCommand (::comphelper::getString(
                 aPanelNode.getNodeValue("DefaultMenuCommand")));
 
-        ReadContextList(
-            aPanelNode,
-            rPanelDescriptor.maContextList,
-            sDefaultMenuCommand);
+        ReadContextList(aPanelNode, rPanelDescriptor.maContextList, sDefaultMenuCommand);
     }
 
     // When there where invalid nodes then we have to adapt the size
@@ -316,9 +285,9 @@ void ResourceManager::ReadPanelList()
 }
 
 void ResourceManager::ReadContextList (
-    const ::utl::OConfigurationNode& rParentNode,
-    ContextList& rContextList,
-    const OUString& rsDefaultMenuCommand) const
+                        const utl::OConfigurationNode& rParentNode,
+                        ContextList& rContextList,
+                        const OUString& rsDefaultMenuCommand) const
 {
     const Any aValue = rParentNode.getNodeValue("ContextList");
     Sequence<OUString> aValues;
@@ -349,22 +318,23 @@ void ResourceManager::ReadContextList (
             }
         }
 
-        const OUString sContextName (sValue.getToken(0, ',', nCharacterIndex).trim());
+        const OUString sContextName(sValue.getToken(0, ',', nCharacterIndex).trim());
         if (nCharacterIndex < 0)
         {
             OSL_FAIL("expecting three or four values per ContextList entry, separated by comma");
             continue;
         }
 
-        const OUString sInitialState (sValue.getToken(0, ',', nCharacterIndex).trim());
+        const OUString sInitialState(sValue.getToken(0, ',', nCharacterIndex).trim());
 
         // The fourth argument is optional.
-        const OUString sMenuCommandOverride (
-            nCharacterIndex<0
+        const OUString sMenuCommandOverride(
+            nCharacterIndex < 0
                 ? OUString()
                 : sValue.getToken(0, ',', nCharacterIndex).trim());
-        const OUString sMenuCommand (
-            sMenuCommandOverride.getLength()>0
+
+        const OUString sMenuCommand(
+            sMenuCommandOverride.getLength() > 0
                 ? (sMenuCommandOverride == "none"
                     ? OUString()
                     : sMenuCommandOverride)
@@ -374,7 +344,7 @@ void ResourceManager::ReadContextList (
         // application name may result in more than one value (eg
         // DrawImpress will result in two enums, one for Draw and one
         // for Impress).
-        ::std::vector<EnumContext::Application> aApplications;
+        std::vector<EnumContext::Application> aApplications;
         EnumContext::Application eApplication (EnumContext::GetApplicationEnum(sApplicationName));
         if (eApplication == EnumContext::Application_None
             && !sApplicationName.equals(EnumContext::GetApplicationName(EnumContext::Application_None)))
@@ -442,19 +412,18 @@ void ResourceManager::ReadContextList (
         }
 
         // Add context descriptors.
-        for (::std::vector<EnumContext::Application>::const_iterator
-                 iApplication(aApplications.begin()),
-                 iEnd(aApplications.end());
-             iApplication!=iEnd;
-             ++iApplication)
+        std::vector<EnumContext::Application>::const_iterator iApplication;
+        for (iApplication = aApplications.begin(); iApplication != aApplications.end(); ++iApplication)
         {
             if (*iApplication != EnumContext::Application_None)
+            {
                 rContextList.AddContextDescription(
                     Context(
                         EnumContext::GetApplicationName(*iApplication),
                         EnumContext::GetContextName(eContext)),
                     bIsInitiallyVisible,
                     sMenuCommand);
+            }
         }
     }
 }
@@ -462,7 +431,7 @@ void ResourceManager::ReadContextList (
 void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
 {
     // Get module name for given frame.
-    ::rtl::OUString sModuleName (Tools::GetModuleName(rxFrame));
+    OUString sModuleName (Tools::GetModuleName(rxFrame));
     if (sModuleName.getLength() == 0)
         return;
     if (maProcessedApplications.find(sModuleName) != maProcessedApplications.end())
@@ -478,12 +447,12 @@ void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
     maProcessedApplications.insert(sModuleName);
 
     // Get access to the configuration root node for the application.
-    ::utl::OConfigurationTreeRoot aLegacyRootNode (GetLegacyAddonRootNode(sModuleName));
-    if ( ! aLegacyRootNode.isValid())
+    utl::OConfigurationTreeRoot aLegacyRootNode (GetLegacyAddonRootNode(sModuleName));
+    if (!aLegacyRootNode.isValid())
         return;
 
     // Process child nodes.
-    ::std::vector<OUString> aMatchingNodeNames;
+    std::vector<OUString> aMatchingNodeNames;
     GetToolPanelNodeNames(aMatchingNodeNames, aLegacyRootNode);
     const sal_Int32 nCount (aMatchingNodeNames.size());
     size_t nDeckWriteIndex (maDecks.size());
@@ -493,8 +462,8 @@ void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
     for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
     {
         const OUString& rsNodeName (aMatchingNodeNames[nReadIndex]);
-        const ::utl::OConfigurationNode aChildNode (aLegacyRootNode.openNode(rsNodeName));
-        if ( ! aChildNode.isValid())
+        const utl::OConfigurationNode aChildNode (aLegacyRootNode.openNode(rsNodeName));
+        if (!aChildNode.isValid())
             continue;
 
         if ( rsNodeName == "private:resource/toolpanel/DrawingFramework/CustomAnimations" ||
@@ -541,58 +510,51 @@ void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
 }
 
 void ResourceManager::StorePanelExpansionState (
-    const ::rtl::OUString& rsPanelId,
-    const bool bExpansionState,
-    const Context& rContext)
+                        const OUString& rsPanelId,
+                        const bool bExpansionState,
+                        const Context& rContext)
 {
-    for (PanelContainer::iterator
-             iPanel(maPanels.begin()),
-             iEnd(maPanels.end());
-         iPanel!=iEnd;
-         ++iPanel)
+    PanelContainer::iterator iPanel;
+    for (iPanel = maPanels.begin(); iPanel != maPanels.end(); ++iPanel)
     {
         if (iPanel->msId.equals(rsPanelId))
         {
-            ContextList::Entry* pEntry (
-                iPanel->maContextList.GetMatch (rContext));
+            ContextList::Entry* pEntry(iPanel->maContextList.GetMatch(rContext));
             if (pEntry != NULL)
                 pEntry->mbIsInitiallyVisible = bExpansionState;
         }
     }
 }
 
-::utl::OConfigurationTreeRoot ResourceManager::GetLegacyAddonRootNode (
-    const ::rtl::OUString& rsModuleName) const
+utl::OConfigurationTreeRoot ResourceManager::GetLegacyAddonRootNode (const OUString& rsModuleName) const
 {
     try
     {
-        const Reference<XComponentContext> xContext (::comphelper::getProcessComponentContext() );
-        const Reference<frame::XModuleManager2> xModuleAccess =
-            frame::ModuleManager::create( xContext );
-        const ::comphelper::NamedValueCollection aModuleProperties (xModuleAccess->getByName(rsModuleName));
-        const ::rtl::OUString sWindowStateRef (aModuleProperties.getOrDefault(
-                "ooSetupFactoryWindowStateConfigRef",
-                ::rtl::OUString()));
-
-        ::rtl::OUStringBuffer aPathComposer;
+        const Reference<XComponentContext> xContext(comphelper::getProcessComponentContext());
+        const Reference<frame::XModuleManager2> xModuleAccess = frame::ModuleManager::create(xContext);
+        const comphelper::NamedValueCollection aModuleProperties(xModuleAccess->getByName(rsModuleName));
+        const OUString sWindowStateRef(aModuleProperties.getOrDefault(
+                                       "ooSetupFactoryWindowStateConfigRef",
+                                       OUString()));
+
+        OUStringBuffer aPathComposer;
         aPathComposer.appendAscii("org.openoffice.Office.UI.");
         aPathComposer.append(sWindowStateRef);
         aPathComposer.appendAscii("/UIElements/States");
 
-        return ::utl::OConfigurationTreeRoot(xContext,
-            aPathComposer.makeStringAndClear(), false);
+        return utl::OConfigurationTreeRoot(xContext, aPathComposer.makeStringAndClear(), false);
     }
-    catch( const Exception& )
+    catch (const Exception&)
     {
         DBG_UNHANDLED_EXCEPTION();
     }
 
-    return ::utl::OConfigurationTreeRoot();
+    return utl::OConfigurationTreeRoot();
 }
 
 void ResourceManager::GetToolPanelNodeNames (
-    ::std::vector<OUString>& rMatchingNames,
-    const ::utl::OConfigurationTreeRoot& aRoot) const
+                        std::vector<OUString>& rMatchingNames,
+                        const utl::OConfigurationTreeRoot& aRoot) const
 {
     Sequence<OUString> aChildNodeNames (aRoot.getNodeNames());
     const sal_Int32 nCount (aChildNodeNames.getLength());
@@ -604,24 +566,18 @@ void ResourceManager::GetToolPanelNodeNames (
 }
 
 bool ResourceManager::IsDeckEnabled (
-    const OUString& rsDeckId,
-    const Context& rContext,
-    const Reference<frame::XFrame>& rxFrame) const
+                        const OUString& rsDeckId,
+                        const Context& rContext,
+                        const Reference<frame::XFrame>& rxFrame) const
 {
     // Check if any panel that matches the current context can be
     // displayed.
     ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
-    ResourceManager::Instance().GetMatchingPanels(
-        aPanelContextDescriptors,
-        rContext,
-        rsDeckId,
-        rxFrame);
-
-    for (ResourceManager::PanelContextDescriptorContainer::const_iterator
-             iPanel(aPanelContextDescriptors.begin()),
-             iEnd(aPanelContextDescriptors.end());
-         iPanel!=iEnd;
-         ++iPanel)
+    ResourceManager::Instance().GetMatchingPanels(aPanelContextDescriptors,
+                                                  rContext, rsDeckId, rxFrame);
+
+    ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel;
+    for (iPanel = aPanelContextDescriptors.begin(); iPanel != aPanelContextDescriptors.end(); ++iPanel)
     {
         if (iPanel->mbShowForReadOnlyDocuments)
             return true;
diff --git a/sfx2/source/sidebar/ResourceManager.hxx b/sfx2/source/sidebar/ResourceManager.hxx
index a358271..560793f 100644
--- a/sfx2/source/sidebar/ResourceManager.hxx
+++ b/sfx2/source/sidebar/ResourceManager.hxx
@@ -42,10 +42,8 @@ class ResourceManager
 public:
     static ResourceManager& Instance();
 
-    const DeckDescriptor* GetDeckDescriptor (
-        const ::rtl::OUString& rsDeckId) const;
-    const PanelDescriptor* GetPanelDescriptor (
-        const ::rtl::OUString& rsPanelId) const;
+    const DeckDescriptor* GetDeckDescriptor(const OUString& rsDeckId) const;
+    const PanelDescriptor* GetPanelDescriptor(const OUString& rsPanelId) const;
 
     /** Excluded or include a deck from being displayed in the tab
         bar.
@@ -54,77 +52,70 @@ public:
         because the ResourceManager gives access to them only
         read-only.
     */
-    void SetIsDeckEnabled (
-        const ::rtl::OUString& rsDeckId,
-        const bool bIsEnabled);
+    void SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsEnabled);
 
     class DeckContextDescriptor
     {
     public:
-        ::rtl::OUString msId;
+        OUString msId;
         bool mbIsEnabled;
     };
-    typedef ::std::vector<DeckContextDescriptor> DeckContextDescriptorContainer;
+    typedef std::vector<DeckContextDescriptor> DeckContextDescriptorContainer;
 
     class PanelContextDescriptor
     {
     public:
-        ::rtl::OUString msId;
-        ::rtl::OUString msMenuCommand;
+        OUString msId;
+        OUString msMenuCommand;
         bool mbIsInitiallyVisible;
         bool mbShowForReadOnlyDocuments;
     };
-    typedef ::std::vector<PanelContextDescriptor> PanelContextDescriptorContainer;
+    typedef std::vector<PanelContextDescriptor> PanelContextDescriptorContainer;
 
-    const DeckContextDescriptorContainer& GetMatchingDecks (
-        DeckContextDescriptorContainer& rDeckDescriptors,
-        const Context& rContext,
-        const bool bIsDocumentReadOnly,
-        const css::uno::Reference<css::frame::XFrame>& rxFrame);
+    const DeckContextDescriptorContainer& GetMatchingDecks(
+                                            DeckContextDescriptorContainer& rDeckDescriptors,
+                                            const Context& rContext,
+                                            const bool bIsDocumentReadOnly,
+                                            const css::uno::Reference<css::frame::XFrame>& rxFrame);
 
-    const PanelContextDescriptorContainer& GetMatchingPanels (
-        PanelContextDescriptorContainer& rPanelDescriptors,
-        const Context& rContext,
-        const ::rtl::OUString& rsDeckId,
-        const css::uno::Reference<css::frame::XFrame>& rxFrame);
+    const PanelContextDescriptorContainer& GetMatchingPanels(
+                                            PanelContextDescriptorContainer& rPanelDescriptors,
+                                            const Context& rContext,
+                                            const OUString& rsDeckId,
+                                            const css::uno::Reference<css::frame::XFrame>& rxFrame);
 
     /** Remember the expansions state per panel and context.
         This is not persistent past application end.
     */
-    void StorePanelExpansionState (
-        const ::rtl::OUString& rsPanelId,
-        const bool bExpansionState,
-        const Context& rContext);
+    void StorePanelExpansionState(const OUString& rsPanelId,
+                                  const bool bExpansionState,
+                                  const Context& rContext);
 
 private:
     ResourceManager();
     ~ResourceManager();
 
-    typedef ::std::vector<DeckDescriptor> DeckContainer;
+    typedef std::vector<DeckDescriptor> DeckContainer;
     DeckContainer maDecks;
-    typedef ::std::vector<PanelDescriptor> PanelContainer;
+
+    typedef std::vector<PanelDescriptor> PanelContainer;
     PanelContainer maPanels;
-    mutable ::std::set<rtl::OUString> maProcessedApplications;
+    mutable std::set<rtl::OUString> maProcessedApplications;
 
     SvtMiscOptions maMiscOptions;
 
     void ReadDeckList();
     void ReadPanelList();
-    void ReadContextList (
-        const ::utl::OConfigurationNode& rNode,
-        ContextList& rContextList,
-        const ::rtl::OUString& rsDefaultMenuCommand) const;
-    void ReadLegacyAddons (
-        const css::uno::Reference<css::frame::XFrame>& rxFrame);
-    ::utl::OConfigurationTreeRoot GetLegacyAddonRootNode (
-        const ::rtl::OUString& rsModuleName) const;
-    void GetToolPanelNodeNames (
-        ::std::vector<rtl::OUString>& rMatchingNames,
-        const ::utl::OConfigurationTreeRoot& aRoot) const;
-    bool IsDeckEnabled (
-        const ::rtl::OUString& rsDeckId,
-        const Context& rContext,
-        const css::uno::Reference<css::frame::XFrame>& rxFrame) const;
+    void ReadContextList(const utl::OConfigurationNode& rNode,
+                         ContextList& rContextList,
+                         const OUString& rsDefaultMenuCommand) const;
+    void ReadLegacyAddons(const css::uno::Reference<css::frame::XFrame>& rxFrame);
+    utl::OConfigurationTreeRoot GetLegacyAddonRootNode(const OUString& rsModuleName) const;
+    void GetToolPanelNodeNames(std::vector<OUString>& rMatchingNames,
+                               const utl::OConfigurationTreeRoot& aRoot) const;
+    bool IsDeckEnabled(const OUString& rsDeckId,
+                       const Context& rContext,
+                       const css::uno::Reference<css::frame::XFrame>& rxFrame) const;
 };
 
 } } // end of namespace sfx2::sidebar


More information about the Libreoffice-commits mailing list