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 <vcl/ptrstyle.hxx>
26 #include <ViewShell.hxx>
33 FuDisplayOrder::FuDisplayOrder( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
34 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
)
35 , maPtr(PointerStyle::Arrow
)
40 FuDisplayOrder::~FuDisplayOrder()
44 void FuDisplayOrder::implClearOverlay()
49 rtl::Reference
<FuPoor
> FuDisplayOrder::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
51 rtl::Reference
<FuPoor
> xFunc( new FuDisplayOrder( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
55 bool FuDisplayOrder::MouseButtonDown(const MouseEvent
& rMEvt
)
57 // remember button state for creation of own MouseEvents
58 SetMouseButtonCode(rMEvt
.GetButtons());
63 bool FuDisplayOrder::MouseMove(const MouseEvent
& rMEvt
)
66 Point
aPnt( mpWindow
->PixelToLogic( rMEvt
.GetPosPixel() ) );
68 SdrObject
* pPickObj
= mpView
->PickObj(aPnt
, mpView
->getHitTolLog(), pPV
);
71 if (mpRefObj
!= pPickObj
)
73 // delete current overlay
77 mpOverlay
.reset( new SdrDropMarkerOverlay(*mpView
, *pPickObj
) );
79 // remember referenced object
92 bool FuDisplayOrder::MouseButtonUp(const MouseEvent
& rMEvt
)
94 // remember button state for creation of own MouseEvents
95 SetMouseButtonCode(rMEvt
.GetButtons());
97 SdrPageView
* pPV
= nullptr;
98 Point
aPnt( mpWindow
->PixelToLogic( rMEvt
.GetPosPixel() ) );
100 mpRefObj
= mpView
->PickObj(aPnt
, mpView
->getHitTolLog(), pPV
);
103 if (nSlotId
== SID_BEFORE_OBJ
)
105 mpView
->PutMarkedInFrontOfObj(mpRefObj
);
109 mpView
->PutMarkedBehindObj(mpRefObj
);
113 mpViewShell
->Cancel();
118 void FuDisplayOrder::Activate()
120 maPtr
= mpWindow
->GetPointer();
121 mpWindow
->SetPointer( PointerStyle::RefHand
);
124 void FuDisplayOrder::Deactivate()
126 mpWindow
->SetPointer( maPtr
);
129 } // end of namespace sd
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */