1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _REPORT_RPTUIFUNC_HXX
28 #define _REPORT_RPTUIFUNC_HXX
29 
30 #include <vcl/timer.hxx>
31 
32 class Timer;
33 class MouseEvent;
34 class Point;
35 class SdrTextObj;
36 class SdrObject;
37 namespace rptui
38 {
39 
40 class OReportSection;
41 class OSectionView;
42 
43 //============================================================================
44 // DlgEdFunc
45 //============================================================================
46 
47 class DlgEdFunc /* : public LinkHdl */
48 {
49     DlgEdFunc(const DlgEdFunc&);
50     void operator =(const DlgEdFunc&);
51 protected:
52 	OReportSection* m_pParent;
53     OSectionView&   m_rView;
54 	Timer			aScrollTimer;
55     Point           m_aMDPos;
56     com::sun::star::uno::Reference<com::sun::star::uno::XInterface> m_xOverlappingObj;
57     SdrObject *     m_pOverlappingObj;
58     sal_Int32       m_nOverlappedControlColor;
59     sal_Int32       m_nOldColor;
60 	bool            m_bSelectionMode;
61     bool            m_bUiActive;
62     bool            m_bShowPropertyBrowser;
63 
64 	DECL_LINK( ScrollTimeout, Timer * );
65 	void	ForceScroll( const Point& rPos );
66     /** checks that no other object is overlapped.
67     *
68     * \param rMEvt
69     */
70     void    checkMovementAllowed(const MouseEvent& rMEvt);
71 
72     /** sets the correct mouse pointer when moving a object
73     *
74     * \param rMEvt
75     * \return <TRUE/> when the pointer was already set.
76     */
77     bool    setMovementPointer(const MouseEvent& rMEvt);
78 
79     bool    isRectangleHit(const MouseEvent& rMEvt);
80 	/**
81 		returns true, as long as only customshapes in the marked list,
82 		custom shapes can drop every where
83 	*/
84 	bool    isOnlyCustomShapeMarked();
85 
86     /** activate object if it is of type OBJ_OLE2
87     */
88     void    activateOle(SdrObject* _pObj);
89 
90     void checkTwoCklicks(const MouseEvent& rMEvt);
91 
92 public:
93 	DlgEdFunc( OReportSection* pParent );
94 	virtual ~DlgEdFunc();
95 
96 	virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
97 	virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt );
98 	virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
99 
100 	/** checks if the keycode is known by the child windows
101 		@param	_rCode	the keycode
102 		@return <TRUE/> if the keycode is handled otherwise <FALSE/>
103 	*/
104 	virtual sal_Bool	handleKeyEvent(const KeyEvent& _rEvent);
105 
106     /** returns <TRUE/> if the mouse event is over an existing object
107     *
108     * \param rMEvt
109     * \return <TRUE/> if overlapping, otherwise <FALSE/>
110     */
111     bool isOverlapping(const MouseEvent& rMEvt);
112     void setOverlappedControlColor(sal_Int32 _nColor);
113     void stopScrollTimer();
114 
115     /** deactivate all ole object
116     */
117     void    deactivateOle(bool _bSelect = false);
118 
119     inline bool isUiActive() const { return m_bUiActive; }
120 protected:
121     void colorizeOverlappedObject(SdrObject* _pOverlappedObj);
122     void unColorizeOverlappedObj();
123 
124 
125 };
126 
127 //============================================================================
128 // DlgEdFuncInsert
129 //============================================================================
130 
131 class DlgEdFuncInsert : public DlgEdFunc
132 {
133 public:
134 	DlgEdFuncInsert( OReportSection* pParent );
135 	~DlgEdFuncInsert();
136 
137 	virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
138 	virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt );
139 	virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
140 };
141 
142 //============================================================================
143 // DlgEdFuncSelect
144 //============================================================================
145 
146 class DlgEdFuncSelect : public DlgEdFunc
147 {
148 public:
149 	DlgEdFuncSelect( OReportSection* pParent );
150 	~DlgEdFuncSelect();
151 
152 	virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt );
153 	virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt );
154 	virtual sal_Bool MouseMove( const MouseEvent& rMEvt );
155 
156     void SetInEditMode(SdrTextObj* _pTextObj,const MouseEvent& rMEvt, sal_Bool bQuickDrag);
157 };
158 
159 }
160 #endif //_REPORT_RPTUIFUNC_HXX
161