office-gobmx/sd/source/ui/func/fudspord.cxx

207 lines
5.1 KiB
C++
Raw Normal View History

2000-09-18 11:07:07 -05:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 11:07:07 -05:00
*
* $RCSfile: fudspord.cxx,v $
2000-09-18 11:07:07 -05:00
*
* $Revision: 1.4 $
2000-09-18 11:07:07 -05:00
*
* last change: $Author: rt $ $Date: 2005-09-09 04:41:57 $
2000-09-18 11:07:07 -05:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
2000-09-18 11:07:07 -05:00
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
2000-09-18 11:07:07 -05:00
*
* 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.
2000-09-18 11:07:07 -05:00
*
* 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.
2000-09-18 11:07:07 -05:00
*
* 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
2000-09-18 11:07:07 -05:00
*
************************************************************************/
#pragma hdrstop
#include "fudspord.hxx"
2000-09-18 11:07:07 -05:00
#include <svx/svxids.hrc>
#ifndef _VCL_POINTR_HXX //autogen
#include <vcl/pointr.hxx>
#endif
#include "app.hrc"
#ifndef SD_FU_POOR_HXX
2000-09-18 11:07:07 -05:00
#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
2000-09-18 11:07:07 -05:00
#include "drawdoc.hxx"
namespace sd {
2000-09-18 11:07:07 -05:00
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)
2000-09-18 11:07:07 -05:00
{
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());
2000-09-18 11:07:07 -05:00
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());
2000-09-18 11:07:07 -05:00
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