[Libreoffice-commits] core.git: sd/source sfx2/source shell/inc shell/source

Arkadiy Illarionov qarkai at gmail.com
Sat Jun 23 11:13:35 UTC 2018


 sd/source/ui/animations/SlideTransitionPane.cxx           |    6 -
 sd/source/ui/inc/SlideTransitionPane.hxx                  |    3 
 sd/source/ui/sidebar/MasterPageObserver.cxx               |   17 +---
 sd/source/ui/view/ToolBarManager.cxx                      |   48 +++++---------
 sfx2/source/dialog/filtergrouping.cxx                     |   10 +-
 shell/inc/types.hxx                                       |    2 
 shell/source/tools/lngconvex/lngconvex.cxx                |   12 +--
 shell/source/unix/sysshell/recently_used_file_handler.cxx |   16 ++--
 shell/source/win32/ooofilereader/keywordstag.cxx          |    4 -
 shell/source/win32/ooofilereader/keywordstag.hxx          |    2 
 shell/source/win32/simplemail/senddoc.cxx                 |    7 --
 11 files changed, 52 insertions(+), 75 deletions(-)

New commits:
commit 6441c2f2e20bc424c6a4cd1c2d704710e4d80346
Author: Arkadiy Illarionov <qarkai at gmail.com>
Date:   Wed Jun 20 22:40:45 2018 +0300

    tdf#96099 Remove trivial std::vector typedefs in sd, sfx2, shell
    
    Change-Id: Ib3708c9650f273de4a2f549d2ce9f2465bd37d6c
    Reviewed-on: https://gerrit.libreoffice.org/56206
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index cd51f1cf36a9..fe555039409e 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -662,7 +662,7 @@ void SlideTransitionPane::updateControls()
         }
         else if( aEffect.mbSoundOn && !aEffect.maSound.isEmpty() )
         {
-            tSoundListType::size_type nPos = 0;
+            std::vector<OUString>::size_type nPos = 0;
             if( lcl_findSoundInList( maSoundList, aEffect.maSound, nPos ))
             {
                 mpLB_SOUND->SelectEntryPos( nPos + 3 );
@@ -747,7 +747,7 @@ void SlideTransitionPane::openSoundFileDialog()
            aFileDialog.Execute() == ERRCODE_NONE )
     {
         OUString aFile = aFileDialog.GetPath();
-        tSoundListType::size_type nPos = 0;
+        std::vector<OUString>::size_type nPos = 0;
         bValidSoundFile = lcl_findSoundInList( maSoundList, aFile, nPos );
 
         if( bValidSoundFile )
@@ -789,7 +789,7 @@ void SlideTransitionPane::openSoundFileDialog()
     {
         if( !maCurrentSoundFile.isEmpty() )
         {
-            tSoundListType::size_type nPos = 0;
+            std::vector<OUString>::size_type nPos = 0;
             if( lcl_findSoundInList( maSoundList, maCurrentSoundFile, nPos ))
                 mpLB_SOUND->SelectEntryPos( nPos + 3 );
             else
diff --git a/sd/source/ui/inc/SlideTransitionPane.hxx b/sd/source/ui/inc/SlideTransitionPane.hxx
index 106e50da4980..f3cdb048ba18 100644
--- a/sd/source/ui/inc/SlideTransitionPane.hxx
+++ b/sd/source/ui/inc/SlideTransitionPane.hxx
@@ -136,8 +136,7 @@ private:
     bool         mbIsMainViewChangePending;
     bool         mbHorizontalLayout;
 
-    typedef ::std::vector< OUString > tSoundListType;
-    tSoundListType  maSoundList;
+    std::vector<OUString>  maSoundList;
     mutable OUString maCurrentSoundFile;
 
     // How many variants each transition set has
diff --git a/sd/source/ui/sidebar/MasterPageObserver.cxx b/sd/source/ui/sidebar/MasterPageObserver.cxx
index c6fa9dc227fb..341c02cb090d 100644
--- a/sd/source/ui/sidebar/MasterPageObserver.cxx
+++ b/sd/source/ui/sidebar/MasterPageObserver.cxx
@@ -266,25 +266,20 @@ void MasterPageObserver::Implementation::AnalyzeUsedMasterPages (
             aCurrentMasterPages.insert (pMasterPage->GetName());
     }
 
-    typedef ::std::vector<OUString> StringList;
-    StringList aNewMasterPages;
-    StringList aRemovedMasterPages;
+    std::vector<OUString> aNewMasterPages;
+    std::vector<OUString> aRemovedMasterPages;
     MasterPageContainer::iterator aOldMasterPagesDescriptor (
         maUsedMasterPages.find(&rDocument));
     if (aOldMasterPagesDescriptor != maUsedMasterPages.end())
     {
-        StringList::iterator I;
-
-        ::std::set<OUString>::iterator J;
-
         // Send events about the newly used master pages.
         ::std::set_difference (
             aCurrentMasterPages.begin(),
             aCurrentMasterPages.end(),
             aOldMasterPagesDescriptor->second.begin(),
             aOldMasterPagesDescriptor->second.end(),
-            ::std::back_insert_iterator<StringList>(aNewMasterPages));
-        for (I=aNewMasterPages.begin(); I!=aNewMasterPages.end(); ++I)
+            std::back_inserter(aNewMasterPages));
+        for (auto I=aNewMasterPages.begin(); I!=aNewMasterPages.end(); ++I)
         {
             MasterPageObserverEvent aEvent (
                 MasterPageObserverEvent::ET_MASTER_PAGE_ADDED,
@@ -298,8 +293,8 @@ void MasterPageObserver::Implementation::AnalyzeUsedMasterPages (
             aOldMasterPagesDescriptor->second.end(),
             aCurrentMasterPages.begin(),
             aCurrentMasterPages.end(),
-            ::std::back_insert_iterator<StringList>(aRemovedMasterPages));
-        for (I=aRemovedMasterPages.begin(); I!=aRemovedMasterPages.end(); ++I)
+            std::back_inserter(aRemovedMasterPages));
+        for (auto I=aRemovedMasterPages.begin(); I!=aRemovedMasterPages.end(); ++I)
         {
             MasterPageObserverEvent aEvent (
                 MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED,
diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx
index 91db27743b2a..6b0c77231b15 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -68,8 +68,6 @@ private:
     Reference<frame::XLayoutManager> mxLayouter;
 };
 
-typedef ::std::vector<OUString> NameList;
-
 /** Store a list of tool bars for each of the tool bar groups.  From
     this the list of requested tool bars is built.
 */
@@ -82,19 +80,19 @@ public:
     void AddToolBar (sd::ToolBarManager::ToolBarGroup eGroup, const OUString& rsName);
     bool RemoveToolBar (sd::ToolBarManager::ToolBarGroup eGroup, const OUString& rsName);
 
-    void GetToolBarsToActivate (NameList& rToolBars) const;
-    void GetToolBarsToDeactivate (NameList& rToolBars) const;
+    void GetToolBarsToActivate (std::vector<OUString>& rToolBars) const;
+    void GetToolBarsToDeactivate (std::vector<OUString>& rToolBars) const;
 
     void MarkToolBarAsActive (const OUString& rsName);
     void MarkToolBarAsNotActive (const OUString& rsName);
     void MarkAllToolBarsAsNotActive();
 
 private:
-    typedef ::std::map<sd::ToolBarManager::ToolBarGroup,NameList> Groups;
+    typedef ::std::map<sd::ToolBarManager::ToolBarGroup, std::vector<OUString> > Groups;
     Groups maGroups;
-    NameList maActiveToolBars;
+    std::vector<OUString> maActiveToolBars;
 
-    void MakeRequestedToolBarList (NameList& rToolBars) const;
+    void MakeRequestedToolBarList (std::vector<OUString>& rToolBars) const;
 };
 
 /** Manage tool bars that are implemented as sub shells of a view shell.
@@ -682,12 +680,11 @@ void ToolBarManager::Implementation::PreUpdate()
 
         // Get the list of tool bars that are not used anymore and are to be
         // deactivated.
-        NameList aToolBars;
+        std::vector<OUString> aToolBars;
         maToolBarList.GetToolBarsToDeactivate(aToolBars);
 
         // Turn off the tool bars.
-        NameList::const_iterator iToolBar;
-        for (iToolBar=aToolBars.begin(); iToolBar!=aToolBars.end(); ++iToolBar)
+        for (auto iToolBar=aToolBars.cbegin(); iToolBar!=aToolBars.cend(); ++iToolBar)
         {
             OUString sFullName (GetToolBarResourceName(*iToolBar));
             SAL_INFO("sd.view", OSL_THIS_FUNC << ":    turning off tool bar " << sFullName);
@@ -710,14 +707,13 @@ void ToolBarManager::Implementation::PostUpdate()
         mbPostUpdatePending = false;
 
         // Create the list of requested tool bars.
-        NameList aToolBars;
+        std::vector<OUString> aToolBars;
         maToolBarList.GetToolBarsToActivate(aToolBars);
 
         SAL_INFO("sd.view", OSL_THIS_FUNC << ": ToolBarManager::PostUpdate [");
 
         // Turn on the tool bars that are visible in the new context.
-        NameList::const_iterator iToolBar;
-        for (iToolBar=aToolBars.begin(); iToolBar!=aToolBars.end(); ++iToolBar)
+        for (auto iToolBar=aToolBars.cbegin(); iToolBar!=aToolBars.cend(); ++iToolBar)
         {
             OUString sFullName (GetToolBarResourceName(*iToolBar));
             SAL_INFO("sd.view", OSL_THIS_FUNC << ":    turning on tool bar " << sFullName);
@@ -1220,13 +1216,12 @@ void ToolBarList::AddToolBar (
 {
     Groups::iterator iGroup (maGroups.find(eGroup));
     if (iGroup == maGroups.end())
-        iGroup = maGroups.emplace(eGroup,NameList()).first;
+        iGroup = maGroups.emplace(eGroup,std::vector<OUString>()).first;
 
     if (iGroup != maGroups.end())
     {
-        NameList::const_iterator iBar (
-            ::std::find(iGroup->second.begin(),iGroup->second.end(),rsName));
-        if (iBar == iGroup->second.end())
+        auto iBar (std::find(iGroup->second.cbegin(),iGroup->second.cend(),rsName));
+        if (iBar == iGroup->second.cend())
         {
             iGroup->second.push_back(rsName);
         }
@@ -1240,8 +1235,7 @@ bool ToolBarList::RemoveToolBar (
     Groups::iterator iGroup (maGroups.find(eGroup));
     if (iGroup != maGroups.end())
     {
-        NameList::iterator iBar (
-            ::std::find(iGroup->second.begin(),iGroup->second.end(),rsName));
+        auto iBar (std::find(iGroup->second.begin(),iGroup->second.end(),rsName));
         if (iBar != iGroup->second.end())
         {
             iGroup->second.erase(iBar);
@@ -1251,7 +1245,7 @@ bool ToolBarList::RemoveToolBar (
     return false;
 }
 
-void ToolBarList::MakeRequestedToolBarList (NameList& rRequestedToolBars) const
+void ToolBarList::MakeRequestedToolBarList (std::vector<OUString>& rRequestedToolBars) const
 {
     for (auto eGroup : o3tl::enumrange<sd::ToolBarManager::ToolBarGroup>())
     {
@@ -1264,13 +1258,12 @@ void ToolBarList::MakeRequestedToolBarList (NameList& rRequestedToolBars) const
     }
 }
 
-void ToolBarList::GetToolBarsToActivate (NameList& rToolBars) const
+void ToolBarList::GetToolBarsToActivate (std::vector<OUString>& rToolBars) const
 {
-    NameList aRequestedToolBars;
+    std::vector<OUString> aRequestedToolBars;
     MakeRequestedToolBarList(aRequestedToolBars);
 
-    NameList::const_iterator iToolBar;
-    for (iToolBar=aRequestedToolBars.begin(); iToolBar!=aRequestedToolBars.end(); ++iToolBar)
+    for (auto iToolBar=aRequestedToolBars.cbegin(); iToolBar!=aRequestedToolBars.cend(); ++iToolBar)
     {
         if (::std::find(maActiveToolBars.begin(),maActiveToolBars.end(),*iToolBar)
             == maActiveToolBars.end())
@@ -1280,13 +1273,12 @@ void ToolBarList::GetToolBarsToActivate (NameList& rToolBars) const
     }
 }
 
-void ToolBarList::GetToolBarsToDeactivate (NameList& rToolBars) const
+void ToolBarList::GetToolBarsToDeactivate (std::vector<OUString>& rToolBars) const
 {
-    NameList aRequestedToolBars;
+    std::vector<OUString> aRequestedToolBars;
     MakeRequestedToolBarList(aRequestedToolBars);
 
-    NameList::const_iterator iToolBar;
-    for (iToolBar=maActiveToolBars.begin(); iToolBar!=maActiveToolBars.end(); ++iToolBar)
+    for (auto iToolBar=maActiveToolBars.cbegin(); iToolBar!=maActiveToolBars.cend(); ++iToolBar)
     {
         if (::std::find(aRequestedToolBars.begin(),aRequestedToolBars.end(),*iToolBar)
             == aRequestedToolBars.end())
diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx
index 0dc08812be6e..2cd55e1d3c21 100644
--- a/sfx2/source/dialog/filtergrouping.cxx
+++ b/sfx2/source/dialog/filtergrouping.cxx
@@ -141,8 +141,6 @@ namespace sfx2
     typedef ::std::list< FilterClass >                                  FilterClassList;
     typedef ::std::map< OUString, FilterClassList::iterator >    FilterClassReferrer;
 
-    typedef ::std::vector< OUString >                            StringArray;
-
 
 // = reading of configuration data
 
@@ -219,7 +217,7 @@ namespace sfx2
     };
 
 
-    void lcl_ReadGlobalFilters( const OConfigurationNode& _rFilterClassification, FilterClassList& _rGlobalClasses, StringArray& _rGlobalClassNames )
+    void lcl_ReadGlobalFilters( const OConfigurationNode& _rFilterClassification, FilterClassList& _rGlobalClasses, std::vector<OUString>& _rGlobalClassNames )
     {
         _rGlobalClasses.clear();
         _rGlobalClassNames.clear();
@@ -306,7 +304,7 @@ namespace sfx2
     }
 
 
-    void lcl_ReadClassification( FilterClassList& _rGlobalClasses, StringArray& _rGlobalClassNames, FilterClassList& _rLocalClasses )
+    void lcl_ReadClassification( FilterClassList& _rGlobalClasses, std::vector<OUString>& _rGlobalClassNames, FilterClassList& _rLocalClasses )
     {
 
         // open our config node
@@ -563,7 +561,7 @@ namespace sfx2
 
         // read the classification of filters
         FilterClassList aGlobalClasses, aLocalClasses;
-        StringArray aGlobalClassNames;
+        std::vector<OUString> aGlobalClassNames;
         lcl_ReadClassification( aGlobalClasses, aGlobalClassNames, aLocalClasses );
 
 
@@ -624,7 +622,7 @@ namespace sfx2
                     "sfx2::lcl_GroupAndClassify: invalid all-filters array here!" );
                     // the loop below will work on invalid objects else ...
                 ++aGroupPos;
-                StringArray::iterator aGlobalIter = aGlobalClassNames.begin();
+                auto aGlobalIter = aGlobalClassNames.begin();
                 while   (   ( aGroupPos != _rAllFilters.end() )
                         &&  ( aGlobalIter != aGlobalClassNames.end() )
                         &&  ( *aGlobalIter != aServiceName )
diff --git a/shell/inc/types.hxx b/shell/inc/types.hxx
index bfc0cd94324a..6834bc60963d 100644
--- a/shell/inc/types.hxx
+++ b/shell/inc/types.hxx
@@ -25,8 +25,6 @@
 #include <utility>
 #include <vector>
 
-typedef std::vector<std::wstring> StringList_t;
-
 //+-------------------------------------------------------------------------
 //  Declare:    XmlTagAttributes_t, xml tag attribute struct
 //              XmlTag_t, xml tag including content and attributes.
diff --git a/shell/source/tools/lngconvex/lngconvex.cxx b/shell/source/tools/lngconvex/lngconvex.cxx
index 9146f6e46be5..802cafb6a08b 100644
--- a/shell/source/tools/lngconvex/lngconvex.cxx
+++ b/shell/source/tools/lngconvex/lngconvex.cxx
@@ -146,8 +146,6 @@ private:
     std::ios::iostate m_OldIos;
 };
 
-typedef std::vector<std::string> string_container_t;
-
 class iso_lang_identifier
 {
 public:
@@ -371,7 +369,7 @@ void read_ulf_file(const std::string& FileName, Substitutor& Substitutor)
 
 void read_file(
     const std::string& fname,
-    string_container_t& string_container)
+    std::vector<std::string>& string_container)
 {
     std::ifstream file(fname.c_str());
     StreamExceptionsEnabler sexc(file);
@@ -459,7 +457,7 @@ void start_language_section(
     replace the all placeholder and append the
     result to the output file */
 void inflate_rc_template_to_file(
-    std::ostream& os, const string_container_t& rctmpl, Substitutor& substitutor)
+    std::ostream& os, const std::vector<std::string>& rctmpl, Substitutor& substitutor)
 {
     StreamExceptionsEnabler sexc(os);
 
@@ -472,8 +470,8 @@ void inflate_rc_template_to_file(
     {
         substitutor.set_language(iso_lang_identifier(iter->first));
 
-        string_container_t::const_iterator rct_iter = rctmpl.begin();
-        string_container_t::const_iterator rct_iter_end = rctmpl.end();
+        auto rct_iter = rctmpl.cbegin();
+        auto rct_iter_end = rctmpl.cend();
 
         if (!rctmpl.empty())
             start_language_section(oi, iso_lang_identifier(iter->first));
@@ -535,7 +533,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         Substitutor substitutor;
         read_ulf_file(ULF_FILE(cmdline), substitutor);
 
-        string_container_t rc_tmpl;
+        std::vector<std::string> rc_tmpl;
         read_file(RC_TEMPLATE(cmdline), rc_tmpl);
 
         std::ofstream rc_file(RC_FILE(cmdline));
diff --git a/shell/source/unix/sysshell/recently_used_file_handler.cxx b/shell/source/unix/sysshell/recently_used_file_handler.cxx
index ced51eda9787..49c200eb47b6 100644
--- a/shell/source/unix/sysshell/recently_used_file_handler.cxx
+++ b/shell/source/unix/sysshell/recently_used_file_handler.cxx
@@ -39,8 +39,6 @@
 #include <time.h>
 
 namespace /* private */ {
-    typedef std::vector<string_t> string_container_t;
-
     #define TAG_RECENT_FILES "RecentFiles"
     #define TAG_RECENT_ITEM  "RecentItem"
     #define TAG_URI          "URI"
@@ -60,7 +58,7 @@ namespace /* private */ {
         recently_used_item(
             const string_t& uri,
             const string_t& mime_type,
-            const string_container_t& groups) :
+            const std::vector<string_t>& groups) :
             uri_(uri),
             mime_type_(mime_type),
             is_private_(false),
@@ -100,10 +98,10 @@ namespace /* private */ {
 
         bool has_group(const string_t& name) const
         {
-            string_container_t::const_iterator iter_end = groups_.end();
+            auto iter_end = groups_.cend();
             return (has_groups() &&
                     iter_end != std::find_if(
-                        groups_.begin(), iter_end,
+                        groups_.cbegin(), iter_end,
                         [&name](const string_t& s)
                         { return (0 == strcasecmp(s.c_str(), name.c_str())); })
                         // compare two string_t's case insensitive
@@ -127,8 +125,8 @@ namespace /* private */ {
             {
                 write_xml_start_tag(TAG_GROUPS, file, true);
 
-                string_container_t::const_iterator iter = groups_.begin();
-                string_container_t::const_iterator iter_end = groups_.end();
+                auto iter = groups_.cbegin();
+                auto iter_end = groups_.cend();
 
                 for ( ; iter != iter_end; ++iter)
                     write_xml_tag(TAG_GROUP, (*iter), file);
@@ -192,7 +190,7 @@ namespace /* private */ {
         string_t mime_type_;
         time_t timestamp_;
         bool is_private_;
-        string_container_t groups_;
+        std::vector<string_t> groups_;
     };
 
     typedef std::vector<std::unique_ptr<recently_used_item>> recently_used_item_list_t;
@@ -387,7 +385,7 @@ namespace /* private */ {
         }
         else
         {
-            string_container_t groups;
+            std::vector<string_t> groups;
             groups.push_back(GROUP_OOO);
             groups.push_back(GROUP_STAR_OFFICE);
             groups.push_back(GROUP_STAR_SUITE);
diff --git a/shell/source/win32/ooofilereader/keywordstag.cxx b/shell/source/win32/ooofilereader/keywordstag.cxx
index 4abb5af921b3..8a8600e2823f 100644
--- a/shell/source/win32/ooofilereader/keywordstag.cxx
+++ b/shell/source/win32/ooofilereader/keywordstag.cxx
@@ -43,8 +43,8 @@ void CKeywordsTag::addAttributes(const XmlTagAttributes_t& /*attributes*/)
 
 std::wstring CKeywordsTag::getTagContent( )
 {
-    StringList_t::const_iterator keywords_Iter= m_slKeywords.begin( );
-    StringList_t::const_iterator keywords_Iter_end = m_slKeywords.end( );
+    auto keywords_Iter= m_slKeywords.cbegin( );
+    auto keywords_Iter_end = m_slKeywords.cend( );
 
     std::wstring ret_KeyWord_String = ( keywords_Iter != keywords_Iter_end) ? *keywords_Iter++ : L"";
     for ( ; keywords_Iter != keywords_Iter_end; ++keywords_Iter)
diff --git a/shell/source/win32/ooofilereader/keywordstag.hxx b/shell/source/win32/ooofilereader/keywordstag.hxx
index d1dbe9288dfd..3fb5372c47eb 100644
--- a/shell/source/win32/ooofilereader/keywordstag.hxx
+++ b/shell/source/win32/ooofilereader/keywordstag.hxx
@@ -39,7 +39,7 @@ class CKeywordsTag : public ITag
         virtual ::std::wstring const getTagAttribute( ::std::wstring  const & /*attrname*/ ) override { return ::std::wstring(); };
 
     private:
-        StringList_t m_slKeywords;
+        std::vector<std::wstring> m_slKeywords;
         std::wstring m_sCurrentKeyword;
 };
 
diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx
index 636a0d862f4e..e4f9c3b3dfd9 100644
--- a/shell/source/win32/simplemail/senddoc.cxx
+++ b/shell/source/win32/simplemail/senddoc.cxx
@@ -42,7 +42,6 @@
     void dumpParameter();
 #endif
 
-typedef std::vector<std::wstring> StringList_t;
 typedef std::vector<MapiRecipDescW> MapiRecipientList_t;
 typedef std::vector<MapiFileDescW> MapiAttachmentList_t;
 
@@ -55,9 +54,9 @@ namespace /* private */
     std::wstring gFrom;
     std::wstring gSubject;
     std::wstring gBody;
-    StringList_t gTo;
-    StringList_t gCc;
-    StringList_t gBcc;
+    std::vector<std::wstring> gTo;
+    std::vector<std::wstring> gCc;
+    std::vector<std::wstring> gBcc;
     // Keep temp filepath and displayed name
     std::vector<std::pair<std::wstring, std::wstring>> gAttachments;
     int gMapiFlags = 0;


More information about the Libreoffice-commits mailing list