bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / func / fudspord.cxx
blobf129c523ccb444f6a2dd67e59145d0d82d67facd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
24 #include <app.hrc>
25 #include <fupoor.hxx>
26 #include <ViewShell.hxx>
27 #include <View.hxx>
28 #include <Window.hxx>
30 namespace sd {
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)
36 , mpRefObj(nullptr)
40 FuDisplayOrder::~FuDisplayOrder()
44 void FuDisplayOrder::implClearOverlay()
46 mpOverlay.reset();
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 ) );
52 return xFunc;
55 bool FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt)
57 // remember button state for creation of own MouseEvents
58 SetMouseButtonCode(rMEvt.GetButtons());
60 return true;
63 bool FuDisplayOrder::MouseMove(const MouseEvent& rMEvt)
65 SdrPageView* pPV;
66 Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
68 SdrObject* pPickObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV);
69 if (pPickObj)
71 if (mpRefObj != pPickObj)
73 // delete current overlay
74 implClearOverlay();
76 // create new one
77 mpOverlay.reset( new SdrDropMarkerOverlay(*mpView, *pPickObj) );
79 // remember referenced object
80 mpRefObj = pPickObj;
83 else
85 mpRefObj = nullptr;
86 implClearOverlay();
89 return true;
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);
101 if (mpRefObj)
103 if (nSlotId == SID_BEFORE_OBJ)
105 mpView->PutMarkedInFrontOfObj(mpRefObj);
107 else
109 mpView->PutMarkedBehindObj(mpRefObj);
113 mpViewShell->Cancel();
115 return true;
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: */