diff --git a/slideshow/IwyuFilter_slideshow.yaml b/slideshow/IwyuFilter_slideshow.yaml index 45bed73d7806..6fec72c4eb9f 100644 --- a/slideshow/IwyuFilter_slideshow.yaml +++ b/slideshow/IwyuFilter_slideshow.yaml @@ -25,6 +25,11 @@ excludelist: slideshow/source/engine/smilfunctionparser.cxx: # Boost wrapper is needed - boost/spirit/include/classic_core.hpp + slideshow/source/engine/shapes/viewappletshape.cxx: + # Actually used + - com/sun/star/uno/XComponentContext.hpp + # Needed for direct member access + - basegfx/matrix/b2dhommatrix.hxx slideshow/source/engine/shapes/mediashape.cxx: # Actually used - com/sun/star/drawing/XShape.hpp diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk index 9dd2a57bf723..3bea78134569 100644 --- a/slideshow/Library_slideshow.mk +++ b/slideshow/Library_slideshow.mk @@ -85,6 +85,7 @@ $(eval $(call gb_Library_add_exception_objects,slideshow,\ slideshow/source/engine/rehearsetimingsactivity \ slideshow/source/engine/screenupdater \ slideshow/source/engine/shapeattributelayer \ + slideshow/source/engine/shapes/appletshape \ slideshow/source/engine/shapes/backgroundshape \ slideshow/source/engine/shapes/drawinglayeranimation \ slideshow/source/engine/shapes/drawshape \ @@ -95,6 +96,7 @@ $(eval $(call gb_Library_add_exception_objects,slideshow,\ slideshow/source/engine/shapes/mediashape \ slideshow/source/engine/shapes/shapeimporter \ slideshow/source/engine/shapesubset \ + slideshow/source/engine/shapes/viewappletshape \ slideshow/source/engine/shapes/viewbackgroundshape \ slideshow/source/engine/shapes/viewmediashape \ slideshow/source/engine/shapes/viewshape \ diff --git a/slideshow/source/engine/shapes/appletshape.cxx b/slideshow/source/engine/shapes/appletshape.cxx new file mode 100644 index 000000000000..f58012af2407 --- /dev/null +++ b/slideshow/source/engine/shapes/appletshape.cxx @@ -0,0 +1,299 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#include "appletshape.hxx" +#include "externalshapebase.hxx" +#include "viewappletshape.hxx" +#include + +#include +#include + +#include +#include + + +using namespace ::com::sun::star; + + +namespace slideshow::internal +{ + namespace { + + /** Represents an applet shape. + + This implementation offers support for applet shapes (both + Java applets, and Netscape plugins). Such shapes need + special treatment. + */ + class AppletShape : public ExternalShapeBase + { + public: + /** Create a shape for the given XShape for an applet object + + @param xShape + The XShape to represent. + + @param nPrio + Externally-determined shape priority (used e.g. for + paint ordering). This number _must be_ unique! + + @param rServiceName + Service name to use, when creating the actual viewer + component + + @param pPropCopyTable + Table of plain ASCII property names, to copy from + xShape to applet. + + @param nNumPropEntries + Number of property table entries (in pPropCopyTable) + */ + AppletShape( const css::uno::Reference< css::drawing::XShape >& xShape, + double nPrio, + OUString aServiceName, + const char* const* pPropCopyTable, + std::size_t nNumPropEntries, + const SlideShowContext& rContext ); // throw ShapeLoadFailedException; + + private: + + // View layer methods + + + virtual void addViewLayer( const ViewLayerSharedPtr& rNewLayer, + bool bRedrawLayer ) override; + virtual bool removeViewLayer( const ViewLayerSharedPtr& rNewLayer ) override; + virtual void clearAllViewLayers() override; + + + // ExternalShapeBase methods + + + virtual bool implRender( const ::basegfx::B2DRange& rCurrBounds ) const override; + virtual void implViewChanged( const UnoViewSharedPtr& rView ) override; + virtual void implViewsChanged() override; + virtual bool implStartIntrinsicAnimation() override; + virtual bool implEndIntrinsicAnimation() override; + virtual void implPauseIntrinsicAnimation() override; + virtual bool implIsIntrinsicAnimationPlaying() const override; + virtual void implSetIntrinsicAnimationTime(double) override; + + const OUString maServiceName; + const char* const* mpPropCopyTable; + const std::size_t mnNumPropEntries; + + /// the list of active view shapes (one for each registered view layer) + typedef ::std::vector< ViewAppletShapeSharedPtr > ViewAppletShapeVector; + ViewAppletShapeVector maViewAppletShapes; + bool mbIsPlaying; + }; + + } + + AppletShape::AppletShape( const uno::Reference< drawing::XShape >& xShape, + double nPrio, + OUString aServiceName, + const char* const* pPropCopyTable, + std::size_t nNumPropEntries, + const SlideShowContext& rContext ) : + ExternalShapeBase( xShape, nPrio, rContext ), + maServiceName(std::move( aServiceName )), + mpPropCopyTable( pPropCopyTable ), + mnNumPropEntries( nNumPropEntries ), + maViewAppletShapes(), + mbIsPlaying(false) + { + } + + + void AppletShape::implViewChanged( const UnoViewSharedPtr& rView ) + { + const ::basegfx::B2DRectangle aBounds = getBounds(); + // determine ViewAppletShape that needs update + for( const auto& pViewAppletShape : maViewAppletShapes ) + { + if( pViewAppletShape->getViewLayer()->isOnView( rView ) ) + pViewAppletShape->resize( aBounds ); + } + } + + + void AppletShape::implViewsChanged() + { + // resize all ViewShapes + const ::basegfx::B2DRectangle aBounds = getBounds(); + for( const auto& pViewAppletShape : maViewAppletShapes ) + pViewAppletShape->resize( aBounds ); + } + + + void AppletShape::addViewLayer( const ViewLayerSharedPtr& rNewLayer, + bool bRedrawLayer ) + { + try + { + maViewAppletShapes.push_back( + std::make_shared( rNewLayer, + getXShape(), + maServiceName, + mpPropCopyTable, + mnNumPropEntries, + mxComponentContext )); + + // push new size to view shape + maViewAppletShapes.back()->resize( getBounds() ); + + // render the Shape on the newly added ViewLayer + if( bRedrawLayer ) + maViewAppletShapes.back()->render( getBounds() ); + } + catch(uno::Exception&) + { + // ignore failed shapes - slideshow should run with + // the remaining content + } + } + + + bool AppletShape::removeViewLayer( const ViewLayerSharedPtr& rLayer ) + { + const ViewAppletShapeVector::iterator aEnd( maViewAppletShapes.end() ); + + OSL_ENSURE( ::std::count_if(maViewAppletShapes.begin(), + aEnd, + [&rLayer] + ( const ViewAppletShapeSharedPtr& pShape ) + { return rLayer == pShape->getViewLayer(); } ) < 2, + "AppletShape::removeViewLayer(): Duplicate ViewLayer entries!" ); + +// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase_if +#if defined ANDROID + ViewAppletShapeVector::iterator aIter; + + if( (aIter=::std::remove_if( maViewAppletShapes.begin(), + aEnd, + [&rLayer] + ( const ViewAppletShapeSharedPtr& pShape ) + { return rLayer == pShape->getViewLayer(); } ) ) == aEnd ) + { + // view layer seemingly was not added, failed + return false; + } + + // actually erase from container + maViewAppletShapes.erase( aIter, aEnd ); + + return true; +#else + size_t nb = std::erase_if(maViewAppletShapes, + [&rLayer] + ( const ViewAppletShapeSharedPtr& pShape ) + { return rLayer == pShape->getViewLayer(); } ); + // if nb == 0, it means view layer seemingly was not added, failed + return (nb != 0); +#endif + } + + + void AppletShape::clearAllViewLayers() + { + maViewAppletShapes.clear(); + } + + + bool AppletShape::implRender( const ::basegfx::B2DRange& rCurrBounds ) const + { + // redraw all view shapes, by calling their update() method + if( o3tl::make_unsigned(::std::count_if( maViewAppletShapes.begin(), + maViewAppletShapes.end(), + [&rCurrBounds] + ( const ViewAppletShapeSharedPtr& pShape ) + { return pShape->render( rCurrBounds ); } )) + != maViewAppletShapes.size() ) + { + // at least one of the ViewShape::update() calls did return + // false - update failed on at least one ViewLayer + return false; + } + + return true; + } + + + bool AppletShape::implStartIntrinsicAnimation() + { + const ::basegfx::B2DRectangle aBounds = getBounds(); + for( const auto& pViewAppletShape : maViewAppletShapes ) + pViewAppletShape->startApplet( aBounds ); + + mbIsPlaying = true; + + return true; + } + + + bool AppletShape::implEndIntrinsicAnimation() + { + for( const auto& pViewAppletShape : maViewAppletShapes ) + pViewAppletShape->endApplet(); + + mbIsPlaying = false; + + return true; + } + + + void AppletShape::implPauseIntrinsicAnimation() + { + // TODO(F1): any way of temporarily disabling/deactivating + // applets? + } + + + bool AppletShape::implIsIntrinsicAnimationPlaying() const + { + return mbIsPlaying; + } + + + void AppletShape::implSetIntrinsicAnimationTime(double) + { + // No way of doing this, or? + } + + std::shared_ptr createAppletShape( + const uno::Reference< drawing::XShape >& xShape, + double nPrio, + const OUString& rServiceName, + const char* const* pPropCopyTable, + std::size_t nNumPropEntries, + const SlideShowContext& rContext ) + { + return std::make_shared(xShape, + nPrio, + rServiceName, + pPropCopyTable, + nNumPropEntries, + rContext); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/slideshow/source/engine/shapes/appletshape.hxx b/slideshow/source/engine/shapes/appletshape.hxx new file mode 100644 index 000000000000..845be861c404 --- /dev/null +++ b/slideshow/source/engine/shapes/appletshape.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_APPLETSHAPE_HXX +#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_APPLETSHAPE_HXX + +#include +#include + +namespace com::sun::star::drawing { class XShape; } + +namespace slideshow::internal +{ + struct SlideShowContext; + class Shape; + + std::shared_ptr createAppletShape( + const css::uno::Reference< css::drawing::XShape >& xShape, + double nPrio, + const OUString& rServiceName, + const char* const* pPropCopyTable, + std::size_t nNumPropEntries, + const SlideShowContext& rContext ); +} + +#endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_APPLETSHAPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/slideshow/source/engine/shapes/externalshapebase.hxx b/slideshow/source/engine/shapes/externalshapebase.hxx index a5f1618f49ae..d8c208db2a99 100644 --- a/slideshow/source/engine/shapes/externalshapebase.hxx +++ b/slideshow/source/engine/shapes/externalshapebase.hxx @@ -29,8 +29,8 @@ namespace slideshow::internal { /** Base class for shapes rendered by external engines. - Used as the common base for e.g. MediaShape - all of which are rendered by external + Used as the common base for e.g. MediaShape or + AppletShape, all of which are rendered by external components (and all employ distinct windows). Please note that this base class indeed assumes the shape diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index 1fb33dbbc3ba..d73ffb161d77 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -37,6 +37,7 @@ #include "drawshape.hxx" #include "backgroundshape.hxx" #include "mediashape.hxx" +#include "appletshape.hxx" #include #include #include @@ -216,6 +217,26 @@ ShapeSharedPtr ShapeImporter::createShape( mnAscendingPrio, mrContext); } + else if( shapeType == u"com.sun.star.drawing.AppletShape" ) + { + // PropertyValues to copy from XShape to applet + static const char* const aPropertyValues[] = + { + "AppletCodeBase", + "AppletName", + "AppletCode", + "AppletCommands", + "AppletIsScript" + }; + + // (Java)Applet shape. This is a special object + return createAppletShape( xCurrShape, + mnAscendingPrio, + u"com.sun.star.comp.sfx2.AppletObject"_ustr, + aPropertyValues, + SAL_N_ELEMENTS(aPropertyValues), + mrContext ); + } else if( shapeType == u"com.sun.star.drawing.OLE2Shape" || shapeType == u"com.sun.star.presentation.OLE2Shape" ) { // #i46224# Mark OLE shapes as foreign content - scan them for diff --git a/slideshow/source/engine/shapes/viewappletshape.cxx b/slideshow/source/engine/shapes/viewappletshape.cxx new file mode 100644 index 000000000000..07322e43dfd7 --- /dev/null +++ b/slideshow/source/engine/shapes/viewappletshape.cxx @@ -0,0 +1,257 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "viewappletshape.hxx" +#include +#include + + +using namespace ::com::sun::star; + +namespace slideshow::internal +{ + ViewAppletShape::ViewAppletShape( ViewLayerSharedPtr xViewLayer, + const uno::Reference< drawing::XShape >& rxShape, + const OUString& rServiceName, + const char* const* pPropCopyTable, + std::size_t nNumPropEntries, + uno::Reference< uno::XComponentContext > xContext ) : + mpViewLayer(std::move( xViewLayer )), + mxViewer(), + mxFrame(), + mxComponentContext(std::move( xContext )) + { + ENSURE_OR_THROW( rxShape.is(), "ViewAppletShape::ViewAppletShape(): Invalid Shape" ); + ENSURE_OR_THROW( mpViewLayer, "ViewAppletShape::ViewAppletShape(): Invalid View" ); + ENSURE_OR_THROW( mpViewLayer->getCanvas(), "ViewAppletShape::ViewAppletShape(): Invalid ViewLayer canvas" ); + ENSURE_OR_THROW( mxComponentContext.is(), "ViewAppletShape::ViewAppletShape(): Invalid component context" ); + + uno::Reference xFactory( + mxComponentContext->getServiceManager(), + uno::UNO_SET_THROW ); + + mxViewer.set( xFactory->createInstanceWithContext( rServiceName, + mxComponentContext), + uno::UNO_QUERY_THROW ); + + uno::Reference< beans::XPropertySet > xShapePropSet( rxShape, + uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xViewerPropSet( mxViewer, + uno::UNO_QUERY_THROW ); + + // copy shape properties to applet viewer + OUString aPropName; + for( std::size_t i=0; isetPropertyValue( aPropName, + xShapePropSet->getPropertyValue( + aPropName )); + } + } + + ViewAppletShape::~ViewAppletShape() + { + try + { + endApplet(); + } + catch (const uno::Exception &) + { + TOOLS_WARN_EXCEPTION("slideshow", ""); + } + } + + const ViewLayerSharedPtr& ViewAppletShape::getViewLayer() const + { + return mpViewLayer; + } + + void ViewAppletShape::startApplet( const ::basegfx::B2DRectangle& rBounds ) + { + ENSURE_OR_RETURN_VOID( mpViewLayer && mpViewLayer->getCanvas() && mpViewLayer->getCanvas()->getUNOCanvas().is(), + "ViewAppletShape::startApplet(): Invalid or disposed view" ); + try + { + ::cppcanvas::CanvasSharedPtr pCanvas = mpViewLayer->getCanvas(); + + uno::Reference< beans::XPropertySet > xPropSet( pCanvas->getUNOCanvas()->getDevice(), + uno::UNO_QUERY_THROW ); + + uno::Reference< awt::XWindow2 > xParentWindow( + xPropSet->getPropertyValue(u"Window"_ustr), + uno::UNO_QUERY_THROW ); + + uno::Reference xFactory( + mxComponentContext->getServiceManager() ); + + if( xFactory.is() ) + { + // create an awt window to contain the applet + // ========================================== + + uno::Reference< awt::XToolkit2 > xToolkit = awt::Toolkit::create(mxComponentContext); + + awt::WindowDescriptor aOwnWinDescriptor( awt::WindowClass_SIMPLE, + OUString(), + uno::Reference< awt::XWindowPeer >(xParentWindow, + uno::UNO_QUERY_THROW), + 0, + awt::Rectangle(), + awt::WindowAttribute::SHOW + | awt::VclWindowPeerAttribute::CLIPCHILDREN ); + + uno::Reference< awt::XWindowPeer > xNewWinPeer( + xToolkit->createWindow( aOwnWinDescriptor )); + uno::Reference< awt::XWindow > xOwnWindow( xNewWinPeer, + uno::UNO_QUERY_THROW ); + + + // create a frame, and load the applet into it + // =========================================== + + mxFrame = frame::Frame::create( mxComponentContext ); + mxFrame->initialize( xOwnWindow ); + + uno::Reference < frame::XSynchronousFrameLoader > xLoader( mxViewer, + uno::UNO_SET_THROW ); + xLoader->load( uno::Sequence < beans::PropertyValue >(), + uno::Reference(mxFrame, uno::UNO_QUERY_THROW) ); + + + // resize surrounding window and applet to current shape size + // ========================================================== + + ::basegfx::B2DRange aTmpRange = ::canvastools::calcTransformedRectBounds( + rBounds, + mpViewLayer->getTransformation() ); + const ::basegfx::B2IRange aPixelBounds( + ::basegfx::unotools::b2ISurroundingRangeFromB2DRange( aTmpRange )); + + uno::Reference< awt::XWindow > xSurroundingWindow( mxFrame->getContainerWindow() ); + if( xSurroundingWindow.is() ) + xSurroundingWindow->setPosSize( aPixelBounds.getMinX(), + aPixelBounds.getMinY(), + static_cast(aPixelBounds.getWidth()), + static_cast(aPixelBounds.getHeight()), + awt::PosSize::POSSIZE ); + + uno::Reference< awt::XWindow > xAppletWindow( mxFrame->getComponentWindow() ); + if( xAppletWindow.is() ) + xAppletWindow->setPosSize( 0, 0, + static_cast(aPixelBounds.getWidth()), + static_cast(aPixelBounds.getHeight()), + awt::PosSize::POSSIZE ); + } + } + catch (uno::Exception &) + { + } + } + + + void ViewAppletShape::endApplet() + { + uno::Reference xCloseable( + mxFrame, + uno::UNO_QUERY ); + + if( xCloseable.is() ) + { + xCloseable->close( true ); + mxFrame.clear(); + } + } + + + bool ViewAppletShape::render( const ::basegfx::B2DRectangle& rBounds ) const + { + ::cppcanvas::CanvasSharedPtr pCanvas = mpViewLayer->getCanvas(); + + if( !pCanvas ) + return false; + + if( !mxFrame.is() ) + { + // fill the shape background with black + fillRect( pCanvas, + rBounds, + 0xFFFFFFFFU ); + } + + return true; + } + + bool ViewAppletShape::resize( const ::basegfx::B2DRectangle& rBounds ) const + { + if( !mxFrame.is() ) + return false; + + ::basegfx::B2DRange aTmpRange = ::canvastools::calcTransformedRectBounds( + rBounds, + mpViewLayer->getTransformation() ); + const ::basegfx::B2IRange aPixelBounds( + ::basegfx::unotools::b2ISurroundingRangeFromB2DRange( aTmpRange )); + + uno::Reference< awt::XWindow > xFrameWindow( mxFrame->getContainerWindow() ); + if( xFrameWindow.is() ) + xFrameWindow->setPosSize( aPixelBounds.getMinX(), + aPixelBounds.getMinY(), + static_cast(aPixelBounds.getWidth()), + static_cast(aPixelBounds.getHeight()), + awt::PosSize::POSSIZE ); + + uno::Reference< awt::XWindow > xAppletWindow( mxFrame->getComponentWindow() ); + if( xAppletWindow.is() ) + xAppletWindow->setPosSize( 0, 0, + static_cast(aPixelBounds.getWidth()), + static_cast(aPixelBounds.getHeight()), + awt::PosSize::POSSIZE ); + + return true; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/slideshow/source/engine/shapes/viewappletshape.hxx b/slideshow/source/engine/shapes/viewappletshape.hxx new file mode 100644 index 000000000000..651cf0a5abbd --- /dev/null +++ b/slideshow/source/engine/shapes/viewappletshape.hxx @@ -0,0 +1,164 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_VIEWAPPLETSHAPE_HXX +#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_VIEWAPPLETSHAPE_HXX + +#include +#include + +#include + +#include + +namespace com::sun::star { + namespace frame { + class XSynchronousFrameLoader; + class XFrame2; + } + namespace uno { + class XComponentContext; + } + namespace drawing { + class XShape; + } +} + +namespace slideshow +{ + namespace internal + { + /** This class is the viewable representation of a draw + document's applet object, associated to a specific View + + The class is able to render the associated applet on View + implementations. + */ + class ViewAppletShape final + { + public: + /** Create a ViewAppletShape for the given View + + @param rViewLayer + The associated View object. + + @param rxShape + The associated Shape + + @param rServiceName + The service name to use, when actually creating the + viewer component + + @param pPropCopyTable + Table of plain ASCII property names, to copy from + xShape to applet. + + @param nNumPropEntries + Number of property table entries (in pPropCopyTable) + */ + ViewAppletShape( ViewLayerSharedPtr xViewLayer, + const css::uno::Reference< css::drawing::XShape >& rxShape, + const OUString& rServiceName, + const char* const* pPropCopyTable, + std::size_t nNumPropEntries, + css::uno::Reference< css::uno::XComponentContext > xContext ); + + /** destroy the object + */ + ~ViewAppletShape(); + + /// Forbid copy construction + ViewAppletShape(const ViewAppletShape&) = delete; + /// Forbid copy assignment + ViewAppletShape& operator=(const ViewAppletShape&) = delete; + + /** Query the associated view layer of this shape + */ + const ViewLayerSharedPtr& getViewLayer() const; + + // animation methods + + + /** Notify the ViewShape that an animation starts now + + This method enters animation mode on the associate + target view. The shape can be animated in parallel on + different views. + + @param rBounds + The current applet shape bounds + */ + void startApplet( const ::basegfx::B2DRectangle& rBounds ); + + /** Notify the ViewShape that it is no longer animated + + This methods ends animation mode on the associate + target view + */ + void endApplet(); + + // render methods + + + /** Render the ViewShape + + This method renders the ViewAppletShape on the associated view. + + @param rBounds + The current applet shape bounds + + @return whether the rendering finished successfully. + */ + bool render( const ::basegfx::B2DRectangle& rBounds ) const; + + /** Resize the ViewShape + + This method resizes the ViewAppletShape on the + associated view. It does not render. + + @param rBounds + The current applet shape bounds + + @return whether the resize finished successfully. + */ + bool resize( const ::basegfx::B2DRectangle& rBounds ) const; + + private: + + ViewLayerSharedPtr mpViewLayer; + + /// the actual viewer component for this applet + css::uno::Reference< + css::frame::XSynchronousFrameLoader> mxViewer; + + /// the frame containing the applet + css::uno::Reference< + css::frame::XFrame2> mxFrame; + css::uno::Reference< + css::uno::XComponentContext> mxComponentContext; + }; + + typedef ::std::shared_ptr< ViewAppletShape > ViewAppletShapeSharedPtr; + + } +} + +#endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_VIEWAPPLETSHAPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 7bb02470f4cb..28b05438b936 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -10280,6 +10280,8 @@ slideshow/source/engine/rehearsetimingsactivity.cxx slideshow/source/engine/rehearsetimingsactivity.hxx slideshow/source/engine/screenupdater.cxx slideshow/source/engine/shapeattributelayer.cxx +slideshow/source/engine/shapes/appletshape.cxx +slideshow/source/engine/shapes/appletshape.hxx slideshow/source/engine/shapes/backgroundshape.cxx slideshow/source/engine/shapes/backgroundshape.hxx slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -10297,6 +10299,8 @@ slideshow/source/engine/shapes/intrinsicanimationactivity.hxx slideshow/source/engine/shapes/mediashape.cxx slideshow/source/engine/shapes/mediashape.hxx slideshow/source/engine/shapes/shapeimporter.cxx +slideshow/source/engine/shapes/viewappletshape.cxx +slideshow/source/engine/shapes/viewappletshape.hxx slideshow/source/engine/shapes/viewbackgroundshape.cxx slideshow/source/engine/shapes/viewbackgroundshape.hxx slideshow/source/engine/shapes/viewmediashape.cxx