create the fill bitmap link tracker in SdrModel::SetLinkManager

merge this common setup

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9efdc64155ed45580fb0ccc122a723fe10f4322c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3551
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit edecf78ffe05453017d3d7b9fef5dcd145fbf56b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208577
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Caolán McNamara
2026-07-25 01:48:33 +02:00
committed by Xisco Fauli
parent 8be0c744f5
commit cb5895ad7b
5 changed files with 18 additions and 26 deletions
+5 -5
View File
@@ -358,13 +358,13 @@ public:
void SetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(SfxStyleSheet* pDefSS) { mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj = pDefSS; }
sfx2::LinkManager* GetLinkManager() { return m_pLinkManager; }
void SetLinkManager( sfx2::LinkManager* pLinkMgr ) { m_pLinkManager = pLinkMgr; }
// Setting a LinkManager also creates the per-host fill bitmap link tracker,
// so any drawing model with a LinkManager tracks deferred remote fill
// bitmaps (registered as the item is set via AttributeProperties::ItemChange
// / SdrPageProperties::PutItem) rather than by a later pool scan.
void SetLinkManager( sfx2::LinkManager* pLinkMgr );
// Opt-in per-host tracking of deferred remote fill bitmap links. When set,
// AttributeProperties::ItemChange routes XATTR_FILLBITMAP changes here so a
// link is registered as the item is set rather than by a later pool scan.
sdr::FillBitmapLinkTracker* GetFillBitmapLinkTracker() const { return m_pFillBitmapLinkTracker.get(); }
void SetFillBitmapLinkTracker( std::unique_ptr<sdr::FillBitmapLinkTracker> pTracker );
::comphelper::IEmbeddedHelper* GetPersist() const { return m_pEmbeddedHelper; }
void SetPersist( ::comphelper::IEmbeddedHelper *p ) { m_pEmbeddedHelper = p; }
+3 -9
View File
@@ -40,7 +40,6 @@
#include <docsh.hxx>
#include <table.hxx>
#include <drwlayer.hxx>
#include <svx/fillbitmaplink.hxx>
#include <markdata.hxx>
#include <patattr.hxx>
#include <rechead.hxx>
@@ -133,15 +132,10 @@ void ScDocument::InitDrawLayer( ScDocShell* pDocShell )
mpDrawLayer.reset(new ScDrawLayer( this, aName ));
// Create the LinkManager up front (not gated on bAutoCalc) so the draw
// layer can register per-object fill bitmap links as shapes are imported,
// and install the tracker that AttributeProperties::ItemChange feeds.
sfx2::LinkManager* pMgr = GetDocLinkManager().getLinkManager(true);
if (pMgr)
{
// layer can register fill bitmap links as shapes are imported. Setting it
// also installs SdrModel's fill bitmap link tracker.
if (sfx2::LinkManager* pMgr = GetDocLinkManager().getLinkManager(true))
mpDrawLayer->SetLinkManager(pMgr);
mpDrawLayer->SetFillBitmapLinkTracker(
std::make_unique<sdr::FillBitmapLinkTracker>(*mpDrawLayer));
}
// set DrawingLayer's SfxItemPool at Calc's SfxItemPool as
// secondary pool to support DrawingLayer FillStyle ranges (and similar)
+3 -4
View File
@@ -280,11 +280,10 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
if (mpDocSh)
{
// Setting the LinkManager also installs the fill bitmap link tracker,
// so deferred remote fills on shapes, page backgrounds and the
// Background style are registered per host as they are set.
SetLinkManager( new sfx2::LinkManager(mpDocSh) );
// Track deferred remote fill bitmaps on shapes and page backgrounds as
// they are set, registering one SvBaseLink per host in place of a pool
// scan.
SetFillBitmapLinkTracker(std::make_unique<sdr::FillBitmapLinkTracker>(*this));
}
EEControlBits nCntrl = rOutliner.GetControlWord();
+4 -2
View File
@@ -226,9 +226,11 @@ void SdrModel::implDtorClearModel()
ClearModel(true);
}
void SdrModel::SetFillBitmapLinkTracker(std::unique_ptr<sdr::FillBitmapLinkTracker> pTracker)
void SdrModel::SetLinkManager(sfx2::LinkManager* pLinkMgr)
{
m_pFillBitmapLinkTracker = std::move(pTracker);
m_pLinkManager = pLinkMgr;
if (pLinkMgr && !m_pFillBitmapLinkTracker)
m_pFillBitmapLinkTracker.reset(new sdr::FillBitmapLinkTracker(*this));
}
SdrModel::~SdrModel()
@@ -38,7 +38,6 @@
#include <editeng/fhgtitem.hxx>
#include <svx/svdlayer.hxx>
#include <svx/svdoutl.hxx>
#include <svx/fillbitmaplink.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdpagv.hxx>
#include <svx/svdotext.hxx>
@@ -128,12 +127,10 @@ void DocumentDrawModelManager::InitDrawModel()
// Set the LinkManager in the model so that linked graphics can be inserted.
// The WinWord import needs it too.
// Setting it also installs the draw model's fill bitmap link tracker, so
// deferred remote fills on draw-layer shapes are registered per SdrObject
// as they are set.
mpDrawModel->SetLinkManager( & m_rDoc.getIDocumentLinksAdministration().GetLinkManager() );
// Track deferred remote fill bitmaps on draw-layer shapes as they are set,
// registering one SvBaseLink per SdrObject in place of a pool scan.
mpDrawModel->SetFillBitmapLinkTracker(
std::make_unique<sdr::FillBitmapLinkTracker>(*mpDrawModel));
mpDrawModel->SetAddExtLeading( m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING) );
OutputDevice* pRefDev = m_rDoc.getIDocumentDeviceAccess().getReferenceDevice( false );