1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_ANIMATIONS_MOTIONPATHTAG_HXX
21 #define INCLUDED_SD_SOURCE_UI_ANIMATIONS_MOTIONPATHTAG_HXX
23 #include <com/sun/star/util/XChangesListener.hpp>
24 #include <com/sun/star/drawing/XShape.hpp>
25 #include <basegfx/polygon/b2dpolypolygon.hxx>
26 #include <basegfx/polygon/b2dpolypolygontools.hxx>
27 #include "smarttag.hxx"
28 #include "CustomAnimationEffect.hxx"
35 class CustomAnimationPane
;
37 /// Base class for all functions.
38 class MotionPathTag
: public SmartTag
, public IPolyPolygonEditorController
, public SfxListener
, public ::com::sun::star::util::XChangesListener
41 MotionPathTag( CustomAnimationPane
& rPane
, ::sd::View
& rView
, const CustomAnimationEffectPtr
& pEffect
);
42 virtual ~MotionPathTag();
44 SdrPathObj
* getPathObj() const { return mpPathObj
; }
46 /// @return true if the SmartTag handled the event.
47 virtual bool MouseButtonDown( const MouseEvent
&, SmartHdl
& ) SAL_OVERRIDE
;
49 /// @return true if the SmartTag consumes this event.
50 virtual bool KeyInput( const KeyEvent
& rKEvt
) SAL_OVERRIDE
;
52 // callbacks from sdr view
53 virtual sal_uLong
GetMarkablePointCount() const SAL_OVERRIDE
;
54 virtual sal_uLong
GetMarkedPointCount() const SAL_OVERRIDE
;
55 virtual bool MarkPoint(SdrHdl
& rHdl
, bool bUnmark
=false) SAL_OVERRIDE
;
56 virtual void CheckPossibilities() SAL_OVERRIDE
;
57 virtual bool MarkPoints(const Rectangle
* pRect
, bool bUnmark
) SAL_OVERRIDE
;
59 const CustomAnimationEffectPtr
& getEffect() const { return mpEffect
; }
61 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
63 // IPolyPolygonEditorController
64 virtual void DeleteMarkedPoints() SAL_OVERRIDE
;
65 virtual bool IsDeleteMarkedPointsPossible() const SAL_OVERRIDE
;
67 virtual void RipUpAtMarkedPoints() SAL_OVERRIDE
;
68 virtual bool IsRipUpAtMarkedPointsPossible() const SAL_OVERRIDE
;
70 virtual bool IsSetMarkedSegmentsKindPossible() const SAL_OVERRIDE
;
71 virtual SdrPathSegmentKind
GetMarkedSegmentsKind() const SAL_OVERRIDE
;
72 virtual void SetMarkedSegmentsKind(SdrPathSegmentKind eKind
) SAL_OVERRIDE
;
74 virtual bool IsSetMarkedPointsSmoothPossible() const SAL_OVERRIDE
;
75 virtual SdrPathSmoothKind
GetMarkedPointsSmooth() const SAL_OVERRIDE
;
76 virtual void SetMarkedPointsSmooth(SdrPathSmoothKind eKind
) SAL_OVERRIDE
;
78 virtual void CloseMarkedObjects(bool bToggle
, bool bOpen
) SAL_OVERRIDE
;
79 virtual bool IsOpenCloseMarkedObjectsPossible() const SAL_OVERRIDE
;
80 virtual SdrObjClosedKind
GetMarkedObjectsClosedState() const SAL_OVERRIDE
;
82 void MovePath( int nDX
, int nDY
);
84 bool OnTabHandles( const KeyEvent
& rKEvt
);
85 bool OnMarkHandle( const KeyEvent
& rKEvt
);
86 bool OnMove( const KeyEvent
& rKEvt
);
89 virtual void SAL_CALL
changesOccurred( const ::com::sun::star::util::ChangesEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 virtual void SAL_CALL
acquire( ) throw () SAL_OVERRIDE
;
93 virtual void SAL_CALL
release( ) throw () SAL_OVERRIDE
;
96 virtual void addCustomHandles( SdrHdlList
& rHandlerList
) SAL_OVERRIDE
;
97 virtual bool getContext( SdrViewContext
& rContext
) SAL_OVERRIDE
;
98 virtual void disposing() SAL_OVERRIDE
;
99 virtual void deselect() SAL_OVERRIDE
;
101 void updatePathAttributes();
102 void selectionChanged();
105 CustomAnimationPane
& mrPane
;
106 CustomAnimationEffectPtr mpEffect
;
107 ::basegfx::B2DPolyPolygon mxPolyPoly
;
108 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> mxOrigin
;
109 SdrPathObj
* mpPathObj
;
110 ::com::sun::star::awt::Point maOriginPos
;
116 } // end of namespace sd
118 #endif // INCLUDED_SD_SOURCE_UI_ANIMATIONS_MOTIONPATHTAG_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */