Unindent.
Change-Id: I875bdf1eb6df37b07dd19c6a7ff5ba5eb3b8a096
This commit is contained in:
@@ -41,409 +41,406 @@
|
|||||||
|
|
||||||
using namespace com::sun::star;
|
using namespace com::sun::star;
|
||||||
|
|
||||||
namespace
|
namespace {
|
||||||
|
|
||||||
|
// animated extractor
|
||||||
|
|
||||||
|
// Necessary to filter a sequence of animated primitives from
|
||||||
|
// a sequence of primitives to find out if animated or not. The decision for
|
||||||
|
// what to decompose is hard-coded and only done for knowingly animated primitives
|
||||||
|
// to not decompose too deeply and unnecessarily. This implies that the list
|
||||||
|
// which is view-specific needs to be expanded by hand when new animated objects
|
||||||
|
// are added. This may eventually be changed to a dynamically configurable approach
|
||||||
|
// if necessary.
|
||||||
|
class AnimatedExtractingProcessor2D : public drawinglayer::processor2d::BaseProcessor2D
|
||||||
{
|
{
|
||||||
// animated extractor
|
protected:
|
||||||
|
// the found animated primitives
|
||||||
|
drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence;
|
||||||
|
|
||||||
// Necessary to filter a sequence of animated primitives from
|
// bitfield
|
||||||
// a sequence of primitives to find out if animated or not. The decision for
|
// text animation allowed?
|
||||||
// what to decompose is hard-coded and only done for knowingly animated primitives
|
bool mbTextAnimationAllowed : 1;
|
||||||
// to not decompose too deeply and unnecessarily. This implies that the list
|
|
||||||
// which is view-specific needs to be expanded by hand when new animated objects
|
|
||||||
// are added. This may eventually be changed to a dynamically configurable approach
|
|
||||||
// if necessary.
|
|
||||||
class AnimatedExtractingProcessor2D : public drawinglayer::processor2d::BaseProcessor2D
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
// the found animated primitives
|
|
||||||
drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence;
|
|
||||||
|
|
||||||
// bitfield
|
// graphic animation allowed?
|
||||||
// text animation allowed?
|
bool mbGraphicAnimationAllowed : 1;
|
||||||
bool mbTextAnimationAllowed : 1;
|
|
||||||
|
|
||||||
// graphic animation allowed?
|
// as tooling, the process() implementation takes over API handling and calls this
|
||||||
bool mbGraphicAnimationAllowed : 1;
|
// virtual render method when the primitive implementation is BasePrimitive2D-based.
|
||||||
|
virtual void processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D& rCandidate) SAL_OVERRIDE;
|
||||||
|
|
||||||
// as tooling, the process() implementation takes over API handling and calls this
|
public:
|
||||||
// virtual render method when the primitive implementation is BasePrimitive2D-based.
|
AnimatedExtractingProcessor2D(
|
||||||
virtual void processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D& rCandidate) SAL_OVERRIDE;
|
|
||||||
|
|
||||||
public:
|
|
||||||
AnimatedExtractingProcessor2D(
|
|
||||||
const drawinglayer::geometry::ViewInformation2D& rViewInformation,
|
|
||||||
bool bTextAnimationAllowed,
|
|
||||||
bool bGraphicAnimationAllowed);
|
|
||||||
virtual ~AnimatedExtractingProcessor2D();
|
|
||||||
|
|
||||||
// data access
|
|
||||||
const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
|
|
||||||
bool isTextAnimationAllowed() const { return mbTextAnimationAllowed; }
|
|
||||||
bool isGraphicAnimationAllowed() const { return mbGraphicAnimationAllowed; }
|
|
||||||
};
|
|
||||||
|
|
||||||
AnimatedExtractingProcessor2D::AnimatedExtractingProcessor2D(
|
|
||||||
const drawinglayer::geometry::ViewInformation2D& rViewInformation,
|
const drawinglayer::geometry::ViewInformation2D& rViewInformation,
|
||||||
bool bTextAnimationAllowed,
|
bool bTextAnimationAllowed,
|
||||||
bool bGraphicAnimationAllowed)
|
bool bGraphicAnimationAllowed);
|
||||||
: drawinglayer::processor2d::BaseProcessor2D(rViewInformation),
|
virtual ~AnimatedExtractingProcessor2D();
|
||||||
maPrimitive2DSequence(),
|
|
||||||
mbTextAnimationAllowed(bTextAnimationAllowed),
|
|
||||||
mbGraphicAnimationAllowed(bGraphicAnimationAllowed)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
AnimatedExtractingProcessor2D::~AnimatedExtractingProcessor2D()
|
// data access
|
||||||
{
|
const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
|
||||||
}
|
bool isTextAnimationAllowed() const { return mbTextAnimationAllowed; }
|
||||||
|
bool isGraphicAnimationAllowed() const { return mbGraphicAnimationAllowed; }
|
||||||
|
};
|
||||||
|
|
||||||
void AnimatedExtractingProcessor2D::processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D& rCandidate)
|
AnimatedExtractingProcessor2D::AnimatedExtractingProcessor2D(
|
||||||
|
const drawinglayer::geometry::ViewInformation2D& rViewInformation,
|
||||||
|
bool bTextAnimationAllowed,
|
||||||
|
bool bGraphicAnimationAllowed)
|
||||||
|
: drawinglayer::processor2d::BaseProcessor2D(rViewInformation),
|
||||||
|
maPrimitive2DSequence(),
|
||||||
|
mbTextAnimationAllowed(bTextAnimationAllowed),
|
||||||
|
mbGraphicAnimationAllowed(bGraphicAnimationAllowed)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimatedExtractingProcessor2D::~AnimatedExtractingProcessor2D()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimatedExtractingProcessor2D::processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D& rCandidate)
|
||||||
|
{
|
||||||
|
// known implementation, access directly
|
||||||
|
switch(rCandidate.getPrimitive2DID())
|
||||||
{
|
{
|
||||||
// known implementation, access directly
|
// add and accept animated primitives directly, no need to decompose
|
||||||
switch(rCandidate.getPrimitive2DID())
|
case PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D :
|
||||||
|
case PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D :
|
||||||
|
case PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D :
|
||||||
{
|
{
|
||||||
// add and accept animated primitives directly, no need to decompose
|
const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D& rSwitchPrimitive = static_cast< const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D& >(rCandidate);
|
||||||
case PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D :
|
|
||||||
case PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D :
|
if((rSwitchPrimitive.isTextAnimation() && isTextAnimationAllowed())
|
||||||
case PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D :
|
|| (rSwitchPrimitive.isGraphicAnimation() && isGraphicAnimationAllowed()))
|
||||||
{
|
{
|
||||||
const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D& rSwitchPrimitive = static_cast< const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D& >(rCandidate);
|
const drawinglayer::primitive2d::Primitive2DReference xReference(const_cast< drawinglayer::primitive2d::BasePrimitive2D* >(&rCandidate));
|
||||||
|
drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, xReference);
|
||||||
if((rSwitchPrimitive.isTextAnimation() && isTextAnimationAllowed())
|
|
||||||
|| (rSwitchPrimitive.isGraphicAnimation() && isGraphicAnimationAllowed()))
|
|
||||||
{
|
|
||||||
const drawinglayer::primitive2d::Primitive2DReference xReference(const_cast< drawinglayer::primitive2d::BasePrimitive2D* >(&rCandidate));
|
|
||||||
drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, xReference);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// decompose animated gifs where SdrGrafPrimitive2D produces a GraphicPrimitive2D
|
// decompose animated gifs where SdrGrafPrimitive2D produces a GraphicPrimitive2D
|
||||||
// which then produces the animation infos (all when used/needed)
|
// which then produces the animation infos (all when used/needed)
|
||||||
case PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D :
|
case PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D :
|
||||||
case PRIMITIVE2D_ID_GRAPHICPRIMITIVE2D :
|
case PRIMITIVE2D_ID_GRAPHICPRIMITIVE2D :
|
||||||
|
|
||||||
// decompose SdrObjects with evtl. animated text
|
// decompose SdrObjects with evtl. animated text
|
||||||
case PRIMITIVE2D_ID_SDRCAPTIONPRIMITIVE2D :
|
case PRIMITIVE2D_ID_SDRCAPTIONPRIMITIVE2D :
|
||||||
case PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D :
|
case PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D :
|
||||||
case PRIMITIVE2D_ID_SDRCUSTOMSHAPEPRIMITIVE2D :
|
case PRIMITIVE2D_ID_SDRCUSTOMSHAPEPRIMITIVE2D :
|
||||||
case PRIMITIVE2D_ID_SDRELLIPSEPRIMITIVE2D :
|
case PRIMITIVE2D_ID_SDRELLIPSEPRIMITIVE2D :
|
||||||
case PRIMITIVE2D_ID_SDRELLIPSESEGMENTPRIMITIVE2D :
|
case PRIMITIVE2D_ID_SDRELLIPSESEGMENTPRIMITIVE2D :
|
||||||
case PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D :
|
case PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D :
|
||||||
case PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D :
|
case PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D :
|
||||||
case PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D :
|
case PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D :
|
||||||
|
|
||||||
// #121194# With Graphic as Bitmap FillStyle, also check
|
// #121194# With Graphic as Bitmap FillStyle, also check
|
||||||
// for primitives filled with animated graphics
|
// for primitives filled with animated graphics
|
||||||
case PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D:
|
case PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D:
|
||||||
case PRIMITIVE2D_ID_FILLGRAPHICPRIMITIVE2D:
|
case PRIMITIVE2D_ID_FILLGRAPHICPRIMITIVE2D:
|
||||||
case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D:
|
case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D:
|
||||||
|
|
||||||
// decompose evtl. animated text contained in MaskPrimitive2D
|
// decompose evtl. animated text contained in MaskPrimitive2D
|
||||||
// or group rimitives
|
// or group rimitives
|
||||||
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
|
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
|
||||||
case PRIMITIVE2D_ID_GROUPPRIMITIVE2D :
|
case PRIMITIVE2D_ID_GROUPPRIMITIVE2D :
|
||||||
{
|
{
|
||||||
process(rCandidate.get2DDecomposition(getViewInformation2D()));
|
process(rCandidate.get2DDecomposition(getViewInformation2D()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
// nothing to do for the rest
|
// nothing to do for the rest
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
|
|
||||||
|
namespace sdr { namespace contact {
|
||||||
|
|
||||||
|
ViewObjectContact::ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact)
|
||||||
namespace sdr
|
: mrObjectContact(rObjectContact),
|
||||||
|
mrViewContact(rViewContact),
|
||||||
|
maObjectRange(),
|
||||||
|
mxPrimitive2DSequence(),
|
||||||
|
mpPrimitiveAnimation(0),
|
||||||
|
mbLazyInvalidate(false)
|
||||||
{
|
{
|
||||||
namespace contact
|
// make the ViewContact remember me
|
||||||
|
mrViewContact.AddViewObjectContact(*this);
|
||||||
|
|
||||||
|
// make the ObjectContact remember me
|
||||||
|
mrObjectContact.AddViewObjectContact(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewObjectContact::~ViewObjectContact()
|
||||||
|
{
|
||||||
|
// invalidate in view
|
||||||
|
if(!maObjectRange.isEmpty())
|
||||||
{
|
{
|
||||||
ViewObjectContact::ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact)
|
GetObjectContact().InvalidatePartOfView(maObjectRange);
|
||||||
: mrObjectContact(rObjectContact),
|
}
|
||||||
mrViewContact(rViewContact),
|
|
||||||
maObjectRange(),
|
|
||||||
mxPrimitive2DSequence(),
|
|
||||||
mpPrimitiveAnimation(0),
|
|
||||||
mbLazyInvalidate(false)
|
|
||||||
{
|
|
||||||
// make the ViewContact remember me
|
|
||||||
mrViewContact.AddViewObjectContact(*this);
|
|
||||||
|
|
||||||
// make the ObjectContact remember me
|
// delete PrimitiveAnimation
|
||||||
mrObjectContact.AddViewObjectContact(*this);
|
if(mpPrimitiveAnimation)
|
||||||
|
{
|
||||||
|
delete mpPrimitiveAnimation;
|
||||||
|
mpPrimitiveAnimation = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// take care of remembered ObjectContact. Remove from
|
||||||
|
// OC first. The VC removal (below) CAN trigger a StopGettingViewed()
|
||||||
|
// which (depending of it's implementation) may destroy other OCs. This
|
||||||
|
// can trigger the deletion of the helper OC of a page visualising object
|
||||||
|
// which IS the OC of this object. Eventually StopGettingViewed() needs
|
||||||
|
// to get asynchron later
|
||||||
|
GetObjectContact().RemoveViewObjectContact(*this);
|
||||||
|
|
||||||
|
// take care of remembered ViewContact
|
||||||
|
GetViewContact().RemoveViewObjectContact(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const basegfx::B2DRange& ViewObjectContact::getObjectRange() const
|
||||||
|
{
|
||||||
|
if(maObjectRange.isEmpty())
|
||||||
|
{
|
||||||
|
// if range is not computed (new or LazyInvalidate objects), force it
|
||||||
|
const DisplayInfo aDisplayInfo;
|
||||||
|
const drawinglayer::primitive2d::Primitive2DSequence xSequence(getPrimitive2DSequence(aDisplayInfo));
|
||||||
|
|
||||||
|
if(xSequence.hasElements())
|
||||||
|
{
|
||||||
|
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
|
||||||
|
const_cast< ViewObjectContact* >(this)->maObjectRange =
|
||||||
|
drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xSequence, rViewInformation2D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return maObjectRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewObjectContact::ActionChanged()
|
||||||
|
{
|
||||||
|
if(!mbLazyInvalidate)
|
||||||
|
{
|
||||||
|
// set local flag
|
||||||
|
mbLazyInvalidate = true;
|
||||||
|
|
||||||
|
// force ObjectRange
|
||||||
|
getObjectRange();
|
||||||
|
|
||||||
|
if(!maObjectRange.isEmpty())
|
||||||
|
{
|
||||||
|
// invalidate current valid range
|
||||||
|
GetObjectContact().InvalidatePartOfView(maObjectRange);
|
||||||
|
|
||||||
|
// reset ObjectRange, it needs to be recalculated
|
||||||
|
maObjectRange.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewObjectContact::~ViewObjectContact()
|
// register at OC for lazy invalidate
|
||||||
{
|
GetObjectContact().setLazyInvalidate(*this);
|
||||||
// invalidate in view
|
}
|
||||||
if(!maObjectRange.isEmpty())
|
}
|
||||||
{
|
|
||||||
GetObjectContact().InvalidatePartOfView(maObjectRange);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete PrimitiveAnimation
|
void ViewObjectContact::triggerLazyInvalidate()
|
||||||
if(mpPrimitiveAnimation)
|
{
|
||||||
{
|
if(mbLazyInvalidate)
|
||||||
delete mpPrimitiveAnimation;
|
{
|
||||||
mpPrimitiveAnimation = 0;
|
// reset flag
|
||||||
}
|
mbLazyInvalidate = false;
|
||||||
|
|
||||||
// take care of remembered ObjectContact. Remove from
|
|
||||||
// OC first. The VC removal (below) CAN trigger a StopGettingViewed()
|
|
||||||
// which (depending of it's implementation) may destroy other OCs. This
|
|
||||||
// can trigger the deletion of the helper OC of a page visualising object
|
|
||||||
// which IS the OC of this object. Eventually StopGettingViewed() needs
|
|
||||||
// to get asynchron later
|
|
||||||
GetObjectContact().RemoveViewObjectContact(*this);
|
|
||||||
|
|
||||||
// take care of remembered ViewContact
|
|
||||||
GetViewContact().RemoveViewObjectContact(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
const basegfx::B2DRange& ViewObjectContact::getObjectRange() const
|
|
||||||
{
|
|
||||||
if(maObjectRange.isEmpty())
|
|
||||||
{
|
|
||||||
// if range is not computed (new or LazyInvalidate objects), force it
|
|
||||||
const DisplayInfo aDisplayInfo;
|
|
||||||
const drawinglayer::primitive2d::Primitive2DSequence xSequence(getPrimitive2DSequence(aDisplayInfo));
|
|
||||||
|
|
||||||
if(xSequence.hasElements())
|
|
||||||
{
|
|
||||||
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
|
|
||||||
const_cast< ViewObjectContact* >(this)->maObjectRange =
|
|
||||||
drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xSequence, rViewInformation2D);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return maObjectRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewObjectContact::ActionChanged()
|
|
||||||
{
|
|
||||||
if(!mbLazyInvalidate)
|
|
||||||
{
|
|
||||||
// set local flag
|
|
||||||
mbLazyInvalidate = true;
|
|
||||||
|
|
||||||
// force ObjectRange
|
|
||||||
getObjectRange();
|
|
||||||
|
|
||||||
if(!maObjectRange.isEmpty())
|
|
||||||
{
|
|
||||||
// invalidate current valid range
|
|
||||||
GetObjectContact().InvalidatePartOfView(maObjectRange);
|
|
||||||
|
|
||||||
// reset ObjectRange, it needs to be recalculated
|
|
||||||
maObjectRange.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
// register at OC for lazy invalidate
|
|
||||||
GetObjectContact().setLazyInvalidate(*this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewObjectContact::triggerLazyInvalidate()
|
|
||||||
{
|
|
||||||
if(mbLazyInvalidate)
|
|
||||||
{
|
|
||||||
// reset flag
|
|
||||||
mbLazyInvalidate = false;
|
|
||||||
|
|
||||||
#if HAVE_FEATURE_DESKTOP
|
#if HAVE_FEATURE_DESKTOP
|
||||||
// 3D charts need to be notified separately, they are not to be
|
// 3D charts need to be notified separately, they are not to be
|
||||||
// drawn by the drawinglayer
|
// drawn by the drawinglayer
|
||||||
ViewContactOfSdrOle2Obj* pViewContact = dynamic_cast<ViewContactOfSdrOle2Obj*>(&GetViewContact());
|
ViewContactOfSdrOle2Obj* pViewContact = dynamic_cast<ViewContactOfSdrOle2Obj*>(&GetViewContact());
|
||||||
if (pViewContact && pViewContact->GetOle2Obj().IsReal3DChart())
|
if (pViewContact && pViewContact->GetOle2Obj().IsReal3DChart())
|
||||||
ChartHelper::updateChart(pViewContact->GetOle2Obj().getXModel());
|
ChartHelper::updateChart(pViewContact->GetOle2Obj().getXModel());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// force ObjectRange
|
// force ObjectRange
|
||||||
getObjectRange();
|
getObjectRange();
|
||||||
|
|
||||||
if(!maObjectRange.isEmpty())
|
if(!maObjectRange.isEmpty())
|
||||||
{
|
|
||||||
// invalidate current valid range
|
|
||||||
GetObjectContact().InvalidatePartOfView(maObjectRange);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take some action when new objects are inserted
|
|
||||||
void ViewObjectContact::ActionChildInserted(ViewContact& rChild)
|
|
||||||
{
|
{
|
||||||
// force creation of the new VOC and trigger it's refresh, so it
|
// invalidate current valid range
|
||||||
// will take part in LazyInvalidate immediately
|
GetObjectContact().InvalidatePartOfView(maObjectRange);
|
||||||
rChild.GetViewObjectContact(GetObjectContact()).ActionChanged();
|
|
||||||
|
|
||||||
// forward action to ObjectContact
|
|
||||||
// const ViewObjectContact& rChildVOC = rChild.GetViewObjectContact(GetObjectContact());
|
|
||||||
// GetObjectContact().InvalidatePartOfView(rChildVOC.getObjectRange());
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ViewObjectContact::checkForPrimitive2DAnimations()
|
// Take some action when new objects are inserted
|
||||||
|
void ViewObjectContact::ActionChildInserted(ViewContact& rChild)
|
||||||
|
{
|
||||||
|
// force creation of the new VOC and trigger it's refresh, so it
|
||||||
|
// will take part in LazyInvalidate immediately
|
||||||
|
rChild.GetViewObjectContact(GetObjectContact()).ActionChanged();
|
||||||
|
|
||||||
|
// forward action to ObjectContact
|
||||||
|
// const ViewObjectContact& rChildVOC = rChild.GetViewObjectContact(GetObjectContact());
|
||||||
|
// GetObjectContact().InvalidatePartOfView(rChildVOC.getObjectRange());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewObjectContact::checkForPrimitive2DAnimations()
|
||||||
|
{
|
||||||
|
// remove old one
|
||||||
|
if(mpPrimitiveAnimation)
|
||||||
|
{
|
||||||
|
delete mpPrimitiveAnimation;
|
||||||
|
mpPrimitiveAnimation = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for animated primitives
|
||||||
|
if(mxPrimitive2DSequence.hasElements())
|
||||||
|
{
|
||||||
|
const bool bTextAnimationAllowed(GetObjectContact().IsTextAnimationAllowed());
|
||||||
|
const bool bGraphicAnimationAllowed(GetObjectContact().IsGraphicAnimationAllowed());
|
||||||
|
|
||||||
|
if(bTextAnimationAllowed || bGraphicAnimationAllowed)
|
||||||
{
|
{
|
||||||
// remove old one
|
AnimatedExtractingProcessor2D aAnimatedExtractor(GetObjectContact().getViewInformation2D(),
|
||||||
if(mpPrimitiveAnimation)
|
bTextAnimationAllowed, bGraphicAnimationAllowed);
|
||||||
|
aAnimatedExtractor.process(mxPrimitive2DSequence);
|
||||||
|
|
||||||
|
if(aAnimatedExtractor.getPrimitive2DSequence().hasElements())
|
||||||
{
|
{
|
||||||
delete mpPrimitiveAnimation;
|
// dervied primitiveList is animated, setup new PrimitiveAnimation
|
||||||
mpPrimitiveAnimation = 0;
|
mpPrimitiveAnimation = new sdr::animation::PrimitiveAnimation(*this, aAnimatedExtractor.getPrimitive2DSequence());
|
||||||
}
|
|
||||||
|
|
||||||
// check for animated primitives
|
|
||||||
if(mxPrimitive2DSequence.hasElements())
|
|
||||||
{
|
|
||||||
const bool bTextAnimationAllowed(GetObjectContact().IsTextAnimationAllowed());
|
|
||||||
const bool bGraphicAnimationAllowed(GetObjectContact().IsGraphicAnimationAllowed());
|
|
||||||
|
|
||||||
if(bTextAnimationAllowed || bGraphicAnimationAllowed)
|
|
||||||
{
|
|
||||||
AnimatedExtractingProcessor2D aAnimatedExtractor(GetObjectContact().getViewInformation2D(),
|
|
||||||
bTextAnimationAllowed, bGraphicAnimationAllowed);
|
|
||||||
aAnimatedExtractor.process(mxPrimitive2DSequence);
|
|
||||||
|
|
||||||
if(aAnimatedExtractor.getPrimitive2DSequence().hasElements())
|
|
||||||
{
|
|
||||||
// dervied primitiveList is animated, setup new PrimitiveAnimation
|
|
||||||
mpPrimitiveAnimation = new sdr::animation::PrimitiveAnimation(*this, aAnimatedExtractor.getPrimitive2DSequence());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
|
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
|
||||||
|
{
|
||||||
|
// get the view-independent Primitive from the viewContact
|
||||||
|
drawinglayer::primitive2d::Primitive2DSequence xRetval(GetViewContact().getViewIndependentPrimitive2DSequence());
|
||||||
|
|
||||||
|
if(xRetval.hasElements())
|
||||||
|
{
|
||||||
|
// handle GluePoint
|
||||||
|
if(!GetObjectContact().isOutputToPrinter() && GetObjectContact().AreGluePointsVisible())
|
||||||
{
|
{
|
||||||
// get the view-independent Primitive from the viewContact
|
const drawinglayer::primitive2d::Primitive2DSequence xGlue(GetViewContact().createGluePointPrimitive2DSequence());
|
||||||
drawinglayer::primitive2d::Primitive2DSequence xRetval(GetViewContact().getViewIndependentPrimitive2DSequence());
|
|
||||||
|
|
||||||
if(xRetval.hasElements())
|
if(xGlue.hasElements())
|
||||||
{
|
{
|
||||||
// handle GluePoint
|
drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xGlue);
|
||||||
if(!GetObjectContact().isOutputToPrinter() && GetObjectContact().AreGluePointsVisible())
|
|
||||||
{
|
|
||||||
const drawinglayer::primitive2d::Primitive2DSequence xGlue(GetViewContact().createGluePointPrimitive2DSequence());
|
|
||||||
|
|
||||||
if(xGlue.hasElements())
|
|
||||||
{
|
|
||||||
drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xGlue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle ghosted
|
|
||||||
if(isPrimitiveGhosted(rDisplayInfo))
|
|
||||||
{
|
|
||||||
const basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
|
|
||||||
const basegfx::BColorModifierSharedPtr aBColorModifier(
|
|
||||||
new basegfx::BColorModifier_interpolate(
|
|
||||||
aRGBWhite,
|
|
||||||
0.5));
|
|
||||||
const drawinglayer::primitive2d::Primitive2DReference xReference(
|
|
||||||
new drawinglayer::primitive2d::ModifiedColorPrimitive2D(
|
|
||||||
xRetval,
|
|
||||||
aBColorModifier));
|
|
||||||
|
|
||||||
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return xRetval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
|
// handle ghosted
|
||||||
|
if(isPrimitiveGhosted(rDisplayInfo))
|
||||||
{
|
{
|
||||||
drawinglayer::primitive2d::Primitive2DSequence xNewPrimitiveSequence;
|
const basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
|
||||||
|
const basegfx::BColorModifierSharedPtr aBColorModifier(
|
||||||
|
new basegfx::BColorModifier_interpolate(
|
||||||
|
aRGBWhite,
|
||||||
|
0.5));
|
||||||
|
const drawinglayer::primitive2d::Primitive2DReference xReference(
|
||||||
|
new drawinglayer::primitive2d::ModifiedColorPrimitive2D(
|
||||||
|
xRetval,
|
||||||
|
aBColorModifier));
|
||||||
|
|
||||||
// take care of redirectors and create new list
|
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
|
||||||
ViewObjectContactRedirector* pRedirector = GetObjectContact().GetViewObjectContactRedirector();
|
|
||||||
|
|
||||||
if(pRedirector)
|
|
||||||
{
|
|
||||||
xNewPrimitiveSequence = pRedirector->createRedirectedPrimitive2DSequence(*this, rDisplayInfo);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xNewPrimitiveSequence = createPrimitive2DSequence(rDisplayInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// local up-to-date checks. New list different from local one?
|
|
||||||
if(!drawinglayer::primitive2d::arePrimitive2DSequencesEqual(mxPrimitive2DSequence, xNewPrimitiveSequence))
|
|
||||||
{
|
|
||||||
// has changed, copy content
|
|
||||||
const_cast< ViewObjectContact* >(this)->mxPrimitive2DSequence = xNewPrimitiveSequence;
|
|
||||||
|
|
||||||
// check for animated stuff
|
|
||||||
const_cast< ViewObjectContact* >(this)->checkForPrimitive2DAnimations();
|
|
||||||
|
|
||||||
// always update object range when PrimitiveSequence changes
|
|
||||||
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
|
|
||||||
const_cast< ViewObjectContact* >(this)->maObjectRange =
|
|
||||||
drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(mxPrimitive2DSequence, rViewInformation2D);
|
|
||||||
}
|
|
||||||
|
|
||||||
// return current Primitive2DSequence
|
|
||||||
return mxPrimitive2DSequence;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ViewObjectContact::isPrimitiveVisible(const DisplayInfo& /*rDisplayInfo*/) const
|
return xRetval;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
|
||||||
|
{
|
||||||
|
drawinglayer::primitive2d::Primitive2DSequence xNewPrimitiveSequence;
|
||||||
|
|
||||||
|
// take care of redirectors and create new list
|
||||||
|
ViewObjectContactRedirector* pRedirector = GetObjectContact().GetViewObjectContactRedirector();
|
||||||
|
|
||||||
|
if(pRedirector)
|
||||||
|
{
|
||||||
|
xNewPrimitiveSequence = pRedirector->createRedirectedPrimitive2DSequence(*this, rDisplayInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xNewPrimitiveSequence = createPrimitive2DSequence(rDisplayInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// local up-to-date checks. New list different from local one?
|
||||||
|
if(!drawinglayer::primitive2d::arePrimitive2DSequencesEqual(mxPrimitive2DSequence, xNewPrimitiveSequence))
|
||||||
|
{
|
||||||
|
// has changed, copy content
|
||||||
|
const_cast< ViewObjectContact* >(this)->mxPrimitive2DSequence = xNewPrimitiveSequence;
|
||||||
|
|
||||||
|
// check for animated stuff
|
||||||
|
const_cast< ViewObjectContact* >(this)->checkForPrimitive2DAnimations();
|
||||||
|
|
||||||
|
// always update object range when PrimitiveSequence changes
|
||||||
|
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
|
||||||
|
const_cast< ViewObjectContact* >(this)->maObjectRange =
|
||||||
|
drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(mxPrimitive2DSequence, rViewInformation2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
// return current Primitive2DSequence
|
||||||
|
return mxPrimitive2DSequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ViewObjectContact::isPrimitiveVisible(const DisplayInfo& /*rDisplayInfo*/) const
|
||||||
|
{
|
||||||
|
// default: always visible
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ViewObjectContact::isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const
|
||||||
|
{
|
||||||
|
// default: standard check
|
||||||
|
return (GetObjectContact().DoVisualizeEnteredGroup() && !GetObjectContact().isOutputToPrinter() && rDisplayInfo.IsGhostedDrawModeActive());
|
||||||
|
}
|
||||||
|
|
||||||
|
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
|
||||||
|
{
|
||||||
|
drawinglayer::primitive2d::Primitive2DSequence xRetval;
|
||||||
|
|
||||||
|
// check model-view visibility
|
||||||
|
if(isPrimitiveVisible(rDisplayInfo))
|
||||||
|
{
|
||||||
|
xRetval = getPrimitive2DSequence(rDisplayInfo);
|
||||||
|
|
||||||
|
if(xRetval.hasElements())
|
||||||
{
|
{
|
||||||
// default: always visible
|
// get ranges
|
||||||
return true;
|
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
|
||||||
}
|
const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
|
||||||
|
const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
|
||||||
|
|
||||||
bool ViewObjectContact::isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const
|
// check geometrical visibility
|
||||||
{
|
if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
|
||||||
// default: standard check
|
|
||||||
return (GetObjectContact().DoVisualizeEnteredGroup() && !GetObjectContact().isOutputToPrinter() && rDisplayInfo.IsGhostedDrawModeActive());
|
|
||||||
}
|
|
||||||
|
|
||||||
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
|
|
||||||
{
|
|
||||||
drawinglayer::primitive2d::Primitive2DSequence xRetval;
|
|
||||||
|
|
||||||
// check model-view visibility
|
|
||||||
if(isPrimitiveVisible(rDisplayInfo))
|
|
||||||
{
|
{
|
||||||
xRetval = getPrimitive2DSequence(rDisplayInfo);
|
// not visible, release
|
||||||
|
xRetval.realloc(0);
|
||||||
if(xRetval.hasElements())
|
|
||||||
{
|
|
||||||
// get ranges
|
|
||||||
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
|
|
||||||
const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
|
|
||||||
const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
|
|
||||||
|
|
||||||
// check geometrical visibility
|
|
||||||
if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
|
|
||||||
{
|
|
||||||
// not visible, release
|
|
||||||
xRetval.realloc(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return xRetval;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const
|
return xRetval;
|
||||||
{
|
}
|
||||||
const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
|
|
||||||
drawinglayer::primitive2d::Primitive2DSequence xSeqRetval;
|
|
||||||
|
|
||||||
for(sal_uInt32 a(0); a < nSubHierarchyCount; a++)
|
drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const
|
||||||
{
|
{
|
||||||
const ViewObjectContact& rCandidate(GetViewContact().GetViewContact(a).GetViewObjectContact(GetObjectContact()));
|
const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
|
||||||
|
drawinglayer::primitive2d::Primitive2DSequence xSeqRetval;
|
||||||
|
|
||||||
drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xSeqRetval, rCandidate.getPrimitive2DSequenceHierarchy(rDisplayInfo));
|
for(sal_uInt32 a(0); a < nSubHierarchyCount; a++)
|
||||||
}
|
{
|
||||||
|
const ViewObjectContact& rCandidate(GetViewContact().GetViewContact(a).GetViewObjectContact(GetObjectContact()));
|
||||||
|
|
||||||
return xSeqRetval;
|
drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xSeqRetval, rCandidate.getPrimitive2DSequenceHierarchy(rDisplayInfo));
|
||||||
}
|
}
|
||||||
} // end of namespace contact
|
|
||||||
} // end of namespace sdr
|
return xSeqRetval;
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Reference in New Issue
Block a user