/************************************************************************* * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: fudspord.cxx,v $ * * $Revision: 1.4 $ * * last change: $Author: rt $ $Date: 2005-09-09 04:41:57 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. * * * GNU Lesser General Public License Version 2.1 * ============================================= * Copyright 2005 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * ************************************************************************/ #pragma hdrstop #include "fudspord.hxx" #include #ifndef _VCL_POINTR_HXX //autogen #include #endif #include "app.hrc" #ifndef SD_FU_POOR_HXX #include "fupoor.hxx" #endif #ifndef SD_VIEW_SHELL_HXX #include "ViewShell.hxx" #endif #ifndef SD_VIEW_HXX #include "View.hxx" #endif #ifndef SD_WINDOW_SHELL_HXX #include "Window.hxx" #endif #include "drawdoc.hxx" namespace sd { TYPEINIT1( FuDisplayOrder, FuPoor ); /************************************************************************* |* |* Konstruktor |* \************************************************************************/ FuDisplayOrder::FuDisplayOrder ( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq) : FuPoor(pViewSh, pWin, pView, pDoc, rReq), pUserMarker(NULL), pRefObj(NULL) { pUserMarker = new SdrViewUserMarker(pView); } /************************************************************************* |* |* Destruktor |* \************************************************************************/ FuDisplayOrder::~FuDisplayOrder() { delete pUserMarker; } /************************************************************************* |* |* MouseButtonDown-event |* \************************************************************************/ BOOL FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt) { // #95491# remember button state for creation of own MouseEvents SetMouseButtonCode(rMEvt.GetButtons()); return TRUE; } /************************************************************************* |* |* MouseMove-event |* \************************************************************************/ BOOL FuDisplayOrder::MouseMove(const MouseEvent& rMEvt) { SdrObject* pPickObj; SdrPageView* pPV; Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); USHORT nHitLog = USHORT ( pWindow->PixelToLogic(Size(HITPIX,0)).Width() ); if ( pView->PickObj(aPnt, pPickObj, pPV) ) { if (pRefObj != pPickObj) { pRefObj = pPickObj; pUserMarker->SetXPolyPolygon(pRefObj, pView->GetPageViewPvNum(0)); pUserMarker->Show(); } } else { pRefObj = NULL; pUserMarker->Hide(); } return TRUE; } /************************************************************************* |* |* MouseButtonUp-event |* \************************************************************************/ BOOL FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt) { // #95491# remember button state for creation of own MouseEvents SetMouseButtonCode(rMEvt.GetButtons()); SdrPageView* pPV = NULL; Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); USHORT nHitLog = USHORT ( pWindow->PixelToLogic(Size(HITPIX,0)).Width() ); if ( pView->PickObj(aPnt, pRefObj, pPV) ) { if (nSlotId == SID_BEFORE_OBJ) { pView->PutMarkedInFrontOfObj(pRefObj); } else { pView->PutMarkedBehindObj(pRefObj); } } pViewShell->Cancel(); return TRUE; } /************************************************************************* |* |* Function aktivieren |* \************************************************************************/ void FuDisplayOrder::Activate() { aPtr = pWindow->GetPointer(); pWindow->SetPointer( Pointer( POINTER_REFHAND ) ); if (pUserMarker) { pUserMarker->Show(); } } /************************************************************************* |* |* Function deaktivieren |* \************************************************************************/ void FuDisplayOrder::Deactivate() { if (pUserMarker) { pUserMarker->Hide(); } pWindow->SetPointer( aPtr ); } } // end of namespace sd