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(
|
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") )
|
if( xAnimateNode->getAttributeName().equalsIgnoreAsciiCase("visibility") )
|
||||||
{
|
{
|
||||||
|
bool bVisible( false );
|
||||||
css::uno::Any aAny( xAnimateNode->getTo() );
|
css::uno::Any aAny( xAnimateNode->getTo() );
|
||||||
|
|
||||||
// try to extract bool value
|
// 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"\"group\": \"DrawPage\"") >= 0);
|
||||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 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\": \"animated\"") >= 0);
|
||||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 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"\"group\": \"DrawPage\"") >= 0);
|
||||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 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\": \"animated\"") >= 0);
|
||||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <sddllapi.h>
|
|
||||||
#include <tools/gen.hxx>
|
|
||||||
#include <rtl/string.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 <deque>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
@ -103,6 +107,29 @@ struct RenderState
|
||||||
{
|
{
|
||||||
return maInAnimation.find(pObject) != maInAnimation.end();
|
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 */
|
/** Renders a slide */
|
||||||
|
|
|
@ -12,14 +12,12 @@
|
||||||
#include <svx/svdpage.hxx>
|
#include <svx/svdpage.hxx>
|
||||||
#include <svx/svdmodel.hxx>
|
#include <svx/svdmodel.hxx>
|
||||||
#include <svx/svdview.hxx>
|
#include <svx/svdview.hxx>
|
||||||
#include <svx/unoapi.hxx>
|
|
||||||
#include <svx/sdr/contact/viewobjectcontact.hxx>
|
#include <svx/sdr/contact/viewobjectcontact.hxx>
|
||||||
#include <svx/sdr/contact/viewcontact.hxx>
|
#include <svx/sdr/contact/viewcontact.hxx>
|
||||||
#include <svx/sdr/contact/objectcontact.hxx>
|
#include <svx/sdr/contact/objectcontact.hxx>
|
||||||
#include <svx/svdoutl.hxx>
|
#include <svx/svdoutl.hxx>
|
||||||
#include <svx/svdpagv.hxx>
|
#include <svx/svdpagv.hxx>
|
||||||
#include <vcl/virdev.hxx>
|
#include <vcl/virdev.hxx>
|
||||||
#include <tools/helpers.hxx>
|
|
||||||
#include <tools/json_writer.hxx>
|
#include <tools/json_writer.hxx>
|
||||||
#include <editeng/editeng.hxx>
|
#include <editeng/editeng.hxx>
|
||||||
|
|
||||||
|
@ -115,6 +113,7 @@ public:
|
||||||
const sdr::contact::DisplayInfo& rDisplayInfo,
|
const sdr::contact::DisplayInfo& rDisplayInfo,
|
||||||
drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) override
|
drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) override
|
||||||
{
|
{
|
||||||
|
// Generate single pass for background layer
|
||||||
if (mrRenderState.meStage == RenderStage::Background)
|
if (mrRenderState.meStage == RenderStage::Background)
|
||||||
{
|
{
|
||||||
mrRenderState.mbPassHasOutput = true;
|
mrRenderState.mbPassHasOutput = true;
|
||||||
|
@ -165,9 +164,11 @@ public:
|
||||||
|
|
||||||
if (mrRenderState.isObjectInAnimation(pObject))
|
if (mrRenderState.isObjectInAnimation(pObject))
|
||||||
{
|
{
|
||||||
|
// Animated object cannot be attached to the previous object
|
||||||
if (!mrRenderState.mbFirstObjectInPass)
|
if (!mrRenderState.mbFirstObjectInPass)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Animated object has to be only one in the render
|
||||||
mrRenderState.mbSkipAllInThisPass = true;
|
mrRenderState.mbSkipAllInThisPass = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,14 +279,17 @@ void SlideshowLayerRenderer::setupAnimations()
|
||||||
|
|
||||||
if (pObject)
|
if (pObject)
|
||||||
{
|
{
|
||||||
bool bVisible = anim::getVisibilityProperty(xAnimate);
|
bool bVisible;
|
||||||
|
|
||||||
// if initial anim sets shape visible, set it
|
if (anim::getVisibilityProperty(xAnimate, bVisible))
|
||||||
// to invisible. If we're asked for the final
|
{
|
||||||
// state, don't do anything obviously
|
// if initial anim sets shape visible, set it
|
||||||
bVisible = !bVisible;
|
// 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("index", maRenderState.currentIndex());
|
||||||
aJsonWriter.put("slideHash", GetInterfaceHash(GetXDrawPageForSdrPage(&mrPage)));
|
aJsonWriter.put("slideHash", GetInterfaceHash(GetXDrawPageForSdrPage(&mrPage)));
|
||||||
|
|
||||||
bool bIsAnimation = false;
|
|
||||||
SdrObject* pObject = maRenderState.currentTarget();
|
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);
|
bool bIsAnimated = maRenderState.isObjectInAnimation(pObject);
|
||||||
if (pSdPage)
|
if (bIsAnimated)
|
||||||
{
|
|
||||||
std::shared_ptr<sd::MainSequence> pMainSequence(pSdPage->getMainSequence());
|
|
||||||
if (pMainSequence && pMainSequence->hasEffect(xShape))
|
|
||||||
bIsAnimation = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bIsAnimation)
|
|
||||||
{
|
{
|
||||||
|
assert(pObject);
|
||||||
aJsonWriter.put("type", "animated");
|
aJsonWriter.put("type", "animated");
|
||||||
{
|
{
|
||||||
auto aContentNode = aJsonWriter.startNode("content");
|
auto aContentNode = aJsonWriter.startNode("content");
|
||||||
|
aJsonWriter.put("hash", RenderState::getObjectHash(pObject));
|
||||||
if (xShape.is())
|
aJsonWriter.put("initVisible", maRenderState.isObjectInitiallyVisible(pObject));
|
||||||
{
|
|
||||||
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("type", "bitmap");
|
aJsonWriter.put("type", "bitmap");
|
||||||
writeContentNode(aJsonWriter);
|
writeContentNode(aJsonWriter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,8 @@ namespace slideshow::internal
|
||||||
// initially. This is currently the only place
|
// initially. This is currently the only place
|
||||||
// where a shape effect influences shape
|
// where a shape effect influences shape
|
||||||
// attributes outside it's effective duration.
|
// 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
|
// if initial anim sets shape visible, set it
|
||||||
// to invisible. If we're asked for the final
|
// to invisible. If we're asked for the final
|
||||||
|
|
Loading…
Reference in a new issue