summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/dpshttab.hxx4
-rw-r--r--sc/qa/unit/ucalc.cxx2
-rw-r--r--sc/source/core/data/dpobject.cxx4
-rw-r--r--sc/source/core/data/dpshttab.cxx8
-rw-r--r--sc/source/filter/excel/xipivot.cxx2
-rw-r--r--sc/source/filter/xml/xmldpimp.cxx2
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx42
-rw-r--r--sc/source/ui/inc/pvlaydlg.hxx1
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx4
-rw-r--r--sc/source/ui/unoobj/datauno.cxx2
-rw-r--r--sc/source/ui/view/cellsh2.cxx2
-rw-r--r--sc/source/ui/view/gridwin2.cxx2
-rw-r--r--sc/source/ui/view/pivotsh.cxx2
13 files changed, 51 insertions, 26 deletions
diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index 34b598b1dfa1..737c0bfe4626 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -52,7 +52,10 @@ class ScDPItemData;
*/
class ScSheetSourceDesc
{
+ ScSheetSourceDesc(); // disabled
+
public:
+ SC_DLLPUBLIC ScSheetSourceDesc(ScDocument* pDoc);
SC_DLLPUBLIC void SetSourceRange(const ScRange& rRange);
SC_DLLPUBLIC const ScRange& GetSourceRange() const;
@@ -81,6 +84,7 @@ private:
ScRange maSourceRange;
::rtl::OUString maRangeName;
ScQueryParam maQueryParam;
+ ScDocument* mpDoc;
};
// --------------------------------------------------------------------
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 10e4a648ab07..d75f650681ed 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -569,7 +569,7 @@ void Test::testDataPilot()
printer.print("Data sheet content");
printer.clear();
- ScSheetSourceDesc aSheetDesc;
+ ScSheetSourceDesc aSheetDesc(m_pDoc);
aSheetDesc.SetSourceRange(ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0));
ScDPObject* pDPObj = new ScDPObject(m_pDoc);
pDPObj->SetSheetDesc(aSheetDesc);
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index c4511496db93..a98863204a75 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -424,7 +424,7 @@ ScDPTableData* ScDPObject::GetTableData()
if (!pSheetDesc)
{
DBG_ERROR("no source descriptor");
- pSheetDesc = new ScSheetSourceDesc; // dummy defaults
+ pSheetDesc = new ScSheetSourceDesc(pDoc); // dummy defaults
}
pData.reset(new ScSheetDPData(pDoc, *pSheetDesc, GetCacheId()));
}
@@ -712,7 +712,7 @@ void ScDPObject::UpdateReference( UpdateRefMode eUpdateRefMode,
nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
if ( eRes != UR_NOTHING )
{
- ScSheetSourceDesc aNewDesc;
+ ScSheetSourceDesc aNewDesc(pDoc);
aNewDesc.SetSourceRange(ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2));
SCsCOL nDiffX = nCol1 - (SCsCOL) pSheetDesc->GetSourceRange().aStart.Col();
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index 1421ba13b2ff..7a3eb6d8cbd5 100644
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -233,6 +233,9 @@ const ScDPCacheTable& ScSheetDPData::GetCacheTable() const
return aCacheTable;
}
+ScSheetSourceDesc::ScSheetSourceDesc(ScDocument* pDoc) :
+ mpDoc(pDoc) {}
+
void ScSheetSourceDesc::SetSourceRange(const ScRange& rRange)
{
maSourceRange = rRange;
@@ -241,6 +244,11 @@ void ScSheetSourceDesc::SetSourceRange(const ScRange& rRange)
const ScRange& ScSheetSourceDesc::GetSourceRange() const
{
+ if (maRangeName.getLength())
+ {
+ // Obtain the source range from the range name first.
+
+ }
return maSourceRange;
}
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index f4ca2cf4b49a..10cefa9be02b 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1395,7 +1395,7 @@ void XclImpPivotTable::Convert()
// *** insert into Calc document ***
// create source descriptor
- ScSheetSourceDesc aDesc;
+ ScSheetSourceDesc aDesc(GetDocPtr());
aDesc.SetSourceRange(mxPCache->GetSourceRange());
// adjust output range to include the page fields
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index cd9ee288fb4f..6a2970a13040 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -445,7 +445,7 @@ void ScXMLDataPilotTableContext::EndElement()
{
if (bSourceCellRange)
{
- ScSheetSourceDesc aSheetDesc;
+ ScSheetSourceDesc aSheetDesc(pDoc);
aSheetDesc.SetSourceRange(aSourceCellRangeAddress);
aSheetDesc.SetQueryParam(aSourceQueryParam);
pDPObject->SetSheetDesc(aSheetDesc);
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 1c04da3db327..89da27b4bb69 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -188,7 +188,6 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pPar
GetViewData() ),
pDoc ( ((ScTabViewShell*)SfxViewShell::Current())->
GetViewData()->GetDocument() ),
- meSrcType(SRC_INVALID),
bRefInputMode (false)
{
xDlgDPObject->SetAlive( TRUE ); // needed to get structure information
@@ -1419,20 +1418,20 @@ bool ScDPLayoutDlg::GetPivotArrays(
void ScDPLayoutDlg::UpdateSrcRange()
{
- String theCurPosStr = aEdInPos.GetText();
- USHORT nResult = ScRange().Parse(theCurPosStr, pDoc, pDoc->GetAddressConvention());
- meSrcType = SRC_INVALID;
-
+ String aSrcStr = aEdInPos.GetText();
+ USHORT nResult = ScRange().Parse(aSrcStr, pDoc, pDoc->GetAddressConvention());
+ DataSrcType eSrcType = SRC_INVALID;
ScRange aNewRange;
+
if (SCA_VALID == (nResult & SCA_VALID))
{
// Valid source range. Take it.
ScRefAddress start, end;
- ConvertDoubleRef(pDoc, theCurPosStr, 1, start, end, pDoc->GetAddressConvention());
+ ConvertDoubleRef(pDoc, aSrcStr, 1, start, end, pDoc->GetAddressConvention());
aNewRange.aStart = start.GetAddress();
aNewRange.aEnd = end.GetAddress();
aEdInPos.SetRefValid(true);
- meSrcType = SRC_REF;
+ eSrcType = SRC_REF;
}
else
{
@@ -1441,7 +1440,7 @@ void ScDPLayoutDlg::UpdateSrcRange()
ScRangeName* pRangeName = pDoc->GetRangeName();
if (pRangeName)
{
- OUString aUpper = ScGlobal::pCharClass->upper(theCurPosStr);
+ OUString aUpper = ScGlobal::pCharClass->upper(aSrcStr);
USHORT n;
bValid = pRangeName->SearchNameUpper(aUpper, n);
if (bValid)
@@ -1460,22 +1459,37 @@ void ScDPLayoutDlg::UpdateSrcRange()
return;
}
- meSrcType = SRC_NAME;
+ eSrcType = SRC_NAME;
}
aBtnOk.Enable();
+
+ // Now update the data src range or range name with the dp object.
ScSheetSourceDesc inSheet = *xDlgDPObject->GetSheetDesc();
- if (inSheet.GetSourceRange() == aNewRange)
- // new range is identical to the current range. Nothing to do.
- return;
+ switch (eSrcType)
+ {
+ case SRC_REF:
+ // data source is a range reference.
+ if (inSheet.GetSourceRange() == aNewRange)
+ // new range is identical to the current range. Nothing to do.
+ return;
+ inSheet.SetSourceRange(aNewRange);
+ break;
+ case SRC_NAME:
+ // data source is a range name.
+ inSheet.SetRangeName(aSrcStr);
+ break;
+ default:
+ OSL_ENSURE(false, "Unknown source type.");
+ return;
+ }
- ScTabViewShell * pTabViewShell = pViewData->GetViewShell();
- inSheet.SetSourceRange(aNewRange);
xDlgDPObject->SetSheetDesc(inSheet);
xDlgDPObject->FillOldParam( thePivotData, FALSE );
xDlgDPObject->FillLabelData(thePivotData);
+ ScTabViewShell* pTabViewShell = pViewData->GetViewShell();
pTabViewShell->SetDialogDPObject(xDlgDPObject.get());
aLabelDataArr.clear();
aWndSelect.ClearFields();
diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx
index 14b1b61dd699..9d0e215cba7a 100644
--- a/sc/source/ui/inc/pvlaydlg.hxx
+++ b/sc/source/ui/inc/pvlaydlg.hxx
@@ -185,7 +185,6 @@ private:
ScPivotParam thePivotData;
ScViewData* pViewData;
ScDocument* pDoc;
- DataSrcType meSrcType;
bool bRefInputMode;
private:
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 8bbf325f4a3e..158f3d0ec7b7 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -719,7 +719,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setSourceRange( const CellRangeAddress&
if (!pDPObject)
throw RuntimeException();
- ScSheetSourceDesc aSheetDesc;
+ ScSheetSourceDesc aSheetDesc(pDocShell->GetDocument());
if (pDPObject->IsSheetData())
aSheetDesc = *pDPObject->GetSheetDesc();
@@ -1418,7 +1418,7 @@ ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) :
aSaveData.SetIgnoreEmptyRows( sal_False );
aSaveData.SetRepeatIfEmpty( sal_False );
mpDPObject->SetSaveData(aSaveData);
- ScSheetSourceDesc aSheetDesc;
+ ScSheetSourceDesc aSheetDesc(pDocSh ? pDocSh->GetDocument() : NULL);
mpDPObject->SetSheetDesc(aSheetDesc);
mpDPObject->GetSource();
}
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 713b97f30475..f18814408fe4 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1599,7 +1599,7 @@ void ScDataPilotFilterDescriptor::PutData( const ScQueryParam& rParam )
ScDPObject* pDPObj = pParent->GetDPObject();
if (pDPObj)
{
- ScSheetSourceDesc aSheetDesc;
+ ScSheetSourceDesc aSheetDesc(pParent->GetDocShell()->GetDocument());
if (pDPObj->IsSheetData())
aSheetDesc = *pDPObj->GetSheetDesc();
aSheetDesc.SetQueryParam(rParam);
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 93dc78dc9f0d..eb9953259d13 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -849,7 +849,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
}
if (bOK)
{
- ScSheetSourceDesc aShtDesc;
+ ScSheetSourceDesc aShtDesc(pDoc);
aShtDesc.SetSourceRange(aRange);
pNewDPObject = new ScDPObject( pDoc );
pNewDPObject->SetSheetDesc( aShtDesc );
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index df929dc77a1f..475ee13cd2f8 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -227,7 +227,7 @@ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt
DBG_ASSERT(pDlg, "Dialog create fail!");
if ( pDlg->Execute() == RET_OK )
{
- ScSheetSourceDesc aNewDesc;
+ ScSheetSourceDesc aNewDesc(pDoc);
if (pDesc)
aNewDesc = *pDesc;
diff --git a/sc/source/ui/view/pivotsh.cxx b/sc/source/ui/view/pivotsh.cxx
index 53a357ee8fe7..c9fa7f8efbf1 100644
--- a/sc/source/ui/view/pivotsh.cxx
+++ b/sc/source/ui/view/pivotsh.cxx
@@ -134,7 +134,7 @@ void ScPivotShell::Execute( SfxRequest& rReq )
if( pDlg->Execute() == RET_OK )
{
- ScSheetSourceDesc aNewDesc;
+ ScSheetSourceDesc aNewDesc(pViewData->GetDocument());
if( pDesc )
aNewDesc = *pDesc;