diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-08 20:34:23 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-08 20:35:12 -0500 |
commit | 1eecb1841e8692e03e8e0aecaa99e3e7a3300d4c (patch) | |
tree | 0aa29cb1ebe4c96afdb92f5ffc9578da8ba3be70 | |
parent | 9300ae1ac0e4ed4ecdf64d59033d27f8171852c6 (diff) |
ScSortedCollection is now officially unused. Nuking it.
-rw-r--r-- | sc/inc/collect.hxx | 45 | ||||
-rw-r--r-- | sc/source/core/tool/collect.cxx | 120 |
2 files changed, 7 insertions, 158 deletions
diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx index d175fa3956be..3dc738fcd85f 100644 --- a/sc/inc/collect.hxx +++ b/sc/inc/collect.hxx @@ -29,22 +29,10 @@ #ifndef SC_COLLECT_HXX #define SC_COLLECT_HXX -#include "address.hxx" -#include <tools/string.hxx> - -#ifndef INCLUDED_LIMITS_H -#include <limits.h> -#define INCLUDED_LIMITS_H -#endif #include "scdllapi.h" +#include "rtl/ustring.hxx" -#define MAXCOLLECTIONSIZE 16384 -#define MAXDELTA 1024 -#define SCPOS_INVALID USHRT_MAX - -#include <boost/ptr_container/ptr_set.hpp> - -class ScDocument; +#include <set> class SC_DLLPUBLIC ScDataObject { @@ -83,35 +71,6 @@ public: ScCollection& operator=( const ScCollection& rCol ); }; - -class SC_DLLPUBLIC ScSortedCollection : public ScCollection -{ -private: - sal_Bool bDuplicates; -protected: - // for ScStrCollection load/store - void SetDups( sal_Bool bVal ) { bDuplicates = bVal; } - sal_Bool IsDups() const { return bDuplicates; } -public: - ScSortedCollection(sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false); - ScSortedCollection(const ScSortedCollection& rScSortedCollection) : - ScCollection(rScSortedCollection), - bDuplicates(rScSortedCollection.bDuplicates) {} - - virtual sal_uInt16 IndexOf(ScDataObject* pScDataObject) const; - virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const = 0; - virtual sal_Bool IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const; - sal_Bool Search(ScDataObject* pScDataObject, sal_uInt16& rIndex) const; - virtual sal_Bool Insert(ScDataObject* pScDataObject); - virtual sal_Bool InsertPos(ScDataObject* pScDataObject, sal_uInt16& nIndex); - - sal_Bool operator==(const ScSortedCollection& rCmp) const; -}; - -//------------------------------------------------------------------------ -// TypedScStrCollection: wie ScStrCollection, nur, dass Zahlen vor Strings -// sortiert werden - class TypedStrData { public: diff --git a/sc/source/core/tool/collect.cxx b/sc/source/core/tool/collect.cxx index 2bbf24412470..e8f3de635877 100644 --- a/sc/source/core/tool/collect.cxx +++ b/sc/source/core/tool/collect.cxx @@ -26,16 +26,15 @@ * ************************************************************************/ +#include <unotools/transliterationwrapper.hxx> - +#include "collect.hxx" +#include "global.hxx" #include <string.h> -#include <tools/stream.hxx> -#include <unotools/transliterationwrapper.hxx> -#include "rechead.hxx" -#include "collect.hxx" -#include "document.hxx" // fuer TypedStrData Konstruktor +#define MAXCOLLECTIONSIZE 16384 +#define MAXDELTA 1024 // ----------------------------------------------------------------------- @@ -197,115 +196,6 @@ ScDataObject* ScCollection::Clone() const return new ScCollection(*this); } -//------------------------------------------------------------------------ -// ScSortedCollection -//------------------------------------------------------------------------ - -ScSortedCollection::ScSortedCollection(sal_uInt16 nLim, sal_uInt16 nDel, sal_Bool bDup) : - ScCollection (nLim, nDel), - bDuplicates ( bDup) -{ -} - -//------------------------------------------------------------------------ - -sal_uInt16 ScSortedCollection::IndexOf(ScDataObject* pScDataObject) const -{ - sal_uInt16 nIndex; - if (Search(pScDataObject, nIndex)) - return nIndex; - else - return 0xffff; -} - -//------------------------------------------------------------------------ - -sal_Bool ScSortedCollection::Search(ScDataObject* pScDataObject, sal_uInt16& rIndex) const -{ - rIndex = nCount; - sal_Bool bFound = false; - short nLo = 0; - short nHi = nCount - 1; - short nIndex; - short nCompare; - while (nLo <= nHi) - { - nIndex = (nLo + nHi) / 2; - nCompare = Compare(pItems[nIndex], pScDataObject); - if (nCompare < 0) - nLo = nIndex + 1; - else - { - nHi = nIndex - 1; - if (nCompare == 0) - { - bFound = sal_True; - nLo = nIndex; - } - } - } - rIndex = nLo; - return bFound; -} - -//------------------------------------------------------------------------ - -sal_Bool ScSortedCollection::Insert(ScDataObject* pScDataObject) -{ - sal_uInt16 nIndex; - sal_Bool bFound = Search(pScDataObject, nIndex); - if (bFound) - { - if (bDuplicates) - return AtInsert(nIndex, pScDataObject); - else - return false; - } - else - return AtInsert(nIndex, pScDataObject); -} - -//------------------------------------------------------------------------ - -sal_Bool ScSortedCollection::InsertPos(ScDataObject* pScDataObject, sal_uInt16& nIndex) -{ - sal_Bool bFound = Search(pScDataObject, nIndex); - if (bFound) - { - if (bDuplicates) - return AtInsert(nIndex, pScDataObject); - else - return false; - } - else - return AtInsert(nIndex, pScDataObject); -} - -//------------------------------------------------------------------------ - -sal_Bool ScSortedCollection::operator==(const ScSortedCollection& rCmp) const -{ - if ( nCount != rCmp.nCount ) - return false; - for (sal_uInt16 i=0; i<nCount; i++) - if ( !IsEqual(pItems[i],rCmp.pItems[i]) ) - return false; - return sal_True; -} - -//------------------------------------------------------------------------ - -// IsEqual - komplette Inhalte vergleichen - -sal_Bool ScSortedCollection::IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const -{ - return ( Compare(pKey1, pKey2) == 0 ); // Default: nur Index vergleichen -} - -//------------------------------------------------------------------------ -// TypedScStrCollection -//------------------------------------------------------------------------ - bool TypedStrData::LessCaseSensitive::operator() (const TypedStrData& left, const TypedStrData& right) const { if (left.meStrType != right.meStrType) |