LCOV - code coverage report
Current view: top level - slideshow/source/engine/slide - userpaintoverlay.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 201 0.0 %
Date: 2012-08-25 Functions: 0 31 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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                 :            : 
      21                 :            : #include <canvas/debug.hxx>
      22                 :            : 
      23                 :            : #include <comphelper/anytostring.hxx>
      24                 :            : #include <cppuhelper/exc_hlp.hxx>
      25                 :            : 
      26                 :            : #include <com/sun/star/awt/MouseButton.hpp>
      27                 :            : #include <com/sun/star/presentation/XSlideShowView.hpp>
      28                 :            : 
      29                 :            : #include <basegfx/point/b2dpoint.hxx>
      30                 :            : #include <basegfx/polygon/b2dpolygon.hxx>
      31                 :            : #include <cppcanvas/basegfxfactory.hxx>
      32                 :            : 
      33                 :            : #include "activity.hxx"
      34                 :            : #include "activitiesqueue.hxx"
      35                 :            : #include "slideshowcontext.hxx"
      36                 :            : #include "userpaintoverlay.hxx"
      37                 :            : #include "mouseeventhandler.hxx"
      38                 :            : #include "eventmultiplexer.hxx"
      39                 :            : #include "screenupdater.hxx"
      40                 :            : #include "vieweventhandler.hxx"
      41                 :            : 
      42                 :            : #include <boost/bind.hpp>
      43                 :            : #include <boost/noncopyable.hpp>
      44                 :            : #include "slide.hxx"
      45                 :            : #include "cursormanager.hxx"
      46                 :            : 
      47                 :            : using namespace ::com::sun::star;
      48                 :            : 
      49                 :            : namespace slideshow
      50                 :            : {
      51                 :            :     namespace internal
      52                 :            :     {
      53                 :          0 :         class PaintOverlayHandler : public MouseEventHandler,
      54                 :            :                                     public ViewEventHandler,
      55                 :            :                     public UserPaintEventHandler
      56                 :            :         {
      57                 :            :         public:
      58                 :          0 :             PaintOverlayHandler( const RGBColor&          rStrokeColor,
      59                 :            :                                  double                   nStrokeWidth,
      60                 :            :                                  ActivitiesQueue&         rActivitiesQueue,
      61                 :            :                                  ScreenUpdater&           rScreenUpdater,
      62                 :            :                                  const UnoViewContainer&  rViews,
      63                 :            :                                  Slide&                   rSlide,
      64                 :            :                                  const PolyPolygonVector& rPolygons,
      65                 :            :                                  bool                     bActive ) :
      66                 :            :                 mrActivitiesQueue( rActivitiesQueue ),
      67                 :            :                 mrScreenUpdater( rScreenUpdater ),
      68                 :            :                 maViews(),
      69                 :            :                 maPolygons( rPolygons ),
      70                 :            :                 maStrokeColor( rStrokeColor ),
      71                 :            :                 mnStrokeWidth( nStrokeWidth ),
      72                 :            :                 maLastPoint(),
      73                 :            :                 maLastMouseDownPos(),
      74                 :            :                 mbIsLastPointValid( false ),
      75                 :            :                 mbIsLastMouseDownPosValid( false ),
      76                 :            :                 //handle the "remove all ink from slide" mode of erasing
      77                 :            :                 mbIsEraseAllModeActivated( false ),
      78                 :            :                 //handle the "remove stroke by stroke" mode of erasing
      79                 :            :                 mbIsEraseModeActivated( false ),
      80                 :            :                 mrSlide(rSlide),
      81                 :            :                 mnSize(100),
      82                 :          0 :                 mbActive( bActive )
      83                 :            :             {
      84                 :            :                 std::for_each( rViews.begin(),
      85                 :            :                                rViews.end(),
      86                 :            :                                boost::bind( &PaintOverlayHandler::viewAdded,
      87                 :            :                                             this,
      88                 :          0 :                                             _1 ));
      89                 :          0 :                 drawPolygons();
      90                 :          0 :             }
      91                 :            : 
      92                 :          0 :             virtual void dispose()
      93                 :            :             {
      94                 :          0 :                 maViews.clear();
      95                 :          0 :             }
      96                 :            : 
      97                 :            :             // ViewEventHandler methods
      98                 :          0 :             virtual void viewAdded( const UnoViewSharedPtr& rView )
      99                 :            :             {
     100                 :          0 :                 maViews.push_back( rView );
     101                 :          0 :             }
     102                 :            : 
     103                 :          0 :             virtual void viewRemoved( const UnoViewSharedPtr& rView )
     104                 :            :             {
     105                 :            :                 maViews.erase( ::std::remove( maViews.begin(),
     106                 :            :                                               maViews.end(),
     107                 :          0 :                                               rView ) );
     108                 :          0 :             }
     109                 :            : 
     110                 :          0 :             virtual void viewChanged( const UnoViewSharedPtr& /*rView*/ )
     111                 :            :             {
     112                 :            :                 // TODO(F2): for persistent drawings, need to store
     113                 :            :                 // polygon and repaint here.
     114                 :          0 :             }
     115                 :            : 
     116                 :          0 :             virtual void viewsChanged()
     117                 :            :             {
     118                 :            :                 // TODO(F2): for persistent drawings, need to store
     119                 :            :                 // polygon and repaint here.
     120                 :          0 :             }
     121                 :            : 
     122                 :          0 :             bool colorChanged( RGBColor const& rUserColor )
     123                 :            :             {
     124                 :          0 :                 mbIsLastPointValid = false;
     125                 :          0 :                 mbActive = true;
     126                 :          0 :                 this->maStrokeColor = rUserColor;
     127                 :          0 :                 this->mbIsEraseModeActivated = false;
     128                 :          0 :                 return true;
     129                 :            :             }
     130                 :            : 
     131                 :          0 :             bool widthChanged( double nUserStrokeWidth )
     132                 :            :             {
     133                 :          0 :                 this->mnStrokeWidth = nUserStrokeWidth;
     134                 :          0 :                 mbIsEraseModeActivated = false;
     135                 :          0 :                 return true;
     136                 :            :             }
     137                 :            : 
     138                 :          0 :             void repaintWithoutPolygons()
     139                 :            :             {
     140                 :            :                     // must get access to the instance to erase all polygon
     141                 :          0 :                     for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
     142                 :            :                         aIter!=aEnd;
     143                 :            :                         ++aIter )
     144                 :            :                     {
     145                 :            :                         // fully clear view content to background color
     146                 :            :                         //(*aIter)->getCanvas()->clear();
     147                 :            : 
     148                 :            :                         //get via SlideImpl instance the bitmap of the slide unmodified to redraw it
     149                 :          0 :                         SlideBitmapSharedPtr         pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) );
     150                 :          0 :                         ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() );
     151                 :            : 
     152                 :          0 :                         const ::basegfx::B2DHomMatrix   aViewTransform( (*aIter)->getTransformation() );
     153                 :          0 :                         const ::basegfx::B2DPoint       aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
     154                 :            : 
     155                 :            :                         // setup a canvas with device coordinate space, the slide
     156                 :            :                         // bitmap already has the correct dimension.
     157                 :          0 :                         ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() );
     158                 :            : 
     159                 :          0 :                         pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() );
     160                 :            : 
     161                 :            :                         // render at given output position
     162                 :          0 :                         pBitmap->move( aOutPosPixel );
     163                 :            : 
     164                 :            :                         // clear clip (might have been changed, e.g. from comb
     165                 :            :                         // transition)
     166                 :          0 :                         pBitmap->clip( ::basegfx::B2DPolyPolygon() );
     167                 :          0 :                         pBitmap->draw( pDevicePixelCanvas );
     168                 :            : 
     169                 :          0 :                         mrScreenUpdater.notifyUpdate(*aIter,true);
     170                 :          0 :                     }
     171                 :          0 :             }
     172                 :            : 
     173                 :          0 :             bool eraseAllInkChanged( bool const& rEraseAllInk )
     174                 :            :             {
     175                 :          0 :                 this->mbIsEraseAllModeActivated= rEraseAllInk;
     176                 :            :                 // if the erase all mode is activated it will remove all ink from slide,
     177                 :            :                 // therefor destroy all the polygons stored
     178                 :          0 :                 if(mbIsEraseAllModeActivated)
     179                 :            :                 {
     180                 :            :                     // The Erase Mode should be desactivated
     181                 :          0 :                     mbIsEraseModeActivated = false;
     182                 :          0 :                     repaintWithoutPolygons();
     183                 :          0 :                     maPolygons.clear();
     184                 :            :                 }
     185                 :          0 :             mbIsEraseAllModeActivated=false;
     186                 :          0 :             return true;
     187                 :            :             }
     188                 :            : 
     189                 :          0 :             bool eraseInkWidthChanged( sal_Int32 rEraseInkSize )
     190                 :            :             {
     191                 :            :                 // Change the size
     192                 :          0 :                 this->mnSize=rEraseInkSize;
     193                 :            :                 // Changed to mode Erase
     194                 :          0 :                 this->mbIsEraseModeActivated = true;
     195                 :          0 :                 return true;
     196                 :            :             }
     197                 :            : 
     198                 :          0 :             bool switchPenMode()
     199                 :            :             {
     200                 :          0 :                 mbIsLastPointValid = false;
     201                 :          0 :                 mbActive = true;
     202                 :          0 :                 this->mbIsEraseModeActivated = false;
     203                 :          0 :                 return true;
     204                 :            :             }
     205                 :            : 
     206                 :          0 :             bool switchEraserMode()
     207                 :            :             {
     208                 :          0 :                 mbIsLastPointValid = false;
     209                 :          0 :                 mbActive = true;
     210                 :          0 :                 this->mbIsEraseModeActivated = true;
     211                 :          0 :                 return true;
     212                 :            :             }
     213                 :            : 
     214                 :          0 :             bool disable()
     215                 :            :             {
     216                 :          0 :                 mbIsLastPointValid = false;
     217                 :          0 :                 mbIsLastMouseDownPosValid = false;
     218                 :          0 :                 mbActive = false;
     219                 :          0 :                 return true;
     220                 :            :             }
     221                 :            : 
     222                 :            :             //Draw all registered polygons.
     223                 :          0 :             void drawPolygons()
     224                 :            :             {
     225                 :          0 :                 for( PolyPolygonVector::iterator aIter=maPolygons.begin(), aEnd=maPolygons.end();
     226                 :            :                                      aIter!=aEnd;
     227                 :            :                                      ++aIter )
     228                 :            :                 {
     229                 :          0 :                     (*aIter)->draw();
     230                 :            :                 }
     231                 :            :                 // screen update necessary to show painting
     232                 :          0 :                 mrScreenUpdater.notifyUpdate();
     233                 :          0 :             }
     234                 :            : 
     235                 :            :             //Retrieve all registered polygons.
     236                 :          0 :             PolyPolygonVector getPolygons()
     237                 :            :             {
     238                 :          0 :                 return maPolygons;
     239                 :            :             }
     240                 :            : 
     241                 :            :             // MouseEventHandler methods
     242                 :          0 :             virtual bool handleMousePressed( const awt::MouseEvent& e )
     243                 :            :             {
     244                 :          0 :                 if( !mbActive )
     245                 :          0 :                     return false;
     246                 :            : 
     247                 :          0 :                 if (e.Buttons == awt::MouseButton::RIGHT)
     248                 :            :                 {
     249                 :          0 :                     mbIsLastPointValid = false;
     250                 :          0 :                     return false;
     251                 :            :                 }
     252                 :            : 
     253                 :          0 :                 if (e.Buttons != awt::MouseButton::LEFT)
     254                 :          0 :                     return false;
     255                 :            : 
     256                 :          0 :                 maLastMouseDownPos.setX( e.X );
     257                 :          0 :                 maLastMouseDownPos.setY( e.Y );
     258                 :          0 :                 mbIsLastMouseDownPosValid = true;
     259                 :            : 
     260                 :            :                 // eat mouse click (though we don't process it
     261                 :            :                 // _directly_, it enables the drag mode
     262                 :          0 :                 return true;
     263                 :            :             }
     264                 :            : 
     265                 :          0 :             virtual bool handleMouseReleased( const awt::MouseEvent& e )
     266                 :            :             {
     267                 :          0 :                 if( !mbActive )
     268                 :          0 :                     return false;
     269                 :            : 
     270                 :          0 :                 if (e.Buttons == awt::MouseButton::RIGHT)
     271                 :            :                 {
     272                 :          0 :                     mbIsLastPointValid = false;
     273                 :          0 :                     return false;
     274                 :            :                 }
     275                 :            : 
     276                 :          0 :                 if (e.Buttons != awt::MouseButton::LEFT)
     277                 :          0 :                     return false;
     278                 :            : 
     279                 :            :                 // check, whether up- and down press are on exactly
     280                 :            :                 // the same pixel. If that's the case, ignore the
     281                 :            :                 // click, and pass on the event to low-prio
     282                 :            :                 // handlers. This effectively permits effect
     283                 :            :                 // advancements via clicks also when user paint is
     284                 :            :                 // enabled.
     285                 :          0 :                 if( mbIsLastMouseDownPosValid &&
     286                 :            :                     ::basegfx::B2DPoint( e.X,
     287                 :          0 :                                          e.Y ) == maLastMouseDownPos )
     288                 :            :                 {
     289                 :          0 :                     mbIsLastMouseDownPosValid = false;
     290                 :          0 :                     return false;
     291                 :            :                 }
     292                 :            : 
     293                 :            :                 // invalidate, next downpress will have to start a new
     294                 :            :                 // polygon.
     295                 :          0 :                 mbIsLastPointValid = false;
     296                 :            : 
     297                 :            :                 // eat mouse click (though we don't process it
     298                 :            :                 // _directly_, it enables the drag mode
     299                 :          0 :                 return true;
     300                 :            :             }
     301                 :            : 
     302                 :          0 :             virtual bool handleMouseEntered( const awt::MouseEvent& e )
     303                 :            :             {
     304                 :          0 :                 if( !mbActive )
     305                 :          0 :                     return false;
     306                 :            : 
     307                 :          0 :                 mbIsLastPointValid = true;
     308                 :          0 :                 maLastPoint.setX( e.X );
     309                 :          0 :                 maLastPoint.setY( e.Y );
     310                 :            : 
     311                 :          0 :                 return true;
     312                 :            :             }
     313                 :            : 
     314                 :          0 :             virtual bool handleMouseExited( const awt::MouseEvent& )
     315                 :            :             {
     316                 :          0 :                 if( !mbActive )
     317                 :          0 :                     return false;
     318                 :            : 
     319                 :          0 :                 mbIsLastPointValid = false;
     320                 :          0 :                 mbIsLastMouseDownPosValid = false;
     321                 :            : 
     322                 :          0 :                 return true;
     323                 :            :             }
     324                 :            : 
     325                 :          0 :             virtual bool handleMouseDragged( const awt::MouseEvent& e )
     326                 :            :             {
     327                 :          0 :                 if( !mbActive )
     328                 :          0 :                     return false;
     329                 :            : 
     330                 :          0 :                 if (e.Buttons == awt::MouseButton::RIGHT)
     331                 :            :                 {
     332                 :          0 :                     mbIsLastPointValid = false;
     333                 :          0 :                     return false;
     334                 :            :                 }
     335                 :            : 
     336                 :          0 :                 if(mbIsEraseModeActivated)
     337                 :            :                 {
     338                 :            :                     //define the last point as an object
     339                 :            :                     //we suppose that there's no way this point could be valid
     340                 :          0 :                     ::basegfx::B2DPolygon aPoly;
     341                 :            : 
     342                 :          0 :                     maLastPoint.setX( e.X-mnSize );
     343                 :          0 :                     maLastPoint.setY( e.Y-mnSize );
     344                 :            : 
     345                 :          0 :                     aPoly.append( maLastPoint );
     346                 :            : 
     347                 :          0 :                     maLastPoint.setX( e.X-mnSize );
     348                 :          0 :                     maLastPoint.setY( e.Y+mnSize );
     349                 :            : 
     350                 :          0 :                     aPoly.append( maLastPoint );
     351                 :          0 :                     maLastPoint.setX( e.X+mnSize );
     352                 :          0 :                     maLastPoint.setY( e.Y+mnSize );
     353                 :            : 
     354                 :          0 :                     aPoly.append( maLastPoint );
     355                 :          0 :                     maLastPoint.setX( e.X+mnSize );
     356                 :          0 :                     maLastPoint.setY( e.Y-mnSize );
     357                 :            : 
     358                 :          0 :                     aPoly.append( maLastPoint );
     359                 :          0 :                     maLastPoint.setX( e.X-mnSize );
     360                 :          0 :                     maLastPoint.setY( e.Y-mnSize );
     361                 :            : 
     362                 :          0 :                     aPoly.append( maLastPoint );
     363                 :            : 
     364                 :            :                     //now we have defined a Polygon that is closed
     365                 :            : 
     366                 :            :                     //The point is to redraw the LastPoint the way it was originally on the bitmap,
     367                 :            :                     //of the slide
     368                 :          0 :             for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
     369                 :            :                         aIter!=aEnd;
     370                 :            :                         ++aIter )
     371                 :            :                     {
     372                 :            : 
     373                 :            :                         //get via SlideImpl instance the bitmap of the slide unmodified to redraw it
     374                 :          0 :                         SlideBitmapSharedPtr         pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) );
     375                 :          0 :                         ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() );
     376                 :            : 
     377                 :          0 :                         ::basegfx::B2DHomMatrix     aViewTransform( (*aIter)->getTransformation() );
     378                 :          0 :                         const ::basegfx::B2DPoint       aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
     379                 :            : 
     380                 :            :                         // setup a canvas with device coordinate space, the slide
     381                 :            :                         // bitmap already has the correct dimension.
     382                 :          0 :                         ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() );
     383                 :            : 
     384                 :          0 :                         pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() );
     385                 :            : 
     386                 :            :                         // render at given output position
     387                 :          0 :                         pBitmap->move( aOutPosPixel );
     388                 :            : 
     389                 :          0 :                         ::basegfx::B2DPolyPolygon aPolyPoly=::basegfx::B2DPolyPolygon(aPoly);
     390                 :          0 :                         aViewTransform.translate(-aOutPosPixel.getX(), -aOutPosPixel.getY());
     391                 :          0 :                         aPolyPoly.transform(aViewTransform);
     392                 :            :                         // set clip so that we just redraw a part of the canvas
     393                 :          0 :                         pBitmap->clip(aPolyPoly);
     394                 :          0 :                         pBitmap->draw( pDevicePixelCanvas );
     395                 :            : 
     396                 :          0 :                         mrScreenUpdater.notifyUpdate(*aIter,true);
     397                 :          0 :                     }
     398                 :            : 
     399                 :            :         }
     400                 :            :                 else
     401                 :            :                 {
     402                 :          0 :                     if( !mbIsLastPointValid )
     403                 :            :                     {
     404                 :          0 :                         mbIsLastPointValid = true;
     405                 :          0 :                         maLastPoint.setX( e.X );
     406                 :          0 :                         maLastPoint.setY( e.Y );
     407                 :            :                     }
     408                 :            :                     else
     409                 :            :                     {
     410                 :          0 :                         ::basegfx::B2DPolygon aPoly;
     411                 :          0 :                         aPoly.append( maLastPoint );
     412                 :            : 
     413                 :          0 :                         maLastPoint.setX( e.X );
     414                 :          0 :                         maLastPoint.setY( e.Y );
     415                 :            : 
     416                 :          0 :                         aPoly.append( maLastPoint );
     417                 :            : 
     418                 :            :                         // paint to all views
     419                 :          0 :                         for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
     420                 :            :                              aIter!=aEnd;
     421                 :            :                              ++aIter )
     422                 :            :                         {
     423                 :            :                             ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
     424                 :          0 :                                 ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(),
     425                 :          0 :                                                                                               aPoly ) );
     426                 :            : 
     427                 :          0 :                             if( pPolyPoly )
     428                 :            :                             {
     429                 :          0 :                                 pPolyPoly->setStrokeWidth(mnStrokeWidth);
     430                 :          0 :                                 pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() );
     431                 :          0 :                                 pPolyPoly->draw();
     432                 :          0 :                                 maPolygons.push_back(pPolyPoly);
     433                 :            :                             }
     434                 :          0 :                         }
     435                 :            : 
     436                 :            :                         // screen update necessary to show painting
     437                 :          0 :                         mrScreenUpdater.notifyUpdate();
     438                 :            :                     }
     439                 :            :                 }
     440                 :            :                 // mouse events captured
     441                 :          0 :                 return true;
     442                 :            :             }
     443                 :            : 
     444                 :          0 :             virtual bool handleMouseMoved( const awt::MouseEvent& /*e*/ )
     445                 :            :             {
     446                 :            :                 // not used here
     447                 :          0 :                 return false; // did not handle the event
     448                 :            :             }
     449                 :            : 
     450                 :            : 
     451                 :            :             void update_settings( bool bUserPaintEnabled, RGBColor const& aUserPaintColor, double dUserPaintStrokeWidth )
     452                 :            :             {
     453                 :            :                 maStrokeColor = aUserPaintColor;
     454                 :            :                 mnStrokeWidth = dUserPaintStrokeWidth;
     455                 :            :                 mbActive = bUserPaintEnabled;
     456                 :            :                 if( !mbActive )
     457                 :            :                     disable();
     458                 :            :             }
     459                 :            : 
     460                 :            :         private:
     461                 :            :             ActivitiesQueue&        mrActivitiesQueue;
     462                 :            :             ScreenUpdater&          mrScreenUpdater;
     463                 :            :             UnoViewVector           maViews;
     464                 :            :             PolyPolygonVector       maPolygons;
     465                 :            :             RGBColor                maStrokeColor;
     466                 :            :             double                  mnStrokeWidth;
     467                 :            :             basegfx::B2DPoint       maLastPoint;
     468                 :            :             basegfx::B2DPoint       maLastMouseDownPos;
     469                 :            :             bool                    mbIsLastPointValid;
     470                 :            :             bool                    mbIsLastMouseDownPosValid;
     471                 :            :             // added bool for erasing purpose :
     472                 :            :             bool                    mbIsEraseAllModeActivated;
     473                 :            :             bool                    mbIsEraseModeActivated;
     474                 :            :             Slide&                  mrSlide;
     475                 :            :             sal_Int32               mnSize;
     476                 :            :             bool                    mbActive;
     477                 :            :         };
     478                 :            : 
     479                 :          0 :         UserPaintOverlaySharedPtr UserPaintOverlay::create( const RGBColor&          rStrokeColor,
     480                 :            :                                                             double                   nStrokeWidth,
     481                 :            :                                                             const SlideShowContext&  rContext,
     482                 :            :                                                             const PolyPolygonVector& rPolygons,
     483                 :            :                                                             bool                     bActive )
     484                 :            :         {
     485                 :            :             UserPaintOverlaySharedPtr pRet( new UserPaintOverlay( rStrokeColor,
     486                 :            :                                                                   nStrokeWidth,
     487                 :            :                                                                   rContext,
     488                 :            :                                                                   rPolygons,
     489                 :          0 :                                                                   bActive));
     490                 :            : 
     491                 :          0 :             return pRet;
     492                 :            :         }
     493                 :            : 
     494                 :          0 :         UserPaintOverlay::UserPaintOverlay( const RGBColor&          rStrokeColor,
     495                 :            :                                             double                   nStrokeWidth,
     496                 :            :                                             const SlideShowContext&  rContext,
     497                 :            :                                             const PolyPolygonVector& rPolygons,
     498                 :            :                                             bool                     bActive ) :
     499                 :            :             mpHandler( new PaintOverlayHandler( rStrokeColor,
     500                 :            :                                                 nStrokeWidth,
     501                 :            :                                                 rContext.mrActivitiesQueue,
     502                 :            :                                                 rContext.mrScreenUpdater,
     503                 :            :                                                 rContext.mrViewContainer,
     504                 :            :                                                 //adding a link to Slide
     505                 :          0 :                                                 dynamic_cast<Slide&>(rContext.mrCursorManager),
     506                 :          0 :                                                 rPolygons, bActive )),
     507                 :          0 :             mrMultiplexer( rContext.mrEventMultiplexer )
     508                 :            :         {
     509                 :          0 :             mrMultiplexer.addClickHandler( mpHandler, 3.0 );
     510                 :          0 :             mrMultiplexer.addMouseMoveHandler( mpHandler, 3.0 );
     511                 :          0 :             mrMultiplexer.addViewHandler( mpHandler );
     512                 :          0 :             mrMultiplexer.addUserPaintHandler(mpHandler);
     513                 :          0 :         }
     514                 :            : 
     515                 :          0 :         PolyPolygonVector UserPaintOverlay::getPolygons()
     516                 :            :         {
     517                 :          0 :             return mpHandler->getPolygons();
     518                 :            :         }
     519                 :            : 
     520                 :          0 :         void UserPaintOverlay::drawPolygons()
     521                 :            :         {
     522                 :          0 :             mpHandler->drawPolygons();
     523                 :          0 :         }
     524                 :            : 
     525                 :          0 :         UserPaintOverlay::~UserPaintOverlay()
     526                 :            :         {
     527                 :            :             try
     528                 :            :             {
     529                 :          0 :                 mrMultiplexer.removeMouseMoveHandler( mpHandler );
     530                 :          0 :                 mrMultiplexer.removeClickHandler( mpHandler );
     531                 :          0 :                 mrMultiplexer.removeViewHandler( mpHandler );
     532                 :          0 :                 mpHandler->dispose();
     533                 :            :             }
     534                 :          0 :             catch (uno::Exception &)
     535                 :            :             {
     536                 :            :                 OSL_FAIL( rtl::OUStringToOString(
     537                 :            :                                 comphelper::anyToString(
     538                 :            :                                     cppu::getCaughtException() ),
     539                 :            :                                 RTL_TEXTENCODING_UTF8 ).getStr() );
     540                 :            :             }
     541                 :          0 :         }
     542                 :            :     }
     543                 :          0 : }
     544                 :            : 
     545                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10