1*c45d927aSAndrew Rist /**************************************************************
2*c45d927aSAndrew Rist  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c45d927aSAndrew Rist  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19*c45d927aSAndrew Rist  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SD_MOTIONPATHTAG_HXX_
25cdf0e10cSrcweir #define _SD_MOTIONPATHTAG_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/util/XChangesListener.hpp>
28cdf0e10cSrcweir #include <com/sun/star/util/XChangesListener.hpp>
29cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
30cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygon.hxx>
31cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
32cdf0e10cSrcweir #include "smarttag.hxx"
33cdf0e10cSrcweir #include "CustomAnimationEffect.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class SdrPathObj;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace sd {
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class View;
40cdf0e10cSrcweir class CustomAnimationPane;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir /*************************************************************************
43cdf0e10cSrcweir |*
44cdf0e10cSrcweir |* Basisklasse fuer alle Funktionen
45cdf0e10cSrcweir |*
46cdf0e10cSrcweir \************************************************************************/
47cdf0e10cSrcweir 
48cdf0e10cSrcweir class MotionPathTag : public SmartTag, public IPolyPolygonEditorController, public SfxListener, public ::com::sun::star::util::XChangesListener
49cdf0e10cSrcweir {
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir 	MotionPathTag( CustomAnimationPane& rPane, ::sd::View& rView, const CustomAnimationEffectPtr& pEffect );
52cdf0e10cSrcweir 	virtual ~MotionPathTag();
53cdf0e10cSrcweir 
getPathObj() const54cdf0e10cSrcweir 	SdrPathObj* getPathObj() const { return mpPathObj; }
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	/** returns true if the SmartTag handled the event. */
57cdf0e10cSrcweir 	virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	/** returns true if the SmartTag consumes this event. */
60cdf0e10cSrcweir 	virtual bool KeyInput( const KeyEvent& rKEvt );
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 	// callbacks from sdr view
63cdf0e10cSrcweir 	virtual sal_uLong GetMarkablePointCount() const;
64cdf0e10cSrcweir 	virtual sal_uLong GetMarkedPointCount() const;
65cdf0e10cSrcweir 	virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
66cdf0e10cSrcweir 	virtual void CheckPossibilities();
67cdf0e10cSrcweir 	virtual sal_Bool MarkPoints(const Rectangle* pRect, sal_Bool bUnmark);
68cdf0e10cSrcweir 
getEffect() const69cdf0e10cSrcweir 	const CustomAnimationEffectPtr& getEffect() const { return mpEffect; }
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 	virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	// IPolyPolygonEditorController
74cdf0e10cSrcweir 	virtual void DeleteMarkedPoints();
75cdf0e10cSrcweir 	virtual sal_Bool IsDeleteMarkedPointsPossible() const;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	virtual	void RipUpAtMarkedPoints();
78cdf0e10cSrcweir 	virtual bool IsRipUpAtMarkedPointsPossible() const;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	virtual sal_Bool IsSetMarkedSegmentsKindPossible() const;
81cdf0e10cSrcweir 	virtual SdrPathSegmentKind GetMarkedSegmentsKind() const;
82cdf0e10cSrcweir 	virtual void SetMarkedSegmentsKind(SdrPathSegmentKind eKind);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	virtual sal_Bool IsSetMarkedPointsSmoothPossible() const;
85cdf0e10cSrcweir 	virtual SdrPathSmoothKind GetMarkedPointsSmooth() const;
86cdf0e10cSrcweir 	virtual void SetMarkedPointsSmooth(SdrPathSmoothKind eKind);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	virtual void CloseMarkedObjects(sal_Bool bToggle, sal_Bool bOpen );
89cdf0e10cSrcweir 	virtual bool IsOpenCloseMarkedObjectsPossible() const;
90cdf0e10cSrcweir 	virtual SdrObjClosedKind GetMarkedObjectsClosedState() const;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	void MovePath( int nDX, int nDY );
93cdf0e10cSrcweir 	bool OnDelete();
94cdf0e10cSrcweir 	bool OnTabHandles( const KeyEvent& rKEvt );
95cdf0e10cSrcweir 	bool OnMarkHandle( const KeyEvent& rKEvt );
96cdf0e10cSrcweir 	bool OnMove( const KeyEvent& rKEvt );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     // XChangesListener
99cdf0e10cSrcweir     virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir     virtual void SAL_CALL acquire(  ) throw ();
103cdf0e10cSrcweir     virtual void SAL_CALL release(  ) throw ();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir protected:
106cdf0e10cSrcweir 	virtual void addCustomHandles( SdrHdlList& rHandlerList );
107cdf0e10cSrcweir 	virtual bool getContext( SdrViewContext& rContext );
108cdf0e10cSrcweir 	virtual void disposing();
109cdf0e10cSrcweir 	virtual void deselect();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	void updatePathAttributes();
112cdf0e10cSrcweir     void selectionChanged();
113cdf0e10cSrcweir 
114cdf0e10cSrcweir private:
115cdf0e10cSrcweir 	CustomAnimationPane& mrPane;
116cdf0e10cSrcweir 	CustomAnimationEffectPtr mpEffect;
117cdf0e10cSrcweir 	::basegfx::B2DPolyPolygon mxPolyPoly;
118cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxOrigin;
119cdf0e10cSrcweir 	SdrPathObj* mpPathObj;
120cdf0e10cSrcweir 	::com::sun::star::awt::Point maOriginPos;
121cdf0e10cSrcweir 	SdrMark* mpMark;
122cdf0e10cSrcweir 	rtl::OUString msLastPath;
123cdf0e10cSrcweir 	bool mbInUpdatePath;
124cdf0e10cSrcweir };
125cdf0e10cSrcweir 
126cdf0e10cSrcweir } // end of namespace sd
127cdf0e10cSrcweir 
128cdf0e10cSrcweir #endif		// _SD_MOTIONPATHTAG_HXX_
129cdf0e10cSrcweir 
130