merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0565-slideshow-configurable-paintoverlay.diff
blobc51c67fc028b4ebdad65fb9e0a2337d2629ddd1d
1 Modified: sd/source/ui/slideshow/slideshow.hrc
2 ==============================================================================
3 --- sd/source/ui/slideshow/slideshow.hrc Sat Jan 31 09:53:18 2009 (r267232)
4 +++ sd/source/ui/slideshow/slideshow.hrc Sat Jan 31 14:05:38 2009 (r267233)
5 @@ -38,8 +38,15 @@
6 #define CM_SCREEN_BLACK 5
7 #define CM_SCREEN_WHITE 6
8 #define CM_ENDSHOW 7
9 -#define CM_FIRST_SLIDE 8
10 -#define CM_LAST_SLIDE 9
11 -#define CM_SLIDES 10
12 +#define CM_COLOR_PEN 8
13 +#define CM_FIRST_SLIDE 9
14 +#define CM_LAST_SLIDE 10
15 +#define CM_WIDTH_PEN 11
16 +#define CM_WIDTH_PEN_VERY_THIN 12
17 +#define CM_WIDTH_PEN_THIN 13
18 +#define CM_WIDTH_PEN_NORMAL 14
19 +#define CM_WIDTH_PEN_THICK 15
20 +#define CM_WIDTH_PEN_VERY_THICK 16
21 +#define CM_SLIDES 17
23 #endif
25 Modified: sd/source/ui/slideshow/slideshow.src
26 ==============================================================================
27 --- sd/source/ui/slideshow/slideshow.src Sat Jan 31 09:53:18 2009 (r267232)
28 +++ sd/source/ui/slideshow/slideshow.src Sat Jan 31 14:05:38 2009 (r267233)
29 @@ -100,6 +100,56 @@
31 Separator = TRUE;
33 + MenuItem
34 + {
35 + Identifier = CM_WIDTH_PEN;
36 + Text [ en-US ] = "~Pen Width" ;
38 + SubMenu = Menu
39 + {
40 + ItemList =
41 + {
42 + MenuItem
43 + {
44 + Identifier = CM_WIDTH_PEN_VERY_THIN;
45 + Text [ en-US ] = "~Very thin";
46 + };
47 + MenuItem
48 + {
49 + Identifier = CM_WIDTH_PEN_THIN;
50 + Text [ en-US ] = "~Thin";
51 + };
52 + MenuItem
53 + {
54 + Identifier = CM_WIDTH_PEN_NORMAL;
55 + Text [ en-US ] = "~Normal";
56 + };
57 + MenuItem
58 + {
59 + Identifier = CM_WIDTH_PEN_THICK;
60 + Text [ en-US ] = "~Thick";
61 + };
62 + MenuItem
63 + {
64 + Identifier = CM_WIDTH_PEN_VERY_THICK;
65 + Text [ en-US ] = "~Very Thick";
66 + };
67 + };
68 + };
69 + };
70 + MenuItem
71 + {
72 + Separator = TRUE;
73 + };
74 + MenuItem
75 + {
76 + Identifier = CM_COLOR_PEN ;
77 + Text [ en-US ] = "~Change Color" ;
78 + };
79 + MenuItem
80 + {
81 + Separator = TRUE;
82 + };
83 MenuItem
85 Identifier = CM_ENDSHOW ;
87 Modified: sd/source/ui/slideshow/slideshowimpl.cxx
88 ==============================================================================
89 --- sd/source/ui/slideshow/slideshowimpl.cxx Sat Jan 31 09:53:18 2009 (r267232)
90 +++ sd/source/ui/slideshow/slideshowimpl.cxx Sat Jan 31 14:05:38 2009 (r267233)
91 @@ -84,6 +84,7 @@
92 #include "canvas/elapsedtime.hxx"
93 #include "canvas/prioritybooster.hxx"
94 #include "avmedia/mediawindow.hxx"
95 +#include "svtools/colrdlg.hxx"
97 #include <boost/noncopyable.hpp>
98 #include <boost/bind.hpp>
99 @@ -532,7 +533,8 @@
100 , mbInputFreeze(false)
101 , mbActive(sal_False)
102 , maPresSettings( pDoc->getPresentationSettings() )
103 -, mnUserPaintColor( 0x0000FF00L )
104 +, mnUserPaintColor( 0x00000000L )
105 +, mdUserPaintStrokeWidth ( 4.0 )
106 , mnEntryCounter(0)
107 , mnLastSlideNumber(-1)
108 , msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") )
109 @@ -2111,6 +2113,8 @@
111 PopupMenu* pMenu = new PopupMenu( SdResId( RID_SLIDESHOW_CONTEXTMENU ) );
113 + pMenu->EnableItem( CM_COLOR_PEN, (maPresSettings.mbMouseAsPen));
115 const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
116 pMenu->EnableItem( CM_NEXT_SLIDE, ( mpSlideController->getNextSlideIndex() != -1 ) );
117 pMenu->EnableItem( CM_PREV_SLIDE, ( mpSlideController->getPreviousSlideIndex() != -1 ) || (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) );
118 @@ -2178,6 +2182,55 @@
123 + PopupMenu* pWidthMenu = pMenu->GetPopupMenu( CM_WIDTH_PEN);
125 + // populate color width list
126 + if( pWidthMenu )
128 + if(! maPresSettings.mbMouseAsPen)
130 + pMenu->EnableItem( CM_WIDTH_PEN, FALSE );
132 + else
134 + sal_Int32 nIterator;
135 + double nWidth;
139 + nWidth = 4.0;
140 + for( nIterator = 1; nIterator < 6; nIterator++)
142 + switch(nIterator)
144 + case 1:
145 + nWidth = 4.0;
146 + break;
147 + case 2:
148 + nWidth = 100.0;
149 + break;
150 + case 3:
151 + nWidth = 150.0;
152 + break;
153 + case 4:
154 + nWidth = 200.0;
155 + break;
156 + case 5:
157 + nWidth = 400.0;
158 + break;
159 + default:
160 + break;
163 + pWidthMenu->EnableItem( (USHORT)(CM_WIDTH_PEN + nIterator), TRUE);
164 + if( nWidth == mdUserPaintStrokeWidth)
165 + pWidthMenu->CheckItem( (USHORT)(CM_WIDTH_PEN + nIterator) );
171 pMenu->SetSelectHdl( LINK( this, SlideshowImpl, ContextMenuSelectHdl ) );
172 pMenu->Execute( mpShowWindow, maPopupMousePos );
173 delete pMenu;
174 @@ -2240,6 +2293,59 @@
177 break;
179 + case CM_COLOR_PEN:
180 + if( maPresSettings.mbMouseAsPen ){
182 + //Open a color picker based on SvColorDialog
183 + ::Color aColor( mnUserPaintColor );
184 + SvColorDialog aColorDlg( mpShowWindow);
185 + aColorDlg.SetColor( aColor );
187 + if (aColorDlg.Execute() )
188 + {
189 + aColor = aColorDlg.GetColor();
190 + mnUserPaintColor = aColor.GetColor();
191 + setPenColor(mnUserPaintColor);
193 + mbWasPaused = false;
195 + break;
197 + case CM_WIDTH_PEN_VERY_THIN:
198 + if( maPresSettings.mbMouseAsPen ){
199 + setPenWidth(4.0);
200 + mbWasPaused = false;
202 + break;
204 + case CM_WIDTH_PEN_THIN:
205 + if( maPresSettings.mbMouseAsPen ){
206 + setPenWidth(100.0);
207 + mbWasPaused = false;
209 + break;
211 + case CM_WIDTH_PEN_NORMAL:
212 + if( maPresSettings.mbMouseAsPen ){
213 + setPenWidth(150.0);
214 + mbWasPaused = false;
216 + break;
218 + case CM_WIDTH_PEN_THICK:
219 + if( maPresSettings.mbMouseAsPen ){
220 + setPenWidth(200.0);
221 + mbWasPaused = false;
223 + break;
225 + case CM_WIDTH_PEN_VERY_THICK:
226 + if( maPresSettings.mbMouseAsPen ){
227 + setPenWidth(400.0);
228 + mbWasPaused = false;
230 + break;
232 case CM_ENDSHOW:
233 // in case the user cancels the presentation, switch to current slide
234 @@ -2824,6 +2930,17 @@
235 aPenProp.Value = aValue;
237 mxShow->setProperty( aPenProp );
239 + //for StrokeWidth :
240 + Any aValueWidth;
241 + if( maPresSettings.mbMouseAsPen )
242 + aValueWidth <<= mdUserPaintStrokeWidth;
244 + beans::PropertyValue aPenPropWidth;
245 + aPenPropWidth.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "UserPaintStrokeWidth" ));
246 + aPenPropWidth.Value = aValueWidth;
248 + mxShow->setProperty( aPenPropWidth );
250 catch( Exception& e )
252 @@ -2837,6 +2954,27 @@
257 +// --------------------------------------------------------------------
259 +double SAL_CALL SlideshowImpl::getPenWidth() throw (RuntimeException)
261 + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
262 + return mdUserPaintStrokeWidth;
266 +// --------------------------------------------------------------------
268 +void SAL_CALL SlideshowImpl::setPenWidth( double dStrokeWidth ) throw (RuntimeException)
270 + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
271 + mdUserPaintStrokeWidth = dStrokeWidth;
272 + if( maPresSettings.mbMouseAsPen )
273 + setUsePen( sal_True ); // update color and width
277 // --------------------------------------------------------------------
279 sal_Int32 SAL_CALL SlideshowImpl::getPenColor() throw (RuntimeException)
280 @@ -2845,6 +2983,7 @@
281 return mnUserPaintColor;
285 // --------------------------------------------------------------------
287 void SAL_CALL SlideshowImpl::setPenColor( sal_Int32 nColor ) throw (RuntimeException)
288 @@ -2852,7 +2991,7 @@
289 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
290 mnUserPaintColor = nColor;
291 if( maPresSettings.mbMouseAsPen )
292 - setUsePen( sal_True ); // update color
293 + setUsePen( sal_True ); // update color and width
296 // --------------------------------------------------------------------
298 Modified: sd/source/ui/slideshow/slideshowimpl.hxx
299 ==============================================================================
300 --- sd/source/ui/slideshow/slideshowimpl.hxx Sat Jan 31 09:53:18 2009 (r267232)
301 +++ sd/source/ui/slideshow/slideshowimpl.hxx Sat Jan 31 14:05:38 2009 (r267233)
302 @@ -200,6 +200,8 @@
303 virtual void SAL_CALL setMouseVisible( ::sal_Bool _mousevisible ) throw (css::uno::RuntimeException);
304 virtual ::sal_Bool SAL_CALL getUsePen() throw (css::uno::RuntimeException);
305 virtual void SAL_CALL setUsePen( ::sal_Bool _usepen ) throw (css::uno::RuntimeException);
306 + virtual double SAL_CALL getPenWidth() throw (css::uno::RuntimeException);
307 + virtual void SAL_CALL setPenWidth( double dStrokeWidth ) throw (css::uno::RuntimeException);
308 virtual ::sal_Int32 SAL_CALL getPenColor() throw (css::uno::RuntimeException);
309 virtual void SAL_CALL setPenColor( ::sal_Int32 _pencolor ) throw (css::uno::RuntimeException);
310 virtual ::sal_Bool SAL_CALL isRunning( ) throw (css::uno::RuntimeException);
311 @@ -379,6 +381,8 @@
312 PresentationSettings maPresSettings;
313 sal_Int32 mnUserPaintColor;
315 + double mdUserPaintStrokeWidth;
317 /// used in updateHdl to prevent recursive calls
318 sal_Int32 mnEntryCounter;
321 Modified: slideshow/source/engine/eventmultiplexer.cxx
322 ==============================================================================
323 --- slideshow/source/engine/eventmultiplexer.cxx Sat Jan 31 09:53:18 2009 (r267232)
324 +++ slideshow/source/engine/eventmultiplexer.cxx Sat Jan 31 14:05:38 2009 (r267233)
325 @@ -1065,6 +1065,14 @@
326 boost::cref(rUserColor)));
329 +bool EventMultiplexer::notifyUserPaintStrokeWidth( double rUserStrokeWidth )
331 + return mpImpl->maUserPaintEventHandlers.applyAll(
332 + boost::bind(&UserPaintEventHandler::widthChanged,
333 + _1,
334 + rUserStrokeWidth));
337 bool EventMultiplexer::notifyUserPaintDisabled()
339 return mpImpl->maUserPaintEventHandlers.applyAll(
341 Modified: slideshow/source/engine/slide/slideimpl.cxx
342 ==============================================================================
343 --- slideshow/source/engine/slide/slideimpl.cxx Sat Jan 31 09:53:18 2009 (r267232)
344 +++ slideshow/source/engine/slide/slideimpl.cxx Sat Jan 31 14:05:38 2009 (r267233)
345 @@ -113,6 +113,7 @@
346 const ShapeEventListenerMap& rShapeListenerMap,
347 const ShapeCursorMap& rShapeCursorMap,
348 RGBColor const& rUserPaintColor,
349 + double dUserPaintStrokeWidth,
350 bool bUserPaintEnabled,
351 bool bIntrinsicAnimationsAllowed,
352 bool bDisableAnimationZOrder );
353 @@ -246,6 +247,7 @@
354 SlideAnimations maAnimations;
356 RGBColor maUserPaintColor;
357 + double mdUserPaintStrokeWidth;
358 UserPaintOverlaySharedPtr mpPaintOverlay;
360 /// Bitmaps with slide content at various states
361 @@ -347,6 +349,7 @@
362 const ShapeEventListenerMap& rShapeListenerMap,
363 const ShapeCursorMap& rShapeCursorMap,
364 RGBColor const& aUserPaintColor,
365 + double dUserPaintStrokeWidth,
366 bool bUserPaintEnabled,
367 bool bIntrinsicAnimationsAllowed,
368 bool bDisableAnimationZOrder ) :
369 @@ -376,6 +379,7 @@
370 maAnimations( maContext,
371 getSlideSizeImpl() ),
372 maUserPaintColor(aUserPaintColor),
373 + mdUserPaintStrokeWidth(dUserPaintStrokeWidth),
374 mpPaintOverlay(),
375 maSlideBitmaps(),
376 meAnimationState( CONSTRUCTING_STATE ),
377 @@ -863,7 +867,7 @@
379 if( mbUserPaintOverlayEnabled )
380 mpPaintOverlay = UserPaintOverlay::create( maUserPaintColor,
381 - 2.0,
382 + mdUserPaintStrokeWidth,
383 maContext );
386 @@ -1188,6 +1192,7 @@
387 const ShapeEventListenerMap& rShapeListenerMap,
388 const ShapeCursorMap& rShapeCursorMap,
389 RGBColor const& rUserPaintColor,
390 + double dUserPaintStrokeWidth,
391 bool bUserPaintEnabled,
392 bool bIntrinsicAnimationsAllowed,
393 bool bDisableAnimationZOrder )
394 @@ -1198,7 +1203,7 @@
395 rCursorManager, rViewContainer,
396 xComponentContext, rShapeListenerMap,
397 rShapeCursorMap, rUserPaintColor,
398 - bUserPaintEnabled,
399 + dUserPaintStrokeWidth, bUserPaintEnabled,
400 bIntrinsicAnimationsAllowed,
401 bDisableAnimationZOrder ));
404 Modified: slideshow/source/engine/slide/userpaintoverlay.cxx
405 ==============================================================================
406 --- slideshow/source/engine/slide/userpaintoverlay.cxx Sat Jan 31 09:53:18 2009 (r267232)
407 +++ slideshow/source/engine/slide/userpaintoverlay.cxx Sat Jan 31 14:05:38 2009 (r267233)
408 @@ -63,7 +63,8 @@
409 namespace internal
411 class PaintOverlayHandler : public MouseEventHandler,
412 - public ViewEventHandler
413 + public ViewEventHandler,
414 + public UserPaintEventHandler
416 public:
417 PaintOverlayHandler( const RGBColor& rStrokeColor,
418 @@ -208,6 +209,7 @@
419 if( pPolyPoly )
421 pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() );
422 + pPolyPoly->setStrokeWidth(mnStrokeWidth);
423 pPolyPoly->draw();
426 @@ -226,6 +228,24 @@
427 return false; // did not handle the event
431 + bool colorChanged( RGBColor const& rUserColor ){
432 + this->maStrokeColor = rUserColor;
433 + return true;
436 + bool widthChanged( double nUserStrokeWidth ){
437 + this->mnStrokeWidth = nUserStrokeWidth;
438 + return true;
441 + bool disable(){
442 + //this->maStrokeColor = *(new RGBColor(255,255,255));
443 + //this->mnStrokeWidth = 4.0;
444 + return true;
448 private:
449 ActivitiesQueue& mrActivitiesQueue;
450 ScreenUpdater& mrScreenUpdater;
451 @@ -262,6 +282,7 @@
452 mrMultiplexer.addClickHandler( mpHandler, 3.0 );
453 mrMultiplexer.addMouseMoveHandler( mpHandler, 3.0 );
454 mrMultiplexer.addViewHandler( mpHandler );
455 + mrMultiplexer.addUserPaintHandler(mpHandler);
458 UserPaintOverlay::~UserPaintOverlay()
460 Modified: slideshow/source/engine/slideshowimpl.cxx
461 ==============================================================================
462 --- slideshow/source/engine/slideshowimpl.cxx Sat Jan 31 09:53:18 2009 (r267232)
463 +++ slideshow/source/engine/slideshowimpl.cxx Sat Jan 31 14:05:38 2009 (r267233)
464 @@ -332,6 +332,8 @@
466 boost::optional<RGBColor> maUserPaintColor;
468 + boost::optional<double> maUserPaintStrokeWidth;
470 boost::shared_ptr<canvas::tools::ElapsedTime> mpPresTimer;
471 ScreenUpdater maScreenUpdater;
472 EventQueue maEventQueue;
473 @@ -444,6 +446,7 @@
474 maShapeEventListeners(),
475 maShapeCursors(),
476 maUserPaintColor(),
477 + maUserPaintStrokeWidth(4.0),
478 mpPresTimer( new canvas::tools::ElapsedTime ),
479 maScreenUpdater(maViewContainer),
480 maEventQueue( mpPresTimer ),
481 @@ -767,6 +770,7 @@
482 maShapeEventListeners,
483 maShapeCursors,
484 maUserPaintColor ? *maUserPaintColor : RGBColor(),
485 + *maUserPaintStrokeWidth,
486 !!maUserPaintColor,
487 mbImageAnimationsAllowed,
488 mbDisableAnimationZOrder) );
489 @@ -1173,6 +1177,34 @@
491 return true;
494 + // new Property for pen's width
495 + if (rProperty.Name.equalsAsciiL(
496 + RTL_CONSTASCII_STRINGPARAM("UserPaintStrokeWidth") ))
498 + double nWidth(4.0);
499 + if (rProperty.Value >>= nWidth)
501 + OSL_ENSURE( mbMouseVisible,
502 + "setProperty(): User paint overrides invisible mouse" );
504 + // enable user paint stroke width
505 + maUserPaintStrokeWidth.reset( nWidth );
506 + maEventMultiplexer.notifyUserPaintStrokeWidth( *maUserPaintStrokeWidth );
508 + else
510 + // disable user paint stroke width
511 + maUserPaintStrokeWidth.reset();
512 + maEventMultiplexer.notifyUserPaintDisabled();
515 + if( mnCurrentCursor == awt::SystemPointer::ARROW )
516 + resetCursor();
518 + return true;
519 + }
522 if (rProperty.Name.equalsAsciiL(
523 RTL_CONSTASCII_STRINGPARAM("AdvanceOnClick") ))
525 Modified: slideshow/source/inc/eventmultiplexer.hxx
526 ==============================================================================
527 --- slideshow/source/inc/eventmultiplexer.hxx Sat Jan 31 09:53:18 2009 (r267232)
528 +++ slideshow/source/inc/eventmultiplexer.hxx Sat Jan 31 14:05:38 2009 (r267233)
529 @@ -486,6 +486,17 @@
531 bool notifyUserPaintColor( RGBColor const& rUserColor );
533 + /** Notify a new user paint width
535 + Sending this notification also implies that user paint is
536 + enabled. .
538 + @return true, if this event was processed by
539 + anybody. If false is returned, no handler processed
540 + this event (and probably, nothing will happen at all)
541 + */
542 + bool notifyUserPaintStrokeWidth( double rUserStrokeWidth );
544 /** Notify that user paint is disabled
546 User paint denotes the feature to draw colored lines on top of
548 Modified: slideshow/source/inc/slide.hxx
549 ==============================================================================
550 --- slideshow/source/inc/slide.hxx Sat Jan 31 09:53:18 2009 (r267232)
551 +++ slideshow/source/inc/slide.hxx Sat Jan 31 14:05:38 2009 (r267233)
552 @@ -198,6 +198,7 @@
553 const ShapeEventListenerMap& rShapeListenerMap,
554 const ShapeCursorMap& rShapeCursorMap,
555 RGBColor const& aUserPaintColor,
556 + double dUserPaintStrokeWidth,
557 bool bUserPaintEnabled,
558 bool bIntrinsicAnimationsAllowed,
559 bool bDisableAnimationZOrder );
561 Modified: slideshow/source/inc/userpainteventhandler.hxx
562 ==============================================================================
563 --- slideshow/source/inc/userpainteventhandler.hxx Sat Jan 31 09:53:18 2009 (r267232)
564 +++ slideshow/source/inc/userpainteventhandler.hxx Sat Jan 31 14:05:38 2009 (r267233)
565 @@ -53,6 +53,7 @@
566 virtual ~UserPaintEventHandler() {}
568 virtual bool colorChanged( RGBColor const& rUserColor ) = 0;
569 + virtual bool widthChanged( double nUserStrokeWidth ) = 0;
570 virtual bool disable() = 0;