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 34 : class WindowController
82 : {
83 : public:
84 2 : 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 : 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 (css::lang::IllegalArgumentException,
219 : css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
220 :
221 : virtual ::com::sun::star::uno::Any SAL_CALL
222 : getSelection() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
223 :
224 : virtual void SAL_CALL
225 : addSelectionChangeListener( const ::com::sun::star::uno::Reference<
226 : com::sun::star::view::XSelectionChangeListener > & xListener )
227 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
228 :
229 : virtual void SAL_CALL
230 : removeSelectionChangeListener( const ::com::sun::star::uno::Reference<
231 : com::sun::star::view::XSelectionChangeListener > & xListener )
232 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
233 :
234 : // ::com::sun::star::ui::XContextMenuInterception (optional interface)
235 : virtual void SAL_CALL
236 : registerContextMenuInterceptor( const ::com::sun::star::uno::Reference<
237 : ::com::sun::star::ui::XContextMenuInterceptor > & xInterceptor)
238 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
239 :
240 : virtual void SAL_CALL
241 : releaseContextMenuInterceptor( const ::com::sun::star::uno::Reference<
242 : ::com::sun::star::ui::XContextMenuInterceptor > & xInterceptor)
243 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
244 :
245 : //additional interfaces
246 :
247 : // ::com::sun::star::util::XCloseListener
248 : virtual void SAL_CALL
249 : queryClosing( const ::com::sun::star::lang::EventObject& Source
250 : , sal_Bool GetsOwnership )
251 : throw (::com::sun::star::util::CloseVetoException
252 : , ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
253 :
254 : virtual void SAL_CALL
255 : notifyClosing( const ::com::sun::star::lang::EventObject& Source )
256 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
257 :
258 : // ::com::sun::star::util::XEventListener (base of XCloseListener and XModifyListener)
259 : virtual void SAL_CALL
260 : disposing( const ::com::sun::star::lang::EventObject& Source )
261 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
262 :
263 : // ::com::sun::star::frame::XDispatch
264 :
265 : virtual void SAL_CALL
266 : dispatch( const ::com::sun::star::util::URL& aURL
267 : , const ::com::sun::star::uno::Sequence<
268 : ::com::sun::star::beans::PropertyValue >& aArgs )
269 : throw (::com::sun::star::uno::RuntimeException,
270 : std::exception) SAL_OVERRIDE;
271 :
272 : virtual void SAL_CALL
273 : addStatusListener( const ::com::sun::star::uno::Reference<
274 : ::com::sun::star::frame::XStatusListener >& xControl
275 : , const ::com::sun::star::util::URL& aURL )
276 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
277 :
278 : virtual void SAL_CALL
279 : removeStatusListener( const ::com::sun::star::uno::Reference<
280 : ::com::sun::star::frame::XStatusListener >& xControl
281 : , const ::com::sun::star::util::URL& aURL )
282 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
283 :
284 : // ::com::sun::star::awt::XWindow
285 : virtual void SAL_CALL
286 : setPosSize( sal_Int32 X, sal_Int32 Y
287 : , sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
288 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
289 :
290 : virtual ::com::sun::star::awt::Rectangle SAL_CALL
291 : getPosSize()
292 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
293 :
294 : virtual void SAL_CALL
295 : setVisible( sal_Bool Visible )
296 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
297 :
298 : virtual void SAL_CALL
299 : setEnable( sal_Bool Enable )
300 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
301 :
302 : virtual void SAL_CALL
303 : setFocus() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
304 :
305 : virtual void SAL_CALL
306 : addWindowListener( const ::com::sun::star::uno::Reference<
307 : ::com::sun::star::awt::XWindowListener >& xListener )
308 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
309 :
310 : virtual void SAL_CALL
311 : removeWindowListener( const ::com::sun::star::uno::Reference<
312 : ::com::sun::star::awt::XWindowListener >& xListener )
313 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
314 :
315 : virtual void SAL_CALL
316 : addFocusListener( const ::com::sun::star::uno::Reference<
317 : ::com::sun::star::awt::XFocusListener >& xListener )
318 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
319 :
320 : virtual void SAL_CALL
321 : removeFocusListener( const ::com::sun::star::uno::Reference<
322 : ::com::sun::star::awt::XFocusListener >& xListener )
323 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
324 :
325 : virtual void SAL_CALL
326 : addKeyListener( const ::com::sun::star::uno::Reference<
327 : ::com::sun::star::awt::XKeyListener >& xListener )
328 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
329 :
330 : virtual void SAL_CALL
331 : removeKeyListener( const ::com::sun::star::uno::Reference<
332 : ::com::sun::star::awt::XKeyListener >& xListener )
333 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
334 :
335 : virtual void SAL_CALL
336 : addMouseListener( const ::com::sun::star::uno::Reference<
337 : ::com::sun::star::awt::XMouseListener >& xListener )
338 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
339 :
340 : virtual void SAL_CALL
341 : removeMouseListener( const ::com::sun::star::uno::Reference<
342 : ::com::sun::star::awt::XMouseListener >& xListener )
343 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
344 :
345 : virtual void SAL_CALL
346 : addMouseMotionListener( const ::com::sun::star::uno::Reference<
347 : ::com::sun::star::awt::XMouseMotionListener >& xListener )
348 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
349 :
350 : virtual void SAL_CALL
351 : removeMouseMotionListener( const ::com::sun::star::uno::Reference<
352 : ::com::sun::star::awt::XMouseMotionListener >& xListener )
353 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
354 :
355 : virtual void SAL_CALL
356 : addPaintListener( const ::com::sun::star::uno::Reference<
357 : ::com::sun::star::awt::XPaintListener >& xListener )
358 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
359 :
360 : virtual void SAL_CALL
361 : removePaintListener( const ::com::sun::star::uno::Reference<
362 : ::com::sun::star::awt::XPaintListener >& xListener )
363 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
364 :
365 : // ::com::sun::star::lang XMultiServiceFactory
366 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
367 : createInstance( const OUString& aServiceSpecifier )
368 : throw (::com::sun::star::uno::Exception,
369 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
370 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
371 : createInstanceWithArguments( const OUString& ServiceSpecifier,
372 : const ::com::sun::star::uno::Sequence<
373 : ::com::sun::star::uno::Any >& Arguments )
374 : throw (::com::sun::star::uno::Exception,
375 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
376 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
377 : getAvailableServiceNames()
378 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
379 :
380 : // ::com::sun::star::util::XModifyListener
381 : virtual void SAL_CALL modified(
382 : const ::com::sun::star::lang::EventObject& aEvent )
383 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
384 :
385 : // ::com::sun::star::util::XModeChangeListener
386 : virtual void SAL_CALL modeChanged(
387 : const ::com::sun::star::util::ModeChangeEvent& _rSource )
388 : throw (::com::sun::star::uno::RuntimeException,
389 : std::exception) SAL_OVERRIDE;
390 :
391 : // ::com::sun::star::frame::XLayoutManagerListener
392 : virtual void SAL_CALL layoutEvent(
393 : const ::com::sun::star::lang::EventObject& aSource,
394 : ::sal_Int16 eLayoutEvent,
395 : const ::com::sun::star::uno::Any& aInfo )
396 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
397 :
398 : // chart2::WindowController
399 : virtual void PrePaint() SAL_OVERRIDE;
400 : virtual void execute_Paint( const Rectangle& rRect ) SAL_OVERRIDE;
401 : virtual void execute_MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
402 : virtual void execute_MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
403 : virtual void execute_Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
404 : virtual void execute_MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
405 : virtual void execute_Resize() SAL_OVERRIDE;
406 : virtual void execute_Activate() SAL_OVERRIDE;
407 : virtual void execute_Deactivate() SAL_OVERRIDE;
408 : virtual void execute_GetFocus() SAL_OVERRIDE;
409 : virtual void execute_LoseFocus() SAL_OVERRIDE;
410 : virtual void execute_Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
411 : virtual bool execute_KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
412 :
413 : virtual bool requestQuickHelp(
414 : ::Point aAtLogicPosition, bool bIsBalloonHelp,
415 : OUString & rOutQuickHelpText, ::com::sun::star::awt::Rectangle & rOutEqualRect ) SAL_OVERRIDE;
416 :
417 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
418 :
419 : static bool isObjectDeleteable( const ::com::sun::star::uno::Any& rSelection );
420 :
421 0 : void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; }
422 : ChartDrawMode getDrawMode() const { return m_eDrawMode; }
423 :
424 : bool isShapeContext() const;
425 :
426 : DECL_LINK( NotifyUndoActionHdl, SdrUndoAction* );
427 :
428 : public:
429 : //private
430 :
431 : private:
432 : DrawModelWrapper* GetDrawModelWrapper();
433 : DrawViewWrapper* GetDrawViewWrapper();
434 :
435 : private:
436 : class TheModelRef;
437 : friend class ChartController::TheModelRef;
438 : class RefCountable
439 : {
440 : public:
441 : RefCountable();
442 : virtual ~RefCountable();
443 : void acquire();
444 : void release();
445 : private:
446 : sal_Int32 m_nRefCount;
447 : };
448 : class TheModel : public RefCountable
449 : {
450 : public:
451 : TheModel( const ::com::sun::star::uno::Reference<
452 : ::com::sun::star::frame::XModel > & xModel );
453 :
454 : virtual ~TheModel();
455 :
456 : void SetOwnership( bool bGetsOwnership );
457 : void addListener( ChartController* pController );
458 : void removeListener( ChartController* pController );
459 : void tryTermination();
460 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
461 14702 : getModel() const { return m_xModel;}
462 :
463 : private:
464 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
465 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > m_xCloseable;
466 :
467 : //the ownership between model and controller is not clear at first
468 : //each controller might consider himself as owner of the model first
469 : bool m_bOwnership;
470 : };
471 : class TheModelRef
472 : {
473 : public:
474 : TheModelRef( TheModel* pTheModel, ::osl::Mutex& rMutex );
475 : TheModelRef( const TheModelRef& rTheModel, ::osl::Mutex& rMutex );
476 : TheModelRef& operator=(ChartController::TheModel* pTheModel);
477 : TheModelRef& operator=(const TheModelRef& rTheModel);
478 : virtual ~TheModelRef();
479 : bool is() const;
480 30017 : TheModel* operator->() const { return m_pTheModel; }
481 : private:
482 : TheModel* m_pTheModel;
483 : ::osl::Mutex& m_rModelMutex;
484 : };
485 :
486 : private:
487 : mutable ::apphelper::LifeTimeManager m_aLifeTimeManager;
488 :
489 : mutable ::osl::Mutex m_aControllerMutex;
490 : bool m_bSuspended;
491 : bool m_bCanClose;
492 :
493 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
494 :
495 : //model
496 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
497 : mutable ::osl::Mutex m_aModelMutex;
498 : TheModelRef m_aModel;
499 :
500 : //view
501 : ChartWindow* m_pChartWindow;
502 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xViewWindow;
503 : ::com::sun::star::uno::Reference<
504 : ::com::sun::star::uno::XInterface > m_xChartView;
505 : ::boost::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
506 : DrawViewWrapper* m_pDrawViewWrapper;
507 :
508 : Selection m_aSelection;
509 : SdrDragMode m_eDragMode;
510 :
511 : Timer m_aDoubleClickTimer;
512 : bool m_bWaitingForDoubleClick;
513 : bool m_bWaitingForMouseUp;
514 :
515 : bool m_bConnectingToView;
516 :
517 : ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager;
518 : ::std::unique_ptr< UndoGuard > m_pTextActionUndoGuard;
519 : /// needed for dispatching URLs in FeatureStateEvents
520 : mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
521 :
522 : ::std::unique_ptr< ::svt::AcceleratorExecute > m_apAccelExecute;
523 :
524 : CommandDispatchContainer m_aDispatchContainer;
525 :
526 : ::std::unique_ptr< DropTargetHelper > m_apDropTargetHelper;
527 : ::com::sun::star::uno::Reference<
528 : ::com::sun::star::frame::XLayoutManagerEventBroadcaster >
529 : m_xLayoutManagerEventBroadcaster;
530 :
531 : ChartDrawMode m_eDrawMode;
532 :
533 : private:
534 : //private methods
535 :
536 : bool impl_isDisposedOrSuspended() const;
537 : ReferenceSizeProvider* impl_createReferenceSizeProvider();
538 : void impl_adaptDataSeriesAutoResize();
539 :
540 : void impl_createDrawViewController();
541 : void impl_deleteDrawViewController();
542 :
543 : //executeDispatch methods
544 : void executeDispatch_ObjectProperties();
545 : void executeDispatch_FormatObject( const OUString& rDispatchCommand );
546 : void executeDlg_ObjectProperties( const OUString& rObjectCID );
547 : bool executeDlg_ObjectProperties_withoutUndoGuard( const OUString& rObjectCID, bool bSuccessOnUnchanged );
548 :
549 : void executeDispatch_ChartType();
550 :
551 : void executeDispatch_InsertTitles();
552 : void executeDispatch_InsertLegend();
553 : void executeDispatch_DeleteLegend();
554 : void executeDispatch_OpenLegendDialog();
555 : void executeDispatch_InsertAxes();
556 : void executeDispatch_InsertGrid();
557 :
558 : void executeDispatch_InsertMenu_DataLabels();
559 : void executeDispatch_InsertMenu_Trendlines();
560 : void executeDispatch_InsertMenu_MeanValues();
561 :
562 : void executeDispatch_InsertMeanValue();
563 : void executeDispatch_InsertTrendline();
564 : void executeDispatch_InsertTrendlineEquation( bool bInsertR2=false );
565 : void executeDispatch_InsertErrorBars( bool bYError );
566 :
567 : void executeDispatch_InsertR2Value();
568 : void executeDispatch_DeleteR2Value();
569 :
570 : void executeDispatch_DeleteMeanValue();
571 : void executeDispatch_DeleteTrendline();
572 : void executeDispatch_DeleteTrendlineEquation();
573 : void executeDispatch_DeleteErrorBars( bool bYError );
574 :
575 : void executeDispatch_InsertDataLabels();
576 : void executeDispatch_InsertDataLabel();
577 : void executeDispatch_DeleteDataLabels();
578 : void executeDispatch_DeleteDataLabel();
579 :
580 : void executeDispatch_ResetAllDataPoints();
581 : void executeDispatch_ResetDataPoint();
582 :
583 : void executeDispatch_InsertAxis();
584 : void executeDispatch_InsertAxisTitle();
585 : void executeDispatch_InsertMajorGrid();
586 : void executeDispatch_InsertMinorGrid();
587 : void executeDispatch_DeleteAxis();
588 : void executeDispatch_DeleteMajorGrid();
589 : void executeDispatch_DeleteMinorGrid();
590 :
591 : void executeDispatch_InsertSpecialCharacter();
592 : void executeDispatch_EditText( const Point* pMousePixel = NULL );
593 : void executeDispatch_SourceData();
594 : void executeDispatch_MoveSeries( bool bForward );
595 :
596 : void StartTextEdit( const Point* pMousePixel = NULL );
597 : bool EndTextEdit();
598 :
599 : void executeDispatch_View3D();
600 : void executeDispatch_PositionAndSize();
601 :
602 : void executeDispatch_EditData();
603 :
604 : void executeDispatch_NewArrangement();
605 : void executeDispatch_ScaleText();
606 :
607 : void executeDispatch_Paste();
608 : void executeDispatch_Copy();
609 : void executeDispatch_Cut();
610 : bool executeDispatch_Delete();
611 : void executeDispatch_ToggleLegend();
612 : void executeDispatch_ToggleGridHorizontal();
613 : void executeDispatch_ToggleGridVertical();
614 :
615 : void impl_ShapeControllerDispatch( const ::com::sun::star::util::URL& rURL,
616 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
617 :
618 : DECL_LINK( DoubleClickWaitingHdl, void* );
619 : void execute_DoubleClick( const Point* pMousePixel = NULL );
620 : void startDoubleClickWaiting();
621 : void stopDoubleClickWaiting();
622 :
623 : void impl_selectObjectAndNotiy();
624 : void impl_notifySelectionChangeListeners();
625 : void impl_invalidateAccessible();
626 : void impl_initializeAccessible();
627 : void impl_initializeAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XInitialization >& xInit );
628 :
629 : //sets the model member to null if it equals the parameter
630 : //returns true if successful
631 : bool impl_releaseThisModel( const ::com::sun::star::uno::Reference<
632 : ::com::sun::star::uno::XInterface > & xModel );
633 :
634 : enum eMoveOrResizeType
635 : {
636 : MOVE_OBJECT,
637 : CENTERED_RESIZE_OBJECT
638 : };
639 : /// @return </sal_True>, if resize/move was successful
640 : bool impl_moveOrResizeObject(
641 : const OUString & rCID, eMoveOrResizeType eType, double fAmountLogicX, double fAmountLogicY );
642 : bool impl_DragDataPoint( const OUString & rCID, double fOffset );
643 :
644 : ::std::set< OUString > impl_getAvailableCommands();
645 :
646 : /** Creates a helper accesibility class that must be initialized via XInitialization. For
647 : parameters see
648 :
649 : The returned object should not be used directly. Instead a proxy object
650 : should use this helper to retrieve its children and add them to its own
651 : children.
652 : */
653 : ::com::sun::star::uno::Reference<
654 : ::com::sun::star::accessibility::XAccessibleContext >
655 : impl_createAccessibleTextContext();
656 :
657 : void impl_PasteGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > & xGraphic,
658 : const ::Point & aPosition );
659 : void impl_PasteShapes( SdrModel* pModel );
660 : void impl_PasteStringAsTextShape( const OUString& rString, const ::com::sun::star::awt::Point& rPosition );
661 : void impl_SetMousePointer( const MouseEvent & rEvent );
662 :
663 : void impl_ClearSelection();
664 :
665 : void impl_switchDiagramPositioningToExcludingPositioning();
666 : };
667 :
668 : } // namespace chart
669 :
670 : #endif
671 :
672 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|