bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / func / fudspord.cxx
blob4e7904eabfbac38ab6f634701c63657b471cce5a
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 <svx/svxids.hrc>
23 #include <vcl/pointr.hxx>
25 #include "app.hrc"
26 #include "fupoor.hxx"
27 #include "ViewShell.hxx"
28 #include "View.hxx"
29 #include "Window.hxx"
30 #include "drawdoc.hxx"
32 namespace sd {
34 TYPEINIT1( FuDisplayOrder, FuPoor );
37 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 , mpOverlay(0L)
45 FuDisplayOrder::~FuDisplayOrder()
47 implClearOverlay();
50 void FuDisplayOrder::implClearOverlay()
52 if(mpOverlay)
54 delete mpOverlay;
55 mpOverlay = 0L;
59 FunctionReference FuDisplayOrder::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
61 FunctionReference xFunc( new FuDisplayOrder( pViewSh, pWin, pView, pDoc, rReq ) );
62 return xFunc;
66 sal_Bool FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt)
68 // remember button state for creation of own MouseEvents
69 SetMouseButtonCode(rMEvt.GetButtons());
71 return sal_True;
75 sal_Bool FuDisplayOrder::MouseMove(const MouseEvent& rMEvt)
77 SdrObject* pPickObj;
78 SdrPageView* pPV;
79 Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
81 if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), pPickObj, pPV) )
83 if (mpRefObj != pPickObj)
85 // delete current overlay
86 implClearOverlay();
88 // create new one
89 mpOverlay = new SdrDropMarkerOverlay(*mpView, *pPickObj);
91 // remember referenced object
92 mpRefObj = pPickObj;
95 else
97 mpRefObj = NULL;
98 implClearOverlay();
101 return sal_True;
105 sal_Bool FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt)
107 // remember button state for creation of own MouseEvents
108 SetMouseButtonCode(rMEvt.GetButtons());
110 SdrPageView* pPV = NULL;
111 Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
113 if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), mpRefObj, pPV) )
115 if (nSlotId == SID_BEFORE_OBJ)
117 mpView->PutMarkedInFrontOfObj(mpRefObj);
119 else
121 mpView->PutMarkedBehindObj(mpRefObj);
125 mpViewShell->Cancel();
127 return sal_True;
131 void FuDisplayOrder::Activate()
133 maPtr = mpWindow->GetPointer();
134 mpWindow->SetPointer( Pointer( POINTER_REFHAND ) );
138 void FuDisplayOrder::Deactivate()
140 mpWindow->SetPointer( maPtr );
144 } // end of namespace sd
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */