summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-27 15:28:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-31 13:14:48 +0200
commitc760d61bad637bf178566884039dd07d81ab17ed (patch)
tree002ca8929cce81c80644f56a6dc4c002a558cfa4 /svx/source
parentf2e2752d75b2c0f65a929ed740deb750cb19a550 (diff)
remove SdrGrafObj::IsSwappedOut
and consequently a whole bunch of related code leftover from commit e4eb416c3ef81d098ed61caabd2077cbbb2418bc remove swapping and link from GraphicObject and Graphic Change-Id: I2f8a631441e06aa52db6d9ad247e8ae6be1004ed Reviewed-on: https://gerrit.libreoffice.org/58195 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx230
-rw-r--r--svx/source/svdraw/svdograf.cxx6
2 files changed, 1 insertions, 235 deletions
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index 8f2902bf5ac5..59c32e6e4006 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -28,206 +28,8 @@
namespace sdr
{
- namespace event
- {
- class AsynchGraphicLoadingEvent : public BaseEvent
- {
- // the ViewContactOfGraphic to work with
- sdr::contact::ViewObjectContactOfGraphic& mrVOCOfGraphic;
-
- public:
- // basic constructor.
- AsynchGraphicLoadingEvent(TimerEventHandler& rEventHandler, sdr::contact::ViewObjectContactOfGraphic& rVOCOfGraphic);
-
- // destructor
- virtual ~AsynchGraphicLoadingEvent() override;
-
- // the called method if the event is triggered
- virtual void ExecuteEvent() override;
- };
-
- AsynchGraphicLoadingEvent::AsynchGraphicLoadingEvent(
- TimerEventHandler& rEventHandler, sdr::contact::ViewObjectContactOfGraphic& rVOCOfGraphic)
- : BaseEvent(rEventHandler),
- mrVOCOfGraphic(rVOCOfGraphic)
- {
- }
-
- AsynchGraphicLoadingEvent::~AsynchGraphicLoadingEvent()
- {
- mrVOCOfGraphic.forgetAsynchGraphicLoadingEvent(this);
- }
-
- void AsynchGraphicLoadingEvent::ExecuteEvent()
- {
- mrVOCOfGraphic.doAsynchGraphicLoading();
- }
- } // end of namespace event
-} // end of namespace sdr
-
-
-namespace sdr
-{
namespace contact
{
- // Test graphics state and eventually trigger a SwapIn event or an Asynchronous
- // load event. Return value gives info if SwapIn was triggered or not
- void ViewObjectContactOfGraphic::impPrepareGraphicWithAsynchroniousLoading()
- {
- SdrGrafObj& rGrafObj = getSdrGrafObj();
-
- if(rGrafObj.IsSwappedOut())
- {
- if(rGrafObj.IsLinkedGraphic())
- {
- // update graphic link
- rGrafObj.ImpUpdateGraphicLink();
- }
- else
- {
- // SwapIn needs to be done. Decide if it can be done asynchronious.
- bool bSwapInAsynchronious(false);
- ObjectContact& rObjectContact = GetObjectContact();
-
- // only when allowed from configuration
- if(rObjectContact.IsAsynchronGraphicsLoadingAllowed())
- {
- // direct output or vdev output (PageView buffering)
- if(rObjectContact.isOutputToWindow() || rObjectContact.isOutputToVirtualDevice())
- {
- // only when no metafile recording
- if(!rObjectContact.isOutputToRecordingMetaFile())
- {
- // allow asynchronious loading
- bSwapInAsynchronious = true;
- }
- }
- }
-
- if(bSwapInAsynchronious)
- {
- // maybe it's on the way, then do nothing
- if(!mpAsynchLoadEvent)
- {
- // Trigger asynchronious SwapIn.
- sdr::event::TimerEventHandler& rEventHandler = rObjectContact.GetEventHandler();
-
- mpAsynchLoadEvent.reset( new sdr::event::AsynchGraphicLoadingEvent(rEventHandler, *this) );
- }
- }
- else
- {
- if(rObjectContact.isOutputToPrinter() || rObjectContact.isOutputToPDFFile())
- {
- // #i76395# preview mechanism is only active if
- // swapin is called from inside paint preparation, so mbInsidePaint
- // has to be false to be able to print with high resolution
- rGrafObj.ForceSwapIn();
- }
- else
- {
- // SwapIn direct
- rGrafObj.mbInsidePaint = true;
- rGrafObj.ForceSwapIn();
- rGrafObj.mbInsidePaint = false;
- }
- }
- }
- }
- else
- {
- // it is not swapped out, somehow[1] it was loaded. In that case, forget
- // about an existing triggered event
- if (mpAsynchLoadEvent)
- {
- // just delete it, this will remove it from the EventHandler and
- // will trigger forgetAsynchGraphicLoadingEvent from the destructor
- mpAsynchLoadEvent.reset();
-
- // Invalidate paint areas.
- // [1] If a calc document with graphics is loaded then OnLoad will
- // be emitted before the graphic are due to be swapped in asynchronously
- // In sfx2 we generate a preview on receiving onload, which forces
- // the graphics to be swapped in to generate the preview. When
- // the timer triggers it find the graphics already swapped in. So
- // we should still invalidate the paint area on finding the graphic
- // swapped in seeing as we're still waiting in calc to draw the
- // graphics on receipt of their contents.
- GetViewContact().ActionChanged();
- }
- }
- }
-
- // Test graphics state and eventually trigger a SwapIn event. Return value
- // gives info if SwapIn was triggered or not
- void ViewObjectContactOfGraphic::impPrepareGraphicWithSynchroniousLoading()
- {
- SdrGrafObj& rGrafObj = getSdrGrafObj();
-
- if(rGrafObj.IsSwappedOut())
- {
- if(rGrafObj.IsLinkedGraphic())
- {
- // update graphic link
- rGrafObj.ImpUpdateGraphicLink( false );
- }
- else
- {
- ObjectContact& rObjectContact = GetObjectContact();
-
- if(rObjectContact.isOutputToPrinter() || rObjectContact.isOutputToPDFFile())
- {
- // #i76395# preview mechanism is only active if
- // swapin is called from inside paint preparation, so mbInsidePaint
- // has to be false to be able to print with high resolution
- rGrafObj.ForceSwapIn();
- }
- else
- {
- // SwapIn direct
- rGrafObj.mbInsidePaint = true;
- rGrafObj.ForceSwapIn();
- rGrafObj.mbInsidePaint = false;
- }
- }
- }
- }
-
- // This is the call from the asynch graphic loading. This may only be called from
- // AsynchGraphicLoadingEvent::ExecuteEvent(). Do load the graphics. The event will
- // be deleted (consumed) and forgetAsynchGraphicLoadingEvent will be called.
- void ViewObjectContactOfGraphic::doAsynchGraphicLoading()
- {
- DBG_ASSERT(mpAsynchLoadEvent, "ViewObjectContactOfGraphic::doAsynchGraphicLoading: I did not trigger a event, why am i called (?)");
-
- // swap it in
- SdrGrafObj& rGrafObj = getSdrGrafObj();
- rGrafObj.ForceSwapIn();
-
- // #i103720# forget event to avoid possible deletion by the following ActionChanged call
- // which may use createPrimitive2DSequence/impPrepareGraphicWithAsynchroniousLoading again.
- // Deletion is actually done by the scheduler who led to coming here
- mpAsynchLoadEvent.release();
-
- // Invalidate all paint areas and check existing animation (which may have changed).
- GetViewContact().ActionChanged();
- }
-
- // This is the call from the destructor of the asynch graphic loading event.
- // No one else has to call this. It is needed to let this object forget about
- // the event. The parameter allows checking for the correct event.
- void ViewObjectContactOfGraphic::forgetAsynchGraphicLoadingEvent(sdr::event::AsynchGraphicLoadingEvent const * pEvent)
- {
- if(mpAsynchLoadEvent)
- {
- OSL_ENSURE(!pEvent || mpAsynchLoadEvent.get() == pEvent,
- "ViewObjectContactOfGraphic::forgetAsynchGraphicLoadingEvent: Forced to forget another event then I have scheduled (?)");
-
- // forget event
- mpAsynchLoadEvent.release();
- }
- }
-
const SdrGrafObj& ViewObjectContactOfGraphic::getSdrGrafObj() const
{
return static_cast<const ViewContactOfGraphic& >(GetViewContact()).GetGrafObject();
@@ -240,35 +42,6 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfGraphic::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
{
- // prepare primitive generation with evtl. loading the graphic when it's swapped out
- SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj();
- bool bDoAsynchronGraphicLoading(rGrafObj.getSdrModelFromSdrObject().IsSwapGraphics());
-
- if( bDoAsynchronGraphicLoading && rGrafObj.IsSwappedOut() )
- {
- // sometimes it is needed that each graphic is completely available and swapped in
- // for these cases a ForceSwapIn is called later at the graphic object
- if ( rGrafObj.getSdrPageFromSdrObject() && rGrafObj.getSdrPageFromSdrObject()->IsMasterPage() )
- {
- // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation
- bDoAsynchronGraphicLoading = false;
- }
- else if ( GetObjectContact().isOutputToPrinter()
- || GetObjectContact().isOutputToRecordingMetaFile()
- || GetObjectContact().isOutputToPDFFile() )
- {
- bDoAsynchronGraphicLoading = false;
- }
- }
- if( bDoAsynchronGraphicLoading )
- {
- const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
- }
- else
- {
- const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithSynchroniousLoading();
- }
-
// get return value by calling parent
drawinglayer::primitive2d::Primitive2DContainer xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo);
@@ -293,8 +66,7 @@ namespace sdr
}
ViewObjectContactOfGraphic::ViewObjectContactOfGraphic(ObjectContact& rObjectContact, ViewContact& rViewContact)
- : ViewObjectContactOfSdrObj(rObjectContact, rViewContact),
- mpAsynchLoadEvent(nullptr)
+ : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
{
}
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 025206cbccde..2e5f955b0165 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -548,12 +548,6 @@ bool SdrGrafObj::IsEPS() const
return mpGraphicObject->IsEPS();
}
-// TODO Remove
-bool SdrGrafObj::IsSwappedOut() const
-{
- return false;
-}
-
MapMode SdrGrafObj::GetGrafPrefMapMode() const
{
return mpGraphicObject->GetPrefMapMode();