diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx index 820788a64195..04fade568a21 100644 --- a/sfx2/source/view/lokcharthelper.cxx +++ b/sfx2/source/view/lokcharthelper.cxx @@ -178,12 +178,17 @@ bool LokChartHelper::Hit(const Point& aPos) bool LokChartHelper::HitAny(const Point& aPos) { + SfxViewShell* pCurView = SfxViewShell::Current(); + int nPartForCurView = pCurView ? pCurView->getPart() : -1; SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - LokChartHelper aChartHelper(pViewShell); - if (aChartHelper.Hit(aPos)) - return true; + if (pViewShell->getPart() == nPartForCurView) + { + LokChartHelper aChartHelper(pViewShell); + if (aChartHelper.Hit(aPos)) + return true; + } pViewShell = SfxViewShell::GetNext(*pViewShell); } return false; @@ -254,12 +259,17 @@ void LokChartHelper::PaintAllChartsOnTile(VirtualDevice& rDevice, aMapMode.SetScaleY(scaleY); rDevice.SetMapMode(aMapMode); + SfxViewShell* pCurView = SfxViewShell::Current(); + int nPartForCurView = pCurView ? pCurView->getPart() : -1; tools::Rectangle aTileRect(Point(nTilePosX, nTilePosY), Size(nTileWidth, nTileHeight)); SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - LokChartHelper aChartHelper(pViewShell); - aChartHelper.PaintTile(rDevice, aTileRect); + if (pViewShell->getPart() == nPartForCurView) + { + LokChartHelper aChartHelper(pViewShell); + aChartHelper.PaintTile(rDevice, aTileRect); + } pViewShell = SfxViewShell::GetNext(*pViewShell); } rDevice.Pop();