office-gobmx/sd/source/ui/func/fudspord.cxx
Rüdiger Timm 2599f78b43 INTEGRATION: CWS changefileheader (1.8.298); FILE MERGED
2008/04/01 15:34:33 thb 1.8.298.3: #i85898# Stripping all external header guards
2008/04/01 12:38:53 thb 1.8.298.2: #i85898# Stripping all external header guards
2008/03/31 13:58:05 rt 1.8.298.1: #i87441# Change license header to LPGL v3.
2008-04-10 19:18:40 +00:00

197 lines
5 KiB
C++

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fudspord.cxx,v $
* $Revision: 1.9 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org 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 version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
#include "fudspord.hxx"
#include <svx/svxids.hrc>
#include <vcl/pointr.hxx>
#include "app.hrc"
#include "fupoor.hxx"
#include "ViewShell.hxx"
#include "View.hxx"
#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)
, mpRefObj(NULL)
, mpOverlay(0L)
{
}
/*************************************************************************
|*
|* Destruktor
|*
\************************************************************************/
FuDisplayOrder::~FuDisplayOrder()
{
implClearOverlay();
}
void FuDisplayOrder::implClearOverlay()
{
if(mpOverlay)
{
delete mpOverlay;
mpOverlay = 0L;
}
}
FunctionReference FuDisplayOrder::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
{
FunctionReference xFunc( new FuDisplayOrder( pViewSh, pWin, pView, pDoc, rReq ) );
return xFunc;
}
/*************************************************************************
|*
|* 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( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
if ( mpView->PickObj(aPnt, pPickObj, pPV) )
{
if (mpRefObj != pPickObj)
{
// delete current overlay
implClearOverlay();
// create new one
mpOverlay = new SdrDropMarkerOverlay(*mpView, *pPickObj);
// remember referenced object
mpRefObj = pPickObj;
}
}
else
{
mpRefObj = NULL;
implClearOverlay();
}
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( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
if ( mpView->PickObj(aPnt, mpRefObj, pPV) )
{
if (nSlotId == SID_BEFORE_OBJ)
{
mpView->PutMarkedInFrontOfObj(mpRefObj);
}
else
{
mpView->PutMarkedBehindObj(mpRefObj);
}
}
mpViewShell->Cancel();
return TRUE;
}
/*************************************************************************
|*
|* Function aktivieren
|*
\************************************************************************/
void FuDisplayOrder::Activate()
{
maPtr = mpWindow->GetPointer();
mpWindow->SetPointer( Pointer( POINTER_REFHAND ) );
}
/*************************************************************************
|*
|* Function deaktivieren
|*
\************************************************************************/
void FuDisplayOrder::Deactivate()
{
mpWindow->SetPointer( maPtr );
}
} // end of namespace sd