1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "fudspord.hxx"
22 #include <svx/svxids.hrc>
23 #include <vcl/pointr.hxx>
27 #include "ViewShell.hxx"
30 #include "drawdoc.hxx"
34 TYPEINIT1( FuDisplayOrder
, FuPoor
);
37 FuDisplayOrder::FuDisplayOrder( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
38 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
)
45 FuDisplayOrder::~FuDisplayOrder()
50 void FuDisplayOrder::implClearOverlay()
59 FunctionReference
FuDisplayOrder::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
61 FunctionReference
xFunc( new FuDisplayOrder( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
66 sal_Bool
FuDisplayOrder::MouseButtonDown(const MouseEvent
& rMEvt
)
68 // remember button state for creation of own MouseEvents
69 SetMouseButtonCode(rMEvt
.GetButtons());
75 sal_Bool
FuDisplayOrder::MouseMove(const MouseEvent
& rMEvt
)
79 Point
aPnt( mpWindow
->PixelToLogic( rMEvt
.GetPosPixel() ) );
81 if ( mpView
->PickObj(aPnt
, mpView
->getHitTolLog(), pPickObj
, pPV
) )
83 if (mpRefObj
!= pPickObj
)
85 // delete current overlay
89 mpOverlay
= new SdrDropMarkerOverlay(*mpView
, *pPickObj
);
91 // remember referenced object
105 sal_Bool
FuDisplayOrder::MouseButtonUp(const MouseEvent
& rMEvt
)
107 // remember button state for creation of own MouseEvents
108 SetMouseButtonCode(rMEvt
.GetButtons());
110 SdrPageView
* pPV
= NULL
;
111 Point
aPnt( mpWindow
->PixelToLogic( rMEvt
.GetPosPixel() ) );
113 if ( mpView
->PickObj(aPnt
, mpView
->getHitTolLog(), mpRefObj
, pPV
) )
115 if (nSlotId
== SID_BEFORE_OBJ
)
117 mpView
->PutMarkedInFrontOfObj(mpRefObj
);
121 mpView
->PutMarkedBehindObj(mpRefObj
);
125 mpViewShell
->Cancel();
131 void FuDisplayOrder::Activate()
133 maPtr
= mpWindow
->GetPointer();
134 mpWindow
->SetPointer( Pointer( POINTER_REFHAND
) );
138 void FuDisplayOrder::Deactivate()
140 mpWindow
->SetPointer( maPtr
);
144 } // end of namespace sd
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */