[Libreoffice-commits] .: 3 commits - sc/source svtools/inc svtools/source unusedcode.easy

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Sun Feb 19 21:45:33 PST 2012


 sc/source/filter/excel/xename.cxx  |    7 ----
 sc/source/filter/excel/xlroot.cxx  |   15 ---------
 sc/source/filter/inc/xlroot.hxx    |    5 ---
 svtools/inc/svtools/treelist.hxx   |   61 +++++++++++++++++++++++--------------
 svtools/source/contnr/treelist.cxx |   52 ++++++++++++-------------------
 unusedcode.easy                    |    4 --
 6 files changed, 58 insertions(+), 86 deletions(-)

New commits:
commit a5922eb60d1726228e71bb66bdb82ec16ed87848
Author: Santiago Martinez <smvarela at gmail.com>
Date:   Sun Feb 19 19:20:54 2012 +0100

    Remove unused code in XclExpName

diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index 0c82a08..cf2f795 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -94,8 +94,6 @@ public:
 
     /** Returns true, if this defined name is volatile. */
     bool                IsVolatile() const;
-    /** Returns true, if this defined name is hidden. */
-    bool                IsHidden() const;
     /** Returns true, if this defined name describes a macro call.
         @param bFunc  true = Macro function; false = Macro procedure. */
     bool                IsMacroCall( bool bVBasic, bool bFunc ) const;
@@ -306,11 +304,6 @@ bool XclExpName::IsVolatile() const
     return mxTokArr && mxTokArr->IsVolatile();
 }
 
