diff options
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/collect.hxx | 59 | ||||
-rw-r--r-- | sc/inc/column.hxx | 6 | ||||
-rw-r--r-- | sc/inc/document.hxx | 25 | ||||
-rw-r--r-- | sc/inc/dpobject.hxx | 4 | ||||
-rw-r--r-- | sc/inc/table.hxx | 6 | ||||
-rw-r--r-- | sc/inc/types.hxx | 4 | ||||
-rw-r--r-- | sc/inc/validat.hxx | 10 |
7 files changed, 67 insertions, 47 deletions
diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx index 08aa75630f55..2eb223b94455 100644 --- a/sc/inc/collect.hxx +++ b/sc/inc/collect.hxx @@ -42,8 +42,7 @@ #define MAXDELTA 1024 #define SCPOS_INVALID USHRT_MAX -#define SC_STRTYPE_VALUE 0 -#define SC_STRTYPE_STANDARD 1 +#include <boost/ptr_container/ptr_set.hpp> class ScDocument; @@ -113,9 +112,8 @@ public: // TypedScStrCollection: wie ScStrCollection, nur, dass Zahlen vor Strings // sortiert werden -class TypedStrData : public ScDataObject +class TypedStrData { - friend class TypedScStrCollection; public: enum StringType { Value = 0, @@ -130,39 +128,48 @@ public: TypedStrData( const TypedStrData& rCpy ); - virtual ScDataObject* Clone() const; - bool IsStrData() const; SC_DLLPUBLIC const rtl::OUString& GetString() const; double GetValue() const; + StringType GetStringType() const; -private: - rtl::OUString maStrValue; - double mfValue; - StringType meStrType; // 0 = Value -}; + struct LessCaseSensitive : std::binary_function<TypedStrData, TypedStrData, bool> + { + bool operator() (const TypedStrData& left, const TypedStrData& right) const; + }; -class SC_DLLPUBLIC TypedScStrCollection : public ScSortedCollection -{ -private: - sal_Bool bCaseSensitive; + struct LessCaseInsensitive : std::binary_function<TypedStrData, TypedStrData, bool> + { + bool operator() (const TypedStrData& left, const TypedStrData& right) const; + }; -public: - TypedScStrCollection( sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false ); + struct EqualCaseSensitive : std::binary_function<TypedStrData, TypedStrData, bool> + { + bool operator() (const TypedStrData& left, const TypedStrData& right) const; + }; - TypedScStrCollection( const TypedScStrCollection& rCpy ) - : ScSortedCollection( rCpy ) { bCaseSensitive = rCpy.bCaseSensitive; } - ~TypedScStrCollection(); + struct EqualCaseInsensitive : std::binary_function<TypedStrData, TypedStrData, bool> + { + bool operator() (const TypedStrData& left, const TypedStrData& right) const; + }; - virtual ScDataObject* Clone() const; - virtual short Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) const; + bool operator== (const TypedStrData& r) const; + bool operator< (const TypedStrData& r) const; - TypedStrData* operator[]( const sal_uInt16 nIndex) const; - void SetCaseSensitive( sal_Bool bSet ); +private: + rtl::OUString maStrValue; + double mfValue; + StringType meStrType; +}; - sal_Bool FindText( const String& rStart, String& rResult, sal_uInt16& rPos, sal_Bool bBack ) const; - sal_Bool GetExactMatch( String& rString ) const; +class FindTypedStrData : std::unary_function<TypedStrData, bool> +{ + TypedStrData maVal; + bool mbCaseSens; +public: + FindTypedStrData(const TypedStrData& rVal, bool bCaseSens); + bool operator() (const TypedStrData& r) const; }; #endif diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 2f58a92630d8..e5e78f39a95a 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -62,7 +62,7 @@ class ScMarkData; class ScPatternAttr; class ScStyleSheet; class SvtBroadcaster; -class TypedScStrCollection; +class TypedStrData; class ScProgress; class ScPostIt; struct ScFunctionData; @@ -379,8 +379,8 @@ public: /// Including current, may return -1 SCsROW GetNextUnprotected( SCROW nRow, bool bUp ) const; - void GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings, bool& rHasDates); - bool GetDataEntries(SCROW nRow, TypedScStrCollection& rStrings, bool bLimit); + void GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector<TypedStrData>& rStrings, bool& rHasDates); + bool GetDataEntries(SCROW nRow, std::set<TypedStrData>& rStrings, bool bLimit); void UpdateInsertTabAbs(SCTAB nNewPos); bool TestTabRefAbs(SCTAB nTable); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index b402ac83d7e8..004d8e90295f 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -118,7 +118,6 @@ class ScTokenArray; class ScValidationData; class ScValidationDataList; class ScViewOptions; -class TypedScStrCollection; class ScChangeTrack; class ScEditEngineDefaulter; class ScFieldEditEngine; @@ -1479,13 +1478,23 @@ public: SCTAB nTab, ScQueryParam& rQueryParam ); void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rStr); - bool GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, - bool bFilter, TypedScStrCollection& rStrings, bool& rHasDates); - SC_DLLPUBLIC bool GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, - SCTAB nTab, TypedScStrCollection& rStrings, bool& rHasDates ); - bool GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, - TypedScStrCollection& rStrings, bool bLimit = false ); - bool GetFormulaEntries( TypedScStrCollection& rStrings ); + /** + * Get a list of unique strings to use in filtering criteria. The string + * values are sorted, and there are no duplicate values in the list. The + * data range to use to populate the filter entries is inferred from the + * database range that contains the specified cell position. + */ + bool GetFilterEntries( + SCCOL nCol, SCROW nRow, SCTAB nTab, bool bFilter, std::vector<TypedStrData>& rStrings, bool& rHasDates); + + SC_DLLPUBLIC bool GetFilterEntriesArea( + SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bCaseSens, + std::vector<TypedStrData>& rStrings, bool& rHasDates); + + bool GetDataEntries( + SCCOL nCol, SCROW nRow, SCTAB nTab, bool bCaseSens, + std::vector<TypedStrData>& rStrings, bool bLimit = false ); + bool GetFormulaEntries( ScTypedCaseStrSet& rStrings ); bool HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab ); diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 79b5a67a0345..121b6149a4d1 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -38,6 +38,7 @@ #include <com/sun/star/sheet/XDimensionsSupplier.hpp> #include <set> +#include <vector> #include <boost/ptr_container/ptr_list.hpp> #include <boost/ptr_container/ptr_vector.hpp> @@ -64,7 +65,6 @@ class ScPivotCollection; struct ScPivotParam; struct ScImportSourceDesc; class ScSheetSourceDesc; -class TypedScStrCollection; struct PivotField; class ScDPCacheTable; class ScDPTableData; @@ -192,7 +192,7 @@ public: void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension); - void FillPageList( TypedScStrCollection& rStrings, long nField ); + void FillPageList( std::vector<rtl::OUString>& rStrings, long nField ); void ToggleDetails(const ::com::sun::star::sheet::DataPilotTableHeaderData& rElemDesc, ScDPObject* pDestObj); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 4f1fe38abe9c..2bae9938d79d 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -761,9 +761,9 @@ public: SCSIZE Query(ScQueryParam& rQueryParam, bool bKeepSub); bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); - void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates); - void GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates ); - bool GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStrings, bool bLimit); + void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<TypedStrData>& rStrings, bool& rHasDates); + void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, std::vector<TypedStrData>& rStrings, bool& rHasDates ); + bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<TypedStrData>& rStrings, bool bLimit); bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ); bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ); diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx index bb454a9e0854..25fe66b99f58 100644 --- a/sc/inc/types.hxx +++ b/sc/inc/types.hxx @@ -29,6 +29,8 @@ #ifndef __SC_TYPES_HXX__ #define __SC_TYPES_HXX__ +#include "collect.hxx" + #include <boost/intrusive_ptr.hpp> class ScMatrix; @@ -36,6 +38,8 @@ class ScMatrix; typedef ::boost::intrusive_ptr<ScMatrix> ScMatrixRef; typedef ::boost::intrusive_ptr<const ScMatrix> ScConstMatrixRef; +typedef std::set<TypedStrData, TypedStrData::LessCaseSensitive> ScTypedCaseStrSet; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx index 13e4aedd8e82..44bc37a290b8 100644 --- a/sc/inc/validat.hxx +++ b/sc/inc/validat.hxx @@ -37,7 +37,7 @@ namespace ValidListType = ::com::sun::star::sheet::TableValidationVisibility; class ScPatternAttr; class ScTokenArray; -class TypedScStrCollection; +class TypedStrData; enum ScValidationMode { @@ -131,7 +131,7 @@ public: @descr Fills the list only, if this is a list validation and IsShowList() is enabled. @param rStrings (out-param) The string list to fill with list validation entires. @return true = rStrings has been filled with at least one entry. */ - bool FillSelectionList( TypedScStrCollection& rStrings, const ScAddress& rPos ) const; + bool FillSelectionList(std::vector<TypedStrData>& rStrings, const ScAddress& rPos) const; // with string: during input, with cell: for detective / RC_FORCED sal_Bool IsDataValid( const String& rTest, const ScPatternAttr& rPattern, @@ -165,9 +165,9 @@ private: @param rTokArr Formula token array. @param rMatch (out-param) the index of the first item that matched, -1 if nothing matched. @return true = Cell range found, rRange is valid, or an error entry stuffed into the list if pCell==NULL. */ - bool GetSelectionFromFormula( TypedScStrCollection* pStrings, - ScBaseCell* pCell, const ScAddress& rPos, - const ScTokenArray& rTokArr, int& rMatch ) const; + bool GetSelectionFromFormula( + std::vector<TypedStrData>* pStrings, ScBaseCell* pCell, const ScAddress& rPos, + const ScTokenArray& rTokArr, int& rMatch) const; /** Tests, if pCell is equal to what the passed token array represents. */ bool IsEqualToTokenArray( ScBaseCell* pCell, const ScAddress& rPos, const ScTokenArray& rTokArr ) const; |