1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _CHART_CONTROLLER_HXX
24 #define _CHART_CONTROLLER_HXX
25 
26 #include "LifeTime.hxx"
27 #include "ServiceMacros.hxx"
28 #include "CommandDispatchContainer.hxx"
29 #include "SelectionHelper.hxx"
30 
31 // header for enum SdrDragMode
32 #include <svx/svdtypes.hxx>
33 // header for class Timer
34 #include <vcl/timer.hxx>
35 // header for class MouseEvent
36 #include <vcl/event.hxx>
37 
38 #include <cppuhelper/implbase12.hxx>
39 
40 #include <com/sun/star/accessibility/XAccessible.hpp>
41 #include <com/sun/star/document/XUndoManager.hpp>
42 #include <com/sun/star/frame/XController.hpp>
43 #include <com/sun/star/frame/XDispatchProvider.hpp>
44 #include <com/sun/star/frame/XDispatch.hpp>
45 #include <com/sun/star/view/XSelectionSupplier.hpp>
46 #include <com/sun/star/ui/XContextMenuInterception.hpp>
47 #include <com/sun/star/uno/XWeak.hpp>
48 #include <com/sun/star/util/XCloseListener.hpp>
49 #include <com/sun/star/util/XCloseable.hpp>
50 #include <com/sun/star/lang/XInitialization.hpp>
51 #include <com/sun/star/lang/XServiceInfo.hpp>
52 #include <com/sun/star/uno/XComponentContext.hpp>
53 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
54 #include <com/sun/star/util/XModifyListener.hpp>
55 #include <com/sun/star/util/XModeChangeListener.hpp>
56 #include <com/sun/star/awt/Point.hpp>
57 #include <com/sun/star/awt/Size.hpp>
58 #include <com/sun/star/util/XURLTransformer.hpp>
59 #include <com/sun/star/frame/XLayoutManagerListener.hpp>
60 #include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
61 
62 #include <memory>
63 #include <boost/shared_ptr.hpp>
64 #include <set>
65 
66 
67 class SdrModel;
68 
69 namespace svt
70 {
71     class AcceleratorExecute;
72 }
73 
74 class DropTargetHelper;
75 
76 namespace com { namespace sun { namespace star {
77 namespace graphic {
78     class XGraphic;
79 }
80 }}}
81 
82 
83 //.............................................................................
84 namespace chart
85 {
86 //.............................................................................
87 
88 class UndoGuard;
89 
90 enum ChartDrawMode { CHARTDRAW_INSERT, CHARTDRAW_SELECT };
91 
92 class WindowController
93 {
94 public:
~WindowController()95     virtual ~WindowController() {};
96 
97     virtual void PrePaint()=0;
98     virtual void execute_Paint( const Rectangle& rRect )=0;
99     virtual void execute_MouseButtonDown( const MouseEvent& rMEvt )=0;
100     virtual void execute_MouseMove( const MouseEvent& rMEvt )=0;
101     virtual void execute_Tracking( const TrackingEvent& rTEvt )=0;
102     virtual void execute_MouseButtonUp( const MouseEvent& rMEvt )=0;
103 	virtual void execute_Resize()=0;
104     virtual void execute_Activate()=0;
105     virtual void execute_Deactivate()=0;
106     virtual void execute_GetFocus()=0;
107     virtual void execute_LoseFocus()=0;
108     virtual void execute_Command( const CommandEvent& rCEvt )=0;
109     virtual bool execute_KeyInput( const KeyEvent& rKEvt )=0;
110 
111     /** get help text to be shown in a quick help
112 
113         @param aAtLogicPosition the position in logic coordinates (of the
114                                 window) of the mouse cursor to determine for
115                                 which object help is requested.
116 
117         @param bIsBalloonHelp determines whether to return the long text version
118                               (balloon help) or the shorter one (quick help).
119 
120         @param rOutQuickHelpText is filled with the quick help text
121 
122         @param rOutEqualRect is filled with a rectangle that denotes the region
123                              in which the quick help does not change.
124 
125         @return </sal_True>, if a quick help should be shown.
126      */
127     virtual bool requestQuickHelp(
128         ::Point aAtLogicPosition, bool bIsBalloonHelp,
129         ::rtl::OUString & rOutQuickHelpText, ::com::sun::star::awt::Rectangle & rOutEqualRect ) = 0;
130 
131     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() = 0;
132 };
133 
134 class ChartWindow;
135 class DrawModelWrapper;
136 class DrawViewWrapper;
137 class ViewElementListProvider;
138 class ReferenceSizeProvider;
139 
140 class ChartController	: public ::cppu::WeakImplHelper12 <
141 		 ::com::sun::star::frame::XController	//comprehends XComponent (required interface)
142 		,::com::sun::star::frame::XDispatchProvider		//(required interface)
143 		,::com::sun::star::view::XSelectionSupplier		//(optional interface)
144 		,::com::sun::star::ui::XContextMenuInterception	//(optional interface)
145 		,::com::sun::star::util::XCloseListener			//(needed for communication with XModel)
146 		,::com::sun::star::lang::XServiceInfo
147 	//	,public ::com::sun::star::uno::XWeak			// implemented by WeakImplHelper(optional interface)
148 	//	,public ::com::sun::star::uno::XInterface		// implemented by WeakImplHelper(optional interface)
149 	//	,public ::com::sun::star::lang::XTypeProvider	// implemented by WeakImplHelper
150 		,::com::sun::star::frame::XDispatch
151 		,::com::sun::star::awt::XWindow //this is the Window Controller part of this Controller, that will be given to a Frame via setComponent
152         ,::com::sun::star::lang::XMultiServiceFactory
153         ,::com::sun::star::util::XModifyListener
154         ,::com::sun::star::util::XModeChangeListener
155         ,::com::sun::star::frame::XLayoutManagerListener
156 		>
157         , public WindowController
158 {
159     friend class DrawCommandDispatch;
160     friend class ShapeController;
161 
162 public:
163 	//no default constructor
164 	ChartController(::com::sun::star::uno::Reference<
165 			   ::com::sun::star::uno::XComponentContext > const & xContext);
166 	virtual ~ChartController();
167 
168 	//-----------------------------------------------------------------
169 	// ::com::sun::star::lang::XServiceInfo
170 	//-----------------------------------------------------------------
171 
172 	APPHELPER_XSERVICEINFO_DECL()
173 	APPHELPER_SERVICE_FACTORY_HELPER(ChartController)
174 
175 	//-----------------------------------------------------------------
176 	// ::com::sun::star::frame::XController (required interface)
177 	//-----------------------------------------------------------------
178 	virtual void SAL_CALL
179 		attachFrame( const ::com::sun::star::uno::Reference<
180 					  ::com::sun::star::frame::XFrame > & xFrame )
181 							throw (::com::sun::star::uno::RuntimeException);
182 
183 	virtual sal_Bool SAL_CALL
184 		attachModel( const ::com::sun::star::uno::Reference<
185 						::com::sun::star::frame::XModel > & xModel )
186 							throw (::com::sun::star::uno::RuntimeException);
187 
188 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL
189 		getFrame()			throw (::com::sun::star::uno::RuntimeException);
190 
191 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL
192 		getModel()			throw (::com::sun::star::uno::RuntimeException);
193 
194 	virtual ::com::sun::star::uno::Any SAL_CALL
195 		getViewData()		throw (::com::sun::star::uno::RuntimeException);
196 
197 	virtual void SAL_CALL
198 		restoreViewData( const ::com::sun::star::uno::Any& rValue )
199 							throw (::com::sun::star::uno::RuntimeException);
200 
201 	virtual sal_Bool SAL_CALL
202 		suspend( sal_Bool bSuspend )
203 							throw (::com::sun::star::uno::RuntimeException);
204 
205 	//-----------------------------------------------------------------
206 	// ::com::sun::star::lang::XComponent (base of XController)
207 	//-----------------------------------------------------------------
208 	virtual void SAL_CALL
209 		dispose()			throw (::com::sun::star::uno::RuntimeException);
210 
211 	virtual void SAL_CALL
212 		addEventListener( const ::com::sun::star::uno::Reference<
213 						  ::com::sun::star::lang::XEventListener > & xListener )
214 							throw (::com::sun::star::uno::RuntimeException);
215 
216 	virtual void SAL_CALL
217 		removeEventListener( const ::com::sun::star::uno::Reference<
218 						  ::com::sun::star::lang::XEventListener > & xListener )
219 							throw (::com::sun::star::uno::RuntimeException);
220 
221 	//-----------------------------------------------------------------
222 	// ::com::sun::star::frame::XDispatchProvider (required interface)
223 	//-----------------------------------------------------------------
224 	virtual ::com::sun::star::uno::Reference<
225 		::com::sun::star::frame::XDispatch> SAL_CALL
226 		queryDispatch( const ::com::sun::star::util::URL& rURL
227 							, const rtl::OUString& rTargetFrameName
228 							, sal_Int32 nSearchFlags)
229 							throw (::com::sun::star::uno::RuntimeException);
230 
231 	virtual ::com::sun::star::uno::Sequence<
232 		::com::sun::star::uno::Reference<
233 		::com::sun::star::frame::XDispatch > > SAL_CALL
234 		queryDispatches( const ::com::sun::star::uno::Sequence<
235 							::com::sun::star::frame::DispatchDescriptor > & xDescripts)
236 							throw (::com::sun::star::uno::RuntimeException);
237 
238 	//-----------------------------------------------------------------
239 	// ::com::sun::star::view::XSelectionSupplier (optional interface)
240 	//-----------------------------------------------------------------
241 	virtual sal_Bool SAL_CALL
242 		select( const ::com::sun::star::uno::Any& rSelection )
243 							throw ( com::sun::star::lang::IllegalArgumentException );
244 
245 	virtual ::com::sun::star::uno::Any	SAL_CALL
246 		getSelection() throw (::com::sun::star::uno::RuntimeException);
247 
248 	virtual void SAL_CALL
249 		addSelectionChangeListener( const ::com::sun::star::uno::Reference<
250 							com::sun::star::view::XSelectionChangeListener > & xListener )
251 							throw (::com::sun::star::uno::RuntimeException);
252 
253 	virtual void SAL_CALL
254 		removeSelectionChangeListener( const ::com::sun::star::uno::Reference<
255 							com::sun::star::view::XSelectionChangeListener > & xListener )
256 							throw (::com::sun::star::uno::RuntimeException);
257 
258 	//-----------------------------------------------------------------
259 	// ::com::sun::star::ui::XContextMenuInterception (optional interface)
260 	//-----------------------------------------------------------------
261 	virtual void SAL_CALL
262 		registerContextMenuInterceptor( const ::com::sun::star::uno::Reference<
263 							::com::sun::star::ui::XContextMenuInterceptor > & xInterceptor)
264 							throw (::com::sun::star::uno::RuntimeException);
265 
266 	virtual void SAL_CALL
267 		releaseContextMenuInterceptor( const ::com::sun::star::uno::Reference<
268 							::com::sun::star::ui::XContextMenuInterceptor > & xInterceptor)
269 							throw (::com::sun::star::uno::RuntimeException);
270 
271 
272 	//-----------------------------------------------------------------
273 	//-----------------------------------------------------------------
274 	//additional interfaces
275 
276 	//-----------------------------------------------------------------
277 	// ::com::sun::star::util::XCloseListener
278 	//-----------------------------------------------------------------
279 	virtual void SAL_CALL
280 		queryClosing( const ::com::sun::star::lang::EventObject& Source
281 							, sal_Bool GetsOwnership )
282 							throw (::com::sun::star::util::CloseVetoException
283 								 , ::com::sun::star::uno::RuntimeException);
284 
285     virtual void SAL_CALL
286 		notifyClosing( const ::com::sun::star::lang::EventObject& Source )
287 							throw (::com::sun::star::uno::RuntimeException);
288 
289 	//-------------------------------------------------------------------------------------
290 	// ::com::sun::star::util::XEventListener (base of XCloseListener and XModifyListener)
291 	//-------------------------------------------------------------------------------------
292 	virtual void SAL_CALL
293 		disposing( const ::com::sun::star::lang::EventObject& Source )
294 							throw (::com::sun::star::uno::RuntimeException);
295 
296 	//-----------------------------------------------------------------
297 	// ::com::sun::star::frame::XDispatch
298 	//-----------------------------------------------------------------
299 
300 	virtual void SAL_CALL
301 		dispatch( const ::com::sun::star::util::URL& aURL
302 					, const ::com::sun::star::uno::Sequence<
303 					::com::sun::star::beans::PropertyValue >& aArgs )
304 					throw (::com::sun::star::uno::RuntimeException);
305 
306     virtual void SAL_CALL
307 		addStatusListener( const ::com::sun::star::uno::Reference<
308 					::com::sun::star::frame::XStatusListener >& xControl
309 					, const ::com::sun::star::util::URL& aURL )
310 					throw (::com::sun::star::uno::RuntimeException);
311 
312     virtual void SAL_CALL
313 		removeStatusListener( const ::com::sun::star::uno::Reference<
314 					::com::sun::star::frame::XStatusListener >& xControl
315 					, const ::com::sun::star::util::URL& aURL )
316 					throw (::com::sun::star::uno::RuntimeException);
317 
318 	//-----------------------------------------------------------------
319 	// ::com::sun::star::awt::XWindow
320 	//-----------------------------------------------------------------
321 	virtual void SAL_CALL
322 		setPosSize( sal_Int32 X, sal_Int32 Y
323 					, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
324 					throw (::com::sun::star::uno::RuntimeException);
325 
326     virtual ::com::sun::star::awt::Rectangle SAL_CALL
327 		getPosSize()
328 					throw (::com::sun::star::uno::RuntimeException);
329 
330     virtual void SAL_CALL
331 		setVisible( sal_Bool Visible )
332 					throw (::com::sun::star::uno::RuntimeException);
333 
334     virtual void SAL_CALL
335 		setEnable( sal_Bool Enable )
336 					throw (::com::sun::star::uno::RuntimeException);
337 
338     virtual void SAL_CALL
339 		setFocus()	throw (::com::sun::star::uno::RuntimeException);
340 
341     //----------------
342     virtual void SAL_CALL
343 		addWindowListener( const ::com::sun::star::uno::Reference<
344 					::com::sun::star::awt::XWindowListener >& xListener )
345 					throw (::com::sun::star::uno::RuntimeException);
346 
347     virtual void SAL_CALL
348 		removeWindowListener( const ::com::sun::star::uno::Reference<
349 					::com::sun::star::awt::XWindowListener >& xListener )
350 					throw (::com::sun::star::uno::RuntimeException);
351 
352     virtual void SAL_CALL
353 		addFocusListener( const ::com::sun::star::uno::Reference<
354 					::com::sun::star::awt::XFocusListener >& xListener )
355 					throw (::com::sun::star::uno::RuntimeException);
356 
357     virtual void SAL_CALL
358 		removeFocusListener( const ::com::sun::star::uno::Reference<
359 					::com::sun::star::awt::XFocusListener >& xListener )
360 					throw (::com::sun::star::uno::RuntimeException);
361 
362     virtual void SAL_CALL
363 		addKeyListener( const ::com::sun::star::uno::Reference<
364 					::com::sun::star::awt::XKeyListener >& xListener )
365 					throw (::com::sun::star::uno::RuntimeException);
366 
367     virtual void SAL_CALL
368 		removeKeyListener( const ::com::sun::star::uno::Reference<
369 					::com::sun::star::awt::XKeyListener >& xListener )
370 					throw (::com::sun::star::uno::RuntimeException);
371 
372     virtual void SAL_CALL
373 		addMouseListener( const ::com::sun::star::uno::Reference<
374 					::com::sun::star::awt::XMouseListener >& xListener )
375 					throw (::com::sun::star::uno::RuntimeException);
376 
377     virtual void SAL_CALL
378 		removeMouseListener( const ::com::sun::star::uno::Reference<
379 					::com::sun::star::awt::XMouseListener >& xListener )
380 					throw (::com::sun::star::uno::RuntimeException);
381 
382     virtual void SAL_CALL
383 		addMouseMotionListener( const ::com::sun::star::uno::Reference<
384 					::com::sun::star::awt::XMouseMotionListener >& xListener )
385 					throw (::com::sun::star::uno::RuntimeException);
386 
387     virtual void SAL_CALL
388 		removeMouseMotionListener( const ::com::sun::star::uno::Reference<
389 					::com::sun::star::awt::XMouseMotionListener >& xListener )
390 					throw (::com::sun::star::uno::RuntimeException);
391 
392     virtual void SAL_CALL
393 		addPaintListener( const ::com::sun::star::uno::Reference<
394 					::com::sun::star::awt::XPaintListener >& xListener )
395 					throw (::com::sun::star::uno::RuntimeException);
396 
397     virtual void SAL_CALL
398 		removePaintListener( const ::com::sun::star::uno::Reference<
399 					::com::sun::star::awt::XPaintListener >& xListener )
400 					throw (::com::sun::star::uno::RuntimeException);
401 
402 	//-----------------------------------------------------------------
403 	// ::com::sun::star::lang XMultiServiceFactory
404 	//-----------------------------------------------------------------
405     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
406         createInstance( const ::rtl::OUString& aServiceSpecifier )
407             throw (::com::sun::star::uno::Exception,
408                    ::com::sun::star::uno::RuntimeException);
409     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
410         createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier,
411                                      const ::com::sun::star::uno::Sequence<
412                                          ::com::sun::star::uno::Any >& Arguments )
413             throw (::com::sun::star::uno::Exception,
414                    ::com::sun::star::uno::RuntimeException);
415     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
416         getAvailableServiceNames()
417             throw (::com::sun::star::uno::RuntimeException);
418 
419     //-----------------------------------------------------------------
420     // ::com::sun::star::util::XModifyListener
421     //-----------------------------------------------------------------
422     virtual void SAL_CALL modified(
423         const ::com::sun::star::lang::EventObject& aEvent )
424         throw (::com::sun::star::uno::RuntimeException);
425 
426     //-----------------------------------------------------------------
427     // ::com::sun::star::util::XModeChangeListener
428     //-----------------------------------------------------------------
429     virtual void SAL_CALL modeChanged(
430         const ::com::sun::star::util::ModeChangeEvent& _rSource )
431         throw (::com::sun::star::uno::RuntimeException);
432 
433     //-----------------------------------------------------------------
434     // ::com::sun::star::frame::XLayoutManagerListener
435     //-----------------------------------------------------------------
436     virtual void SAL_CALL layoutEvent(
437         const ::com::sun::star::lang::EventObject& aSource,
438         ::sal_Int16 eLayoutEvent,
439         const ::com::sun::star::uno::Any& aInfo )
440         throw (::com::sun::star::uno::RuntimeException);
441 
442     //-----------------------------------------------------------------
443     // chart2::WindowController
444     //-----------------------------------------------------------------
445     virtual void PrePaint();
446     virtual void execute_Paint( const Rectangle& rRect );
447     virtual void execute_MouseButtonDown( const MouseEvent& rMEvt );
448     virtual void execute_MouseMove( const MouseEvent& rMEvt );
449     virtual void execute_Tracking( const TrackingEvent& rTEvt );
450     virtual void execute_MouseButtonUp( const MouseEvent& rMEvt );
451 	virtual void execute_Resize();
452     virtual void execute_Activate();
453     virtual void execute_Deactivate();
454     virtual void execute_GetFocus();
455     virtual void execute_LoseFocus();
456     virtual void execute_Command( const CommandEvent& rCEvt );
457     virtual bool execute_KeyInput( const KeyEvent& rKEvt );
458 
459     virtual bool requestQuickHelp(
460         ::Point aAtLogicPosition, bool bIsBalloonHelp,
461         ::rtl::OUString & rOutQuickHelpText, ::com::sun::star::awt::Rectangle & rOutEqualRect );
462 
463     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
464 
465     //-----------------------------------------------------------------
466     //-----------------------------------------------------------------
467 
468     static bool isObjectDeleteable( const ::com::sun::star::uno::Any& rSelection );
469 
setDrawMode(ChartDrawMode eMode)470     void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; }
getDrawMode() const471     ChartDrawMode getDrawMode() const { return m_eDrawMode; }
472 
473     bool isShapeContext() const;
474 
475     DECL_LINK( NotifyUndoActionHdl, SdrUndoAction* );
476 
477 public:
478     //-----------------------------------------------------------------
479     //-----------------------------------------------------------------
480     //-----------------------------------------------------------------
481     //-----------------------------------------------------------------
482     //private
483     //-----------------------------------------------------------------
484     //-----------------------------------------------------------------
485     //-----------------------------------------------------------------
486     //-----------------------------------------------------------------
487 
488 
489 private:
490     DrawModelWrapper* GetDrawModelWrapper();
491     DrawViewWrapper* GetDrawViewWrapper();
492 
493 private:
494 	class TheModelRef;
495 	friend class ChartController::TheModelRef;
496 	class RefCountable
497 	{
498 		public:
499 			RefCountable();
500 			virtual ~RefCountable();
501 			void acquire();
502 			void release();
503 		private:
504 			sal_Int32 volatile		m_nRefCount;
505 	};
506 	class TheModel : public RefCountable
507 	{
508 		public:
509 			TheModel( const ::com::sun::star::uno::Reference<
510 						::com::sun::star::frame::XModel > & xModel );
511 
512 			virtual ~TheModel();
513 
514 			void		SetOwnerShip( sal_Bool bGetsOwnership );
515 			void		addListener( ChartController* pController );
516 			void		removeListener(  ChartController* pController );
517 			void		tryTermination();
518 			::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
getModel()519 						getModel() { return m_xModel;}
520 
521 		private:
522 			::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >		m_xModel;
523 			::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable >	m_xCloseable;
524 
525 			//the ownership between model and controller is not clear at first
526 			//each controller might consider himself as owner of the model first
527 			sal_Bool volatile		m_bOwnership;
528 			//with a XCloseable::close call and during XCloseListener::queryClosing
529 			//the ownership can be regulated more explicit,
530 			//if so the ownership is considered to be well known
531 			sal_Bool volatile		m_bOwnershipIsWellKnown;
532 	};
533 	class TheModelRef
534 	{
535 		public:
536 			TheModelRef( TheModel* pTheModel, ::osl::Mutex& rMutex );
537 			TheModelRef( const TheModelRef& rTheModel, ::osl::Mutex& rMutex );
538 			TheModelRef& operator=(ChartController::TheModel* pTheModel);
539 			TheModelRef& operator=(const TheModelRef& rTheModel);
540 			virtual ~TheModelRef();
541 			sal_Bool is() const;
operator ->() const542 		        TheModel* operator->() const { return m_pTheModel; }
543 		private:
544 			TheModel*				m_pTheModel;
545             ::osl::Mutex&   m_rModelMutex;
546 	};
547 
548 private:
549 	mutable ::apphelper::LifeTimeManager	m_aLifeTimeManager;
550 
551 	mutable ::osl::Mutex	m_aControllerMutex;
552 	sal_Bool volatile		m_bSuspended;
553 	sal_Bool volatile		m_bCanClose;
554 
555 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>		   m_xCC;
556 
557 	//model
558 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >		m_xFrame;
559 	mutable ::osl::Mutex	m_aModelMutex;
560 	TheModelRef				m_aModel;
561 
562 	//view
563     ChartWindow*        m_pChartWindow;
564 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >		m_xViewWindow;
565     ::com::sun::star::uno::Reference<
566                        ::com::sun::star::uno::XInterface >                  m_xChartView;
567     ::boost::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
568     DrawViewWrapper*	m_pDrawViewWrapper;
569 
570     Selection           m_aSelection;
571     SdrDragMode         m_eDragMode;
572 
573     Timer               m_aDoubleClickTimer;
574     bool volatile       m_bWaitingForDoubleClick;
575     bool volatile       m_bWaitingForMouseUp;
576 
577     bool volatile       m_bConnectingToView;
578 
579     ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager >    m_xUndoManager;
580     ::std::auto_ptr< UndoGuard >                                                    m_pTextActionUndoGuard;
581     /// needed for dispatching URLs in FeatureStateEvents
582     mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
583 
584     ::std::auto_ptr< ::svt::AcceleratorExecute >  m_apAccelExecute;
585 
586     CommandDispatchContainer m_aDispatchContainer;
587 
588     ::std::auto_ptr< DropTargetHelper >           m_apDropTargetHelper;
589     ::com::sun::star::uno::Reference<
590             ::com::sun::star::frame::XLayoutManagerEventBroadcaster >
591                                                   m_xLayoutManagerEventBroadcaster;
592 
593     ChartDrawMode       m_eDrawMode;
594 
595 private:
596 	//private methods
597 
598 	sal_Bool	        impl_isDisposedOrSuspended() const;
599     ::std::auto_ptr< ReferenceSizeProvider > impl_createReferenceSizeProvider();
600     void                impl_adaptDataSeriesAutoResize();
601 
602     void                impl_createDrawViewController();
603     void                impl_deleteDrawViewController();
604 
605     //executeDispatch methods
606     void SAL_CALL       executeDispatch_ObjectProperties();
607     void SAL_CALL       executeDispatch_FormatObject( const ::rtl::OUString& rDispatchCommand );
608     void SAL_CALL       executeDlg_ObjectProperties( const ::rtl::OUString& rObjectCID );
609     bool                executeDlg_ObjectProperties_withoutUndoGuard( const ::rtl::OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso );
610 
611     void SAL_CALL       executeDispatch_ChartType();
612 
613     void                executeDispatch_InsertTitles();
614     void                executeDispatch_InsertLegend();
615     void                executeDispatch_DeleteLegend();
616     void                executeDispatch_OpenLegendDialog();
617     void                executeDispatch_InsertAxes();
618     void                executeDispatch_InsertGrid();
619 
620     void                executeDispatch_InsertMenu_DataLabels();
621     void                executeDispatch_InsertMenu_YErrorBars();
622     void                executeDispatch_InsertMenu_Trendlines();
623     void                executeDispatch_InsertMenu_MeanValues();
624 
625     void                executeDispatch_InsertMeanValue();
626     void                executeDispatch_InsertTrendline();
627     void                executeDispatch_InsertTrendlineEquation( bool bInsertR2=false );
628     void                executeDispatch_InsertYErrorBars();
629 
630     void                executeDispatch_InsertR2Value();
631     void                executeDispatch_DeleteR2Value();
632 
633     void                executeDispatch_DeleteMeanValue();
634     void                executeDispatch_DeleteTrendline();
635     void                executeDispatch_DeleteTrendlineEquation();
636     void                executeDispatch_DeleteYErrorBars();
637 
638     void                executeDispatch_InsertDataLabels();
639     void                executeDispatch_InsertDataLabel();
640     void                executeDispatch_DeleteDataLabels();
641     void                executeDispatch_DeleteDataLabel();
642 
643     void                executeDispatch_ResetAllDataPoints();
644     void                executeDispatch_ResetDataPoint();
645 
646     void                executeDispatch_InsertAxis();
647     void                executeDispatch_InsertAxisTitle();
648     void                executeDispatch_InsertMajorGrid();
649     void                executeDispatch_InsertMinorGrid();
650     void                executeDispatch_DeleteAxis();
651     void                executeDispatch_DeleteMajorGrid();
652     void                executeDispatch_DeleteMinorGrid();
653 
654     void SAL_CALL       executeDispatch_InsertSpecialCharacter();
655     void SAL_CALL       executeDispatch_EditText( const Point* pMousePixel = NULL );
656     void SAL_CALL       executeDispatch_SourceData();
657     void SAL_CALL       executeDispatch_MoveSeries( sal_Bool bForward );
658 
659     void                StartTextEdit( const Point* pMousePixel = NULL );
660     bool                EndTextEdit();
661 
662     void SAL_CALL       executeDispatch_View3D();
663     void SAL_CALL       executeDispatch_PositionAndSize();
664 
665     void                executeDispatch_EditData();
666 
667     void                executeDispatch_NewArrangement();
668     void                executeDispatch_ScaleText();
669 
670     void                executeDispatch_Paste();
671     void                executeDispatch_Copy();
672     void                executeDispatch_Cut();
673     bool                executeDispatch_Delete();
674     void                executeDispatch_ToggleLegend();
675     void                executeDispatch_ToggleGridHorizontal();
676 
677     void impl_ShapeControllerDispatch( const ::com::sun::star::util::URL& rURL,
678         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
679 
680     //
681     DECL_LINK( DoubleClickWaitingHdl, void* );
682     void execute_DoubleClick( const Point* pMousePixel = NULL );
683     void startDoubleClickWaiting();
684     void stopDoubleClickWaiting();
685 
686     void impl_selectObjectAndNotiy();
687     void impl_notifySelectionChangeListeners();
688     void impl_invalidateAccessible();
689     void impl_initializeAccessible();
690     void impl_initializeAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XInitialization >& xInit );
691 
692     //sets the model member to null if it equals the parameter
693     //returns true if successful
694     bool impl_releaseThisModel( const ::com::sun::star::uno::Reference<
695 						::com::sun::star::uno::XInterface > & xModel );
696 
697     enum eMoveOrResizeType
698     {
699         MOVE_OBJECT,
700         CENTERED_RESIZE_OBJECT
701     };
702     /// @return </sal_True>, if resize/move was successful
703     bool impl_moveOrResizeObject(
704         const ::rtl::OUString & rCID, eMoveOrResizeType eType, double fAmountLogicX, double fAmountLogicY );
705     bool impl_DragDataPoint( const ::rtl::OUString & rCID, double fOffset );
706 
707     ::std::set< ::rtl::OUString > impl_getAvailableCommands();
708 
709     /** Creates a helper accesibility class that must be initialized via XInitialization.  For
710         parameters see
711 
712         The returned object should not be used directly.  Instead a proxy object
713         should use this helper to retrieve its children and add them to its own
714         children.
715      */
716     ::com::sun::star::uno::Reference<
717             ::com::sun::star::accessibility::XAccessibleContext >
718         impl_createAccessibleTextContext();
719 
720     void impl_PasteGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > & xGraphic,
721                             const ::Point & aPosition );
722     void impl_PasteShapes( SdrModel* pModel );
723     void impl_PasteStringAsTextShape( const ::rtl::OUString& rString, const ::com::sun::star::awt::Point& rPosition );
724     void impl_SetMousePointer( const MouseEvent & rEvent );
725 
726     void impl_ClearSelection();
727 
728     void impl_switchDiagramPositioningToExcludingPositioning();
729 };
730 
731 //.............................................................................
732 }  // namespace chart
733 //.............................................................................
734 
735 #endif
736 
737