Line data Source code
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 <svx/svxids.hrc>
23 : #include <vcl/pointr.hxx>
24 :
25 : #include "app.hrc"
26 : #include "fupoor.hxx"
27 : #include "ViewShell.hxx"
28 : #include "View.hxx"
29 : #include "Window.hxx"
30 : #include "drawdoc.hxx"
31 :
32 : namespace sd {
33 :
34 0 : TYPEINIT1( FuDisplayOrder, FuPoor );
35 :
36 :
37 0 : FuDisplayOrder::FuDisplayOrder( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq)
38 : : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
39 : , mpRefObj(NULL)
40 0 : , mpOverlay(0L)
41 : {
42 0 : }
43 :
44 :
45 0 : FuDisplayOrder::~FuDisplayOrder()
46 : {
47 0 : implClearOverlay();
48 0 : }
49 :
50 0 : void FuDisplayOrder::implClearOverlay()
51 : {
52 0 : if(mpOverlay)
53 : {
54 0 : delete mpOverlay;
55 0 : mpOverlay = 0L;
56 : }
57 0 : }
58 :
59 0 : rtl::Reference<FuPoor> FuDisplayOrder::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
60 : {
61 0 : rtl::Reference<FuPoor> xFunc( new FuDisplayOrder( pViewSh, pWin, pView, pDoc, rReq ) );
62 0 : return xFunc;
63 : }
64 :
65 :
66 0 : sal_Bool FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt)
67 : {
68 : // remember button state for creation of own MouseEvents
69 0 : SetMouseButtonCode(rMEvt.GetButtons());
70 :
71 0 : return sal_True;
72 : }
73 :
74 :
75 0 : sal_Bool FuDisplayOrder::MouseMove(const MouseEvent& rMEvt)
76 : {
77 : SdrObject* pPickObj;
78 : SdrPageView* pPV;
79 0 : Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
80 :
81 0 : if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), pPickObj, pPV) )
82 : {
83 0 : if (mpRefObj != pPickObj)
84 : {
85 : // delete current overlay
86 0 : implClearOverlay();
87 :
88 : // create new one
89 0 : mpOverlay = new SdrDropMarkerOverlay(*mpView, *pPickObj);
90 :
91 : // remember referenced object
92 0 : mpRefObj = pPickObj;
93 : }
94 : }
95 : else
96 : {
97 0 : mpRefObj = NULL;
98 0 : implClearOverlay();
99 : }
100 :
101 0 : return sal_True;
102 : }
103 :
104 :
105 0 : sal_Bool FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt)
106 : {
107 : // remember button state for creation of own MouseEvents
108 0 : SetMouseButtonCode(rMEvt.GetButtons());
109 :
110 0 : SdrPageView* pPV = NULL;
111 0 : Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
112 :
113 0 : if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), mpRefObj, pPV) )
114 : {
115 0 : if (nSlotId == SID_BEFORE_OBJ)
116 : {
117 0 : mpView->PutMarkedInFrontOfObj(mpRefObj);
118 : }
119 : else
120 : {
121 0 : mpView->PutMarkedBehindObj(mpRefObj);
122 : }
123 : }
124 :
125 0 : mpViewShell->Cancel();
126 :
127 0 : return sal_True;
128 : }
129 :
130 :
131 0 : void FuDisplayOrder::Activate()
132 : {
133 0 : maPtr = mpWindow->GetPointer();
134 0 : mpWindow->SetPointer( Pointer( POINTER_REFHAND ) );
135 0 : }
136 :
137 :
138 0 : void FuDisplayOrder::Deactivate()
139 : {
140 0 : mpWindow->SetPointer( maPtr );
141 0 : }
142 :
143 :
144 : } // end of namespace sd
145 :
146 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|