Branch data 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 : :
20 : : #ifndef _SD_MOTIONPATHTAG_HXX_
21 : : #define _SD_MOTIONPATHTAG_HXX_
22 : :
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"
29 : :
30 : : class SdrPathObj;
31 : :
32 : : namespace sd {
33 : :
34 : : class View;
35 : : class CustomAnimationPane;
36 : :
37 : : /// Base class for all functions.
38 : : class MotionPathTag : public SmartTag, public IPolyPolygonEditorController, public SfxListener, public ::com::sun::star::util::XChangesListener
39 : : {
40 : : public:
41 : : MotionPathTag( CustomAnimationPane& rPane, ::sd::View& rView, const CustomAnimationEffectPtr& pEffect );
42 : : virtual ~MotionPathTag();
43 : :
44 : 0 : SdrPathObj* getPathObj() const { return mpPathObj; }
45 : :
46 : : /// @return true if the SmartTag handled the event.
47 : : virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& );
48 : :
49 : : /// @return true if the SmartTag consumes this event.
50 : : virtual bool KeyInput( const KeyEvent& rKEvt );
51 : :
52 : : // callbacks from sdr view
53 : : virtual sal_uLong GetMarkablePointCount() const;
54 : : virtual sal_uLong GetMarkedPointCount() const;
55 : : virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
56 : : virtual void CheckPossibilities();
57 : : virtual sal_Bool MarkPoints(const Rectangle* pRect, sal_Bool bUnmark);
58 : :
59 : 0 : const CustomAnimationEffectPtr& getEffect() const { return mpEffect; }
60 : :
61 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
62 : :
63 : : // IPolyPolygonEditorController
64 : : virtual void DeleteMarkedPoints();
65 : : virtual sal_Bool IsDeleteMarkedPointsPossible() const;
66 : :
67 : : virtual void RipUpAtMarkedPoints();
68 : : virtual bool IsRipUpAtMarkedPointsPossible() const;
69 : :
70 : : virtual sal_Bool IsSetMarkedSegmentsKindPossible() const;
71 : : virtual SdrPathSegmentKind GetMarkedSegmentsKind() const;
72 : : virtual void SetMarkedSegmentsKind(SdrPathSegmentKind eKind);
73 : :
74 : : virtual sal_Bool IsSetMarkedPointsSmoothPossible() const;
75 : : virtual SdrPathSmoothKind GetMarkedPointsSmooth() const;
76 : : virtual void SetMarkedPointsSmooth(SdrPathSmoothKind eKind);
77 : :
78 : : virtual void CloseMarkedObjects(sal_Bool bToggle, sal_Bool bOpen );
79 : : virtual bool IsOpenCloseMarkedObjectsPossible() const;
80 : : virtual SdrObjClosedKind GetMarkedObjectsClosedState() const;
81 : :
82 : : void MovePath( int nDX, int nDY );
83 : : bool OnDelete();
84 : : bool OnTabHandles( const KeyEvent& rKEvt );
85 : : bool OnMarkHandle( const KeyEvent& rKEvt );
86 : : bool OnMove( const KeyEvent& rKEvt );
87 : :
88 : : // XChangesListener
89 : : virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
90 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
91 : : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
92 : : virtual void SAL_CALL acquire( ) throw ();
93 : : virtual void SAL_CALL release( ) throw ();
94 : :
95 : : protected:
96 : : virtual void addCustomHandles( SdrHdlList& rHandlerList );
97 : : virtual bool getContext( SdrViewContext& rContext );
98 : : virtual void disposing();
99 : : virtual void deselect();
100 : :
101 : : void updatePathAttributes();
102 : : void selectionChanged();
103 : :
104 : : private:
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;
111 : : SdrMark* mpMark;
112 : : rtl::OUString msLastPath;
113 : : bool mbInUpdatePath;
114 : : };
115 : :
116 : : } // end of namespace sd
117 : :
118 : : #endif // _SD_MOTIONPATHTAG_HXX_
119 : :
120 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|