summaryrefslogtreecommitdiff
path: root/slideshow/source/engine/slide
diff options
context:
space:
mode:
Diffstat (limited to 'slideshow/source/engine/slide')
-rw-r--r--slideshow/source/engine/slide/layer.cxx5
-rw-r--r--slideshow/source/engine/slide/layer.hxx5
-rw-r--r--slideshow/source/engine/slide/layermanager.cxx5
-rw-r--r--slideshow/source/engine/slide/layermanager.hxx5
-rw-r--r--slideshow/source/engine/slide/makefile.mk6
-rw-r--r--slideshow/source/engine/slide/shapemanagerimpl.cxx5
-rw-r--r--slideshow/source/engine/slide/shapemanagerimpl.hxx5
-rw-r--r--slideshow/source/engine/slide/slideanimations.cxx5
-rw-r--r--slideshow/source/engine/slide/slideanimations.hxx5
-rw-r--r--slideshow/source/engine/slide/slideimpl.cxx94
-rw-r--r--slideshow/source/engine/slide/userpaintoverlay.cxx308
-rw-r--r--slideshow/source/engine/slide/userpaintoverlay.hxx25
12 files changed, 369 insertions, 104 deletions
diff --git a/slideshow/source/engine/slide/layer.cxx b/slideshow/source/engine/slide/layer.cxx
index ae64b7a38773..080594a3350f 100644
--- a/slideshow/source/engine/slide/layer.cxx
+++ b/slideshow/source/engine/slide/layer.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: layer.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/slideshow/source/engine/slide/layer.hxx b/slideshow/source/engine/slide/layer.hxx
index 531d685a1396..3001bc3b8e6d 100644
--- a/slideshow/source/engine/slide/layer.hxx
+++ b/slideshow/source/engine/slide/layer.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: layer.hxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx
index 251cff3a73b3..83a51334eb33 100644
--- a/slideshow/source/engine/slide/layermanager.cxx
+++ b/slideshow/source/engine/slide/layermanager.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: layermanager.cxx,v $
- * $Revision: 1.6 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/slideshow/source/engine/slide/layermanager.hxx b/slideshow/source/engine/slide/layermanager.hxx
index 5a1512bb4f7e..fecf0c30587f 100644
--- a/slideshow/source/engine/slide/layermanager.hxx
+++ b/slideshow/source/engine/slide/layermanager.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: layermanager.hxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/slideshow/source/engine/slide/makefile.mk b/slideshow/source/engine/slide/makefile.mk
index 0f58b55878d2..953307d621c1 100644
--- a/slideshow/source/engine/slide/makefile.mk
+++ b/slideshow/source/engine/slide/makefile.mk
@@ -2,14 +2,10 @@
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
-# Copyright 2008 by Sun Microsystems, Inc.
+# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.3 $
-#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx
index b08241bf8fbb..93d8fc6719af 100644
--- a/slideshow/source/engine/slide/shapemanagerimpl.cxx
+++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: shapemanagerimpl.cxx,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/slideshow/source/engine/slide/shapemanagerimpl.hxx b/slideshow/source/engine/slide/shapemanagerimpl.hxx
index 369fa2c36816..32082273e6d0 100644
--- a/slideshow/source/engine/slide/shapemanagerimpl.hxx
+++ b/slideshow/source/engine/slide/shapemanagerimpl.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: shapemanagerimpl.hxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/slideshow/source/engine/slide/slideanimations.cxx b/slideshow/source/engine/slide/slideanimations.cxx
index 28d2aadb6fb5..9b951d5af55a 100644
--- a/slideshow/source/engine/slide/slideanimations.cxx
+++ b/slideshow/source/engine/slide/slideanimations.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: slideanimations.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/slideshow/source/engine/slide/slideanimations.hxx b/slideshow/source/engine/slide/slideanimations.hxx
index d39a56d77799..a3c2f92c6af2 100644
--- a/slideshow/source/engine/slide/slideanimations.hxx
+++ b/slideshow/source/engine/slide/slideanimations.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: slideanimations.hxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index 84b6ad7b4305..0343c357a51a 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: slideimpl.cxx,v $
- * $Revision: 1.4 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -81,7 +78,7 @@
#include <iterator>
#include <algorithm>
#include <functional>
-
+#include <iostream>
using namespace ::com::sun::star;
@@ -101,6 +98,7 @@ class SlideImpl : public Slide,
{
public:
SlideImpl( const uno::Reference<drawing::XDrawPage>& xDrawPage,
+ const uno::Reference<drawing::XDrawPagesSupplier>& xDrawPages,
const uno::Reference<animations::XAnimationNode>& xRootNode,
EventQueue& rEventQueue,
EventMultiplexer& rEventMultiplexer,
@@ -112,7 +110,9 @@ public:
const uno::Reference<uno::XComponentContext>& xContext,
const ShapeEventListenerMap& rShapeListenerMap,
const ShapeCursorMap& rShapeCursorMap,
+ const PolyPolygonVector& rPolyPolygonVector,
RGBColor const& rUserPaintColor,
+ double dUserPaintStrokeWidth,
bool bUserPaintEnabled,
bool bIntrinsicAnimationsAllowed,
bool bDisableAnimationZOrder );
@@ -136,6 +136,9 @@ public:
virtual basegfx::B2ISize getSlideSize() const;
virtual uno::Reference<drawing::XDrawPage > getXDrawPage() const;
virtual uno::Reference<animations::XAnimationNode> getXAnimationNode() const;
+ virtual PolyPolygonVector getPolygons();
+ virtual void drawPolygons() const;
+ virtual bool isPaintOverlayActive() const;
// TODO(F2): Rework SlideBitmap to no longer be based on XBitmap,
// but on canvas-independent basegfx bitmaps
@@ -201,6 +204,8 @@ private:
/// End GIF and other intrinsic shape animations
void startIntrinsicAnimations();
+ /// Add Polygons to the member maPolygons
+ void addPolygons(PolyPolygonVector aPolygons);
// Types
// =====
@@ -230,6 +235,7 @@ private:
/// The page model object
uno::Reference< drawing::XDrawPage > mxDrawPage;
+ uno::Reference< drawing::XDrawPagesSupplier > mxDrawPagesSupplier;
uno::Reference< animations::XAnimationNode > mxRootNode;
LayerManagerSharedPtr mpLayerManager;
@@ -244,8 +250,10 @@ private:
/// Handles the animation and event generation for us
SlideAnimations maAnimations;
+ PolyPolygonVector maPolygons;
RGBColor maUserPaintColor;
+ double mdUserPaintStrokeWidth;
UserPaintOverlaySharedPtr mpPaintOverlay;
/// Bitmaps with slide content at various states
@@ -287,6 +295,9 @@ private:
/// When true, show() was called. Slide hidden oherwise.
bool mbActive;
+
+ ///When true, enablePaintOverlay was called and mbUserPaintOverlay = true
+ bool mbPaintOverlayActive;
};
@@ -335,6 +346,7 @@ private:
SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDrawPage,
+ const uno::Reference<drawing::XDrawPagesSupplier>& xDrawPages,
const uno::Reference< animations::XAnimationNode >& xRootNode,
EventQueue& rEventQueue,
EventMultiplexer& rEventMultiplexer,
@@ -346,11 +358,14 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra
const uno::Reference< uno::XComponentContext >& xComponentContext,
const ShapeEventListenerMap& rShapeListenerMap,
const ShapeCursorMap& rShapeCursorMap,
+ const PolyPolygonVector& rPolyPolygonVector,
RGBColor const& aUserPaintColor,
+ double dUserPaintStrokeWidth,
bool bUserPaintEnabled,
bool bIntrinsicAnimationsAllowed,
bool bDisableAnimationZOrder ) :
mxDrawPage( xDrawPage ),
+ mxDrawPagesSupplier( xDrawPages ),
mxRootNode( xRootNode ),
mpLayerManager( new LayerManager(
rViewContainer,
@@ -375,7 +390,9 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra
mrCursorManager( rCursorManager ),
maAnimations( maContext,
getSlideSizeImpl() ),
+ maPolygons(rPolyPolygonVector),
maUserPaintColor(aUserPaintColor),
+ mdUserPaintStrokeWidth(dUserPaintStrokeWidth),
mpPaintOverlay(),
maSlideBitmaps(),
meAnimationState( CONSTRUCTING_STATE ),
@@ -387,7 +404,8 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra
mbShowLoaded( false ),
mbHaveAnimations( false ),
mbMainSequenceFound( false ),
- mbActive( false )
+ mbActive( false ),
+ mbPaintOverlayActive( false )
{
// clone already existing views for slide bitmaps
std::for_each( rViewContainer.begin(),
@@ -436,6 +454,9 @@ void SlideImpl::dispose()
mpShapeManager.reset();
mxRootNode.clear();
mxDrawPage.clear();
+#ifndef ENABLE_PRESENTER_EXTRA_UI
+ mxDrawPagesSupplier.clear();
+#endif
}
bool SlideImpl::prefetch()
@@ -583,6 +604,12 @@ uno::Reference<animations::XAnimationNode> SlideImpl::getXAnimationNode() const
return mxRootNode;
}
+PolyPolygonVector SlideImpl::getPolygons()
+{
+ if(mbPaintOverlayActive)
+ maPolygons = mpPaintOverlay->getPolygons();
+ return maPolygons;
+}
SlideBitmapSharedPtr SlideImpl::getCurrentSlideBitmap( const UnoViewSharedPtr& rView ) const
{
@@ -862,14 +889,47 @@ bool SlideImpl::implPrefetchShow()
void SlideImpl::enablePaintOverlay()
{
if( mbUserPaintOverlayEnabled )
+ {
mpPaintOverlay = UserPaintOverlay::create( maUserPaintColor,
- 2.0,
- maContext );
+ mdUserPaintStrokeWidth,
+ maContext,
+ maPolygons );
+ mbPaintOverlayActive = true;
+ }
+}
+
+void SlideImpl::drawPolygons() const
+{
+ if( mbUserPaintOverlayEnabled )
+ mpPaintOverlay->drawPolygons();
+}
+
+void SlideImpl::addPolygons(PolyPolygonVector aPolygons)
+{
+ if(!aPolygons.empty())
+ {
+ for( PolyPolygonVector::iterator aIter=aPolygons.begin(),
+ aEnd=aPolygons.end();
+ aIter!=aEnd;
+ ++aIter )
+ {
+ maPolygons.push_back(*aIter);
+ }
+ }
+}
+
+bool SlideImpl::isPaintOverlayActive() const
+{
+ return mbPaintOverlayActive;
}
void SlideImpl::disablePaintOverlay()
{
+ if(mbPaintOverlayActive)
+ maPolygons = mpPaintOverlay->getPolygons();
+
mpPaintOverlay.reset();
+ mbPaintOverlayActive = false;
}
::basegfx::B2DRectangle SlideImpl::getSlideRect() const
@@ -1073,6 +1133,7 @@ bool SlideImpl::loadShapes()
// -------------------------------------------------------------------------
ShapeImporter aMPShapesFunctor( xMasterPage,
mxDrawPage,
+ mxDrawPagesSupplier,
maContext,
0, /* shape num starts at 0 */
true );
@@ -1087,6 +1148,7 @@ bool SlideImpl::loadShapes()
if( rShape )
mpLayerManager->addShape( rShape );
}
+ addPolygons(aMPShapesFunctor.getPolygons());
nCurrCount = xMasterPageShapes->getCount() + 1;
}
@@ -1121,6 +1183,7 @@ bool SlideImpl::loadShapes()
ShapeImporter aShapesFunctor( mxDrawPage,
mxDrawPage,
+ mxDrawPagesSupplier,
maContext,
nCurrCount,
false );
@@ -1132,6 +1195,7 @@ bool SlideImpl::loadShapes()
if( rShape )
mpLayerManager->addShape( rShape );
}
+ addPolygons(aShapesFunctor.getPolygons());
}
catch( uno::RuntimeException& )
{
@@ -1176,6 +1240,7 @@ basegfx::B2ISize SlideImpl::getSlideSizeImpl() const
SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >& xDrawPage,
+ const uno::Reference<drawing::XDrawPagesSupplier>& xDrawPages,
const uno::Reference< animations::XAnimationNode >& xRootNode,
EventQueue& rEventQueue,
EventMultiplexer& rEventMultiplexer,
@@ -1187,18 +1252,25 @@ SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >&
const uno::Reference< uno::XComponentContext >& xComponentContext,
const ShapeEventListenerMap& rShapeListenerMap,
const ShapeCursorMap& rShapeCursorMap,
+ const PolyPolygonVector& rPolyPolygonVector,
RGBColor const& rUserPaintColor,
+ double dUserPaintStrokeWidth,
bool bUserPaintEnabled,
bool bIntrinsicAnimationsAllowed,
bool bDisableAnimationZOrder )
{
- boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, xRootNode, rEventQueue,
+#ifdef ENABLE_PRESENTER_EXTRA_UI
+ boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, xDrawPages, xRootNode, rEventQueue,
+#else
+ (void)xDrawPages;
+ boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, NULL, xRootNode, rEventQueue,
+#endif
rEventMultiplexer, rScreenUpdater,
rActivitiesQueue, rUserEventQueue,
rCursorManager, rViewContainer,
xComponentContext, rShapeListenerMap,
- rShapeCursorMap, rUserPaintColor,
- bUserPaintEnabled,
+ rShapeCursorMap, rPolyPolygonVector, rUserPaintColor,
+ dUserPaintStrokeWidth, bUserPaintEnabled,
bIntrinsicAnimationsAllowed,
bDisableAnimationZOrder ));
diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx
index 5cdfbddc1193..8d9fad06a3e3 100644
--- a/slideshow/source/engine/slide/userpaintoverlay.cxx
+++ b/slideshow/source/engine/slide/userpaintoverlay.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: userpaintoverlay.cxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -54,7 +51,8 @@
#include <boost/bind.hpp>
#include <boost/noncopyable.hpp>
-
+#include "slide.hxx"
+#include "cursormanager.hxx"
using namespace ::com::sun::star;
@@ -63,29 +61,40 @@ namespace slideshow
namespace internal
{
class PaintOverlayHandler : public MouseEventHandler,
- public ViewEventHandler
+ public ViewEventHandler,
+ public UserPaintEventHandler
{
public:
- PaintOverlayHandler( const RGBColor& rStrokeColor,
- double nStrokeWidth,
- ActivitiesQueue& rActivitiesQueue,
- ScreenUpdater& rScreenUpdater,
- const UnoViewContainer& rViews ) :
+ PaintOverlayHandler( const RGBColor& rStrokeColor,
+ double nStrokeWidth,
+ ActivitiesQueue& rActivitiesQueue,
+ ScreenUpdater& rScreenUpdater,
+ const UnoViewContainer& rViews,
+ Slide& rSlide,
+ const PolyPolygonVector& rPolygons ) :
mrActivitiesQueue( rActivitiesQueue ),
mrScreenUpdater( rScreenUpdater ),
maViews(),
+ maPolygons( rPolygons ),
maStrokeColor( rStrokeColor ),
mnStrokeWidth( nStrokeWidth ),
maLastPoint(),
maLastMouseDownPos(),
mbIsLastPointValid( false ),
- mbIsLastMouseDownPosValid( false )
+ mbIsLastMouseDownPosValid( false ),
+ //handle the "remove all ink from slide" mode of erasing
+ mbIsEraseAllModeActivated( false ),
+ //handle the "remove stroke by stroke" mode of erasing
+ mbIsEraseModeActivated( false ),
+ mrSlide(rSlide),
+ mnSize(100)
{
std::for_each( rViews.begin(),
rViews.end(),
boost::bind( &PaintOverlayHandler::viewAdded,
this,
_1 ));
+ drawPolygons();
}
virtual void dispose()
@@ -118,9 +127,120 @@ namespace slideshow
// polygon and repaint here.
}
+ bool colorChanged( RGBColor const& rUserColor )
+ {
+ this->maStrokeColor = rUserColor;
+ this->mbIsEraseModeActivated = false;
+ return true;
+ }
+
+ bool widthChanged( double nUserStrokeWidth )
+ {
+ this->mnStrokeWidth = nUserStrokeWidth;
+ mbIsEraseModeActivated = false;
+ return true;
+ }
+
+ bool eraseAllInkChanged( bool const& rEraseAllInk )
+ {
+ this->mbIsEraseAllModeActivated= rEraseAllInk;
+ // if the erase all mode is activated it will remove all ink from slide,
+ // therefor destroy all the polygons stored
+ if(mbIsEraseAllModeActivated)
+ {
+ // The Erase Mode should be desactivated
+ mbIsEraseModeActivated = false;
+ // must get access to the instance to erase all polygon
+ for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
+ aIter!=aEnd;
+ ++aIter )
+ {
+ // fully clear view content to background color
+ (*aIter)->getCanvas()->clear();
+
+ //get via SlideImpl instance the bitmap of the slide unmodified to redraw it
+ SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) );
+ ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() );
+
+ const ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() );
+ const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
+
+ // setup a canvas with device coordinate space, the slide
+ // bitmap already has the correct dimension.
+ ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() );
+
+ pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() );
+
+ // render at given output position
+ pBitmap->move( aOutPosPixel );
+
+ // clear clip (might have been changed, e.g. from comb
+ // transition)
+ pBitmap->clip( ::basegfx::B2DPolyPolygon() );
+ pBitmap->draw( pDevicePixelCanvas );
+
+ mrScreenUpdater.notifyUpdate(*aIter,true);
+ }
+ maPolygons.clear();
+ }
+ mbIsEraseAllModeActivated=false;
+ return true;
+ }
+
+ bool eraseInkWidthChanged( sal_Int32 rEraseInkSize )
+ {
+ // Change the size
+ this->mnSize=rEraseInkSize;
+ // Changed to mode Erase
+ this->mbIsEraseModeActivated = true;
+ return true;
+ }
+
+ bool switchPenMode()
+ {
+ this->mbIsEraseModeActivated = false;
+ return true;
+ }
+
+ bool switchEraserMode()
+ {
+ this->mbIsEraseModeActivated = true;
+ return true;
+ }
+
+ bool disable()
+ {
+ return true;
+ }
+
+ //Draw all registered polygons.
+ void drawPolygons()
+ {
+ for( PolyPolygonVector::iterator aIter=maPolygons.begin(), aEnd=maPolygons.end();
+ aIter!=aEnd;
+ ++aIter )
+ {
+ (*aIter)->draw();
+ }
+ // screen update necessary to show painting
+ mrScreenUpdater.notifyUpdate();
+ }
+
+ //Retrieve all registered polygons.
+ PolyPolygonVector getPolygons()
+ {
+ return maPolygons;
+ }
+
// MouseEventHandler methods
virtual bool handleMousePressed( const awt::MouseEvent& e )
{
+ if (e.Buttons == awt::MouseButton::RIGHT)
+ {
+ mbIsLastPointValid = false;
+ return false;
+ }
+
if (e.Buttons != awt::MouseButton::LEFT)
return false;
@@ -135,6 +255,12 @@ namespace slideshow
virtual bool handleMouseReleased( const awt::MouseEvent& e )
{
+ if (e.Buttons == awt::MouseButton::RIGHT)
+ {
+ mbIsLastPointValid = false;
+ return false;
+ }
+
if (e.Buttons != awt::MouseButton::LEFT)
return false;
@@ -180,42 +306,110 @@ namespace slideshow
virtual bool handleMouseDragged( const awt::MouseEvent& e )
{
- if( !mbIsLastPointValid )
- {
- mbIsLastPointValid = true;
- maLastPoint.setX( e.X );
- maLastPoint.setY( e.Y );
- }
- else
+ if(mbIsEraseModeActivated)
{
+ //define the last point as an object
+ //we suppose that there's no way this point could be valid
::basegfx::B2DPolygon aPoly;
+
+ maLastPoint.setX( e.X-mnSize );
+ maLastPoint.setY( e.Y-mnSize );
+
aPoly.append( maLastPoint );
- maLastPoint.setX( e.X );
- maLastPoint.setY( e.Y );
+ maLastPoint.setX( e.X-mnSize );
+ maLastPoint.setY( e.Y+mnSize );
aPoly.append( maLastPoint );
+ maLastPoint.setX( e.X+mnSize );
+ maLastPoint.setY( e.Y+mnSize );
- // paint to all views
- for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
- aIter!=aEnd;
- ++aIter )
+ aPoly.append( maLastPoint );
+ maLastPoint.setX( e.X+mnSize );
+ maLastPoint.setY( e.Y-mnSize );
+
+ aPoly.append( maLastPoint );
+ maLastPoint.setX( e.X-mnSize );
+ maLastPoint.setY( e.Y-mnSize );
+
+ aPoly.append( maLastPoint );
+
+ //now we have defined a Polygon that is closed
+
+ //The point is to redraw the LastPoint the way it was originally on the bitmap,
+ //of the slide
+ for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
+ aIter!=aEnd;
+ ++aIter )
{
- ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
- ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(),
- aPoly ) );
- if( pPolyPoly )
+ //get via SlideImpl instance the bitmap of the slide unmodified to redraw it
+ SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) );
+ ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() );
+
+ ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() );
+ const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
+
+ // setup a canvas with device coordinate space, the slide
+ // bitmap already has the correct dimension.
+ ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() );
+
+ pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() );
+
+ // render at given output position
+ pBitmap->move( aOutPosPixel );
+
+ ::basegfx::B2DPolyPolygon aPolyPoly=::basegfx::B2DPolyPolygon(aPoly);
+ aViewTransform.translate(-aOutPosPixel.getX(), -aOutPosPixel.getY());
+ aPolyPoly.transform(aViewTransform);
+ // set clip so that we just redraw a part of the canvas
+ pBitmap->clip(aPolyPoly);
+ pBitmap->draw( pDevicePixelCanvas );
+
+ mrScreenUpdater.notifyUpdate(*aIter,true);
+ }
+
+ }
+ else
+ {
+ if( !mbIsLastPointValid )
+ {
+ mbIsLastPointValid = true;
+ maLastPoint.setX( e.X );
+ maLastPoint.setY( e.Y );
+ }
+ else
+ {
+ ::basegfx::B2DPolygon aPoly;
+ aPoly.append( maLastPoint );
+
+ maLastPoint.setX( e.X );
+ maLastPoint.setY( e.Y );
+
+ aPoly.append( maLastPoint );
+
+ // paint to all views
+ for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
+ aIter!=aEnd;
+ ++aIter )
{
- pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() );
- pPolyPoly->draw();
+ ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
+ ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(),
+ aPoly ) );
+
+ if( pPolyPoly )
+ {
+ pPolyPoly->setStrokeWidth(mnStrokeWidth);
+ pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() );
+ pPolyPoly->draw();
+ maPolygons.push_back(pPolyPoly);
+ }
}
- }
- // screen update necessary to show painting
- mrScreenUpdater.notifyUpdate();
+ // screen update necessary to show painting
+ mrScreenUpdater.notifyUpdate();
+ }
}
-
// mouse events captured
return true;
}
@@ -226,42 +420,67 @@ namespace slideshow
return false; // did not handle the event
}
+
+
private:
ActivitiesQueue& mrActivitiesQueue;
ScreenUpdater& mrScreenUpdater;
UnoViewVector maViews;
+ PolyPolygonVector maPolygons;
RGBColor maStrokeColor;
double mnStrokeWidth;
basegfx::B2DPoint maLastPoint;
basegfx::B2DPoint maLastMouseDownPos;
bool mbIsLastPointValid;
bool mbIsLastMouseDownPosValid;
+ // added bool for erasing purpose :
+ bool mbIsEraseAllModeActivated;
+ bool mbIsEraseModeActivated;
+ Slide& mrSlide;
+ sal_Int32 mnSize;
};
- UserPaintOverlaySharedPtr UserPaintOverlay::create( const RGBColor& rStrokeColor,
- double nStrokeWidth,
- const SlideShowContext& rContext )
+ UserPaintOverlaySharedPtr UserPaintOverlay::create( const RGBColor& rStrokeColor,
+ double nStrokeWidth,
+ const SlideShowContext& rContext,
+ const PolyPolygonVector& rPolygons )
{
UserPaintOverlaySharedPtr pRet( new UserPaintOverlay( rStrokeColor,
nStrokeWidth,
- rContext ));
+ rContext,
+ rPolygons ));
return pRet;
}
- UserPaintOverlay::UserPaintOverlay( const RGBColor& rStrokeColor,
- double nStrokeWidth,
- const SlideShowContext& rContext ) :
+ UserPaintOverlay::UserPaintOverlay( const RGBColor& rStrokeColor,
+ double nStrokeWidth,
+ const SlideShowContext& rContext,
+ const PolyPolygonVector& rPolygons ) :
mpHandler( new PaintOverlayHandler( rStrokeColor,
nStrokeWidth,
rContext.mrActivitiesQueue,
rContext.mrScreenUpdater,
- rContext.mrViewContainer )),
+ rContext.mrViewContainer,
+ //adding a link to Slide
+ dynamic_cast<Slide&>(rContext.mrCursorManager),
+ rPolygons )),
mrMultiplexer( rContext.mrEventMultiplexer )
{
mrMultiplexer.addClickHandler( mpHandler, 3.0 );
mrMultiplexer.addMouseMoveHandler( mpHandler, 3.0 );
mrMultiplexer.addViewHandler( mpHandler );
+ mrMultiplexer.addUserPaintHandler(mpHandler);
+ }
+
+ PolyPolygonVector UserPaintOverlay::getPolygons()
+ {
+ return mpHandler->getPolygons();
+ }
+
+ void UserPaintOverlay::drawPolygons()
+ {
+ mpHandler->drawPolygons();
}
UserPaintOverlay::~UserPaintOverlay()
@@ -273,7 +492,8 @@ namespace slideshow
mrMultiplexer.removeViewHandler( mpHandler );
mpHandler->dispose();
}
- catch (uno::Exception &) {
+ catch (uno::Exception &)
+ {
OSL_ENSURE( false, rtl::OUStringToOString(
comphelper::anyToString(
cppu::getCaughtException() ),
diff --git a/slideshow/source/engine/slide/userpaintoverlay.hxx b/slideshow/source/engine/slide/userpaintoverlay.hxx
index 34a171f1740c..b92f5f2539b0 100644
--- a/slideshow/source/engine/slide/userpaintoverlay.hxx
+++ b/slideshow/source/engine/slide/userpaintoverlay.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: userpaintoverlay.hxx,v $
- * $Revision: 1.3 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -38,7 +35,7 @@
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
-
+#include <vector>
/* Definition of UserPaintOverlay class */
@@ -51,7 +48,7 @@ namespace slideshow
class PaintOverlayHandler;
typedef ::boost::shared_ptr< class UserPaintOverlay > UserPaintOverlaySharedPtr;
-
+ typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector;
/** Slide overlay, which can be painted into by the user.
This class registers itself at the EventMultiplexer,
@@ -69,15 +66,19 @@ namespace slideshow
@param nStrokeWidth
Width of the stroked path
*/
- static UserPaintOverlaySharedPtr create( const RGBColor& rStrokeColor,
- double nStrokeWidth,
- const SlideShowContext& rContext );
+ static UserPaintOverlaySharedPtr create( const RGBColor& rStrokeColor,
+ double nStrokeWidth,
+ const SlideShowContext& rContext,
+ const PolyPolygonVector& rPolygons );
~UserPaintOverlay();
+ PolyPolygonVector getPolygons();
+ void drawPolygons();
private:
- UserPaintOverlay( const RGBColor& rStrokeColor,
- double nStrokeWidth,
- const SlideShowContext& rContext );
+ UserPaintOverlay( const RGBColor& rStrokeColor,
+ double nStrokeWidth,
+ const SlideShowContext& rContext,
+ const PolyPolygonVector& rPolygons );
::boost::shared_ptr<PaintOverlayHandler> mpHandler;
EventMultiplexer& mrMultiplexer;