Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "fudspord.hxx"
30 : :
31 : : #include <svx/svxids.hrc>
32 : : #include <vcl/pointr.hxx>
33 : :
34 : : #include "app.hrc"
35 : : #include "fupoor.hxx"
36 : : #include "ViewShell.hxx"
37 : : #include "View.hxx"
38 : : #include "Window.hxx"
39 : : #include "drawdoc.hxx"
40 : :
41 : : namespace sd {
42 : :
43 [ # # ][ # # ]: 0 : TYPEINIT1( FuDisplayOrder, FuPoor );
44 : :
45 : : /*************************************************************************
46 : : |*
47 : : |* Konstruktor
48 : : |*
49 : : \************************************************************************/
50 : :
51 : 0 : FuDisplayOrder::FuDisplayOrder( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq)
52 : : : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
53 : : , mpRefObj(NULL)
54 : 0 : , mpOverlay(0L)
55 : : {
56 : 0 : }
57 : :
58 : : /*************************************************************************
59 : : |*
60 : : |* Destruktor
61 : : |*
62 : : \************************************************************************/
63 : :
64 : 0 : FuDisplayOrder::~FuDisplayOrder()
65 : : {
66 [ # # ]: 0 : implClearOverlay();
67 [ # # ]: 0 : }
68 : :
69 : 0 : void FuDisplayOrder::implClearOverlay()
70 : : {
71 [ # # ]: 0 : if(mpOverlay)
72 : : {
73 [ # # ]: 0 : delete mpOverlay;
74 : 0 : mpOverlay = 0L;
75 : : }
76 : 0 : }
77 : :
78 : 0 : FunctionReference FuDisplayOrder::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
79 : : {
80 [ # # ][ # # ]: 0 : FunctionReference xFunc( new FuDisplayOrder( pViewSh, pWin, pView, pDoc, rReq ) );
81 : 0 : return xFunc;
82 : : }
83 : :
84 : : /*************************************************************************
85 : : |*
86 : : |* MouseButtonDown-event
87 : : |*
88 : : \************************************************************************/
89 : :
90 : 0 : sal_Bool FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt)
91 : : {
92 : : // remember button state for creation of own MouseEvents
93 : 0 : SetMouseButtonCode(rMEvt.GetButtons());
94 : :
95 : 0 : return sal_True;
96 : : }
97 : :
98 : : /*************************************************************************
99 : : |*
100 : : |* MouseMove-event
101 : : |*
102 : : \************************************************************************/
103 : :
104 : 0 : sal_Bool FuDisplayOrder::MouseMove(const MouseEvent& rMEvt)
105 : : {
106 : : SdrObject* pPickObj;
107 : : SdrPageView* pPV;
108 [ # # ]: 0 : Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
109 : :
110 [ # # ][ # # ]: 0 : if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), pPickObj, pPV) )
111 : : {
112 [ # # ]: 0 : if (mpRefObj != pPickObj)
113 : : {
114 : : // delete current overlay
115 [ # # ]: 0 : implClearOverlay();
116 : :
117 : : // create new one
118 [ # # ][ # # ]: 0 : mpOverlay = new SdrDropMarkerOverlay(*mpView, *pPickObj);
119 : :
120 : : // remember referenced object
121 : 0 : mpRefObj = pPickObj;
122 : : }
123 : : }
124 : : else
125 : : {
126 : 0 : mpRefObj = NULL;
127 [ # # ]: 0 : implClearOverlay();
128 : : }
129 : :
130 : 0 : return sal_True;
131 : : }
132 : :
133 : : /*************************************************************************
134 : : |*
135 : : |* MouseButtonUp-event
136 : : |*
137 : : \************************************************************************/
138 : :
139 : 0 : sal_Bool FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt)
140 : : {
141 : : // remember button state for creation of own MouseEvents
142 : 0 : SetMouseButtonCode(rMEvt.GetButtons());
143 : :
144 : 0 : SdrPageView* pPV = NULL;
145 [ # # ]: 0 : Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
146 : :
147 [ # # ][ # # ]: 0 : if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), mpRefObj, pPV) )
148 : : {
149 [ # # ]: 0 : if (nSlotId == SID_BEFORE_OBJ)
150 : : {
151 [ # # ]: 0 : mpView->PutMarkedInFrontOfObj(mpRefObj);
152 : : }
153 : : else
154 : : {
155 [ # # ]: 0 : mpView->PutMarkedBehindObj(mpRefObj);
156 : : }
157 : : }
158 : :
159 [ # # ]: 0 : mpViewShell->Cancel();
160 : :
161 : 0 : return sal_True;
162 : : }
163 : :
164 : : /*************************************************************************
165 : : |*
166 : : |* Function aktivieren
167 : : |*
168 : : \************************************************************************/
169 : :
170 : 0 : void FuDisplayOrder::Activate()
171 : : {
172 : 0 : maPtr = mpWindow->GetPointer();
173 [ # # ]: 0 : mpWindow->SetPointer( Pointer( POINTER_REFHAND ) );
174 : 0 : }
175 : :
176 : : /*************************************************************************
177 : : |*
178 : : |* Function deaktivieren
179 : : |*
180 : : \************************************************************************/
181 : :
182 : 0 : void FuDisplayOrder::Deactivate()
183 : : {
184 : 0 : mpWindow->SetPointer( maPtr );
185 : 0 : }
186 : :
187 : :
188 : : } // end of namespace sd
189 : :
190 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|