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>
35 FuDisplayOrder::FuDisplayOrder( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
36 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
)
42 FuDisplayOrder::~FuDisplayOrder()
47 void FuDisplayOrder::implClearOverlay()
56 rtl::Reference
<FuPoor
> FuDisplayOrder::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
58 rtl::Reference
<FuPoor
> xFunc( new FuDisplayOrder( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
62 bool FuDisplayOrder::MouseButtonDown(const MouseEvent
& rMEvt
)
64 // remember button state for creation of own MouseEvents
65 SetMouseButtonCode(rMEvt
.GetButtons());
70 bool FuDisplayOrder::MouseMove(const MouseEvent
& rMEvt
)
73 Point
aPnt( mpWindow
->PixelToLogic( rMEvt
.GetPosPixel() ) );
75 SdrObject
* pPickObj
= mpView
->PickObj(aPnt
, mpView
->getHitTolLog(), pPV
);
78 if (mpRefObj
!= pPickObj
)
80 // delete current overlay
84 mpOverlay
= new SdrDropMarkerOverlay(*mpView
, *pPickObj
);
86 // remember referenced object
99 bool FuDisplayOrder::MouseButtonUp(const MouseEvent
& rMEvt
)
101 // remember button state for creation of own MouseEvents
102 SetMouseButtonCode(rMEvt
.GetButtons());
104 SdrPageView
* pPV
= nullptr;
105 Point
aPnt( mpWindow
->PixelToLogic( rMEvt
.GetPosPixel() ) );
107 mpRefObj
= mpView
->PickObj(aPnt
, mpView
->getHitTolLog(), pPV
);
110 if (nSlotId
== SID_BEFORE_OBJ
)
112 mpView
->PutMarkedInFrontOfObj(mpRefObj
);
116 mpView
->PutMarkedBehindObj(mpRefObj
);
120 mpViewShell
->Cancel();
125 void FuDisplayOrder::Activate()
127 maPtr
= mpWindow
->GetPointer();
128 mpWindow
->SetPointer( Pointer( PointerStyle::RefHand
) );
131 void FuDisplayOrder::Deactivate()
133 mpWindow
->SetPointer( maPtr
);
136 } // end of namespace sd
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */