summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNiklas Nebel <nn@openoffice.org>2010-02-08 11:44:10 +0100
committerNiklas Nebel <nn@openoffice.org>2010-02-08 11:44:10 +0100
commit27ba0334e70f637b52a416ca67e9f0a68c68b81b (patch)
tree3085d439270a3733616e7cfcdca8a43c87ebf42a /sc
parente6e1c829d45335c00f7246e983e03011fafb75b0 (diff)
datapilotperf: RefreshDPObject, copied from svn revision 277984
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/dbfunc.hxx8
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx20
-rw-r--r--sc/source/ui/view/dbfunc3.cxx53
3 files changed, 66 insertions, 15 deletions
diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx
index 875576a22889..371d2df645b8 100644
--- a/sc/source/ui/inc/dbfunc.hxx
+++ b/sc/source/ui/inc/dbfunc.hxx
@@ -56,7 +56,7 @@ private:
public:
ScDBFunc( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell );
//UNUSED2008-05 ScDBFunc( Window* pParent, const ScDBFunc& rDBFunc, ScTabViewShell* pViewShell );
- ~ScDBFunc();
+ virtual ~ScDBFunc();
// nur UISort wiederholt bei Bedarf die Teilergebnisse
@@ -89,8 +89,10 @@ public:
bool MakePivotTable( const ScDPSaveData& rData, const ScRange& rDest, BOOL bNewTable,
const ScDPObject& rSource, BOOL bApi = FALSE );
void DeletePivotTable();
- void RecalcPivotTable();
-
+ // Wang Xu Ming -- 2009-6-17
+ // DataPilot Migration
+ ULONG RecalcPivotTable();
+ // End Comments
BOOL HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32& rParts );
BOOL HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo );
void GroupDataPilot();
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index a7836b43f740..b366f6e67852 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1118,17 +1118,21 @@ CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange() throw(RuntimeExc
return aRet;
}
+ULONG RefreshDPObject( ScDPObject *pDPObj, ScDocument *pDoc, ScDocShell *pDocSh, BOOL bRecord, BOOL bApi );
+
void SAL_CALL ScDataPilotTableObj::refresh() throw(RuntimeException)
{
ScUnoGuard aGuard;
- ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
- if (pDPObj)
- {
- ScDPObject* pNew = new ScDPObject(*pDPObj);
- ScDBDocFunc aFunc(*GetDocShell());
- aFunc.DataPilotUpdate( pDPObj, pNew, TRUE, TRUE );
- delete pNew; // DataPilotUpdate copies settings from "new" object
- }
+ if( ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName) )
+ RefreshDPObject( pDPObj, NULL, GetDocShell(), TRUE, TRUE );
+ //if (pDPObj)
+ //{
+ // ScDPObject* pNew = new ScDPObject(*pDPObj);
+ // ScDBDocFunc aFunc(*GetDocShell());
+ // aFunc.DataPilotUpdate( pDPObj, pNew, TRUE, TRUE );
+ // delete pNew; // DataPilotUpdate copies settings from "new" object
+ //}
+
}
Sequence< Sequence<Any> > SAL_CALL ScDataPilotTableObj::getDrillDownData(const CellAddress& aAddr)
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 41a959409727..b9cef29c7b04 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -692,8 +692,41 @@ void ScDBFunc::DeletePivotTable()
else
ErrorMessage(STR_PIVOT_NOTFOUND);
}
+ULONG RefreshDPObject( ScDPObject *pDPObj, ScDocument *pDoc, ScDocShell *pDocSh, BOOL bRecord, BOOL bApi )
+{
+ if( !pDPObj )
+ return STR_PIVOT_NOTFOUND;
+
+ if( !pDoc )
+ return -1;
+
+ if( !pDocSh && ( pDocSh = PTR_CAST( ScDocShell, pDoc->GetDocumentShell() ) ) == NULL )
+ return -1;
+
+ if( ULONG nErrId = pDPObj->RefreshCache() )
+ return nErrId;
+ else if ( nErrId == 0 )
+ {
+ //Refresh all dpobjects
+ ScDPCollection* pDPCollection = pDoc->GetDPCollection();
+ USHORT nCount = pDPCollection->GetCount();
+ for (USHORT i=0; i<nCount; i++)
+ {
+ if ( (*pDPCollection)[i]->GetCacheId() == pDPObj->GetCacheId() )
+ {
+ ScDBDocFunc aFunc( * pDocSh );
+ if ( !aFunc.DataPilotUpdate( (*pDPCollection)[i], (*pDPCollection)[i], bRecord, bApi ) )
+ break;
+ }
+ }
-void ScDBFunc::RecalcPivotTable()
+ return nErrId;
+ }
+
+ return 0U;
+}
+
+ULONG ScDBFunc::RecalcPivotTable()
{
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScDocument* pDoc = GetViewData()->GetDocument();
@@ -705,12 +738,24 @@ void ScDBFunc::RecalcPivotTable()
GetViewData()->GetTabNo() );
if ( pDPObj )
{
- ScDBDocFunc aFunc( *pDocSh );
- aFunc.DataPilotUpdate( pDPObj, pDPObj, TRUE, FALSE );
- CursorPosChanged(); // shells may be switched
+ // Wang Xu Ming -- 2009-6-17
+ // DataPilot Migration
+ //ScDBDocFunc aFunc( *pDocSh );
+ //aFunc.DataPilotUpdate( pDPObj, pDPObj, TRUE, FALSE );
+ //CursorPosChanged(); // shells may be switched
+ ULONG nErrId = RefreshDPObject( pDPObj, pDoc, pDocSh, TRUE, FALSE );//pDPObj->RefreshCache();
+ if ( nErrId == 0 )
+ {
+ GetViewData()->GetDocShell()->GetUndoManager()->Clear();
+ }
+ else
+ ErrorMessage(nErrId);
+ return nErrId;
+ // End Comments
}
else
ErrorMessage(STR_PIVOT_NOTFOUND);
+ return STR_PIVOT_NOTFOUND;
}
void ScDBFunc::GetSelectedMemberList( ScStrCollection& rEntries, long& rDimension )