summaryrefslogtreecommitdiffstats
path: root/sc/source/ui/view
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r--sc/source/ui/view/tabview3.cxx18
-rw-r--r--sc/source/ui/view/tabvwshb.cxx32
2 files changed, 35 insertions, 15 deletions
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 84c56659065e..71204128ce60 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2469,27 +2469,23 @@ void ScTabView::DoChartSelection(
}
}
-void ScTabView::DoDPFieldPopup(Point aPoint, Size /*aSize*/)
+void ScTabView::DoDPFieldPopup(OUString const & rPivotTableName, sal_Int32 nDimensionIndex, Point aPoint, Size aSize)
{
ScDocument& rDocument = aViewData.GetDocShell()->GetDocument();
ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()].get();
+
if (!pWin)
return;
- ScDPCollection* pDPs = rDocument.GetDPCollection();
- // TODO - DP name should be a parameter
- ScDPObject* pDPObj = pDPs->GetByName("DataPilot1");
-
- pDPObj->BuildAllDimensionMembers();
+ ScDPCollection* pDPCollection = rDocument.GetDPCollection();
+ ScDPObject* pDPObject = pDPCollection->GetByName(rPivotTableName);
- //const ScDPSaveData* pSaveData = pDPObj->GetSaveData();
- //bool bIsDataLayout;
- //OUString aDimName = pDPObj->GetDimName(0, bIsDataLayout);
+ pDPObject->BuildAllDimensionMembers();
Point aScreenPoint = pWin->OutputToScreenPixel(pWin->LogicToPixel(aPoint));
- //Size aScreenSize = pWin->LogicToPixel(aSize);
+ Size aScreenSize = pWin->LogicToPixel(aSize);
- pWin->DPLaunchFieldPopupMenu(aScreenPoint, Size(1, 1), 1, pDPObj);
+ pWin->DPLaunchFieldPopupMenu(aScreenPoint, aScreenSize, nDimensionIndex, pDPObject);
}
// PaintGrid - repaint data range
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 3dced2749fd7..52990c0f9428 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -19,6 +19,8 @@
#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/awt/XRequestCallback.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/embed/EmbedMisc.hpp>
#include <com/sun/star/embed/EmbedStates.hpp>
@@ -111,10 +113,32 @@ public:
{}
// XCallback
- virtual void SAL_CALL notify(const css::uno::Any& /*aData*/) override
+ virtual void SAL_CALL notify(const css::uno::Any& aData) override
{
- tools::Rectangle aRect = m_pObject->GetLogicRect();
- m_pViewShell->DoDPFieldPopup(aRect.TopLeft(), aRect.GetSize());
+ uno::Sequence<beans::PropertyValue> aProperties;
+ if (aData >>= aProperties)
+ {
+ awt::Rectangle xRectangle;
+ sal_Int32 dimensionIndex = 0;
+ OUString sPivotTableName("DataPilot1");
+
+ for (beans::PropertyValue const & rProperty : aProperties)
+ {
+ if (rProperty.Name == "Rectangle")
+ rProperty.Value >>= xRectangle;
+ if (rProperty.Name == "DimensionIndex")
+ rProperty.Value >>= dimensionIndex;
+ if (rProperty.Name == "PivotTableName")
+ rProperty.Value >>= sPivotTableName;
+ }
+
+ tools::Rectangle aChartRect = m_pObject->GetLogicRect();
+
+ Point aPoint(xRectangle.X + aChartRect.Left(), xRectangle.Y + aChartRect.Top());
+ Size aSize(xRectangle.Width, xRectangle.Height);
+
+ m_pViewShell->DoDPFieldPopup(sPivotTableName, dimensionIndex, aPoint, aSize);
+ }
}
};
@@ -209,7 +233,7 @@ void ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb )
new ScChartRangeSelectionListener( this ));
xRangeHightlighter->addSelectionChangeListener( xListener );
}
- uno::Reference<chart2::data::XPopupRequest> xPopupRequest(xDataReceiver->getPopupRequest());
+ uno::Reference<awt::XRequestCallback> xPopupRequest(xDataReceiver->getPopupRequest());
if (xPopupRequest.is())
{
uno::Reference<awt::XCallback> xCallback(new PopupCallback(this, pObj));