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