/src/libreoffice/sd/source/ui/func/fudspord.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include <fudspord.hxx> |
21 | | |
22 | | #include <vcl/ptrstyle.hxx> |
23 | | |
24 | | #include <app.hrc> |
25 | | #include <fupoor.hxx> |
26 | | #include <ViewShell.hxx> |
27 | | #include <View.hxx> |
28 | | #include <Window.hxx> |
29 | | |
30 | | namespace sd { |
31 | | |
32 | | |
33 | | FuDisplayOrder::FuDisplayOrder( ViewShell& rViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument& rDoc, SfxRequest& rReq) |
34 | 0 | : FuPoor(rViewSh, pWin, pView, rDoc, rReq) |
35 | 0 | , maPtr(PointerStyle::Arrow) |
36 | 0 | , mpRefObj(nullptr) |
37 | 0 | { |
38 | 0 | } |
39 | | |
40 | | FuDisplayOrder::~FuDisplayOrder() |
41 | 0 | { |
42 | 0 | } |
43 | | |
44 | | void FuDisplayOrder::implClearOverlay() |
45 | 0 | { |
46 | 0 | mpOverlay.reset(); |
47 | 0 | } |
48 | | |
49 | | rtl::Reference<FuPoor> FuDisplayOrder::Create( ViewShell& rViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument& rDoc, SfxRequest& rReq ) |
50 | 0 | { |
51 | 0 | rtl::Reference<FuPoor> xFunc( new FuDisplayOrder( rViewSh, pWin, pView, rDoc, rReq ) ); |
52 | 0 | return xFunc; |
53 | 0 | } |
54 | | |
55 | | bool FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt) |
56 | 0 | { |
57 | | // remember button state for creation of own MouseEvents |
58 | 0 | SetMouseButtonCode(rMEvt.GetButtons()); |
59 | |
|
60 | 0 | return true; |
61 | 0 | } |
62 | | |
63 | | bool FuDisplayOrder::MouseMove(const MouseEvent& rMEvt) |
64 | 0 | { |
65 | 0 | SdrPageView* pPV; |
66 | 0 | Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); |
67 | |
|
68 | 0 | SdrObject* pPickObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV); |
69 | 0 | if (pPickObj) |
70 | 0 | { |
71 | 0 | if (mpRefObj != pPickObj) |
72 | 0 | { |
73 | | // delete current overlay |
74 | 0 | implClearOverlay(); |
75 | | |
76 | | // create new one |
77 | 0 | mpOverlay.reset( new SdrDropMarkerOverlay(*mpView, *pPickObj) ); |
78 | | |
79 | | // remember referenced object |
80 | 0 | mpRefObj = pPickObj; |
81 | 0 | } |
82 | 0 | } |
83 | 0 | else |
84 | 0 | { |
85 | 0 | mpRefObj = nullptr; |
86 | 0 | implClearOverlay(); |
87 | 0 | } |
88 | |
|
89 | 0 | return true; |
90 | 0 | } |
91 | | |
92 | | bool FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt) |
93 | 0 | { |
94 | | // remember button state for creation of own MouseEvents |
95 | 0 | SetMouseButtonCode(rMEvt.GetButtons()); |
96 | |
|
97 | 0 | SdrPageView* pPV = nullptr; |
98 | 0 | Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); |
99 | |
|
100 | 0 | mpRefObj = mpView->PickObj(aPnt, mpView->getHitTolLog(), pPV); |
101 | 0 | if (mpRefObj) |
102 | 0 | { |
103 | 0 | if (nSlotId == SID_BEFORE_OBJ) |
104 | 0 | { |
105 | 0 | mpView->PutMarkedInFrontOfObj(mpRefObj); |
106 | 0 | } |
107 | 0 | else |
108 | 0 | { |
109 | 0 | mpView->PutMarkedBehindObj(mpRefObj); |
110 | 0 | } |
111 | 0 | } |
112 | |
|
113 | 0 | mrViewShell.Cancel(); |
114 | |
|
115 | 0 | return true; |
116 | 0 | } |
117 | | |
118 | | void FuDisplayOrder::Activate() |
119 | 0 | { |
120 | 0 | maPtr = mpWindow->GetPointer(); |
121 | 0 | mpWindow->SetPointer( PointerStyle::RefHand ); |
122 | 0 | } |
123 | | |
124 | | void FuDisplayOrder::Deactivate() |
125 | 0 | { |
126 | 0 | mpWindow->SetPointer( maPtr ); |
127 | 0 | } |
128 | | |
129 | | } // end of namespace sd |
130 | | |
131 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |