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 INCLUDED_SD_SOURCE_UI_ANIMATIONS_MOTIONPATHTAG_HXX
21 : #define INCLUDED_SD_SOURCE_UI_ANIMATIONS_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& ) SAL_OVERRIDE;
48 :
49 : /// @return true if the SmartTag consumes this event.
50 : virtual bool KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
51 :
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;
58 :
59 0 : const CustomAnimationEffectPtr& getEffect() const { return mpEffect; }
60 :
61 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
62 :
63 : // IPolyPolygonEditorController
64 : virtual void DeleteMarkedPoints() SAL_OVERRIDE;
65 : virtual bool IsDeleteMarkedPointsPossible() const SAL_OVERRIDE;
66 :
67 : virtual void RipUpAtMarkedPoints() SAL_OVERRIDE;
68 : virtual bool IsRipUpAtMarkedPointsPossible() const SAL_OVERRIDE;
69 :
70 : virtual bool IsSetMarkedSegmentsKindPossible() const SAL_OVERRIDE;
71 : virtual SdrPathSegmentKind GetMarkedSegmentsKind() const SAL_OVERRIDE;
72 : virtual void SetMarkedSegmentsKind(SdrPathSegmentKind eKind) SAL_OVERRIDE;
73 :
74 : virtual bool IsSetMarkedPointsSmoothPossible() const SAL_OVERRIDE;
75 : virtual SdrPathSmoothKind GetMarkedPointsSmooth() const SAL_OVERRIDE;
76 : virtual void SetMarkedPointsSmooth(SdrPathSmoothKind eKind) SAL_OVERRIDE;
77 :
78 : virtual void CloseMarkedObjects(bool bToggle, bool bOpen ) SAL_OVERRIDE;
79 : virtual bool IsOpenCloseMarkedObjectsPossible() const SAL_OVERRIDE;
80 : virtual SdrObjClosedKind GetMarkedObjectsClosedState() const SAL_OVERRIDE;
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, 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;
94 :
95 : protected:
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;
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 : OUString msLastPath;
113 : bool mbInUpdatePath;
114 : };
115 :
116 : } // end of namespace sd
117 :
118 : #endif // INCLUDED_SD_SOURCE_UI_ANIMATIONS_MOTIONPATHTAG_HXX
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|