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 "sal/config.h"
21 :
22 : #include <cstddef>
23 :
24 : #include "PresenterHelper.hxx"
25 : #include "CanvasUpdateRequester.hxx"
26 : #include "PresenterCanvas.hxx"
27 : #include <cppcanvas/vclfactory.hxx>
28 : #include <com/sun/star/awt/WindowAttribute.hpp>
29 : #include <com/sun/star/awt/WindowClass.hpp>
30 : #include <com/sun/star/awt/WindowDescriptor.hpp>
31 : #include <toolkit/helper/vclunohelper.hxx>
32 : #include <vcl/svapp.hxx>
33 : #include <vcl/window.hxx>
34 : #include <vcl/wrkwin.hxx>
35 :
36 : #include "res_bmp.hrc"
37 : #include "sdresid.hxx"
38 :
39 : using namespace ::com::sun::star;
40 : using namespace ::com::sun::star::uno;
41 : using ::rtl::OUString;
42 :
43 : namespace sd { namespace presenter {
44 :
45 : //===== Service ===============================================================
46 :
47 0 : Reference<XInterface> SAL_CALL PresenterHelperService_createInstance (
48 : const Reference<XComponentContext>& rxContext)
49 : {
50 0 : return Reference<XInterface>(static_cast<XWeak*>(new PresenterHelper(rxContext)));
51 : }
52 :
53 :
54 :
55 :
56 2 : ::rtl::OUString PresenterHelperService_getImplementationName (void)
57 : throw(RuntimeException)
58 : {
59 2 : return OUString("com.sun.star.comp.Draw.PresenterHelper");
60 : }
61 :
62 :
63 :
64 :
65 0 : Sequence<rtl::OUString> SAL_CALL PresenterHelperService_getSupportedServiceNames (void)
66 : throw (RuntimeException)
67 : {
68 0 : static const ::rtl::OUString sServiceName("com.sun.star.drawing.PresenterHelper");
69 0 : return Sequence<rtl::OUString>(&sServiceName, 1);
70 : }
71 :
72 :
73 :
74 :
75 : //===== PresenterHelper =======================================================
76 :
77 0 : PresenterHelper::PresenterHelper (
78 : const Reference<XComponentContext>& rxContext)
79 : : PresenterHelperInterfaceBase(m_aMutex),
80 0 : mxComponentContext(rxContext)
81 : {
82 0 : }
83 :
84 :
85 :
86 0 : PresenterHelper::~PresenterHelper (void)
87 : {
88 0 : }
89 :
90 :
91 :
92 :
93 : //----- XInitialize -----------------------------------------------------------
94 :
95 0 : void SAL_CALL PresenterHelper::initialize (const Sequence<Any>& rArguments)
96 : throw(Exception,RuntimeException)
97 : {
98 : (void)rArguments;
99 0 : }
100 :
101 :
102 :
103 :
104 : //----- XPaneHelper ----------------------------------------------------
105 :
106 0 : Reference<awt::XWindow> SAL_CALL PresenterHelper::createWindow (
107 : const Reference<awt::XWindow>& rxParentWindow,
108 : sal_Bool bCreateSystemChildWindow,
109 : sal_Bool bInitiallyVisible,
110 : sal_Bool bEnableChildTransparentMode,
111 : sal_Bool bEnableParentClip)
112 : throw (css::uno::RuntimeException)
113 : {
114 0 : ::Window* pParentWindow = VCLUnoHelper::GetWindow(rxParentWindow);
115 :
116 : // Create a new window.
117 0 : ::Window* pWindow = NULL;
118 0 : if (bCreateSystemChildWindow)
119 : {
120 0 : pWindow = new WorkWindow(pParentWindow, WB_SYSTEMCHILDWINDOW);
121 : }
122 : else
123 : {
124 0 : pWindow = new ::Window(pParentWindow);
125 : }
126 0 : Reference<awt::XWindow> xWindow (pWindow->GetComponentInterface(), UNO_QUERY);
127 :
128 0 : if (bEnableChildTransparentMode)
129 : {
130 : // Make the frame window transparent and make the parent able to
131 : // draw behind it.
132 0 : if (pParentWindow != NULL)
133 0 : pParentWindow->EnableChildTransparentMode(sal_True);
134 : }
135 :
136 0 : if (pWindow != NULL)
137 : {
138 0 : pWindow->Show(bInitiallyVisible);
139 :
140 0 : pWindow->SetMapMode(MAP_PIXEL);
141 0 : pWindow->SetBackground();
142 0 : if ( ! bEnableParentClip)
143 : {
144 0 : pWindow->SetParentClipMode(PARENTCLIPMODE_NOCLIP);
145 0 : pWindow->SetPaintTransparent(sal_True);
146 : }
147 : else
148 : {
149 0 : pWindow->SetParentClipMode(PARENTCLIPMODE_CLIP);
150 0 : pWindow->SetPaintTransparent(sal_False);
151 : }
152 :
153 : }
154 :
155 0 : return xWindow;
156 : }
157 :
158 :
159 :
160 :
161 0 : Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createSharedCanvas (
162 : const Reference<rendering::XSpriteCanvas>& rxUpdateCanvas,
163 : const Reference<awt::XWindow>& rxUpdateWindow,
164 : const Reference<rendering::XCanvas>& rxSharedCanvas,
165 : const Reference<awt::XWindow>& rxSharedWindow,
166 : const Reference<awt::XWindow>& rxWindow)
167 : throw (css::uno::RuntimeException)
168 : {
169 0 : if ( ! rxSharedCanvas.is()
170 0 : || ! rxSharedWindow.is()
171 0 : || ! rxWindow.is())
172 : {
173 : throw RuntimeException("illegal argument",
174 0 : Reference<XInterface>(static_cast<XWeak*>(this)));
175 : }
176 :
177 0 : if (rxWindow == rxSharedWindow)
178 0 : return rxSharedCanvas;
179 : else
180 : return new PresenterCanvas(
181 : rxUpdateCanvas,
182 : rxUpdateWindow,
183 : rxSharedCanvas,
184 : rxSharedWindow,
185 0 : rxWindow);
186 : }
187 :
188 :
189 :
190 :
191 0 : Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createCanvas (
192 : const Reference<awt::XWindow>& rxWindow,
193 : sal_Int16 nRequestedCanvasFeatures,
194 : const OUString& rsOptionalCanvasServiceName)
195 : throw (css::uno::RuntimeException)
196 : {
197 : (void)nRequestedCanvasFeatures;
198 :
199 : // No shared window is given or an explicit canvas service name is
200 : // specified. Create a new canvas.
201 0 : ::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
202 0 : if (pWindow != NULL)
203 : {
204 0 : Sequence<Any> aArg (5);
205 :
206 : // common: first any is VCL pointer to window (for VCL canvas)
207 0 : aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow));
208 0 : aArg[1] = Any();
209 0 : aArg[2] = makeAny(::com::sun::star::awt::Rectangle());
210 0 : aArg[3] = makeAny(sal_False);
211 0 : aArg[4] = makeAny(rxWindow);
212 :
213 : Reference<lang::XMultiServiceFactory> xFactory (
214 0 : mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
215 : return Reference<rendering::XCanvas>(
216 0 : xFactory->createInstanceWithArguments(
217 0 : !rsOptionalCanvasServiceName.isEmpty()
218 : ? rsOptionalCanvasServiceName
219 : : OUString("com.sun.star.rendering.VCLCanvas"),
220 0 : aArg),
221 0 : UNO_QUERY);
222 : }
223 : else
224 0 : throw RuntimeException();
225 : }
226 :
227 :
228 :
229 :
230 0 : void SAL_CALL PresenterHelper::toTop (
231 : const Reference<awt::XWindow>& rxWindow)
232 : throw (css::uno::RuntimeException)
233 : {
234 0 : ::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
235 0 : if (pWindow != NULL)
236 : {
237 0 : pWindow->ToTop();
238 0 : pWindow->SetZOrder(NULL, WINDOW_ZORDER_LAST);
239 : }
240 0 : }
241 :
242 :
243 :
244 : namespace {
245 :
246 : struct IdMapEntry {
247 : char const * sid;
248 : sal_uInt32 nid;
249 : };
250 :
251 : }
252 :
253 0 : Reference<rendering::XBitmap> SAL_CALL PresenterHelper::loadBitmap (
254 : const OUString& id,
255 : const Reference<rendering::XCanvas>& rxCanvas)
256 : throw (RuntimeException)
257 : {
258 0 : if ( ! rxCanvas.is())
259 0 : return NULL;
260 :
261 : static IdMapEntry const map[] = {
262 : { "bitmaps/Background.png", BMP_PRESENTERSCREEN_BACKGROUND },
263 : { "bitmaps/BorderActiveBottom.png",
264 : BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM },
265 : { "bitmaps/BorderActiveBottomCallout.png",
266 : BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM_CALLOUT },
267 : { "bitmaps/BorderActiveBottomLeft.png",
268 : BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM_LEFT },
269 : { "bitmaps/BorderActiveBottomRight.png",
270 : BMP_PRESENTERSCREEN_BORDER_ACTIVE_BOTTOM_RIGHT },
271 : { "bitmaps/BorderActiveLeft.png",
272 : BMP_PRESENTERSCREEN_BORDER_ACTIVE_LEFT },
273 : { "bitmaps/BorderActiveRight.png",
274 : BMP_PRESENTERSCREEN_BORDER_ACTIVE_RIGHT },
275 : { "bitmaps/BorderActiveTop.png",
276 : BMP_PRESENTERSCREEN_BORDER_ACTIVE_TOP },
277 : { "bitmaps/BorderActiveTopLeft.png",
278 : BMP_PRESENTERSCREEN_BORDER_ACTIVE_TOP_LEFT },
279 : { "bitmaps/BorderActiveTopRight.png",
280 : BMP_PRESENTERSCREEN_BORDER_ACTIVE_TOP_RIGHT },
281 : { "bitmaps/BorderBottom.png", BMP_PRESENTERSCREEN_BORDER_BOTTOM },
282 : { "bitmaps/BorderBottomLeft.png",
283 : BMP_PRESENTERSCREEN_BORDER_BOTTOM_LEFT },
284 : { "bitmaps/BorderBottomRight.png",
285 : BMP_PRESENTERSCREEN_BORDER_BOTTOM_RIGHT },
286 : { "bitmaps/BorderCurrentSlideBottom.png",
287 : BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_BOTTOM },
288 : { "bitmaps/BorderCurrentSlideBottomLeft.png",
289 : BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_BOTTOM_LEFT },
290 : { "bitmaps/BorderCurrentSlideBottomRight.png",
291 : BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_BOTTOM_RIGHT },
292 : { "bitmaps/BorderCurrentSlideLeft.png",
293 : BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_LEFT },
294 : { "bitmaps/BorderCurrentSlideRight.png",
295 : BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_RIGHT },
296 : { "bitmaps/BorderCurrentSlideTop.png",
297 : BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_TOP },
298 : { "bitmaps/BorderCurrentSlideTopLeft.png",
299 : BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_TOP_LEFT },
300 : { "bitmaps/BorderCurrentSlideTopRight.png",
301 : BMP_PRESENTERSCREEN_BORDER_CURRENT_SLIDE_TOP_RIGHT },
302 : { "bitmaps/BorderLeft.png", BMP_PRESENTERSCREEN_BORDER_LEFT },
303 : { "bitmaps/BorderRight.png", BMP_PRESENTERSCREEN_BORDER_RIGHT },
304 : { "bitmaps/BorderToolbarBottom.png",
305 : BMP_PRESENTERSCREEN_BORDER_TOOLBAR_BOTTOM },
306 : { "bitmaps/BorderToolbarLeft.png",
307 : BMP_PRESENTERSCREEN_BORDER_TOOLBAR_LEFT },
308 : { "bitmaps/BorderToolbarRight.png",
309 : BMP_PRESENTERSCREEN_BORDER_TOOLBAR_RIGHT },
310 : { "bitmaps/BorderToolbarTop.png",
311 : BMP_PRESENTERSCREEN_BORDER_TOOLBAR_TOP },
312 : { "bitmaps/BorderToolbarTopLeft.png",
313 : BMP_PRESENTERSCREEN_BORDER_TOOLBAR_TOP_LEFT },
314 : { "bitmaps/BorderToolbarTopRight.png",
315 : BMP_PRESENTERSCREEN_BORDER_TOOLBAR_TOP_RIGHT },
316 : { "bitmaps/BorderTop.png", BMP_PRESENTERSCREEN_BORDER_TOP },
317 : { "bitmaps/BorderTopLeft.png", BMP_PRESENTERSCREEN_BORDER_TOP_LEFT },
318 : { "bitmaps/BorderTopRight.png", BMP_PRESENTERSCREEN_BORDER_TOP_RIGHT },
319 : { "bitmaps/ButtonEffectNextDisabled.png",
320 : BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_DISABLED },
321 : { "bitmaps/ButtonEffectNextMouseOver.png",
322 : BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_MOUSE_OVER },
323 : { "bitmaps/ButtonEffectNextNormal.png",
324 : BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_NORMAL },
325 : { "bitmaps/ButtonEffectNextSelected.png",
326 : BMP_PRESENTERSCREEN_BUTTON_EFFECT_NEXT_SELECTED },
327 : { "bitmaps/ButtonFrameCenterMouseOver.png",
328 : BMP_PRESENTERSCREEN_BUTTON_FRAME_CENTER_MOUSE_OVER },
329 : { "bitmaps/ButtonFrameCenterNormal.png",
330 : BMP_PRESENTERSCREEN_BUTTON_FRAME_CENTER_NORMAL },
331 : { "bitmaps/ButtonFrameLeftMouseOver.png",
332 : BMP_PRESENTERSCREEN_BUTTON_FRAME_LEFT_MOUSE_OVER },
333 : { "bitmaps/ButtonFrameLeftNormal.png",
334 : BMP_PRESENTERSCREEN_BUTTON_FRAME_LEFT_NORMAL },
335 : { "bitmaps/ButtonFrameRightMouseOver.png",
336 : BMP_PRESENTERSCREEN_BUTTON_FRAME_RIGHT_MOUSE_OVER },
337 : { "bitmaps/ButtonFrameRightNormal.png",
338 : BMP_PRESENTERSCREEN_BUTTON_FRAME_RIGHT_NORMAL },
339 : { "bitmaps/ButtonHelpDisabled.png",
340 : BMP_PRESENTERSCREEN_BUTTON_HELP_DISABLED },
341 : { "bitmaps/ButtonHelpMouseOver.png",
342 : BMP_PRESENTERSCREEN_BUTTON_HELP_MOUSE_OVER },
343 : { "bitmaps/ButtonHelpNormal.png",
344 : BMP_PRESENTERSCREEN_BUTTON_HELP_NORMAL },
345 : { "bitmaps/ButtonHelpSelected.png",
346 : BMP_PRESENTERSCREEN_BUTTON_HELP_SELECTED },
347 : { "bitmaps/ButtonMinusDisabled.png",
348 : BMP_PRESENTERSCREEN_BUTTON_MINUS_DISABLED },
349 : { "bitmaps/ButtonMinusMouseOver.png",
350 : BMP_PRESENTERSCREEN_BUTTON_MINUS_MOUSE_OVER },
351 : { "bitmaps/ButtonMinusNormal.png",
352 : BMP_PRESENTERSCREEN_BUTTON_MINUS_NORMAL },
353 : { "bitmaps/ButtonMinusSelected.png",
354 : BMP_PRESENTERSCREEN_BUTTON_MINUS_SELECTED },
355 : { "bitmaps/ButtonNotesDisabled.png",
356 : BMP_PRESENTERSCREEN_BUTTON_NOTES_DISABLED },
357 : { "bitmaps/ButtonNotesMouseOver.png",
358 : BMP_PRESENTERSCREEN_BUTTON_NOTES_MOUSE_OVER },
359 : { "bitmaps/ButtonNotesNormal.png",
360 : BMP_PRESENTERSCREEN_BUTTON_NOTES_NORMAL },
361 : { "bitmaps/ButtonNotesSelected.png",
362 : BMP_PRESENTERSCREEN_BUTTON_NOTES_SELECTED },
363 : { "bitmaps/ButtonPlusDisabled.png",
364 : BMP_PRESENTERSCREEN_BUTTON_PLUS_DISABLED },
365 : { "bitmaps/ButtonPlusMouseOver.png",
366 : BMP_PRESENTERSCREEN_BUTTON_PLUS_MOUSE_OVER },
367 : { "bitmaps/ButtonPlusNormal.png",
368 : BMP_PRESENTERSCREEN_BUTTON_PLUS_NORMAL },
369 : { "bitmaps/ButtonPlusSelected.png",
370 : BMP_PRESENTERSCREEN_BUTTON_PLUS_SELECTED },
371 : { "bitmaps/ButtonSlideNextDisabled.png",
372 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_DISABLED },
373 : { "bitmaps/ButtonSlideNextMouseOver.png",
374 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_MOUSE_OVER },
375 : { "bitmaps/ButtonSlideNextNormal.png",
376 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_NEXT_NORMAL },
377 : { "bitmaps/ButtonSlidePreviousDisabled.png",
378 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_DISABLED },
379 : { "bitmaps/ButtonSlidePreviousMouseOver.png",
380 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_MOUSE_OVER },
381 : { "bitmaps/ButtonSlidePreviousNormal.png",
382 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_NORMAL },
383 : { "bitmaps/ButtonSlidePreviousSelected.png",
384 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_PREVIOUS_SELECTED },
385 : { "bitmaps/ButtonSlideSorterDisabled.png",
386 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_DISABLED },
387 : { "bitmaps/ButtonSlideSorterMouseOver.png",
388 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_MOUSE_OVER },
389 : { "bitmaps/ButtonSlideSorterNormal.png",
390 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_NORMAL },
391 : { "bitmaps/ButtonSlideSorterSelected.png",
392 : BMP_PRESENTERSCREEN_BUTTON_SLIDE_SORTER_SELECTED },
393 : { "bitmaps/ButtonSwitchMonitorMouseOver.png",
394 : BMP_PRESENTERSCREEN_BUTTON_SWITCH_MONITOR_MOUSE_OVER },
395 : { "bitmaps/ButtonSwitchMonitorNormal.png",
396 : BMP_PRESENTERSCREEN_BUTTON_SWITCH_MONITOR_NORMAL },
397 : { "bitmaps/LabelMouseOverCenter.png",
398 : BMP_PRESENTERSCREEN_LABEL_MOUSE_OVER_CENTER },
399 : { "bitmaps/LabelMouseOverLeft.png",
400 : BMP_PRESENTERSCREEN_LABEL_MOUSE_OVER_LEFT },
401 : { "bitmaps/LabelMouseOverRight.png",
402 : BMP_PRESENTERSCREEN_LABEL_MOUSE_OVER_RIGHT },
403 : { "bitmaps/ScrollbarArrowDownDisabled.png",
404 : BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_DISABLED },
405 : { "bitmaps/ScrollbarArrowDownMouseOver.png",
406 : BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_MOUSE_OVER },
407 : { "bitmaps/ScrollbarArrowDownNormal.png",
408 : BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_NORMAL },
409 : { "bitmaps/ScrollbarArrowDownSelected.png",
410 : BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_DOWN_SELECTED },
411 : { "bitmaps/ScrollbarArrowUpDisabled.png",
412 : BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_DISABLED },
413 : { "bitmaps/ScrollbarArrowUpMouseOver.png",
414 : BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_MOUSE_OVER },
415 : { "bitmaps/ScrollbarArrowUpNormal.png",
416 : BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_NORMAL },
417 : { "bitmaps/ScrollbarArrowUpSelected.png",
418 : BMP_PRESENTERSCREEN_SCROLLBAR_ARROW_UP_SELECTED },
419 : { "bitmaps/ScrollbarPagerMiddleMouseOver.png",
420 : BMP_PRESENTERSCREEN_SCROLLBAR_PAGER_MIDDLE_MOUSE_OVER },
421 : { "bitmaps/ScrollbarPagerMiddleNormal.png",
422 : BMP_PRESENTERSCREEN_SCROLLBAR_PAGER_MIDDLE_NORMAL },
423 : { "bitmaps/ScrollbarThumbBottomMouseOver.png",
424 : BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_BOTTOM_MOUSE_OVER },
425 : { "bitmaps/ScrollbarThumbBottomNormal.png",
426 : BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_BOTTOM_NORMAL },
427 : { "bitmaps/ScrollbarThumbMiddleMouseOver.png",
428 : BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_MIDDLE_MOUSE_OVER },
429 : { "bitmaps/ScrollbarThumbMiddleNormal.png",
430 : BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_MIDDLE_NORMAL },
431 : { "bitmaps/ScrollbarThumbTopMouseOver.png",
432 : BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_TOP_MOUSE_OVER },
433 : { "bitmaps/ScrollbarThumbTopNormal.png",
434 : BMP_PRESENTERSCREEN_SCROLLBAR_THUMB_TOP_NORMAL },
435 : { "bitmaps/ViewBackground.png", BMP_PRESENTERSCREEN_VIEW_BACKGROUND }
436 : };
437 0 : sal_uInt32 nid = 0;
438 0 : for (std::size_t i = 0; i != SAL_N_ELEMENTS(map); ++i) {
439 0 : if (id.equalsAscii(map[i].sid)) {
440 0 : nid = map[i].nid;
441 0 : break;
442 : }
443 : }
444 0 : if (nid == 0) {
445 0 : return 0;
446 : }
447 :
448 0 : ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
449 :
450 : const cppcanvas::CanvasSharedPtr pCanvas (
451 0 : cppcanvas::VCLFactory::getInstance().createCanvas(
452 0 : Reference<css::rendering::XBitmapCanvas>(rxCanvas,UNO_QUERY)));
453 :
454 0 : if (pCanvas.get()!=NULL)
455 : {
456 0 : BitmapEx aBitmapEx = SdResId(nid);
457 0 : return cppcanvas::VCLFactory::getInstance().createBitmap(
458 0 : pCanvas, aBitmapEx)->getUNOBitmap();
459 : }
460 :
461 0 : return NULL;
462 : }
463 :
464 :
465 :
466 :
467 :
468 0 : void SAL_CALL PresenterHelper::captureMouse (
469 : const Reference<awt::XWindow>& rxWindow)
470 : throw (RuntimeException)
471 : {
472 0 : ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
473 :
474 : // Capture the mouse (if not already done.)
475 0 : ::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
476 0 : if (pWindow != NULL && ! pWindow->IsMouseCaptured())
477 : {
478 0 : pWindow->CaptureMouse();
479 0 : }
480 0 : }
481 :
482 :
483 :
484 :
485 0 : void SAL_CALL PresenterHelper::releaseMouse (const Reference<awt::XWindow>& rxWindow)
486 : throw (RuntimeException)
487 : {
488 0 : ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
489 :
490 : // Release the mouse (if not already done.)
491 0 : ::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
492 0 : if (pWindow != NULL && pWindow->IsMouseCaptured())
493 : {
494 0 : pWindow->ReleaseMouse();
495 0 : }
496 0 : }
497 :
498 :
499 :
500 :
501 0 : awt::Rectangle PresenterHelper::getWindowExtentsRelative (
502 : const Reference<awt::XWindow>& rxChildWindow,
503 : const Reference<awt::XWindow>& rxParentWindow)
504 : throw (RuntimeException)
505 : {
506 0 : ::Window* pChildWindow = VCLUnoHelper::GetWindow(rxChildWindow);
507 0 : ::Window* pParentWindow = VCLUnoHelper::GetWindow(rxParentWindow);
508 0 : if (pChildWindow!=NULL && pParentWindow!=NULL)
509 : {
510 0 : Rectangle aBox (pChildWindow->GetWindowExtentsRelative(pParentWindow));
511 0 : return awt::Rectangle(aBox.Left(),aBox.Top(),aBox.GetWidth(),aBox.GetHeight());
512 : }
513 : else
514 0 : return awt::Rectangle();
515 : }
516 :
517 :
518 :
519 : } } // end of namespace ::sd::presenter
520 :
521 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|