[Libreoffice-commits] .: 5 commits - svtools/inc svtools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 11 22:32:46 PDT 2012


 svtools/inc/svtools/treelist.hxx      |   13 ++---
 svtools/inc/svtools/treelistbox.hxx   |   17 -------
 svtools/source/contnr/treelist.cxx    |   18 +++----
 svtools/source/contnr/treelistbox.cxx |   77 ++++++++++++++++++----------------
 4 files changed, 57 insertions(+), 68 deletions(-)

New commits:
commit 5c635140c7aa4b31d23ea96c8d10be3b3a44d8f7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Oct 12 00:48:34 2012 -0400

    Put typedef inside class scope.
    
    Change-Id: Ied6b5c1714b23a7f64b5b8271979deb21350f76b

diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx
index 702f249..2534052 100644
--- a/svtools/inc/svtools/treelist.hxx
+++ b/svtools/inc/svtools/treelist.hxx
@@ -211,13 +211,13 @@ struct SvSortData
     SvListEntry* pRight;
 };
 
-typedef ::std::vector< SvListView* > SvListView_impl;
-
 class SVT_DLLPUBLIC SvTreeList
 {
+    typedef std::vector<SvListView*> ListViewsType;
+
     friend class        SvListView;
 
-    SvListView_impl     aViewList;
+    ListViewsType       aViewList;
     sal_uLong           nEntryCount;
 
     Link                aCloneLink;
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index 83bbd58..0f930f5 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -308,10 +308,12 @@ void SvTreeList::InsertView( SvListView* pView )
 
 void SvTreeList::RemoveView( SvListView* pView )
 {
-    for ( SvListView_impl::iterator it = aViewList.begin(); it != aViewList.end(); ++it ) {
-        if ( *it == pView ) {
+    for ( ListViewsType::iterator it = aViewList.begin(); it != aViewList.end(); ++it )
+    {
+        if ( *it == pView )
+        {
             aViewList.erase( it );
-            nRefCount--;
+            --nRefCount;
             break;
         }
     }
commit a19b6e4149cf264846d7c67f22f496619b70d65b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Oct 12 00:44:24 2012 -0400

    No need to keep this method.
    
    Change-Id: I5152c6f2888919a6b495bdcf1da7d797d1b1232e

diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx
index aad8ee2..702f249 100644
--- a/svtools/inc/svtools/treelist.hxx
+++ b/svtools/inc/svtools/treelist.hxx
@@ -386,7 +386,6 @@ class SVT_DLLPUBLIC SvListView
     sal_Bool            bVisPositionsValid;
 
     SVT_DLLPRIVATE void InitTable();
-    SVT_DLLPRIVATE void ClearTable();
     SVT_DLLPRIVATE void RemoveViewData( SvListEntry* pParent );
 
     SvDataTable maDataTable;  // Mapping SvListEntry -> ViewData
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index cb12059..83bbd58 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -1526,7 +1526,7 @@ SvListView::SvListView()
 SvListView::~SvListView()
 {
     DBG_DTOR(SvListView,0);
-    ClearTable();
+    maDataTable.clear();
 }
 
 void SvListView::InitTable()
@@ -1570,15 +1570,9 @@ SvViewData* SvListView::CreateViewData( SvListEntry* )
     return new SvViewData;
 }
 
-void SvListView::ClearTable()
-{
-    DBG_CHKTHIS(SvListView,0);
-    maDataTable.clear();
-}
-
 void SvListView::Clear()
 {
-    ClearTable();
+    maDataTable.clear();
     nSelectionCount = 0;
     nVisibleCount = 0;
     bVisPositionsValid = sal_False;
commit d0f2185477af437cc7220e2a050bed4eb4a13665
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Oct 12 00:41:50 2012 -0400

    These can be private.
    
    Change-Id: I960477a220db813e86c40008bc9e3ed7ed460595

diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx
index bc0b683..aad8ee2 100644
--- a/svtools/inc/svtools/treelist.hxx
+++ b/svtools/inc/svtools/treelist.hxx
@@ -389,9 +389,7 @@ class SVT_DLLPUBLIC SvListView
     SVT_DLLPRIVATE void ClearTable();
     SVT_DLLPRIVATE void RemoveViewData( SvListEntry* pParent );
 
-protected:
     SvDataTable maDataTable;  // Mapping SvListEntry -> ViewData
-    SvTreeList*         pModel;
 
     void                ActionMoving( SvListEntry* pEntry,SvListEntry* pTargetPrnt,sal_uLong nChildPos);
     void                ActionMoved( SvListEntry* pEntry,SvListEntry* pTargetPrnt,sal_uLong nChildPos);
@@ -401,8 +399,10 @@ protected:
     void                ActionRemoved( SvListEntry* pEntry );
     void                ActionClear();
 
-public:
+protected:
+    SvTreeList* pModel;
 
+public:
                         SvListView();   // !!! setzt das Model auf 0
     virtual             ~SvListView();
     void                Clear();
commit 8f8212536f6c35546447f1254639d02572f68ecb
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Oct 12 00:33:09 2012 -0400

    Less friends.
    
    Change-Id: I40410e401d9edd23d62ee12a9b8076d473d5cd29

diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index 4536075..6e2f278 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -301,9 +301,7 @@ class SVT_DLLPUBLIC SvTreeListBox
                 ,public ::vcl::IMnemonicEntryList
                 ,public ::vcl::ISearchableStringList
 {
-    friend class SvLBoxEntry;
     friend class SvImpLBox;
-    friend class ImpLBSelEng;
     friend class TreeControlPeer;
 
     SvTreeListBoxImpl* mpImpl;
commit 98a77cef93663a0ae41dcc2c2858b418aeaaa40e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Oct 12 00:29:31 2012 -0400

    Hide (part of) the implementation.
    
    Change-Id: Ia750cb1a6234ff3566728b9e22def65febed4f5c

diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index 0ab9a32..4536075 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -291,18 +291,7 @@ public:
 #define SVLBOX_TARGEMPH_VIS     0x0010
 #define SVLBOX_EDTEND_CALLED    0x0020
 
-class SvTreeListBox;
-struct SvLBox_Impl
-{
-    bool                        m_bIsEmptyTextAllowed;
-    bool                        m_bEntryMnemonicsEnabled;
-    bool                        m_bDoingQuickSelection;
-    Link*                       m_pLink;
-    ::vcl::MnemonicEngine       m_aMnemonicEngine;
-    ::vcl::QuickSelectionEngine m_aQuickSelectionEngine;
-
-    SvLBox_Impl( SvTreeListBox& _rBox );
-};
+struct SvTreeListBoxImpl;
 
 class SVT_DLLPUBLIC SvTreeListBox
                 :public Control
@@ -317,7 +306,7 @@ class SVT_DLLPUBLIC SvTreeListBox
     friend class ImpLBSelEng;
     friend class TreeControlPeer;
 
-    SvLBox_Impl*    pLBoxImpl;
+    SvTreeListBoxImpl* mpImpl;
     SvImpLBox*      pImp;
     Link            aCheckButtonHdl;
     Link            aScrolledHdl;
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 06113cc..3c7da29 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -566,35 +566,40 @@ SvViewDataEntry::~SvViewDataEntry()
     delete [] pItemData;
 }
 
-// ***************************************************************
-// struct SvLBox_Impl
-// ***************************************************************
-SvLBox_Impl::SvLBox_Impl( SvTreeListBox& _rBox )
-    :m_bIsEmptyTextAllowed( true )
-    ,m_bEntryMnemonicsEnabled( false )
-    ,m_bDoingQuickSelection( false )
-    ,m_pLink( NULL )
-    ,m_aMnemonicEngine( _rBox )
-    ,m_aQuickSelectionEngine( _rBox )
+struct SvTreeListBoxImpl
 {
-}
+    bool m_bIsEmptyTextAllowed:1;
+    bool m_bEntryMnemonicsEnabled:1;
+    bool m_bDoingQuickSelection:1;
 
-// ***************************************************************
-// class SvTreeListBox
-// ***************************************************************
+    Link* m_pLink;
+
+    vcl::MnemonicEngine m_aMnemonicEngine;
+    vcl::QuickSelectionEngine m_aQuickSelectionEngine;
+
+    SvTreeListBoxImpl(SvTreeListBox& _rBox) :
+        m_bIsEmptyTextAllowed(true),
+        m_bEntryMnemonicsEnabled(false),
+        m_bDoingQuickSelection(false),
+        m_pLink(NULL),
+        m_aMnemonicEngine(_rBox),
+        m_aQuickSelectionEngine(_rBox) {}
+};
 
 DBG_NAME(SvTreeListBox);
 
-SvTreeListBox::SvTreeListBox( Window* pParent, WinBits nWinStyle  ) :
-    Control( pParent, nWinStyle | WB_CLIPCHILDREN ),
-    DropTargetHelper( this ), DragSourceHelper( this ), eSelMode( NO_SELECTION )
+SvTreeListBox::SvTreeListBox(Window* pParent, WinBits nWinStyle) :
+    Control(pParent, nWinStyle | WB_CLIPCHILDREN),
+    DropTargetHelper(this),
+    DragSourceHelper(this),
+    mpImpl(new SvTreeListBoxImpl(*this)),
+    eSelMode(NO_SELECTION)
 {
     DBG_CTOR(SvTreeListBox,0);
     nDragOptions =  DND_ACTION_COPYMOVE | DND_ACTION_LINK;
     nImpFlags = 0;
     pTargetEntry = 0;
     nDragDropMode = 0;
-    pLBoxImpl = new SvLBox_Impl( *this );
     SvLBoxTreeList* pTempModel = new SvLBoxTreeList;
     pTempModel->SetRefCount( 0 );
     SetBaseModel(pTempModel);
@@ -611,14 +616,16 @@ SvTreeListBox::SvTreeListBox( Window* pParent, WinBits nWinStyle  ) :
     SetSublistOpenWithLeftRight();
 }
 
-SvTreeListBox::SvTreeListBox( Window* pParent, const ResId& rResId ) :
-    Control( pParent, rResId ),
-    DropTargetHelper( this ), DragSourceHelper( this ), eSelMode( NO_SELECTION )
+SvTreeListBox::SvTreeListBox(Window* pParent, const ResId& rResId) :
+    Control(pParent, rResId),
+    DropTargetHelper(this),
+    DragSourceHelper(this),
+    mpImpl(new SvTreeListBoxImpl(*this)),
+    eSelMode(NO_SELECTION)
 {
     DBG_CTOR(SvTreeListBox,0);
     pTargetEntry = 0;
     nImpFlags = 0;
-    pLBoxImpl = new SvLBox_Impl( *this );
     nDragOptions = DND_ACTION_COPYMOVE | DND_ACTION_LINK;
     nDragDropMode = 0;
     SvLBoxTreeList* pTempModel = new SvLBoxTreeList;
@@ -647,13 +654,13 @@ void SvTreeListBox::EnableEntryMnemonics( bool _bEnable )
     if ( _bEnable == IsEntryMnemonicsEnabled() )
         return;
 
-    pLBoxImpl->m_bEntryMnemonicsEnabled = _bEnable;
+    mpImpl->m_bEntryMnemonicsEnabled = _bEnable;
     Invalidate();
 }
 
 bool SvTreeListBox::IsEntryMnemonicsEnabled() const
 {
-    return pLBoxImpl->m_bEntryMnemonicsEnabled;
+    return mpImpl->m_bEntryMnemonicsEnabled;
 }
 
 IMPL_LINK_INLINE_START( SvTreeListBox, CloneHdl_Impl, SvListEntry*, pEntry )
@@ -1018,8 +1025,8 @@ void SvTreeListBox::ImplShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool bShow)
 
 void SvTreeListBox::OnCurrentEntryChanged()
 {
-    if ( !pLBoxImpl->m_bDoingQuickSelection )
-        pLBoxImpl->m_aQuickSelectionEngine.Reset();
+    if ( !mpImpl->m_bDoingQuickSelection )
+        mpImpl->m_aQuickSelectionEngine.Reset();
 }
 
 SvLBoxEntry* SvTreeListBox::GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const
@@ -1225,13 +1232,13 @@ void SvTreeListBox::EndEditing( bool bCancel )
 bool SvTreeListBox::IsEmptyTextAllowed() const
 {
     DBG_CHKTHIS(SvTreeListBox,0);
-    return pLBoxImpl->m_bIsEmptyTextAllowed;
+    return mpImpl->m_bIsEmptyTextAllowed;
 }
 
 void SvTreeListBox::ForbidEmptyText()
 {
     DBG_CHKTHIS(SvTreeListBox,0);
-    pLBoxImpl->m_bIsEmptyTextAllowed = false;
+    mpImpl->m_bIsEmptyTextAllowed = false;
 }
 
 SvLBoxEntry* SvTreeListBox::CreateEntry() const
@@ -1326,15 +1333,15 @@ void SvTreeListBox::SelectEntry( ::vcl::StringEntryIdentifier _entry )
 bool SvTreeListBox::HandleKeyInput( const KeyEvent& _rKEvt )
 {
     if  (   IsEntryMnemonicsEnabled()
-        &&  pLBoxImpl->m_aMnemonicEngine.HandleKeyEvent( _rKEvt )
+        &&  mpImpl->m_aMnemonicEngine.HandleKeyEvent( _rKEvt )
         )
         return true;
 
     if ( ( GetStyle() & WB_QUICK_SEARCH ) != 0 )
     {
-        pLBoxImpl->m_bDoingQuickSelection = true;
-        const bool bHandled = pLBoxImpl->m_aQuickSelectionEngine.HandleKeyEvent( _rKEvt );
-        pLBoxImpl->m_bDoingQuickSelection = false;
+        mpImpl->m_bDoingQuickSelection = true;
+        const bool bHandled = mpImpl->m_aQuickSelectionEngine.HandleKeyEvent( _rKEvt );
+        mpImpl->m_bDoingQuickSelection = false;
         if ( bHandled )
             return true;
     }
@@ -1628,7 +1635,7 @@ void SvTreeListBox::InitTreeView()
     mnCheckboxItemWidth = 0;
 
     Link* pLink = new Link( LINK(this,SvTreeListBox, DefaultCompare) );
-    pLBoxImpl->m_pLink = pLink;
+    mpImpl->m_pLink = pLink;
 
     nTreeFlags = TREEFLAG_RECALCTABS;
     nIndent = SV_LBOX_DEFAULT_INDENT_PIXEL;
@@ -1652,7 +1659,7 @@ SvTreeListBox::~SvTreeListBox()
 
     pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
     delete pImp;
-    delete pLBoxImpl->m_pLink;
+    delete mpImpl->m_pLink;
     ClearTabList();
 
     delete pEdCtrl;
@@ -1671,7 +1678,7 @@ SvTreeListBox::~SvTreeListBox()
         pDDSource = 0;
     if( this == pDDTarget )
         pDDTarget = 0;
-    delete pLBoxImpl;
+    delete mpImpl;
 }
 
 void SvTreeListBox::SetExtendedWinBits( ExtendedWinBits _nBits )


More information about the Libreoffice-commits mailing list