slideshow: fix initVisible value
be sure we don't overwrite the real "visibility" value when other property is read Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: Ied2285e8183665b5b48d10d74e1cc052cf8edcbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173110 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177235
This commit is contained in:
parent
dfb779ff76
commit
4ffd7c1456
5 changed files with 55 additions and 48 deletions
|
@ -74,12 +74,11 @@ namespace anim
|
|||
}
|
||||
|
||||
inline bool getVisibilityProperty(
|
||||
const css::uno::Reference< css::animations::XAnimate >& xAnimateNode)
|
||||
const css::uno::Reference< css::animations::XAnimate >& xAnimateNode, bool& bReturn)
|
||||
{
|
||||
bool bVisible( false );
|
||||
if( xAnimateNode->getAttributeName().equalsIgnoreAsciiCase("visibility") )
|
||||
{
|
||||
|
||||
bool bVisible( false );
|
||||
css::uno::Any aAny( xAnimateNode->getTo() );
|
||||
|
||||
// try to extract bool value
|
||||
|
@ -103,9 +102,11 @@ namespace anim
|
|||
}
|
||||
}
|
||||
}
|
||||
bReturn = bVisible;
|
||||
return true;
|
||||
}
|
||||
|
||||
return bVisible;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3146,7 +3146,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
|
|||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
|
||||
|
@ -3178,7 +3178,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
|
|||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
|
||||
|
|
|
@ -9,9 +9,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <sddllapi.h>
|
||||
#include <tools/gen.hxx>
|
||||
#include <rtl/string.hxx>
|
||||
#include <sal/log.hxx>
|
||||
#include <sddllapi.h>
|
||||
#include <svx/unoapi.hxx>
|
||||
#include <tools/gen.hxx>
|
||||
#include <tools/helpers.hxx>
|
||||
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
|
@ -103,6 +107,29 @@ struct RenderState
|
|||
{
|
||||
return maInAnimation.find(pObject) != maInAnimation.end();
|
||||
}
|
||||
|
||||
bool isObjectInitiallyVisible(SdrObject* pObject) const
|
||||
{
|
||||
bool bInitiallyVisible = true;
|
||||
if (maInitiallyVisible.contains(pObject))
|
||||
bInitiallyVisible = maInitiallyVisible.at(pObject);
|
||||
return bInitiallyVisible;
|
||||
}
|
||||
|
||||
static std::string getObjectHash(SdrObject* pObject)
|
||||
{
|
||||
css::uno::Reference<css::drawing::XShape> xShape = GetXShapeForSdrObject(pObject);
|
||||
if (xShape.is())
|
||||
{
|
||||
css::uno::Reference<css::uno::XInterface> xRef;
|
||||
css::uno::Any(xShape) >>= xRef;
|
||||
if (xRef.is())
|
||||
return GetInterfaceHash(xRef);
|
||||
}
|
||||
|
||||
SAL_WARN("sd", "RenderState::getObjectHash: failed");
|
||||
return std::string();
|
||||
}
|
||||
};
|
||||
|
||||
/** Renders a slide */
|
||||
|
|
|
@ -12,14 +12,12 @@
|
|||
#include <svx/svdpage.hxx>
|
||||
#include <svx/svdmodel.hxx>
|
||||
#include <svx/svdview.hxx>
|
||||
#include <svx/unoapi.hxx>
|
||||
#include <svx/sdr/contact/viewobjectcontact.hxx>
|
||||
#include <svx/sdr/contact/viewcontact.hxx>
|
||||
#include <svx/sdr/contact/objectcontact.hxx>
|
||||
#include <svx/svdoutl.hxx>
|
||||
#include <svx/svdpagv.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <tools/helpers.hxx>
|
||||
#include <tools/json_writer.hxx>
|
||||
#include <editeng/editeng.hxx>
|
||||
|
||||
|
@ -115,6 +113,7 @@ public:
|
|||
const sdr::contact::DisplayInfo& rDisplayInfo,
|
||||
drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) override
|
||||
{
|
||||
// Generate single pass for background layer
|
||||
if (mrRenderState.meStage == RenderStage::Background)
|
||||
{
|
||||
mrRenderState.mbPassHasOutput = true;
|
||||
|
@ -165,9 +164,11 @@ public:
|
|||
|
||||
if (mrRenderState.isObjectInAnimation(pObject))
|
||||
{
|
||||
// Animated object cannot be attached to the previous object
|
||||
if (!mrRenderState.mbFirstObjectInPass)
|
||||
return;
|
||||
|
||||
// Animated object has to be only one in the render
|
||||
mrRenderState.mbSkipAllInThisPass = true;
|
||||
}
|
||||
|
||||
|
@ -278,14 +279,17 @@ void SlideshowLayerRenderer::setupAnimations()
|
|||
|
||||
if (pObject)
|
||||
{
|
||||
bool bVisible = anim::getVisibilityProperty(xAnimate);
|
||||
bool bVisible;
|
||||
|
||||
// if initial anim sets shape visible, set it
|
||||
// to invisible. If we're asked for the final
|
||||
// state, don't do anything obviously
|
||||
bVisible = !bVisible;
|
||||
if (anim::getVisibilityProperty(xAnimate, bVisible))
|
||||
{
|
||||
// if initial anim sets shape visible, set it
|
||||
// to invisible. If we're asked for the final
|
||||
// state, don't do anything obviously
|
||||
bVisible = !bVisible;
|
||||
|
||||
maRenderState.maInitiallyVisible[pObject] = bVisible;
|
||||
maRenderState.maInitiallyVisible[pObject] = bVisible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,43 +341,17 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg)
|
|||
aJsonWriter.put("index", maRenderState.currentIndex());
|
||||
aJsonWriter.put("slideHash", GetInterfaceHash(GetXDrawPageForSdrPage(&mrPage)));
|
||||
|
||||
bool bIsAnimation = false;
|
||||
SdrObject* pObject = maRenderState.currentTarget();
|
||||
com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xShape;
|
||||
if (pObject)
|
||||
{
|
||||
xShape = GetXShapeForSdrObject(pObject);
|
||||
|
||||
auto* pSdPage = dynamic_cast<SdPage*>(&mrPage);
|
||||
if (pSdPage)
|
||||
{
|
||||
std::shared_ptr<sd::MainSequence> pMainSequence(pSdPage->getMainSequence());
|
||||
if (pMainSequence && pMainSequence->hasEffect(xShape))
|
||||
bIsAnimation = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsAnimation)
|
||||
bool bIsAnimated = maRenderState.isObjectInAnimation(pObject);
|
||||
if (bIsAnimated)
|
||||
{
|
||||
assert(pObject);
|
||||
aJsonWriter.put("type", "animated");
|
||||
{
|
||||
auto aContentNode = aJsonWriter.startNode("content");
|
||||
|
||||
if (xShape.is())
|
||||
{
|
||||
com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xRef;
|
||||
com::sun::star::uno::Any(xShape) >>= xRef;
|
||||
if (xRef.is())
|
||||
{
|
||||
aJsonWriter.put("hash", GetInterfaceHash(xRef));
|
||||
|
||||
bool bInitiallyVisible = true;
|
||||
if (maRenderState.maInitiallyVisible.contains(pObject))
|
||||
bInitiallyVisible = maRenderState.maInitiallyVisible[pObject];
|
||||
aJsonWriter.put("initVisible", bInitiallyVisible);
|
||||
}
|
||||
}
|
||||
|
||||
aJsonWriter.put("hash", RenderState::getObjectHash(pObject));
|
||||
aJsonWriter.put("initVisible", maRenderState.isObjectInitiallyVisible(pObject));
|
||||
aJsonWriter.put("type", "bitmap");
|
||||
writeContentNode(aJsonWriter);
|
||||
}
|
||||
|
|
|
@ -258,7 +258,8 @@ namespace slideshow::internal
|
|||
// initially. This is currently the only place
|
||||
// where a shape effect influences shape
|
||||
// attributes outside it's effective duration.
|
||||
bool bVisible = anim::getVisibilityProperty(xAnimateNode);
|
||||
bool bVisible = false;
|
||||
anim::getVisibilityProperty(xAnimateNode, bVisible);
|
||||
|
||||
// if initial anim sets shape visible, set it
|
||||
// to invisible. If we're asked for the final
|
||||
|
|
Loading…
Reference in a new issue