Update ooo320-m1
[ooovba.git] / sd / source / ui / func / fudspord.cxx
blob0f9b61a381fa24116b8fda4c4fab8b7edf6ac6e1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fudspord.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
36 #include "fudspord.hxx"
38 #include <svx/svxids.hrc>
39 #include <vcl/pointr.hxx>
41 #include "app.hrc"
42 #include "fupoor.hxx"
43 #include "ViewShell.hxx"
44 #include "View.hxx"
45 #ifndef SD_WINDOW_SHELL_HXX
46 #include "Window.hxx"
47 #endif
48 #include "drawdoc.hxx"
50 namespace sd {
52 TYPEINIT1( FuDisplayOrder, FuPoor );
54 /*************************************************************************
56 |* Konstruktor
58 \************************************************************************/
60 FuDisplayOrder::FuDisplayOrder( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq)
61 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
62 , mpRefObj(NULL)
63 , mpOverlay(0L)
67 /*************************************************************************
69 |* Destruktor
71 \************************************************************************/
73 FuDisplayOrder::~FuDisplayOrder()
75 implClearOverlay();
78 void FuDisplayOrder::implClearOverlay()
80 if(mpOverlay)
82 delete mpOverlay;
83 mpOverlay = 0L;
87 FunctionReference FuDisplayOrder::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
89 FunctionReference xFunc( new FuDisplayOrder( pViewSh, pWin, pView, pDoc, rReq ) );
90 return xFunc;
93 /*************************************************************************
95 |* MouseButtonDown-event
97 \************************************************************************/
99 BOOL FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt)
101 // #95491# remember button state for creation of own MouseEvents
102 SetMouseButtonCode(rMEvt.GetButtons());
104 return TRUE;
107 /*************************************************************************
109 |* MouseMove-event
111 \************************************************************************/
113 BOOL FuDisplayOrder::MouseMove(const MouseEvent& rMEvt)
115 SdrObject* pPickObj;
116 SdrPageView* pPV;
117 Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
119 if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), pPickObj, pPV) )
121 if (mpRefObj != pPickObj)
123 // delete current overlay
124 implClearOverlay();
126 // create new one
127 mpOverlay = new SdrDropMarkerOverlay(*mpView, *pPickObj);
129 // remember referenced object
130 mpRefObj = pPickObj;
133 else
135 mpRefObj = NULL;
136 implClearOverlay();
139 return TRUE;
142 /*************************************************************************
144 |* MouseButtonUp-event
146 \************************************************************************/
148 BOOL FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt)
150 // #95491# remember button state for creation of own MouseEvents
151 SetMouseButtonCode(rMEvt.GetButtons());
153 SdrPageView* pPV = NULL;
154 Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
156 if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), mpRefObj, pPV) )
158 if (nSlotId == SID_BEFORE_OBJ)
160 mpView->PutMarkedInFrontOfObj(mpRefObj);
162 else
164 mpView->PutMarkedBehindObj(mpRefObj);
168 mpViewShell->Cancel();
170 return TRUE;
173 /*************************************************************************
175 |* Function aktivieren
177 \************************************************************************/
179 void FuDisplayOrder::Activate()
181 maPtr = mpWindow->GetPointer();
182 mpWindow->SetPointer( Pointer( POINTER_REFHAND ) );
185 /*************************************************************************
187 |* Function deaktivieren
189 \************************************************************************/
191 void FuDisplayOrder::Deactivate()
193 mpWindow->SetPointer( maPtr );
197 } // end of namespace sd