tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sd / source / ui / presenter / PresenterHelper.cxx
blob0f40a723add5f00d2053ea7c19f176d163bde3d9
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 <sal/config.h>
22 #include <cstddef>
24 #include "PresenterHelper.hxx"
25 #include "PresenterCanvas.hxx"
26 #include <cppcanvas/vclfactory.hxx>
27 #include <cppuhelper/supportsservice.hxx>
28 #include <com/sun/star/awt/XVclWindowPeer.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <toolkit/helper/vclunohelper.hxx>
31 #include <vcl/window.hxx>
32 #include <vcl/wrkwin.hxx>
35 #include <bitmaps.hlst>
37 using namespace ::com::sun::star;
38 using namespace ::com::sun::star::uno;
40 namespace sd::presenter {
42 //===== PresenterHelper =======================================================
44 PresenterHelper::PresenterHelper (
45 const Reference<XComponentContext>& rxContext)
46 : mxComponentContext(rxContext)
50 PresenterHelper::~PresenterHelper()
54 //----- XInitialize -----------------------------------------------------------
56 void SAL_CALL PresenterHelper::initialize (const Sequence<Any>&) {}
58 OUString PresenterHelper::getImplementationName() {
59 return u"com.sun.star.comp.Draw.PresenterHelper"_ustr;
62 sal_Bool PresenterHelper::supportsService(OUString const & ServiceName) {
63 return cppu::supportsService(this, ServiceName);
66 css::uno::Sequence<OUString> PresenterHelper::getSupportedServiceNames() {
67 return {u"com.sun.star.drawing.PresenterHelper"_ustr};
70 //----- XPaneHelper ----------------------------------------------------
72 Reference<awt::XWindow> SAL_CALL PresenterHelper::createWindow (
73 const Reference<awt::XWindow>& rxParentWindow,
74 sal_Bool bCreateSystemChildWindow,
75 sal_Bool bInitiallyVisible,
76 sal_Bool bEnableChildTransparentMode,
77 sal_Bool bEnableParentClip)
79 VclPtr<vcl::Window> pParentWindow(VCLUnoHelper::GetWindow(rxParentWindow));
81 // Create a new window.
82 VclPtr<vcl::Window> pWindow;
83 if (bCreateSystemChildWindow)
85 pWindow = VclPtr<WorkWindow>::Create(pParentWindow, WB_SYSTEMCHILDWINDOW);
87 else
89 pWindow = VclPtr<vcl::Window>::Create(pParentWindow);
91 Reference<awt::XWindow> xWindow (pWindow->GetComponentInterface(), UNO_QUERY);
93 if (bEnableChildTransparentMode)
95 // Make the frame window transparent and make the parent able to
96 // draw behind it.
97 if (pParentWindow)
98 pParentWindow->EnableChildTransparentMode();
101 pWindow->Show(bInitiallyVisible);
103 pWindow->SetMapMode(MapMode(MapUnit::MapPixel));
104 pWindow->SetBackground();
105 if ( ! bEnableParentClip)
107 pWindow->SetParentClipMode(ParentClipMode::NoClip);
108 pWindow->SetPaintTransparent(true);
110 else
112 pWindow->SetParentClipMode(ParentClipMode::Clip);
113 pWindow->SetPaintTransparent(false);
116 return xWindow;
119 Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createSharedCanvas (
120 const Reference<rendering::XSpriteCanvas>& rxUpdateCanvas,
121 const Reference<awt::XWindow>& rxUpdateWindow,
122 const Reference<rendering::XCanvas>& rxSharedCanvas,
123 const Reference<awt::XWindow>& rxSharedWindow,
124 const Reference<awt::XWindow>& rxWindow)
126 if ( ! rxSharedCanvas.is()
127 || ! rxSharedWindow.is()
128 || ! rxWindow.is())
130 throw RuntimeException(u"illegal argument"_ustr, static_cast<XWeak*>(this));
133 if (rxWindow == rxSharedWindow)
134 return rxSharedCanvas;
135 else
136 return new PresenterCanvas(
137 rxUpdateCanvas,
138 rxUpdateWindow,
139 rxSharedCanvas,
140 rxSharedWindow,
141 rxWindow);
144 Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createCanvas (
145 const Reference<awt::XWindow>& rxWindow,
146 sal_Int16,
147 const OUString& rsOptionalCanvasServiceName)
149 // No shared window is given or an explicit canvas service name is
150 // specified. Create a new canvas.
151 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
152 if (!pWindow)
153 throw RuntimeException();
155 Sequence<Any> aArg{ // common: first any is VCL pointer to window (for VCL canvas)
156 Any(reinterpret_cast<sal_Int64>(pWindow.get())),
157 Any(css::awt::Rectangle()),
158 Any(false),
159 Any(rxWindow)
162 Reference<lang::XMultiServiceFactory> xFactory (
163 mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
164 return Reference<rendering::XCanvas>(
165 xFactory->createInstanceWithArguments(
166 !rsOptionalCanvasServiceName.isEmpty()
167 ? rsOptionalCanvasServiceName
168 : u"com.sun.star.rendering.Canvas.VCL"_ustr,
169 aArg),
170 UNO_QUERY);
173 void SAL_CALL PresenterHelper::toTop (
174 const Reference<awt::XWindow>& rxWindow)
176 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
177 if (pWindow)
179 pWindow->ToTop();
180 pWindow->SetZOrder(nullptr, ZOrderFlags::Last);
184 namespace {
186 struct IdMapEntry {
187 char const * sid;
188 OUString bmpid;
193 Reference<rendering::XBitmap> SAL_CALL PresenterHelper::loadBitmap (
194 const OUString& id,
195 const Reference<rendering::XCanvas>& rxCanvas)
197 if ( ! rxCanvas.is())
198 return nullptr;
200 static IdMapEntry constexpr map[] = {
201 { "bitmaps/Background.png", BMP_PRESENTERSCREEN_BACKGROUND },
202 { "bitmaps/Animation.png",
203 BMP_PRESENTERSCREEN_ANIMATION },
204 { "bitmaps/Transition.png",
205 BMP_PRESENTERSCREEN_TRANSITION },
206 { "bitmaps/BorderActiveBottom.png",
207 BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM },
208 { "bitmaps/BorderActiveBottomCallout.png",
209 BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM_CALLOUT },
210 { "bitmaps/BorderActiveBottomLeft.png",
211 BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM_LEFT },
212 { "bitmaps/BorderActiveBottomRight.png",
213 BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM_RIGHT },
214 { "bitmaps/BorderActiveLeft.png",
215 BMP_PRESENTERSCREEN_BORDER_ACTIVE_LEFT },
216 { "bitmaps/BorderActiveRight.png",
217 BMP_PRESENTERSCREEN_BORDER_ACTIVE_RIGHT },
218 { "bitmaps/BorderActiveTop.png",
219 BMP_PRESENTERSCREEN_BORDER_ACTIVE_TOP },
220 { "bitmaps/BorderActiveTopLeft.png",
221 BMP_PRESENTERSCREEN_BORDER_ACTIVE_TOP_LEFT },
222 { "bitmaps/BorderActiveTopRight.png",
223 BMP_PRESENTERSCREEN_BORDER_ACTIVE_TOP_RIGHT },
224 { "bitmaps/BorderBottom.png", BMP_PRESENTERSCREEN_BORDER_BOTTOM },
225 { "bitmaps/BorderBottomLeft.png",
226 BMP_PRESENTERSCREEN_BORDER_BOTTOM_LEFT },
227 { "bitmaps/BorderBottomRight.png",
228 BMP_PRESENTERSCREEN_BORDER_BOTTOM_RIGHT },
229 { "bitmaps/BorderCurrentSlideBottom.png",
230 BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_BOTTOM },
231 { "bitmaps/BorderCurrentSlideBottomLeft.png",
232 BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_BOTTOM_LEFT },
233 { "bitmaps/BorderCurrentSlideBottomRight.png",
234 BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_BOTTOM_RIGHT },
235 { "bitmaps/BorderCurrentSlideLeft.png",
236 BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_LEFT },
237 { "bitmaps/BorderCurrentSlideRight.png",
238 BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_RIGHT },
239 { "bitmaps/BorderCurrentSlideTop.png",
240 BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_TOP },
241 { "bitmaps/BorderCurrentSlideTopLeft.png",
242 BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_TOP_LEFT },
243 { "bitmaps/BorderCurrentSlideTopRight.png",
244 BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_TOP_RIGHT },
245 { "bitmaps/BorderLeft.png", BMP_PRESENTERSCREEN_BORDER_LEFT },
246 { "bitmaps/BorderRight.png", BMP_PRESENTERSCREEN_BORDER_RIGHT },
247 { "bitmaps/BorderToolbarBottom.png",
248 BMP_PRESENTERSCREEN_BORDER_TOOLBAR_BOTTOM },
249 { "bitmaps/BorderToolbarLeft.png",
250 BMP_PRESENTERSCREEN_BORDER_TOOLBAR_LEFT },
251 { "bitmaps/BorderToolbarRight.png",
252 BMP_PRESENTERSCREEN_BORDER_TOOLBAR_RIGHT },
253 { "bitmaps/BorderToolbarTop.png",
254 BMP_PRESENTERSCREEN_BORDER_TOOLBAR_TOP },
255 { "bitmaps/BorderToolbarTopLeft.png",
256 BMP_PRESENTERSCREEN_BORDER_TOOLBAR_TOP_LEFT },
257 { "bitmaps/BorderToolbarTopRight.png",
258 BMP_PRESENTERSCREEN_BORDER_TOOLBAR_TOP_RIGHT },
259 { "bitmaps/BorderTop.png", BMP_PRESENTERSCREEN_BORDER_TOP },
260 { "bitmaps/BorderTopLeft.png", BMP_PRESENTERSCREEN_BORDER_TOP_LEFT },
261 { "bitmaps/BorderTopRight.png", BMP_PRESENTERSCREEN_BORDER_TOP_RIGHT },
262 { "bitmaps/ButtonEffectNextDisabled.png",
263 BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_DISABLED },
264 { "bitmaps/ButtonEffectNextMouseOver.png",
265 BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_MOUSE_OVER },
266 { "bitmaps/ButtonEffectNextNormal.png",
267 BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_NORMAL },
268 { "bitmaps/ButtonEffectNextSelected.png",
269 BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_SELECTED },
270 { "bitmaps/ButtonFrameCenterMouseOver.png",
271 BMP_PRESENTERSCREEN_BUTTON_FRAME_CENTER_MOUSE_OVER },
272 { "bitmaps/ButtonFrameCenterNormal.png",
273 BMP_PRESENTERSCREEN_BUTTON_FRAME_CENTER_NORMAL },
274 { "bitmaps/ButtonFrameLeftMouseOver.png",
275 BMP_PRESENTERSCREEN_BUTTON_FRAME_LEFT_MOUSE_OVER },
276 { "bitmaps/ButtonFrameLeftNormal.png",
277 BMP_PRESENTERSCREEN_BUTTON_FRAME_LEFT_NORMAL },
278 { "bitmaps/ButtonFrameRightMouseOver.png",
279 BMP_PRESENTERSCREEN_BUTTON_FRAME_RIGHT_MOUSE_OVER },
280 { "bitmaps/ButtonFrameRightNormal.png",
281 BMP_PRESENTERSCREEN_BUTTON_FRAME_RIGHT_NORMAL },
282 { "bitmaps/ButtonHelpDisabled.png",
283 BMP_PRESENTERSCREEN_BUTTON_HELP_DISABLED },
284 { "bitmaps/ButtonHelpMouseOver.png",
285 BMP_PRESENTERSCREEN_BUTTON_HELP_MOUSE_OVER },
286 { "bitmaps/ButtonHelpNormal.png",
287 BMP_PRESENTERSCREEN_BUTTON_HELP_NORMAL },
288 { "bitmaps/ButtonHelpSelected.png",
289 BMP_PRESENTERSCREEN_BUTTON_HELP_SELECTED },
290 { "bitmaps/ButtonExitPresenterMouseOver.png",
291 BMP_PRESENTERSCREEN_BUTTON_EXIT_PRESENTER_MOUSE_OVER },
292 { "bitmaps/ButtonExitPresenterNormal.png",
293 BMP_PRESENTERSCREEN_BUTTON_EXIT_PRESENTER_NORMAL },
294 { "bitmaps/ButtonMinusDisabled.png",
295 BMP_PRESENTERSCREEN_BUTTON_MINUS_DISABLED },
296 { "bitmaps/ButtonMinusMouseOver.png",
297 BMP_PRESENTERSCREEN_BUTTON_MINUS_MOUSE_OVER },
298 { "bitmaps/ButtonMinusNormal.png",
299 BMP_PRESENTERSCREEN_BUTTON_MINUS_NORMAL },
300 { "bitmaps/ButtonMinusSelected.png",
301 BMP_PRESENTERSCREEN_BUTTON_MINUS_SELECTED },
302 { "bitmaps/ButtonNotesDisabled.png",
303 BMP_PRESENTERSCREEN_BUTTON_NOTES_DISABLED },
304 { "bitmaps/ButtonNotesMouseOver.png",
305 BMP_PRESENTERSCREEN_BUTTON_NOTES_MOUSE_OVER },
306 { "bitmaps/ButtonNotesNormal.png",
307 BMP_PRESENTERSCREEN_BUTTON_NOTES_NORMAL },
308 { "bitmaps/ButtonNotesSelected.png",
309 BMP_PRESENTERSCREEN_BUTTON_NOTES_SELECTED },
310 { "bitmaps/ButtonPlusDisabled.png",
311 BMP_PRESENTERSCREEN_BUTTON_PLUS_DISABLED },
312 { "bitmaps/ButtonPlusMouseOver.png",
313 BMP_PRESENTERSCREEN_BUTTON_PLUS_MOUSE_OVER },
314 { "bitmaps/ButtonPlusNormal.png",
315 BMP_PRESENTERSCREEN_BUTTON_PLUS_NORMAL },
316 { "bitmaps/ButtonPlusSelected.png",
317 BMP_PRESENTERSCREEN_BUTTON_PLUS_SELECTED },
318 { "bitmaps/ButtonSlideNextDisabled.png",
319 BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_DISABLED },
320 { "bitmaps/ButtonSlideNextMouseOver.png",
321 BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_MOUSE_OVER },
322 { "bitmaps/ButtonSlideNextNormal.png",
323 BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_NORMAL },
324 { "bitmaps/ButtonSlidePreviousDisabled.png",
325 BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_DISABLED },
326 { "bitmaps/ButtonSlidePreviousMouseOver.png",
327 BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_MOUSE_OVER },
328 { "bitmaps/ButtonSlidePreviousNormal.png",
329 BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_NORMAL },
330 { "bitmaps/ButtonSlidePreviousSelected.png",
331 BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_SELECTED },
332 { "bitmaps/ButtonSlideSorterDisabled.png",
333 BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_DISABLED },
334 { "bitmaps/ButtonSlideSorterMouseOver.png",
335 BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_MOUSE_OVER },
336 { "bitmaps/ButtonSlideSorterNormal.png",
337 BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_NORMAL },
338 { "bitmaps/ButtonSlideSorterSelected.png",
339 BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_SELECTED },
340 { "bitmaps/ButtonSwitchMonitorMouseOver.png",
341 BMP_PRESENTERSCREEN_BUTTON_SWITCH_MONITOR_MOUSE_OVER },
342 { "bitmaps/ButtonSwitchMonitorNormal.png",
343 BMP_PRESENTERSCREEN_BUTTON_SWITCH_MONITOR_NORMAL },
344 { "bitmaps/ButtonRestartTimerMouseOver.png",
345 BMP_PRESENTERSCREEN_BUTTON_RESTART_TIMER_MOUSE_OVER },
346 { "bitmaps/ButtonRestartTimerNormal.png",
347 BMP_PRESENTERSCREEN_BUTTON_RESTART_TIMER_NORMAL },
348 { "bitmaps/ButtonPauseTimerMouseOver.png",
349 BMP_PRESENTERSCREEN_BUTTON_PAUSE_TIMER_MOUSE_OVER },
350 { "bitmaps/ButtonPauseTimerNormal.png",
351 BMP_PRESENTERSCREEN_BUTTON_PAUSE_TIMER_NORMAL },
352 { "bitmaps/ButtonResumeTimerMouseOver.png",
353 BMP_PRESENTERSCREEN_BUTTON_RESUME_TIMER_MOUSE_OVER },
354 { "bitmaps/ButtonResumeTimerNormal.png",
355 BMP_PRESENTERSCREEN_BUTTON_RESUME_TIMER_NORMAL },
356 { "bitmaps/LabelMouseOverCenter.png",
357 BMP_PRESENTERSCREEN_LABEL_MOUSE_OVER_CENTER },
358 { "bitmaps/LabelMouseOverLeft.png",
359 BMP_PRESENTERSCREEN_LABEL_MOUSE_OVER_LEFT },
360 { "bitmaps/LabelMouseOverRight.png",
361 BMP_PRESENTERSCREEN_LABEL_MOUSE_OVER_RIGHT },
362 { "bitmaps/ScrollbarArrowDownDisabled.png",
363 BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_DISABLED },
364 { "bitmaps/ScrollbarArrowDownMouseOver.png",
365 BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_MOUSE_OVER },
366 { "bitmaps/ScrollbarArrowDownNormal.png",
367 BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_NORMAL },
368 { "bitmaps/ScrollbarArrowDownSelected.png",
369 BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_SELECTED },
370 { "bitmaps/ScrollbarArrowUpDisabled.png",
371 BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_DISABLED },
372 { "bitmaps/ScrollbarArrowUpMouseOver.png",
373 BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_MOUSE_OVER },
374 { "bitmaps/ScrollbarArrowUpNormal.png",
375 BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_NORMAL },
376 { "bitmaps/ScrollbarArrowUpSelected.png",
377 BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_SELECTED },
378 { "bitmaps/ScrollbarPagerMiddleMouseOver.png",
379 BMP_PRESENTERSCREEN_SCROLLBAR_PAGER_MIDDLE_MOUSE_OVER },
380 { "bitmaps/ScrollbarPagerMiddleNormal.png",
381 BMP_PRESENTERSCREEN_SCROLLBAR_PAGER_MIDDLE_NORMAL },
382 { "bitmaps/ScrollbarThumbBottomMouseOver.png",
383 BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_BOTTOM_MOUSE_OVER },
384 { "bitmaps/ScrollbarThumbBottomNormal.png",
385 BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_BOTTOM_NORMAL },
386 { "bitmaps/ScrollbarThumbMiddleMouseOver.png",
387 BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_MIDDLE_MOUSE_OVER },
388 { "bitmaps/ScrollbarThumbMiddleNormal.png",
389 BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_MIDDLE_NORMAL },
390 { "bitmaps/ScrollbarThumbTopMouseOver.png",
391 BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_TOP_MOUSE_OVER },
392 { "bitmaps/ScrollbarThumbTopNormal.png",
393 BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_TOP_NORMAL },
394 { "bitmaps/ViewBackground.png", BMP_PRESENTERSCREEN_VIEW_BACKGROUND },
395 { "bitmaps/Separator.png",
396 BMP_PRESENTERSCREEN_SEPARATOR }
398 OUString bmpid;
399 for (std::size_t i = 0; i != SAL_N_ELEMENTS(map); ++i) {
400 if (id.equalsAscii(map[i].sid)) {
401 bmpid = map[i].bmpid;
402 break;
405 if (bmpid.isEmpty()) {
406 return nullptr;
409 ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
411 const cppcanvas::CanvasSharedPtr pCanvas (
412 cppcanvas::VCLFactory::createCanvas(rxCanvas));
414 if (pCanvas)
416 BitmapEx aBitmapEx(bmpid);
417 cppcanvas::BitmapSharedPtr xBitmap(
418 cppcanvas::VCLFactory::createBitmap(pCanvas,
419 aBitmapEx));
420 if (!xBitmap)
421 return nullptr;
422 return xBitmap->getUNOBitmap();
425 return nullptr;
428 void SAL_CALL PresenterHelper::captureMouse (
429 const Reference<awt::XWindow>& rxWindow)
431 ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
433 // Capture the mouse (if not already done.)
434 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
435 if (pWindow && ! pWindow->IsMouseCaptured())
437 pWindow->CaptureMouse();
441 void SAL_CALL PresenterHelper::releaseMouse (const Reference<awt::XWindow>& rxWindow)
443 ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
445 // Release the mouse (if not already done.)
446 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
447 if (pWindow && pWindow->IsMouseCaptured())
449 pWindow->ReleaseMouse();
453 awt::Rectangle PresenterHelper::getWindowExtentsRelative (
454 const Reference<awt::XWindow>& rxChildWindow,
455 const Reference<awt::XWindow>& rxParentWindow)
457 VclPtr<vcl::Window> pChildWindow = VCLUnoHelper::GetWindow(rxChildWindow);
458 VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(rxParentWindow);
459 if (pChildWindow && pParentWindow)
461 ::tools::Rectangle aBox (pChildWindow->GetWindowExtentsRelative(*pParentWindow));
462 return awt::Rectangle(aBox.Left(),aBox.Top(),aBox.GetWidth(),aBox.GetHeight());
464 else
465 return awt::Rectangle();
468 } // end of namespace ::sd::presenter
471 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
472 com_sun_star_comp_Draw_PresenterHelper_get_implementation(css::uno::XComponentContext* context,
473 css::uno::Sequence<css::uno::Any> const &)
475 return cppu::acquire(new sd::presenter::PresenterHelper(context));
479 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */