bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / func / fudspord.cxx
blob3f4f3a11b2183e3e2f3147930ebf127470940850
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 );
36 FuDisplayOrder::FuDisplayOrder( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq)
37 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
38 , mpRefObj(NULL)
39 , mpOverlay(0L)
43 FuDisplayOrder::~FuDisplayOrder()
45 implClearOverlay();
48 void FuDisplayOrder::implClearOverlay()
50 if(mpOverlay)
52 delete mpOverlay;
53 mpOverlay = 0L;
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 ) );
60 return xFunc;
63 bool FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt)
65 // remember button state for creation of own MouseEvents
66 SetMouseButtonCode(rMEvt.GetButtons());
68 return true;
71 bool FuDisplayOrder::MouseMove(const MouseEvent& rMEvt)
73 SdrObject* pPickObj;
74 SdrPageView* pPV;
75 Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
77 if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), pPickObj, pPV) )
79 if (mpRefObj != pPickObj)
81 // delete current overlay
82 implClearOverlay();
84 // create new one
85 mpOverlay = new SdrDropMarkerOverlay(*mpView, *pPickObj);
87 // remember referenced object
88 mpRefObj = pPickObj;
91 else
93 mpRefObj = NULL;
94 implClearOverlay();
97 return true;
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);
114 else
116 mpView->PutMarkedBehindObj(mpRefObj);
120 mpViewShell->Cancel();
122 return true;
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: */