summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/dpobject.cxx35
-rw-r--r--sc/source/filter/excel/xestream.cxx6
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx5
-rw-r--r--sc/source/ui/view/dbfunc3.cxx33
-rw-r--r--sc/source/ui/view/output.cxx1
5 files changed, 44 insertions, 36 deletions
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 8e8ded033933..eda6c16baa2e 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2575,6 +2575,41 @@ public:
}
+bool ScDPCollection::ClearCache(ScDPObject* pDPObj)
+{
+ if (pDPObj->IsSheetData())
+ {
+ // data source is internal sheet.
+ const ScSheetSourceDesc* pDesc = pDPObj->GetSheetDesc();
+ if (!pDesc)
+ return false;
+
+ if (pDesc->HasRangeName())
+ {
+ // cache by named range
+ ScDPCollection::NameCaches& rCaches = GetNameCaches();
+ rCaches.removeCache(pDesc->GetRangeName());
+ }
+ else
+ {
+ // cache by cell range
+ ScDPCollection::SheetCaches& rCaches = GetSheetCaches();
+ rCaches.removeCache(pDesc->GetSourceRange());
+ }
+ }
+ else if (pDPObj->IsImportData())
+ {
+ // data source is external database.
+ const ScImportSourceDesc* pDesc = pDPObj->GetImportSourceDesc();
+ if (!pDesc)
+ return false;
+
+ ScDPCollection::DBCaches& rCaches = GetDBCaches();
+ rCaches.removeCache(pDesc->GetCommandType(), pDesc->aDBName, pDesc->aObject);
+ }
+ return true;
+}
+
void ScDPCollection::DeleteOnTab( SCTAB nTab )
{
maTables.erase(
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index d6d729ce1de2..4e2798e06ee9 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -861,10 +861,10 @@ OUString XclXmlUtils::ToOUString( const char* s )
OUString XclXmlUtils::ToOUString( const ScfUInt16Vec& rBuf, sal_Int32 nStart, sal_Int32 nLength )
{
- if( nLength == -1 )
- nLength = rBuf.size();
+ if( nLength == -1 || ( nLength > (rBuf.size() - nStart) ) )
+ nLength = (rBuf.size() - nStart);
- return OUString( &rBuf[nStart], nLength );
+ return (nLength > 0) ? OUString( &rBuf[nStart], nLength ) : OUString();
}
OUString XclXmlUtils::ToOUString( const String& s )
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index d1289cd205d8..65fe8a002dc8 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1282,10 +1282,9 @@ void SAL_CALL ScDataPilotTableObj::refresh() throw(RuntimeException)
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
+ GetDocShell()->GetDocument()->GetDPCollection()->ClearCache(pDPObj);
+ aFunc.DataPilotUpdate( pDPObj, pDPObj, true, true );
}
}
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index e8e5baafb1f7..ac4408238818 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -707,37 +707,10 @@ void ScDBFunc::RecalcPivotTable()
{
// Remove existing data cache for the data that this datapilot uses,
// to force re-build data cache.
- if (pDPObj->IsSheetData())
+ if (!pDPs->ClearCache(pDPObj))
{
- // data source is internal sheet.
- const ScSheetSourceDesc* pDesc = pDPObj->GetSheetDesc();
- if (!pDesc)
- {
- ErrorMessage(STR_PIVOT_NOTFOUND);
- return;
- }
- if (pDesc->HasRangeName())
- {
- ScDPCollection::NameCaches& rCaches = pDPs->GetNameCaches();
- rCaches.removeCache(pDesc->GetRangeName());
- }
- else
- {
- ScDPCollection::SheetCaches& rCaches = pDPs->GetSheetCaches();
- rCaches.removeCache(pDesc->GetSourceRange());
- }
- }
- else if (pDPObj->IsImportData())
- {
- // data source is external database.
- const ScImportSourceDesc* pDesc = pDPObj->GetImportSourceDesc();
- if (!pDesc)
- {
- ErrorMessage(STR_PIVOT_NOTFOUND);
- return;
- }
- ScDPCollection::DBCaches& rCaches = pDPs->GetDBCaches();
- rCaches.removeCache(pDesc->GetCommandType(), pDesc->aDBName, pDesc->aObject);
+ ErrorMessage(STR_PIVOT_NOTFOUND);
+ return;
}
ScDBDocFunc aFunc( *pDocSh );
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index b69f2ace659a..5d34fa25d1c3 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1634,6 +1634,7 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor )
drawinglayer::processor2d::BaseProcessor2D* ScOutputData::CreateProcessor2D( )
{
+ pDoc->InitDrawLayer(pDoc->GetDocumentShell());
ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
if (!pDrawLayer)
return NULL;