summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2011-01-05 13:23:59 +0100
committerVladimir Glazunov <vg@openoffice.org>2011-01-05 13:23:59 +0100
commitfaf2e7ab967a47f55804af62adad5d9a3f77dbcc (patch)
treecbf17dbc153f2cf17409665f2b766ddf8741722a /slideshow
parenteb483309e8c3792c8a494ed9f1ec4f08a0f9590b (diff)
parent43aa5e0362693dfddbd9e8a44ca028f49428fd96 (diff)
CWS-TOOLING: integrate CWS impressdefaults1
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/color.cxx4
-rw-r--r--slideshow/source/engine/makefile.mk2
-rw-r--r--slideshow/source/engine/shapes/shapeimporter.cxx7
-rw-r--r--slideshow/source/engine/slide/slideimpl.cxx50
-rw-r--r--slideshow/source/engine/slide/userpaintoverlay.cxx91
-rw-r--r--slideshow/source/engine/slide/userpaintoverlay.hxx9
-rw-r--r--slideshow/source/engine/slideshowimpl.cxx54
-rw-r--r--slideshow/source/inc/slide.hxx7
-rw-r--r--slideshow/util/makefile.pmk2
9 files changed, 138 insertions, 88 deletions
diff --git a/slideshow/source/engine/color.cxx b/slideshow/source/engine/color.cxx
index e49f8e7e1b63..7b60a463dd1c 100644
--- a/slideshow/source/engine/color.cxx
+++ b/slideshow/source/engine/color.cxx
@@ -267,7 +267,9 @@ namespace slideshow
RGBColor::RGBColor(const RGBColor& rLHS)
{
- RGBColor(rLHS.getRed(), rLHS.getGreen(), rLHS.getBlue());
+ maRGBTriple.mnRed = rLHS.getRed();
+ maRGBTriple.mnGreen = rLHS.getGreen();
+ maRGBTriple.mnBlue = rLHS.getBlue();
}
RGBColor& RGBColor::operator=( const RGBColor& rLHS ){
diff --git a/slideshow/source/engine/makefile.mk b/slideshow/source/engine/makefile.mk
index beac66778518..fdc99cd1ad9f 100644
--- a/slideshow/source/engine/makefile.mk
+++ b/slideshow/source/engine/makefile.mk
@@ -38,7 +38,7 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : $(PRJ)$/util$/makefile.pmk
.IF "$(ENABLE_PRESENTER_EXTRA_UI)"=="YES"
-CDEFS+=-DENABLE_PRESENTER_EXTRA_UI
+ENABLE_PRESENTER_EXTRA_UI is not used anymore
.ENDIF
# --- Common ----------------------------------------------------------
diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx
index 84786c26a504..a5d8acea2140 100644
--- a/slideshow/source/engine/shapes/shapeimporter.cxx
+++ b/slideshow/source/engine/shapes/shapeimporter.cxx
@@ -653,20 +653,13 @@ 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(),
mnAscendingPrio( nOrdNumStart ),
mbConvertingMasterPage( bConvertingMasterPage )
{
-#ifndef ENABLE_PRESENTER_EXTRA_UI
- (void)xPagesSupplier;
-#endif
uno::Reference<drawing::XShapes> const xShapes(
xPage, uno::UNO_QUERY_THROW );
maShapesStack.push( XShapesEntry(xShapes) );
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index 55831ba1609f..2534b495ca90 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -139,6 +139,10 @@ public:
virtual PolyPolygonVector getPolygons();
virtual void drawPolygons() const;
virtual bool isPaintOverlayActive() const;
+ virtual void enablePaintOverlay();
+ virtual void disablePaintOverlay();
+ virtual void update_settings( bool bUserPaintEnabled, RGBColor const& aUserPaintColor, double dUserPaintStrokeWidth );
+
// TODO(F2): Rework SlideBitmap to no longer be based on XBitmap,
// but on canvas-independent basegfx bitmaps
@@ -156,6 +160,9 @@ private:
virtual bool requestCursor( sal_Int16 nCursorShape );
virtual void resetCursor();
+ void activatePaintOverlay();
+ void deactivatePaintOverlay();
+
/** Query whether the slide has animations at all
If the slide doesn't have animations, show() displays
@@ -174,9 +181,6 @@ private:
*/
bool isShowing() const;
- void enablePaintOverlay();
- void disablePaintOverlay();
-
/// Set all Shapes to their initial attributes for slideshow
bool applyInitialShapeAttributes( const ::com::sun::star::uno::Reference<
::com::sun::star::animations::XAnimationNode >& xRootAnimationNode );
@@ -419,6 +423,13 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra
maContext.mrScreenUpdater.addViewUpdate(mpShapeManager);
}
+void SlideImpl::update_settings( bool bUserPaintEnabled, RGBColor const& aUserPaintColor, double dUserPaintStrokeWidth )
+{
+ maUserPaintColor = aUserPaintColor;
+ mdUserPaintStrokeWidth = dUserPaintStrokeWidth;
+ mbUserPaintOverlayEnabled = bUserPaintEnabled;
+}
+
SlideImpl::~SlideImpl()
{
if( mpShapeManager )
@@ -454,9 +465,7 @@ void SlideImpl::dispose()
mpShapeManager.reset();
mxRootNode.clear();
mxDrawPage.clear();
-#ifndef ENABLE_PRESENTER_EXTRA_UI
mxDrawPagesSupplier.clear();
-#endif
}
bool SlideImpl::prefetch()
@@ -542,7 +551,7 @@ bool SlideImpl::show( bool bSlideBackgoundPainted )
// ---------------------------------------------------------------
// enable paint overlay, if maUserPaintColor is valid
- enablePaintOverlay();
+ activatePaintOverlay();
// ---------------------------------------------------------------
@@ -566,7 +575,7 @@ void SlideImpl::hide()
// disable user paint overlay under all circumstances,
// this slide now ceases to be active.
- disablePaintOverlay();
+ deactivatePaintOverlay();
// ---------------------------------------------------------------
@@ -888,19 +897,33 @@ bool SlideImpl::implPrefetchShow()
void SlideImpl::enablePaintOverlay()
{
- if( mbUserPaintOverlayEnabled )
+ if( !mbUserPaintOverlayEnabled || !mbPaintOverlayActive )
+ {
+ mbUserPaintOverlayEnabled = true;
+ activatePaintOverlay();
+ }
+}
+
+void SlideImpl::disablePaintOverlay()
+{
+}
+
+void SlideImpl::activatePaintOverlay()
+{
+ if( mbUserPaintOverlayEnabled || !maPolygons.empty() )
{
mpPaintOverlay = UserPaintOverlay::create( maUserPaintColor,
mdUserPaintStrokeWidth,
maContext,
- maPolygons );
+ maPolygons,
+ mbUserPaintOverlayEnabled );
mbPaintOverlayActive = true;
}
}
void SlideImpl::drawPolygons() const
{
- if( mbUserPaintOverlayEnabled )
+ if( mpPaintOverlay )
mpPaintOverlay->drawPolygons();
}
@@ -923,7 +946,7 @@ bool SlideImpl::isPaintOverlayActive() const
return mbPaintOverlayActive;
}
-void SlideImpl::disablePaintOverlay()
+void SlideImpl::deactivatePaintOverlay()
{
if(mbPaintOverlayActive)
maPolygons = mpPaintOverlay->getPolygons();
@@ -1259,12 +1282,7 @@ 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
- (void)xDrawPages;
- 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 8d9fad06a3e3..d0ab4e33a1e3 100644
--- a/slideshow/source/engine/slide/userpaintoverlay.cxx
+++ b/slideshow/source/engine/slide/userpaintoverlay.cxx
@@ -70,8 +70,9 @@ namespace slideshow
ActivitiesQueue& rActivitiesQueue,
ScreenUpdater& rScreenUpdater,
const UnoViewContainer& rViews,
- Slide& rSlide,
- const PolyPolygonVector& rPolygons ) :
+ Slide& rSlide,
+ const PolyPolygonVector& rPolygons,
+ bool bActive ) :
mrActivitiesQueue( rActivitiesQueue ),
mrScreenUpdater( rScreenUpdater ),
maViews(),
@@ -87,7 +88,8 @@ namespace slideshow
//handle the "remove stroke by stroke" mode of erasing
mbIsEraseModeActivated( false ),
mrSlide(rSlide),
- mnSize(100)
+ mnSize(100),
+ mbActive( bActive )
{
std::for_each( rViews.begin(),
rViews.end(),
@@ -129,6 +131,8 @@ namespace slideshow
bool colorChanged( RGBColor const& rUserColor )
{
+ mbIsLastPointValid = false;
+ mbActive = true;
this->maStrokeColor = rUserColor;
this->mbIsEraseModeActivated = false;
return true;
@@ -141,22 +145,15 @@ namespace slideshow
return true;
}
- bool eraseAllInkChanged( bool const& rEraseAllInk )
+ void repaintWithoutPolygons()
{
- 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();
+ //(*aIter)->getCanvas()->clear();
//get via SlideImpl instance the bitmap of the slide unmodified to redraw it
SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) );
@@ -181,7 +178,19 @@ namespace slideshow
mrScreenUpdater.notifyUpdate(*aIter,true);
}
- maPolygons.clear();
+ }
+
+ 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;
+ repaintWithoutPolygons();
+ maPolygons.clear();
}
mbIsEraseAllModeActivated=false;
return true;
@@ -198,18 +207,25 @@ namespace slideshow
bool switchPenMode()
{
+ mbIsLastPointValid = false;
+ mbActive = true;
this->mbIsEraseModeActivated = false;
return true;
}
bool switchEraserMode()
{
+ mbIsLastPointValid = false;
+ mbActive = true;
this->mbIsEraseModeActivated = true;
return true;
}
bool disable()
{
+ mbIsLastPointValid = false;
+ mbIsLastMouseDownPosValid = false;
+ mbActive = false;
return true;
}
@@ -235,6 +251,9 @@ namespace slideshow
// MouseEventHandler methods
virtual bool handleMousePressed( const awt::MouseEvent& e )
{
+ if( !mbActive )
+ return false;
+
if (e.Buttons == awt::MouseButton::RIGHT)
{
mbIsLastPointValid = false;
@@ -255,6 +274,9 @@ namespace slideshow
virtual bool handleMouseReleased( const awt::MouseEvent& e )
{
+ if( !mbActive )
+ return false;
+
if (e.Buttons == awt::MouseButton::RIGHT)
{
mbIsLastPointValid = false;
@@ -289,6 +311,9 @@ namespace slideshow
virtual bool handleMouseEntered( const awt::MouseEvent& e )
{
+ if( !mbActive )
+ return false;
+
mbIsLastPointValid = true;
maLastPoint.setX( e.X );
maLastPoint.setY( e.Y );
@@ -298,6 +323,9 @@ namespace slideshow
virtual bool handleMouseExited( const awt::MouseEvent& )
{
+ if( !mbActive )
+ return false;
+
mbIsLastPointValid = false;
mbIsLastMouseDownPosValid = false;
@@ -306,7 +334,16 @@ namespace slideshow
virtual bool handleMouseDragged( const awt::MouseEvent& e )
{
- if(mbIsEraseModeActivated)
+ if( !mbActive )
+ return false;
+
+ if (e.Buttons == awt::MouseButton::RIGHT)
+ {
+ mbIsLastPointValid = false;
+ return false;
+ }
+
+ if(mbIsEraseModeActivated)
{
//define the last point as an object
//we suppose that there's no way this point could be valid
@@ -421,6 +458,14 @@ namespace slideshow
}
+ void update_settings( bool bUserPaintEnabled, RGBColor const& aUserPaintColor, double dUserPaintStrokeWidth )
+ {
+ maStrokeColor = aUserPaintColor;
+ mnStrokeWidth = dUserPaintStrokeWidth;
+ mbActive = bUserPaintEnabled;
+ if( !mbActive )
+ disable();
+ }
private:
ActivitiesQueue& mrActivitiesQueue;
@@ -438,17 +483,20 @@ namespace slideshow
bool mbIsEraseModeActivated;
Slide& mrSlide;
sal_Int32 mnSize;
+ bool mbActive;
};
UserPaintOverlaySharedPtr UserPaintOverlay::create( const RGBColor& rStrokeColor,
double nStrokeWidth,
const SlideShowContext& rContext,
- const PolyPolygonVector& rPolygons )
+ const PolyPolygonVector& rPolygons,
+ bool bActive )
{
UserPaintOverlaySharedPtr pRet( new UserPaintOverlay( rStrokeColor,
nStrokeWidth,
rContext,
- rPolygons ));
+ rPolygons,
+ bActive));
return pRet;
}
@@ -456,7 +504,8 @@ namespace slideshow
UserPaintOverlay::UserPaintOverlay( const RGBColor& rStrokeColor,
double nStrokeWidth,
const SlideShowContext& rContext,
- const PolyPolygonVector& rPolygons ) :
+ const PolyPolygonVector& rPolygons,
+ bool bActive ) :
mpHandler( new PaintOverlayHandler( rStrokeColor,
nStrokeWidth,
rContext.mrActivitiesQueue,
@@ -464,7 +513,7 @@ namespace slideshow
rContext.mrViewContainer,
//adding a link to Slide
dynamic_cast<Slide&>(rContext.mrCursorManager),
- rPolygons )),
+ rPolygons, bActive )),
mrMultiplexer( rContext.mrEventMultiplexer )
{
mrMultiplexer.addClickHandler( mpHandler, 3.0 );
@@ -483,6 +532,12 @@ namespace slideshow
mpHandler->drawPolygons();
}
+ void UserPaintOverlay::update_settings( bool bUserPaintEnabled, RGBColor const& aUserPaintColor, double dUserPaintStrokeWidth )
+ {
+ mpHandler->update_settings( bUserPaintEnabled, aUserPaintColor, dUserPaintStrokeWidth );
+ }
+
+
UserPaintOverlay::~UserPaintOverlay()
{
try
diff --git a/slideshow/source/engine/slide/userpaintoverlay.hxx b/slideshow/source/engine/slide/userpaintoverlay.hxx
index b92f5f2539b0..3a8e14c600c5 100644
--- a/slideshow/source/engine/slide/userpaintoverlay.hxx
+++ b/slideshow/source/engine/slide/userpaintoverlay.hxx
@@ -69,16 +69,21 @@ namespace slideshow
static UserPaintOverlaySharedPtr create( const RGBColor& rStrokeColor,
double nStrokeWidth,
const SlideShowContext& rContext,
- const PolyPolygonVector& rPolygons );
+ const PolyPolygonVector& rPolygons,
+ bool bActive);
~UserPaintOverlay();
PolyPolygonVector getPolygons();
void drawPolygons();
+ void update_settings( bool bUserPaintEnabled, RGBColor const& aUserPaintColor, double dUserPaintStrokeWidth );
+
+
private:
UserPaintOverlay( const RGBColor& rStrokeColor,
double nStrokeWidth,
const SlideShowContext& rContext,
- const PolyPolygonVector& rPolygons );
+ const PolyPolygonVector& rPolygons,
+ bool bActive );
::boost::shared_ptr<PaintOverlayHandler> mpHandler;
EventMultiplexer& mrMultiplexer;
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index d736c3f52d64..a909ade61ee2 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -458,7 +458,7 @@ private:
boost::optional<RGBColor> maUserPaintColor;
- boost::optional<double> maUserPaintStrokeWidth;
+ double maUserPaintStrokeWidth;
//changed for the eraser project
boost::optional<bool> maEraseAllInk;
@@ -950,7 +950,7 @@ SlideSharedPtr SlideShowImpl::makeSlide(
maShapeCursors,
(aIter != maPolygons.end()) ? aIter->second : PolyPolygonVector(),
maUserPaintColor ? *maUserPaintColor : RGBColor(),
- *maUserPaintStrokeWidth,
+ maUserPaintStrokeWidth,
!!maUserPaintColor,
mbImageAnimationsAllowed,
mbDisableAnimationZOrder) );
@@ -1112,11 +1112,7 @@ 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,
@@ -1620,6 +1616,9 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
// enable user paint
maUserPaintColor.reset( unoColor2RGBColor( nColor ) );
+ if( mpCurrentSlide && !mpCurrentSlide->isPaintOverlayActive() )
+ mpCurrentSlide->enablePaintOverlay();
+
maEventMultiplexer.notifyUserPaintColor( *maUserPaintColor );
}
else
@@ -1627,10 +1626,11 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
// disable user paint
maUserPaintColor.reset();
maEventMultiplexer.notifyUserPaintDisabled();
+ if( mpCurrentSlide )
+ mpCurrentSlide->disablePaintOverlay();
}
- if( mnCurrentCursor == awt::SystemPointer::ARROW )
- resetCursor();
+ resetCursor();
return true;
}
@@ -1649,15 +1649,6 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
maEraseAllInk.reset( nEraseAllInk );
maEventMultiplexer.notifyEraseAllInk( *maEraseAllInk );
}
- else
- {
- // disable user paint
- maEraseAllInk.reset();
- maEventMultiplexer.notifyUserPaintDisabled();
- }
-
- if( mnCurrentCursor == awt::SystemPointer::ARROW )
- resetCursor();
return true;
}
@@ -1677,9 +1668,6 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
maEventMultiplexer.notifySwitchPenMode();
}
}
-
- if( mnCurrentCursor == awt::SystemPointer::ARROW )
- resetCursor();
return true;
}
@@ -1699,8 +1687,6 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
}
}
- if( mnCurrentCursor == awt::SystemPointer::ARROW )
- resetCursor();
return true;
}
@@ -1719,15 +1705,6 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
maEraseInk.reset( nEraseInk );
maEventMultiplexer.notifyEraseInkWidth( *maEraseInk );
}
- else
- {
- // disable user paint
- maEraseInk.reset();
- maEventMultiplexer.notifyUserPaintDisabled();
- }
-
- if( mnCurrentCursor == awt::SystemPointer::ARROW )
- resetCursor();
return true;
}
@@ -1741,17 +1718,10 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
{
OSL_ENSURE( mbMouseVisible,"setProperty(): User paint overrides invisible mouse" );
// enable user paint stroke width
- maUserPaintStrokeWidth.reset( nWidth );
- maEventMultiplexer.notifyUserPaintStrokeWidth( *maUserPaintStrokeWidth );
+ maUserPaintStrokeWidth = nWidth;
+ maEventMultiplexer.notifyUserPaintStrokeWidth( maUserPaintStrokeWidth );
}
- else
- {
- // disable user paint stroke width
- maUserPaintStrokeWidth.reset();
- maEventMultiplexer.notifyUserPaintDisabled();
- }
- if( mnCurrentCursor == awt::SystemPointer::ARROW )
- resetCursor();
+
return true;
}
@@ -2214,6 +2184,8 @@ void SlideShowImpl::notifySlideTransitionEnded( bool bPaintSlide )
"notifySlideTransitionEnded(): Invalid current slide" );
if (mpCurrentSlide)
{
+ mpCurrentSlide->update_settings( !!maUserPaintColor, maUserPaintColor ? *maUserPaintColor : RGBColor(), maUserPaintStrokeWidth );
+
// first init show, to give the animations
// the chance to register SlideStartEvents
const bool bBackgroundLayerRendered( !bPaintSlide );
diff --git a/slideshow/source/inc/slide.hxx b/slideshow/source/inc/slide.hxx
index 9f4e6b8f5055..d457d8e16f88 100644
--- a/slideshow/source/inc/slide.hxx
+++ b/slideshow/source/inc/slide.hxx
@@ -121,9 +121,14 @@ namespace slideshow
///Draw the slide Polygons
virtual void drawPolygons() const = 0;
- ///Check if slide is already active
+ ///Check if paint overlay is already active
virtual bool isPaintOverlayActive() const = 0;
+ virtual void enablePaintOverlay() = 0;
+ virtual void disablePaintOverlay() = 0;
+
+ virtual void update_settings( bool bUserPaintEnabled, RGBColor const& aUserPaintColor, double dUserPaintStrokeWidth ) = 0;
+
// Slide bitmaps
// -------------------------------------------------------------------
diff --git a/slideshow/util/makefile.pmk b/slideshow/util/makefile.pmk
index 53724522d5e8..765b5249e5a4 100644
--- a/slideshow/util/makefile.pmk
+++ b/slideshow/util/makefile.pmk
@@ -35,7 +35,7 @@ CDEFS += -DBOOST_SP_ENABLE_DEBUG_HOOKS
.IF "$(COM)"=="MSC"
# disable inlining for MSVC
-CFLAGS += -Ob0
+#CFLAGS += -Ob0
.ENDIF
.ENDIF # "$(debug)"!="" || "$(DEBUG)"!=""