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 .
22 #include <com/sun/star/util/XChangesListener.hpp>
23 #include <basegfx/polygon/b2dpolypolygon.hxx>
24 #include <smarttag.hxx>
25 #include <CustomAnimationList.hxx>
27 namespace com::sun::star::drawing
{ class XShape
; }
33 class CustomAnimationPane
;
35 /// Base class for all functions.
36 class MotionPathTag final
: public SmartTag
, public IPolyPolygonEditorController
, public SfxListener
, public css::util::XChangesListener
39 MotionPathTag( CustomAnimationPane
& rPane
, ::sd::View
& rView
, const CustomAnimationEffectPtr
& pEffect
);
40 virtual ~MotionPathTag() override
;
42 SdrPathObj
* getPathObj() const { return mpPathObj
.get(); }
44 /// @return true if the SmartTag handled the event.
45 virtual bool MouseButtonDown( const MouseEvent
&, SmartHdl
& ) override
;
47 /// @return true if the SmartTag consumes this event.
48 virtual bool KeyInput( const KeyEvent
& rKEvt
) override
;
50 // callbacks from sdr view
51 virtual sal_Int32
GetMarkablePointCount() const override
;
52 virtual sal_Int32
GetMarkedPointCount() const override
;
53 virtual bool MarkPoint(SdrHdl
& rHdl
, bool bUnmark
) override
;
54 virtual void CheckPossibilities() override
;
55 virtual bool MarkPoints(const ::tools::Rectangle
* pRect
, bool bUnmark
) override
;
57 const CustomAnimationEffectPtr
& getEffect() const { return mpEffect
; }
59 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
61 // IPolyPolygonEditorController
62 virtual void DeleteMarkedPoints() override
;
63 virtual bool IsDeleteMarkedPointsPossible() const override
;
65 virtual void RipUpAtMarkedPoints() override
;
66 virtual bool IsRipUpAtMarkedPointsPossible() const override
;
68 virtual bool IsSetMarkedSegmentsKindPossible() const override
;
69 virtual SdrPathSegmentKind
GetMarkedSegmentsKind() const override
;
70 virtual void SetMarkedSegmentsKind(SdrPathSegmentKind eKind
) override
;
72 virtual bool IsSetMarkedPointsSmoothPossible() const override
;
73 virtual SdrPathSmoothKind
GetMarkedPointsSmooth() const override
;
74 virtual void SetMarkedPointsSmooth(SdrPathSmoothKind eKind
) override
;
76 virtual bool IsOpenCloseMarkedObjectsPossible() const override
;
77 virtual SdrObjClosedKind
GetMarkedObjectsClosedState() const override
;
79 void MovePath( int nDX
, int nDY
);
81 bool OnTabHandles( const KeyEvent
& rKEvt
);
82 bool OnMarkHandle( const KeyEvent
& rKEvt
);
83 bool OnMove( const KeyEvent
& rKEvt
);
86 virtual void SAL_CALL
changesOccurred( const css::util::ChangesEvent
& Event
) override
;
87 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
88 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) override
;
89 virtual void SAL_CALL
acquire( ) noexcept override
;
90 virtual void SAL_CALL
release( ) noexcept override
;
93 virtual void addCustomHandles( SdrHdlList
& rHandlerList
) override
;
94 virtual bool getContext( SdrViewContext
& rContext
) override
;
95 virtual void disposing() override
;
96 virtual void deselect() override
;
98 void updatePathAttributes();
99 void selectionChanged();
101 CustomAnimationPane
& mrPane
;
102 CustomAnimationEffectPtr mpEffect
;
103 ::basegfx::B2DPolyPolygon mxPolyPoly
;
104 css::uno::Reference
< css::drawing::XShape
> mxOrigin
;
105 rtl::Reference
<SdrPathObj
> mpPathObj
;
106 css::awt::Point maOriginPos
;
107 std::unique_ptr
<SdrMark
> mpMark
;
112 } // end of namespace sd
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */