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
);
36 FuDisplayOrder::FuDisplayOrder( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
37 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
)
43 FuDisplayOrder::~FuDisplayOrder()
48 void FuDisplayOrder::implClearOverlay()
57 rtl::Reference
<FuPoor
> FuDisplayOrder::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
59 rtl::Reference
<FuPoor
> xFunc( new FuDisplayOrder( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
63 bool FuDisplayOrder::MouseButtonDown(const MouseEvent
& rMEvt
)
65 // remember button state for creation of own MouseEvents
66 SetMouseButtonCode(rMEvt
.GetButtons());
71 bool FuDisplayOrder::MouseMove(const MouseEvent
& rMEvt
)
75 Point
aPnt( mpWindow
->PixelToLogic( rMEvt
.GetPosPixel() ) );
77 if ( mpView
->PickObj(aPnt
, mpView
->getHitTolLog(), pPickObj
, pPV
) )
79 if (mpRefObj
!= pPickObj
)
81 // delete current overlay
85 mpOverlay
= new SdrDropMarkerOverlay(*mpView
, *pPickObj
);
87 // remember referenced object
100 bool FuDisplayOrder::MouseButtonUp(const MouseEvent
& rMEvt
)
102 // remember button state for creation of own MouseEvents
103 SetMouseButtonCode(rMEvt
.GetButtons());
105 SdrPageView
* pPV
= NULL
;
106 Point
aPnt( mpWindow
->PixelToLogic( rMEvt
.GetPosPixel() ) );
108 if ( mpView
->PickObj(aPnt
, mpView
->getHitTolLog(), mpRefObj
, 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: */