1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: motionpathtag.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SD_MOTIONPATHTAG_HXX_
32 #define _SD_MOTIONPATHTAG_HXX_
34 #include <com/sun/star/util/XChangesListener.hpp>
35 #include <com/sun/star/util/XChangesListener.hpp>
36 #include <com/sun/star/drawing/XShape.hpp>
37 #include <basegfx/polygon/b2dpolypolygon.hxx>
38 #include <basegfx/polygon/b2dpolypolygontools.hxx>
39 #include "smarttag.hxx"
40 #include "CustomAnimationEffect.hxx"
47 class CustomAnimationPane
;
49 /*************************************************************************
51 |* Basisklasse fuer alle Funktionen
53 \************************************************************************/
55 class MotionPathTag
: public SmartTag
, public IPolyPolygonEditorController
, public SfxListener
, public ::com::sun::star::util::XChangesListener
58 MotionPathTag( CustomAnimationPane
& rPane
, ::sd::View
& rView
, const CustomAnimationEffectPtr
& pEffect
);
59 virtual ~MotionPathTag();
61 SdrPathObj
* getPathObj() const { return mpPathObj
; }
63 /** returns true if the SmartTag handled the event. */
64 virtual bool MouseButtonDown( const MouseEvent
&, SmartHdl
& );
66 /** returns true if the SmartTag consumes this event. */
67 virtual bool KeyInput( const KeyEvent
& rKEvt
);
69 // callbacks from sdr view
70 virtual ULONG
GetMarkablePointCount() const;
71 virtual ULONG
GetMarkedPointCount() const;
72 virtual BOOL
MarkPoint(SdrHdl
& rHdl
, BOOL bUnmark
=FALSE
);
73 virtual void CheckPossibilities();
74 virtual BOOL
MarkPoints(const Rectangle
* pRect
, BOOL bUnmark
);
76 const CustomAnimationEffectPtr
& getEffect() const { return mpEffect
; }
78 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
80 // IPolyPolygonEditorController
81 virtual void DeleteMarkedPoints();
82 virtual BOOL
IsDeleteMarkedPointsPossible() const;
84 virtual void RipUpAtMarkedPoints();
85 virtual bool IsRipUpAtMarkedPointsPossible() const;
87 virtual BOOL
IsSetMarkedSegmentsKindPossible() const;
88 virtual SdrPathSegmentKind
GetMarkedSegmentsKind() const;
89 virtual void SetMarkedSegmentsKind(SdrPathSegmentKind eKind
);
91 virtual BOOL
IsSetMarkedPointsSmoothPossible() const;
92 virtual SdrPathSmoothKind
GetMarkedPointsSmooth() const;
93 virtual void SetMarkedPointsSmooth(SdrPathSmoothKind eKind
);
95 virtual void CloseMarkedObjects(BOOL bToggle
, BOOL bOpen
);
96 virtual bool IsOpenCloseMarkedObjectsPossible() const;
97 virtual SdrObjClosedKind
GetMarkedObjectsClosedState() const;
99 void MovePath( int nDX
, int nDY
);
101 bool OnTabHandles( const KeyEvent
& rKEvt
);
102 bool OnMarkHandle( const KeyEvent
& rKEvt
);
103 bool OnMove( const KeyEvent
& rKEvt
);
106 virtual void SAL_CALL
changesOccurred( const ::com::sun::star::util::ChangesEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
107 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
108 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
) throw (::com::sun::star::uno::RuntimeException
);
109 virtual void SAL_CALL
acquire( ) throw ();
110 virtual void SAL_CALL
release( ) throw ();
113 virtual void addCustomHandles( SdrHdlList
& rHandlerList
);
114 virtual bool getContext( SdrViewContext
& rContext
);
115 virtual void disposing();
116 virtual void deselect();
118 void updatePathAttributes();
119 void selectionChanged();
122 CustomAnimationPane
& mrPane
;
123 CustomAnimationEffectPtr mpEffect
;
124 ::basegfx::B2DPolyPolygon mxPolyPoly
;
125 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> mxOrigin
;
126 SdrPathObj
* mpPathObj
;
127 ::com::sun::star::awt::Point maOriginPos
;
129 rtl::OUString msLastPath
;
133 } // end of namespace sd
135 #endif // _SD_MOTIONPATHTAG_HXX_