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

Takeshi Abe tabe at fixedpoint.jp
Fri Oct 27 14:53:14 UTC 2017


 sfx2/source/appl/appdata.cxx      |    2 --
 sfx2/source/appl/childwinimpl.cxx |   35 -----------------------------------
 sfx2/source/inc/appdata.hxx       |    3 +--
 sfx2/source/inc/childwinimpl.hxx  |   21 ---------------------
 sfx2/source/view/frame.cxx        |   16 ++++++++--------
 5 files changed, 9 insertions(+), 68 deletions(-)

New commits:
commit 8b2ec0947c91eb12ae5e0302e2092bdf2ea5147e
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Fri Oct 27 18:39:52 2017 +0900

    sfx2: Drop unnecessary abstraction of SfxFrameArr_Impl
    
    Instead, use plain std::vector<SfxFrame*>.
    
    Change-Id: Ib32e748a0ce744d15cbe48f5d03e28c57b731394
    Reviewed-on: https://gerrit.libreoffice.org/43938
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index aabd7a4463e4..920cbdaaea6c 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -87,7 +87,6 @@ SfxAppData_Impl::SfxAppData_Impl()
     , pTriggerTopic(nullptr)
     , pDdeService2(nullptr)
     , pFactArr(nullptr)
-    , pTopFrames( new SfxFrameArr_Impl )
     , pMatcher( nullptr )
     , m_pToolsErrorHdl(nullptr)
     , m_pSoErrorHdl(nullptr)
@@ -123,7 +122,6 @@ SfxAppData_Impl::SfxAppData_Impl()
 SfxAppData_Impl::~SfxAppData_Impl()
 {
     DeInitDDE();
-    delete pTopFrames;
     delete pBasicManager;
 
 #if HAVE_FEATURE_SCRIPTING
diff --git a/sfx2/source/appl/childwinimpl.cxx b/sfx2/source/appl/childwinimpl.cxx
index 93b5fbe6cb09..6299edc88305 100644
--- a/sfx2/source/appl/childwinimpl.cxx
+++ b/sfx2/source/appl/childwinimpl.cxx
@@ -70,39 +70,4 @@ SfxChildWinFactArr_Impl::iterator SfxChildWinFactArr_Impl::begin()
     return maData.begin();
 }
 
-SfxFrameArr_Impl::iterator SfxFrameArr_Impl::begin()
-{
-    return maData.begin();
-}
-
-SfxFrameArr_Impl::iterator SfxFrameArr_Impl::end()
-{
-    return maData.end();
-}
-
-SfxFrame* SfxFrameArr_Impl::front()
-{
-    return maData.front();
-}
-
-void SfxFrameArr_Impl::erase( const iterator& it )
-{
-    maData.erase(it);
-}
-
-SfxFrame* SfxFrameArr_Impl::operator[] ( size_t i )
-{
-    return maData[i];
-}
-
-void SfxFrameArr_Impl::push_back( SfxFrame* p )
-{
-    maData.push_back(p);
-}
-
-bool SfxFrameArr_Impl::empty() const
-{
-    return maData.empty();
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 23f9fbf07fdf..334abf539179 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -45,7 +45,6 @@ class SfxStatusDispatcher;
 class SfxDdeTriggerTopic_Impl;
 class SfxDocumentTemplates;
 class SfxFrame;
-class SfxFrameArr_Impl;
 class SvtSaveOptions;
 class SvtHelpOptions;
 class SfxViewFrame;
@@ -78,7 +77,7 @@ public:
 
     // single instance classes
     SfxChildWinFactArr_Impl*            pFactArr;
-    SfxFrameArr_Impl*                   pTopFrames;
+    std::vector<SfxFrame*>              vTopFrames;
 
     // application members
     SfxFilterMatcher*                   pMatcher;
diff --git a/sfx2/source/inc/childwinimpl.hxx b/sfx2/source/inc/childwinimpl.hxx
index e90a874dcea6..4b5c3ac1576a 100644
--- a/sfx2/source/inc/childwinimpl.hxx
+++ b/sfx2/source/inc/childwinimpl.hxx
@@ -57,27 +57,6 @@ public:
     iterator begin();
 };
 
-class SfxFrameArr_Impl
-{
-    typedef std::vector<SfxFrame*> DataType;
-    DataType maData;
-
-public:
-    typedef DataType::iterator iterator;
-
-    iterator begin();
-    iterator end();
-
-    SfxFrame* front();
-
-    void erase( const iterator& it );
-
-    SfxFrame* operator[] ( size_t i );
-
-    void push_back( SfxFrame* p );
-    bool empty() const;
-};
-
 #endif
 
 
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 92abaca424d9..481011ba7d3b 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -38,7 +38,6 @@
 #include <comphelper/processfactory.hxx>
 #include <vcl/msgbox.hxx>
 
-// due to pTopFrames
 #include <appdata.hxx>
 #include <sfx2/app.hxx>
 #include <sfx2/event.hxx>
@@ -62,6 +61,7 @@
 #include <objshimp.hxx>
 #include <sfx2/ipclient.hxx>
 #include <childwinimpl.hxx>
+#include <vector>
 
 #ifdef DBG_UTIL
 #include <sfx2/frmhtmlw.hxx>
@@ -69,7 +69,7 @@
 
 using namespace com::sun::star;
 
-static SfxFrameArr_Impl* pFramesArr_Impl=nullptr;
+static std::vector<SfxFrame*>* pFramesArr_Impl=nullptr;
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::util;
@@ -86,7 +86,7 @@ void SfxFrame::Construct_Impl()
 {
     pImpl.reset(new SfxFrame_Impl);
     if ( !pFramesArr_Impl )
-        pFramesArr_Impl = new SfxFrameArr_Impl;
+        pFramesArr_Impl = new std::vector<SfxFrame*>;
     pFramesArr_Impl->push_back( this );
 }
 
@@ -96,7 +96,7 @@ SfxFrame::~SfxFrame()
     RemoveTopFrame_Impl( this );
     pWindow.disposeAndClear();
 
-    SfxFrameArr_Impl::iterator it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), this );
+    auto it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), this );
     if ( it != pFramesArr_Impl->end() )
         pFramesArr_Impl->erase( it );
 
@@ -383,14 +383,14 @@ void SfxFrame::GetDefaultTargetList(TargetList& rList)
 
 void SfxFrame::InsertTopFrame_Impl( SfxFrame* pFrame )
 {
-    SfxFrameArr_Impl& rArr = *SfxGetpApp()->Get_Impl()->pTopFrames;
+    auto& rArr = SfxGetpApp()->Get_Impl()->vTopFrames;
     rArr.push_back( pFrame );
 }
 
 void SfxFrame::RemoveTopFrame_Impl( SfxFrame* pFrame )
 {
-    SfxFrameArr_Impl& rArr = *SfxGetpApp()->Get_Impl()->pTopFrames;
-    SfxFrameArr_Impl::iterator it = std::find( rArr.begin(), rArr.end(), pFrame );
+    auto& rArr = SfxGetpApp()->Get_Impl()->vTopFrames;
+    auto it = std::find( rArr.begin(), rArr.end(), pFrame );
     if ( it != rArr.end() )
         rArr.erase( it );
 }
@@ -738,7 +738,7 @@ SfxFrame* SfxFrame::GetFirst()
 
 SfxFrame* SfxFrame::GetNext( SfxFrame& rFrame )
 {
-    SfxFrameArr_Impl::iterator it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), &rFrame );
+    auto it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), &rFrame );
     if ( it != pFramesArr_Impl->end() && (++it) != pFramesArr_Impl->end() )
         return *it;
     else


More information about the Libreoffice-commits mailing list