diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-03-01 00:02:01 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-03-01 00:02:01 -0500 |
commit | f84427bfddd49efee446f73fb1b926d102ce9641 (patch) | |
tree | 6c6871ab683a1465190638713dffb9d79a3f4d05 /sc | |
parent | 716556f19c21090cd7f0ed4c0515df17a3cec241 (diff) |
Finally get the refresh to work properly.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/dpcachetable.hxx | 1 | ||||
-rw-r--r-- | sc/inc/dpsdbtab.hxx | 11 | ||||
-rw-r--r-- | sc/inc/dpshttab.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/dpcachetable.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/dpsdbtab.cxx | 14 | ||||
-rw-r--r-- | sc/source/core/data/dpshttab.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/xml/xmldpimp.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/dapiuno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh2.cxx | 2 |
9 files changed, 33 insertions, 17 deletions
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx index 5e5bb24c3b21..d0b209a2bafc 100644 --- a/sc/inc/dpcachetable.hxx +++ b/sc/inc/dpcachetable.hxx @@ -169,6 +169,7 @@ public: SCROW getOrder(long nDim, SCROW nIndex) const; void clear(); bool empty() const; + void setCache(ScDPTableDataCache* p); private: ScDPCacheTable(); diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx index 5c2608e75edc..9ab6693ae025 100644 --- a/sc/inc/dpsdbtab.hxx +++ b/sc/inc/dpsdbtab.hxx @@ -50,22 +50,25 @@ struct ScImportSourceDesc String aObject; USHORT nType; // enum DataImportMode BOOL bNative; + ScDocument* mpDoc; - ScImportSourceDesc() : nType(0), bNative(FALSE) {} + ScImportSourceDesc(ScDocument* pDoc) : nType(0), bNative(FALSE), mpDoc(pDoc) {} BOOL operator== ( const ScImportSourceDesc& rOther ) const { return aDBName == rOther.aDBName && aObject == rOther.aObject && nType == rOther.nType && - bNative == rOther.bNative; } + bNative == rOther.bNative && + mpDoc == rOther.mpDoc; } - ScDPTableDataCache* CreateCache(ScDocument* pDoc) const; + ScDPTableDataCache* CreateCache() const; }; class ScDatabaseDPData : public ScDPTableData { private: - ScDPCacheTable aCacheTable; + const ScImportSourceDesc& mrImport; + ScDPCacheTable aCacheTable; public: ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport); virtual ~ScDatabaseDPData(); diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx index a9d9529adcb3..51df5cee5100 100644 --- a/sc/inc/dpshttab.hxx +++ b/sc/inc/dpshttab.hxx @@ -110,6 +110,7 @@ private: bool bIgnoreEmptyRows; bool bRepeatIfEmpty; + const ScSheetSourceDesc& mrDesc; ScDPCacheTable aCacheTable; public: diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx index 6ddc61c8871e..463bf7cc7b57 100644 --- a/sc/source/core/data/dpcachetable.cxx +++ b/sc/source/core/data/dpcachetable.cxx @@ -402,6 +402,8 @@ void ScDPCacheTable::clear() { maFieldEntries.clear(); maRowsVisible.clear(); + delete mpCache; + mpCache = NULL; } bool ScDPCacheTable::empty() const @@ -409,6 +411,12 @@ bool ScDPCacheTable::empty() const return mpCache == NULL || maFieldEntries.empty(); } +void ScDPCacheTable::setCache(ScDPTableDataCache* p) +{ + delete mpCache; + mpCache = p; +} + bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) const { diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx index 717b381af987..5abe399275f3 100644 --- a/sc/source/core/data/dpsdbtab.cxx +++ b/sc/source/core/data/dpsdbtab.cxx @@ -75,9 +75,9 @@ using ::com::sun::star::uno::UNO_QUERY; #define SC_DBPROP_COMMAND "Command" #define SC_DBPROP_COMMANDTYPE "CommandType" -ScDPTableDataCache* ScImportSourceDesc::CreateCache(ScDocument* pDoc) const +ScDPTableDataCache* ScImportSourceDesc::CreateCache() const { - if ( !pDoc ) + if (!mpDoc) return NULL; sal_Int32 nSdbType = -1; @@ -91,7 +91,7 @@ ScDPTableDataCache* ScImportSourceDesc::CreateCache(ScDocument* pDoc) const return NULL; } - ScDPTableDataCache* pCache = new ScDPTableDataCache( pDoc ); + ScDPTableDataCache* pCache = new ScDPTableDataCache(mpDoc); uno::Reference<sdbc::XRowSet> xRowSet ; try @@ -131,7 +131,7 @@ ScDPTableDataCache* ScImportSourceDesc::CreateCache(ScDocument* pDoc) const } else xRowSet->execute(); - SvNumberFormatter aFormat( pDoc->GetServiceManager(), ScGlobal::eLnge); + SvNumberFormatter aFormat(mpDoc->GetServiceManager(), ScGlobal::eLnge); pCache->InitFromDataBase( xRowSet, *aFormat.GetNullDate() ); } } @@ -157,7 +157,8 @@ ScDPTableDataCache* ScImportSourceDesc::CreateCache(ScDocument* pDoc) const ScDatabaseDPData::ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport) : ScDPTableData(pDoc), - aCacheTable(rImport.CreateCache(pDoc)) + mrImport(rImport), + aCacheTable(rImport.CreateCache()) { } @@ -168,7 +169,7 @@ ScDatabaseDPData::~ScDatabaseDPData() void ScDatabaseDPData::DisposeData() { //! use OpenDatabase here? - aCacheTable.clear(); + aCacheTable.clear(); } long ScDatabaseDPData::GetColumnCount() @@ -213,6 +214,7 @@ void ScDatabaseDPData::CreateCacheTable() if (!aCacheTable.empty()) return; + aCacheTable.setCache(mrImport.CreateCache()); aCacheTable.fillTable(); } diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx index e547965538ee..9fd67bb27e50 100644 --- a/sc/source/core/data/dpshttab.cxx +++ b/sc/source/core/data/dpshttab.cxx @@ -66,6 +66,7 @@ ScSheetDPData::ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc) : pSpecial(NULL), bIgnoreEmptyRows( FALSE ), bRepeatIfEmpty(FALSE), + mrDesc(rDesc), aCacheTable(rDesc.CreateCache()) { SCSIZE nEntryCount( aQuery.GetEntryCount()); @@ -200,8 +201,8 @@ void ScSheetDPData::CreateCacheTable() // already cached. return; - aCacheTable.fillTable( aQuery, pSpecial, - bIgnoreEmptyRows, bRepeatIfEmpty ); + aCacheTable.setCache(mrDesc.CreateCache()); + aCacheTable.fillTable(aQuery, pSpecial, bIgnoreEmptyRows, bRepeatIfEmpty); } void ScSheetDPData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims) diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx index 82c466cd1fe3..26e35ad1f99d 100644 --- a/sc/source/filter/xml/xmldpimp.cxx +++ b/sc/source/filter/xml/xmldpimp.cxx @@ -409,7 +409,7 @@ void ScXMLDataPilotTableContext::EndElement() { case SQL : { - ScImportSourceDesc aImportDesc; + ScImportSourceDesc aImportDesc(pDoc); aImportDesc.aDBName = sDatabaseName; aImportDesc.aObject = sSourceObject; aImportDesc.nType = sheet::DataImportMode_SQL; @@ -419,7 +419,7 @@ void ScXMLDataPilotTableContext::EndElement() break; case TABLE : { - ScImportSourceDesc aImportDesc; + ScImportSourceDesc aImportDesc(pDoc); aImportDesc.aDBName = sDatabaseName; aImportDesc.aObject = sSourceObject; aImportDesc.nType = sheet::DataImportMode_TABLE; @@ -428,7 +428,7 @@ void ScXMLDataPilotTableContext::EndElement() break; case QUERY : { - ScImportSourceDesc aImportDesc; + ScImportSourceDesc aImportDesc(pDoc); aImportDesc.aDBName = sDatabaseName; aImportDesc.aObject = sSourceObject; aImportDesc.nType = sheet::DataImportMode_QUERY; diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index e0bcc9b65853..ba1fedd5198c 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -833,7 +833,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp uno::Sequence<beans::PropertyValue> aArgSeq; if ( aValue >>= aArgSeq ) { - ScImportSourceDesc aImportDesc; + ScImportSourceDesc aImportDesc(pDocShell->GetDocument()); const ScImportSourceDesc* pOldDesc = pDPObject->GetImportSourceDesc(); if (pOldDesc) diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index eb9953259d13..5b72e164d22a 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -809,7 +809,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) DBG_ASSERT(pDataDlg, "Dialog create fail!"); if ( pDataDlg->Execute() == RET_OK ) { - ScImportSourceDesc aImpDesc; + ScImportSourceDesc aImpDesc(pDoc); pDataDlg->GetValues( aImpDesc ); pNewDPObject = new ScDPObject( pDoc ); pNewDPObject->SetImportDesc( aImpDesc ); |