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