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@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
committed by
Tomaž Vajngerl
parent
f8fb04d0af
commit
7581730b27
@@ -126,8 +126,6 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool bUpdate = false;
|
bool bUpdate = false;
|
||||||
bool bGraphicArrived = false;
|
|
||||||
bool bGraphicPieceArrived = false;
|
|
||||||
bool bFrameInPaint = false;
|
bool bFrameInPaint = false;
|
||||||
Size aGrfSz, aOldSz;
|
Size aGrfSz, aOldSz;
|
||||||
|
|
||||||
@@ -142,9 +140,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
|
|||||||
|
|
||||||
bFrameInPaint = pSwGrfNode->IsFrameInPaint();
|
bFrameInPaint = pSwGrfNode->IsFrameInPaint();
|
||||||
|
|
||||||
bGraphicArrived = GetObj()->IsDataComplete();
|
pSwGrfNode->SetGraphicArrived(true);
|
||||||
bGraphicPieceArrived = GetObj()->IsPending();
|
|
||||||
pSwGrfNode->SetGraphicArrived( bGraphicArrived );
|
|
||||||
|
|
||||||
Graphic aGrf;
|
Graphic aGrf;
|
||||||
|
|
||||||
@@ -154,36 +150,18 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
|
|||||||
{
|
{
|
||||||
aGrfSz = ::GetGraphicSizeTwip( aGrf, nullptr );
|
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, "");
|
pSwGrfNode->SetGraphic(aGrf, "");
|
||||||
bUpdate = true;
|
bUpdate = true;
|
||||||
|
|
||||||
// In order for the Node to have the right transparency status
|
// Always use the correct graphic size
|
||||||
// without having to access the graphic.
|
if( aGrfSz.Height() && aGrfSz.Width() &&
|
||||||
// Or else we cause a SwapIn.
|
aOldSz.Height() && aOldSz.Width() &&
|
||||||
if( bGraphicArrived )
|
aGrfSz != aOldSz )
|
||||||
{
|
{
|
||||||
// Always use the correct graphic size
|
pSwGrfNode->SetTwipSize(aGrfSz);
|
||||||
if( aGrfSz.Height() && aGrfSz.Width() &&
|
aOldSz = aGrfSz;
|
||||||
aOldSz.Height() && aOldSz.Width() &&
|
|
||||||
aGrfSz != aOldSz )
|
|
||||||
{
|
|
||||||
pSwGrfNode->SetTwipSize( aGrfSz );
|
|
||||||
aOldSz = aGrfSz;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( bUpdate && !bGraphicArrived && !bGraphicPieceArrived )
|
|
||||||
pSwGrfNode->SetTwipSize( Size(0,0) );
|
|
||||||
}
|
}
|
||||||
else if( m_pContentNode->IsOLENode() )
|
else if( m_pContentNode->IsOLENode() )
|
||||||
bUpdate = true;
|
bUpdate = true;
|
||||||
@@ -191,103 +169,16 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
|
|||||||
if ( !bUpdate || bFrameInPaint )
|
if ( !bUpdate || bFrameInPaint )
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
||||||
SwViewShell *pSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
|
if (bUpdate)
|
||||||
SwEditShell* pESh = pDoc->GetEditShell();
|
|
||||||
|
|
||||||
if ( bGraphicPieceArrived && !m_bInSwapIn )
|
|
||||||
{
|
{
|
||||||
// Send hint without Actions; triggers direct paint
|
if (!SetGrfFlySize(aGrfSz, pSwGrfNode, aOldSz))
|
||||||
if ( (!pSh || !pSh->ActionPend()) && (!pESh || !pESh->ActionPend()) )
|
|
||||||
{
|
{
|
||||||
SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
|
SwMsgPoolItem aMsgHint(RES_GRAPHIC_ARRIVED);
|
||||||
m_pContentNode->ModifyNotification( &aMsgHint, &aMsgHint );
|
lcl_CallModify(*pSwGrfNode, aMsgHint);
|
||||||
bUpdate = false;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bInNotifyLinks = false;
|
|
||||||
if( (!m_bInSwapIn || bGraphicArrived) && !bInNotifyLinks)
|
|
||||||
{
|
|
||||||
bool bLockView = false;
|
|
||||||
if( pSh )
|
|
||||||
{
|
|
||||||
bLockView = pSh->IsViewLocked();
|
|
||||||
pSh->LockView( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user