[Libreoffice-commits] core.git: sw/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Wed May 23 13:19:55 UTC 2018
sw/source/core/docnode/swbaslnk.cxx | 133 +++---------------------------------
1 file changed, 12 insertions(+), 121 deletions(-)
New commits:
commit 7581730b2795a58d4fe6868e2f61572a91fde293
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed May 23 17:36:44 2018 +0900
tdf#117247 just send a GRAPHIC_ARRIVED hint after update
As we always load graphic complete now, we can just hint that it
has arrived. In the future we might properly restore retrieving the
stream of a graphic throught link manager, but not creating the
partial graphic from it - just an async retrieval of the bytes.
The graphic should then always be created completely with the
GraphicFilter.
Change-Id: I8560c9d41a057d228aa558316131ba99d436645b
Reviewed-on: https://gerrit.libreoffice.org/54693
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
index 4f30f7b4d67e..744eb2720cea 100644
--- a/sw/source/core/docnode/swbaslnk.cxx
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -126,8 +126,6 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
}
bool bUpdate = false;
- bool bGraphicArrived = false;
- bool bGraphicPieceArrived = false;
bool bFrameInPaint = false;
Size aGrfSz, aOldSz;
@@ -142,9 +140,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
bFrameInPaint = pSwGrfNode->IsFrameInPaint();
- bGraphicArrived = GetObj()->IsDataComplete();
- bGraphicPieceArrived = GetObj()->IsPending();
- pSwGrfNode->SetGraphicArrived( bGraphicArrived );
+ pSwGrfNode->SetGraphicArrived(true);
Graphic aGrf;
@@ -154,36 +150,18 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
{
aGrfSz = ::GetGraphicSizeTwip( aGrf, nullptr );
- if( bGraphicPieceArrived && GraphicType::Default != aGrf.GetType() &&
- ( !aOldSz.Width() || !aOldSz.Height() ) )
- {
- // If only a part arrives, but the size is not set
- // we need to go through bGraphicArrived down there.
- // Or else the graphic is painted at its definitive size
- bGraphicArrived = true;
- bGraphicPieceArrived = false;
- }
-
pSwGrfNode->SetGraphic(aGrf, "");
bUpdate = true;
- // In order for the Node to have the right transparency status
- // without having to access the graphic.
- // Or else we cause a SwapIn.
- if( bGraphicArrived )
+ // Always use the correct graphic size
+ if( aGrfSz.Height() && aGrfSz.Width() &&
+ aOldSz.Height() && aOldSz.Width() &&
+ aGrfSz != aOldSz )
{
- // Always use the correct graphic size
- if( aGrfSz.Height() && aGrfSz.Width() &&
- aOldSz.Height() && aOldSz.Width() &&
- aGrfSz != aOldSz )
- {
- pSwGrfNode->SetTwipSize( aGrfSz );
- aOldSz = aGrfSz;
- }
+ pSwGrfNode->SetTwipSize(aGrfSz);
+ aOldSz = aGrfSz;
}
}
- if ( bUpdate && !bGraphicArrived && !bGraphicPieceArrived )
- pSwGrfNode->SetTwipSize( Size(0,0) );
}
else if( m_pContentNode->IsOLENode() )
bUpdate = true;
@@ -191,101 +169,14 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
if ( !bUpdate || bFrameInPaint )
return SUCCESS;
- SwViewShell *pSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
- SwEditShell* pESh = pDoc->GetEditShell();
-
- if ( bGraphicPieceArrived && !m_bInSwapIn )
- {
- // Send hint without Actions; triggers direct paint
- if ( (!pSh || !pSh->ActionPend()) && (!pESh || !pESh->ActionPend()) )
- {
- SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
- m_pContentNode->ModifyNotification( &aMsgHint, &aMsgHint );
- bUpdate = false;
- }
- }
-
- static bool bInNotifyLinks = false;
- if( (!m_bInSwapIn || bGraphicArrived) && !bInNotifyLinks)
+ if (bUpdate)
{
- bool bLockView = false;
- if( pSh )
+ if (!SetGrfFlySize(aGrfSz, pSwGrfNode, aOldSz))
{
- bLockView = pSh->IsViewLocked();
- pSh->LockView( true );
+ SwMsgPoolItem aMsgHint(RES_GRAPHIC_ARRIVED);
+ lcl_CallModify(*pSwGrfNode, aMsgHint);
+ return SUCCESS;
}
-
- if( pESh )
- pESh->StartAllAction();
- else if( pSh )
- pSh->StartAction();
-
- SwMsgPoolItem aMsgHint(
- bGraphicArrived ? sal_uInt16(RES_GRAPHIC_ARRIVED) : sal_uInt16(RES_UPDATE_ATTR) );
-
- if ( bGraphicArrived )
- {
- // Notify all who are listening at the same link
- bInNotifyLinks = true;
-
- const ::sfx2::SvBaseLinks& rLnks = pDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks();
- for( auto n = rLnks.size(); n; )
- {
- ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
- if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() &&
- dynamic_cast<const SwBaseLink*>( pLnk) != nullptr && pLnk->GetObj() == GetObj() )
- {
- SwBaseLink* pBLink = static_cast<SwBaseLink*>(pLnk);
- SwGrfNode* pGrfNd = static_cast<SwGrfNode*>(pBLink->m_pContentNode);
-
- if( pBLink != this &&
- ( !m_bInSwapIn ||
- GraphicType::Default == pGrfNd->GetGrfObj().GetType()))
- {
- Size aPreArriveSize(pGrfNd->GetTwipSize());
-
- pBLink->m_bIgnoreDataChanged = false;
- pBLink->DataChanged( rMimeType, rValue );
- pBLink->m_bIgnoreDataChanged = true;
-
- pGrfNd->SetGraphicArrived( static_cast<SwGrfNode*>(m_pContentNode)->
- IsGraphicArrived() );
-
- // Adjust the Fly's graphic
- if (!::SetGrfFlySize(aGrfSz, pGrfNd, aPreArriveSize))
- ::lcl_CallModify( *pGrfNd, aMsgHint );
- }
- else if (pBLink == this)
- {
- assert(pGrfNd == pSwGrfNode && "fdo#87083 needs a different fix");
- if (!::SetGrfFlySize(aGrfSz, pGrfNd, aOldSz))
- {
- // Adjust the Fly's graphic
- ::lcl_CallModify( *pGrfNd, aMsgHint );
- }
- }
- }
- }
-
- bInNotifyLinks = false;
- }
- else
- {
- m_pContentNode->ModifyNotification( &aMsgHint, &aMsgHint );
- }
-
- if( pESh )
- {
- const bool bEndActionByVirDev = pESh->IsEndActionByVirDev();
- pESh->SetEndActionByVirDev( true );
- pESh->EndAllAction();
- pESh->SetEndActionByVirDev( bEndActionByVirDev );
- }
- else if( pSh )
- pSh->EndAction();
-
- if( pSh && !bLockView )
- pSh->LockView( false );
}
return SUCCESS;
More information about the Libreoffice-commits
mailing list