summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/dpcachetable.hxx87
-rw-r--r--sc/inc/dpgroup.hxx3
-rw-r--r--sc/inc/dpobject.hxx41
-rw-r--r--sc/inc/dpsave.hxx7
-rw-r--r--sc/inc/dpsdbtab.hxx11
-rw-r--r--sc/inc/dptabdat.hxx15
-rw-r--r--sc/inc/dptabres.hxx37
-rw-r--r--sc/inc/global.hxx42
8 files changed, 157 insertions, 86 deletions
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index 4d89dd333979..88451ed748a2 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -38,8 +38,8 @@
#include "collect.hxx"
#include <vector>
-#include <set>
#include <hash_map>
+#include <hash_set>
#include <boost/shared_ptr.hpp>
#include <com/sun/star/uno/Reference.hxx>
@@ -57,62 +57,24 @@ class Date;
class ScDocument;
class ScRange;
class ScDPDimension;
+class ScDPCollection;
+class ScDPCacheCell;
struct ScDPItemData;
class Date;
// ----------------------------------------------------------------------------
-/** public interface for string-sharing */
-class ScSharedString
-{
-public:
- static const sal_Int32 EMPTY = 0;
-
- static const String* getString(sal_Int32 nId);
- static sal_Int32 getStringId(const String& aStr);
- static sal_Int32 insertString(const String& aStr);
-
-private:
-
- /** internal shared string table implementation */
- class StringTable
- {
- public:
- sal_Int32 insertString(const String& aStr);
- sal_Int32 getStringId(const String& aStr);
- const String* getString(sal_Int32 nId) const;
-
- StringTable();
- ~StringTable();
-
- private:
- typedef ::std::hash_map< String, sal_Int32, ScStringHashCode, ::std::equal_to< String > > SharedStrMap;
-
- ::std::vector<String> maSharedStrings;
- SharedStrMap maSharedStringIds;
- sal_Int32 mnStrCount;
- };
-
- static ::osl::Mutex maStrMutex;
- static StringTable maStringTable;
-};
-
-// ----------------------------------------------------------------------------
-
class ScDPCacheTable
{
public:
- /** individual cell within table. */
struct Cell
{
- SCROW mnCategoryRef;
- sal_Int32 mnStrId;
- sal_uInt8 mnType;
- double mfValue;
- bool mbNumeric;
+ SCROW mnCategoryRef;
+ ScDPCacheCell* mpContent;
Cell();
+ ~Cell();
};
/** individual filter item used in SingleFilter and GroupFilter. */
@@ -131,38 +93,47 @@ public:
public:
/** returns true if the matching condition is met for a single cell
value, or false otherwise. */
- virtual bool match(const Cell& rCell) const = 0;
+ virtual bool match(const ScDPCacheCell& rCell) const = 0;
};
/** ordinary single-item filter. */
class SingleFilter : public FilterBase
{
public:
- explicit SingleFilter();
- explicit SingleFilter(sal_Int32 nMatchStrId, double fValue, bool bHasValue);
+ explicit SingleFilter(ScSimpleSharedString& rSharedString,
+ sal_Int32 nMatchStrId, double fValue, bool bHasValue);
- virtual bool match(const Cell& rCell) const;
+ virtual bool match(const ScDPCacheCell& rCell) const;
- const String getMatchString() const;
+ const String getMatchString();
double getMatchValue() const;
bool hasValue() const;
private:
+ explicit SingleFilter();
+
FilterItem maItem;
+ ScSimpleSharedString mrSharedString;
};
/** multi-item (group) filter. */
class GroupFilter : public FilterBase
{
public:
- GroupFilter();
+ GroupFilter(ScSimpleSharedString& rSharedString);
virtual ~GroupFilter(){}
- virtual bool match(const Cell& rCell) const;
+ virtual bool match(const ScDPCacheCell& rCell) const;
+ void setMatchIfFound(bool b);
void addMatchItem(const String& rStr, double fVal, bool bHasValue);
+ size_t getMatchItemCount() const;
private:
+ GroupFilter();
+
::std::vector<FilterItem> maItems;
+ ScSimpleSharedString mrSharedString;
+ bool mbMatchIfFound;
};
/** single filtering criterion. */
@@ -174,10 +145,9 @@ public:
Criterion();
};
- ScDPCacheTable();
+ ScDPCacheTable(ScDPCollection* pCollection);
~ScDPCacheTable();
- sal_Int32 getHeaderSize() const;
sal_Int32 getRowSize() const;
sal_Int32 getColSize() const;
@@ -203,7 +173,7 @@ public:
/** Get the cell instance at specified location within the data grid. Note
that the data grid doesn't include the header row. Don't delete the
returned object! */
- const ::ScDPCacheTable::Cell* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty = false) const;
+ const ScDPCacheCell* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty = false) const;
const String* getFieldName(sal_Int32 nIndex) const;
@@ -229,12 +199,14 @@ public:
bool empty() const;
private:
+ ScDPCacheTable();
+ ScDPCacheTable(const ScDPCacheTable&);
+
/**
* Check if a given row meets all specified criteria.
*/
bool isRowQualified(sal_Int32 nRow, const ::std::vector<Criterion>& rCriteria, bool bRepeatIfEmpty) const;
- void getValueData(ScDocument* pDoc, const ScAddress& rPos, Cell& rCell);
- ScDPCacheTable::Cell getSelectedDimension(ScDPDimension* pDim) const;
+ void getValueData(ScDocument* pDoc, const ScAddress& rPos, ScDPCacheCell& rCell);
private:
typedef ::boost::shared_ptr<TypedStrCollection> TypedStrCollectionPtr;
@@ -251,6 +223,9 @@ private:
/** used to track visibility of rows. The first row below the header row
has the index of 0. */
::std::vector<bool> maRowsVisible;
+
+ ScSimpleSharedString& mrSharedString;
+ ScDPCollection* mpCollection;
};
diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx
index 08a52cd319ff..0fbab349f0a1 100644
--- a/sc/inc/dpgroup.hxx
+++ b/sc/inc/dpgroup.hxx
@@ -190,13 +190,12 @@ class ScDPGroupTableData : public ScDPTableData
void FillGroupValues( ScDPItemData* pItemData, long nCount, const long* pDims );
void CopyFields(const ::std::vector<long>& rFieldDims, ::std::vector<long>& rNewFieldDims);
- long* CopyFields( const long* pSourceDims, long nCount );
bool IsNumGroupDimension( long nDimension ) const;
void GetNumGroupInfo( long nDimension, ScDPNumGroupInfo& rInfo,
bool& rNonInteger, sal_Unicode& rDecimal );
- void ModifyFilterCriteria(::std::vector<ScDPCacheTable::Criterion>& rCriteria) const;
+ void ModifyFilterCriteria(::std::vector<ScDPCacheTable::Criterion>& rCriteria);
public:
// takes ownership of pSource
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index e04d4a7750ed..3ba1dfab5e98 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dpobject.hxx,v $
- * $Revision: 1.14.30.5 $
+ * $Revision: 1.15 $
*
* This file is part of OpenOffice.org.
*
@@ -57,10 +57,8 @@ class ScDPSaveData;
class ScDPOutput;
class ScMultipleReadHeader;
class ScMultipleWriteHeader;
-#if OLD_PIVOT_IMPLEMENTATION
class ScPivot;
class ScPivotCollection;
-#endif
struct ScPivotParam;
struct ScImportSourceDesc;
struct ScSheetSourceDesc;
@@ -186,9 +184,8 @@ public:
BOOL FillOldParam(ScPivotParam& rParam, BOOL bForFile) const;
BOOL FillLabelData(ScPivotParam& rParam);
-#if OLD_PIVOT_IMPLEMENTATION
void InitFromOldPivot(const ScPivot& rOld, ScDocument* pDoc, BOOL bSetSource);
-#endif
+
BOOL GetHierarchiesNA( sal_Int32 nDim, com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xHiers );
BOOL GetHierarchies( sal_Int32 nDim, com::sun::star::uno::Sequence< rtl::OUString >& rHiers );
@@ -242,11 +239,39 @@ public:
PivotField* pRefPageFields = NULL, SCSIZE nRefPageCount = 0 );
};
+// ============================================================================
+
+struct ScDPCacheCell
+{
+ sal_Int32 mnStrId;
+ sal_uInt8 mnType;
+ double mfValue;
+ bool mbNumeric;
+
+ ScDPCacheCell();
+ ScDPCacheCell(const ScDPCacheCell& r);
+ ~ScDPCacheCell();
+};
+
+// ============================================================================
class ScDPCollection : public Collection
{
private:
ScDocument* pDoc;
+ ScSimpleSharedString maSharedString;
+
+ struct CacheCellHash
+ {
+ size_t operator()(const ScDPCacheCell* pCell) const;
+ };
+ struct CacheCellEqual
+ {
+ bool operator()(const ScDPCacheCell* p1, const ScDPCacheCell* p2) const;
+ };
+ typedef ::std::hash_set<ScDPCacheCell*, CacheCellHash, CacheCellEqual> CacheCellPoolType;
+
+ CacheCellPoolType maCacheCellPool;
public:
ScDPCollection(ScDocument* pDocument);
@@ -267,7 +292,11 @@ public:
void WriteRefsTo( ScDPCollection& r ) const;
String CreateNewName( USHORT nMin = 1 ) const;
-//UNUSED2008-05 void EnsureNames();
+
+ ScSimpleSharedString& GetSharedString();
+
+ ScDPCacheCell* getCacheCellFromPool(const ScDPCacheCell& rCell);
+ void clearCacheCellPool();
};
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index a03ca15f5451..4d1be16e7145 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -45,7 +45,6 @@ namespace com { namespace sun { namespace star { namespace sheet {
struct DataPilotFieldLayoutInfo;
} } } }
-class SvStream;
class ScDPDimensionSaveData;
// --------------------------------------------------------------------
@@ -64,7 +63,6 @@ private:
public:
ScDPSaveMember(const String& rName);
ScDPSaveMember(const ScDPSaveMember& r);
- ScDPSaveMember(SvStream& rStream);
~ScDPSaveMember();
BOOL operator== ( const ScDPSaveMember& r ) const;
@@ -82,8 +80,6 @@ public:
void WriteToSource( const com::sun::star::uno::Reference<
com::sun::star::uno::XInterface>& xMember,
sal_Int32 nPosition );
-
- void Store( SvStream& rStream ) const;
};
@@ -116,7 +112,6 @@ private:
public:
ScDPSaveDimension(const String& rName, BOOL bDataLayout);
ScDPSaveDimension(const ScDPSaveDimension& r);
- ScDPSaveDimension(SvStream& rStream);
~ScDPSaveDimension();
BOOL operator== ( const ScDPSaveDimension& r ) const;
@@ -170,8 +165,6 @@ public:
void WriteToSource( const com::sun::star::uno::Reference<
com::sun::star::uno::XInterface>& xDim );
-
- void Store( SvStream& rStream ) const;
};
diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx
index f4874d54263a..84fd36f65ea6 100644
--- a/sc/inc/dpsdbtab.hxx
+++ b/sc/inc/dpsdbtab.hxx
@@ -33,17 +33,13 @@
#include <com/sun/star/uno/Reference.hxx>
-namespace com { namespace sun { namespace star {
- namespace lang {
- class XMultiServiceFactory;
- }
-}}}
#include "dptabdat.hxx"
#include <vector>
#include <set>
class ScDPCacheTable;
+class ScDocument;
// --------------------------------------------------------------------
//
@@ -74,10 +70,7 @@ private:
BOOL OpenDatabase();
public:
- ScDatabaseDPData(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory > xSMgr,
- const ScImportSourceDesc& rImport );
+ ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport);
virtual ~ScDatabaseDPData();
virtual long GetColumnCount();
diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx
index 3545c90ccbee..90953d8c3b4f 100644
--- a/sc/inc/dptabdat.hxx
+++ b/sc/inc/dptabdat.hxx
@@ -46,6 +46,7 @@ namespace com { namespace sun { namespace star { namespace sheet {
}}}}
class TypedStrCollection;
+class ScSimpleSharedString;
// -----------------------------------------------------------------------
@@ -112,6 +113,7 @@ class ScDPDimension;
class ScDPLevel;
class ScDPInitState;
class ScDPResultMember;
+class ScDocument;
class ScDPTableData
{
@@ -120,6 +122,7 @@ class ScDPTableData
long nLastHier;
long nLastLevel;
long nLastRet;
+ ScSimpleSharedString& mrSharedString;
public:
@@ -146,7 +149,7 @@ public:
CalcInfo();
};
- ScDPTableData();
+ ScDPTableData(ScDocument* pDoc);
virtual ~ScDPTableData();
long GetDatePart( long nDateVal, long nHierarchy, long nLevel );
@@ -165,11 +168,11 @@ public:
virtual bool IsRepeatIfEmpty();
- virtual void CreateCacheTable();
- virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria);
+ virtual void CreateCacheTable() = 0;
+ virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria) = 0;
virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData);
- virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData) = 0;
+ virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow) = 0;
virtual const ScDPCacheTable& GetCacheTable() const = 0;
// overloaded in ScDPGroupTableData:
@@ -181,6 +184,8 @@ public:
virtual BOOL HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex,
const ScDPItemData& rSecondData, long nSecondIndex ) const;
+ ScSimpleSharedString& GetSharedString();
+
protected:
/** This structure stores vector arrays that hold intermediate data for
each row during cache table iteration. */
diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index df8c2cfe4434..6dfb782b2313 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -31,14 +31,15 @@
#ifndef SC_DPTABRES_HXX
#define SC_DPTABRES_HXX
-#include <vector>
#include <svtools/svarray.hxx>
#include <tools/string.hxx>
#include <com/sun/star/sheet/MemberResult.hpp>
#include <com/sun/star/sheet/DataResult.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include "global.hxx" // enum ScSubTotalFunc
+#include "dpcachetable.hxx"
#include <hash_map>
+#include <hash_set>
#include <vector>
namespace com { namespace sun { namespace star { namespace sheet {
@@ -50,10 +51,12 @@ class ScAddress;
class ScDocument;
class ScDPSource;
class ScDPDimension;
+class ScDPDimensions;
class ScDPLevel;
class ScDPMember;
class ScDPAggData;
class ScDPResultMember;
+class ScDPResultVisibilityData;
struct ScDPValueData;
struct ScDPItemData;
@@ -370,6 +373,8 @@ public:
const ScDPLevel* GetParentLevel() const { return pParentLevel; } //! Ref
ScDPAggData* GetColTotal( long nMeasure ) const;
+
+ void FillVisibilityData(ScDPResultVisibilityData& rData) const;
};
class ScDPDataMember
@@ -538,6 +543,8 @@ public:
long GetAutoCount() const { return nAutoCount; }
ScDPResultDimension* GetFirstChildDimension() const;
+
+ void FillVisibilityData(ScDPResultVisibilityData& rData) const;
};
class ScDPDataDimension
@@ -580,5 +587,33 @@ public:
ScDPDataMember* GetMember(long n) const;
};
+// ----------------------------------------------------------------------------
+
+/**
+ * This class collects visible members of each dimension and uses that
+ * information to create filtering criteria (e.g. for drill-down data).
+ */
+class ScDPResultVisibilityData
+{
+public:
+ ScDPResultVisibilityData(ScSimpleSharedString& rSharedString, ScDPSource* pSource);
+ ~ScDPResultVisibilityData();
+
+ void addVisibleMember(const String& rDimName, const ScDPItemData& rMemberItem);
+ void fillFieldFilters(::std::vector<ScDPCacheTable::Criterion>& rFilters) const;
+
+private:
+ struct MemberHash
+ {
+ size_t operator()(const ScDPItemData& r) const;
+ };
+ typedef ::std::hash_set<ScDPItemData, MemberHash> VisibleMemberType;
+ typedef ::std::hash_map<String, VisibleMemberType, ScStringHashCode> DimMemberType;
+ DimMemberType maDimensions;
+
+ ScSimpleSharedString& mrSharedString;
+ ScDPSource* mpSource;
+};
+
#endif
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 6965b2acc8e7..eed8720b0836 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -38,6 +38,8 @@
#include <com/sun/star/uno/Reference.hxx>
#include "scdllapi.h"
+#include <hash_map>
+
class ImageList;
class Bitmap;
class SfxItemSet;
@@ -884,6 +886,46 @@ struct ScConsolidateParam
};
// -----------------------------------------------------------------------
+
+class ScSimpleSharedString
+{
+public:
+ static const sal_Int32 EMPTY = 0;
+
+ ScSimpleSharedString();
+ ScSimpleSharedString(const ScSimpleSharedString& r);
+ ~ScSimpleSharedString();
+
+ const String* getString(sal_Int32 nId);
+ sal_Int32 getStringId(const String& aStr);
+ sal_Int32 insertString(const String& aStr);
+
+private:
+
+ /** internal shared string table implementation */
+ class StringTable
+ {
+ public:
+ sal_Int32 insertString(const String& aStr);
+ sal_Int32 getStringId(const String& aStr);
+ const String* getString(sal_Int32 nId) const;
+
+ StringTable();
+ StringTable(const StringTable& r);
+ ~StringTable();
+
+ private:
+ typedef ::std::hash_map< String, sal_Int32, ScStringHashCode, ::std::equal_to< String > > SharedStrMap;
+
+ ::std::vector<String> maSharedStrings;
+ SharedStrMap maSharedStringIds;
+ sal_Int32 mnStrCount;
+ };
+
+ StringTable maStringTable;
+};
+
+// -----------------------------------------------------------------------
extern ::utl::TransliterationWrapper* GetScGlobalpTransliteration();//CHINA001
extern const LocaleDataWrapper* GetScGlobalpLocaleData();