summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorericb <ericb@ordinateur-de-eric-b-2.local>2009-12-15 23:12:19 +0100
committerericb <ericb@ordinateur-de-eric-b-2.local>2009-12-15 23:12:19 +0100
commitaf5c661b945658b1c0a2f61e66446d030abdbf40 (patch)
tree636538744983ed395deb85b22861e50971a8f183 /slideshow
parent54e4becdc5eee38a4ef85f8bab8d6258c54e2faf (diff)
#i97972# commit all changes since Thorsten rebase. Thanks to Nelle, Jonathan, Christian and ericb
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/color.cxx13
-rw-r--r--slideshow/source/engine/eventmultiplexer.cxx22
-rw-r--r--slideshow/source/engine/makefile.mk4
-rw-r--r--slideshow/source/engine/shapes/shapeimporter.cxx4
-rw-r--r--slideshow/source/engine/slide/slideimpl.cxx15
-rw-r--r--slideshow/source/engine/slide/userpaintoverlay.cxx51
-rw-r--r--slideshow/source/engine/slideshowimpl.cxx68
-rw-r--r--slideshow/source/engine/tools.cxx30
-rw-r--r--slideshow/source/inc/eventmultiplexer.hxx4
-rw-r--r--slideshow/source/inc/rgbcolor.hxx3
-rw-r--r--slideshow/source/inc/shapeimporter.hxx2
-rw-r--r--slideshow/source/inc/userpainteventhandler.hxx5
12 files changed, 173 insertions, 48 deletions
diff --git a/slideshow/source/engine/color.cxx b/slideshow/source/engine/color.cxx
index a7a7088a302f..a6ffbb492066 100644
--- a/slideshow/source/engine/color.cxx
+++ b/slideshow/source/engine/color.cxx
@@ -268,6 +268,19 @@ namespace slideshow
return RGBColor( aColor.mnRed, aColor.mnGreen, aColor.mnBlue );
}
+ RGBColor::RGBColor(const RGBColor& rLHS)
+ {
+ RGBColor(rLHS.getRed(), rLHS.getGreen(), rLHS.getBlue());
+ }
+
+ RGBColor& RGBColor::operator=( const RGBColor& rLHS ){
+
+ maRGBTriple.mnRed = rLHS.getRed();
+ maRGBTriple.mnGreen = rLHS.getGreen();
+ maRGBTriple.mnBlue = rLHS.getBlue();
+ return *this;
+ }
+
HSLColor operator+( const HSLColor& rLHS, const HSLColor& rRHS )
{
return HSLColor( rLHS.getHue() + rRHS.getHue(),
diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx
index 31cd7cf286c4..6ad89b278286 100644
--- a/slideshow/source/engine/eventmultiplexer.cxx
+++ b/slideshow/source/engine/eventmultiplexer.cxx
@@ -1067,17 +1067,27 @@ bool EventMultiplexer::notifyUserPaintColor( RGBColor const& rUserColor )
bool EventMultiplexer::notifyUserPaintStrokeWidth( double rUserStrokeWidth )
{
return mpImpl->maUserPaintEventHandlers.applyAll(
- boost::bind(&UserPaintEventHandler::widthChanged,
- _1,
- rUserStrokeWidth));
+ boost::bind(&UserPaintEventHandler::widthChanged,
+ _1,
+ rUserStrokeWidth));
}
-
+//NELLE a regarder de plus près
bool EventMultiplexer::notifyUserPaintDisabled()
{
return mpImpl->maUserPaintEventHandlers.applyAll(
boost::mem_fn(&UserPaintEventHandler::disable));
}
+bool EventMultiplexer::notifySwitchPenMode(){
+ return mpImpl->maUserPaintEventHandlers.applyAll(
+ boost::mem_fn(&UserPaintEventHandler::switchPenMode));
+}
+
+bool EventMultiplexer::notifySwitchEraserMode(){
+ return mpImpl->maUserPaintEventHandlers.applyAll(
+ boost::mem_fn(&UserPaintEventHandler::switchEraserMode));
+}
+
//adding erasing all ink features with UserPaintOverlay
bool EventMultiplexer::notifyEraseAllInk( bool const& rEraseAllInk )
{
@@ -1088,10 +1098,10 @@ bool EventMultiplexer::notifyEraseAllInk( bool const& rEraseAllInk )
}
//adding erasing features with UserPaintOverlay
-bool EventMultiplexer::notifyEraseInk( double rEraseInkSize )
+bool EventMultiplexer::notifyEraseInk( sal_Int32 rEraseInkSize )
{
return mpImpl->maUserPaintEventHandlers.applyAll(
- boost::bind(&UserPaintEventHandler::eraseInkChanged,
+ boost::bind(&UserPaintEventHandler::eraseInkWidthChanged,
_1,
boost::cref(rEraseInkSize)));
}
diff --git a/slideshow/source/engine/makefile.mk b/slideshow/source/engine/makefile.mk
index ba00e028b9ff..6d4b182f2323 100644
--- a/slideshow/source/engine/makefile.mk
+++ b/slideshow/source/engine/makefile.mk
@@ -41,6 +41,10 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/makefile.pmk
+.IF "$(ENABLE_PRESENTER_EXTRA_UI)"=="YES"
+CDEFS+=-DENABLE_PRESENTER_EXTRA_UI
+.ENDIF
+
# --- Common ----------------------------------------------------------
.IF "$(OS)"=="SOLARIS"
diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx
index 54436c7330ed..98bda086286a 100644
--- a/slideshow/source/engine/shapes/shapeimporter.cxx
+++ b/slideshow/source/engine/shapes/shapeimporter.cxx
@@ -650,7 +650,11 @@ ShapeImporter::ShapeImporter( uno::Reference<drawing::XDrawPage> const&
sal_Int32 nOrdNumStart,
bool bConvertingMasterPage ) :
mxPage( xActualPage ),
+#ifdef ENABLE_PRESENTER_EXTRA_UI
mxPagesSupplier( xPagesSupplier ),
+#else
+ mxPagesSupplier( NULL ),
+#endif
mrContext( rContext ),
maPolygons(),
maShapesStack(),
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index e895f98fa94a..c0302fd92909 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -81,6 +81,7 @@
#include <iterator>
#include <algorithm>
#include <functional>
+#include <iostream>
using namespace ::com::sun::star;
@@ -367,7 +368,11 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra
bool bIntrinsicAnimationsAllowed,
bool bDisableAnimationZOrder ) :
mxDrawPage( xDrawPage ),
- mxDrawPagesSupplier( xDrawPages ),
+#ifdef ENABLE_PRESENTER_EXTRA_UI
+ mxDrawPagesSupplier( xDrawPages ),
+#else
+ mxDrawPagesSupplier( NULL ),
+#endif
mxRootNode( xRootNode ),
mpLayerManager( new LayerManager(
rViewContainer,
@@ -456,7 +461,9 @@ void SlideImpl::dispose()
mpShapeManager.reset();
mxRootNode.clear();
mxDrawPage.clear();
+#ifndef ENABLE_PRESENTER_EXTRA_UI
mxDrawPagesSupplier.clear();
+#endif
}
bool SlideImpl::prefetch()
@@ -906,7 +913,7 @@ void SlideImpl::drawPolygons() const
void SlideImpl::addPolygons(PolyPolygonVector aPolygons)
{
- if(!aPolygons.empty())
+ if(!aPolygons.empty()) /* FIXME : was if(aPolygons.size() != 0) */
{
for( PolyPolygonVector::iterator aIter=aPolygons.begin(),
aEnd=aPolygons.end();
@@ -1259,7 +1266,11 @@ SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >&
bool bIntrinsicAnimationsAllowed,
bool bDisableAnimationZOrder )
{
+#ifdef ENABLE_PRESENTER_EXTRA_UI
boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, xDrawPages, xRootNode, rEventQueue,
+#else
+ boost::shared_ptr<SlideImpl> pRet( new SlideImpl( xDrawPage, NULL, xRootNode, rEventQueue,
+#endif
rEventMultiplexer, rScreenUpdater,
rActivitiesQueue, rUserEventQueue,
rCursorManager, rViewContainer,
diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx
index d9854f67b6fe..cfcb6a1918dc 100644
--- a/slideshow/source/engine/slide/userpaintoverlay.cxx
+++ b/slideshow/source/engine/slide/userpaintoverlay.cxx
@@ -65,7 +65,7 @@ namespace slideshow
{
class PaintOverlayHandler : public MouseEventHandler,
public ViewEventHandler,
- public UserPaintEventHandler
+ public UserPaintEventHandler
{
public:
PaintOverlayHandler( const RGBColor& rStrokeColor,
@@ -73,7 +73,7 @@ namespace slideshow
ActivitiesQueue& rActivitiesQueue,
ScreenUpdater& rScreenUpdater,
const UnoViewContainer& rViews,
- Slide& rSlide,
+ Slide& rSlide,
const PolyPolygonVector& rPolygons ) :
mrActivitiesQueue( rActivitiesQueue ),
mrScreenUpdater( rScreenUpdater ),
@@ -90,7 +90,7 @@ namespace slideshow
//handle the "remove stroke by stroke" mode of erasing
mbIsEraseModeActivated( false ),
mrSlide(rSlide),
- mnSize(100.0)
+ mnSize(100)
{
std::for_each( rViews.begin(),
rViews.end(),
@@ -132,23 +132,27 @@ namespace slideshow
bool colorChanged( RGBColor const& rUserColor )
{
- maStrokeColor = rUserColor;
+ this->maStrokeColor = rUserColor;
+ this->mbIsEraseModeActivated = false;
return true;
}
bool widthChanged( double nUserStrokeWidth )
{
- mnStrokeWidth = nUserStrokeWidth;
+ this->mnStrokeWidth = nUserStrokeWidth;
+ mbIsEraseModeActivated = false;
return true;
}
bool eraseAllInkChanged( bool const& rEraseAllInk )
{
- mbIsEraseAllModeActivated= 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;
@@ -180,17 +184,30 @@ namespace slideshow
mrScreenUpdater.notifyUpdate(*aIter,true);
}
+ maPolygons.clear();
}
- mbIsEraseAllModeActivated=false;
+ 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 eraseInkChanged( double rEraseInkSize )
+ bool switchPenMode()
{
- if(mbIsEraseModeActivated)
- mbIsEraseModeActivated=false;
- else
- mbIsEraseModeActivated=true;
+ this->mbIsEraseModeActivated = false;
+ return true;
+ }
+
+ bool switchEraserMode()
+ {
+ this->mbIsEraseModeActivated = true;
return true;
}
@@ -292,7 +309,7 @@ namespace slideshow
virtual bool handleMouseDragged( const awt::MouseEvent& e )
{
- if(mbIsEraseModeActivated)
+ if(mbIsEraseModeActivated)
{
//define the last point as an object
//we suppose that there's no way this point could be valid
@@ -324,7 +341,7 @@ namespace slideshow
//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();
+ for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
aIter!=aEnd;
++aIter )
{
@@ -355,7 +372,7 @@ namespace slideshow
mrScreenUpdater.notifyUpdate(*aIter,true);
}
- }
+ }
else
{
if( !mbIsLastPointValid )
@@ -385,8 +402,10 @@ namespace slideshow
if( pPolyPoly )
{
+ pPolyPoly->setStrokeWidth(mnStrokeWidth);
pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() );
pPolyPoly->draw();
+ maPolygons.push_back(pPolyPoly);
}
}
@@ -421,7 +440,7 @@ namespace slideshow
bool mbIsEraseAllModeActivated;
bool mbIsEraseModeActivated;
Slide& mrSlide;
- double mnSize;
+ sal_Int32 mnSize;
};
UserPaintOverlaySharedPtr UserPaintOverlay::create( const RGBColor& rStrokeColor,
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index ad63f4d80d17..6e12389cddbe 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -116,6 +116,7 @@
#include <string>
#include <algorithm>
#include <stdio.h>
+#include <iostream>
using namespace com::sun::star;
using namespace ::slideshow::internal;
@@ -367,9 +368,10 @@ private:
boost::optional<double> maUserPaintStrokeWidth;
//changed for the eraser project
- boost::optional<bool> maEraseAllInk;
-
- boost::optional<bool> maEraseInk;
+ boost::optional<bool> maEraseAllInk;
+ boost::optional<bool> maSwitchPenMode;
+ boost::optional<bool> maSwitchEraserMode;
+ boost::optional<sal_Int32> maEraseInk;
//end changed
boost::shared_ptr<canvas::tools::ElapsedTime> mpPresTimer;
@@ -956,7 +958,11 @@ void SlideShowImpl::displaySlide(
// precondition: must only be called from the main thread!
DBG_TESTSOLARMUTEX();
+#ifdef ENABLE_PRESENTER_EXTRA_UI
mxDrawPagesSupplier = xDrawPages;
+#else
+ mxDrawPagesSupplier = NULL;
+#endif
stopShow(); // MUST call that: results in
// maUserEventQueue.clear(). What's more,
@@ -990,9 +996,7 @@ void SlideShowImpl::displaySlide(
mpCurrentSlide = mpPrefetchSlide;
}
else
- {
mpCurrentSlide = makeSlide( xSlide, xDrawPages, xRootNode );
- }
OSL_ASSERT( mpCurrentSlide );
if (mpCurrentSlide)
@@ -1399,21 +1403,65 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
}
else
{
- // disable user paint
- maEraseAllInk.reset();
- maEventMultiplexer.notifyUserPaintDisabled();
+ // disable user paint
+ maEraseAllInk.reset();
+ maEventMultiplexer.notifyUserPaintDisabled();
+ }
+
+ if( mnCurrentCursor == awt::SystemPointer::ARROW )
+ resetCursor();
+
+ return true;
+ }
+
+ if (rProperty.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SwitchPenMode") ))
+ {
+ bool nSwitchPenMode(false);
+ if (rProperty.Value >>= nSwitchPenMode)
+ {
+ OSL_ENSURE( mbMouseVisible,
+ "setProperty(): User paint overrides invisible mouse" );
+
+ if(nSwitchPenMode == true){
+ // Switch to Pen Mode
+ maSwitchPenMode.reset( nSwitchPenMode );
+ maEventMultiplexer.notifySwitchPenMode();
+ }
}
if( mnCurrentCursor == awt::SystemPointer::ARROW )
resetCursor();
+ return true;
+ }
+
+
+ if (rProperty.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SwitchEraserMode") ))
+ {
+ bool nSwitchEraserMode(false);
+ if (rProperty.Value >>= nSwitchEraserMode)
+ {
+ OSL_ENSURE( mbMouseVisible,
+ "setProperty(): User paint overrides invisible mouse" );
+ if(nSwitchEraserMode == true){
+ // switch to Eraser mode
+ maSwitchEraserMode.reset( nSwitchEraserMode );
+ maEventMultiplexer.notifySwitchEraserMode();
+ }
+ }
+ if( mnCurrentCursor == awt::SystemPointer::ARROW )
+ resetCursor();
return true;
}
+
+
if (rProperty.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("EraseInk") ))
{
- double nEraseInk(0.0);
+ sal_Int32 nEraseInk(100);
if (rProperty.Value >>= nEraseInk)
{
OSL_ENSURE( mbMouseVisible,
@@ -1421,7 +1469,7 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
// enable user paint
maEraseInk.reset( nEraseInk );
- maEventMultiplexer.notifyEraseInk( *maEraseInk );
+ maEventMultiplexer.notifyEraseInkWidth( *maEraseInk );
}
else
{
diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx
index be3a39849040..249375f99032 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -637,8 +637,8 @@ namespace slideshow
aTransform );
}
- ::basegfx::B2DRange getShapeUpdateArea( const ::basegfx::B2DRange& rUnitBounds,
- const ::basegfx::B2DRange& rShapeBounds )
+ ::basegfx::B2DRange getShapeUpdateArea( const ::basegfx::B2DRange& rUnitBounds,
+ const ::basegfx::B2DRange& rShapeBounds )
{
return ::basegfx::B2DRectangle(
lerp( rShapeBounds.getMinX(),
@@ -710,15 +710,25 @@ namespace slideshow
static_cast< sal_uInt8 >( nColor >> 24U ) ) );
}
- sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA aColor )
+ /*sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA aColor )
{
- return ::cppcanvas::makeColorARGB(
- // convert from IntSRGBA color to API color
- // (0xRRGGBBAA -> 0xAARRGGBB)
- static_cast< sal_uInt8 >(0),
- ::cppcanvas::getRed(aColor),
- ::cppcanvas::getGreen(aColor),
- ::cppcanvas::getBlue(aColor));
+ return ::cppcanvas::unMakeColor(
+ // convert from IntSRGBA color to API color
+ // (0xRRGGBBAA -> 0xAARRGGBB)
+ static_cast< sal_uInt8 >(0),
+ ::cppcanvas::getRed(aColor),
+ ::cppcanvas::getGreen(aColor),
+ ::cppcanvas::getBlue(aColor));
+ }*/
+
+ sal_Int8 unSignedToSigned(sal_Int8 nInt)
+ {
+ if(nInt < 0 ){
+ sal_Int8 nInt2 = nInt >> 1U;
+ return nInt2;
+ }else{
+ return nInt;
+ }
}
void fillRect( const ::cppcanvas::CanvasSharedPtr& rCanvas,
diff --git a/slideshow/source/inc/eventmultiplexer.hxx b/slideshow/source/inc/eventmultiplexer.hxx
index 01722ee0b527..a1c932252d7b 100644
--- a/slideshow/source/inc/eventmultiplexer.hxx
+++ b/slideshow/source/inc/eventmultiplexer.hxx
@@ -509,7 +509,9 @@ public:
this event (and probably, nothing will happen at all)
*/
bool notifyEraseAllInk( bool const& rEraseAllInk );
- bool notifyEraseInk( double rEraseInkSize );
+ bool notifySwitchPenMode();
+ bool notifySwitchEraserMode();
+ bool notifyEraseInkWidth( sal_Int32 rEraseInkSize );
/** Notify that user paint is disabled
diff --git a/slideshow/source/inc/rgbcolor.hxx b/slideshow/source/inc/rgbcolor.hxx
index 1ea168ee80c3..73f14558b494 100644
--- a/slideshow/source/inc/rgbcolor.hxx
+++ b/slideshow/source/inc/rgbcolor.hxx
@@ -90,6 +90,9 @@ namespace slideshow
*/
::cppcanvas::Color::IntSRGBA getIntegerColor() const;
+ RGBColor(const RGBColor& rLHS);
+ RGBColor& operator=( const RGBColor& rLHS);
+
struct RGBTriple
{
RGBTriple();
diff --git a/slideshow/source/inc/shapeimporter.hxx b/slideshow/source/inc/shapeimporter.hxx
index e86db9c7a864..6b3ff7eb2057 100644
--- a/slideshow/source/inc/shapeimporter.hxx
+++ b/slideshow/source/inc/shapeimporter.hxx
@@ -82,7 +82,7 @@ public:
::com::sun::star::drawing::XDrawPage >& xPage,
const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XDrawPage >& xActualPage,
- const ::com::sun::star::uno::Reference<
+ const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XDrawPagesSupplier>& xPagesSupplier,
const SlideShowContext& rContext,
sal_Int32 nOrdNumStart,
diff --git a/slideshow/source/inc/userpainteventhandler.hxx b/slideshow/source/inc/userpainteventhandler.hxx
index 1a9ab5fbb64a..8675ed4d5ae7 100644
--- a/slideshow/source/inc/userpainteventhandler.hxx
+++ b/slideshow/source/inc/userpainteventhandler.hxx
@@ -51,11 +51,12 @@ namespace slideshow
{
public:
virtual ~UserPaintEventHandler() {}
-
virtual bool colorChanged( RGBColor const& rUserColor ) = 0;
virtual bool widthChanged( double nUserStrokeWidth ) = 0;
virtual bool eraseAllInkChanged(bool const& rEraseAllInk) =0;
- virtual bool eraseInkChanged(double rEraseInkSize) =0;
+ virtual bool eraseInkWidthChanged(sal_Int32 rEraseInkSize) =0;
+ virtual bool switchEraserMode() = 0;
+ virtual bool switchPenMode() = 0;
virtual bool disable() = 0;
};