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