LibreOffice Module svx (master) 1
sdrmediawindow.cxx
Go to the documentation of this file.
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
21#include "sdrmediawindow.hxx"
22#include <vcl/transfer.hxx>
23
25#include <vcl/window.hxx>
26#include <vcl/commandevent.hxx>
27#include <vcl/event.hxx>
28
29namespace sdr::contact {
30
31
33 ::avmedia::MediaWindow( pParent, false ),
34 mrViewObjectContactOfSdrMediaObj( rViewObjContact )
35{
36}
37
38
40{
41}
42
43
45{
47
48 if( pWindow && getWindow() )
49 {
50 const MouseEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
51 rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
52
53 pWindow->MouseMove( aTransformedEvent );
54 setPointer( pWindow->GetPointer() );
55 }
56}
57
58
60{
62
63 if( pWindow && getWindow() )
64 {
65 const MouseEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
66 rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
67
68 pWindow->MouseButtonDown( aTransformedEvent );
69 }
70}
71
72
74{
76
77 if( pWindow && getWindow() )
78 {
79 const MouseEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
80 rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
81
82 pWindow->MouseButtonUp( aTransformedEvent );
83 }
84}
85
86
88{
90
91 if( pWindow )
92 pWindow->KeyInput( rKEvt );
93}
94
95
96void SdrMediaWindow::KeyUp( const KeyEvent& rKEvt )
97{
99
100 if( pWindow )
101 pWindow->KeyUp( rKEvt );
102}
103
104
106{
108
109 if( pWindow && getWindow() )
110 {
111 const CommandEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ),
112 rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetEventData() );
113
114 pWindow->Command( aTransformedEvent );
115 }
116}
117
118
120{
123
124 if( pWindow )
125 {
126 DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow );
127
128 if( pDropTargetHelper )
129 {
130 nRet = pDropTargetHelper->AcceptDrop( rEvt );
131 }
132 }
133
134 return nRet;
135}
136
137
139{
142
143 if( pWindow )
144 {
145 DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow );
146
147 if( pDropTargetHelper )
148 {
149 nRet = pDropTargetHelper->ExecuteDrop( rEvt );
150 }
151 }
152
153 return nRet;
154}
155
156
157void SdrMediaWindow::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
158{
160
161 if( pWindow )
162 {
163 DragSourceHelper* pDragSourceHelper = dynamic_cast< DragSourceHelper* >( pWindow );
164
165 if( pDragSourceHelper )
166 {
167 pDragSourceHelper->StartDrag( nAction, rPosPixel );
168 }
169 }
170}
171
172}
173
174/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
void * GetEventData() const
bool IsMouseEvent() const
MouseEventModifiers GetMode() const
sal_uInt16 GetModifier() const
sal_uInt16 GetClicks() const
sal_uInt16 GetButtons() const
const Point & GetPosPixel() const
void setPointer(PointerStyle aPointer)
vcl::Window * getWindow() const
virtual void KeyUp(const KeyEvent &rKEvt) override
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
SdrMediaWindow(vcl::Window *pParent, ViewObjectContactOfSdrMediaObj &rViewObjContact)
virtual void Command(const CommandEvent &rCEvt) override
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
ViewObjectContactOfSdrMediaObj & mrViewObjectContactOfSdrMediaObj
virtual ~SdrMediaWindow() override
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
virtual void KeyInput(const KeyEvent &rKEvt) override
virtual void MouseMove(const MouseEvent &rMEvt) override
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
virtual void Command(const CommandEvent &rCEvt)
virtual void MouseButtonDown(const MouseEvent &rMEvt)
virtual void MouseButtonUp(const MouseEvent &rMEvt)
virtual void KeyInput(const KeyEvent &rKEvt)
virtual void MouseMove(const MouseEvent &rMEvt)
virtual void KeyUp(const KeyEvent &rKEvt)
Point ScreenToOutputPixel(const Point &rPos) const
PointerStyle GetPointer() const
#define DND_ACTION_NONE
signed char sal_Int8