include/svx/svdograf.hxx                              |    1 
 svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx    |   18 -
 svx/source/sdr/contact/viewobjectcontactofgraphic.cxx |  230 ------------------
 svx/source/svdraw/svdograf.cxx                        |    6 
 4 files changed, 1 insertion(+), 254 deletions(-)

New commits:
commit c760d61bad637bf178566884039dd07d81ab17ed
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jul 27 15:28:44 2018 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jul 31 13:14:48 2018 +0200

    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.gran...@collabora.co.uk>

diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 6f59b3659bda..bdcb24d32b83 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -153,7 +153,6 @@ public:
     // Keep ATM for SD.
     bool IsAnimated() const;
     bool IsEPS() const;
-    bool IsSwappedOut() const;
 
     MapMode          GetGrafPrefMapMode() const;
     Size             GetGrafPrefSize() const;
diff --git a/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx 
b/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx
index 40c57cb0eacd..360009e58f92 100644
--- a/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx
+++ b/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx
@@ -25,30 +25,12 @@
 
 class SdrGrafObj;
 
-namespace sdr { namespace event {
-    class AsynchGraphicLoadingEvent;
-}}
-
 namespace sdr
 {
     namespace contact
     {
         class ViewObjectContactOfGraphic final : public 
ViewObjectContactOfSdrObj
         {
-            // allow async loading event helper to call tooling methods
-            friend class sdr::event::AsynchGraphicLoadingEvent;
-
-            // Member which takes care for the asynch loading events which may 
be necessary
-            // for asynch graphics loading.
-            std::unique_ptr<sdr::event::AsynchGraphicLoadingEvent>  
mpAsynchLoadEvent;
-
-            // async graphics loading helpers. Only to be used internally or 
from the
-            // event helper class (in .cxx file)
-            void impPrepareGraphicWithAsynchroniousLoading();
-            void impPrepareGraphicWithSynchroniousLoading();
-            void doAsynchGraphicLoading();
-            void 
forgetAsynchGraphicLoadingEvent(sdr::event::AsynchGraphicLoadingEvent const * 
pEvent);
-
             const SdrGrafObj& getSdrGrafObj() const;
             SdrGrafObj& getSdrGrafObj();
 
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();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to