1cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3cde9e8dcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4cde9e8dcSAndrew Rist * or more contributor license agreements. See the NOTICE file
5cde9e8dcSAndrew Rist * distributed with this work for additional information
6cde9e8dcSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7cde9e8dcSAndrew Rist * to you under the Apache License, Version 2.0 (the
8cde9e8dcSAndrew Rist * "License"); you may not use this file except in compliance
9cde9e8dcSAndrew Rist * with the License. You may obtain a copy of the License at
10cde9e8dcSAndrew Rist *
11cde9e8dcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cde9e8dcSAndrew Rist *
13cde9e8dcSAndrew Rist * Unless required by applicable law or agreed to in writing,
14cde9e8dcSAndrew Rist * software distributed under the License is distributed on an
15cde9e8dcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16cde9e8dcSAndrew Rist * KIND, either express or implied. See the License for the
17cde9e8dcSAndrew Rist * specific language governing permissions and limitations
18cde9e8dcSAndrew Rist * under the License.
19cde9e8dcSAndrew Rist *
20cde9e8dcSAndrew Rist *************************************************************/
21cde9e8dcSAndrew Rist
22cde9e8dcSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir #include "ChartController.hxx"
27cdf0e10cSrcweir #include "PositionAndSizeHelper.hxx"
28cdf0e10cSrcweir #include "ObjectIdentifier.hxx"
29cdf0e10cSrcweir #include "ChartWindow.hxx"
30cdf0e10cSrcweir #include "ResId.hxx"
31cdf0e10cSrcweir #include "CommonConverters.hxx"
32cdf0e10cSrcweir #include "ChartModelHelper.hxx"
33cdf0e10cSrcweir #include "DiagramHelper.hxx"
34cdf0e10cSrcweir #include "TitleHelper.hxx"
35cdf0e10cSrcweir #include "UndoGuard.hxx"
36cdf0e10cSrcweir #include "ControllerLockGuard.hxx"
37cdf0e10cSrcweir #include "ObjectNameProvider.hxx"
38cdf0e10cSrcweir #include "Strings.hrc"
39cdf0e10cSrcweir #include "SchSlotIds.hxx"
40cdf0e10cSrcweir #include "macros.hxx"
41cdf0e10cSrcweir #include "DragMethod_PieSegment.hxx"
42cdf0e10cSrcweir #include "DragMethod_RotateDiagram.hxx"
43cdf0e10cSrcweir #include "ObjectHierarchy.hxx"
44cdf0e10cSrcweir #include "chartview/ExplicitValueProvider.hxx"
45cdf0e10cSrcweir #include "RelativePositionHelper.hxx"
46cdf0e10cSrcweir #include "chartview/DrawModelWrapper.hxx"
47cdf0e10cSrcweir #include "RegressionCurveHelper.hxx"
48cdf0e10cSrcweir #include "StatisticsHelper.hxx"
49cdf0e10cSrcweir #include "DataSeriesHelper.hxx"
50cdf0e10cSrcweir #include "ContainerHelper.hxx"
51cdf0e10cSrcweir #include "AxisHelper.hxx"
52cdf0e10cSrcweir #include "LegendHelper.hxx"
53cdf0e10cSrcweir #include "servicenames_charttypes.hxx"
54cdf0e10cSrcweir #include "MenuResIds.hrc"
55cdf0e10cSrcweir #include "DrawCommandDispatch.hxx"
56cdf0e10cSrcweir
57cdf0e10cSrcweir #include <com/sun/star/chart2/RelativePosition.hpp>
58cdf0e10cSrcweir #include <com/sun/star/chart2/RelativeSize.hpp>
59cdf0e10cSrcweir #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
60cdf0e10cSrcweir
61cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchHelper.hpp>
62cdf0e10cSrcweir #include <com/sun/star/frame/FrameSearchFlag.hpp>
63cdf0e10cSrcweir #include <com/sun/star/util/XUpdatable.hpp>
64cdf0e10cSrcweir #include <comphelper/InlineContainer.hxx>
65cdf0e10cSrcweir
66cdf0e10cSrcweir #include <svtools/contextmenuhelper.hxx>
67cdf0e10cSrcweir #include <toolkit/awt/vclxmenu.hxx>
68cdf0e10cSrcweir
69cdf0e10cSrcweir #include <svx/svxids.hrc>
70cdf0e10cSrcweir #include <svx/ActionDescriptionProvider.hxx>
71cdf0e10cSrcweir
72cdf0e10cSrcweir // header for class E3dObject
73cdf0e10cSrcweir #include <svx/obj3d.hxx>
74cdf0e10cSrcweir // header for class E3dScene
75cdf0e10cSrcweir #include <svx/scene3d.hxx>
76cdf0e10cSrcweir // header for class SdrDragMethod
77cdf0e10cSrcweir #include <svx/svddrgmt.hxx>
78cdf0e10cSrcweir #include <vcl/svapp.hxx>
79cdf0e10cSrcweir #include <vos/mutex.hxx>
80cdf0e10cSrcweir
81cdf0e10cSrcweir // for InfoBox
82cdf0e10cSrcweir #include <vcl/msgbox.hxx>
83cdf0e10cSrcweir
84cdf0e10cSrcweir #include <rtl/math.hxx>
85cdf0e10cSrcweir #include <svtools/acceleratorexecute.hxx>
86cdf0e10cSrcweir
87cdf0e10cSrcweir #define DRGPIX 2 // Drag MinMove in Pixel
88cdf0e10cSrcweir
89cdf0e10cSrcweir using namespace ::com::sun::star;
90cdf0e10cSrcweir using namespace ::com::sun::star::chart2;
91cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
92cdf0e10cSrcweir using ::rtl::OUString;
93cdf0e10cSrcweir
94cdf0e10cSrcweir //.............................................................................
95cdf0e10cSrcweir namespace chart
96cdf0e10cSrcweir {
97cdf0e10cSrcweir //.............................................................................
98cdf0e10cSrcweir
99cdf0e10cSrcweir namespace
100cdf0e10cSrcweir {
lcl_GrowAndShiftLogic(RelativePosition & rInOutRelPos,RelativeSize & rInOutRelSize,const awt::Size & rRefSize,double fGrowLogicX,double fGrowLogicY)101cdf0e10cSrcweir bool lcl_GrowAndShiftLogic(
102cdf0e10cSrcweir RelativePosition & rInOutRelPos,
103cdf0e10cSrcweir RelativeSize & rInOutRelSize,
104cdf0e10cSrcweir const awt::Size & rRefSize,
105cdf0e10cSrcweir double fGrowLogicX,
106cdf0e10cSrcweir double fGrowLogicY )
107cdf0e10cSrcweir {
108cdf0e10cSrcweir if( rRefSize.Width == 0 ||
109cdf0e10cSrcweir rRefSize.Height == 0 )
110cdf0e10cSrcweir return false;
111cdf0e10cSrcweir
112cdf0e10cSrcweir double fRelativeGrowX = fGrowLogicX / rRefSize.Width;
113cdf0e10cSrcweir double fRelativeGrowY = fGrowLogicY / rRefSize.Height;
114cdf0e10cSrcweir
115cdf0e10cSrcweir return ::chart::RelativePositionHelper::centerGrow(
116cdf0e10cSrcweir rInOutRelPos, rInOutRelSize,
117cdf0e10cSrcweir fRelativeGrowX, fRelativeGrowY,
118cdf0e10cSrcweir /* bCheck = */ true );
119cdf0e10cSrcweir }
120cdf0e10cSrcweir
lcl_MoveObjectLogic(RelativePosition & rInOutRelPos,RelativeSize & rObjectSize,const awt::Size & rRefSize,double fShiftLogicX,double fShiftLogicY)121cdf0e10cSrcweir bool lcl_MoveObjectLogic(
122cdf0e10cSrcweir RelativePosition & rInOutRelPos,
123cdf0e10cSrcweir RelativeSize & rObjectSize,
124cdf0e10cSrcweir const awt::Size & rRefSize,
125cdf0e10cSrcweir double fShiftLogicX,
126cdf0e10cSrcweir double fShiftLogicY )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir if( rRefSize.Width == 0 ||
129cdf0e10cSrcweir rRefSize.Height == 0 )
130cdf0e10cSrcweir return false;
131cdf0e10cSrcweir
132cdf0e10cSrcweir double fRelativeShiftX = fShiftLogicX / rRefSize.Width;
133cdf0e10cSrcweir double fRelativeShiftY = fShiftLogicY / rRefSize.Height;
134cdf0e10cSrcweir
135cdf0e10cSrcweir return ::chart::RelativePositionHelper::moveObject(
136cdf0e10cSrcweir rInOutRelPos, rObjectSize,
137cdf0e10cSrcweir fRelativeShiftX, fRelativeShiftY,
138cdf0e10cSrcweir /* bCheck = */ true );
139cdf0e10cSrcweir }
140cdf0e10cSrcweir
lcl_insertMenuCommand(const uno::Reference<awt::XPopupMenu> & xMenu,sal_Int16 nId,const::rtl::OUString & rCommand)141cdf0e10cSrcweir void lcl_insertMenuCommand(
142cdf0e10cSrcweir const uno::Reference< awt::XPopupMenu > & xMenu,
143cdf0e10cSrcweir sal_Int16 nId, const ::rtl::OUString & rCommand )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir static ::rtl::OUString aEmptyString;
146cdf0e10cSrcweir xMenu->insertItem( nId, aEmptyString, 0, -1 );
147d026be40SAriel Constenla-Haile xMenu->setCommand( nId, rCommand );
148cdf0e10cSrcweir }
149cdf0e10cSrcweir
lcl_getFormatCommandForObjectCID(const OUString & rCID)150cdf0e10cSrcweir OUString lcl_getFormatCommandForObjectCID( const OUString& rCID )
151cdf0e10cSrcweir {
152cdf0e10cSrcweir OUString aDispatchCommand( C2U(".uno:FormatSelection") );
153cdf0e10cSrcweir
154cdf0e10cSrcweir ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID );
155cdf0e10cSrcweir
156cdf0e10cSrcweir switch(eObjectType)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir case OBJECTTYPE_DIAGRAM:
159cdf0e10cSrcweir case OBJECTTYPE_DIAGRAM_WALL:
160cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatWall");
161cdf0e10cSrcweir break;
162cdf0e10cSrcweir case OBJECTTYPE_DIAGRAM_FLOOR:
163cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatFloor");
164cdf0e10cSrcweir break;
165cdf0e10cSrcweir case OBJECTTYPE_PAGE:
166cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatChartArea");
167cdf0e10cSrcweir break;
168cdf0e10cSrcweir case OBJECTTYPE_LEGEND:
169cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatLegend");
170cdf0e10cSrcweir break;
171cdf0e10cSrcweir case OBJECTTYPE_TITLE:
172cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatTitle");
173cdf0e10cSrcweir break;
174cdf0e10cSrcweir case OBJECTTYPE_LEGEND_ENTRY:
175cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatDataSeries");
176cdf0e10cSrcweir break;
177cdf0e10cSrcweir case OBJECTTYPE_AXIS:
178cdf0e10cSrcweir case OBJECTTYPE_AXIS_UNITLABEL:
179cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatAxis");
180cdf0e10cSrcweir break;
181cdf0e10cSrcweir case OBJECTTYPE_GRID:
182cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatMajorGrid");
183cdf0e10cSrcweir break;
184cdf0e10cSrcweir case OBJECTTYPE_SUBGRID:
185cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatMinorGrid");
186cdf0e10cSrcweir break;
187cdf0e10cSrcweir case OBJECTTYPE_DATA_LABELS:
188cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatDataLabels");
189cdf0e10cSrcweir break;
190cdf0e10cSrcweir case OBJECTTYPE_DATA_SERIES:
191cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatDataSeries");
192cdf0e10cSrcweir break;
193cdf0e10cSrcweir case OBJECTTYPE_DATA_LABEL:
194cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatDataLabel");
195cdf0e10cSrcweir break;
196cdf0e10cSrcweir case OBJECTTYPE_DATA_POINT:
197cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatDataPoint");
198cdf0e10cSrcweir break;
199cdf0e10cSrcweir case OBJECTTYPE_DATA_AVERAGE_LINE:
200cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatMeanValue");
201cdf0e10cSrcweir break;
202cdf0e10cSrcweir case OBJECTTYPE_DATA_ERRORS:
203cdf0e10cSrcweir case OBJECTTYPE_DATA_ERRORS_X:
204cdf0e10cSrcweir case OBJECTTYPE_DATA_ERRORS_Y:
205cdf0e10cSrcweir case OBJECTTYPE_DATA_ERRORS_Z:
206cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatYErrorBars");
207cdf0e10cSrcweir break;
208cdf0e10cSrcweir case OBJECTTYPE_DATA_CURVE:
209cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatTrendline");
210cdf0e10cSrcweir break;
211cdf0e10cSrcweir case OBJECTTYPE_DATA_CURVE_EQUATION:
212cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatTrendlineEquation");
213cdf0e10cSrcweir break;
214cdf0e10cSrcweir case OBJECTTYPE_DATA_STOCK_RANGE:
215cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatSelection");
216cdf0e10cSrcweir break;
217cdf0e10cSrcweir case OBJECTTYPE_DATA_STOCK_LOSS:
218cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatStockLoss");
219cdf0e10cSrcweir break;
220cdf0e10cSrcweir case OBJECTTYPE_DATA_STOCK_GAIN:
221cdf0e10cSrcweir aDispatchCommand = C2U(".uno:FormatStockGain");
222cdf0e10cSrcweir break;
223cdf0e10cSrcweir default: //OBJECTTYPE_UNKNOWN
224cdf0e10cSrcweir break;
225cdf0e10cSrcweir }
226cdf0e10cSrcweir return aDispatchCommand;
227cdf0e10cSrcweir }
228cdf0e10cSrcweir
229cdf0e10cSrcweir } // anonymous namespace
230cdf0e10cSrcweir
231cdf0e10cSrcweir const short HITPIX=2; //hit-tolerance in pixel
232cdf0e10cSrcweir
233cdf0e10cSrcweir //-----------------------------------------------------------------
234cdf0e10cSrcweir // awt::XWindow
235cdf0e10cSrcweir //-----------------------------------------------------------------
236cdf0e10cSrcweir void SAL_CALL ChartController
setPosSize(sal_Int32 X,sal_Int32 Y,sal_Int32 Width,sal_Int32 Height,sal_Int16 Flags)237cdf0e10cSrcweir ::setPosSize( sal_Int32 X, sal_Int32 Y
238cdf0e10cSrcweir , sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
239cdf0e10cSrcweir throw (uno::RuntimeException)
240cdf0e10cSrcweir {
241cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
242cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
243cdf0e10cSrcweir
244cdf0e10cSrcweir if(xWindow.is() && m_pChartWindow)
245cdf0e10cSrcweir {
246cdf0e10cSrcweir Size aLogicSize = m_pChartWindow->PixelToLogic( Size( Width, Height ), MapMode( MAP_100TH_MM ) );
247cdf0e10cSrcweir
248cdf0e10cSrcweir bool bIsEmbedded = true;
249cdf0e10cSrcweir //todo: for standalone chart: detect wether we are standalone
250cdf0e10cSrcweir if( bIsEmbedded )
251cdf0e10cSrcweir {
252cdf0e10cSrcweir //change map mode to fit new size
253cdf0e10cSrcweir awt::Size aModelPageSize = ChartModelHelper::getPageSize( getModel() );
254cdf0e10cSrcweir sal_Int32 nScaleXNumerator = aLogicSize.Width();
255cdf0e10cSrcweir sal_Int32 nScaleXDenominator = aModelPageSize.Width;
256cdf0e10cSrcweir sal_Int32 nScaleYNumerator = aLogicSize.Height();
257cdf0e10cSrcweir sal_Int32 nScaleYDenominator = aModelPageSize.Height;
258cdf0e10cSrcweir MapMode aNewMapMode( MAP_100TH_MM, Point(0,0)
259cdf0e10cSrcweir , Fraction(nScaleXNumerator,nScaleXDenominator)
260cdf0e10cSrcweir , Fraction(nScaleYNumerator,nScaleYDenominator) );
261cdf0e10cSrcweir m_pChartWindow->SetMapMode(aNewMapMode);
262cdf0e10cSrcweir m_pChartWindow->SetPosSizePixel( X, Y, Width, Height, Flags );
263cdf0e10cSrcweir
264cdf0e10cSrcweir //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
265cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProp( m_xChartView, uno::UNO_QUERY );
266cdf0e10cSrcweir if( xProp.is() )
267cdf0e10cSrcweir {
268cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aZoomFactors(4);
269cdf0e10cSrcweir aZoomFactors[0].Name = C2U("ScaleXNumerator");
270cdf0e10cSrcweir aZoomFactors[0].Value = uno::makeAny( nScaleXNumerator );
271cdf0e10cSrcweir aZoomFactors[1].Name = C2U("ScaleXDenominator");
272cdf0e10cSrcweir aZoomFactors[1].Value = uno::makeAny( nScaleXDenominator );
273cdf0e10cSrcweir aZoomFactors[2].Name = C2U("ScaleYNumerator");
274cdf0e10cSrcweir aZoomFactors[2].Value = uno::makeAny( nScaleYNumerator );
275cdf0e10cSrcweir aZoomFactors[3].Name = C2U("ScaleYDenominator");
276cdf0e10cSrcweir aZoomFactors[3].Value = uno::makeAny( nScaleYDenominator );
277cdf0e10cSrcweir xProp->setPropertyValue( C2U("ZoomFactors"), uno::makeAny( aZoomFactors ));
278cdf0e10cSrcweir }
279cdf0e10cSrcweir
280cdf0e10cSrcweir //a correct work area is at least necessary for correct values in the position and size dialog and for dragging area
281cdf0e10cSrcweir if(m_pDrawViewWrapper)
282cdf0e10cSrcweir {
283cdf0e10cSrcweir Rectangle aRect(Point(0,0), m_pChartWindow->GetOutputSize());
284cdf0e10cSrcweir m_pDrawViewWrapper->SetWorkArea( aRect );
285cdf0e10cSrcweir }
286cdf0e10cSrcweir }
287cdf0e10cSrcweir else
288cdf0e10cSrcweir {
289cdf0e10cSrcweir //change visarea
290cdf0e10cSrcweir ChartModelHelper::setPageSize( awt::Size( aLogicSize.Width(), aLogicSize.Height() ), getModel() );
291cdf0e10cSrcweir m_pChartWindow->SetPosSizePixel( X, Y, Width, Height, Flags );
292cdf0e10cSrcweir }
293cdf0e10cSrcweir m_pChartWindow->Invalidate();
294cdf0e10cSrcweir }
295cdf0e10cSrcweir }
296cdf0e10cSrcweir
297cdf0e10cSrcweir awt::Rectangle SAL_CALL ChartController
getPosSize()298cdf0e10cSrcweir ::getPosSize()
299cdf0e10cSrcweir throw (uno::RuntimeException)
300cdf0e10cSrcweir {
301cdf0e10cSrcweir //@todo
302cdf0e10cSrcweir awt::Rectangle aRet(0,0,0,0);
303cdf0e10cSrcweir
304cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
305cdf0e10cSrcweir if(xWindow.is())
306cdf0e10cSrcweir aRet = xWindow->getPosSize();
307cdf0e10cSrcweir
308cdf0e10cSrcweir return aRet;
309cdf0e10cSrcweir }
310cdf0e10cSrcweir
311cdf0e10cSrcweir void SAL_CALL ChartController
setVisible(sal_Bool Visible)312cdf0e10cSrcweir ::setVisible( sal_Bool Visible )
313cdf0e10cSrcweir throw (uno::RuntimeException)
314cdf0e10cSrcweir {
315cdf0e10cSrcweir //@todo
316cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
317cdf0e10cSrcweir
318cdf0e10cSrcweir if(xWindow.is())
319cdf0e10cSrcweir xWindow->setVisible( Visible );
320cdf0e10cSrcweir }
321cdf0e10cSrcweir
322cdf0e10cSrcweir void SAL_CALL ChartController
setEnable(sal_Bool Enable)323cdf0e10cSrcweir ::setEnable( sal_Bool Enable )
324cdf0e10cSrcweir throw (uno::RuntimeException)
325cdf0e10cSrcweir {
326cdf0e10cSrcweir //@todo
327cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
328cdf0e10cSrcweir
329cdf0e10cSrcweir if(xWindow.is())
330cdf0e10cSrcweir xWindow->setEnable( Enable );
331cdf0e10cSrcweir }
332cdf0e10cSrcweir
333cdf0e10cSrcweir void SAL_CALL ChartController
setFocus()334cdf0e10cSrcweir ::setFocus() throw (uno::RuntimeException)
335cdf0e10cSrcweir {
336cdf0e10cSrcweir //@todo
337cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
338cdf0e10cSrcweir
339cdf0e10cSrcweir if(xWindow.is())
340cdf0e10cSrcweir xWindow->setFocus();
341cdf0e10cSrcweir }
342cdf0e10cSrcweir
343cdf0e10cSrcweir void SAL_CALL ChartController
addWindowListener(const uno::Reference<awt::XWindowListener> & xListener)344cdf0e10cSrcweir ::addWindowListener( const uno::Reference<
345cdf0e10cSrcweir awt::XWindowListener >& xListener )
346cdf0e10cSrcweir throw (uno::RuntimeException)
347cdf0e10cSrcweir {
348cdf0e10cSrcweir //@todo
349cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
350cdf0e10cSrcweir
351cdf0e10cSrcweir if(xWindow.is())
352cdf0e10cSrcweir xWindow->addWindowListener( xListener );
353cdf0e10cSrcweir }
354cdf0e10cSrcweir
355cdf0e10cSrcweir void SAL_CALL ChartController
removeWindowListener(const uno::Reference<awt::XWindowListener> & xListener)356cdf0e10cSrcweir ::removeWindowListener( const uno::Reference<
357cdf0e10cSrcweir awt::XWindowListener >& xListener )
358cdf0e10cSrcweir throw (uno::RuntimeException)
359cdf0e10cSrcweir {
360cdf0e10cSrcweir //@todo
361cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
362cdf0e10cSrcweir
363cdf0e10cSrcweir if(xWindow.is())
364cdf0e10cSrcweir xWindow->removeWindowListener( xListener );
365cdf0e10cSrcweir }
366cdf0e10cSrcweir
367cdf0e10cSrcweir void SAL_CALL ChartController
addFocusListener(const uno::Reference<awt::XFocusListener> & xListener)368cdf0e10cSrcweir ::addFocusListener( const uno::Reference<
369cdf0e10cSrcweir awt::XFocusListener >& xListener )
370cdf0e10cSrcweir throw (uno::RuntimeException)
371cdf0e10cSrcweir {
372cdf0e10cSrcweir //@todo
373cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
374cdf0e10cSrcweir
375cdf0e10cSrcweir if(xWindow.is())
376cdf0e10cSrcweir xWindow->addFocusListener( xListener );
377cdf0e10cSrcweir }
378cdf0e10cSrcweir
379cdf0e10cSrcweir void SAL_CALL ChartController
removeFocusListener(const uno::Reference<awt::XFocusListener> & xListener)380cdf0e10cSrcweir ::removeFocusListener( const uno::Reference<
381cdf0e10cSrcweir awt::XFocusListener >& xListener )
382cdf0e10cSrcweir throw (uno::RuntimeException)
383cdf0e10cSrcweir {
384cdf0e10cSrcweir //@todo
385cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
386cdf0e10cSrcweir
387cdf0e10cSrcweir if(xWindow.is())
388cdf0e10cSrcweir xWindow->removeFocusListener( xListener );
389cdf0e10cSrcweir }
390cdf0e10cSrcweir
391cdf0e10cSrcweir void SAL_CALL ChartController
addKeyListener(const uno::Reference<awt::XKeyListener> & xListener)392cdf0e10cSrcweir ::addKeyListener( const uno::Reference<
393cdf0e10cSrcweir awt::XKeyListener >& xListener )
394cdf0e10cSrcweir throw (uno::RuntimeException)
395cdf0e10cSrcweir {
396cdf0e10cSrcweir //@todo
397cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
398cdf0e10cSrcweir
399cdf0e10cSrcweir if(xWindow.is())
400cdf0e10cSrcweir xWindow->addKeyListener( xListener );
401cdf0e10cSrcweir }
402cdf0e10cSrcweir
403cdf0e10cSrcweir void SAL_CALL ChartController
removeKeyListener(const uno::Reference<awt::XKeyListener> & xListener)404cdf0e10cSrcweir ::removeKeyListener( const uno::Reference<
405cdf0e10cSrcweir awt::XKeyListener >& xListener )
406cdf0e10cSrcweir throw (uno::RuntimeException)
407cdf0e10cSrcweir {
408cdf0e10cSrcweir //@todo
409cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
410cdf0e10cSrcweir
411cdf0e10cSrcweir if(xWindow.is())
412cdf0e10cSrcweir xWindow->removeKeyListener( xListener );
413cdf0e10cSrcweir }
414cdf0e10cSrcweir
415cdf0e10cSrcweir void SAL_CALL ChartController
addMouseListener(const uno::Reference<awt::XMouseListener> & xListener)416cdf0e10cSrcweir ::addMouseListener( const uno::Reference<
417cdf0e10cSrcweir awt::XMouseListener >& xListener )
418cdf0e10cSrcweir throw (uno::RuntimeException)
419cdf0e10cSrcweir {
420cdf0e10cSrcweir //@todo
421cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
422cdf0e10cSrcweir
423cdf0e10cSrcweir if(xWindow.is())
424cdf0e10cSrcweir xWindow->addMouseListener( xListener );
425cdf0e10cSrcweir }
426cdf0e10cSrcweir
427cdf0e10cSrcweir void SAL_CALL ChartController
removeMouseListener(const uno::Reference<awt::XMouseListener> & xListener)428cdf0e10cSrcweir ::removeMouseListener( const uno::Reference<
429cdf0e10cSrcweir awt::XMouseListener >& xListener )
430cdf0e10cSrcweir throw (uno::RuntimeException)
431cdf0e10cSrcweir {
432cdf0e10cSrcweir //@todo
433cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
434cdf0e10cSrcweir
435cdf0e10cSrcweir if(xWindow.is())
436cdf0e10cSrcweir xWindow->removeMouseListener( xListener );
437cdf0e10cSrcweir }
438cdf0e10cSrcweir
439cdf0e10cSrcweir void SAL_CALL ChartController
addMouseMotionListener(const uno::Reference<awt::XMouseMotionListener> & xListener)440cdf0e10cSrcweir ::addMouseMotionListener( const uno::Reference<
441cdf0e10cSrcweir awt::XMouseMotionListener >& xListener )
442cdf0e10cSrcweir throw (uno::RuntimeException)
443cdf0e10cSrcweir {
444cdf0e10cSrcweir //@todo
445cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
446cdf0e10cSrcweir
447cdf0e10cSrcweir if(xWindow.is())
448cdf0e10cSrcweir xWindow->addMouseMotionListener( xListener );
449cdf0e10cSrcweir }
450cdf0e10cSrcweir
451cdf0e10cSrcweir void SAL_CALL ChartController
removeMouseMotionListener(const uno::Reference<awt::XMouseMotionListener> & xListener)452cdf0e10cSrcweir ::removeMouseMotionListener( const uno::Reference<
453cdf0e10cSrcweir awt::XMouseMotionListener >& xListener )
454cdf0e10cSrcweir throw (uno::RuntimeException)
455cdf0e10cSrcweir {
456cdf0e10cSrcweir //@todo
457cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
458cdf0e10cSrcweir
459cdf0e10cSrcweir if(xWindow.is())
460cdf0e10cSrcweir xWindow->removeMouseMotionListener( xListener );
461cdf0e10cSrcweir }
462cdf0e10cSrcweir
463cdf0e10cSrcweir void SAL_CALL ChartController
addPaintListener(const uno::Reference<awt::XPaintListener> & xListener)464cdf0e10cSrcweir ::addPaintListener( const uno::Reference<
465cdf0e10cSrcweir awt::XPaintListener >& xListener )
466cdf0e10cSrcweir throw (uno::RuntimeException)
467cdf0e10cSrcweir {
468cdf0e10cSrcweir //@todo
469cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
470cdf0e10cSrcweir
471cdf0e10cSrcweir if(xWindow.is())
472cdf0e10cSrcweir xWindow->addPaintListener( xListener );
473cdf0e10cSrcweir }
474cdf0e10cSrcweir
475cdf0e10cSrcweir void SAL_CALL ChartController
removePaintListener(const uno::Reference<awt::XPaintListener> & xListener)476cdf0e10cSrcweir ::removePaintListener( const uno::Reference<
477cdf0e10cSrcweir awt::XPaintListener >& xListener )
478cdf0e10cSrcweir throw (uno::RuntimeException)
479cdf0e10cSrcweir {
480cdf0e10cSrcweir //@todo
481cdf0e10cSrcweir uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
482cdf0e10cSrcweir
483cdf0e10cSrcweir if(xWindow.is())
484cdf0e10cSrcweir xWindow->removePaintListener( xListener );
485cdf0e10cSrcweir }
486cdf0e10cSrcweir
487cdf0e10cSrcweir //-----------------------------------------------------------------
488cdf0e10cSrcweir // impl vcl window controller methods
489cdf0e10cSrcweir //-----------------------------------------------------------------
PrePaint()490cdf0e10cSrcweir void ChartController::PrePaint()
491cdf0e10cSrcweir {
492cdf0e10cSrcweir // forward VCLs PrePaint window event to DrawingLayer
493cdf0e10cSrcweir DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
494cdf0e10cSrcweir
495cdf0e10cSrcweir if(pDrawViewWrapper)
496cdf0e10cSrcweir {
497cdf0e10cSrcweir pDrawViewWrapper->PrePaint();
498cdf0e10cSrcweir }
499cdf0e10cSrcweir }
500cdf0e10cSrcweir
execute_Paint(const Rectangle & rRect)501cdf0e10cSrcweir void ChartController::execute_Paint( const Rectangle& rRect )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir try
504cdf0e10cSrcweir {
505cdf0e10cSrcweir uno::Reference< frame::XModel > xModel( getModel() );
506cdf0e10cSrcweir //DBG_ASSERT( xModel.is(), "ChartController::execute_Paint: have no model to paint");
507cdf0e10cSrcweir if( !xModel.is() )
508cdf0e10cSrcweir return;
509cdf0e10cSrcweir
510cdf0e10cSrcweir //better performance for big data
511cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProp( m_xChartView, uno::UNO_QUERY );
512cdf0e10cSrcweir if( xProp.is() )
513cdf0e10cSrcweir {
514cdf0e10cSrcweir awt::Size aResolution(1000,1000);
515cdf0e10cSrcweir {
516cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex());
517cdf0e10cSrcweir if( m_pChartWindow )
518cdf0e10cSrcweir {
519cdf0e10cSrcweir aResolution.Width = m_pChartWindow->GetSizePixel().Width();
520cdf0e10cSrcweir aResolution.Height = m_pChartWindow->GetSizePixel().Height();
521cdf0e10cSrcweir }
522cdf0e10cSrcweir }
523cdf0e10cSrcweir xProp->setPropertyValue( C2U("Resolution"), uno::makeAny( aResolution ));
524cdf0e10cSrcweir }
525cdf0e10cSrcweir //
526cdf0e10cSrcweir
527cdf0e10cSrcweir uno::Reference< util::XUpdatable > xUpdatable( m_xChartView, uno::UNO_QUERY );
528cdf0e10cSrcweir if( xUpdatable.is() )
529cdf0e10cSrcweir xUpdatable->update();
530cdf0e10cSrcweir
531cdf0e10cSrcweir {
532cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex());
533cdf0e10cSrcweir DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
534cdf0e10cSrcweir if(pDrawViewWrapper)
535cdf0e10cSrcweir pDrawViewWrapper->CompleteRedraw(m_pChartWindow, Region(rRect) );
536cdf0e10cSrcweir }
537cdf0e10cSrcweir }
538cdf0e10cSrcweir catch( uno::Exception & ex )
539cdf0e10cSrcweir {
540cdf0e10cSrcweir ASSERT_EXCEPTION( ex );
541cdf0e10cSrcweir }
542cdf0e10cSrcweir catch( ... )
543cdf0e10cSrcweir {
544cdf0e10cSrcweir }
545cdf0e10cSrcweir }
546cdf0e10cSrcweir
isDoubleClick(const MouseEvent & rMEvt)547cdf0e10cSrcweir bool isDoubleClick( const MouseEvent& rMEvt )
548cdf0e10cSrcweir {
549cdf0e10cSrcweir return rMEvt.GetClicks() == 2 && rMEvt.IsLeft() &&
550cdf0e10cSrcweir !rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsShift();
551cdf0e10cSrcweir }
552cdf0e10cSrcweir
553cdf0e10cSrcweir //-----------------------------------------------------------------------------
554cdf0e10cSrcweir //-----------------------------------------------------------------------------
555cdf0e10cSrcweir //-----------------------------------------------------------------------------
556cdf0e10cSrcweir
startDoubleClickWaiting()557cdf0e10cSrcweir void ChartController::startDoubleClickWaiting()
558cdf0e10cSrcweir {
559cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
560cdf0e10cSrcweir
561cdf0e10cSrcweir m_bWaitingForDoubleClick = true;
562cdf0e10cSrcweir
563cdf0e10cSrcweir sal_uLong nDblClkTime = 500;
564cdf0e10cSrcweir if( m_pChartWindow )
565cdf0e10cSrcweir {
566cdf0e10cSrcweir const MouseSettings& rMSettings = m_pChartWindow->GetSettings().GetMouseSettings();
567cdf0e10cSrcweir nDblClkTime = rMSettings.GetDoubleClickTime();
568cdf0e10cSrcweir }
569cdf0e10cSrcweir m_aDoubleClickTimer.SetTimeout( nDblClkTime );
570cdf0e10cSrcweir m_aDoubleClickTimer.Start();
571cdf0e10cSrcweir }
572cdf0e10cSrcweir
stopDoubleClickWaiting()573cdf0e10cSrcweir void ChartController::stopDoubleClickWaiting()
574cdf0e10cSrcweir {
575cdf0e10cSrcweir m_aDoubleClickTimer.Stop();
576cdf0e10cSrcweir m_bWaitingForDoubleClick = false;
577cdf0e10cSrcweir }
578cdf0e10cSrcweir
IMPL_LINK(ChartController,DoubleClickWaitingHdl,void *,EMPTYARG)579cdf0e10cSrcweir IMPL_LINK( ChartController, DoubleClickWaitingHdl, void*, EMPTYARG )
580cdf0e10cSrcweir {
581cdf0e10cSrcweir m_bWaitingForDoubleClick = false;
582cdf0e10cSrcweir
583cdf0e10cSrcweir if( !m_bWaitingForMouseUp && m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured() )
584cdf0e10cSrcweir {
585cdf0e10cSrcweir this->impl_selectObjectAndNotiy();
586cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
587cdf0e10cSrcweir if( m_pChartWindow )
588cdf0e10cSrcweir {
589cdf0e10cSrcweir Window::PointerState aPointerState( m_pChartWindow->GetPointerState() );
590cdf0e10cSrcweir MouseEvent aMouseEvent( aPointerState.maPos,1/*nClicks*/,
591cdf0e10cSrcweir 0/*nMode*/, static_cast< sal_uInt16 >( aPointerState.mnState )/*nButtons*/,
592cdf0e10cSrcweir 0/*nModifier*/ );
593cdf0e10cSrcweir impl_SetMousePointer( aMouseEvent );
594cdf0e10cSrcweir }
595cdf0e10cSrcweir }
596cdf0e10cSrcweir
597cdf0e10cSrcweir return 0;
598cdf0e10cSrcweir }
599cdf0e10cSrcweir
600cdf0e10cSrcweir //------------------------------------------------------------------------
601cdf0e10cSrcweir
execute_MouseButtonDown(const MouseEvent & rMEvt)602cdf0e10cSrcweir void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
603cdf0e10cSrcweir {
604cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex());
605cdf0e10cSrcweir
606cdf0e10cSrcweir m_bWaitingForMouseUp = true;
607cdf0e10cSrcweir
608cdf0e10cSrcweir if( isDoubleClick(rMEvt) )
609cdf0e10cSrcweir stopDoubleClickWaiting();
610cdf0e10cSrcweir else
611cdf0e10cSrcweir startDoubleClickWaiting();
612cdf0e10cSrcweir
613cdf0e10cSrcweir m_aSelection.remindSelectionBeforeMouseDown();
614cdf0e10cSrcweir
615cdf0e10cSrcweir DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
616cdf0e10cSrcweir if(!m_pChartWindow || !pDrawViewWrapper )
617cdf0e10cSrcweir return;
618cdf0e10cSrcweir
619cdf0e10cSrcweir Point aMPos = m_pChartWindow->PixelToLogic(rMEvt.GetPosPixel());
620cdf0e10cSrcweir
621cdf0e10cSrcweir if ( MOUSE_LEFT == rMEvt.GetButtons() )
622cdf0e10cSrcweir {
623cdf0e10cSrcweir m_pChartWindow->GrabFocus();
624cdf0e10cSrcweir m_pChartWindow->CaptureMouse();
625cdf0e10cSrcweir }
626cdf0e10cSrcweir
627cdf0e10cSrcweir if( pDrawViewWrapper->IsTextEdit() )
628cdf0e10cSrcweir {
629cdf0e10cSrcweir SdrViewEvent aVEvt;
630cdf0e10cSrcweir if ( pDrawViewWrapper->IsTextEditHit( aMPos, HITPIX ) ||
631cdf0e10cSrcweir // #i12587# support for shapes in chart
632cdf0e10cSrcweir ( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, SDRMOUSEBUTTONDOWN, aVEvt ) == SDRHIT_MARKEDOBJECT ) )
633cdf0e10cSrcweir {
634cdf0e10cSrcweir pDrawViewWrapper->MouseButtonDown(rMEvt,m_pChartWindow);
635cdf0e10cSrcweir return;
636cdf0e10cSrcweir }
637cdf0e10cSrcweir else
638cdf0e10cSrcweir {
639cdf0e10cSrcweir this->EndTextEdit();
640cdf0e10cSrcweir }
641cdf0e10cSrcweir }
642cdf0e10cSrcweir
643cdf0e10cSrcweir //abort running action
644cdf0e10cSrcweir if( pDrawViewWrapper->IsAction() )
645cdf0e10cSrcweir {
646cdf0e10cSrcweir if( rMEvt.IsRight() )
647cdf0e10cSrcweir pDrawViewWrapper->BckAction();
648cdf0e10cSrcweir return;
649cdf0e10cSrcweir }
650cdf0e10cSrcweir
651cdf0e10cSrcweir if( isDoubleClick(rMEvt) ) //do not change selection if double click
652cdf0e10cSrcweir return;//double click is handled further in mousebutton up
653cdf0e10cSrcweir
654cdf0e10cSrcweir SdrHdl* pHitSelectionHdl = 0;
655cdf0e10cSrcweir //switch from move to resize if handle is hit on a resizeable object
656cdf0e10cSrcweir if( m_aSelection.isResizeableObjectSelected() )
657cdf0e10cSrcweir pHitSelectionHdl = pDrawViewWrapper->PickHandle( aMPos );
658cdf0e10cSrcweir //only change selection if no selection handles are hit
659cdf0e10cSrcweir if( !pHitSelectionHdl )
660cdf0e10cSrcweir {
661cdf0e10cSrcweir // #i12587# support for shapes in chart
662cdf0e10cSrcweir if ( m_eDrawMode == CHARTDRAW_INSERT &&
663cdf0e10cSrcweir ( !pDrawViewWrapper->IsMarkedHit( aMPos ) || !m_aSelection.isDragableObjectSelected() ) )
664cdf0e10cSrcweir {
665cdf0e10cSrcweir if ( m_aSelection.hasSelection() )
666cdf0e10cSrcweir {
667cdf0e10cSrcweir m_aSelection.clearSelection();
668cdf0e10cSrcweir }
669cdf0e10cSrcweir if ( !pDrawViewWrapper->IsAction() )
670cdf0e10cSrcweir {
671cdf0e10cSrcweir if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CAPTION )
672cdf0e10cSrcweir {
673cdf0e10cSrcweir Size aCaptionSize( 2268, 1134 );
674cdf0e10cSrcweir pDrawViewWrapper->BegCreateCaptionObj( aMPos, aCaptionSize );
675cdf0e10cSrcweir }
676cdf0e10cSrcweir else
677cdf0e10cSrcweir {
678cdf0e10cSrcweir pDrawViewWrapper->BegCreateObj( aMPos);
679cdf0e10cSrcweir }
680cdf0e10cSrcweir SdrObject* pObj = pDrawViewWrapper->GetCreateObj();
681cdf0e10cSrcweir DrawCommandDispatch* pDrawCommandDispatch = m_aDispatchContainer.getDrawCommandDispatch();
682cdf0e10cSrcweir if ( pObj && m_pDrawModelWrapper && pDrawCommandDispatch )
683cdf0e10cSrcweir {
684cdf0e10cSrcweir SfxItemSet aSet( m_pDrawModelWrapper->GetItemPool() );
685cdf0e10cSrcweir pDrawCommandDispatch->setAttributes( pObj );
686cdf0e10cSrcweir pDrawCommandDispatch->setLineEnds( aSet );
687cdf0e10cSrcweir pObj->SetMergedItemSet( aSet );
688cdf0e10cSrcweir }
689cdf0e10cSrcweir }
690cdf0e10cSrcweir impl_SetMousePointer( rMEvt );
691cdf0e10cSrcweir return;
692cdf0e10cSrcweir }
693cdf0e10cSrcweir
694cdf0e10cSrcweir m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper
695cdf0e10cSrcweir , rMEvt.IsRight(), m_bWaitingForDoubleClick );
696cdf0e10cSrcweir
697cdf0e10cSrcweir if( !m_aSelection.isRotateableObjectSelected( getModel() ) )
698cdf0e10cSrcweir {
699cdf0e10cSrcweir m_eDragMode = SDRDRAG_MOVE;
700cdf0e10cSrcweir pDrawViewWrapper->SetDragMode(m_eDragMode);
701cdf0e10cSrcweir }
702cdf0e10cSrcweir
703cdf0e10cSrcweir m_aSelection.applySelection(pDrawViewWrapper);
704cdf0e10cSrcweir }
705cdf0e10cSrcweir if( m_aSelection.isDragableObjectSelected()
706cdf0e10cSrcweir && !rMEvt.IsRight() )
707cdf0e10cSrcweir {
708cdf0e10cSrcweir //start drag
709cdf0e10cSrcweir sal_uInt16 nDrgLog = (sal_uInt16)m_pChartWindow->PixelToLogic(Size(DRGPIX,0)).Width();
710cdf0e10cSrcweir SdrDragMethod* pDragMethod = NULL;
711cdf0e10cSrcweir
712cdf0e10cSrcweir //change selection to 3D scene if rotate mode
713cdf0e10cSrcweir SdrDragMode eDragMode = pDrawViewWrapper->GetDragMode();
714cdf0e10cSrcweir if( SDRDRAG_ROTATE==eDragMode )
715cdf0e10cSrcweir {
716cdf0e10cSrcweir E3dScene* pScene = SelectionHelper::getSceneToRotate( pDrawViewWrapper->getNamedSdrObject( m_aSelection.getSelectedCID() ) );
717cdf0e10cSrcweir if( pScene )
718cdf0e10cSrcweir {
719cdf0e10cSrcweir DragMethod_RotateDiagram::RotationDirection eRotationDirection(DragMethod_RotateDiagram::ROTATIONDIRECTION_FREE);
720cdf0e10cSrcweir if(pHitSelectionHdl)
721cdf0e10cSrcweir {
722cdf0e10cSrcweir SdrHdlKind eKind = pHitSelectionHdl->GetKind();
723cdf0e10cSrcweir if( eKind==HDL_UPPER || eKind==HDL_LOWER )
724cdf0e10cSrcweir eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_X;
725cdf0e10cSrcweir else if( eKind==HDL_LEFT || eKind==HDL_RIGHT )
726cdf0e10cSrcweir eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_Y;
727cdf0e10cSrcweir else if( eKind==HDL_UPLFT || eKind==HDL_UPRGT || eKind==HDL_LWLFT || eKind==HDL_LWRGT )
728cdf0e10cSrcweir eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_Z;
729cdf0e10cSrcweir }
730cdf0e10cSrcweir pDragMethod = new DragMethod_RotateDiagram( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getModel(), eRotationDirection );
731cdf0e10cSrcweir }
732cdf0e10cSrcweir }
733cdf0e10cSrcweir else
734cdf0e10cSrcweir {
735cdf0e10cSrcweir rtl::OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ) );
736cdf0e10cSrcweir if( aDragMethodServiceName.equals( ObjectIdentifier::getPieSegmentDragMethodServiceName() ) )
737cdf0e10cSrcweir pDragMethod = new DragMethod_PieSegment( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getModel() );
738cdf0e10cSrcweir }
739cdf0e10cSrcweir pDrawViewWrapper->SdrView::BegDragObj(aMPos, NULL, pHitSelectionHdl, nDrgLog, pDragMethod);
740cdf0e10cSrcweir }
741cdf0e10cSrcweir
742cdf0e10cSrcweir impl_SetMousePointer( rMEvt );
743cdf0e10cSrcweir }
744cdf0e10cSrcweir
execute_MouseMove(const MouseEvent & rMEvt)745cdf0e10cSrcweir void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
746cdf0e10cSrcweir {
747cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex());
748cdf0e10cSrcweir
749cdf0e10cSrcweir DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
750cdf0e10cSrcweir if(!m_pChartWindow || !pDrawViewWrapper)
751cdf0e10cSrcweir return;
752cdf0e10cSrcweir
753cdf0e10cSrcweir if( m_pDrawViewWrapper->IsTextEdit() )
754cdf0e10cSrcweir {
755cdf0e10cSrcweir if( m_pDrawViewWrapper->MouseMove(rMEvt,m_pChartWindow) )
756cdf0e10cSrcweir return;
757cdf0e10cSrcweir }
758cdf0e10cSrcweir
759cdf0e10cSrcweir if(pDrawViewWrapper->IsAction())
760cdf0e10cSrcweir {
761cdf0e10cSrcweir pDrawViewWrapper->MovAction( m_pChartWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
762cdf0e10cSrcweir }
763cdf0e10cSrcweir
764cdf0e10cSrcweir //?? pDrawViewWrapper->GetPageView()->DragPoly();
765cdf0e10cSrcweir
766cdf0e10cSrcweir impl_SetMousePointer( rMEvt );
767cdf0e10cSrcweir }
execute_Tracking(const TrackingEvent &)768cdf0e10cSrcweir void ChartController::execute_Tracking( const TrackingEvent& /* rTEvt */ )
769cdf0e10cSrcweir {
770cdf0e10cSrcweir }
771cdf0e10cSrcweir
772cdf0e10cSrcweir //-----------------
773cdf0e10cSrcweir
execute_MouseButtonUp(const MouseEvent & rMEvt)774cdf0e10cSrcweir void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
775cdf0e10cSrcweir {
776cdf0e10cSrcweir ControllerLockGuard aCLGuard( getModel() );
777cdf0e10cSrcweir bool bMouseUpWithoutMouseDown = !m_bWaitingForMouseUp;
778cdf0e10cSrcweir m_bWaitingForMouseUp = false;
779cdf0e10cSrcweir bool bNotifySelectionChange = false;
780cdf0e10cSrcweir {
781cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex());
782cdf0e10cSrcweir
783cdf0e10cSrcweir DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
784cdf0e10cSrcweir if(!m_pChartWindow || !pDrawViewWrapper)
785cdf0e10cSrcweir return;
786cdf0e10cSrcweir
787cdf0e10cSrcweir Point aMPos = m_pChartWindow->PixelToLogic(rMEvt.GetPosPixel());
788cdf0e10cSrcweir
789cdf0e10cSrcweir if(pDrawViewWrapper->IsTextEdit())
790cdf0e10cSrcweir {
791cdf0e10cSrcweir if( pDrawViewWrapper->MouseButtonUp(rMEvt,m_pChartWindow) )
792cdf0e10cSrcweir return;
793cdf0e10cSrcweir }
794cdf0e10cSrcweir
795cdf0e10cSrcweir // #i12587# support for shapes in chart
796cdf0e10cSrcweir if ( m_eDrawMode == CHARTDRAW_INSERT && pDrawViewWrapper->IsCreateObj() )
797cdf0e10cSrcweir {
798cdf0e10cSrcweir pDrawViewWrapper->EndCreateObj( SDRCREATE_FORCEEND );
799cdf0e10cSrcweir {
800cdf0e10cSrcweir HiddenUndoContext aUndoContext( m_xUndoManager );
801cdf0e10cSrcweir // don't want the positioning Undo action to appear in the UI
802cdf0e10cSrcweir impl_switchDiagramPositioningToExcludingPositioning();
803cdf0e10cSrcweir }
804cdf0e10cSrcweir if ( pDrawViewWrapper->AreObjectsMarked() )
805cdf0e10cSrcweir {
806cdf0e10cSrcweir if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT )
807cdf0e10cSrcweir {
808cdf0e10cSrcweir executeDispatch_EditText();
809cdf0e10cSrcweir }
810cdf0e10cSrcweir else
811cdf0e10cSrcweir {
812cdf0e10cSrcweir SdrObject* pObj = pDrawViewWrapper->getSelectedObject();
813cdf0e10cSrcweir if ( pObj )
814cdf0e10cSrcweir {
815cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
816cdf0e10cSrcweir if ( xShape.is() )
817cdf0e10cSrcweir {
818cdf0e10cSrcweir m_aSelection.setSelection( xShape );
819cdf0e10cSrcweir m_aSelection.applySelection( pDrawViewWrapper );
820cdf0e10cSrcweir }
821cdf0e10cSrcweir }
822cdf0e10cSrcweir }
823cdf0e10cSrcweir }
824cdf0e10cSrcweir else
825cdf0e10cSrcweir {
826cdf0e10cSrcweir m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper, rMEvt.IsRight(), m_bWaitingForDoubleClick );
827cdf0e10cSrcweir m_aSelection.applySelection( pDrawViewWrapper );
828cdf0e10cSrcweir setDrawMode( CHARTDRAW_SELECT );
829cdf0e10cSrcweir }
830cdf0e10cSrcweir }
831cdf0e10cSrcweir else if ( pDrawViewWrapper->IsDragObj() )
832cdf0e10cSrcweir {
833cdf0e10cSrcweir bool bDraggingDone = false;
834cdf0e10cSrcweir SdrDragMethod* pDragMethod = pDrawViewWrapper->SdrView::GetDragMethod();
835cdf0e10cSrcweir bool bIsMoveOnly = pDragMethod ? pDragMethod->getMoveOnly() : false;
836cdf0e10cSrcweir DragMethod_Base* pChartDragMethod = dynamic_cast< DragMethod_Base* >(pDragMethod);
837cdf0e10cSrcweir if( pChartDragMethod )
838cdf0e10cSrcweir {
839cdf0e10cSrcweir UndoGuard aUndoGuard( pChartDragMethod->getUndoDescription(),
840cdf0e10cSrcweir m_xUndoManager );
841cdf0e10cSrcweir
842cdf0e10cSrcweir if( pDrawViewWrapper->EndDragObj(false) )
843cdf0e10cSrcweir {
844cdf0e10cSrcweir bDraggingDone = true;
845cdf0e10cSrcweir aUndoGuard.commit();
846cdf0e10cSrcweir }
847cdf0e10cSrcweir }
848cdf0e10cSrcweir
849cdf0e10cSrcweir if( !bDraggingDone && pDrawViewWrapper->EndDragObj(false) )
850cdf0e10cSrcweir {
851cdf0e10cSrcweir try
852cdf0e10cSrcweir {
853cdf0e10cSrcweir //end move or size
854cdf0e10cSrcweir SdrObject* pObj = pDrawViewWrapper->getSelectedObject();
855cdf0e10cSrcweir if( pObj )
856cdf0e10cSrcweir {
857cdf0e10cSrcweir Rectangle aObjectRect = pObj->GetSnapRect();
858cdf0e10cSrcweir awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
859cdf0e10cSrcweir Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height );
860cdf0e10cSrcweir
861cdf0e10cSrcweir const E3dObject* pE3dObject = dynamic_cast< const E3dObject*>( pObj );
862cdf0e10cSrcweir if( pE3dObject )
863cdf0e10cSrcweir aObjectRect = pE3dObject->GetScene()->GetSnapRect();
864cdf0e10cSrcweir
865cdf0e10cSrcweir ActionDescriptionProvider::ActionType eActionType(ActionDescriptionProvider::MOVE);
866cdf0e10cSrcweir if( !bIsMoveOnly && m_aSelection.isResizeableObjectSelected() )
867cdf0e10cSrcweir eActionType = ActionDescriptionProvider::RESIZE;
868cdf0e10cSrcweir
869cdf0e10cSrcweir ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
870cdf0e10cSrcweir
871cdf0e10cSrcweir UndoGuard aUndoGuard(
872cdf0e10cSrcweir ActionDescriptionProvider::createDescription( eActionType, ObjectNameProvider::getName( eObjectType)),
873cdf0e10cSrcweir m_xUndoManager );
874cdf0e10cSrcweir
875cdf0e10cSrcweir bool bChanged = false;
876cdf0e10cSrcweir if ( eObjectType == OBJECTTYPE_LEGEND )
877cdf0e10cSrcweir bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( getModel(), false , true );
878cdf0e10cSrcweir
879cdf0e10cSrcweir bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID()
880cdf0e10cSrcweir , getModel()
881cdf0e10cSrcweir , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight())
882cdf0e10cSrcweir , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) );
883cdf0e10cSrcweir
884cdf0e10cSrcweir if( bMoved || bChanged )
885cdf0e10cSrcweir {
886cdf0e10cSrcweir bDraggingDone = true;
887cdf0e10cSrcweir aUndoGuard.commit();
888cdf0e10cSrcweir }
889cdf0e10cSrcweir }
890cdf0e10cSrcweir }
891cdf0e10cSrcweir catch( uno::Exception & ex )
892cdf0e10cSrcweir {
893cdf0e10cSrcweir ASSERT_EXCEPTION( ex );
894cdf0e10cSrcweir }
895cdf0e10cSrcweir //all wanted model changes will take effect
896cdf0e10cSrcweir //and all unwanted view modifications are cleaned
897cdf0e10cSrcweir }
898cdf0e10cSrcweir
899cdf0e10cSrcweir if( !bDraggingDone ) //mouse wasn't moved while dragging
900cdf0e10cSrcweir {
901cdf0e10cSrcweir bool bClickedTwiceOnDragableObject = SelectionHelper::isDragableObjectHitTwice( aMPos, m_aSelection.getSelectedCID(), *pDrawViewWrapper );
902cdf0e10cSrcweir bool bIsRotateable = m_aSelection.isRotateableObjectSelected( getModel() );
903cdf0e10cSrcweir
904cdf0e10cSrcweir //toggel between move and rotate
905cdf0e10cSrcweir if( bIsRotateable && bClickedTwiceOnDragableObject && SDRDRAG_MOVE==m_eDragMode )
906cdf0e10cSrcweir m_eDragMode=SDRDRAG_ROTATE;
907cdf0e10cSrcweir else
908cdf0e10cSrcweir m_eDragMode=SDRDRAG_MOVE;
909cdf0e10cSrcweir
910cdf0e10cSrcweir pDrawViewWrapper->SetDragMode(m_eDragMode);
911cdf0e10cSrcweir
912cdf0e10cSrcweir if( !m_bWaitingForDoubleClick && m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured() )
913cdf0e10cSrcweir {
914cdf0e10cSrcweir this->impl_selectObjectAndNotiy();
915cdf0e10cSrcweir }
916cdf0e10cSrcweir }
917cdf0e10cSrcweir else
918cdf0e10cSrcweir m_aSelection.resetPossibleSelectionAfterSingleClickWasEnsured();
919cdf0e10cSrcweir }
920cdf0e10cSrcweir else if( isDoubleClick(rMEvt) && !bMouseUpWithoutMouseDown /*#i106966#*/ )
921cdf0e10cSrcweir {
922cdf0e10cSrcweir Point aMousePixel = rMEvt.GetPosPixel();
923cdf0e10cSrcweir execute_DoubleClick( &aMousePixel );
924cdf0e10cSrcweir }
925cdf0e10cSrcweir
926cdf0e10cSrcweir //@todo ForcePointer(&rMEvt);
927cdf0e10cSrcweir m_pChartWindow->ReleaseMouse();
928cdf0e10cSrcweir
929cdf0e10cSrcweir if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
930cdf0e10cSrcweir bNotifySelectionChange = true;
931cdf0e10cSrcweir }
932cdf0e10cSrcweir
933cdf0e10cSrcweir impl_SetMousePointer( rMEvt );
934cdf0e10cSrcweir
935cdf0e10cSrcweir if(bNotifySelectionChange)
936cdf0e10cSrcweir impl_notifySelectionChangeListeners();
937cdf0e10cSrcweir }
938cdf0e10cSrcweir
execute_DoubleClick(const Point * pMousePixel)939cdf0e10cSrcweir void ChartController::execute_DoubleClick( const Point* pMousePixel )
940cdf0e10cSrcweir {
941cdf0e10cSrcweir bool bEditText = false;
942cdf0e10cSrcweir if ( m_aSelection.hasSelection() )
943cdf0e10cSrcweir {
944cdf0e10cSrcweir ::rtl::OUString aCID( m_aSelection.getSelectedCID() );
945*9ec58d04SHerbert Dürr if ( !aCID.isEmpty() )
946cdf0e10cSrcweir {
947cdf0e10cSrcweir ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID );
948cdf0e10cSrcweir if ( OBJECTTYPE_TITLE == eObjectType )
949cdf0e10cSrcweir {
950cdf0e10cSrcweir bEditText = true;
951cdf0e10cSrcweir }
952cdf0e10cSrcweir }
953cdf0e10cSrcweir else
954cdf0e10cSrcweir {
955cdf0e10cSrcweir // #i12587# support for shapes in chart
956cdf0e10cSrcweir SdrObject* pObj = DrawViewWrapper::getSdrObject( m_aSelection.getSelectedAdditionalShape() );
957cdf0e10cSrcweir if ( pObj && pObj->ISA( SdrTextObj ) )
958cdf0e10cSrcweir {
959cdf0e10cSrcweir bEditText = true;
960cdf0e10cSrcweir }
961cdf0e10cSrcweir }
962cdf0e10cSrcweir }
963cdf0e10cSrcweir
964cdf0e10cSrcweir if ( bEditText )
965cdf0e10cSrcweir {
966cdf0e10cSrcweir executeDispatch_EditText( pMousePixel );
967cdf0e10cSrcweir }
968cdf0e10cSrcweir else
969cdf0e10cSrcweir {
970cdf0e10cSrcweir executeDispatch_ObjectProperties();
971cdf0e10cSrcweir }
972cdf0e10cSrcweir }
973cdf0e10cSrcweir
execute_Resize()974cdf0e10cSrcweir void ChartController::execute_Resize()
975cdf0e10cSrcweir {
976cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
977cdf0e10cSrcweir if(m_pChartWindow)
978cdf0e10cSrcweir m_pChartWindow->Invalidate();
979cdf0e10cSrcweir }
execute_Activate()980cdf0e10cSrcweir void ChartController::execute_Activate()
981cdf0e10cSrcweir {
982cdf0e10cSrcweir ///// pDrawViewWrapper->SetEditMode(sal_True);
983cdf0e10cSrcweir }
execute_Deactivate()984cdf0e10cSrcweir void ChartController::execute_Deactivate()
985cdf0e10cSrcweir {
986cdf0e10cSrcweir /*
987cdf0e10cSrcweir pDrawViewWrapper->SetEditMode(sal_False);
988cdf0e10cSrcweir this->ReleaseMouse();
989cdf0e10cSrcweir */
990cdf0e10cSrcweir }
execute_GetFocus()991cdf0e10cSrcweir void ChartController::execute_GetFocus()
992cdf0e10cSrcweir {
993cdf0e10cSrcweir }
execute_LoseFocus()994cdf0e10cSrcweir void ChartController::execute_LoseFocus()
995cdf0e10cSrcweir {
996cdf0e10cSrcweir //this->ReleaseMouse();
997cdf0e10cSrcweir }
998cdf0e10cSrcweir
execute_Command(const CommandEvent & rCEvt)999cdf0e10cSrcweir void ChartController::execute_Command( const CommandEvent& rCEvt )
1000cdf0e10cSrcweir {
1001cdf0e10cSrcweir bool bIsAction = false;
1002cdf0e10cSrcweir {
1003cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex());
1004cdf0e10cSrcweir DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
1005cdf0e10cSrcweir if(!m_pChartWindow || !pDrawViewWrapper)
1006cdf0e10cSrcweir return;
1007cdf0e10cSrcweir bIsAction = m_pDrawViewWrapper->IsAction();
1008cdf0e10cSrcweir }
1009cdf0e10cSrcweir
1010cdf0e10cSrcweir // pop-up menu
1011cdf0e10cSrcweir if(rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bIsAction)
1012cdf0e10cSrcweir {
1013cdf0e10cSrcweir {
1014cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1015cdf0e10cSrcweir if(m_pChartWindow)
1016cdf0e10cSrcweir m_pChartWindow->ReleaseMouse();
1017cdf0e10cSrcweir }
1018cdf0e10cSrcweir
1019cdf0e10cSrcweir if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
1020cdf0e10cSrcweir impl_notifySelectionChangeListeners();
1021cdf0e10cSrcweir
1022cdf0e10cSrcweir if ( isShapeContext() )
1023cdf0e10cSrcweir {
1024cdf0e10cSrcweir // #i12587# support for shapes in chart
1025cdf0e10cSrcweir PopupMenu aContextMenu( SchResId( m_pDrawViewWrapper->IsTextEdit() ?
1026cdf0e10cSrcweir RID_CONTEXTMENU_SHAPEEDIT : RID_CONTEXTMENU_SHAPE ) );
1027cdf0e10cSrcweir ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
1028cdf0e10cSrcweir Point aPos( rCEvt.GetMousePosPixel() );
1029cdf0e10cSrcweir if( !rCEvt.IsMouseEvent() )
1030cdf0e10cSrcweir {
1031cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1032cdf0e10cSrcweir if(m_pChartWindow)
1033cdf0e10cSrcweir aPos = m_pChartWindow->GetPointerState().maPos;
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir aContextMenuHelper.completeAndExecute( aPos, aContextMenu );
1036cdf0e10cSrcweir }
1037cdf0e10cSrcweir else
1038cdf0e10cSrcweir {
1039cdf0e10cSrcweir // todo: the context menu should be specified by an xml file in uiconfig
1040cdf0e10cSrcweir uno::Reference< awt::XPopupMenu > xPopupMenu(
1041cdf0e10cSrcweir m_xCC->getServiceManager()->createInstanceWithContext(
1042cdf0e10cSrcweir C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
1043d026be40SAriel Constenla-Haile if( xPopupMenu.is())
1044cdf0e10cSrcweir {
1045cdf0e10cSrcweir sal_Int16 nUniqueId = 1;
1046cdf0e10cSrcweir ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
1047cdf0e10cSrcweir Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( getModel() );
1048cdf0e10cSrcweir
1049cdf0e10cSrcweir OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) );
1050d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, aFormatCommand );
1051cdf0e10cSrcweir
1052cdf0e10cSrcweir //some commands for dataseries and points:
1053cdf0e10cSrcweir //-----
1054cdf0e10cSrcweir if( OBJECTTYPE_DATA_SERIES == eObjectType || OBJECTTYPE_DATA_POINT == eObjectType )
1055cdf0e10cSrcweir {
1056cdf0e10cSrcweir bool bIsPoint = ( OBJECTTYPE_DATA_POINT == eObjectType );
1057cdf0e10cSrcweir uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() );
1058cdf0e10cSrcweir uno::Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
1059cdf0e10cSrcweir Reference< chart2::XRegressionCurve > xTrendline( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ) );
1060cdf0e10cSrcweir bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline );
1061cdf0e10cSrcweir Reference< chart2::XRegressionCurve > xMeanValue( RegressionCurveHelper::getMeanValueLine( xCurveCnt ) );
1062cdf0e10cSrcweir bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries, true );
1063cdf0e10cSrcweir bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries );
1064cdf0e10cSrcweir bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries );
1065cdf0e10cSrcweir bool bHasDataLabelAtPoint = false;
1066cdf0e10cSrcweir sal_Int32 nPointIndex = -1;
1067cdf0e10cSrcweir if( bIsPoint )
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
1070cdf0e10cSrcweir bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex );
1071cdf0e10cSrcweir }
1072cdf0e10cSrcweir bool bSelectedPointIsFormatted = false;
1073cdf0e10cSrcweir bool bHasFormattedDataPointsOtherThanSelected = false;
1074cdf0e10cSrcweir
1075cdf0e10cSrcweir Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
1076cdf0e10cSrcweir if( xSeriesProperties.is() )
1077cdf0e10cSrcweir {
1078cdf0e10cSrcweir uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
1079cdf0e10cSrcweir if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
1080cdf0e10cSrcweir {
1081cdf0e10cSrcweir if( aAttributedDataPointIndexList.hasElements() )
1082cdf0e10cSrcweir {
1083cdf0e10cSrcweir if( bIsPoint )
1084cdf0e10cSrcweir {
1085cdf0e10cSrcweir ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) );
1086cdf0e10cSrcweir ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex );
1087cdf0e10cSrcweir if( aIt != aIndices.end())
1088cdf0e10cSrcweir bSelectedPointIsFormatted = true;
1089cdf0e10cSrcweir else
1090cdf0e10cSrcweir bHasFormattedDataPointsOtherThanSelected = true;
1091cdf0e10cSrcweir }
1092cdf0e10cSrcweir else
1093cdf0e10cSrcweir bHasFormattedDataPointsOtherThanSelected = true;
1094cdf0e10cSrcweir }
1095cdf0e10cSrcweir }
1096cdf0e10cSrcweir }
1097cdf0e10cSrcweir
1098cdf0e10cSrcweir //const sal_Int32 nIdBeforeFormat = nUniqueId;
1099cdf0e10cSrcweir if( bIsPoint )
1100cdf0e10cSrcweir {
1101cdf0e10cSrcweir if( bHasDataLabelAtPoint )
1102d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatDataLabel") );
1103cdf0e10cSrcweir if( !bHasDataLabelAtPoint )
1104d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertDataLabel") );
1105cdf0e10cSrcweir else
1106d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteDataLabel") );
1107cdf0e10cSrcweir if( bSelectedPointIsFormatted )
1108d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:ResetDataPoint"));
1109cdf0e10cSrcweir
1110cdf0e10cSrcweir xPopupMenu->insertSeparator( -1 );
1111cdf0e10cSrcweir
1112d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatDataSeries") );
1113cdf0e10cSrcweir }
1114cdf0e10cSrcweir
1115cdf0e10cSrcweir Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
1116cdf0e10cSrcweir if( xChartType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
1117cdf0e10cSrcweir {
1118cdf0e10cSrcweir try
1119cdf0e10cSrcweir {
1120cdf0e10cSrcweir Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
1121cdf0e10cSrcweir if( xChartTypeProp.is() )
1122cdf0e10cSrcweir {
1123cdf0e10cSrcweir bool bJapaneseStyle = false;
1124cdf0e10cSrcweir xChartTypeProp->getPropertyValue( C2U( "Japanese" ) ) >>= bJapaneseStyle;
1125cdf0e10cSrcweir
1126cdf0e10cSrcweir if( bJapaneseStyle )
1127cdf0e10cSrcweir {
1128d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatStockLoss") );
1129d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatStockGain") );
1130cdf0e10cSrcweir }
1131cdf0e10cSrcweir }
1132cdf0e10cSrcweir }
1133cdf0e10cSrcweir catch( const uno::Exception & ex )
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir ASSERT_EXCEPTION( ex );
1136cdf0e10cSrcweir }
1137cdf0e10cSrcweir }
1138cdf0e10cSrcweir
1139cdf0e10cSrcweir if( bHasDataLabelsAtSeries )
1140d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatDataLabels") );
1141cdf0e10cSrcweir if( xTrendline.is() )
1142d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatTrendline") );
1143cdf0e10cSrcweir if( bHasEquation )
1144d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatTrendlineEquation") );
1145cdf0e10cSrcweir if( xMeanValue.is() )
1146d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatMeanValue") );
1147cdf0e10cSrcweir if( bHasYErrorBars )
1148d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatYErrorBars") );
1149cdf0e10cSrcweir
1150cdf0e10cSrcweir //if( nIdBeforeFormat != nUniqueId )
1151cdf0e10cSrcweir xPopupMenu->insertSeparator( -1 );
1152cdf0e10cSrcweir
1153cdf0e10cSrcweir //const sal_Int32 nIdBeforeInsert = nUniqueId;
1154cdf0e10cSrcweir
1155cdf0e10cSrcweir if( !bHasDataLabelsAtSeries )
1156d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertDataLabels") );
1157cdf0e10cSrcweir if( !xTrendline.is() )
1158d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertTrendline") );
1159cdf0e10cSrcweir else if( !bHasEquation )
1160d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertTrendlineEquation") );
1161cdf0e10cSrcweir if( !xMeanValue.is() )
1162d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertMeanValue") );
1163cdf0e10cSrcweir if( !bHasYErrorBars )
1164d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertYErrorBars") );
1165cdf0e10cSrcweir
1166cdf0e10cSrcweir //if( nIdBeforeInsert != nUniqueId )
1167cdf0e10cSrcweir // xPopupMenu->insertSeparator( -1 );
1168cdf0e10cSrcweir
1169cdf0e10cSrcweir //const sal_Int32 nIdBeforeDelete = nUniqueId;
1170cdf0e10cSrcweir
1171cdf0e10cSrcweir if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) )
1172d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteDataLabels") );
1173cdf0e10cSrcweir if( xTrendline.is() )
1174d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteTrendline") );
1175cdf0e10cSrcweir if( bHasEquation )
1176d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") );
1177cdf0e10cSrcweir if( xMeanValue.is() )
1178d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteMeanValue") );
1179cdf0e10cSrcweir if( bHasYErrorBars )
1180d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteYErrorBars") );
1181cdf0e10cSrcweir
1182cdf0e10cSrcweir if( bHasFormattedDataPointsOtherThanSelected )
1183d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:ResetAllDataPoints"));
1184cdf0e10cSrcweir
1185cdf0e10cSrcweir //if( nIdBeforeDelete != nUniqueId )
1186cdf0e10cSrcweir xPopupMenu->insertSeparator( -1 );
1187cdf0e10cSrcweir
1188d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId, C2U(".uno:ArrangeRow"));
1189cdf0e10cSrcweir uno::Reference< awt::XPopupMenu > xArrangePopupMenu(
1190cdf0e10cSrcweir m_xCC->getServiceManager()->createInstanceWithContext(
1191cdf0e10cSrcweir C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
1192d026be40SAriel Constenla-Haile if( xArrangePopupMenu.is() )
1193cdf0e10cSrcweir {
1194cdf0e10cSrcweir sal_Int16 nSubId = nUniqueId + 1;
1195d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xArrangePopupMenu, nSubId++, C2U(".uno:Forward") );
1196d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xArrangePopupMenu, nSubId, C2U(".uno:Backward") );
1197cdf0e10cSrcweir xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu );
1198cdf0e10cSrcweir nUniqueId = nSubId;
1199cdf0e10cSrcweir }
1200cdf0e10cSrcweir ++nUniqueId;
1201cdf0e10cSrcweir }
1202cdf0e10cSrcweir else if( OBJECTTYPE_DATA_CURVE == eObjectType )
1203cdf0e10cSrcweir {
1204d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatTrendlineEquation") );
1205d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertTrendlineEquation") );
1206d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertTrendlineEquationAndR2") );
1207d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertR2Value") );
1208d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") );
1209d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteR2Value") );
1210cdf0e10cSrcweir }
1211cdf0e10cSrcweir else if( OBJECTTYPE_DATA_CURVE_EQUATION == eObjectType )
1212cdf0e10cSrcweir {
1213d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertR2Value") );
1214d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteR2Value") );
1215cdf0e10cSrcweir }
1216cdf0e10cSrcweir
1217cdf0e10cSrcweir //some commands for axes: and grids
1218cdf0e10cSrcweir //-----
1219cdf0e10cSrcweir else if( OBJECTTYPE_AXIS == eObjectType || OBJECTTYPE_GRID == eObjectType || OBJECTTYPE_SUBGRID == eObjectType )
1220cdf0e10cSrcweir {
1221cdf0e10cSrcweir Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
1222cdf0e10cSrcweir if( xAxis.is() && xDiagram.is() )
1223cdf0e10cSrcweir {
1224cdf0e10cSrcweir sal_Int32 nDimensionIndex = -1;
1225cdf0e10cSrcweir sal_Int32 nCooSysIndex = -1;
1226cdf0e10cSrcweir sal_Int32 nAxisIndex = -1;
1227cdf0e10cSrcweir AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex );
1228cdf0e10cSrcweir bool bIsSecondaryAxis = nAxisIndex!=0;
1229cdf0e10cSrcweir bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis );
1230cdf0e10cSrcweir bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram );
1231cdf0e10cSrcweir bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram );
1232cdf0e10cSrcweir bool bHasTitle = false;
1233cdf0e10cSrcweir uno::Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY );
1234cdf0e10cSrcweir if( xTitled.is())
1235*9ec58d04SHerbert Dürr bHasTitle = ( TitleHelper::getCompleteString( xTitled->getTitleObject() ).isEmpty() == false );
1236cdf0e10cSrcweir
1237cdf0e10cSrcweir if( OBJECTTYPE_AXIS != eObjectType && bIsAxisVisible )
1238d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatAxis") );
1239cdf0e10cSrcweir if( OBJECTTYPE_GRID != eObjectType && bIsMajorGridVisible && !bIsSecondaryAxis )
1240d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatMajorGrid") );
1241cdf0e10cSrcweir if( OBJECTTYPE_SUBGRID != eObjectType && bIsMinorGridVisible && !bIsSecondaryAxis )
1242d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatMinorGrid") );
1243cdf0e10cSrcweir
1244cdf0e10cSrcweir xPopupMenu->insertSeparator( -1 );
1245cdf0e10cSrcweir
1246cdf0e10cSrcweir if( OBJECTTYPE_AXIS != eObjectType && !bIsAxisVisible )
1247d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertAxis") );
1248cdf0e10cSrcweir if( OBJECTTYPE_GRID != eObjectType && !bIsMajorGridVisible && !bIsSecondaryAxis )
1249d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertMajorGrid") );
1250cdf0e10cSrcweir if( OBJECTTYPE_SUBGRID != eObjectType && !bIsMinorGridVisible && !bIsSecondaryAxis )
1251d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertMinorGrid") );
1252cdf0e10cSrcweir if( !bHasTitle )
1253d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertAxisTitle") );
1254cdf0e10cSrcweir
1255cdf0e10cSrcweir if( bIsAxisVisible )
1256d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteAxis") );
1257cdf0e10cSrcweir if( bIsMajorGridVisible && !bIsSecondaryAxis )
1258d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteMajorGrid") );
1259cdf0e10cSrcweir if( bIsMinorGridVisible && !bIsSecondaryAxis )
1260d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteMinorGrid") );
1261cdf0e10cSrcweir }
1262cdf0e10cSrcweir }
1263cdf0e10cSrcweir
1264cdf0e10cSrcweir if( OBJECTTYPE_DATA_STOCK_LOSS == eObjectType )
1265d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatStockGain") );
1266cdf0e10cSrcweir else if( OBJECTTYPE_DATA_STOCK_GAIN == eObjectType )
1267d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:FormatStockLoss") );
1268cdf0e10cSrcweir
1269d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:TransformDialog"));
1270cdf0e10cSrcweir
1271cdf0e10cSrcweir if( OBJECTTYPE_PAGE == eObjectType || OBJECTTYPE_DIAGRAM == eObjectType
1272cdf0e10cSrcweir || OBJECTTYPE_DIAGRAM_WALL == eObjectType
1273cdf0e10cSrcweir || OBJECTTYPE_DIAGRAM_FLOOR == eObjectType
1274cdf0e10cSrcweir || OBJECTTYPE_UNKNOWN == eObjectType )
1275cdf0e10cSrcweir {
1276cdf0e10cSrcweir if( OBJECTTYPE_UNKNOWN != eObjectType )
1277cdf0e10cSrcweir xPopupMenu->insertSeparator( -1 );
1278cdf0e10cSrcweir bool bHasLegend = LegendHelper::hasLegend( xDiagram );
1279d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertTitles") );
1280cdf0e10cSrcweir if( !bHasLegend )
1281d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertLegend") );
1282d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:InsertRemoveAxes") );
1283cdf0e10cSrcweir if( bHasLegend )
1284d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DeleteLegend") );
1285cdf0e10cSrcweir }
1286cdf0e10cSrcweir //-----
1287cdf0e10cSrcweir
1288cdf0e10cSrcweir xPopupMenu->insertSeparator( -1 );
1289d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DiagramType"));
1290d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DataRanges"));
1291d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:DiagramData"));
1292d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:View3D"));
1293cdf0e10cSrcweir xPopupMenu->insertSeparator( -1 );
1294d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:Cut"));
1295d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:Copy"));
1296d026be40SAriel Constenla-Haile lcl_insertMenuCommand( xPopupMenu, nUniqueId++, C2U(".uno:Paste"));
1297cdf0e10cSrcweir
1298cdf0e10cSrcweir ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
1299cdf0e10cSrcweir Point aPos( rCEvt.GetMousePosPixel() );
1300cdf0e10cSrcweir if( !rCEvt.IsMouseEvent() )
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1303cdf0e10cSrcweir if(m_pChartWindow)
1304cdf0e10cSrcweir aPos = m_pChartWindow->GetPointerState().maPos;
1305cdf0e10cSrcweir }
1306cdf0e10cSrcweir aContextMenuHelper.completeAndExecute( aPos, xPopupMenu );
1307cdf0e10cSrcweir }
1308cdf0e10cSrcweir }
1309cdf0e10cSrcweir }
1310cdf0e10cSrcweir else if( ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT ) ||
1311cdf0e10cSrcweir ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT ) ||
1312cdf0e10cSrcweir ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT ) ||
1313cdf0e10cSrcweir ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE ) )
1314cdf0e10cSrcweir {
1315cdf0e10cSrcweir //#i84417# enable editing with IME
1316cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1317cdf0e10cSrcweir if( m_pDrawViewWrapper )
1318cdf0e10cSrcweir m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow );
1319cdf0e10cSrcweir }
1320cdf0e10cSrcweir }
1321cdf0e10cSrcweir
execute_KeyInput(const KeyEvent & rKEvt)1322cdf0e10cSrcweir bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
1323cdf0e10cSrcweir {
1324cdf0e10cSrcweir bool bReturn=false;
1325cdf0e10cSrcweir
1326cdf0e10cSrcweir DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
1327cdf0e10cSrcweir if(!m_pChartWindow || !pDrawViewWrapper)
1328cdf0e10cSrcweir return bReturn;
1329cdf0e10cSrcweir
1330cdf0e10cSrcweir // handle accelerators
1331cdf0e10cSrcweir if( ! m_apAccelExecute.get() && m_xFrame.is() && m_xCC.is() && m_xCC->getServiceManager().is() )
1332cdf0e10cSrcweir {
1333cdf0e10cSrcweir m_apAccelExecute.reset( ::svt::AcceleratorExecute::createAcceleratorHelper());
1334cdf0e10cSrcweir OSL_ASSERT( m_apAccelExecute.get());
1335cdf0e10cSrcweir if( m_apAccelExecute.get() )
1336cdf0e10cSrcweir m_apAccelExecute->init(
1337cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory >( m_xCC->getServiceManager(), uno::UNO_QUERY ), m_xFrame );
1338cdf0e10cSrcweir }
1339cdf0e10cSrcweir
1340cdf0e10cSrcweir KeyCode aKeyCode( rKEvt.GetKeyCode());
1341cdf0e10cSrcweir sal_uInt16 nCode = aKeyCode.GetCode();
1342cdf0e10cSrcweir // bool bShift = aKeyCode.IsShift();
1343cdf0e10cSrcweir bool bAlternate = aKeyCode.IsMod2();
1344cdf0e10cSrcweir
1345cdf0e10cSrcweir if( m_apAccelExecute.get() )
1346cdf0e10cSrcweir bReturn = m_apAccelExecute->execute( aKeyCode );
1347cdf0e10cSrcweir if( bReturn )
1348cdf0e10cSrcweir return bReturn;
1349cdf0e10cSrcweir
1350cdf0e10cSrcweir {
1351cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1352cdf0e10cSrcweir if( pDrawViewWrapper->IsTextEdit() )
1353cdf0e10cSrcweir {
1354cdf0e10cSrcweir if( pDrawViewWrapper->KeyInput(rKEvt,m_pChartWindow) )
1355cdf0e10cSrcweir {
1356cdf0e10cSrcweir bReturn = true;
1357cdf0e10cSrcweir if( nCode == KEY_ESCAPE )
1358cdf0e10cSrcweir {
1359cdf0e10cSrcweir this->EndTextEdit();
1360cdf0e10cSrcweir }
1361cdf0e10cSrcweir }
1362cdf0e10cSrcweir }
1363cdf0e10cSrcweir }
1364cdf0e10cSrcweir
1365cdf0e10cSrcweir //if( m_pDrawViewWrapper->IsAction() );
1366cdf0e10cSrcweir
1367cdf0e10cSrcweir // keyboard accessibility
1368cdf0e10cSrcweir ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
1369cdf0e10cSrcweir if( ! bReturn )
1370cdf0e10cSrcweir {
1371cdf0e10cSrcweir // Natvigation (Tab/F3/Home/End)
1372cdf0e10cSrcweir uno::Reference< XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
1373cdf0e10cSrcweir ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, ExplicitValueProvider::getExplicitValueProvider( m_xChartView ));
1374cdf0e10cSrcweir awt::KeyEvent aKeyEvent( ::svt::AcceleratorExecute::st_VCLKey2AWTKey( aKeyCode ));
1375cdf0e10cSrcweir bReturn = aObjNav.handleKeyEvent( aKeyEvent );
1376cdf0e10cSrcweir if( bReturn )
1377cdf0e10cSrcweir {
1378cdf0e10cSrcweir ObjectIdentifier aNewOID = aObjNav.getCurrentSelection();
1379cdf0e10cSrcweir uno::Any aNewSelection;
1380cdf0e10cSrcweir if ( aNewOID.isValid() && !ObjectHierarchy::isRootNode( aNewOID ) )
1381cdf0e10cSrcweir {
1382cdf0e10cSrcweir aNewSelection = aNewOID.getAny();
1383cdf0e10cSrcweir }
1384cdf0e10cSrcweir if ( m_eDragMode == SDRDRAG_ROTATE && !SelectionHelper::isRotateableObject( aNewOID.getObjectCID(), getModel() ) )
1385cdf0e10cSrcweir {
1386cdf0e10cSrcweir m_eDragMode = SDRDRAG_MOVE;
1387cdf0e10cSrcweir }
1388cdf0e10cSrcweir bReturn = select( aNewSelection );
1389cdf0e10cSrcweir }
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir
1392cdf0e10cSrcweir // Position and Size (+/-/arrow-keys) or pie segment dragging
1393cdf0e10cSrcweir if( ! bReturn )
1394cdf0e10cSrcweir {
1395cdf0e10cSrcweir // pie segment dragging
1396cdf0e10cSrcweir // note: could also be done for data series
1397cdf0e10cSrcweir if( eObjectType == OBJECTTYPE_DATA_POINT &&
1398cdf0e10cSrcweir ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ).equals(
1399cdf0e10cSrcweir ObjectIdentifier::getPieSegmentDragMethodServiceName()))
1400cdf0e10cSrcweir {
1401cdf0e10cSrcweir bool bDrag = false;
1402cdf0e10cSrcweir bool bDragInside = false;
1403cdf0e10cSrcweir if( nCode == KEY_ADD ||
1404cdf0e10cSrcweir nCode == KEY_SUBTRACT )
1405cdf0e10cSrcweir {
1406cdf0e10cSrcweir bDrag = true;
1407cdf0e10cSrcweir bDragInside = ( nCode == KEY_SUBTRACT );
1408cdf0e10cSrcweir }
1409cdf0e10cSrcweir else if(
1410cdf0e10cSrcweir nCode == KEY_LEFT ||
1411cdf0e10cSrcweir nCode == KEY_RIGHT ||
1412cdf0e10cSrcweir nCode == KEY_UP ||
1413cdf0e10cSrcweir nCode == KEY_DOWN )
1414cdf0e10cSrcweir {
1415cdf0e10cSrcweir bDrag = true;
1416cdf0e10cSrcweir rtl::OUString aParameter( ObjectIdentifier::getDragParameterString( m_aSelection.getSelectedCID() ));
1417cdf0e10cSrcweir sal_Int32 nOffsetPercentDummy( 0 );
1418cdf0e10cSrcweir awt::Point aMinimumPosition( 0, 0 );
1419cdf0e10cSrcweir awt::Point aMaximumPosition( 0, 0 );
1420cdf0e10cSrcweir ObjectIdentifier::parsePieSegmentDragParameterString(
1421cdf0e10cSrcweir aParameter, nOffsetPercentDummy, aMinimumPosition, aMaximumPosition );
1422cdf0e10cSrcweir aMaximumPosition.Y -= aMinimumPosition.Y;
1423cdf0e10cSrcweir aMaximumPosition.X -= aMinimumPosition.X;
1424cdf0e10cSrcweir
1425cdf0e10cSrcweir bDragInside =
1426cdf0e10cSrcweir (nCode == KEY_RIGHT && (aMaximumPosition.X < 0)) ||
1427cdf0e10cSrcweir (nCode == KEY_LEFT && (aMaximumPosition.X > 0)) ||
1428cdf0e10cSrcweir (nCode == KEY_DOWN && (aMaximumPosition.Y < 0)) ||
1429cdf0e10cSrcweir (nCode == KEY_UP && (aMaximumPosition.Y > 0));
1430cdf0e10cSrcweir }
1431cdf0e10cSrcweir
1432cdf0e10cSrcweir if( bDrag )
1433cdf0e10cSrcweir {
1434cdf0e10cSrcweir double fAmount = bAlternate ? 0.01 : 0.05;
1435cdf0e10cSrcweir if( bDragInside )
1436cdf0e10cSrcweir fAmount *= -1.0;
1437cdf0e10cSrcweir
1438cdf0e10cSrcweir bReturn = impl_DragDataPoint( m_aSelection.getSelectedCID(), fAmount );
1439cdf0e10cSrcweir }
1440cdf0e10cSrcweir }
1441cdf0e10cSrcweir else
1442cdf0e10cSrcweir {
1443cdf0e10cSrcweir // size
1444cdf0e10cSrcweir if( nCode == KEY_ADD ||
1445cdf0e10cSrcweir nCode == KEY_SUBTRACT )
1446cdf0e10cSrcweir {
1447cdf0e10cSrcweir if( eObjectType == OBJECTTYPE_DIAGRAM )
1448cdf0e10cSrcweir {
1449cdf0e10cSrcweir // default 1 mm in each direction
1450cdf0e10cSrcweir double fGrowAmountX = 200.0;
1451cdf0e10cSrcweir double fGrowAmountY = 200.0;
1452cdf0e10cSrcweir if( bAlternate && m_pChartWindow )
1453cdf0e10cSrcweir {
1454cdf0e10cSrcweir // together with Alt-key: 1 px in each direction
1455cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1456cdf0e10cSrcweir if( m_pChartWindow )
1457cdf0e10cSrcweir {
1458cdf0e10cSrcweir Size aPixelSize = m_pChartWindow->PixelToLogic( Size( 2, 2 ));
1459cdf0e10cSrcweir fGrowAmountX = static_cast< double >( aPixelSize.Width());
1460cdf0e10cSrcweir fGrowAmountY = static_cast< double >( aPixelSize.Height());
1461cdf0e10cSrcweir }
1462cdf0e10cSrcweir }
1463cdf0e10cSrcweir if( nCode == KEY_SUBTRACT )
1464cdf0e10cSrcweir {
1465cdf0e10cSrcweir fGrowAmountX = -fGrowAmountX;
1466cdf0e10cSrcweir fGrowAmountY = -fGrowAmountY;
1467cdf0e10cSrcweir }
1468cdf0e10cSrcweir bReturn = impl_moveOrResizeObject(
1469cdf0e10cSrcweir m_aSelection.getSelectedCID(), CENTERED_RESIZE_OBJECT, fGrowAmountX, fGrowAmountY );
1470cdf0e10cSrcweir }
1471cdf0e10cSrcweir }
1472cdf0e10cSrcweir // position
1473cdf0e10cSrcweir else if( nCode == KEY_LEFT ||
1474cdf0e10cSrcweir nCode == KEY_RIGHT ||
1475cdf0e10cSrcweir nCode == KEY_UP ||
1476cdf0e10cSrcweir nCode == KEY_DOWN )
1477cdf0e10cSrcweir {
1478cdf0e10cSrcweir if( m_aSelection.isDragableObjectSelected() )
1479cdf0e10cSrcweir {
1480cdf0e10cSrcweir // default 1 mm
1481cdf0e10cSrcweir double fShiftAmountX = 100.0;
1482cdf0e10cSrcweir double fShiftAmountY = 100.0;
1483cdf0e10cSrcweir if( bAlternate && m_pChartWindow )
1484cdf0e10cSrcweir {
1485cdf0e10cSrcweir // together with Alt-key: 1 px
1486cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1487cdf0e10cSrcweir if(m_pChartWindow)
1488cdf0e10cSrcweir {
1489cdf0e10cSrcweir Size aPixelSize = m_pChartWindow->PixelToLogic( Size( 1, 1 ));
1490cdf0e10cSrcweir fShiftAmountX = static_cast< double >( aPixelSize.Width());
1491cdf0e10cSrcweir fShiftAmountY = static_cast< double >( aPixelSize.Height());
1492cdf0e10cSrcweir }
1493cdf0e10cSrcweir }
1494cdf0e10cSrcweir switch( nCode )
1495cdf0e10cSrcweir {
1496cdf0e10cSrcweir case KEY_LEFT:
1497cdf0e10cSrcweir fShiftAmountX = -fShiftAmountX;
1498cdf0e10cSrcweir fShiftAmountY = 0.0;
1499cdf0e10cSrcweir break;
1500cdf0e10cSrcweir case KEY_RIGHT:
1501cdf0e10cSrcweir fShiftAmountY = 0.0;
1502cdf0e10cSrcweir break;
1503cdf0e10cSrcweir case KEY_UP:
1504cdf0e10cSrcweir fShiftAmountX = 0.0;
1505cdf0e10cSrcweir fShiftAmountY = -fShiftAmountY;
1506cdf0e10cSrcweir break;
1507cdf0e10cSrcweir case KEY_DOWN:
1508cdf0e10cSrcweir fShiftAmountX = 0.0;
1509cdf0e10cSrcweir break;
1510cdf0e10cSrcweir }
1511*9ec58d04SHerbert Dürr if( !m_aSelection.getSelectedCID().isEmpty() )
1512cdf0e10cSrcweir {
1513cdf0e10cSrcweir //move chart objects
1514cdf0e10cSrcweir bReturn = impl_moveOrResizeObject(
1515cdf0e10cSrcweir m_aSelection.getSelectedCID(), MOVE_OBJECT, fShiftAmountX, fShiftAmountY );
1516cdf0e10cSrcweir }
1517cdf0e10cSrcweir else
1518cdf0e10cSrcweir {
1519cdf0e10cSrcweir //move additional shapes
1520cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape( m_aSelection.getSelectedAdditionalShape() );
1521cdf0e10cSrcweir if( xShape.is() )
1522cdf0e10cSrcweir {
1523cdf0e10cSrcweir awt::Point aPos( xShape->getPosition() );
1524cdf0e10cSrcweir awt::Size aSize( xShape->getSize() );
1525cdf0e10cSrcweir awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
1526cdf0e10cSrcweir aPos.X = static_cast< long >( static_cast< double >( aPos.X ) + fShiftAmountX );
1527cdf0e10cSrcweir aPos.Y = static_cast< long >( static_cast< double >( aPos.Y ) + fShiftAmountY );
1528cdf0e10cSrcweir if( aPos.X + aSize.Width > aPageSize.Width )
1529cdf0e10cSrcweir aPos.X = aPageSize.Width - aSize.Width;
1530cdf0e10cSrcweir if( aPos.X < 0 )
1531cdf0e10cSrcweir aPos.X = 0;
1532cdf0e10cSrcweir if( aPos.Y + aSize.Height > aPageSize.Height )
1533cdf0e10cSrcweir aPos.Y = aPageSize.Height - aSize.Height;
1534cdf0e10cSrcweir if( aPos.Y < 0 )
1535cdf0e10cSrcweir aPos.Y = 0;
1536cdf0e10cSrcweir
1537cdf0e10cSrcweir xShape->setPosition( aPos );
1538cdf0e10cSrcweir }
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir }
1541cdf0e10cSrcweir }
1542cdf0e10cSrcweir }
1543cdf0e10cSrcweir }
1544cdf0e10cSrcweir
1545cdf0e10cSrcweir // text edit
1546cdf0e10cSrcweir if( ! bReturn &&
1547cdf0e10cSrcweir nCode == KEY_F2 )
1548cdf0e10cSrcweir {
1549cdf0e10cSrcweir if( OBJECTTYPE_TITLE == eObjectType )
1550cdf0e10cSrcweir {
1551cdf0e10cSrcweir executeDispatch_EditText();
1552cdf0e10cSrcweir bReturn = true;
1553cdf0e10cSrcweir }
1554cdf0e10cSrcweir }
1555cdf0e10cSrcweir
1556cdf0e10cSrcweir // deactivate inplace mode (this code should be unnecessary, but
1557cdf0e10cSrcweir // unfortunately is not)
1558cdf0e10cSrcweir if( ! bReturn &&
1559cdf0e10cSrcweir nCode == KEY_ESCAPE )
1560cdf0e10cSrcweir {
1561cdf0e10cSrcweir uno::Reference< frame::XDispatchHelper > xDispatchHelper(
1562cdf0e10cSrcweir m_xCC->getServiceManager()->createInstanceWithContext(
1563cdf0e10cSrcweir C2U("com.sun.star.frame.DispatchHelper"), m_xCC ), uno::UNO_QUERY );
1564cdf0e10cSrcweir if( xDispatchHelper.is())
1565cdf0e10cSrcweir {
1566cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aArgs;
1567cdf0e10cSrcweir xDispatchHelper->executeDispatch(
1568cdf0e10cSrcweir uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ),
1569cdf0e10cSrcweir C2U(".uno:TerminateInplaceActivation"),
1570cdf0e10cSrcweir C2U("_parent"),
1571cdf0e10cSrcweir frame::FrameSearchFlag::PARENT,
1572cdf0e10cSrcweir aArgs );
1573cdf0e10cSrcweir bReturn = true;
1574cdf0e10cSrcweir }
1575cdf0e10cSrcweir }
1576cdf0e10cSrcweir
1577cdf0e10cSrcweir if( ! bReturn &&
1578cdf0e10cSrcweir (nCode == KEY_DELETE || nCode == KEY_BACKSPACE ))
1579cdf0e10cSrcweir {
1580cdf0e10cSrcweir bReturn = executeDispatch_Delete();
1581cdf0e10cSrcweir if( ! bReturn )
1582cdf0e10cSrcweir {
1583cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1584cdf0e10cSrcweir InfoBox( m_pChartWindow, String(SchResId( STR_ACTION_NOTPOSSIBLE ))).Execute();
1585cdf0e10cSrcweir }
1586cdf0e10cSrcweir }
1587cdf0e10cSrcweir
1588cdf0e10cSrcweir /* old chart:
1589cdf0e10cSrcweir // Ctrl-Shift-R: Repaint
1590cdf0e10cSrcweir if (!bReturn && GetWindow())
1591cdf0e10cSrcweir {
1592cdf0e10cSrcweir KeyCode aKeyCode = rKEvt.GetKeyCode();
1593cdf0e10cSrcweir
1594cdf0e10cSrcweir if (aKeyCode.IsMod1() && aKeyCode.IsShift()
1595cdf0e10cSrcweir && aKeyCode.GetCode() == KEY_R)
1596cdf0e10cSrcweir {
1597cdf0e10cSrcweir // 3D-Kontext wieder zerstoeren
1598cdf0e10cSrcweir GetWindow()->Invalidate();
1599cdf0e10cSrcweir bReturn = sal_True;
1600cdf0e10cSrcweir }
1601cdf0e10cSrcweir }
1602cdf0e10cSrcweir */
1603cdf0e10cSrcweir return bReturn;
1604cdf0e10cSrcweir }
1605cdf0e10cSrcweir
requestQuickHelp(::Point aAtLogicPosition,bool bIsBalloonHelp,::rtl::OUString & rOutQuickHelpText,awt::Rectangle & rOutEqualRect)1606cdf0e10cSrcweir bool ChartController::requestQuickHelp(
1607cdf0e10cSrcweir ::Point aAtLogicPosition,
1608cdf0e10cSrcweir bool bIsBalloonHelp,
1609cdf0e10cSrcweir ::rtl::OUString & rOutQuickHelpText,
1610cdf0e10cSrcweir awt::Rectangle & rOutEqualRect )
1611cdf0e10cSrcweir {
1612cdf0e10cSrcweir uno::Reference< frame::XModel > xChartModel;
1613cdf0e10cSrcweir if( m_aModel.is())
1614cdf0e10cSrcweir xChartModel.set( getModel() );
1615cdf0e10cSrcweir if( !xChartModel.is())
1616cdf0e10cSrcweir return false;
1617cdf0e10cSrcweir
1618cdf0e10cSrcweir // help text
1619cdf0e10cSrcweir ::rtl::OUString aCID;
1620cdf0e10cSrcweir if( m_pDrawViewWrapper )
1621cdf0e10cSrcweir {
1622cdf0e10cSrcweir aCID = SelectionHelper::getHitObjectCID(
1623cdf0e10cSrcweir aAtLogicPosition, *m_pDrawViewWrapper );
1624cdf0e10cSrcweir }
1625*9ec58d04SHerbert Dürr bool bResult( !aCID.isEmpty() );
1626cdf0e10cSrcweir
1627cdf0e10cSrcweir if( bResult )
1628cdf0e10cSrcweir {
1629cdf0e10cSrcweir // get help text
1630cdf0e10cSrcweir rOutQuickHelpText = ObjectNameProvider::getHelpText( aCID, xChartModel, bIsBalloonHelp /* bVerbose */ );
1631cdf0e10cSrcweir
1632cdf0e10cSrcweir // set rectangle
1633cdf0e10cSrcweir ExplicitValueProvider * pValueProvider(
1634cdf0e10cSrcweir ExplicitValueProvider::getExplicitValueProvider( m_xChartView ));
1635cdf0e10cSrcweir if( pValueProvider )
1636cdf0e10cSrcweir rOutEqualRect = pValueProvider->getRectangleOfObject( aCID, true );
1637cdf0e10cSrcweir }
1638cdf0e10cSrcweir
1639cdf0e10cSrcweir return bResult;
1640cdf0e10cSrcweir }
1641cdf0e10cSrcweir
1642cdf0e10cSrcweir //-----------------------------------------------------------------
1643cdf0e10cSrcweir // XSelectionSupplier (optional interface)
1644cdf0e10cSrcweir //-----------------------------------------------------------------
1645cdf0e10cSrcweir sal_Bool SAL_CALL ChartController
select(const uno::Any & rSelection)1646cdf0e10cSrcweir ::select( const uno::Any& rSelection )
1647cdf0e10cSrcweir throw( lang::IllegalArgumentException )
1648cdf0e10cSrcweir {
1649cdf0e10cSrcweir bool bSuccess = false;
1650cdf0e10cSrcweir
1651cdf0e10cSrcweir if ( rSelection.hasValue() )
1652cdf0e10cSrcweir {
1653cdf0e10cSrcweir const uno::Type& rType = rSelection.getValueType();
1654cdf0e10cSrcweir if ( rType == ::getCppuType( static_cast< const ::rtl::OUString* >( 0 ) ) )
1655cdf0e10cSrcweir {
1656cdf0e10cSrcweir ::rtl::OUString aNewCID;
1657cdf0e10cSrcweir if ( ( rSelection >>= aNewCID ) && m_aSelection.setSelection( aNewCID ) )
1658cdf0e10cSrcweir {
1659cdf0e10cSrcweir bSuccess = true;
1660cdf0e10cSrcweir }
1661cdf0e10cSrcweir }
1662cdf0e10cSrcweir else if ( rType == ::getCppuType( static_cast< const uno::Reference< drawing::XShape >* >( 0 ) ) )
1663cdf0e10cSrcweir {
1664cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape;
1665cdf0e10cSrcweir if ( ( rSelection >>= xShape ) && m_aSelection.setSelection( xShape ) )
1666cdf0e10cSrcweir {
1667cdf0e10cSrcweir bSuccess = true;
1668cdf0e10cSrcweir }
1669cdf0e10cSrcweir }
1670cdf0e10cSrcweir }
1671cdf0e10cSrcweir else
1672cdf0e10cSrcweir {
1673cdf0e10cSrcweir if ( m_aSelection.hasSelection() )
1674cdf0e10cSrcweir {
1675cdf0e10cSrcweir m_aSelection.clearSelection();
1676cdf0e10cSrcweir bSuccess = true;
1677cdf0e10cSrcweir }
1678cdf0e10cSrcweir }
1679cdf0e10cSrcweir
1680cdf0e10cSrcweir if ( bSuccess )
1681cdf0e10cSrcweir {
1682cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1683cdf0e10cSrcweir if ( m_pDrawViewWrapper && m_pDrawViewWrapper->IsTextEdit() )
1684cdf0e10cSrcweir {
1685cdf0e10cSrcweir this->EndTextEdit();
1686cdf0e10cSrcweir }
1687cdf0e10cSrcweir this->impl_selectObjectAndNotiy();
1688cdf0e10cSrcweir if ( m_pChartWindow )
1689cdf0e10cSrcweir {
1690cdf0e10cSrcweir m_pChartWindow->Invalidate();
1691cdf0e10cSrcweir }
1692cdf0e10cSrcweir return sal_True;
1693cdf0e10cSrcweir }
1694cdf0e10cSrcweir
1695cdf0e10cSrcweir return sal_False;
1696cdf0e10cSrcweir }
1697cdf0e10cSrcweir
1698cdf0e10cSrcweir uno::Any SAL_CALL ChartController
getSelection()1699cdf0e10cSrcweir ::getSelection() throw(uno::RuntimeException)
1700cdf0e10cSrcweir {
1701cdf0e10cSrcweir uno::Any aReturn;
1702cdf0e10cSrcweir if ( m_aSelection.hasSelection() )
1703cdf0e10cSrcweir {
1704cdf0e10cSrcweir ::rtl::OUString aCID( m_aSelection.getSelectedCID() );
1705*9ec58d04SHerbert Dürr if ( !aCID.isEmpty() )
1706cdf0e10cSrcweir {
1707cdf0e10cSrcweir aReturn = uno::makeAny( aCID );
1708cdf0e10cSrcweir }
1709cdf0e10cSrcweir else
1710cdf0e10cSrcweir {
1711cdf0e10cSrcweir // #i12587# support for shapes in chart
1712cdf0e10cSrcweir aReturn = uno::makeAny( m_aSelection.getSelectedAdditionalShape() );
1713cdf0e10cSrcweir }
1714cdf0e10cSrcweir }
1715cdf0e10cSrcweir return aReturn;
1716cdf0e10cSrcweir }
1717cdf0e10cSrcweir
1718cdf0e10cSrcweir void SAL_CALL ChartController
addSelectionChangeListener(const uno::Reference<view::XSelectionChangeListener> & xListener)1719cdf0e10cSrcweir ::addSelectionChangeListener( const uno::Reference<
1720cdf0e10cSrcweir view::XSelectionChangeListener > & xListener )
1721cdf0e10cSrcweir throw(uno::RuntimeException)
1722cdf0e10cSrcweir {
1723cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex());
1724cdf0e10cSrcweir if( impl_isDisposedOrSuspended() )//@todo? allow adding of listeners in suspend mode?
1725cdf0e10cSrcweir return; //behave passive if already disposed or suspended
1726cdf0e10cSrcweir
1727cdf0e10cSrcweir //--add listener
1728cdf0e10cSrcweir m_aLifeTimeManager.m_aListenerContainer.addInterface( ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0), xListener );
1729cdf0e10cSrcweir }
1730cdf0e10cSrcweir
1731cdf0e10cSrcweir void SAL_CALL ChartController
removeSelectionChangeListener(const uno::Reference<view::XSelectionChangeListener> & xListener)1732cdf0e10cSrcweir ::removeSelectionChangeListener( const uno::Reference<
1733cdf0e10cSrcweir view::XSelectionChangeListener > & xListener )
1734cdf0e10cSrcweir throw(uno::RuntimeException)
1735cdf0e10cSrcweir {
1736cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex());
1737cdf0e10cSrcweir if( impl_isDisposedOrSuspended() ) //@todo? allow removing of listeners in suspend mode?
1738cdf0e10cSrcweir return; //behave passive if already disposed or suspended
1739cdf0e10cSrcweir
1740cdf0e10cSrcweir //--remove listener
1741cdf0e10cSrcweir m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0), xListener );
1742cdf0e10cSrcweir }
1743cdf0e10cSrcweir
1744cdf0e10cSrcweir void ChartController
impl_notifySelectionChangeListeners()1745cdf0e10cSrcweir ::impl_notifySelectionChangeListeners()
1746cdf0e10cSrcweir {
1747cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
1748cdf0e10cSrcweir .getContainer( ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0) );
1749cdf0e10cSrcweir if( pIC )
1750cdf0e10cSrcweir {
1751cdf0e10cSrcweir uno::Reference< view::XSelectionSupplier > xSelectionSupplier(this);
1752cdf0e10cSrcweir lang::EventObject aEvent( xSelectionSupplier );
1753cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper aIt( *pIC );
1754cdf0e10cSrcweir while( aIt.hasMoreElements() )
1755cdf0e10cSrcweir {
1756cdf0e10cSrcweir uno::Reference< view::XSelectionChangeListener > xListener( aIt.next(), uno::UNO_QUERY );
1757cdf0e10cSrcweir if( xListener.is() )
1758cdf0e10cSrcweir xListener->selectionChanged( aEvent );
1759cdf0e10cSrcweir }
1760cdf0e10cSrcweir }
1761cdf0e10cSrcweir }
1762cdf0e10cSrcweir
impl_selectObjectAndNotiy()1763cdf0e10cSrcweir void ChartController::impl_selectObjectAndNotiy()
1764cdf0e10cSrcweir {
1765cdf0e10cSrcweir {
1766cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() );
1767cdf0e10cSrcweir DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
1768cdf0e10cSrcweir if( pDrawViewWrapper )
1769cdf0e10cSrcweir {
1770cdf0e10cSrcweir pDrawViewWrapper->SetDragMode( m_eDragMode );
1771cdf0e10cSrcweir m_aSelection.applySelection( m_pDrawViewWrapper );
1772cdf0e10cSrcweir }
1773cdf0e10cSrcweir }
1774cdf0e10cSrcweir impl_notifySelectionChangeListeners();
1775cdf0e10cSrcweir }
1776cdf0e10cSrcweir
impl_moveOrResizeObject(const::rtl::OUString & rCID,eMoveOrResizeType eType,double fAmountLogicX,double fAmountLogicY)1777cdf0e10cSrcweir bool ChartController::impl_moveOrResizeObject(
1778cdf0e10cSrcweir const ::rtl::OUString & rCID,
1779cdf0e10cSrcweir eMoveOrResizeType eType,
1780cdf0e10cSrcweir double fAmountLogicX,
1781cdf0e10cSrcweir double fAmountLogicY )
1782cdf0e10cSrcweir {
1783cdf0e10cSrcweir bool bResult = false;
1784cdf0e10cSrcweir bool bNeedShift = true;
1785cdf0e10cSrcweir bool bNeedResize = ( eType == CENTERED_RESIZE_OBJECT );
1786cdf0e10cSrcweir
1787cdf0e10cSrcweir uno::Reference< frame::XModel > xChartModel( getModel() );
1788cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xObjProp(
1789cdf0e10cSrcweir ObjectIdentifier::getObjectPropertySet( rCID, xChartModel ));
1790cdf0e10cSrcweir if( xObjProp.is())
1791cdf0e10cSrcweir {
1792cdf0e10cSrcweir awt::Size aRefSize = ChartModelHelper::getPageSize( xChartModel );
1793cdf0e10cSrcweir
1794cdf0e10cSrcweir chart2::RelativePosition aRelPos;
1795cdf0e10cSrcweir chart2::RelativeSize aRelSize;
1796cdf0e10cSrcweir bool bDeterminePos = !(xObjProp->getPropertyValue( C2U("RelativePosition")) >>= aRelPos);
1797cdf0e10cSrcweir bool bDetermineSize = !bNeedResize || !(xObjProp->getPropertyValue( C2U("RelativeSize")) >>= aRelSize);
1798cdf0e10cSrcweir
1799cdf0e10cSrcweir if( ( bDeterminePos || bDetermineSize ) &&
1800cdf0e10cSrcweir ( aRefSize.Width > 0 && aRefSize.Height > 0 ) )
1801cdf0e10cSrcweir {
1802cdf0e10cSrcweir ExplicitValueProvider * pValueProvider(
1803cdf0e10cSrcweir ExplicitValueProvider::getExplicitValueProvider( m_xChartView ));
1804cdf0e10cSrcweir if( pValueProvider )
1805cdf0e10cSrcweir {
1806cdf0e10cSrcweir awt::Rectangle aRect( pValueProvider->getRectangleOfObject( rCID ));
1807cdf0e10cSrcweir double fWidth = static_cast< double >( aRefSize.Width );
1808cdf0e10cSrcweir double fHeight = static_cast< double >( aRefSize.Height );
1809cdf0e10cSrcweir if( bDetermineSize )
1810cdf0e10cSrcweir {
1811cdf0e10cSrcweir aRelSize.Primary = static_cast< double >( aRect.Width ) / fWidth;
1812cdf0e10cSrcweir aRelSize.Secondary = static_cast< double >( aRect.Height ) / fHeight;
1813cdf0e10cSrcweir }
1814cdf0e10cSrcweir if( bDeterminePos )
1815cdf0e10cSrcweir {
1816cdf0e10cSrcweir if( bNeedResize && aRelSize.Primary > 0.0 && aRelSize.Secondary > 0.0 )
1817cdf0e10cSrcweir {
1818cdf0e10cSrcweir aRelPos.Primary = (static_cast< double >( aRect.X ) / fWidth) +
1819cdf0e10cSrcweir (aRelSize.Primary / 2.0);
1820cdf0e10cSrcweir aRelPos.Secondary = (static_cast< double >( aRect.Y ) / fHeight) +
1821cdf0e10cSrcweir (aRelSize.Secondary / 2.0);
1822cdf0e10cSrcweir aRelPos.Anchor = drawing::Alignment_CENTER;
1823cdf0e10cSrcweir }
1824cdf0e10cSrcweir else
1825cdf0e10cSrcweir {
1826cdf0e10cSrcweir aRelPos.Primary = static_cast< double >( aRect.X ) / fWidth;
1827cdf0e10cSrcweir aRelPos.Secondary = static_cast< double >( aRect.Y ) / fHeight;
1828cdf0e10cSrcweir aRelPos.Anchor = drawing::Alignment_TOP_LEFT;
1829cdf0e10cSrcweir }
1830cdf0e10cSrcweir }
1831cdf0e10cSrcweir }
1832cdf0e10cSrcweir }
1833cdf0e10cSrcweir
1834cdf0e10cSrcweir if( eType == CENTERED_RESIZE_OBJECT )
1835cdf0e10cSrcweir bResult = lcl_GrowAndShiftLogic( aRelPos, aRelSize, aRefSize, fAmountLogicX, fAmountLogicY );
1836cdf0e10cSrcweir else if( eType == MOVE_OBJECT )
1837cdf0e10cSrcweir bResult = lcl_MoveObjectLogic( aRelPos, aRelSize, aRefSize, fAmountLogicX, fAmountLogicY );
1838cdf0e10cSrcweir
1839cdf0e10cSrcweir if( bResult )
1840cdf0e10cSrcweir {
1841cdf0e10cSrcweir ActionDescriptionProvider::ActionType eActionType(ActionDescriptionProvider::MOVE);
1842cdf0e10cSrcweir if( bNeedResize )
1843cdf0e10cSrcweir eActionType = ActionDescriptionProvider::RESIZE;
1844cdf0e10cSrcweir
1845cdf0e10cSrcweir ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID );
1846cdf0e10cSrcweir UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
1847cdf0e10cSrcweir eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager );
1848cdf0e10cSrcweir {
1849cdf0e10cSrcweir ControllerLockGuard aCLGuard( xChartModel );
1850cdf0e10cSrcweir if( bNeedShift )
1851cdf0e10cSrcweir xObjProp->setPropertyValue( C2U("RelativePosition"), uno::makeAny( aRelPos ));
1852cdf0e10cSrcweir if( bNeedResize || (eObjectType == OBJECTTYPE_DIAGRAM) )//Also set an explicat size at the diagram when an explicit position is set
1853cdf0e10cSrcweir xObjProp->setPropertyValue( C2U("RelativeSize"), uno::makeAny( aRelSize ));
1854cdf0e10cSrcweir }
1855cdf0e10cSrcweir aUndoGuard.commit();
1856cdf0e10cSrcweir }
1857cdf0e10cSrcweir }
1858cdf0e10cSrcweir return bResult;
1859cdf0e10cSrcweir }
1860cdf0e10cSrcweir
impl_DragDataPoint(const::rtl::OUString & rCID,double fAdditionalOffset)1861cdf0e10cSrcweir bool ChartController::impl_DragDataPoint( const ::rtl::OUString & rCID, double fAdditionalOffset )
1862cdf0e10cSrcweir {
1863cdf0e10cSrcweir bool bResult = false;
1864cdf0e10cSrcweir if( fAdditionalOffset < -1.0 || fAdditionalOffset > 1.0 || fAdditionalOffset == 0.0 )
1865cdf0e10cSrcweir return bResult;
1866cdf0e10cSrcweir
1867cdf0e10cSrcweir sal_Int32 nDataPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( rCID );
1868cdf0e10cSrcweir uno::Reference< chart2::XDataSeries > xSeries(
1869cdf0e10cSrcweir ObjectIdentifier::getDataSeriesForCID( rCID, getModel() ));
1870cdf0e10cSrcweir if( xSeries.is())
1871cdf0e10cSrcweir {
1872cdf0e10cSrcweir try
1873cdf0e10cSrcweir {
1874cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex( nDataPointIndex ));
1875cdf0e10cSrcweir double fOffset = 0.0;
1876cdf0e10cSrcweir if( xPointProp.is() &&
1877cdf0e10cSrcweir (xPointProp->getPropertyValue( C2U("Offset" )) >>= fOffset ) &&
1878cdf0e10cSrcweir (( fAdditionalOffset > 0.0 && fOffset < 1.0 ) || (fOffset > 0.0)) )
1879cdf0e10cSrcweir {
1880cdf0e10cSrcweir fOffset += fAdditionalOffset;
1881cdf0e10cSrcweir if( fOffset > 1.0 )
1882cdf0e10cSrcweir fOffset = 1.0;
1883cdf0e10cSrcweir else if( fOffset < 0.0 )
1884cdf0e10cSrcweir fOffset = 0.0;
1885cdf0e10cSrcweir xPointProp->setPropertyValue( C2U("Offset"), uno::makeAny( fOffset ));
1886cdf0e10cSrcweir bResult = true;
1887cdf0e10cSrcweir }
1888cdf0e10cSrcweir }
1889cdf0e10cSrcweir catch( const uno::Exception & ex )
1890cdf0e10cSrcweir {
1891cdf0e10cSrcweir ASSERT_EXCEPTION( ex );
1892cdf0e10cSrcweir }
1893cdf0e10cSrcweir }
1894cdf0e10cSrcweir
1895cdf0e10cSrcweir return bResult;
1896cdf0e10cSrcweir }
1897cdf0e10cSrcweir
impl_SetMousePointer(const MouseEvent & rEvent)1898cdf0e10cSrcweir void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
1899cdf0e10cSrcweir {
1900cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex());
1901cdf0e10cSrcweir if( m_pDrawViewWrapper && m_pChartWindow )
1902cdf0e10cSrcweir {
1903cdf0e10cSrcweir Point aMousePos( m_pChartWindow->PixelToLogic( rEvent.GetPosPixel()));
1904cdf0e10cSrcweir sal_uInt16 nModifier = rEvent.GetModifier();
1905cdf0e10cSrcweir sal_Bool bLeftDown = rEvent.IsLeft();
1906cdf0e10cSrcweir
1907cdf0e10cSrcweir if ( m_pDrawViewWrapper->IsTextEdit() )
1908cdf0e10cSrcweir {
1909cdf0e10cSrcweir if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) )
1910cdf0e10cSrcweir {
1911cdf0e10cSrcweir m_pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferedPointer(
1912cdf0e10cSrcweir aMousePos, m_pChartWindow, nModifier, bLeftDown ) );
1913cdf0e10cSrcweir return;
1914cdf0e10cSrcweir }
1915cdf0e10cSrcweir }
1916cdf0e10cSrcweir else if( m_pDrawViewWrapper->IsAction() )
1917cdf0e10cSrcweir {
1918cdf0e10cSrcweir return;//don't change pointer during running action
1919cdf0e10cSrcweir }
1920cdf0e10cSrcweir
1921cdf0e10cSrcweir SdrHdl* pHitSelectionHdl = 0;
1922cdf0e10cSrcweir if( m_aSelection.isResizeableObjectSelected() )
1923cdf0e10cSrcweir pHitSelectionHdl = m_pDrawViewWrapper->PickHandle( aMousePos );
1924cdf0e10cSrcweir
1925cdf0e10cSrcweir if( pHitSelectionHdl )
1926cdf0e10cSrcweir {
1927cdf0e10cSrcweir
1928cdf0e10cSrcweir Pointer aPointer = m_pDrawViewWrapper->GetPreferedPointer(
1929cdf0e10cSrcweir aMousePos, m_pChartWindow, nModifier, bLeftDown );
1930cdf0e10cSrcweir bool bForceArrowPointer = false;
1931cdf0e10cSrcweir
1932cdf0e10cSrcweir ObjectIdentifier aOID( m_aSelection.getSelectedOID() );
1933cdf0e10cSrcweir
1934cdf0e10cSrcweir switch( aPointer.GetStyle())
1935cdf0e10cSrcweir {
1936cdf0e10cSrcweir case POINTER_NSIZE:
1937cdf0e10cSrcweir case POINTER_SSIZE:
1938cdf0e10cSrcweir case POINTER_WSIZE:
1939cdf0e10cSrcweir case POINTER_ESIZE:
1940cdf0e10cSrcweir case POINTER_NWSIZE:
1941cdf0e10cSrcweir case POINTER_NESIZE:
1942cdf0e10cSrcweir case POINTER_SWSIZE:
1943cdf0e10cSrcweir case POINTER_SESIZE:
1944cdf0e10cSrcweir if( ! m_aSelection.isResizeableObjectSelected() )
1945cdf0e10cSrcweir bForceArrowPointer = true;
1946cdf0e10cSrcweir break;
1947cdf0e10cSrcweir case POINTER_MOVE:
1948cdf0e10cSrcweir if ( !aOID.isDragableObject() )
1949cdf0e10cSrcweir bForceArrowPointer = true;
1950cdf0e10cSrcweir break;
1951cdf0e10cSrcweir case POINTER_MOVEPOINT:
1952cdf0e10cSrcweir case POINTER_MOVEBEZIERWEIGHT:
1953cdf0e10cSrcweir // there is no point-editing in a chart
1954cdf0e10cSrcweir // the POINTER_MOVEBEZIERWEIGHT appears in 3d data points
1955cdf0e10cSrcweir bForceArrowPointer = true;
1956cdf0e10cSrcweir break;
1957cdf0e10cSrcweir default:
1958cdf0e10cSrcweir break;
1959cdf0e10cSrcweir }
1960cdf0e10cSrcweir
1961cdf0e10cSrcweir if( bForceArrowPointer )
1962cdf0e10cSrcweir m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
1963cdf0e10cSrcweir else
1964cdf0e10cSrcweir m_pChartWindow->SetPointer( aPointer );
1965cdf0e10cSrcweir }
1966cdf0e10cSrcweir else
1967cdf0e10cSrcweir {
1968cdf0e10cSrcweir // #i12587# support for shapes in chart
1969cdf0e10cSrcweir if ( m_eDrawMode == CHARTDRAW_INSERT &&
1970cdf0e10cSrcweir ( !m_pDrawViewWrapper->IsMarkedHit( aMousePos ) || !m_aSelection.isDragableObjectSelected() ) )
1971cdf0e10cSrcweir {
1972cdf0e10cSrcweir PointerStyle ePointerStyle = POINTER_DRAW_RECT;
1973cdf0e10cSrcweir SdrObjKind eKind = static_cast< SdrObjKind >( m_pDrawViewWrapper->GetCurrentObjIdentifier() );
1974cdf0e10cSrcweir switch ( eKind )
1975cdf0e10cSrcweir {
1976cdf0e10cSrcweir case OBJ_LINE:
1977cdf0e10cSrcweir {
1978cdf0e10cSrcweir ePointerStyle = POINTER_DRAW_LINE;
1979cdf0e10cSrcweir }
1980cdf0e10cSrcweir break;
1981cdf0e10cSrcweir case OBJ_RECT:
1982cdf0e10cSrcweir case OBJ_CUSTOMSHAPE:
1983cdf0e10cSrcweir {
1984cdf0e10cSrcweir ePointerStyle = POINTER_DRAW_RECT;
1985cdf0e10cSrcweir }
1986cdf0e10cSrcweir break;
1987cdf0e10cSrcweir case OBJ_CIRC:
1988cdf0e10cSrcweir {
1989cdf0e10cSrcweir ePointerStyle = POINTER_DRAW_ELLIPSE;
1990cdf0e10cSrcweir }
1991cdf0e10cSrcweir break;
1992cdf0e10cSrcweir case OBJ_FREELINE:
1993cdf0e10cSrcweir {
1994cdf0e10cSrcweir ePointerStyle = POINTER_DRAW_POLYGON;
1995cdf0e10cSrcweir }
1996cdf0e10cSrcweir break;
1997cdf0e10cSrcweir case OBJ_TEXT:
1998cdf0e10cSrcweir {
1999cdf0e10cSrcweir ePointerStyle = POINTER_DRAW_TEXT;
2000cdf0e10cSrcweir }
2001cdf0e10cSrcweir break;
2002cdf0e10cSrcweir case OBJ_CAPTION:
2003cdf0e10cSrcweir {
2004cdf0e10cSrcweir ePointerStyle = POINTER_DRAW_CAPTION;
2005cdf0e10cSrcweir }
2006cdf0e10cSrcweir break;
2007cdf0e10cSrcweir default:
2008cdf0e10cSrcweir {
2009cdf0e10cSrcweir ePointerStyle = POINTER_DRAW_RECT;
2010cdf0e10cSrcweir }
2011cdf0e10cSrcweir break;
2012cdf0e10cSrcweir }
2013cdf0e10cSrcweir m_pChartWindow->SetPointer( Pointer( ePointerStyle ) );
2014cdf0e10cSrcweir return;
2015cdf0e10cSrcweir }
2016cdf0e10cSrcweir
2017cdf0e10cSrcweir ::rtl::OUString aHitObjectCID(
2018cdf0e10cSrcweir SelectionHelper::getHitObjectCID(
2019cdf0e10cSrcweir aMousePos, *m_pDrawViewWrapper, true /*bGetDiagramInsteadOf_Wall*/ ));
2020cdf0e10cSrcweir
2021cdf0e10cSrcweir if( m_pDrawViewWrapper->IsTextEdit() )
2022cdf0e10cSrcweir {
2023cdf0e10cSrcweir if( aHitObjectCID.equals(m_aSelection.getSelectedCID()) )
2024cdf0e10cSrcweir {
2025cdf0e10cSrcweir m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
2026cdf0e10cSrcweir return;
2027cdf0e10cSrcweir }
2028cdf0e10cSrcweir }
2029cdf0e10cSrcweir
2030*9ec58d04SHerbert Dürr if( aHitObjectCID.isEmpty() )
2031cdf0e10cSrcweir {
2032cdf0e10cSrcweir //additional shape was hit
2033cdf0e10cSrcweir m_pChartWindow->SetPointer( POINTER_MOVE );
2034cdf0e10cSrcweir }
2035cdf0e10cSrcweir else if( ObjectIdentifier::isDragableObject( aHitObjectCID ) )
2036cdf0e10cSrcweir {
2037cdf0e10cSrcweir if( (m_eDragMode == SDRDRAG_ROTATE)
2038cdf0e10cSrcweir && SelectionHelper::isRotateableObject( aHitObjectCID
2039cdf0e10cSrcweir , getModel() ) )
2040cdf0e10cSrcweir m_pChartWindow->SetPointer( Pointer( POINTER_ROTATE ) );
2041cdf0e10cSrcweir else
2042cdf0e10cSrcweir {
2043cdf0e10cSrcweir ObjectType eHitObjectType = ObjectIdentifier::getObjectType( aHitObjectCID );
2044cdf0e10cSrcweir if( eHitObjectType == OBJECTTYPE_DATA_POINT )
2045cdf0e10cSrcweir {
2046cdf0e10cSrcweir if( !ObjectIdentifier::areSiblings(aHitObjectCID,m_aSelection.getSelectedCID())
2047cdf0e10cSrcweir && !ObjectIdentifier::areIdenticalObjects(aHitObjectCID,m_aSelection.getSelectedCID()) )
2048cdf0e10cSrcweir {
2049cdf0e10cSrcweir m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
2050cdf0e10cSrcweir return;
2051cdf0e10cSrcweir }
2052cdf0e10cSrcweir }
2053cdf0e10cSrcweir m_pChartWindow->SetPointer( POINTER_MOVE );
2054cdf0e10cSrcweir }
2055cdf0e10cSrcweir }
2056cdf0e10cSrcweir else
2057cdf0e10cSrcweir m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
2058cdf0e10cSrcweir }
2059cdf0e10cSrcweir }
2060cdf0e10cSrcweir }
2061cdf0e10cSrcweir
2062cdf0e10cSrcweir //.............................................................................
2063cdf0e10cSrcweir } //namespace chart
2064cdf0e10cSrcweir //.............................................................................
2065