AddWindowToPaintView -> AddDeviceToPaintView

... and likewise DeleteWindowFromPaintView -> DeleteDeviceFromPaintView
because they add/delete output devices, not windows, ever since commit
53fd4bb47c (INTEGRATION: CWS sdwarningsbegone
(1.42.34); FILE MERGED, Dec 12 18:19:15 2006)

And use references instead of pointers, because they are dereferenced
unconditionally.

Change-Id: I67d5841babaec040aa5308e95f333948eb0dde2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142945
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2022-11-18 18:35:07 +01:00
parent 2fa426da15
commit e684762425
13 changed files with 48 additions and 53 deletions
+2 -2
View File
@@ -82,8 +82,8 @@ public:
rtl::Reference<SdrObject> CreateXFormsControl( const svx::OXFormsDescriptor &_rDesc );
virtual void MarkListHasChanged() override;
virtual void AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow) override;
virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin) override;
virtual void AddDeviceToPaintView(OutputDevice& rNewDev, vcl::Window* pWindow) override;
virtual void DeleteDeviceFromPaintView(OutputDevice& rOldDev) override;
static void createControlLabelPair(
OutputDevice const * _pOutDev,
+2 -2
View File
@@ -275,8 +275,8 @@ public:
void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
// Intern: at mounting new OutlinerView...
virtual void AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow) override;
virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin) override;
virtual void AddDeviceToPaintView(OutputDevice& rNewDev, vcl::Window* pWindow) override;
virtual void DeleteDeviceFromPaintView(OutputDevice& rOldWin) override;
sal_uInt16 GetSelectionLevel() const;
+3 -3
View File
@@ -299,9 +299,9 @@ public:
// Iterate over all registered PageViews
SdrPageView* GetSdrPageView() const { return mpPageView.get(); }
// A SdrView can be displayed on multiple Windows at the same time
virtual void AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow);
virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
// A SdrView can be output to multiple devices at the same time
virtual void AddDeviceToPaintView(OutputDevice& rNewDev, vcl::Window* pWindow);
virtual void DeleteDeviceFromPaintView(OutputDevice& rOldDev);
void SetLayerVisible(const OUString& rName, bool bShow);
bool IsLayerVisible(const OUString& rName) const;
+3 -3
View File
@@ -185,7 +185,7 @@ ScTabView::~ScTabView()
for (i=0; i<4; i++)
if (pGridWin[i])
{
pDrawView->DeleteWindowFromPaintView(pGridWin[i]->GetOutDev());
pDrawView->DeleteDeviceFromPaintView(*pGridWin[i]->GetOutDev());
}
pDrawView->HideSdrPage();
@@ -238,7 +238,7 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode )
if (pGridWin[i])
{
if ( SC_SPLIT_BOTTOMLEFT != static_cast<ScSplitPos>(i) )
pDrawView->AddWindowToPaintView(pGridWin[i]->GetOutDev(), nullptr);
pDrawView->AddDeviceToPaintView(*pGridWin[i]->GetOutDev(), nullptr);
}
pDrawView->RecalcScale();
for (i=0; i<4; i++)
@@ -271,7 +271,7 @@ void ScTabView::DoAddWin( ScGridWindow* pWin )
{
if (pDrawView)
{
pDrawView->AddWindowToPaintView(pWin->GetOutDev(), nullptr);
pDrawView->AddDeviceToPaintView(*pWin->GetOutDev(), nullptr);
pWin->DrawLayerCreated();
}
pWin->SetAutoSpellContext(mpSpellCheckCxt);
+2 -2
View File
@@ -75,8 +75,8 @@ public:
static SdrTextObj* CreateTitleTextObject(SdPage* pPage);
static SdrTextObj* CreateOutlineTextObject(SdPage* pPage);
virtual void AddWindowToPaintView(OutputDevice* pWin, vcl::Window* pWindow) override;
virtual void DeleteWindowFromPaintView(OutputDevice* pWin) override;
virtual void AddDeviceToPaintView(OutputDevice& rDev, vcl::Window* pWindow) override;
virtual void DeleteDeviceFromPaintView(OutputDevice& rDev) override;
OutlinerView* GetViewByWindow(vcl::Window const * pWin) const;
SdrOutliner& GetOutliner() { return mrOutliner; }
+2 -2
View File
@@ -587,7 +587,7 @@ IMPL_LINK( ShowWindow, EventHdl, VclWindowEvent&, rEvent, void )
void ShowWindow::DeleteWindowFromPaintView()
{
if( mpViewShell->GetView() )
mpViewShell->GetView()->DeleteWindowFromPaintView( GetOutDev() );
mpViewShell->GetView()->DeleteDeviceFromPaintView( *GetOutDev() );
sal_uInt16 nChild = GetChildCount();
while( nChild-- )
@@ -597,7 +597,7 @@ void ShowWindow::DeleteWindowFromPaintView()
void ShowWindow::AddWindowToPaintView()
{
if( mpViewShell->GetView() )
mpViewShell->GetView()->AddWindowToPaintView( GetOutDev(), nullptr );
mpViewShell->GetView()->AddDeviceToPaintView( *GetOutDev(), nullptr );
sal_uInt16 nChild = GetChildCount();
while( nChild-- )
+3 -3
View File
@@ -628,7 +628,7 @@ void SlideshowImpl::disposing(std::unique_lock<std::mutex>&)
// take DrawView from presentation window, but give the old window back
if( mpShowWindow && mpView )
mpView->DeleteWindowFromPaintView( mpShowWindow->GetOutDev() );
mpView->DeleteDeviceFromPaintView( *mpShowWindow->GetOutDev() );
if( mpView )
mpView->SetAnimationPause( false );
@@ -781,7 +781,7 @@ bool SlideshowImpl::startPreview(
if( mpView )
{
mpView->AddWindowToPaintView( mpShowWindow->GetOutDev(), nullptr );
mpView->AddDeviceToPaintView( *mpShowWindow->GetOutDev(), nullptr );
mpView->SetAnimationPause( true );
}
@@ -967,7 +967,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx const * pPresSettings )
if( mpView )
{
mpView->AddWindowToPaintView( mpShowWindow->GetOutDev(), nullptr );
mpView->AddDeviceToPaintView( *mpShowWindow->GetOutDev(), nullptr );
mpView->SetAnimationPause( true );
}
+7 -7
View File
@@ -194,7 +194,7 @@ void OutlineView::Paint(const ::tools::Rectangle& rRect, ::sd::Window const * pW
}
}
void OutlineView::AddWindowToPaintView(OutputDevice* pWin, vcl::Window* pWindow)
void OutlineView::AddDeviceToPaintView(OutputDevice& rDev, vcl::Window* pWindow)
{
bool bAdded = false;
bool bValidArea = false;
@@ -206,7 +206,7 @@ void OutlineView::AddWindowToPaintView(OutputDevice* pWin, vcl::Window* pWindow)
{
if (mpOutlinerViews[nView] == nullptr)
{
mpOutlinerViews[nView].reset( new OutlinerView(&mrOutliner, dynamic_cast< ::sd::Window* >(pWin->GetOwnerWindow())) );
mpOutlinerViews[nView].reset( new OutlinerView(&mrOutliner, dynamic_cast< ::sd::Window* >(rDev.GetOwnerWindow())) );
mpOutlinerViews[nView]->SetBackgroundColor( aWhiteColor );
mrOutliner.InsertView(mpOutlinerViews[nView].get(), EE_APPEND);
bAdded = true;
@@ -226,12 +226,12 @@ void OutlineView::AddWindowToPaintView(OutputDevice* pWin, vcl::Window* pWindow)
}
// white background in Outliner
pWin->SetBackground( Wallpaper( aWhiteColor ) );
rDev.SetBackground( Wallpaper( aWhiteColor ) );
::sd::View::AddWindowToPaintView(pWin, pWindow);
::sd::View::AddDeviceToPaintView(rDev, pWindow);
}
void OutlineView::DeleteWindowFromPaintView(OutputDevice* pWin)
void OutlineView::DeleteDeviceFromPaintView(OutputDevice& rDev)
{
bool bRemoved = false;
sal_uInt16 nView = 0;
@@ -243,7 +243,7 @@ void OutlineView::DeleteWindowFromPaintView(OutputDevice* pWin)
{
pWindow = mpOutlinerViews[nView]->GetWindow();
if (pWindow->GetOutDev() == pWin)
if (pWindow->GetOutDev() == &rDev)
{
mrOutliner.RemoveView( mpOutlinerViews[nView].get() );
mpOutlinerViews[nView].reset();
@@ -254,7 +254,7 @@ void OutlineView::DeleteWindowFromPaintView(OutputDevice* pWin)
nView++;
}
::sd::View::DeleteWindowFromPaintView(pWin);
::sd::View::DeleteDeviceFromPaintView(rDev);
}
/**
+1 -1
View File
@@ -161,7 +161,7 @@ View::~View()
while(PaintWindowCount())
{
// remove all registered OutDevs
suppress_fun_call_w_exception(DeleteWindowFromPaintView(GetFirstOutputDevice()));
suppress_fun_call_w_exception(DeleteDeviceFromPaintView(*GetFirstOutputDevice()));
}
}
+6 -9
View File
@@ -174,28 +174,25 @@ namespace
}
void FmFormView::AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow)
void FmFormView::AddDeviceToPaintView(OutputDevice& rNewDev, vcl::Window* pWindow)
{
E3dView::AddWindowToPaintView(pNewWin, pWindow);
if ( !pNewWin )
return;
E3dView::AddDeviceToPaintView(rNewDev, pWindow);
// look up the PageViewWindow for the newly inserted window, and care for it
// #i39269# / 2004-12-20 / frank.schoenheit@sun.com
const SdrPageWindow* pPageWindow = findPageWindow( this, pNewWin );
const SdrPageWindow* pPageWindow = findPageWindow( this, &rNewDev );
if ( pPageWindow )
pImpl->addWindow( *pPageWindow );
}
void FmFormView::DeleteWindowFromPaintView(OutputDevice* pNewWin)
void FmFormView::DeleteDeviceFromPaintView(OutputDevice& rNewDev)
{
const SdrPageWindow* pPageWindow = findPageWindow( this, pNewWin );
const SdrPageWindow* pPageWindow = findPageWindow( this, &rNewDev );
if ( pPageWindow )
pImpl->removeWindow( pPageWindow->GetControlContainer() );
E3dView::DeleteWindowFromPaintView(pNewWin);
E3dView::DeleteDeviceFromPaintView(rNewDev);
}
+9 -9
View File
@@ -2483,37 +2483,37 @@ void SdrObjEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveH
SdrGlueEditView::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr);
}
void SdrObjEditView::AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow)
void SdrObjEditView::AddDeviceToPaintView(OutputDevice& rNewDev, vcl::Window* pWindow)
{
SdrGlueEditView::AddWindowToPaintView(pNewWin, pWindow);
SdrGlueEditView::AddDeviceToPaintView(rNewDev, pWindow);
if (mxWeakTextEditObj.get() && !mbTextEditOnlyOneView
&& pNewWin->GetOutDevType() == OUTDEV_WINDOW)
&& rNewDev.GetOutDevType() == OUTDEV_WINDOW)
{
OutlinerView* pOutlView = ImpMakeOutlinerView(pNewWin->GetOwnerWindow(), nullptr);
OutlinerView* pOutlView = ImpMakeOutlinerView(rNewDev.GetOwnerWindow(), nullptr);
mpTextEditOutliner->InsertView(pOutlView);
}
}
void SdrObjEditView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
void SdrObjEditView::DeleteDeviceFromPaintView(OutputDevice& rOldDev)
{
SdrGlueEditView::DeleteWindowFromPaintView(pOldWin);
SdrGlueEditView::DeleteDeviceFromPaintView(rOldDev);
if (mxWeakTextEditObj.get() && !mbTextEditOnlyOneView
&& pOldWin->GetOutDevType() == OUTDEV_WINDOW)
&& rOldDev.GetOutDevType() == OUTDEV_WINDOW)
{
for (size_t i = mpTextEditOutliner->GetViewCount(); i > 0;)
{
i--;
OutlinerView* pOLV = mpTextEditOutliner->GetView(i);
if (pOLV && pOLV->GetWindow() == pOldWin->GetOwnerWindow())
if (pOLV && pOLV->GetWindow() == rOldDev.GetOwnerWindow())
{
mpTextEditOutliner->RemoveView(i);
}
}
}
lcl_RemoveTextEditOutlinerViews(this, GetSdrPageView(), pOldWin);
lcl_RemoveTextEditOutlinerViews(this, GetSdrPageView(), &rOldDev);
}
bool SdrObjEditView::IsTextEditInSelectionMode() const
+5 -7
View File
@@ -175,7 +175,7 @@ SdrPaintView::SdrPaintView(SdrModel& rSdrModel, OutputDevice* pOut)
SetDefaultStyleSheet(mpModel->GetDefaultStyleSheet(), true);
if (pOut)
AddWindowToPaintView(pOut, nullptr);
AddDeviceToPaintView(*pOut, nullptr);
maColorConfig.AddListener(this);
onChangeColorConfig();
@@ -385,10 +385,9 @@ void SdrPaintView::HideSdrPage()
}
}
void SdrPaintView::AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window *pWindow)
void SdrPaintView::AddDeviceToPaintView(OutputDevice& rNewDev, vcl::Window *pWindow)
{
DBG_ASSERT(pNewWin, "SdrPaintView::AddWindowToPaintView: No OutputDevice(!)");
SdrPaintWindow* pNewPaintWindow = new SdrPaintWindow(*this, *pNewWin, pWindow);
SdrPaintWindow* pNewPaintWindow = new SdrPaintWindow(*this, rNewDev, pWindow);
maPaintWindows.emplace_back(pNewPaintWindow);
if(mpPageView)
@@ -397,10 +396,9 @@ void SdrPaintView::AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window *pWin
}
}
void SdrPaintView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
void SdrPaintView::DeleteDeviceFromPaintView(OutputDevice& rOldDev)
{
assert(pOldWin && "SdrPaintView::DeleteWindowFromPaintView: No OutputDevice(!)");
SdrPaintWindow* pCandidate = FindPaintWindow(*pOldWin);
SdrPaintWindow* pCandidate = FindPaintWindow(rOldDev);
if(pCandidate)
{
+3 -3
View File
@@ -1406,14 +1406,14 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to
// #i75172# To get a clean repaint, a new ObjectContact is needed here. Without, the
// repaint would not be correct since it would use the wrong DrawPage visible region.
// This repaint IS about painting something currently outside the visible part (!).
// For that purpose, AddWindowToPaintView is used which creates a new SdrPageViewWindow
// For that purpose, AddDeviceToPaintView is used which creates a new SdrPageViewWindow
// and all the necessary stuff. It's not cheap, but necessary here. Alone because repaint
// target really is NOT the current window.
// Also will automatically NOT use PreRendering and overlay (since target is VirtualDevice)
if(!HasDrawView())
MakeDrawView();
SdrView* pDrawView = GetDrawView();
pDrawView->AddWindowToPaintView(pVout, nullptr);
pDrawView->AddDeviceToPaintView(*pVout, nullptr);
// clear mpWin during DLPrePaint2 to get paint preparation for mpOut, but set it again
// immediately afterwards. There are many decisions in SW which imply that Printing
@@ -1431,7 +1431,7 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to
// end paint and destroy ObjectContact again
DLPostPaint2(true);
pDrawView->DeleteWindowFromPaintView(pVout);
pDrawView->DeleteDeviceFromPaintView(*pVout);
}
mpOut = pOld;