summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/attarray.hxx2
-rw-r--r--sc/inc/charthelper.hxx13
-rw-r--r--sc/inc/collect.hxx14
-rw-r--r--sc/inc/column.hxx6
-rw-r--r--sc/inc/document.hxx33
-rw-r--r--sc/inc/dpcachetable.hxx134
-rwxr-xr-xsc/inc/dpglobal.hxx209
-rw-r--r--sc/inc/dpgroup.hxx52
-rw-r--r--sc/inc/dpobject.hxx42
-rw-r--r--sc/inc/dpsave.hxx19
-rw-r--r--sc/inc/dpsdbtab.hxx18
-rw-r--r--sc/inc/dpshttab.hxx33
-rw-r--r--sc/inc/dptabdat.hxx81
-rw-r--r--sc/inc/dptablecache.hxx122
-rw-r--r--sc/inc/dptabres.hxx261
-rw-r--r--sc/inc/dptabsrc.hxx53
-rw-r--r--sc/inc/filter.hxx8
-rw-r--r--sc/inc/global.hxx55
-rw-r--r--sc/inc/globstr.hrc5
-rw-r--r--sc/inc/optutil.hxx7
-rw-r--r--sc/inc/pivot.hxx1
-rw-r--r--sc/inc/rangelst.hxx4
-rw-r--r--sc/inc/sc.hrc5
-rw-r--r--sc/inc/scabstdlg.hxx12
-rw-r--r--sc/inc/scmatrix.hxx7
-rw-r--r--sc/inc/stringutil.hxx56
-rw-r--r--sc/inc/table.hxx5
27 files changed, 938 insertions, 319 deletions
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 6d7b7f48c2d7..c82d607577bf 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -148,7 +148,7 @@ public:
BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
BOOL bLeft, BOOL bRight ) const;
- BOOL HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
+ bool HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
BOOL ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
SCCOL& rPaintCol, SCROW& rPaintRow,
BOOL bRefresh, BOOL bAttrs );
diff --git a/sc/inc/charthelper.hxx b/sc/inc/charthelper.hxx
index b4c677d7c3c6..50b8586bdace 100644
--- a/sc/inc/charthelper.hxx
+++ b/sc/inc/charthelper.hxx
@@ -29,9 +29,12 @@
#define SC_CHARTHELPER_HXX
#include <tools/solar.h>
+#include "address.hxx"
+#include "global.hxx"
-class ScDocument;
-class ScAddress;
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+class SdrObject;
/** Use this to handle charts in a calc document
*/
@@ -40,6 +43,12 @@ class ScChartHelper
public:
static USHORT DoUpdateAllCharts( ScDocument* pDoc );
static USHORT DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc ); //use this to replace ScDBFunc::DoUpdateCharts in future
+ static void AdjustRangesOfChartsOnDestinationPage( ScDocument* pSrcDoc, ScDocument* pDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartFromSdrObject( SdrObject* pObject );
+ static void GetChartRanges( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc,
+ ::com::sun::star::uno::Sequence< rtl::OUString >& rRanges );
+ static void SetChartRanges( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc,
+ const ::com::sun::star::uno::Sequence< rtl::OUString >& rRanges );
};
#endif
diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx
index e8b9bed60865..167ab5929c6a 100644
--- a/sc/inc/collect.hxx
+++ b/sc/inc/collect.hxx
@@ -184,20 +184,18 @@ private:
BOOL bCaseSensitive;
public:
- TypedScStrCollection( USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE )
- : ScSortedCollection( nLim, nDel, bDup ) { bCaseSensitive = FALSE; }
+ TypedScStrCollection( USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE );
- TypedScStrCollection( const TypedScStrCollection& rCpy )
- : ScSortedCollection( rCpy ) { bCaseSensitive = rCpy.bCaseSensitive; }
- ~TypedScStrCollection();
+ TypedScStrCollection( const TypedScStrCollection& rCpy )
+ : ScSortedCollection( rCpy ) { bCaseSensitive = rCpy.bCaseSensitive; }
+ ~TypedScStrCollection();
virtual ScDataObject* Clone() const;
virtual short Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) const;
- TypedStrData* operator[]( const USHORT nIndex) const
- { return (TypedStrData*)At(nIndex); }
+ TypedStrData* operator[]( const USHORT nIndex) const;
- void SetCaseSensitive( BOOL bSet ) { bCaseSensitive = bSet; }
+ void SetCaseSensitive( BOOL bSet );
BOOL FindText( const String& rStart, String& rResult, USHORT& rPos, BOOL bBack ) const;
BOOL GetExactMatch( String& rString ) const;
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 08f3d1f7b1e3..85567a2a656d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -142,7 +142,7 @@ public:
//UNUSED2009-05 BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
//UNUSED2009-05 BOOL bLeft, BOOL bRight ) const;
- BOOL HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
+ bool HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const;
BOOL ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
SCCOL& rPaintCol, SCROW& rPaintRow,
@@ -235,7 +235,9 @@ public:
// TRUE = Zahlformat gesetzt
BOOL SetString( SCROW nRow, SCTAB nTab, const String& rString,
- formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO );
+ formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO,
+ SvNumberFormatter* pFormatter = NULL,
+ bool bDetectNumberFormat = true );
void SetValue( SCROW nRow, const double& rVal);
void SetError( SCROW nRow, const USHORT nError);
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 44bda96f8322..1d92962a56db 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -45,6 +45,13 @@
#include <memory>
#include <map>
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+#include <list>
+#include "dpobject.hxx"
+#include "dptabdat.hxx"
+// End Comments
+
class KeyEvent;
class OutputDevice;
class SdrObject;
@@ -256,6 +263,11 @@ private:
ScRangeName* pRangeName;
ScDBCollection* pDBCollection;
ScDPCollection* pDPCollection;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ std::list<ScDPObject> m_listDPObjectsInClip;
+ std::list<ScDPTableDataCache*> m_listDPObjectsCaches;
+ // End Comments
ScChartCollection* pChartCollection;
std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock;
ScPatternAttr* pSelectionAttr; // Attribute eines Blocks
@@ -492,6 +504,17 @@ public:
SC_DLLPUBLIC ScDPCollection* GetDPCollection();
ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ SC_DLLPUBLIC ScDPTableDataCache* GetDPObjectCache( long nID );
+ SC_DLLPUBLIC ScDPTableDataCache* GetUsedDPObjectCache ( ScRange rRange );
+ SC_DLLPUBLIC long AddDPObjectCache( ScDPTableDataCache* pData );
+ SC_DLLPUBLIC void RemoveDPObjectCache( long nID );
+ SC_DLLPUBLIC void RemoveUnusedDPObjectCaches();
+ SC_DLLPUBLIC void GetUsedDPObjectCache( std::list<ScDPTableDataCache*>& usedlist );
+ SC_DLLPUBLIC long GetNewDPObjectCacheId ();
+ // End Comments
+
SC_DLLPUBLIC ScChartCollection* GetChartCollection() const;
void StopTemporaryChartLock();
@@ -727,7 +750,9 @@ public:
SC_DLLPUBLIC void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
ULONG nFormatIndex, BOOL bForceTab = FALSE);
// return TRUE = Zahlformat gesetzt
- SC_DLLPUBLIC BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString );
+ SC_DLLPUBLIC BOOL SetString(
+ SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
+ SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const USHORT nError);
@@ -822,9 +847,9 @@ public:
BOOL IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
BOOL IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
- SC_DLLPUBLIC BOOL HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
- SCCOL nCol2, SCROW nRow2, SCTAB nTab2, USHORT nMask );
- SC_DLLPUBLIC BOOL HasAttrib( const ScRange& rRange, USHORT nMask );
+ SC_DLLPUBLIC bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
+ SCCOL nCol2, SCROW nRow2, SCTAB nTab2, USHORT nMask );
+ SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, USHORT nMask );
void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab,
const SvxBorderLine** ppLeft,
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index 60dba0bc27db..eab01d078081 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -55,33 +55,38 @@ class ScRange;
class ScDPDimension;
class ScDPCollection;
struct ScDPCacheCell;
-struct ScDPItemData;
struct ScQueryParam;
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+class ScDPItemData;
+// End Comments
class Date;
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+class ScDPTableDataCache;
+struct ScDPValueData;
+// End Comments
// ----------------------------------------------------------------------------
-class ScDPCacheTable
+class SC_DLLPUBLIC ScDPCacheTable
{
public:
-
- struct Cell
- {
- SCROW mnCategoryRef;
- ScDPCacheCell* mpContent;
-
- Cell();
- ~Cell();
- };
-
/** individual filter item used in SingleFilter and GroupFilter. */
struct FilterItem
{
- sal_Int32 mnMatchStrId;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ String maString;
+ // End Comments
double mfValue;
bool mbHasValue;
FilterItem();
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+ bool match( const ScDPItemData& rCellData ) const;
+// End Comments
};
/** interface class used for filtering of rows. */
@@ -90,19 +95,26 @@ public:
public:
/** returns true if the matching condition is met for a single cell
value, or false otherwise. */
- virtual bool match(const ScDPCacheCell& rCell) const = 0;
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+ virtual bool match( const ScDPItemData& rCellData ) const = 0;
+// End Comments
};
/** ordinary single-item filter. */
class SingleFilter : public FilterBase
{
public:
- explicit SingleFilter(ScSimpleSharedString& rSharedString,
- sal_Int32 nMatchStrId, double fValue, bool bHasValue);
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ explicit SingleFilter(String aString, double fValue, bool bHasValue);
+ // End Comments
virtual ~SingleFilter(){}
- virtual bool match(const ScDPCacheCell& rCell) const;
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ virtual bool match(const ScDPItemData& rCellData) const;
+ // End Comments
const String getMatchString();
double getMatchValue() const;
bool hasValue() const;
@@ -111,25 +123,27 @@ public:
explicit SingleFilter();
FilterItem maItem;
- ScSimpleSharedString mrSharedString;
};
/** multi-item (group) filter. */
class GroupFilter : public FilterBase
{
public:
- GroupFilter(ScSimpleSharedString& rSharedString);
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ GroupFilter();
+ // End Comments
virtual ~GroupFilter(){}
- virtual bool match(const ScDPCacheCell& rCell) const;
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ virtual bool match( const ScDPItemData& rCellData ) const;
+ // End Comments
void addMatchItem(const String& rStr, double fVal, bool bHasValue);
size_t getMatchItemCount() const;
private:
- GroupFilter();
::std::vector<FilterItem> maItems;
- ScSimpleSharedString mrSharedString;
};
/** single filtering criterion. */
@@ -140,22 +154,26 @@ public:
Criterion();
};
-
- ScDPCacheTable(ScDPCollection* pCollection);
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPCacheTable( ScDocument* pDoc,long nId );
+ // End Comments
~ScDPCacheTable();
sal_Int32 getRowSize() const;
sal_Int32 getColSize() const;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPTableDataCache* GetCache() const;
/** Fill the internal table from the cell range provided. This function
- assumes that the first row is the column header. */
- void fillTable(ScDocument* pDoc, const ScRange& rRange, const ScQueryParam& rQuery, BOOL* pSpecial,
- bool bIgnoreEmptyRows);
-
+ assumes that the first row is the column header. */
+ void fillTable( const ScQueryParam& rQuery, BOOL* pSpecial,
+ bool bIgnoreEmptyRows, bool bRepeatIfEmpty );
/** Fill the internal table from database connection object. This function
assumes that the first row is the column header. */
- void fillTable(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xRowSet,
- const Date& rNullDate);
+ void fillTable();
+ // End Comments
/** Check whether a specified row is active or not. When a row is active,
it is used in calculation of the results data. A row becomes inactive
@@ -169,15 +187,23 @@ 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 ScDPCacheCell* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const;
-
- const String* getFieldName(sal_Int32 nIndex) const;
-
- /** Get the unique entries for a field specified by index. The caller must
+ const ScDPItemData* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const;
+ void getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const;
+ String getFieldName( SCCOL nIndex) const;
+ //End Comments
+
+ /** Get the field index (i.e. column ID in the original data source) based
+ on the string value that corresponds with the column title. It returns
+ -1 if no field matching the string value exists. */
+ sal_Int32 getFieldIndex(const String& rStr) const;
+
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ /** Get the unique entries for a field specified by index. The caller must
make sure that the table is filled before calling function, or it will
get an empty collection. */
- const TypedScStrCollection& getFieldEntries(sal_Int32 nIndex) const;
-
+ const ::std::vector<SCROW>& getFieldEntries( sal_Int32 nColumn ) const;
+ // End Comments
/** Filter the table based on the specified criteria, and copy the
result to rTabData. This method is used, for example, to generate
a drill-down data table. */
@@ -186,6 +212,7 @@ public:
const ::std::hash_set<sal_Int32>& rRepeatIfEmptyDims);
void clear();
+ void swap(ScDPCacheTable& rOther);
bool empty() const;
private:
@@ -200,26 +227,23 @@ private:
*/
bool isRowQualified(sal_Int32 nRow, const ::std::vector<Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rRepeatIfEmptyDims) const;
void getValueData(ScDocument* pDoc, const ScAddress& rPos, ScDPCacheCell& rCell);
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ void InitNoneCache( ScDocument* pDoc );
+ // End Comments
private:
- typedef ::boost::shared_ptr<TypedScStrCollection> TypedScStrCollectionPtr;
-
- /** main data table. */
- ::std::vector< ::std::vector< ::ScDPCacheTable::Cell > > maTable;
-
- /** header string IDs */
- ::std::vector<sal_Int32> maHeader;
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
/** unique field entires for each field (column). */
- ::std::vector<TypedScStrCollectionPtr> maFieldEntries;
-
+ ::std::vector< ::std::vector<SCROW> > maFieldEntries;
+ // End Comments
/** 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;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPTableDataCache* mpCache;
+ ScDPTableDataCache* mpNoneCache;
+ // End Comments
};
-
-
#endif
diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx
new file mode 100755
index 000000000000..7de5947cc969
--- /dev/null
+++ b/sc/inc/dpglobal.hxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009.
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dpglobal.hxx,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+// Wang Xu Ming - DataPilot migration
+// Buffer&&Performance
+//
+#ifndef _SC_DPGLOBAL_HXX
+#define _SC_DPGLOBAL_HXX
+
+#include <algorithm>
+#include <list>
+#include <tools/gen.hxx>
+#include <tools/debug.hxx>
+#include <global.hxx>
+
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
+
+#include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
+#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
+#include <com/sun/star/sheet/DataPilotTableHeaderData.hpp>
+#include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
+#include <com/sun/star/sheet/DataPilotTablePositionType.hpp>
+#include <com/sun/star/sheet/DataPilotTableResultData.hpp>
+#include <com/sun/star/sheet/DataResultFlags.hpp>
+#include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/sheet/MemberResultFlags.hpp>
+#include <com/sun/star/sheet/TableFilterField.hpp>
+#include <com/sun/star/sheet/XDataPilotMemberResults.hpp>
+#include <com/sun/star/sheet/XDataPilotResults.hpp>
+#include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
+#include <com/sun/star/sheet/XLevelsSupplier.hpp>
+
+
+// moved from fieldwnd.hxx, see also SC_DAPI_MAXFIELDS
+#define MAX_LABELS 256
+
+#define MAX_PAGEFIELDS 10 // maximum count of fields for page area
+
+#define PIVOT_MAXFUNC 11
+#define PIVOT_FUNC_NONE 0x0000
+#define PIVOT_FUNC_SUM 0x0001
+#define PIVOT_FUNC_COUNT 0x0002
+#define PIVOT_FUNC_AVERAGE 0x0004
+#define PIVOT_FUNC_MAX 0x0008
+#define PIVOT_FUNC_MIN 0x0010
+#define PIVOT_FUNC_PRODUCT 0x0020
+#define PIVOT_FUNC_COUNT_NUM 0x0040
+#define PIVOT_FUNC_STD_DEV 0x0080
+#define PIVOT_FUNC_STD_DEVP 0x0100
+#define PIVOT_FUNC_STD_VAR 0x0200
+#define PIVOT_FUNC_STD_VARP 0x0400
+#define PIVOT_FUNC_AUTO 0x1000
+
+#define DATA_RENAME_SEPARATOR "_"
+#define __MAX_NUM_LEN 64
+#define __DECIMALPLACE 18
+
+#define DP_PROP_COLUMNGRAND "ColumnGrand"
+#define DP_PROP_FUNCTION "Function"
+#define DP_PROP_IGNOREEMPTY "IgnoreEmptyRows"
+#define DP_PROP_ISDATALAYOUT "IsDataLayoutDimension"
+#define DP_PROP_ISVISIBLE "IsVisible"
+#define DP_PROP_ORIENTATION "Orientation"
+#define DP_PROP_REPEATIFEMPTY "RepeatIfEmpty"
+#define DP_PROP_ROWGRAND "RowGrand"
+#define DP_PROP_SHOWDETAILS "ShowDetails"
+#define DP_PROP_SHOWEMPTY "ShowEmpty"
+#define DP_PROP_SUBTOTALS "SubTotals"
+#define DP_PROP_USEDHIERARCHY "UsedHierarchy"
+#define DP_PROP_FILTER "Filter"
+#define DP_PROP_POSITION "Position"
+
+#define DBG_TRACESTR( x ) \
+ {\
+ ByteString aTemp( x , RTL_TEXTENCODING_UTF8 ); \
+ DBG_TRACE( aTemp.GetBuffer() );\
+ }
+
+class TypedStrData;
+class ScDPObject;
+
+class SC_DLLPUBLIC ScDPItemData
+{
+public:
+ enum { MK_VAL = 0x01, MK_DATA = MK_VAL<<1, MK_ERR = MK_DATA<<1, MK_DATE = MK_ERR<<1, MK_DATEPART = MK_DATE<<1 };
+private:
+ union
+ {
+ ULONG nNumFormat;
+ sal_Int32 mnDatePart;
+ };
+
+ String aString;
+ double fValue;
+ BYTE mbFlag;
+ //BOOL bHasValue: 1 ;
+ //BOOL bHasData: 1;
+ //BOOL bErr: 1;
+
+ friend class ScDPTableDataCache;
+public:
+ ScDPItemData() : nNumFormat( 0 ), fValue(0.0), mbFlag( 0 ){}
+ ScDPItemData( ULONG nNF, const String & rS, double fV, BYTE bF ):nNumFormat(nNF), aString(rS), fValue(fV), mbFlag( bF ){}
+ ScDPItemData( const String& rS, double fV = 0.0, BOOL bHV = FALSE, const ULONG nNumFormat = 0 , BOOL bData = TRUE) ;
+ ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab );
+
+ void SetString( const String& rS ) { aString = rS; mbFlag &= ~(MK_VAL|MK_DATE); nNumFormat = 0; mbFlag |= MK_DATA; }
+// void SetValue ( double value , ULONG nNumFormat = 0 ) { bHasValue = TRUE; nNumFormat = 0;bHasData = TRUE; bDate = FALSE; fValue = value ;}
+ BOOL IsCaseInsEqual( const ScDPItemData& r ) const;
+
+ size_t Hash() const;
+
+ // exact equality
+ BOOL operator==( const ScDPItemData& r ) const;
+ // case insensitive equality
+ static sal_Int32 Compare( const ScDPItemData& rA, const ScDPItemData& rB );
+
+#ifdef DEBUG
+ void dump() const;
+#endif
+
+public:
+ BOOL IsHasData() const ;
+ BOOL IsHasErr() const ;
+ BOOL IsValue() const;
+ String GetString() const ;
+ double GetValue() const ;
+ ULONG GetNumFormat() const ;
+ BOOL HasStringData() const ;
+ BOOL IsDate() const;
+ BOOL HasDatePart() const;
+ void SetDate( BOOL b ) ;
+
+ TypedStrData* CreateTypeString( );
+ sal_uInt8 GetType() const;
+ BYTE & GetFlag() throw() { return mbFlag; }
+ const BYTE & GetFlag() const throw() { return const_cast<ScDPItemData*>(this)->GetFlag(); }
+};
+
+class SC_DLLPUBLIC ScDPItemDataPool
+{
+public:
+ // construct
+ ScDPItemDataPool(void);
+ ScDPItemDataPool(const ScDPItemDataPool& r);
+
+ virtual ~ScDPItemDataPool(void);
+ virtual const ScDPItemData* getData( sal_Int32 nId );
+ virtual sal_Int32 getDataId( const ScDPItemData& aData );
+ virtual sal_Int32 insertData( const ScDPItemData& aData );
+protected:
+ struct DataHashFunc : public std::unary_function< const ScDPItemData &, size_t >
+ {
+ size_t operator() (const ScDPItemData &rData) const { return rData.Hash(); }
+ };
+
+ typedef ::std::hash_multimap< ScDPItemData, sal_Int32, DataHashFunc > DataHash;
+
+ ::std::vector< ScDPItemData > maItems;
+ DataHash maItemIds;
+};
+
+class ScDPInfoWnd;
+class ScDocShell;
+class ScTabViewShell;
+namespace ScDPGlobal
+{
+// used for core data
+ String GetFieldFuncString( const String& rSourceName, USHORT &rFuncMask, BOOL bIsValue );
+ String GetFuncString( const String &rString, const USHORT nIndex );
+ com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> DP_GetMembers( const com::sun::star::uno::Reference<
+ com::sun::star::sheet::XDimensionsSupplier>&rSrc, long nField );
+// common operation
+ String operator + ( const String & rL, const String &rR );
+ Rectangle operator *( const Rectangle &rLeft, const std::pair<double,double> & rRight );
+// used for DataPilot Panel
+ ScDPInfoWnd* GetDPInfoWnd( ScTabViewShell *pViewShell );
+ bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip = FALSE );
+
+}
+#endif
diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx
index 39770d2adffd..2a66f8b45555 100644
--- a/sc/inc/dpgroup.hxx
+++ b/sc/inc/dpgroup.hxx
@@ -34,7 +34,10 @@
#include "dptabdat.hxx"
#include "scdllapi.h"
-
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+#include "dpglobal.hxx"
+// End Comments
class ScDocument;
class SvNumberFormatter;
@@ -73,8 +76,11 @@ public:
sal_Int32 GetDatePart() const { return nDatePart; }
const ScDPNumGroupInfo& GetNumInfo() const { return aNumInfo; }
- void FillColumnEntries( TypedScStrCollection& rEntries, const TypedScStrCollection& rOriginal,
- SvNumberFormatter* pFormatter ) const;
+ // Wang Xu Ming -- 2009-9-8
+ // DataPilot Migration - Cache&&Performance
+ void FillColumnEntries( SCCOL nSourceDim, ScDPTableDataCache* pCahe , std::vector< SCROW >& rEntries,
+ const std::vector< SCROW >& rOriginal ) const;
+ // End Comments
};
// --------------------------------------------------------------------
@@ -108,8 +114,10 @@ class ScDPGroupDimension
String aGroupName;
ScDPDateGroupHelper* pDateHelper;
ScDPGroupItemVec aItems;
- mutable TypedScStrCollection* pCollection; // collection of item names (cached)
-
+ // Wang Xu Ming -- 2009-9-4
+ // DataPilot Migration - Cache&&Performance
+ mutable ::std::vector< SCROW > maMemberEntries;
+ // End Comments
public:
ScDPGroupDimension( long nSource, const String& rNewName );
ScDPGroupDimension( const ScDPGroupDimension& rOther );
@@ -122,9 +130,12 @@ public:
long GetSourceDim() const { return nSourceDim; }
long GetGroupDim() const { return nGroupDim; }
- const String& GetName() const { return aGroupName; }
+ const String& GetName() const { return aGroupName; }
- const TypedScStrCollection& GetColumnEntries( const TypedScStrCollection& rOriginal, ScDocument* pDoc ) const;
+// Wang Xu Ming -- 2009-9-2
+// DataPilot Migration - Cache&&Performance
+ const std::vector< SCROW >& GetColumnEntries( const ScDPCacheTable& rCacheTable, const std::vector< SCROW >& rOriginal ) const;
+// End Comments
const ScDPGroupItem* GetGroupForData( const ScDPItemData& rData ) const; // rData = entry in original dim.
const ScDPGroupItem* GetGroupForName( const ScDPItemData& rName ) const; // rName = entry in group dim.
const ScDPGroupItem* GetGroupByIndex( size_t nIndex ) const;
@@ -146,7 +157,10 @@ class SC_DLLPUBLIC ScDPNumGroupDimension
{
ScDPNumGroupInfo aGroupInfo; // settings
ScDPDateGroupHelper* pDateHelper;
- mutable TypedScStrCollection* pCollection; // collection of item names (cached)
+// Wang Xu Ming -- 2009-9-4
+// DataPilot Migration - Cache&&Performance
+ mutable ::std::vector< SCROW > maMemberEntries;
+// End Comments
mutable bool bHasNonInteger; // initialized in GetNumEntries
mutable sal_Unicode cDecSeparator; // initialized in GetNumEntries
@@ -158,14 +172,15 @@ public:
ScDPNumGroupDimension& operator=( const ScDPNumGroupDimension& rOther );
- const TypedScStrCollection& GetNumEntries( const TypedScStrCollection& rOriginal, ScDocument* pDoc ) const;
-
const ScDPNumGroupInfo& GetInfo() const { return aGroupInfo; }
bool HasNonInteger() const { return bHasNonInteger; }
sal_Unicode GetDecSeparator() const { return cDecSeparator; }
const ScDPDateGroupHelper* GetDateHelper() const { return pDateHelper; }
+ const std::vector< SCROW >& GetNumEntries( SCCOL nSourceDim, ScDPTableDataCache* pCache,
+ const std::vector< SCROW >& rOriginal ) const;
+
void MakeDateHelper( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart );
void DisposeData();
@@ -187,7 +202,11 @@ class ScDPGroupTableData : public ScDPTableData
ScDocument* pDoc;
StringHashSet aGroupNames;
- void FillGroupValues( ScDPItemData* pItemData, long nCount, const long* pDims );
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+ void FillGroupValues( SCROW* pItemDataIndex, long nCount, const long* pDims );
+ virtual long GetSourceDim( long nDim );
+// End Comments
void CopyFields(const ::std::vector<long>& rFieldDims, ::std::vector<long>& rNewFieldDims);
bool IsNumGroupDimension( long nDimension ) const;
@@ -208,11 +227,18 @@ public:
ScDocument* GetDocument() { return pDoc; }
virtual long GetColumnCount();
- virtual const TypedScStrCollection& GetColumnEntries(long nColumn);
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+ virtual long GetMembersCount( long nDim );
+ virtual const std::vector< SCROW >& GetColumnEntries( long nColumn ) ;
+ virtual const ScDPItemData* GetMemberById( long nDim, long nId);
+ virtual long Compare( long nDim, long nDataId1, long nDataId2);
+
+// End Comments
virtual String getDimensionName(long nColumn);
virtual BOOL getIsDataLayoutDimension(long nColumn);
virtual BOOL IsDateDimension(long nDim);
- virtual UINT32 GetNumberFormat(long nDim);
+ virtual ULONG GetNumberFormat(long nDim);
virtual void DisposeData();
virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty );
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 917d62f38bfe..65e89ec75d41 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -115,8 +115,18 @@ private:
SC_DLLPRIVATE ScDPTableData* GetTableData();
SC_DLLPRIVATE void CreateObjects();
SC_DLLPRIVATE void CreateOutput();
+ BOOL bRefresh;
+ long mnCacheId;
public:
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ inline void SetRefresh() { bRefresh = TRUE; }
+ const ScDPTableDataCache* GetCache() const;
+ long GetCacheId() const;
+ void SetCacheId( long nCacheId );
+ ULONG RefreshCache();
+ // End Comments
ScDPObject( ScDocument* pD );
ScDPObject(const ScDPObject& r);
virtual ~ScDPObject();
@@ -251,19 +261,6 @@ 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();
-};
// ============================================================================
@@ -271,20 +268,6 @@ class ScDPCollection : public ScCollection
{
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);
ScDPCollection(const ScDPCollection& r);
@@ -303,15 +286,10 @@ public:
String CreateNewName( USHORT nMin = 1 ) const;
- ScSimpleSharedString& GetSharedString();
-
void FreeTable(ScDPObject* pDPObj);
SC_DLLPUBLIC bool InsertNewTable(ScDPObject* pDPObj);
bool HasDPTable(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
-
- ScDPCacheCell* getCacheCellFromPool(const ScDPCacheCell& rCell);
- void clearCacheCellPool();
};
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index 587e23d8109b..bfff0b97a168 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -88,6 +88,9 @@ public:
};
+bool operator == (const ::com::sun::star::sheet::DataPilotFieldSortInfo &l, const ::com::sun::star::sheet::DataPilotFieldSortInfo &r );
+bool operator == (const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo &l, const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo &r );
+bool operator == (const ::com::sun::star::sheet::DataPilotFieldReference &l, const ::com::sun::star::sheet::DataPilotFieldReference &r );
class SC_DLLPUBLIC ScDPSaveDimension
{
private:
@@ -175,6 +178,9 @@ public:
void WriteToSource( const com::sun::star::uno::Reference<
com::sun::star::uno::XInterface>& xDim );
+ void Refresh( const com::sun::star::uno::Reference<
+ com::sun::star::sheet::XDimensionsSupplier>& xSource ,
+ const std::list<String> & deletedDims);
void UpdateMemberVisibility(const ::std::hash_map< ::rtl::OUString, bool, ::rtl::OUStringHash>& rData);
@@ -193,6 +199,10 @@ private:
USHORT nRepeatEmptyMode;
BOOL bFilterButton; // not passed to DataPilotSource
BOOL bDrillDown; // not passed to DataPilotSource
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ long mnCacheId;
+ // End Comments
/** if true, all dimensions already have all of their member instances
* created. */
@@ -248,10 +258,15 @@ public:
BOOL GetDrillDown() const { return bDrillDown; }
void WriteToSource( const com::sun::star::uno::Reference<
+ com::sun::star::sheet::XDimensionsSupplier>& xSource );
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ void Refresh( const com::sun::star::uno::Reference<
com::sun::star::sheet::XDimensionsSupplier>& xSource );
-
BOOL IsEmpty() const;
-
+ inline long GetCacheId() const{ return mnCacheId; }
+ inline void SetCacheId( long nCacheId ){ mnCacheId = nCacheId; }
+ // End Comments
const ScDPDimensionSaveData* GetExistingDimensionData() const { return pDimensionData; }
SC_DLLPUBLIC ScDPDimensionSaveData* GetDimensionData(); // create if not there
void SetDimensionData( const ScDPDimensionSaveData* pNew ); // copied
diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx
index 21e23e883da9..732e3d30e8df 100644
--- a/sc/inc/dpsdbtab.hxx
+++ b/sc/inc/dpsdbtab.hxx
@@ -57,23 +57,25 @@ struct ScImportSourceDesc
aObject == rOther.aObject &&
nType == rOther.nType &&
bNative == rOther.bNative; }
-};
-class ScDatabaseDPData_Impl;
+ // Wang Xu Ming -- 2009-9-15
+ // DataPilot Migration - Cache&&Performance
+ ScDPTableDataCache* GetExistDPObjectCache( ScDocument* pDoc ) const;
+ ScDPTableDataCache* CreateCache( ScDocument* pDoc , long nID ) const;
+ ScDPTableDataCache* GetCache( ScDocument* pDoc, long nID ) const;
+ long GetCacheId( ScDocument* pDoc, long nID ) const;
+ // End Comments
+};
class ScDatabaseDPData : public ScDPTableData
{
private:
- ScDatabaseDPData_Impl* pImpl;
-
- BOOL OpenDatabase();
-
+ ScDPCacheTable aCacheTable;
public:
- ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport);
+ ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport, long nCacheId = -1);
virtual ~ScDatabaseDPData();
virtual long GetColumnCount();
- virtual const TypedScStrCollection& GetColumnEntries(long nColumn);
virtual String getDimensionName(long nColumn);
virtual BOOL getIsDataLayoutDimension(long nColumn);
virtual BOOL IsDateDimension(long nDim);
diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index a0e67371eff1..a8d80072c68a 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -41,8 +41,10 @@ namespace com { namespace sun { namespace star { namespace sheet {
}}}}
class ScDPDimension;
-struct ScDPItemData;
-
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+class ScDPItemData;
+// End Comments
// --------------------------------------------------------------------
//
// implementation of ScDPTableData with sheet data
@@ -56,25 +58,38 @@ struct ScSheetSourceDesc
BOOL operator== ( const ScSheetSourceDesc& rOther ) const
{ return aSourceRange == rOther.aSourceRange &&
aQueryParam == rOther.aQueryParam; }
+// Wang Xu Ming - DataPilot migration
+// Buffer&&Performance
+ ScDPTableDataCache* CreateCache( ScDocument* pDoc, long nID = -1) const;
+ ULONG CheckValidate( ScDocument* pDoc ) const;
+ ScDPTableDataCache* GetCache( ScDocument* pDoc, long nID ) const;
+ ScDPTableDataCache* GetExistDPObjectCache ( ScDocument* pDoc ) const;
+ long GetCacheId( ScDocument* pDoc, long nID ) const;
+
+// End Comments
};
-class ScSheetDPData_Impl;
-
class SC_DLLPUBLIC ScSheetDPData : public ScDPTableData
{
private:
- ScSheetDPData_Impl* pImpl;
+ ScQueryParam aQuery;
+ BOOL* pSpecial;
+ BOOL bIgnoreEmptyRows;
+ BOOL bRepeatIfEmpty;
+
+ ScDPCacheTable aCacheTable;
public:
- ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc );
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc, long nCacheId = -1 );
virtual ~ScSheetDPData();
-
+ // End Comments
virtual long GetColumnCount();
- virtual const TypedScStrCollection& GetColumnEntries(long nColumn);
virtual String getDimensionName(long nColumn);
virtual BOOL getIsDataLayoutDimension(long nColumn);
virtual BOOL IsDateDimension(long nDim);
- virtual UINT32 GetNumberFormat(long nDim);
+ virtual ULONG GetNumberFormat(long nDim);
virtual void DisposeData();
virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty );
diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx
index 43c719e9ee16..6323434ca4ad 100644
--- a/sc/inc/dptabdat.hxx
+++ b/sc/inc/dptabdat.hxx
@@ -31,7 +31,10 @@
#include "address.hxx"
#include "dpoutput.hxx"
#include "dpcachetable.hxx"
-
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+#include "dptablecache.hxx"
+// End Comments
#include <tools/string.hxx>
#include <vector>
@@ -43,8 +46,6 @@ namespace com { namespace sun { namespace star { namespace sheet {
struct DataPilotFieldFilter;
}}}}
-class TypedScStrCollection;
-class ScSimpleSharedString;
// -----------------------------------------------------------------------
@@ -71,28 +72,6 @@ class ScSimpleSharedString;
// base class ScDPTableData to allow implementation with tabular data
// by deriving only of this
//
-
-struct ScDPItemData
-{
- String aString;
- double fValue;
- BOOL bHasValue;
-
- ScDPItemData() : fValue(0.0), bHasValue(FALSE) {}
- ScDPItemData( const String& rS, double fV = 0.0, BOOL bHV = FALSE ) :
- aString(rS), fValue(fV), bHasValue( bHV ) {}
-
- void SetString( const String& rS ) { aString = rS; bHasValue = FALSE; }
- BOOL IsCaseInsEqual( const ScDPItemData& r ) const;
-
- size_t Hash() const;
-
- // exact equality
- BOOL operator==( const ScDPItemData& r ) const;
- // case insensitive equality
- static sal_Int32 Compare( const ScDPItemData& rA, const ScDPItemData& rB );
-};
-
#define SC_VALTYPE_EMPTY 0
#define SC_VALTYPE_VALUE 1
#define SC_VALTYPE_STRING 2
@@ -113,15 +92,18 @@ class ScDPInitState;
class ScDPResultMember;
class ScDocument;
-class ScDPTableData
+ class SC_DLLPUBLIC ScDPTableData
{
// cached data for GetDatePart
long nLastDateVal;
long nLastHier;
long nLastLevel;
long nLastRet;
- ScSimpleSharedString& mrSharedString;
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ long mnCacheId;
+ const ScDocument* mpDoc;
+ // End Comments
public:
/** This structure stores dimension information used when calculating
@@ -147,7 +129,10 @@ public:
CalcInfo();
};
- ScDPTableData(ScDocument* pDoc);
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPTableData(ScDocument* pDoc, long nCacheId );
+ // End Comments
virtual ~ScDPTableData();
long GetDatePart( long nDateVal, long nHierarchy, long nLevel );
@@ -156,11 +141,16 @@ public:
//! or separate Str and ValueCollection
virtual long GetColumnCount() = 0;
- virtual const TypedScStrCollection& GetColumnEntries(long nColumn) = 0;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ virtual const std::vector< SCROW >& GetColumnEntries( long nColumn ) ;
+ long GetCacheId() const;
+ // End Comments
virtual String getDimensionName(long nColumn) = 0;
virtual BOOL getIsDataLayoutDimension(long nColumn) = 0;
virtual BOOL IsDateDimension(long nDim) = 0;
- virtual UINT32 GetNumberFormat(long nDim);
+ virtual ULONG GetNumberFormat(long nDim);
+ virtual UINT32 GetNumberFormatByIdx( NfIndexTableOffset );
virtual void DisposeData() = 0;
virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ) = 0;
@@ -176,23 +166,33 @@ public:
// overloaded in ScDPGroupTableData:
virtual BOOL IsBaseForGroup(long nDim) const;
- virtual long GetGroupBase(long nGroupDim) const;
+ virtual long GetGroupBase(long nGroupDim) const;
virtual BOOL IsNumOrDateGroup(long nDim) const;
virtual BOOL IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex,
const ScDPItemData& rBaseData, long nBaseIndex ) const;
virtual BOOL HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex,
const ScDPItemData& rSecondData, long nSecondIndex ) const;
- ScSimpleSharedString& GetSharedString();
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ virtual long GetMembersCount( long nDim );
+ virtual const ScDPItemData* GetMemberByIndex( long nDim, long nIndex );
+ virtual const ScDPItemData* GetMemberById( long nDim, long nId);
+ virtual SCROW GetIdOfItemData( long nDim, const ScDPItemData& rData );
+ virtual long GetSourceDim( long nDim );
+ virtual long Compare( long nDim, long nDataId1, long nDataId2);
+ // End Comments
protected:
/** This structure stores vector arrays that hold intermediate data for
each row during cache table iteration. */
struct CalcRowData
{
- ::std::vector<ScDPItemData> aColData;
- ::std::vector<ScDPItemData> aRowData;
- ::std::vector<ScDPItemData> aPageData;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ::std::vector< SCROW > aColData;
+ ::std::vector< SCROW > aRowData;
+ ::std::vector< SCROW > aPageData;
+ // End Comments
::std::vector<ScDPValueData> aValues;
};
@@ -201,10 +201,11 @@ protected:
void CalcResultsFromCacheTable(const ScDPCacheTable& rCacheTable, CalcInfo& rInfo, bool bAutoShow);
private:
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
void GetItemData(const ScDPCacheTable& rCacheTable, sal_Int32 nRow,
- const ::std::vector<long>& rDims, ::std::vector<ScDPItemData>& rItemData);
+ const ::std::vector<long>& rDims, ::std::vector< SCROW >& rItemData);
+ // End Comments
};
-
-
#endif
diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx
new file mode 100644
index 000000000000..953c793093be
--- /dev/null
+++ b/sc/inc/dptablecache.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009.
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dptablecache.hxx,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef DPTABLECACHE_HXX
+#define DPTABLECACHE_HXX
+// Wang Xu Ming -- 12/21/2008
+// Add Data Cache Support.
+#ifndef SC_SCGLOB_HXX
+#include "global.hxx"
+#endif
+//Added by PengYunQuan for SODC_16015
+#include <svl/zforlist.hxx>
+//end
+#include <vector>
+#include "dpglobal.hxx"
+
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+
+class ScDPTableDataCache;
+class TypedStrData;
+struct ScQueryParam;
+
+// --------------------------------------------------------------------
+//
+// base class ScDPTableData to allow implementation with tabular data
+// by deriving only of this
+//
+
+class SC_DLLPUBLIC ScDPTableDataCache
+{
+ long mnID;
+ ScDocument* mpDoc;
+
+ long mnColumnCount; // Column count
+
+ std::vector<ScDPItemData*>* mpTableDataValues; //Data Pilot Table's index - value map
+ std::vector<SCROW>* mpSourceData; //Data Pilot Table's Source data
+ std::vector<SCROW>* mpGlobalOrder; //Sorted members index
+ std::vector<SCROW>* mpIndexOrder; //Index the sorted number
+ std::vector<ScDPItemData*> mrLabelNames; //Source Label data
+ std::vector<BOOL> mbEmptyRow; //If empty row?
+ mutable ScDPItemDataPool maAdditionalDatas;
+public:
+ SCROW GetOrder( long nDim, SCROW nIndex ) const;
+ SCROW GetIdByItemData( long nDim, String sItemData ) const;
+ SCROW GetIdByItemData( long nDim, const ScDPItemData& rData ) const;
+
+ SCROW GetAdditionalItemID ( String sItemData );
+ SCROW GetAdditionalItemID( const ScDPItemData& rData );
+
+ SCCOL GetDimensionIndex( String sName) const;
+ const ScDPItemData* GetSortedItemData( SCCOL nDim, SCROW nOrder ) const;
+ ULONG GetNumType ( ULONG nFormat ) const;
+ ULONG GetNumberFormat( long nDim ) const;
+ BOOL IsDateDimension( long nDim ) const ;
+ ULONG GetDimNumType( SCCOL nDim) const;
+ SCROW GetDimMemberCount( SCCOL nDim ) const;
+
+ SCROW GetSortedItemDataId( SCCOL nDim, SCROW nOrder ) const;
+ const std::vector<ScDPItemData*>& GetDimMemberValues( SCCOL nDim )const;
+ void SetId( long nId ){ mnID = nId;}
+ void AddRow( ScDPItemData* pRow, USHORT nCount );
+ bool InitFromDoc( ScDocument* pDoc, const ScRange& rRange );
+ bool InitFromDataBase (const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate);
+
+ SCROW GetRowCount() const;
+ SCROW GetItemDataId( USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty ) const;
+ String GetDimensionName( USHORT nColumn ) const;
+ bool IsEmptyMember( SCROW nRow, USHORT nColumn ) const;
+ bool IsRowEmpty( SCROW nRow ) const;
+ bool IsValid() const;
+ bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, BOOL* pSpecial );
+
+ ScDocument* GetDoc() const;//ms-cache-core
+ long GetColumnCount() const;
+ long GetId() const;
+
+ const ScDPItemData* GetItemDataById( long nDim, SCROW nId ) const;
+
+ BOOL operator== ( const ScDPTableDataCache& r ) const;
+
+//construction
+ ScDPTableDataCache( ScDocument* pDoc );
+//deconstruction
+ virtual ~ScDPTableDataCache();
+
+protected:
+private:
+ void AddLabel( ScDPItemData* pData);
+ BOOL AddData( long nDim, ScDPItemData* itemData );
+};
+
+#endif //DPTABLECACHE_HXX
diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index d4e8807d4a3b..e35975ab170f 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -57,8 +57,10 @@ class ScDPResultMember;
class ScDPResultVisibilityData;
struct ScDPValueData;
-struct ScDPItemData;
-
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+class ScDPItemData;
+// End Comments
//
// Member names that are being processed for InitFrom/LateInitFrom
// (needed for initialization of grouped items)
@@ -67,21 +69,26 @@ struct ScDPItemData;
class ScDPInitState
{
long* pIndex; // array
- ScDPItemData* pData; // array
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+ SCROW* pData; // array
+ // End Comments
long nCount;
public:
ScDPInitState();
~ScDPInitState();
- void AddMember( long nSourceIndex, const ScDPItemData& rName );
+ void AddMember( long nSourceIndex,SCROW nMember);
void RemoveMember();
long GetCount() const { return nCount; }
const long* GetSource() const { return pIndex; }
- const ScDPItemData* GetNames() const { return pData; }
-
- const ScDPItemData* GetNameForIndex( long nIndexValue ) const;
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+ const SCROW* GetNameIds() const { return pData; }
+ const SCROW GetNameIdForIndex( long nIndexValue ) const;
+// End Comments
};
typedef ::std::vector<sal_Int32> ScMemberSortOrder;
@@ -230,6 +237,68 @@ class ScDPDataMember;
#define SC_DPMEASURE_ALL -1
#define SC_DPMEASURE_ANY -2
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+
+struct MemberHashIndexFunc : public std::unary_function< const SCROW &, size_t >
+{
+ size_t operator() (const SCROW &rDataIndex) const { return rDataIndex; }
+};
+
+class ScDPParentDimData
+{
+public:
+ const SCROW mnOrder; //! Ref
+ const ScDPDimension* mpParentDim; //! Ref
+ const ScDPLevel* mpParentLevel; //! Ref
+ const ScDPMember* mpMemberDesc; //! Ref
+
+ ScDPParentDimData():mnOrder(-1), mpParentDim( NULL), mpParentLevel( NULL ), mpMemberDesc( NULL ){}
+ ScDPParentDimData( const SCROW nIndex, ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember ): mnOrder( nIndex ), mpParentDim( pDim), mpParentLevel( pLev ), mpMemberDesc( pMember ){}
+};
+
+typedef std::vector <ScDPParentDimData *> DimMemberArray;
+typedef std::hash_map < SCROW, ScDPParentDimData *, MemberHashIndexFunc> DimMemberHash;
+
+class ResultMembers
+{
+ DimMemberHash maMemberHash;
+ BOOL mbHasHideDetailsMember;
+public:
+ ScDPParentDimData* FindMember( const SCROW& nIndex ) const;
+ void InsertMember( ScDPParentDimData* pNew );
+ BOOL IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; }
+ void SetHasHideDetailsMembers( BOOL b ) { mbHasHideDetailsMember=b; }
+ ResultMembers();
+ virtual ~ResultMembers();
+};
+
+class LateInitParams
+{
+private:
+ const ::std::vector<ScDPDimension*>& mppDim;
+ const ::std::vector<ScDPLevel*>& mppLev;
+
+ BOOL mbRow;
+ BOOL mbInitChild;
+ BOOL mbAllChildren;
+public:
+ LateInitParams( const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev,
+ BOOL bRow, BOOL bInitChild = TRUE , BOOL bAllChildren = FALSE);
+ ~LateInitParams();
+
+ void SetInitChild( BOOL b ) { mbInitChild = b; }
+ void SetInitAllChildren( BOOL b ) { mbAllChildren = b; }
+
+ inline ScDPDimension* GetDim( size_t nPos ) const { return mppDim[nPos];}
+ inline ScDPLevel* GetLevel( size_t nPos ) const { return mppLev[nPos];}
+
+ inline BOOL GetInitChild() const {return mbInitChild; }
+ inline BOOL GetInitAllChild() const { return mbAllChildren; }
+ inline BOOL IsRow() const { return mbRow; }
+ BOOL IsEnd( size_t nPos ) const ;
+};
+// End Comments
class ScDPResultData
{
@@ -247,7 +316,7 @@ private:
BOOL bDataAtRow;
//! add "displayed values" settings
-
+ mutable std::vector< ResultMembers* > mpDimMembers;
public:
ScDPResultData( ScDPSource* pSrc ); //! Ref
~ScDPResultData();
@@ -278,11 +347,18 @@ public:
BOOL IsBaseForGroup( long nDim ) const; // any group
long GetGroupBase( long nGroupDim ) const;
BOOL IsNumOrDateGroup( long nDim ) const;
+ // Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
BOOL IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex,
- const ScDPItemData& rBaseData, long nBaseIndex ) const;
- BOOL HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex,
+ long nBaseDataId, long nBaseIndex ) const;
+ BOOL IsInGroup( SCROW nGroupDataId, long nGroupIndex,
+ const ScDPItemData& rBaseData, long nBaseIndex ) const;
+ BOOL HasCommonElement( SCROW nFirstDataId, long nFirstIndex,
const ScDPItemData& rSecondData, long nSecondIndex ) const;
+ ResultMembers* GetDimResultMembers( long nDim , ScDPDimension* pDim , ScDPLevel* pLevel) const ;
+
+// End Comments
const ScDPSource* GetSource() const;
};
@@ -291,9 +367,10 @@ class ScDPResultMember
{
private:
const ScDPResultData* pResultData;
- const ScDPDimension* pParentDim; //! Ref
- const ScDPLevel* pParentLevel; //! Ref
- const ScDPMember* pMemberDesc; //! Ref
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPParentDimData aParentDimData;
+ // End Comments
ScDPResultDimension* pChildDimension;
ScDPDataMember* pDataRoot;
BOOL bHasElements;
@@ -303,21 +380,30 @@ private:
BOOL bAutoHidden;
ScDPAggData aColTotal; // to store column totals
+ USHORT nMemberStep; // step to show details
public:
- ScDPResultMember( const ScDPResultData* pData, const ScDPDimension* pDim,
- const ScDPLevel* pLev, const ScDPMember* pDesc,
- BOOL bForceSub ); //! Ref
- ~ScDPResultMember();
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPResultMember( const ScDPResultData* pData, const ScDPParentDimData& rParentDimData,
+ BOOL bForceSub ); //! Ref
+ ScDPResultMember( const ScDPResultData* pData, BOOL bForceSub );
+ // End Comments
+ ~ScDPResultMember();
+
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
void InitFrom( const ::std::vector<ScDPDimension*>& ppDim,
- const ::std::vector<ScDPLevel*>& ppLev,
- size_t nPos,
- ScDPInitState& rInitState );
- void LateInitFrom( const ::std::vector<ScDPDimension*>& ppDim,
- const ::std::vector<ScDPLevel*>& ppLev,
- const ::std::vector<ScDPItemData>& pItemData,
- size_t nPos,
- ScDPInitState& rInitState );
+ const ::std::vector<ScDPLevel*>& ppLev,
+ size_t nPos,
+ ScDPInitState& rInitState,
+ BOOL bInitChild = TRUE );
+ void LateInitFrom(
+ LateInitParams& rParams,
+ const ::std::vector< SCROW >& pItemData,
+ size_t nPos,
+ ScDPInitState& rInitState);
+ void CheckShowEmpty( BOOL bShow = FALSE );
+ // End Comments
String GetName() const;
void FillItemData( ScDPItemData& rData ) const;
BOOL IsValid() const;
@@ -329,17 +415,22 @@ public:
// BOOL SubTotalEnabled() const;
long GetSubTotalCount( long* pUserSubStart = NULL ) const;
- BOOL IsNamedItem( const ScDPItemData& r ) const;
- bool IsValidEntry( const ::std::vector<ScDPItemData>& aMembers ) const;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ BOOL IsNamedItem( SCROW nIndex ) const;
+ bool IsValidEntry( const ::std::vector< SCROW >& aMembers ) const;
+ // End Comments
void SetHasElements() { bHasElements = TRUE; }
void SetAutoHidden() { bAutoHidden = TRUE; }
- void ProcessData( const ::std::vector<ScDPItemData>& aChildMembers,
- const ScDPResultDimension* pDataDim,
- const ::std::vector<ScDPItemData>& aDataMembers,
- const ::std::vector<ScDPValueData>& aValues );
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ void ProcessData( const ::std::vector<SCROW>& aChildMembers,
+ const ScDPResultDimension* pDataDim,
+ const ::std::vector<SCROW>& aDataMembers,
+ const ::std::vector<ScDPValueData>& aValues );
+ // End Comments
void FillMemberResults( com::sun::star::uno::Sequence<
com::sun::star::sheet::MemberResult>* pSequences,
long& rPos, long nMeasure, BOOL bRoot,
@@ -369,9 +460,15 @@ public:
ScDPDataMember* GetDataRoot() const { return pDataRoot; }
- const ScDPDimension* GetParentDim() const { return pParentDim; } //! Ref
- const ScDPLevel* GetParentLevel() const { return pParentLevel; } //! Ref
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ const ScDPDimension* GetParentDim() const { return aParentDimData.mpParentDim; } //! Ref
+ const ScDPLevel* GetParentLevel() const { return aParentDimData.mpParentLevel; } //! Ref
+ const ScDPMember* GetDPMember()const { return aParentDimData.mpMemberDesc; } //! Ref
+ inline SCROW GetOrder() const { return aParentDimData.mnOrder; } //! Ref
+ inline BOOL IsRoot() const { return GetParentLevel() == NULL; }
+ SCROW GetDataId( ) const ;
+ // End Comments
ScDPAggData* GetColTotal( long nMeasure ) const;
void FillVisibilityData(ScDPResultVisibilityData& rData) const;
@@ -397,13 +494,17 @@ public:
BOOL IsVisible() const;
BOOL HasData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
- BOOL IsNamedItem( const ScDPItemData& r ) const;
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ BOOL IsNamedItem( SCROW r ) const;
+ // End Comments
BOOL HasHiddenDetails() const;
- void ProcessData( const ::std::vector<ScDPItemData>& aChildMembers, const ::std::vector<ScDPValueData>& aValues,
- const ScDPSubTotalState& rSubState );
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ void ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValueData>& aValues,
+ const ScDPSubTotalState& rSubState );
+ // End Comments
BOOL HasError( long nMeasure, const ScDPSubTotalState& rSubState ) const;
double GetAggregate( long nMeasure, const ScDPSubTotalState& rSubState ) const;
const ScDPAggData* GetConstAggData( long nMeasure, const ScDPSubTotalState& rSubState ) const;
@@ -443,15 +544,13 @@ SV_DECL_PTRARR_DEL(ScDPDataMembers, ScDPDataMemberPtr, SC_DP_RES_GROW, SC_DP_RES
class ScDPResultDimension
{
public :
- struct MemberHashFunc : public std::unary_function< const ScDPItemData &, size_t >
- {
- size_t operator() (const ScDPItemData &rData) const { return rData.Hash(); }
- };
- typedef std::vector <ScDPResultMember *> MemberArray;
- typedef std::hash_map <ScDPItemData, ScDPResultMember *, MemberHashFunc> MemberHash;
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ typedef std::vector <ScDPResultMember *> MemberArray;
+ typedef std::map < SCROW , ScDPResultMember *> MemberHash;
+ // End Comments
private:
- const ScDPResultData* pResultData;
+ const ScDPResultData* pResultData;
MemberArray maMemberArray;
MemberHash maMemberHash;
BOOL bInitialized;
@@ -466,31 +565,47 @@ private:
long nAutoMeasure;
long nAutoCount;
- ScDPResultMember* FindMember( const ScDPItemData& rData ) const;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPResultMember* FindMember( SCROW iData ) const;
+ ScDPResultMember* AddMember( const ScDPParentDimData& aData );
+ ScDPResultMember* InsertMember( ScDPParentDimData* pMemberData );
+ ResultMembers* GetResultMember( ScDPDimension* pDim, ScDPLevel* pLevel );
+ void InitWithMembers( LateInitParams& rParams,
+ const ::std::vector< SCROW >& pItemData,
+ size_t nPos,
+ ScDPInitState& rInitState );
+ // End Comments
public:
- ScDPResultDimension( const ScDPResultData* pData );
- ~ScDPResultDimension();
+ ScDPResultDimension( const ScDPResultData* pData );
+ ~ScDPResultDimension();
// allocates new members
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
void InitFrom( const ::std::vector<ScDPDimension*>& ppDim,
- const ::std::vector<ScDPLevel*>& ppLev,
- size_t nPos,
- ScDPInitState& rInitState );
- void LateInitFrom( const ::std::vector<ScDPDimension*>& ppDim,
- const ::std::vector<ScDPLevel*>& ppLev,
- const ::std::vector<ScDPItemData>& pItemData,
- size_t nPos,
- ScDPInitState& rInitState );
-
+ const ::std::vector<ScDPLevel*>& ppLev,
+ size_t nPos,
+ ScDPInitState& rInitState , BOOL bInitChild = TRUE );
+ void LateInitFrom( LateInitParams& rParams,
+ const ::std::vector< SCROW >& pItemData,
+ size_t nPos,
+ ScDPInitState& rInitState );
+ void CheckShowEmpty( BOOL bShow = FALSE );
+
+ // End Comments
long GetSize(long nMeasure) const;
- bool IsValidEntry( const ::std::vector<ScDPItemData>& aMembers ) const;
- // modifies existing members, allocates data dimensions
- void ProcessData( const ::std::vector<ScDPItemData>& aMembers,
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ bool IsValidEntry( const ::std::vector<SCROW>& aMembers ) const;
+
+ // modifies existing members, allocates data dimensions
+ void ProcessData( const ::std::vector<SCROW>& aMembers,
const ScDPResultDimension* pDataDim,
- const ::std::vector<ScDPItemData>& aDataMembers,
+ const ::std::vector<SCROW>& aDataMembers,
const ::std::vector<ScDPValueData>& aValues ) const; //! Test
-
+ // End Comments
void FillMemberResults( com::sun::star::uno::Sequence<
com::sun::star::sheet::MemberResult>* pSequences,
long nStart, long nMeasure );
@@ -560,9 +675,11 @@ public:
~ScDPDataDimension();
void InitFrom( const ScDPResultDimension* pDim ); // recursive
- void ProcessData( const ::std::vector<ScDPItemData>& aDataMembers, const ::std::vector<ScDPValueData>& aValues,
- const ScDPSubTotalState& rSubState );
-
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ void ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValueData>& aValues,
+ const ScDPSubTotalState& rSubState );
+ // End Comments
void FillDataRow( const ScDPResultDimension* pRefDim,
com::sun::star::uno::Sequence<com::sun::star::sheet::DataResult>& rSequence,
long nCol, long nMeasure, BOOL bIsSubTotalRow,
@@ -596,7 +713,10 @@ public:
class ScDPResultVisibilityData
{
public:
- ScDPResultVisibilityData(ScSimpleSharedString& rSharedString, ScDPSource* pSource);
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPResultVisibilityData( ScDPSource* pSource);
+ // End Comments
~ScDPResultVisibilityData();
void addVisibleMember(const String& rDimName, const ScDPItemData& rMemberItem);
@@ -611,7 +731,6 @@ private:
typedef ::std::hash_map<String, VisibleMemberType, ScStringHashCode> DimMemberType;
DimMemberType maDimensions;
- ScSimpleSharedString& mrSharedString;
ScDPSource* mpSource;
};
diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx
index d2884281e1b8..18210f38e80e 100644
--- a/sc/inc/dptabsrc.hxx
+++ b/sc/inc/dptabsrc.hxx
@@ -30,6 +30,10 @@
#include <vector>
#include <hash_map>
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+#include <list>
+// End Comments
#include <memory>
#include <tools/string.hxx>
#include <tools/list.hxx>
@@ -57,7 +61,10 @@
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/implbase6.hxx>
-
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+#include "dpglobal.hxx"
+// End Comments
#include "dptabdat.hxx"
namespace com { namespace sun { namespace star {
@@ -71,7 +78,10 @@ namespace com { namespace sun { namespace star {
class ScDPResultMember;
class ScDPResultData;
-struct ScDPItemData;
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+class ScDPItemData;
+// End Comments
class ScDPTableData;
// ------------------------------------------------------------------------
@@ -172,10 +182,18 @@ public:
long GetDataDimensionCount();
ScDPDimension* GetDataDimension(long nIndex);
String GetDataDimName(long nIndex);
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPTableDataCache* GetCache();
+ const ScDPItemData* GetItemDataById( long nDim, long nId );
+ long GetDataLayoutDim(){ return pData->GetColumnCount(); }
+ SCROW GetMemberId( long nDim, const ScDPItemData& rData );
+ // End Comments
BOOL IsDataLayoutDimension(long nDim);
USHORT GetDataLayoutOrientation();
BOOL IsDateDimension(long nDim);
+ UINT32 GetNumberFormat(long nDim);
BOOL SubTotalAllowed(long nColumn); //! move to ScDPResultData
@@ -439,6 +457,10 @@ public:
const ::com::sun::star::sheet::DataPilotFieldReference& GetReferenceValue() const;
//UNUSED2009-05 BOOL IsValidPage( const ScDPItemData& rData );
+// Wang Xu Ming -- 2009-8-17
+// DataPilot Migration - Cache&&Performance
+ BOOL IsVisible( const ScDPItemData& rData );
+// End Comments
};
class ScDPHierarchies : public cppu::WeakImplHelper2<
@@ -732,6 +754,12 @@ public:
long getMinMembers() const;
sal_Int32 GetIndexFromName( const ::rtl::OUString& rName ) const; // <0 if not found
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ const std::vector<sal_Int32>& GetGlobalOrder();
+ const ScDPItemData* GetSrcItemDataByIndex( SCROW nIndex);
+ SCROW GetSrcItemsCount();
+ // End Comments
};
class ScDPMember : public cppu::WeakImplHelper3<
@@ -745,7 +773,11 @@ private:
long nHier;
long nLev;
- ScDPItemData maData;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ SCROW mnDataId;
+ // End Comments
+// String aCaption; // visible name (changeable by user)
::std::auto_ptr<rtl::OUString> mpLayoutName;
sal_Int32 nPosition; // manual sorting
@@ -753,13 +785,24 @@ private:
BOOL bShowDet;
public:
- ScDPMember( ScDPSource* pSrc, long nD, long nH, long nL,
- const String& rN, double fV, BOOL bHV );
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ ScDPMember( ScDPSource* pSrc, long nD, long nH, long nL,
+ SCROW nIndex /*const String& rN, double fV, BOOL bHV */);
+ // End Comments
virtual ~ScDPMember();
BOOL IsNamedItem( const ScDPItemData& r ) const;
String GetNameStr() const;
void FillItemData( ScDPItemData& rData ) const;
+ // Wang Xu Ming -- 2009-8-17
+ // DataPilot Migration - Cache&&Performance
+ // const ScDPItemData& GetItemData() const{ return maData; }
+ const ScDPItemData& GetItemData() const;
+ inline SCROW GetItemDataId() const { return mnDataId; }
+ BOOL IsNamedItem( SCROW nIndex ) const;
+ // End Comments
+
SC_DLLPUBLIC const ::rtl::OUString* GetLayoutName() const;
sal_Int32 Compare( const ScDPMember& rOther ) const; // visible order
diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index 8e3e540c9038..ae0fd92f6858 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -39,6 +39,7 @@ class SvStream;
class ScAddress;
class ScDocument;
class ScRange;
+class SvNumberFormatter;
// Return-Werte Im-/Exportfilter (ULONG)
@@ -89,7 +90,9 @@ class ScEEAbsImport {
virtual ~ScEEAbsImport() {}
virtual ULONG Read( SvStream& rStream, const String& rBaseURL ) = 0;
virtual ScRange GetRange() = 0;
- virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0 ) = 0;
+ virtual void WriteToDocument(
+ BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0,
+ SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
};
class ScFormatFilterPlugin {
@@ -106,7 +109,8 @@ class ScFormatFilterPlugin {
virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos,
const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, UINT32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
virtual FltError ScImportRTF( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange ) = 0;
- virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0, BOOL bCalcWidthHeight = TRUE ) = 0;
+ virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0,
+ BOOL bCalcWidthHeight = TRUE, SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
// various import helpers
virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ) = 0;
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 8bcbd50b0f3c..185113e77389 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -758,21 +758,6 @@ enum ScSubTotalFunc
};
-#define PIVOT_MAXFUNC 11
-#define PIVOT_FUNC_NONE 0x0000
-#define PIVOT_FUNC_SUM 0x0001
-#define PIVOT_FUNC_COUNT 0x0002
-#define PIVOT_FUNC_AVERAGE 0x0004
-#define PIVOT_FUNC_MAX 0x0008
-#define PIVOT_FUNC_MIN 0x0010
-#define PIVOT_FUNC_PRODUCT 0x0020
-#define PIVOT_FUNC_COUNT_NUM 0x0040
-#define PIVOT_FUNC_STD_DEV 0x0080
-#define PIVOT_FUNC_STD_DEVP 0x0100
-#define PIVOT_FUNC_STD_VAR 0x0200
-#define PIVOT_FUNC_STD_VARP 0x0400
-#define PIVOT_FUNC_AUTO 0x1000
-
// -----------------------------------------------------------------------
/*
@@ -876,46 +861,6 @@ 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();
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index c635877e2ea2..bca93e7aa441 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -570,7 +570,10 @@
#define STR_STYLE_FAMILY_CELL 433
#define STR_STYLE_FAMILY_PAGE 434
-#define STR_COUNT 435
+#define STR_ERR_DATAPILOTSOURCE 435
+#define STR_PIVOT_FIRSTROWEMPTYERR 436
+#define STR_PIVOT_ONLYONEROWERR 437
+#define STR_COUNT 438
#endif
diff --git a/sc/inc/optutil.hxx b/sc/inc/optutil.hxx
index c197076ee642..83b23a3c9ef9 100644
--- a/sc/inc/optutil.hxx
+++ b/sc/inc/optutil.hxx
@@ -30,6 +30,7 @@
#include <unotools/configitem.hxx>
#include <tools/link.hxx>
+#include "scdllapi.h"
class ScOptionsUtil
@@ -41,13 +42,13 @@ public:
// ConfigItem for classes that use items from several sub trees
-class ScLinkConfigItem : public utl::ConfigItem
+class SC_DLLPUBLIC ScLinkConfigItem : public utl::ConfigItem
{
Link aCommitLink;
public:
- ScLinkConfigItem( const rtl::OUString rSubTree );
- ScLinkConfigItem( const rtl::OUString rSubTree, sal_Int16 nMode );
+ ScLinkConfigItem( const rtl::OUString& rSubTree );
+ ScLinkConfigItem( const rtl::OUString& rSubTree, sal_Int16 nMode );
void SetCommitLink( const Link& rLink );
virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames );
diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx
index 2a1f17846afd..915a311411c4 100644
--- a/sc/inc/pivot.hxx
+++ b/sc/inc/pivot.hxx
@@ -48,6 +48,7 @@
#include "global.hxx"
#include "address.hxx"
+#include "dpglobal.hxx"
#include <vector>
#include <boost/shared_ptr.hpp>
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx
index 2350cea085f0..51555decaa5b 100644
--- a/sc/inc/rangelst.hxx
+++ b/sc/inc/rangelst.hxx
@@ -55,10 +55,10 @@ public:
USHORT Parse( const String&, ScDocument* = NULL,
USHORT nMask = SCA_VALID,
formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
- char cDelimiter = 0 );
+ sal_Unicode cDelimiter = 0 );
void Format( String&, USHORT nFlags = 0, ScDocument* = NULL,
formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
- char cDelimiter = 0 ) const;
+ sal_Unicode cDelimiter = 0 ) const;
void Join( const ScRange&, BOOL bIsInList = FALSE );
BOOL UpdateReference( UpdateRefMode, ScDocument*,
const ScRange& rWhere,
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index d9bce97f1bc8..1b6d18e21dbb 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1631,9 +1631,10 @@
#define RID_SCDLG_DOCPROTECTION (SC_DIALOGS_START + 149)
#define RID_SCDLG_RETYPEPASS (SC_DIALOGS_START + 150)
#define RID_SCDLG_RETYPEPASS_INPUT (SC_DIALOGS_START + 151)
-#define RID_POPUP_FILTER (SC_DIALOGS_START + 152)
+#define RID_SCDLG_TEXT_IMPORT_OPTIONS (SC_DIALOGS_START + 152)
+#define RID_POPUP_FILTER (SC_DIALOGS_START + 153)
-#define SC_DIALOGS_END (SC_DIALOGS_START + 153)
+#define SC_DIALOGS_END (SC_DIALOGS_START + 154)
#ifndef STD_MASKCOLOR
#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index f33077b3e090..d3c19bb539d5 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -38,6 +38,7 @@
#include "sc.hrc"
#include "global.hxx"
#include "pivot.hxx"
+#include "i18npool/lang.h"
class ScAsciiOptions;
class ScAutoFormat;
@@ -65,6 +66,7 @@ class AbstractScImportAsciiDlg : public VclAbstractDialog //add for ScImportAsc
public:
virtual void GetOptions( ScAsciiOptions& rOpt ) = 0;
virtual void SetTextToColumnsMode() = 0;
+ virtual void SaveParameters() = 0;
};
@@ -289,6 +291,14 @@ class AbstractScImportOptionsDlg : public VclAbstractDialog //add for ScImportO
public:
virtual void GetImportOptions( ScImportOptions& rOptions ) const = 0;
};
+
+class AbstractScTextImportOptionsDlg : public VclAbstractDialog //add for ScLangChooserDlg
+{
+public:
+ virtual LanguageType GetLanguageType() const = 0;
+ virtual bool IsDateConversionSet() const = 0;
+};
+
//-------Scabstract fractory ---------------------------
class ScAbstractDialogFactory
{
@@ -299,6 +309,8 @@ public:
SvStream* pInStream, int nId,
sal_Unicode cSep = '\t') = 0;
+ virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId ) = 0;
+
virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg
ScAutoFormat* pAutoFormat,
const ScAutoFormatData* pSelFormatData,
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 494ab86b0c74..9857d675b7ab 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -103,6 +103,7 @@ class SC_DLLPUBLIC ScMatrix
void ResetIsString();
void DeleteIsString();
void CreateMatrix( SCSIZE nC, SCSIZE nR);
+ void Clear();
// pStr may be NULL, bFlag MUST NOT be 0
void PutStringEntry( const String* pStr, BYTE bFlag, SCSIZE nIndex );
@@ -175,6 +176,12 @@ public:
/** Clone the matrix. */
ScMatrix* Clone() const;
+ /**
+ * Resize the matrix to specified new dimension. Note that this operation
+ * clears all stored values.
+ */
+ void Resize( SCSIZE nC, SCSIZE nR);
+
/** Clone the matrix and extend it to the new size. nNewCols and nNewRows
MUST be at least of the size of the original matrix. */
ScMatrix* CloneAndExtend( SCSIZE nNewCols, SCSIZE nNewRows ) const;
diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx
new file mode 100644
index 000000000000..c50c0d8cf156
--- /dev/null
+++ b/sc/inc/stringutil.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: table.hxx,v $
+ * $Revision: 1.35 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_STRINGUTIL_HXX
+#define SC_STRINGUTIL_HXX
+
+#include "rtl/ustring.hxx"
+
+class ScStringUtil
+{
+public:
+ /**
+ * Check if a given string is a simple decimal number (e.g. 12.345). We
+ * don't do any elaborate parsing here; we only check for the simplest
+ * case of decimal number format.
+ *
+ * @param rStr string to parse
+ * @param dsep decimal separator
+ * @param gsep group separator (aka thousands separator)
+ * @param rVal value of successfully parsed number
+ *
+ * @return true if the string is a valid number, false otherwise.
+ */
+ static bool parseSimpleNumber(
+ const ::rtl::OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal);
+};
+
+
+#endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 55d31d30430e..0311c5093c4c 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -265,7 +265,8 @@ public:
void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell );
void PutCell(SCCOL nCol, SCROW nRow, ULONG nFormatIndex, ScBaseCell* pCell);
// TRUE = Zahlformat gesetzt
- BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString );
+ BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
+ SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
void SetError( SCCOL nCol, SCROW nRow, USHORT nError);
@@ -468,7 +469,7 @@ public:
const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const;
//UNUSED2009-05 BOOL HasLines( const ScRange& rRange, Rectangle& rSizes ) const;
- BOOL HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const;
+ bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const;
BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const;
BOOL ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
SCCOL& rEndCol, SCROW& rEndRow,