-bool XclExpName::IsHidden() const
-{
-    return ::get_flag( mnFlags, EXC_NAME_HIDDEN );
-}
-
 bool XclExpName::IsMacroCall( bool bVBasic, bool bFunc ) const
 {
     return
diff --git a/unusedcode.easy b/unusedcode.easy
index afeba1d..b160c03 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -549,7 +549,6 @@ XMLVisAreaContext::XMLVisAreaContext(SvXMLImport&, unsigned short, rtl::OUString
 XWindowItem::XWindowItem(unsigned short, Window*)
 XWindowItem::XWindowItem(unsigned short, com::sun::star::uno::Reference<com::sun::star::awt::XWindow>&)
 XclExpFontBuffer::Insert(ScPatternAttr const&, short, XclExpColorType, bool)
-XclExpName::IsHidden() const
 XclExpPivotCache::GetFieldAcc(rtl::OUString const&)
 XclExpString::SetFormats(std::__debug::vector<XclFormatRun, std::allocator<XclFormatRun> > const&)
 XclTokenArray::XclTokenArray(std::__debug::vector<unsigned char, std::allocator<unsigned char> >&, bool)
commit 20d6c4d4e952765ef7938f9e6d9135fb067076a5
Author: Santiago Martinez <smvarela at gmail.com>
Date:   Sun Feb 19 18:26:38 2012 +0100

    Remove unused code in XclRoot.

diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index 21e8a70..0177ce4 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -247,16 +247,6 @@ sal_Int32 XclRoot::GetHmmFromPixelY( double fPixelY ) const
     return static_cast< sal_Int32 >( fPixelY * mrData.mfScreenPixelY + 0.5 );
 }
 
-double XclRoot::GetPixelXFromHmm( sal_Int32 nX ) const
-{
-    return static_cast< double >( (nX - 0.5) / mrData.mfScreenPixelX );
-}
-
-double XclRoot::GetPixelYFromHmm( sal_Int32 nY ) const
-{
-    return static_cast< double >( (nY - 0.5) / mrData.mfScreenPixelY );
-}
-
 uno::Sequence< beans::NamedValue > XclRoot::RequestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const
 {
     ::std::vector< OUString > aDefaultPasswords;
@@ -320,11 +310,6 @@ ScRangeName& XclRoot::GetNamedRanges() const
     return *GetDoc().GetRangeName();
 }
 
-ScDBCollection& XclRoot::GetDatabaseRanges() const
-{
-    return *GetDoc().GetDBCollection();
-}
-
 SdrPage* XclRoot::GetSdrPage( SCTAB nScTab ) const
 {
     return ((nScTab >= 0) && GetDoc().GetDrawLayer()) ?
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index 20eb819..0a652ba 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -188,9 +188,6 @@ public:
     /** Calculates the height of the passed number of pixels in 1/100 mm. */
     sal_Int32           GetHmmFromPixelY( double fPixelY ) const;
 
-    double              GetPixelXFromHmm( sal_Int32 nX ) const;
-    double              GetPixelYFromHmm( sal_Int32 nY ) const;
-
     /** Returns the medium to import from. */
     inline SfxMedium&   GetMedium() const { return mrData.mrMedium; }
     /** Returns the document URL of the imported/exported file. */
@@ -235,8 +232,6 @@ public:
     ScStyleSheetPool&   GetStyleSheetPool() const;
     /** Returns the defined names container of the Calc document. */
     ScRangeName&        GetNamedRanges() const;
-    /** Returns the database ranges container of the Calc document. */
-    ScDBCollection&     GetDatabaseRanges() const;
     /** Returns the drawing layer page of the passed sheet, if present. */
     SdrPage*            GetSdrPage( SCTAB nScTab ) const;
 
diff --git a/unusedcode.easy b/unusedcode.easy
index eb5cec5..afeba1d 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -552,9 +552,6 @@ XclExpFontBuffer::Insert(ScPatternAttr const&, short, XclExpColorType, bool)
 XclExpName::IsHidden() const
 XclExpPivotCache::GetFieldAcc(rtl::OUString const&)
 XclExpString::SetFormats(std::__debug::vector<XclFormatRun, std::allocator<XclFormatRun> > const&)
-XclRoot::GetDatabaseRanges() const
-XclRoot::GetPixelXFromHmm(int) const
-XclRoot::GetPixelYFromHmm(int) const
 XclTokenArray::XclTokenArray(std::__debug::vector<unsigned char, std::allocator<unsigned char> >&, bool)
 XclTokenArrayIterator::Init()
 XclXFBase::HasUsedFlags() const
commit 1c9f0a6ddb48f7b6d62670901e117b25a0e59713
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 20 06:31:12 2012 +0100

    move SvListView from Table to ptr_map, related fdo#45679

diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx
index 9db33bb..b2a7173 100644
--- a/svtools/inc/svtools/treelist.hxx
+++ b/svtools/inc/svtools/treelist.hxx
@@ -32,6 +32,7 @@
 #include "svtools/svtdllapi.h"
 #include <tools/solar.h>
 #include <vector>
+#include <boost/ptr_container/ptr_map.hpp>
 
 #include <tools/table.hxx>
 #include <tools/link.hxx>
@@ -280,7 +281,7 @@ class SVT_DLLPUBLIC SvTreeList
     sal_Bool            IsEntryVisible( const SvListView*,SvListEntry* pEntry ) const;
     SvListEntry*        GetEntryAtVisPos( const SvListView*,sal_uLong nVisPos ) const;
     sal_uLong           GetVisiblePos( const SvListView*,SvListEntry* pEntry ) const;
-    sal_uLong           GetVisibleCount( const SvListView* ) const;
+    sal_uLong           GetVisibleCount( SvListView* ) const;
     sal_uLong           GetVisibleChildCount( const SvListView*,SvListEntry* pParent ) const;
 
     SvListEntry*        FirstSelected( const SvListView*) const;
@@ -421,6 +422,8 @@ class SVT_DLLPUBLIC SvListView
 {
     friend class SvTreeList;
 
+    typedef boost::ptr_map<SvListEntry*, SvViewData> SvDataTable;
+
     sal_uLong           nVisibleCount;
     sal_uLong           nSelectionCount;
     sal_Bool            bVisPositionsValid;
@@ -430,7 +433,7 @@ class SVT_DLLPUBLIC SvListView
     SVT_DLLPRIVATE void RemoveViewData( SvListEntry* pParent );
 
 protected:
-    Table               aDataTable;  // Mapping SvListEntry -> ViewData
+    SvDataTable maDataTable;  // Mapping SvListEntry -> ViewData
     SvTreeList*         pModel;
 
     void                ActionMoving( SvListEntry* pEntry,SvListEntry* pTargetPrnt,sal_uLong nChildPos);
@@ -527,10 +530,11 @@ public:
     sal_Bool            IsExpanded( SvListEntry* pEntry ) const;
     sal_Bool            IsSelected( SvListEntry* pEntry ) const;
     sal_Bool            HasEntryFocus( SvListEntry* pEntry ) const;
-    void                SetEntryFocus( SvListEntry* pEntry, sal_Bool bFocus ) const;
-    SvViewData*         GetViewData( SvListEntry* pEntry ) const;
+    void                SetEntryFocus( SvListEntry* pEntry, sal_Bool bFocus );
+    const SvViewData*         GetViewData( SvListEntry* pEntry ) const;
+    SvViewData*         GetViewData( SvListEntry* pEntry );
     sal_Bool            HasViewData() const
-    { return aDataTable.Count() > 1; }  // eine ROOT gibts immer
+    { return maDataTable.size() > 1; }  // eine ROOT gibts immer
 
     virtual SvViewData* CreateViewData( SvListEntry* pEntry );
     virtual void        InitViewData( SvViewData*, SvListEntry* pEntry );
@@ -552,43 +556,54 @@ public:
 inline sal_Bool SvListView::IsExpanded( SvListEntry* pEntry ) const
 {
     DBG_ASSERT(pEntry,"IsExpanded:No Entry");
-    SvViewData* pData = (SvViewData*)aDataTable.Get( (sal_uLong)pEntry );
-    DBG_ASSERT(pData,"Entry not in Table");
-    return pData->IsExpanded();
+    SvDataTable::const_iterator itr = maDataTable.find(pEntry);
+    DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
+    return itr->second->IsExpanded();
 }
 
 inline sal_Bool SvListView::IsSelected( SvListEntry* pEntry ) const
 {
     DBG_ASSERT(pEntry,"IsExpanded:No Entry");
-    SvViewData* pData = (SvViewData*)aDataTable.Get( (sal_uLong)pEntry );
-    DBG_ASSERT(pData,"Entry not in Table");
-    return pData->IsSelected();
+    SvDataTable::const_iterator itr = maDataTable.find(pEntry );
+    DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
+    return itr->second->IsSelected();
 }
 
 inline sal_Bool SvListView::HasEntryFocus( SvListEntry* pEntry ) const
 {
     DBG_ASSERT(pEntry,"IsExpanded:No Entry");
-    SvViewData* pData = (SvViewData*)aDataTable.Get( (sal_uLong)pEntry );
-    DBG_ASSERT(pData,"Entry not in Table");
-    return pData->HasFocus();
+    SvDataTable::const_iterator itr = maDataTable.find(pEntry );
+    DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
+    return itr->second->HasFocus();
 }
 
-inline void SvListView::SetEntryFocus( SvListEntry* pEntry, sal_Bool bFocus ) const
+inline void SvListView::SetEntryFocus( SvListEntry* pEntry, sal_Bool bFocus )
 {
     DBG_ASSERT(pEntry,"SetEntryFocus:No Entry");
-    SvViewData* pData = (SvViewData*)aDataTable.Get( (sal_uLong)pEntry );
-    DBG_ASSERT(pData,"Entry not in Table");
-    pData->SetFocus(bFocus);
+    SvDataTable::iterator itr = maDataTable.find(pEntry);
+    DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
+    itr->second->SetFocus(bFocus);
+}
+
+inline const SvViewData* SvListView::GetViewData( SvListEntry* pEntry ) const
+{
+#ifndef DBG_UTIL
+    return maDataTable.find( pEntry )->second;
+#else
+    SvDataTable::const_iterator itr = maDataTable.find( pEntry );
+    DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
+    return itr->second;
+#endif
 }
 
-inline SvViewData* SvListView::GetViewData( SvListEntry* pEntry ) const
+inline SvViewData* SvListView::GetViewData( SvListEntry* pEntry )
 {
 #ifndef DBG_UTIL
-    return (SvViewData*)aDataTable.Get( (sal_uLong)pEntry );
+    return maDataTable.find( pEntry )->second;
 #else
-    SvViewData* pResult = (SvViewData*)aDataTable.Get( (sal_uLong)pEntry );
-    DBG_ASSERT(pResult,"Entry not in model or wrong view");
-    return pResult;
+    SvDataTable::iterator itr = maDataTable.find( pEntry );
+    DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
+    return itr->second;
 #endif
 }
 
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index 7ea23f3..a6ad1ef 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -732,9 +732,9 @@ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvListEntry* pEntr
     {
         // damit GetVisibleCount die Positionen aktualisiert
         ((SvListView*)pView)->nVisibleCount = 0;
-        GetVisibleCount( pView );
+        GetVisibleCount( const_cast<SvListView*>(pView) );
     }
-    SvViewData* pViewData = pView->GetViewData( pEntry );
+    const SvViewData* pViewData = pView->GetViewData( pEntry );
     return pViewData->nVisPos;
 }
 
@@ -744,7 +744,7 @@ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvListEntry* pEntr
 |*
 *************************************************************************/
 
-sal_uLong SvTreeList::GetVisibleCount( const SvListView* pView ) const
+sal_uLong SvTreeList::GetVisibleCount( SvListView* pView ) const
 {
     DBG_ASSERT(pView,"GetVisCount:No View");
     if( !pView->HasViewData() )
@@ -1445,15 +1445,13 @@ void SvListView::InitTable()
     DBG_ASSERT(pModel,"InitTable:No Model");
     DBG_ASSERT(!nSelectionCount&&!nVisibleCount&&!bVisPositionsValid,"InitTable: Not cleared!");
 
-    if( aDataTable.Count() )
+    if( maDataTable.size() )
     {
-        DBG_ASSERT(aDataTable.Count()==1,"InitTable: TableCount != 1");
+        DBG_ASSERT(maDataTable.size()==1,"InitTable: TableCount != 1");
         // die im Clear fuer die Root allozierten View-Daten loeschen
         // Achtung: Das zu dem RootEntry (und damit auch der Entry)
         // gehoerende Model kann bereits geloescht sein!
-        SvViewData* pViewData = (SvViewData*)aDataTable.GetObject( 0 );
-        delete pViewData;
-        aDataTable.Clear();
+        maDataTable.clear();
     }
 
     SvListEntry* pEntry;
@@ -1463,7 +1461,7 @@ void SvListView::InitTable()
     pEntry = pModel->pRootItem;
     pViewData = new SvViewData;
     pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED;
-    aDataTable.Insert( (sal_uLong)pEntry, pViewData );
+    maDataTable.insert( pEntry, pViewData );
     // Jetzt alle anderen Entries
     pEntry = pModel->First();
     while( pEntry )
@@ -1471,7 +1469,7 @@ void SvListView::InitTable()
         pViewData = CreateViewData( pEntry );
         DBG_ASSERT(pViewData,"InitTable:No ViewData");
         InitViewData( pViewData, pEntry );
-        aDataTable.Insert( (sal_uLong)pEntry, pViewData );
+        maDataTable.insert( pEntry, pViewData );
         pEntry = pModel->Next( pEntry );
     }
 }
@@ -1485,13 +1483,7 @@ SvViewData* SvListView::CreateViewData( SvListEntry* )
 void SvListView::ClearTable()
 {
     DBG_CHKTHIS(SvListView,0);
-    SvViewData* pViewData = (SvViewData*)aDataTable.First();
-    while( pViewData )
-    {
-        delete pViewData;
-        pViewData = (SvViewData*)aDataTable.Next();
-    }
-    aDataTable.Clear();
+    maDataTable.clear();
 }
 
 void SvListView::Clear()
@@ -1506,7 +1498,7 @@ void SvListView::Clear()
         SvListEntry* pEntry = pModel->pRootItem;
         SvViewData* pViewData = new SvViewData;
         pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED;
-        aDataTable.Insert( (sal_uLong)pEntry, pViewData );
+        maDataTable.insert( pEntry, pViewData );
     }
 }
 
@@ -1579,7 +1571,7 @@ void SvListView::ActionMoving( SvListEntry* pEntry,SvListEntry*,sal_uLong)
     DBG_ASSERT(pParent,"Model not consistent");
     if( pParent != pModel->pRootItem && pParent->pChildren->size() == 1 )
     {
-        SvViewData* pViewData = (SvViewData*)aDataTable.Get( (sal_uLong)pParent );
+        SvViewData* pViewData = maDataTable.find( pParent )->second;
         pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED);
     }
     // vorlaeufig
@@ -1603,10 +1595,10 @@ void SvListView::ActionInserted( SvListEntry* pEntry )
     SvViewData* pData = CreateViewData( pEntry );
     InitViewData( pData, pEntry );
     #ifdef DBG_UTIL
-    sal_Bool bSuccess =
+    std::pair<SvDataTable::iterator, bool> aSuccess =
     #endif
-        aDataTable.Insert( (sal_uLong)pEntry, pData );
-    DBG_ASSERT(bSuccess,"Entry already in View");
+        maDataTable.insert( pEntry, pData );
+    DBG_ASSERT(aSuccess.second,"Entry already in View");
     if ( nVisibleCount && pModel->IsEntryVisible( this, pEntry ))
     {
         nVisibleCount = 0;
@@ -1627,11 +1619,11 @@ void SvListView::ActionInsertedTree( SvListEntry* pEntry )
     sal_uInt16 nRefDepth = pModel->GetDepth( pCurEntry );
     while( pCurEntry )
     {
-        DBG_ASSERT(aDataTable.Get((sal_uLong)pCurEntry)==0,"Entry already in Table");
+        DBG_ASSERT(maDataTable.find(pCurEntry) != maDataTable.end(),"Entry already in Table");
         SvViewData* pViewData = CreateViewData( pCurEntry );
         DBG_ASSERT(pViewData,"No ViewData");
         InitViewData( pViewData, pEntry );
-        aDataTable.Insert( (sal_uLong)pCurEntry, pViewData );
+        maDataTable.insert( pCurEntry, pViewData );
         pCurEntry = pModel->Next( pCurEntry );
         if ( pCurEntry && pModel->GetDepth(pCurEntry) <= nRefDepth)
             pCurEntry = 0;
@@ -1646,9 +1638,7 @@ void SvListView::RemoveViewData( SvListEntry* pParent )
         SvListEntry* pCur = (SvListEntry*)pChildren->First();
         while( pCur )
         {
-            SvViewData* pViewData = (SvViewData*)aDataTable.Get((sal_uLong)pCur);
-            delete pViewData;
-            aDataTable.Remove( (sal_uLong)pCur );
+            maDataTable.erase(pCur);
             if( pCur->HasChildren())
                 RemoveViewData( pCur );
             pCur = (SvListEntry*)pChildren->Next();
@@ -1663,7 +1653,7 @@ void SvListView::ActionRemoving( SvListEntry* pEntry )
     DBG_CHKTHIS(SvListView,0);
     DBG_ASSERT(pEntry,"Remove:No Entry");
 
-    SvViewData* pViewData = (SvViewData*)aDataTable.Get( (sal_uLong)pEntry );
+    SvViewData* pViewData = maDataTable.find( pEntry )->second;
     sal_uLong nSelRemoved = 0;
     if ( pViewData->IsSelected() )
         nSelRemoved = 1 + pModel->GetChildSelectionCount( this, pEntry );
@@ -1683,16 +1673,14 @@ void SvListView::ActionRemoving( SvListEntry* pEntry )
     }
     bVisPositionsValid = sal_False;
 
-    pViewData = (SvViewData*)aDataTable.Get((sal_uLong)pEntry);
-    delete pViewData;
-    aDataTable.Remove( (sal_uLong)pEntry );
+    maDataTable.erase(pEntry);
     RemoveViewData( pEntry );
 
     SvListEntry* pCurEntry = pEntry->pParent;
     if ( pCurEntry && pCurEntry != pModel->pRootItem &&
          pCurEntry->pChildren->size() == 1 )
     {
-        pViewData = (SvViewData*)aDataTable.Get((sal_uLong)pCurEntry);
+        pViewData = maDataTable.find(pCurEntry)->second;
         pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED);
     }
 }


More information about the Libreoffice-commits mailing list