1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _REPORT_RPTUIFUNC_HXX
24 #define _REPORT_RPTUIFUNC_HXX
25 
26 #include <vcl/timer.hxx>
27 
28 class Timer;
29 class MouseEvent;
30 class Point;
31 class SdrTextObj;
32 class SdrObject;
33 namespace rptui
34 {
35 
36 class OReportSection;
37 class OSectionView;
38 
39 //============================================================================
40 // DlgEdFunc
41 //============================================================================
42 
43 class DlgEdFunc /* : public LinkHdl */
44 {
45     DlgEdFunc(const DlgEdFunc&);
46     void operator =(const DlgEdFunc&);
47 protected:
48 	OReportSection* m_pParent;
49     OSectionView&   m_rView;
50 	Timer			aScrollTimer;
51     Point           m_aMDPos;
52     com::sun::star::uno::Reference<com::sun::star::uno::XInterface> m_xOverlappingObj;
53     SdrObject *     m_pOverlappingObj;
54     sal_Int32       m_nOverlappedControlColor;
55     sal_Int32       m_nOldColor;
56 	bool            m_bSelectionMode;
57     bool            m_bUiActive;
58     bool            m_bShowPropertyBrowser;
59 
60 	DECL_LINK( ScrollTimeout, Timer * );
61 	void	ForceScroll( const Point& rPos );
62     /** checks that no other object is overlapped.
63     *
64     * \param rMEvt
65     */
66     void    checkMovementAllowed(const MouseEvent& rMEvt);
67 
68     /** sets the correct mouse pointer when moving a object
69     *
70     * \param rMEvt
71     * \return <TRUE/> when the pointer was already set.
72     */
73     bool    setMovementPointer(const MouseEvent& rMEvt);
74 
75     bool    isRectangleHit(const MouseEvent& rMEvt);
76 	/**
77 		returns true, as long as only customshapes in the marked list,
78 		custom shapes can drop every where
79 	*/
80 	bool    isOnlyCustomShapeMarked();
81 
82     /** activate object if it is of type OBJ_OLE2
83     */
84     void    activateOle(SdrObject* _pObj);
85 
86     void checkTwoCklicks(const MouseEvent& rMEvt);
87 
88 public:
89 	DlgEdFunc( OReportSection* pParent );
90 	virtual ~DlgEdFunc();
91 
92 	virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
93 	virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt );
94 	virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
95 
96 	/** checks if the keycode is known by the child windows
97 		@param	_rCode	the keycode
98 		@return <TRUE/> if the keycode is handled otherwise <FALSE/>
99 	*/
100 	virtual sal_Bool	handleKeyEvent(const KeyEvent& _rEvent);
101 
102     /** returns <TRUE/> if the mouse event is over an existing object
103     *
104     * \param rMEvt
105     * \return <TRUE/> if overlapping, otherwise <FALSE/>
106     */
107     bool isOverlapping(const MouseEvent& rMEvt);
108     void setOverlappedControlColor(sal_Int32 _nColor);
109     void stopScrollTimer();
110 
111     /** deactivate all ole object
112     */
113     void    deactivateOle(bool _bSelect = false);
114 
isUiActive() const115     inline bool isUiActive() const { return m_bUiActive; }
116 protected:
117     void colorizeOverlappedObject(SdrObject* _pOverlappedObj);
118     void unColorizeOverlappedObj();
119 
120 
121 };
122 
123 //============================================================================
124 // DlgEdFuncInsert
125 //============================================================================
126 
127 class DlgEdFuncInsert : public DlgEdFunc
128 {
129 public:
130 	DlgEdFuncInsert( OReportSection* pParent );
131 	~DlgEdFuncInsert();
132 
133 	virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
134 	virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt );
135 	virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
136 };
137 
138 //============================================================================
139 // DlgEdFuncSelect
140 //============================================================================
141 
142 class DlgEdFuncSelect : public DlgEdFunc
143 {
144 public:
145 	DlgEdFuncSelect( OReportSection* pParent );
146 	~DlgEdFuncSelect();
147 
148 	virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
149 	virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt );
150 	virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
151 
152     void SetInEditMode(SdrTextObj* _pTextObj,const MouseEvent& rMEvt, sal_Bool bQuickDrag);
153 };
154 
155 }
156 #endif //_REPORT_RPTUIFUNC_HXX
157