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 17 : class WindowController
82 : {
83 : public:
84 17 : 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 17 : 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 : private:
435 : class TheModelRef;
436 : friend class ChartController::TheModelRef;
437 : class RefCountable
438 : {
439 : public:
440 : RefCountable();
441 : virtual ~RefCountable();
442 : void acquire();
443 : void release();
444 : private:
445 : sal_Int32 volatile m_nRefCount;
446 : };
447 : class TheModel : public RefCountable
448 : {
449 : public:
450 : TheModel( const ::com::sun::star::uno::Reference<
451 : ::com::sun::star::frame::XModel > & xModel );
452 :
453 : virtual ~TheModel();
454 :
455 : void SetOwnership( sal_Bool bGetsOwnership );
456 : void addListener( ChartController* pController );
457 : void removeListener( ChartController* pController );
458 : void tryTermination();
459 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
460 8153 : getModel() const { return m_xModel;}
461 :
462 : private:
463 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
464 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > m_xCloseable;
465 :
466 : //the ownership between model and controller is not clear at first
467 : //each controller might consider himself as owner of the model first
468 : sal_Bool volatile m_bOwnership;
469 : //with a XCloseable::close call and during XCloseListener::queryClosing
470 : //the ownership can be regulated more explicit,
471 : //if so the ownership is considered to be well known
472 : sal_Bool volatile m_bOwnershipIsWellKnown;
473 : };
474 : class TheModelRef
475 : {
476 : public:
477 : TheModelRef( TheModel* pTheModel, ::osl::Mutex& rMutex );
478 : TheModelRef( const TheModelRef& rTheModel, ::osl::Mutex& rMutex );
479 : TheModelRef& operator=(ChartController::TheModel* pTheModel);
480 : TheModelRef& operator=(const TheModelRef& rTheModel);
481 : virtual ~TheModelRef();
482 : sal_Bool is() const;
483 16558 : TheModel* operator->() const { return m_pTheModel; }
484 : private:
485 : TheModel* m_pTheModel;
486 : ::osl::Mutex& m_rModelMutex;
487 : };
488 :
489 : private:
490 : mutable ::apphelper::LifeTimeManager m_aLifeTimeManager;
491 :
492 : mutable ::osl::Mutex m_aControllerMutex;
493 : sal_Bool volatile m_bSuspended;
494 : sal_Bool volatile m_bCanClose;
495 :
496 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
497 :
498 : //model
499 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
500 : mutable ::osl::Mutex m_aModelMutex;
501 : TheModelRef m_aModel;
502 :
503 : //view
504 : ChartWindow* m_pChartWindow;
505 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xViewWindow;
506 : ::com::sun::star::uno::Reference<
507 : ::com::sun::star::uno::XInterface > m_xChartView;
508 : ::boost::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
509 : DrawViewWrapper* m_pDrawViewWrapper;
510 :
511 : Selection m_aSelection;
512 : SdrDragMode m_eDragMode;
513 :
514 : Timer m_aDoubleClickTimer;
515 : bool volatile m_bWaitingForDoubleClick;
516 : bool volatile m_bWaitingForMouseUp;
517 :
518 : bool volatile m_bConnectingToView;
519 :
520 : ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager;
521 : ::std::auto_ptr< UndoGuard > m_pTextActionUndoGuard;
522 : /// needed for dispatching URLs in FeatureStateEvents
523 : mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
524 :
525 : ::std::auto_ptr< ::svt::AcceleratorExecute > m_apAccelExecute;
526 :
527 : CommandDispatchContainer m_aDispatchContainer;
528 :
529 : ::std::auto_ptr< DropTargetHelper > m_apDropTargetHelper;
530 : ::com::sun::star::uno::Reference<
531 : ::com::sun::star::frame::XLayoutManagerEventBroadcaster >
532 : m_xLayoutManagerEventBroadcaster;
533 :
534 : ChartDrawMode m_eDrawMode;
535 :
536 : private:
537 : //private methods
538 :
539 : sal_Bool impl_isDisposedOrSuspended() const;
540 : ::std::auto_ptr< ReferenceSizeProvider > impl_createReferenceSizeProvider();
541 : void impl_adaptDataSeriesAutoResize();
542 :
543 : void impl_createDrawViewController();
544 : void impl_deleteDrawViewController();
545 :
546 : //executeDispatch methods
547 : void SAL_CALL executeDispatch_ObjectProperties();
548 : void SAL_CALL executeDispatch_FormatObject( const OUString& rDispatchCommand );
549 : void SAL_CALL executeDlg_ObjectProperties( const OUString& rObjectCID );
550 : bool executeDlg_ObjectProperties_withoutUndoGuard( const OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso );
551 :
552 : void SAL_CALL executeDispatch_ChartType();
553 :
554 : void executeDispatch_InsertTitles();
555 : void executeDispatch_InsertLegend();
556 : void executeDispatch_DeleteLegend();
557 : void executeDispatch_OpenLegendDialog();
558 : void executeDispatch_InsertAxes();
559 : void executeDispatch_InsertGrid();
560 :
561 : void executeDispatch_InsertMenu_DataLabels();
562 : void executeDispatch_InsertMenu_Trendlines();
563 : void executeDispatch_InsertMenu_MeanValues();
564 :
565 : void executeDispatch_InsertMeanValue();
566 : void executeDispatch_InsertTrendline();
567 : void executeDispatch_InsertTrendlineEquation( bool bInsertR2=false );
568 : void executeDispatch_InsertErrorBars( bool bYError );
569 :
570 : void executeDispatch_InsertR2Value();
571 : void executeDispatch_DeleteR2Value();
572 :
573 : void executeDispatch_DeleteMeanValue();
574 : void executeDispatch_DeleteTrendline();
575 : void executeDispatch_DeleteTrendlineEquation();
576 : void executeDispatch_DeleteErrorBars( bool bYError );
577 :
578 : void executeDispatch_InsertDataLabels();
579 : void executeDispatch_InsertDataLabel();
580 : void executeDispatch_DeleteDataLabels();
581 : void executeDispatch_DeleteDataLabel();
582 :
583 : void executeDispatch_ResetAllDataPoints();
584 : void executeDispatch_ResetDataPoint();
585 :
586 : void executeDispatch_InsertAxis();
587 : void executeDispatch_InsertAxisTitle();
588 : void executeDispatch_InsertMajorGrid();
589 : void executeDispatch_InsertMinorGrid();
590 : void executeDispatch_DeleteAxis();
591 : void executeDispatch_DeleteMajorGrid();
592 : void executeDispatch_DeleteMinorGrid();
593 :
594 : void SAL_CALL executeDispatch_InsertSpecialCharacter();
595 : void SAL_CALL executeDispatch_EditText( const Point* pMousePixel = NULL );
596 : void SAL_CALL executeDispatch_SourceData();
597 : void SAL_CALL executeDispatch_MoveSeries( sal_Bool bForward );
598 :
599 : void StartTextEdit( const Point* pMousePixel = NULL );
600 : bool EndTextEdit();
601 :
602 : void SAL_CALL executeDispatch_View3D();
603 : void SAL_CALL executeDispatch_PositionAndSize();
604 :
605 : void executeDispatch_EditData();
606 :
607 : void executeDispatch_NewArrangement();
608 : void executeDispatch_ScaleText();
609 :
610 : void executeDispatch_Paste();
611 : void executeDispatch_Copy();
612 : void executeDispatch_Cut();
613 : bool executeDispatch_Delete();
614 : void executeDispatch_ToggleLegend();
615 : void executeDispatch_ToggleGridHorizontal();
616 : void executeDispatch_ToggleGridVertical();
617 :
618 : void impl_ShapeControllerDispatch( const ::com::sun::star::util::URL& rURL,
619 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
620 :
621 : DECL_LINK( DoubleClickWaitingHdl, void* );
622 : void execute_DoubleClick( const Point* pMousePixel = NULL );
623 : void startDoubleClickWaiting();
624 : void stopDoubleClickWaiting();
625 :
626 : void impl_selectObjectAndNotiy();
627 : void impl_notifySelectionChangeListeners();
628 : void impl_invalidateAccessible();
629 : void impl_initializeAccessible();
630 : void impl_initializeAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XInitialization >& xInit );
631 :
632 : //sets the model member to null if it equals the parameter
633 : //returns true if successful
634 : bool impl_releaseThisModel( const ::com::sun::star::uno::Reference<
635 : ::com::sun::star::uno::XInterface > & xModel );
636 :
637 : enum eMoveOrResizeType
638 : {
639 : MOVE_OBJECT,
640 : CENTERED_RESIZE_OBJECT
641 : };
642 : /// @return </sal_True>, if resize/move was successful
643 : bool impl_moveOrResizeObject(
644 : const OUString & rCID, eMoveOrResizeType eType, double fAmountLogicX, double fAmountLogicY );
645 : bool impl_DragDataPoint( const OUString & rCID, double fOffset );
646 :
647 : ::std::set< OUString > impl_getAvailableCommands();
648 :
649 : /** Creates a helper accesibility class that must be initialized via XInitialization. For
650 : parameters see
651 :
652 : The returned object should not be used directly. Instead a proxy object
653 : should use this helper to retrieve its children and add them to its own
654 : children.
655 : */
656 : ::com::sun::star::uno::Reference<
657 : ::com::sun::star::accessibility::XAccessibleContext >
658 : impl_createAccessibleTextContext();
659 :
660 : void impl_PasteGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > & xGraphic,
661 : const ::Point & aPosition );
662 : void impl_PasteShapes( SdrModel* pModel );
663 : void impl_PasteStringAsTextShape( const OUString& rString, const ::com::sun::star::awt::Point& rPosition );
664 : void impl_SetMousePointer( const MouseEvent & rEvent );
665 :
666 : void impl_ClearSelection();
667 :
668 : void impl_switchDiagramPositioningToExcludingPositioning();
669 : };
670 :
671 : } // namespace chart
672 :
673 : #endif
674 :
675 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|