summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-10 12:53:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-11 06:55:41 +0000
commit78b4a1fb01af9ad3b3395a22f6e396be914b553e (patch)
tree846fdaea907a70fdc274a1e76642ed5e06622c0d
parent071e23fee07b92b8f07800cda3ca7e66afe818ae (diff)
update vclwidget loplugin to find ref-dropping assigment
Look for places where we are accidentally assigning a returned-by-value VclPtr<T> to a T*, which generally ends up in a use-after-free. Change-Id: I4f361eaca88820cdb7aa3b8340212db61580fdd9 Reviewed-on: https://gerrit.libreoffice.org/30749 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--accessibility/source/extended/accessibleiconchoicectrl.cxx16
-rw-r--r--accessibility/source/extended/accessiblelistbox.cxx6
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx2
-rw-r--r--accessibility/source/helper/acc_factory.cxx2
-rw-r--r--accessibility/source/standard/floatingwindowaccessible.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessiblebox.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessiblebutton.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessiblecheckbox.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessibleedit.cxx6
-rw-r--r--accessibility/source/standard/vclxaccessibleradiobutton.cxx2
-rw-r--r--basctl/source/basicide/basicrenderable.cxx6
-rw-r--r--basctl/source/basicide/baside2.cxx2
-rw-r--r--basctl/source/basicide/basides1.cxx16
-rw-r--r--basctl/source/basicide/basides2.cxx4
-rw-r--r--basctl/source/basicide/basides3.cxx4
-rw-r--r--basctl/source/basicide/basidesh.cxx4
-rw-r--r--basctl/source/basicide/basobj2.cxx2
-rw-r--r--basctl/source/basicide/basobj3.cxx4
-rw-r--r--basctl/source/basicide/localizationmgr.cxx2
-rw-r--r--canvas/source/cairo/cairo_spritecanvas.cxx2
-rw-r--r--canvas/source/opengl/ogl_spritecanvas.cxx2
-rw-r--r--canvas/source/tools/canvastools.cxx2
-rw-r--r--canvas/source/vcl/windowoutdevholder.cxx2
-rw-r--r--chart2/source/controller/accessibility/AccessibleBase.cxx2
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartView.cxx4
-rw-r--r--chart2/source/controller/accessibility/AccessibleTextHelper.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.cxx2
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx2
-rw-r--r--chart2/source/controller/sidebar/Chart2PanelFactory.cxx2
-rw-r--r--compilerplugins/clang/vclwidgets.cxx60
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx2
-rw-r--r--cui/source/factory/dlgfact.cxx2
-rw-r--r--cui/source/options/treeopt.cxx2
-rw-r--r--cui/source/tabpages/macroass.cxx2
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx2
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx4
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLine.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx2
-rw-r--r--desktop/source/app/app.cxx4
-rw-r--r--drawinglayer/source/primitive2d/controlprimitive2d.cxx9
-rw-r--r--extensions/source/bibliography/bibload.cxx2
-rw-r--r--extensions/source/bibliography/framectr.cxx2
-rw-r--r--extensions/source/bibliography/general.cxx4
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx2
-rw-r--r--framework/source/dispatch/closedispatcher.cxx6
-rw-r--r--framework/source/dispatch/windowcommanddispatch.cxx4
-rw-r--r--framework/source/helper/persistentwindowstate.cxx10
-rw-r--r--framework/source/helper/statusindicatorfactory.cxx2
-rw-r--r--framework/source/helper/tagwindowasmodified.cxx2
-rw-r--r--framework/source/helper/titlebarupdate.cxx12
-rw-r--r--framework/source/helper/vclstatusindicator.cxx2
-rw-r--r--framework/source/inc/pattern/window.hxx2
-rw-r--r--framework/source/layoutmanager/helpers.cxx12
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx32
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx66
-rw-r--r--framework/source/loadenv/loadenv.cxx16
-rw-r--r--framework/source/services/frame.cxx10
-rw-r--r--framework/source/services/taskcreatorsrv.cxx2
-rw-r--r--framework/source/tabwin/tabwindow.cxx14
-rw-r--r--framework/source/uielement/addonstoolbarmanager.cxx2
-rw-r--r--framework/source/uielement/addonstoolbarwrapper.cxx2
-rw-r--r--framework/source/uielement/menubarmanager.cxx4
-rw-r--r--framework/source/uielement/progressbarwrapper.cxx16
-rw-r--r--framework/source/uielement/statusbarwrapper.cxx2
-rw-r--r--framework/source/uielement/subtoolbarcontroller.cxx6
-rw-r--r--framework/source/uielement/toolbarmanager.cxx6
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx2
-rw-r--r--framework/source/uielement/toolbarwrapper.cxx2
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx2
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx6
-rw-r--r--sc/source/ui/miscdlgs/retypepassdlg.cxx2
-rw-r--r--sc/source/ui/sidebar/ScPanelFactory.cxx2
-rw-r--r--sc/source/ui/vba/vbaeventshelper.cxx12
-rw-r--r--sd/source/ui/framework/factories/FullScreenPane.cxx6
-rw-r--r--sd/source/ui/framework/factories/ViewShellWrapper.cxx4
-rw-r--r--sd/source/ui/presenter/PresenterCanvas.cxx14
-rw-r--r--sd/source/ui/presenter/PresenterHelper.cxx24
-rw-r--r--sd/source/ui/sidebar/PanelFactory.cxx4
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx11
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterService.cxx4
-rw-r--r--sfx2/source/appl/appserv.cxx2
-rw-r--r--sfx2/source/appl/newhelp.cxx4
-rw-r--r--sfx2/source/appl/sfxhelp.cxx2
-rw-r--r--sfx2/source/dialog/backingcomp.cxx6
-rw-r--r--sfx2/source/dialog/dockwin.cxx2
-rw-r--r--sfx2/source/dialog/mailmodel.cxx2
-rw-r--r--sfx2/source/doc/iframe.cxx2
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx2
-rw-r--r--sfx2/source/inet/inettbc.cxx2
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx2
-rw-r--r--sfx2/source/sidebar/ControllerFactory.cxx2
-rw-r--r--sfx2/source/sidebar/FocusManager.cxx4
-rw-r--r--sfx2/source/sidebar/UnoDeck.cxx2
-rw-r--r--sfx2/source/view/classificationcontroller.cxx4
-rw-r--r--sfx2/source/view/frame2.cxx2
-rw-r--r--sfx2/source/view/ipclient.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx2
-rw-r--r--sfx2/source/view/viewsh.cxx4
-rw-r--r--svtools/source/dialogs/wizardmachine.cxx2
-rw-r--r--svtools/source/hatchwindow/documentcloser.cxx2
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx4
-rw-r--r--svtools/source/uno/statusbarcontroller.cxx4
-rw-r--r--svtools/source/uno/svtxgridcontrol.cxx2
-rw-r--r--svtools/source/uno/unoiface.cxx120
-rw-r--r--svtools/source/uno/wizard/wizardpagecontroller.cxx8
-rw-r--r--svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx4
-rw-r--r--svx/source/fmcomp/fmgridif.cxx12
-rw-r--r--svx/source/fmcomp/gridctrl.cxx2
-rw-r--r--svx/source/gallery2/galbrws1.cxx2
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx4
-rw-r--r--svx/source/sidebar/PanelFactory.cxx2
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx2
-rw-r--r--svx/source/tbxctrls/linectrl.cxx3
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx4
-rw-r--r--svx/source/tbxctrls/tbunocontroller.cxx2
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx32
-rw-r--r--sw/source/ui/chrdlg/tblnumfm.cxx2
-rw-r--r--sw/source/ui/dialog/addrdlg.cxx2
-rw-r--r--sw/source/ui/frmdlg/uiborder.cxx2
-rw-r--r--sw/source/ui/index/cnttab.cxx8
-rw-r--r--sw/source/uibase/dbui/mailmergehelper.cxx3
-rw-r--r--sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx8
-rw-r--r--sw/source/uibase/sidebar/SwPanelFactory.cxx2
-rw-r--r--toolkit/source/awt/stylesettings.cxx10
-rw-r--r--toolkit/source/awt/vclxaccessiblecomponent.cxx8
-rw-r--r--toolkit/source/awt/vclxcontainer.cxx12
-rw-r--r--toolkit/source/awt/vclxsystemdependentwindow.cxx4
-rw-r--r--toolkit/source/awt/vclxtabpagecontainer.cxx4
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx18
-rw-r--r--toolkit/source/awt/vclxwindow.cxx31
-rw-r--r--toolkit/source/awt/vclxwindow1.cxx4
-rw-r--r--toolkit/source/awt/vclxwindows.cxx12
-rw-r--r--toolkit/source/controls/unocontrol.cxx2
-rw-r--r--vbahelper/source/msforms/vbacontrol.cxx4
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx2
-rw-r--r--vcl/source/window/dockmgr.cxx4
-rw-r--r--vcl/source/window/dockwin.cxx4
-rw-r--r--vcl/source/window/layout.cxx3
142 files changed, 499 insertions, 453 deletions
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx
index cacf65c5cf3b..194e52a870c0 100644
--- a/accessibility/source/extended/accessibleiconchoicectrl.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx
@@ -90,7 +90,7 @@ namespace accessibility
}
case VCLEVENT_WINDOW_GETFOCUS :
{
- SvtIconChoiceCtrl* pCtrl = getCtrl();
+ VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl();
if ( pCtrl && pCtrl->HasFocus() )
{
SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() );
@@ -167,7 +167,7 @@ namespace accessibility
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
- SvtIconChoiceCtrl* pCtrl = getCtrl();
+ VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl();
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry(i);
if ( !pEntry )
throw RuntimeException();
@@ -217,7 +217,7 @@ namespace accessibility
ensureAlive();
- SvtIconChoiceCtrl* pCtrl = getCtrl();
+ VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl();
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex );
if ( !pEntry )
throw IndexOutOfBoundsException();
@@ -231,7 +231,7 @@ namespace accessibility
ensureAlive();
- SvtIconChoiceCtrl* pCtrl = getCtrl();
+ VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl();
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex );
if ( !pEntry )
throw IndexOutOfBoundsException();
@@ -253,7 +253,7 @@ namespace accessibility
ensureAlive();
- SvtIconChoiceCtrl* pCtrl = getCtrl();
+ VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl();
sal_Int32 nCount = pCtrl->GetEntryCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
@@ -270,7 +270,7 @@ namespace accessibility
ensureAlive();
sal_Int32 nSelCount = 0;
- SvtIconChoiceCtrl* pCtrl = getCtrl();
+ VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl();
sal_Int32 nCount = pCtrl->GetEntryCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
@@ -293,7 +293,7 @@ namespace accessibility
Reference< XAccessible > xChild;
sal_Int32 nSelCount = 0;
- SvtIconChoiceCtrl* pCtrl = getCtrl();
+ VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl();
sal_Int32 nCount = pCtrl->GetEntryCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
@@ -322,7 +322,7 @@ namespace accessibility
Reference< XAccessible > xChild;
sal_Int32 nSelCount = 0;
- SvtIconChoiceCtrl* pCtrl = getCtrl();
+ VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl();
sal_Int32 nCount = pCtrl->GetEntryCount();
bool bFound = false;
for ( sal_Int32 i = 0; i < nCount; ++i )
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index fb9b58054d46..367e92a689c2 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -118,7 +118,7 @@ namespace accessibility
break;
case VCLEVENT_LISTBOX_TREEFOCUS:
{
- SvTreeListBox* pBox = getListBox();
+ VclPtr<SvTreeListBox> pBox = getListBox();
bool bNeedFocus = false;
if (pBox)
{
@@ -276,7 +276,7 @@ namespace accessibility
m_mapEntry.erase(mi);
}
- SvTreeListBox* pBox = getListBox();
+ VclPtr<SvTreeListBox> pBox = getListBox();
SvTreeListEntry* pEntryChild = pBox->FirstChild(pEntry);
while (pEntryChild)
{
@@ -351,7 +351,7 @@ namespace accessibility
ensureAlive();
sal_Int32 nCount = 0;
- SvTreeListBox* pSvTreeListBox = getListBox();
+ VclPtr<SvTreeListBox> pSvTreeListBox = getListBox();
if ( pSvTreeListBox )
nCount = pSvTreeListBox->GetLevelChildCount( nullptr );
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 5fd378821197..07a67088aa73 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -267,7 +267,7 @@ css::awt::Size SAL_CALL Paragraph::getSize()
void SAL_CALL Paragraph::grabFocus() throw (css::uno::RuntimeException, std::exception)
{
checkDisposed();
- vcl::Window* pWindow = m_xDocument->GetWindow();
+ VclPtr<vcl::Window> pWindow = m_xDocument->GetWindow();
if ( pWindow )
{
pWindow->GrabFocus();
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
index a147cb962735..7b5d87236990 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -288,7 +288,7 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX
{
Reference< XAccessibleContext > xContext;
- vcl::Window* pWindow = _pXWindow->GetWindow();
+ VclPtr<vcl::Window> pWindow = _pXWindow->GetWindow();
if ( pWindow )
{
WindowType nType = pWindow->GetType();
diff --git a/accessibility/source/standard/floatingwindowaccessible.cxx b/accessibility/source/standard/floatingwindowaccessible.cxx
index 7a3f1f59ac27..51aee0cec394 100644
--- a/accessibility/source/standard/floatingwindowaccessible.cxx
+++ b/accessibility/source/standard/floatingwindowaccessible.cxx
@@ -37,7 +37,7 @@ FloatingWindowAccessible::~FloatingWindowAccessible()
void FloatingWindowAccessible::FillAccessibleRelationSet(utl::AccessibleRelationSetHelper& rRelationSet)
{
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
vcl::Window* pParentWindow = pWindow->GetParent();
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index 9af428efa24f..6f3997ed1328 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -160,7 +160,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
{
pList->ProcessWindowEvent (rVclWindowEvent);
}
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if( pWindow && (pWindow->HasFocus() || pWindow->HasChildPathFocus()) )
{
Any aOldValue, aNewValue;
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
index 8b0faab35f21..b7feea96c46a 100644
--- a/accessibility/source/standard/vclxaccessiblebutton.cxx
+++ b/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -217,7 +217,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyB
OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
KeyEvent aKeyEvent = pWindow->GetActivationKey();
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index c50c827d2e03..9221c10dfa09 100644
--- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -234,7 +234,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKe
OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
KeyEvent aKeyEvent = pWindow->GetActivationKey();
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx
index 68e91f05182d..432315a35aea 100644
--- a/accessibility/source/standard/vclxaccessibleedit.cxx
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -79,7 +79,7 @@ void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve
sal_Int32 nOldCaretPosition = m_nCaretPosition;
m_nCaretPosition = getCaretPosition();
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if (pWindow && pWindow->HasChildPathFocus())
{
if (m_nCaretPosition != nOldCaretPosition)
@@ -94,7 +94,7 @@ void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve
break;
case VCLEVENT_EDIT_SELECTIONCHANGED:
{
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if (pWindow && pWindow->HasChildPathFocus())
{
NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() );
@@ -245,7 +245,7 @@ sal_Bool VCLXAccessibleEdit::doAccessibleAction ( sal_Int32 nIndex ) throw (Inde
throw IndexOutOfBoundsException();
bool bDoAction = false;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
pWindow->GrabFocus();
diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
index 131cd03ad146..23cae200edc4 100644
--- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx
+++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
@@ -193,7 +193,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActio
OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
KeyEvent aKeyEvent = pWindow->GetActivationKey();
diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx
index 4e5a9675b2c3..d1b7bced581d 100644
--- a/basctl/source/basicide/basicrenderable.cxx
+++ b/basctl/source/basicide/basicrenderable.cxx
@@ -93,7 +93,7 @@ sal_Int32 SAL_CALL Renderable::getRendererCount (
sal_Int32 nCount = 0;
if( mpWindow )
{
- if (Printer* pPrinter = getPrinter())
+ if (VclPtr<Printer> pPrinter = getPrinter())
{
nCount = mpWindow->countPages( pPrinter );
sal_Int64 nContent = getIntValue( "PrintContent", -1 );
@@ -124,7 +124,7 @@ Sequence<beans::PropertyValue> SAL_CALL Renderable::getRenderer (
Sequence< beans::PropertyValue > aVals;
// insert page size here
- Printer* pPrinter = getPrinter();
+ VclPtr<Printer> pPrinter = getPrinter();
// no renderdevice is legal; the first call is to get our print ui options
if( pPrinter )
{
@@ -152,7 +152,7 @@ void SAL_CALL Renderable::render (
if( mpWindow )
{
- if (Printer* pPrinter = getPrinter())
+ if (VclPtr<Printer> pPrinter = getPrinter())
{
sal_Int64 nContent = getIntValue( "PrintContent", -1 );
if( nContent == 1 )
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 351ce03e34fd..0afd147228dc 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -617,7 +617,7 @@ bool ModulWindow::BasicErrorHdl( StarBASIC * pBasic )
ErrorHandler::HandleError( StarBASIC::GetErrorCode() );
// #i47002#
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( !pWindow )
return false;
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 59c3006377ab..3f8f34c48624 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -320,7 +320,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
SfxViewFrame* pViewFrame = GetViewFrame();
if ( pViewFrame )
pViewFrame->ToTop();
- ModulWindow* pWin = FindBasWin( aDocument, aLibName, rInfo.GetModule(), true );
+ VclPtr<ModulWindow> pWin = FindBasWin( aDocument, aLibName, rInfo.GetModule(), true );
DBG_ASSERT( pWin, "Edit/Create Macro: Fenster wurde nicht erzeugt/gefunden!" );
SetCurWindow( pWin, true );
pWin->EditMacro( rInfo.GetMethod() );
@@ -344,13 +344,13 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
const SfxStringItem &rModName = static_cast<const SfxStringItem&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_MODULENAME ));
if ( aWindowTable.find( rTabId.GetValue() ) != aWindowTable.end() )
{
- BaseWindow* pWin = aWindowTable[ rTabId.GetValue() ];
+ VclPtr<BaseWindow> pWin = aWindowTable[ rTabId.GetValue() ];
const OUString& aNewName( rModName.GetValue() );
OUString aOldName( pWin->GetName() );
if ( aNewName != aOldName )
{
bool bRenameOk = false;
- if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin))
+ if (ModulWindow* pModWin = dynamic_cast<ModulWindow*>(pWin.get()))
{
OUString aLibName = pModWin->GetLibName();
ScriptDocument aDocument( pWin->GetDocument() );
@@ -365,7 +365,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
}
}
- else if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin))
+ else if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin.get()))
{
bRenameOk = pDlgWin->RenameDialog( aNewName );
}
@@ -396,7 +396,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
BasicManager* pBasMgr = const_cast<BasicManager*>(rInfo.GetBasicManager());
DBG_ASSERT( pBasMgr, "Store source: Kein BasMgr?" );
ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
- ModulWindow* pWin = FindBasWin( aDocument, rInfo.GetLib(), rInfo.GetModule(), false, true );
+ VclPtr<ModulWindow> pWin = FindBasWin( aDocument, rInfo.GetLib(), rInfo.GetModule(), false, true );
if ( pWin )
{
if ( rReq.GetSlot() == SID_BASICIDE_STOREMODULESOURCE )
@@ -522,7 +522,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
const SbxItem& rSbxItem = static_cast<const SbxItem&>(rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ));
const ScriptDocument& aDocument( rSbxItem.GetDocument() );
- BaseWindow* pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), true );
+ VclPtr<BaseWindow> pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), true );
if ( pWin )
RemoveWindow( pWin, true );
}
@@ -1103,7 +1103,7 @@ VclPtr<BaseWindow> Shell::FindWindow(
bool Shell::CallBasicErrorHdl( StarBASIC* pBasic )
{
bool bRet = false;
- ModulWindow* pModWin = ShowActiveModuleWindow( pBasic );
+ VclPtr<ModulWindow> pModWin = ShowActiveModuleWindow( pBasic );
if ( pModWin )
bRet = pModWin->BasicErrorHdl( pBasic );
return bRet;
@@ -1112,7 +1112,7 @@ bool Shell::CallBasicErrorHdl( StarBASIC* pBasic )
long Shell::CallBasicBreakHdl( StarBASIC* pBasic )
{
long nRet = 0;
- ModulWindow* pModWin = ShowActiveModuleWindow( pBasic );
+ VclPtr<ModulWindow> pModWin = ShowActiveModuleWindow( pBasic );
if ( pModWin )
{
bool bAppWindowDisabled, bDispatcherLocked;
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index 40bd5c4bc327..378d4c551bb4 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -208,8 +208,8 @@ VclPtr<ModulWindow> Shell::FindBasWin (
bool bCreateIfNotExist, bool bFindSuspended
)
{
- if (BaseWindow* pWin = FindWindow(rDocument, rLibName, rName, TYPE_MODULE, bFindSuspended))
- return VclPtr<ModulWindow>(static_cast<ModulWindow*>(pWin));
+ if (VclPtr<BaseWindow> pWin = FindWindow(rDocument, rLibName, rName, TYPE_MODULE, bFindSuspended))
+ return VclPtr<ModulWindow>(static_cast<ModulWindow*>(pWin.get()));
return bCreateIfNotExist ? CreateBasWin(rDocument, rLibName, rName) : nullptr;
}
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index f8458f67e385..218ef5772637 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -113,8 +113,8 @@ VclPtr<DialogWindow> Shell::FindDlgWin (
bool bCreateIfNotExist, bool bFindSuspended
)
{
- if (BaseWindow* pWin = FindWindow(rDocument, rLibName, rName, TYPE_DIALOG, bFindSuspended))
- return static_cast<DialogWindow*>(pWin);
+ if (VclPtr<BaseWindow> pWin = FindWindow(rDocument, rLibName, rName, TYPE_DIALOG, bFindSuspended))
+ return static_cast<DialogWindow*>(pWin.get());
return bCreateIfNotExist ? CreateDlgWin(rDocument, rLibName, rName) : nullptr;
}
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 2cea9d1d8b0b..e24794bf7a37 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -458,7 +458,7 @@ bool Shell::NextPage( bool bPrev )
if ( nPos < pTabBar->GetPageCount() )
{
- BaseWindow* pWin = aWindowTable[ pTabBar->GetPageId( nPos ) ];
+ VclPtr<BaseWindow> pWin = aWindowTable[ pTabBar->GetPageId( nPos ) ];
SetCurWindow( pWin, true );
bRet = true;
}
@@ -682,7 +682,7 @@ void Shell::UpdateWindows()
for ( sal_Int32 j = 0 ; j < nModCount ; j++ )
{
OUString aModName = pModNames[ j ];
- ModulWindow* pWin = FindBasWin( *doc, aLibName, aModName );
+ VclPtr<ModulWindow> pWin = FindBasWin( *doc, aLibName, aModName );
if ( !pWin )
pWin = CreateBasWin( *doc, aLibName, aModName );
if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aModName &&
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 5d939a7134c0..b88a89f3b348 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -169,7 +169,7 @@ bool RenameModule (
if (Shell* pShell = GetShell())
{
- if (ModulWindow* pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true))
+ if (VclPtr<ModulWindow> pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true))
{
// set new name in window
pWin->SetName( rNewName );
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index d406120b1d39..f3cdc49b6a70 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -158,7 +158,7 @@ bool RenameDialog (
}
Shell* pShell = GetShell();
- DialogWindow* pWin = pShell ? pShell->FindDlgWin(rDocument, rLibName, rOldName) : nullptr;
+ VclPtr<DialogWindow> pWin = pShell ? pShell->FindDlgWin(rDocument, rLibName, rOldName) : nullptr;
Reference< XNameContainer > xExistingDialog;
if ( pWin )
xExistingDialog = pWin->GetEditor().GetDialog();
@@ -195,7 +195,7 @@ bool RemoveDialog( const ScriptDocument& rDocument, const OUString& rLibName, co
{
if (Shell* pShell = GetShell())
{
- if (DialogWindow* pDlgWin = pShell->FindDlgWin(rDocument, rLibName, rDlgName))
+ if (VclPtr<DialogWindow> pDlgWin = pShell->FindDlgWin(rDocument, rLibName, rDlgName))
{
Reference< container::XNameContainer > xDialogModel = pDlgWin->GetDialog();
LocalizationMgr::removeResourceForDialog( rDocument, rLibName, rDlgName, xDialogModel );
diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx
index 6ee7bdd752d8..decf6d48f565 100644
--- a/basctl/source/basicide/localizationmgr.cxx
+++ b/basctl/source/basicide/localizationmgr.cxx
@@ -136,7 +136,7 @@ void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResou
for( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
{
OUString aDlgName = pDlgNames[ i ];
- if (DialogWindow* pWin = m_pShell->FindDlgWin(m_aDocument, m_aLibName, aDlgName))
+ if (VclPtr<DialogWindow> pWin = m_pShell->FindDlgWin(m_aDocument, m_aLibName, aDlgName))
{
Reference< container::XNameContainer > xDialog = pWin->GetDialog();
if( xDialog.is() )
diff --git a/canvas/source/cairo/cairo_spritecanvas.cxx b/canvas/source/cairo/cairo_spritecanvas.cxx
index 921850dd7fbf..906c220115ec 100644
--- a/canvas/source/cairo/cairo_spritecanvas.cxx
+++ b/canvas/source/cairo/cairo_spritecanvas.cxx
@@ -77,7 +77,7 @@ namespace cairocanvas
uno::Reference< awt::XWindow > xParentWindow;
maArguments[4] >>= xParentWindow;
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if( !pParentWindow )
throw lang::NoSupportException(
"Parent window not VCL window, or canvas out-of-process!", nullptr);
diff --git a/canvas/source/opengl/ogl_spritecanvas.cxx b/canvas/source/opengl/ogl_spritecanvas.cxx
index 7e6bc04c7204..c3bc92a3da7e 100644
--- a/canvas/source/opengl/ogl_spritecanvas.cxx
+++ b/canvas/source/opengl/ogl_spritecanvas.cxx
@@ -62,7 +62,7 @@ namespace oglcanvas
uno::Reference< awt::XWindow > xParentWindow;
maArguments[4] >>= xParentWindow;
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if( !pParentWindow )
throw lang::NoSupportException(
"Parent window not VCL window, or canvas out-of-process!", nullptr);
diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx
index 0b874e518e2e..fdf8ab7729a9 100644
--- a/canvas/source/tools/canvastools.cxx
+++ b/canvas/source/tools/canvastools.cxx
@@ -1141,7 +1141,7 @@ namespace canvas
{
awt::Rectangle aRetVal( rRect );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWin);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWin);
if( pWindow )
{
::Point aPoint( aRetVal.X,
diff --git a/canvas/source/vcl/windowoutdevholder.cxx b/canvas/source/vcl/windowoutdevholder.cxx
index 1afde92172f1..4776ee554878 100644
--- a/canvas/source/vcl/windowoutdevholder.cxx
+++ b/canvas/source/vcl/windowoutdevholder.cxx
@@ -32,7 +32,7 @@ namespace vclcanvas
{
vcl::Window& windowFromXWin( const uno::Reference<awt::XWindow>& xWin )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWin);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWin);
if( !pWindow )
throw lang::NoSupportException(
"Parent window not VCL window, or canvas out-of-process!",
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx
index a903d4b3a6d7..b06f6d456263 100644
--- a/chart2/source/controller/accessibility/AccessibleBase.cxx
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -681,7 +681,7 @@ awt::Rectangle SAL_CALL AccessibleBase::getBounds()
ExplicitValueProvider::getExplicitValueProvider( m_aAccInfo.m_xView ));
if( pExplicitValueProvider )
{
- vcl::Window* pWindow( VCLUnoHelper::GetWindow( m_aAccInfo.m_xWindow ));
+ VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( m_aAccInfo.m_xWindow ));
awt::Rectangle aLogicRect( pExplicitValueProvider->getRectangleOfObject( m_aAccInfo.m_aOID.getObjectCID() ));
if( pWindow )
{
diff --git a/chart2/source/controller/accessibility/AccessibleChartView.cxx b/chart2/source/controller/accessibility/AccessibleChartView.cxx
index f24951371df6..823c3b5872fc 100644
--- a/chart2/source/controller/accessibility/AccessibleChartView.cxx
+++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx
@@ -74,7 +74,7 @@ awt::Rectangle AccessibleChartView::GetWindowPosSize() const
awt::Rectangle aBBox( xWindow->getPosSize() );
- vcl::Window* pWindow( VCLUnoHelper::GetWindow( GetInfo().m_xWindow ));
+ VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( GetInfo().m_xWindow ));
if( pWindow )
{
SolarMutexGuard aSolarGuard;
@@ -322,7 +322,7 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments
aAccInfo.m_pParent = nullptr;
aAccInfo.m_spObjectHierarchy = m_spObjectHierarchy;
aAccInfo.m_pSdrView = m_pSdrView;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( m_xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( m_xWindow );
if ( m_pViewForwarder )
{
delete m_pViewForwarder;
diff --git a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
index e715e0775d3f..d7d4fdd5ae9b 100644
--- a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
+++ b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
@@ -81,7 +81,7 @@ void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArg
delete m_pTextHelper;
- vcl::Window* pWindow( VCLUnoHelper::GetWindow( xWindow ));
+ VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( xWindow ));
if( pWindow )
{
SdrView * pView = m_pDrawViewWrapper;
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
index 9d0e54ca4c42..bcffbbdfe7c2 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
@@ -38,7 +38,7 @@ NumberFormatDialog::NumberFormatDialog(vcl::Window* pParent, SfxItemSet& rSet)
::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );
if ( fnCreatePage )
{
- SfxTabPage* pTabPage = (*fnCreatePage)( get_content_area(), &rSet );
+ VclPtr<SfxTabPage> pTabPage = (*fnCreatePage)( get_content_area(), &rSet );
pTabPage->PageCreated(rSet);
SetTabPage(pTabPage);
}
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index e03a43c7e094..e45b280d6f94 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -313,7 +313,7 @@ uno::Reference< awt::XWindow > SAL_CALL ElementSelectorToolbarController::create
uno::Reference< awt::XWindow > xItemWindow;
if( !m_apSelectorListBox.get() )
{
- vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xParent );
if( pParent )
{
m_apSelectorListBox.reset( VclPtr<SelectorListBox>::Create( pParent, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER ) );
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
index 7265a07b1728..1da8c639343e 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -68,7 +68,7 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
Reference<css::awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<css::awt::XWindow>()));
Reference<css::frame::XController> xController (aArguments.getOrDefault("Controller", Reference<css::frame::XController>()));
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==nullptr)
throw RuntimeException(
"PanelFactory::createUIElement called without ParentWindow",
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 2b1da0280ca5..d6007a65537b 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -42,9 +42,11 @@ public:
bool VisitCXXDestructorDecl(const CXXDestructorDecl *);
bool VisitCXXDeleteExpr(const CXXDeleteExpr *);
bool VisitCallExpr(const CallExpr *);
- bool VisitDeclRefExpr(const DeclRefExpr* pDeclRefExpr);
- bool VisitCXXConstructExpr( const CXXConstructExpr* expr );
+ bool VisitDeclRefExpr(const DeclRefExpr *);
+ bool VisitCXXConstructExpr(const CXXConstructExpr *);
+ bool VisitBinaryOperator(const BinaryOperator *);
private:
+ void checkAssignmentForVclPtrToRawConversion(const Type* lhsType, const Expr* rhs);
bool isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl);
bool mbCheckingMemcpy = false;
};
@@ -241,6 +243,57 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
return true;
}
+bool VCLWidgets::VisitBinaryOperator(const BinaryOperator * binaryOperator)
+{
+ if (ignoreLocation(binaryOperator)) {
+ return true;
+ }
+ if ( !binaryOperator->isAssignmentOp() ) {
+ return true;
+ }
+ checkAssignmentForVclPtrToRawConversion(binaryOperator->getLHS()->getType().getTypePtr(), binaryOperator->getRHS());
+ return true;
+}
+
+// Look for places where we are accidentally assigning a returned-by-value VclPtr<T> to a T*, which generally
+// ends up in a use-after-free.
+void VCLWidgets::checkAssignmentForVclPtrToRawConversion(const Type* lhsType, const Expr* rhs)
+{
+ if (!lhsType || !isa<PointerType>(lhsType)) {
+ return;
+ }
+ if (!rhs) {
+ return;
+ }
+ // lots of null checking for something weird going in SW that tends to crash clang with:
+ // const clang::ExtQualsTypeCommonBase *clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type pointer"'
+ if (rhs->getType().getTypePtrOrNull()) {
+ if (const PointerType* pt = dyn_cast<PointerType>(rhs->getType())) {
+ const Type* pointeeType = pt->getPointeeType().getTypePtrOrNull();
+ if (pointeeType && !isa<SubstTemplateTypeParmType>(pointeeType)) {
+ return;
+ }
+ }
+ }
+ const CXXRecordDecl* pointeeClass = lhsType->getPointeeType()->getAsCXXRecordDecl();
+ if (!isDerivedFromVclReferenceBase(pointeeClass)) {
+ return;
+ }
+ const ExprWithCleanups* exprWithCleanups = dyn_cast<ExprWithCleanups>(rhs);
+ if (!exprWithCleanups) {
+ return;
+ }
+ const ImplicitCastExpr* implicitCast = dyn_cast<ImplicitCastExpr>(exprWithCleanups->getSubExpr());
+ if (!implicitCast) {
+ return;
+ }
+ //rhs->getType().dump();
+ report(
+ DiagnosticsEngine::Warning,
+ "assigning a returned-by-value VclPtr<T> to a T* variable is dodgy, should be assigned to a VclPtr",
+ rhs->getSourceRange().getBegin())
+ << rhs->getSourceRange();
+}
bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
if (ignoreLocation(pVarDecl)) {
@@ -249,6 +302,9 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
if (isa<ParmVarDecl>(pVarDecl)) {
return true;
}
+ if (pVarDecl->getInit()) {
+ checkAssignmentForVclPtrToRawConversion(pVarDecl->getType().getTypePtr(), pVarDecl->getInit());
+ }
StringRef aFileName = compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(pVarDecl->getLocStart()));
if (aFileName == SRCDIR "/include/vcl/vclptr.hxx")
return true;
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 36677728ec22..b41dd0052a89 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -976,7 +976,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, SelectFileTypeHdl, ComboBox&, void)
void TPGalleryThemeProperties::SearchFiles()
{
- SearchProgress* pProgress = VclPtr<SearchProgress>::Create( this, aURL );
+ VclPtrInstance<SearchProgress> pProgress( this, aURL );
aFoundList.clear();
m_pLbxFound->Clear();
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 01e97c794872..8bf720fa4b04 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1146,7 +1146,7 @@ VclPtr<AbstractSvxMultiPathDialog> AbstractDialogFactory_Impl::CreateSvxPathSele
VclPtr<AbstractSvxHpLinkDlg> AbstractDialogFactory_Impl::CreateSvxHpLinkDlg (vcl::Window* pParent,
SfxBindings* pBindings)
{
- SvxHpLinkDlg* pDlg = VclPtr<SvxHpLinkDlg>::Create( pParent, pBindings );
+ VclPtrInstance<SvxHpLinkDlg> pDlg( pParent, pBindings );
return VclPtr<AbstractSvxHpLinkDlg_Impl>::Create(pDlg);
}
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 7d968e38ab93..a9e9e306a8eb 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -2164,7 +2164,7 @@ void ExtensionsTabPage::CreateDialogWithHandler()
Reference< awt::XWindowPeer > xWinPeer( xPageControl->getPeer() );
if ( xWinPeer.is() )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWinPeer );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWinPeer );
if ( pWindow )
pWindow->SetStyle( pWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
}
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index 3325b3f9c703..b05a057ad6bd 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -466,7 +466,7 @@ SfxMacroAssignDlg::SfxMacroAssignDlg(vcl::Window* pParent,
: SfxSingleTabDialog(pParent, rSet, "EventAssignDialog",
"cui/ui/eventassigndialog.ui")
{
- SfxMacroTabPage* pPage = CreateSfxMacroTabPage(get_content_area(), rSet);
+ VclPtr<SfxMacroTabPage> pPage = CreateSfxMacroTabPage(get_content_area(), rSet);
pPage->SetFrame( rxDocumentFrame );
SetTabPage( pPage );
pPage->LaunchFillGroup();
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index 2a2ddb2cc263..43f4e01c9079 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -264,7 +264,7 @@ sal_Bool SAL_CALL ODBFilter::filter( const Sequence< PropertyValue >& rDescripto
if ( xWindow.is() )
{
SolarMutexGuard aGuard;
- vcl::Window* pFocusWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pFocusWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pFocusWindow )
pFocusWindow->LeaveWait();
}
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 5aa5f4f38f7d..6a60cec27c96 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1327,8 +1327,8 @@ void SbaTableQueryBrowser::implCheckExternalSlot( sal_uInt16 _nId )
if ( !m_xMainToolbar.is() )
return;
- vcl::Window* pToolboxWindow = VCLUnoHelper::GetWindow( m_xMainToolbar );
- ToolBox* pToolbox = dynamic_cast< ToolBox* >( pToolboxWindow );
+ VclPtr<vcl::Window> pToolboxWindow = VCLUnoHelper::GetWindow( m_xMainToolbar );
+ ToolBox* pToolbox = dynamic_cast< ToolBox* >( pToolboxWindow.get() );
OSL_ENSURE( pToolbox, "SbaTableQueryBrowser::implCheckExternalSlot: cannot obtain the toolbox window!" );
// check if we have to hide this item from the toolbox
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index 6b91673a704a..d764b507dd45 100644
--- a/dbaccess/source/ui/misc/databaseobjectview.cxx
+++ b/dbaccess/source/ui/misc/databaseobjectview.cxx
@@ -133,7 +133,7 @@ namespace dbaui
// "ThisComponent"-game for the global application Basic.
const Reference< XFrame > xFrame( m_xFrameLoader, UNO_QUERY_THROW );
const Reference< XWindow > xFrameWindow( xFrame->getContainerWindow(), UNO_SET_THROW );
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xFrameWindow );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xFrameWindow );
ENSURE_OR_THROW( pContainerWindow, "no implementation access to the frame's container window!" );
pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
}
diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
index 0bd4d514c74b..1ddeaf5dbcc0 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
@@ -49,7 +49,7 @@ namespace
*/
Rectangle GetTextPos(const OTableWindow* _pWin, const Point& _aConnPos,const Point& _aDescrLinePos)
{
- OTableWindowListBox* pListBox = _pWin ? _pWin->GetListBox() : nullptr;
+ VclPtr<OTableWindowListBox> pListBox = _pWin ? _pWin->GetListBox() : nullptr;
OSL_ENSURE(_pWin && pListBox, "OConnectionLine::GetSourceTextPos : invalid call !");
Rectangle aReturn;
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 52d2de8844e9..d87cff6e5b79 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -220,7 +220,7 @@ void OJoinTableView::Resize()
m_aScrollOffset.X() = GetHScrollBar().GetThumbPos();
m_aScrollOffset.Y() = GetVScrollBar().GetThumbPos();
- OTableWindow* pCheck = m_aTableMap.begin()->second;
+ VclPtr<OTableWindow> pCheck = m_aTableMap.begin()->second;
Point aRealPos = pCheck->GetPosPixel();
Point aAssumedPos = pCheck->GetData()->GetPosition() - GetScrollOffset();
@@ -1438,7 +1438,7 @@ void OJoinTableView::GrabTabWinFocus()
}
else if (!m_aTableMap.empty() && m_aTableMap.begin()->second && m_aTableMap.begin()->second->IsVisible())
{
- OTableWindow* pFirstWin = m_aTableMap.begin()->second;
+ VclPtr<OTableWindow> pFirstWin = m_aTableMap.begin()->second;
if (pFirstWin->GetListBox())
pFirstWin->GetListBox()->GrabFocus();
else
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 4f26fc9287df..ea8f22f0976e 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -328,7 +328,7 @@ void OSelectionBrowseBox::Init()
EditBrowseBox::Init();
// set the header bar
- BrowserHeader* pNewHeaderBar = CreateHeaderBar(this);
+ VclPtr<BrowserHeader> pNewHeaderBar = CreateHeaderBar(this);
pNewHeaderBar->SetMouseTransparent(false);
SetHeaderBar(pNewHeaderBar);
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
index d4b3a13bb123..cf17ee449068 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
@@ -195,7 +195,7 @@ uno::Reference< awt::XWindow > SAL_CALL LimitBoxController::createItemWindow(
{
uno::Reference< awt::XWindow > xItemWindow;
- vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xParent );
if ( pParent )
{
SolarMutexGuard aSolarMutexGuard;
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 6dac16d1492c..718611b984e1 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -284,7 +284,7 @@ namespace
if (xUIElement.is())
{
Reference< XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( pWindow && pWindow->HasChildPathFocus() )
{
pWindow->GrabFocusToDocument();
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index badeca5cc707..7abfdda84c89 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2391,7 +2391,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
xStartModule->attachFrame(xBackingFrame);
xContainerWindow->setVisible(true);
- vcl::Window* pCompWindow = VCLUnoHelper::GetWindow(xBackingFrame->getComponentWindow());
+ VclPtr<vcl::Window> pCompWindow = VCLUnoHelper::GetWindow(xBackingFrame->getComponentWindow());
if (pCompWindow)
pCompWindow->Update();
}
@@ -2606,7 +2606,7 @@ void Desktop::ShowBackingComponent(Desktop * progress)
// set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank"
// frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior,
// otherwise documents loaded into this frame will later on miss functionality depending on the style.
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
SAL_WARN_IF( !pContainerWindow, "desktop.app", "Desktop::Main: no implementation access to the frame's container window!" );
pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
if (progress != nullptr)
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 8a06c039a235..846305510397 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -152,18 +152,15 @@ namespace drawinglayer
if(pVCLXWindow)
{
- vcl::Window* pWindow = pVCLXWindow->GetWindow();
+ VclPtr<vcl::Window> pWindow = pVCLXWindow->GetWindow();
if(pWindow)
{
pWindow = pWindow->GetParent();
- if(pWindow)
+ if(pWindow && MapUnit::Map100thMM == pWindow->GetMapMode().GetMapUnit())
{
- if(MapUnit::Map100thMM == pWindow->GetMapMode().GetMapUnit())
- {
- bUserIs100thmm = true;
- }
+ bUserIs100thmm = true;
}
}
}
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
index 6144d9ef0ff1..c48bbe5b960e 100644
--- a/extensions/source/bibliography/bibload.cxx
+++ b/extensions/source/bibliography/bibload.cxx
@@ -270,7 +270,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(aWindow);
assert(pParentComponent);
- vcl::Window* pParent = VCLUnoHelper::GetWindow( aWindow );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( aWindow );
VclPtrInstance<BibBookContainer> pMyWindow( pParent );
pMyWindow->Show();
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index f07e61b156e1..c1979822dea3 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -404,7 +404,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen
if ( !bDisposing )
{
::SolarMutexGuard aGuard;
- vcl::Window* pParent = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xWindow );
WaitObject aWaitObject( pParent );
OUString aCommand( _rURL.Path);
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 1cc434f8c0d9..c963356cc0be 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -502,7 +502,7 @@ uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl(
xCtrWin->setVisible( true );
xControl->setDesignMode( true );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
pWindow->set_grid_top_attach(rLabel.get_grid_top_attach());
pWindow->set_grid_left_attach(rLabel.get_grid_left_attach()+1);
pWindow->set_valign(VclAlign::Center);
@@ -658,7 +658,7 @@ bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent )
uno::Reference< awt::XControl > xControl( aControls[ nCtrlIndex ], UNO_QUERY );
DBG_ASSERT( xControl.is(), "-BibGeneralPage::HandleShortCutKey(): a control which is not a control!" );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() );
if( pWindow )
{
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index ae1f136a93cd..43fdf3ed956e 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2705,7 +2705,7 @@ namespace pcr
if ( !fnCreatePage )
throw RuntimeException(); // caught below
- SfxTabPage* pPage = (*fnCreatePage)( xDialog->get_content_area(), &aCoreSet );
+ VclPtr<SfxTabPage> pPage = (*fnCreatePage)( xDialog->get_content_area(), &aCoreSet );
xDialog->SetTabPage( pPage );
_rClearBeforeDialog.clear();
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx
index eedefcd36da5..afab7e871798 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -71,9 +71,9 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponent
uno::Reference<awt::XWindow> xWindow = xTarget->getContainerWindow();
if (xWindow.is())
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if (pWindow->IsSystemWindow())
- m_pSysWindow = dynamic_cast<SystemWindow*>(pWindow);
+ m_pSysWindow = dynamic_cast<SystemWindow*>(pWindow.get());
}
}
@@ -603,7 +603,7 @@ css::uno::Reference< css::frame::XFrame > CloseDispatcher::static_impl_searchRig
// Because sometimes VCL create "implicit border windows" as parents even we created
// a simple XWindow using the toolkit only .-(
SolarMutexGuard aSolarLock;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if (
(pWindow ) &&
(pWindow->IsSystemWindow())
diff --git a/framework/source/dispatch/windowcommanddispatch.cxx b/framework/source/dispatch/windowcommanddispatch.cxx
index bc9e6389d707..1470007553ae 100644
--- a/framework/source/dispatch/windowcommanddispatch.cxx
+++ b/framework/source/dispatch/windowcommanddispatch.cxx
@@ -62,7 +62,7 @@ void WindowCommandDispatch::impl_startListening()
{
SolarMutexGuard aSolarLock;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if ( ! pWindow)
return;
@@ -82,7 +82,7 @@ void WindowCommandDispatch::impl_stopListening()
{
SolarMutexGuard aSolarLock;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if (!pWindow)
return;
diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx
index 911833596342..6cfb1f075c00 100644
--- a/framework/source/helper/persistentwindowstate.cxx
+++ b/framework/source/helper/persistentwindowstate.cxx
@@ -213,7 +213,7 @@ OUString PersistentWindowState::implst_getWindowStateFromWindow(const css::uno::
// SOLAR SAFE -> ------------------------
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
// check for system window is necessary to guarantee correct pointer cast!
if (
(pWindow ) &&
@@ -222,7 +222,7 @@ OUString PersistentWindowState::implst_getWindowStateFromWindow(const css::uno::
{
WindowStateMask nMask = WindowStateMask::All & ~(WindowStateMask::Minimized);
sWindowState = OStringToOUString(
- static_cast<SystemWindow*>(pWindow)->GetWindowState(nMask),
+ static_cast<SystemWindow*>(pWindow.get())->GetWindowState(nMask),
RTL_TEXTENCODING_UTF8);
}
// <- SOLAR SAFE ------------------------
@@ -243,7 +243,7 @@ void PersistentWindowState::implst_setWindowStateOnWindow(const css::uno::Refere
// SOLAR SAFE -> ------------------------
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if (!pWindow)
return;
@@ -254,8 +254,8 @@ void PersistentWindowState::implst_setWindowStateOnWindow(const css::uno::Refere
if (!bSystemWindow && !bWorkWindow)
return;
- SystemWindow* pSystemWindow = static_cast<SystemWindow*>(pWindow);
- WorkWindow* pWorkWindow = static_cast<WorkWindow* >(pWindow);
+ SystemWindow* pSystemWindow = static_cast<SystemWindow*>(pWindow.get());
+ WorkWindow* pWorkWindow = static_cast<WorkWindow* >(pWindow.get());
// don't save this special state!
if (pWorkWindow->IsMinimized())
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index 67432898f664..9f4d658ed2c4 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -373,7 +373,7 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed()
impl_showProgress();
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( pWindow )
{
bool bForceFrontAndFocus(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get(xContext));
diff --git a/framework/source/helper/tagwindowasmodified.cxx b/framework/source/helper/tagwindowasmodified.cxx
index 5f47e85e5854..47eb85bdedbb 100644
--- a/framework/source/helper/tagwindowasmodified.cxx
+++ b/framework/source/helper/tagwindowasmodified.cxx
@@ -88,7 +88,7 @@ void SAL_CALL TagWindowAsModified::modified(const css::lang::EventObject& aEvent
// SYNCHRONIZED ->
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if ( ! pWindow)
return;
diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx
index 4977e97bd40f..0f600e5a01bd 100644
--- a/framework/source/helper/titlebarupdate.cxx
+++ b/framework/source/helper/titlebarupdate.cxx
@@ -170,13 +170,13 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr
// VCL SYNCHRONIZED ->
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = (VCLUnoHelper::GetWindow( xWindow ));
+ VclPtr<vcl::Window> pWindow = (VCLUnoHelper::GetWindow( xWindow ));
if (
( pWindow ) &&
( pWindow->GetType() == WINDOW_WORKWINDOW )
)
{
- WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow);
+ WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get());
pWorkWindow->SetApplicationID( sApplicationID );
}
// <- VCL SYNCHRONIZED
@@ -287,13 +287,13 @@ void TitleBarUpdate::impl_updateIcon(const css::uno::Reference< css::frame::XFra
// VCL SYNCHRONIZED ->
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = (VCLUnoHelper::GetWindow( xWindow ));
+ VclPtr<vcl::Window> pWindow = (VCLUnoHelper::GetWindow( xWindow ));
if (
( pWindow ) &&
( pWindow->GetType() == WINDOW_WORKWINDOW )
)
{
- WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow);
+ WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get());
pWorkWindow->SetIcon( (sal_uInt16)nIcon );
css::uno::Reference< css::frame::XModel > xModel = xController->getModel();
@@ -321,13 +321,13 @@ void TitleBarUpdate::impl_updateTitle(const css::uno::Reference< css::frame::XFr
// VCL SYNCHRONIZED ->
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = (VCLUnoHelper::GetWindow( xWindow ));
+ VclPtr<vcl::Window> pWindow = (VCLUnoHelper::GetWindow( xWindow ));
if (
( pWindow ) &&
( pWindow->GetType() == WINDOW_WORKWINDOW )
)
{
- WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow);
+ WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get());
pWorkWindow->SetText( sTitle );
}
// <- VCL SYNCHRONIZED
diff --git a/framework/source/helper/vclstatusindicator.cxx b/framework/source/helper/vclstatusindicator.cxx
index 463cba642206..1ca763ed5cd7 100644
--- a/framework/source/helper/vclstatusindicator.cxx
+++ b/framework/source/helper/vclstatusindicator.cxx
@@ -46,7 +46,7 @@ void SAL_CALL VCLStatusIndicator::start(const OUString& sText ,
{
SolarMutexGuard aSolarGuard;
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(m_xParentWindow);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(m_xParentWindow);
if (!m_pStatusBar)
m_pStatusBar = VclPtr<StatusBar>::Create(pParentWindow, WB_3DLOOK|WB_BORDER);
diff --git a/framework/source/inc/pattern/window.hxx b/framework/source/inc/pattern/window.hxx
index 87c95ad04174..04aa9d0a4ead 100644
--- a/framework/source/inc/pattern/window.hxx
+++ b/framework/source/inc/pattern/window.hxx
@@ -54,7 +54,7 @@ static bool isTopWindow(const css::uno::Reference< css::awt::XWindow >& xWindow)
// Because sometimes VCL create "implicit border windows" as parents even we created
// a simple XWindow using the toolkit only .-(
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if (
(pWindow ) &&
(pWindow->IsSystemWindow())
diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx
index e7f1d0dba93b..7bf7a3d72660 100644
--- a/framework/source/layoutmanager/helpers.cxx
+++ b/framework/source/layoutmanager/helpers.cxx
@@ -118,12 +118,12 @@ vcl::Window* getWindowFromXUIElement( const uno::Reference< ui::XUIElement >& xU
SystemWindow* getTopSystemWindow( const uno::Reference< awt::XWindow >& xWindow )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
while ( pWindow && !pWindow->IsSystemWindow() )
pWindow = pWindow->GetParent();
if ( pWindow )
- return static_cast<SystemWindow *>(pWindow);
+ return static_cast<SystemWindow *>(pWindow.get());
else
return nullptr;
}
@@ -150,10 +150,10 @@ bool lcl_checkUIElement(const uno::Reference< ui::XUIElement >& xUIElement, awt:
_xWindow.set( xUIElement->getRealInterface(), uno::UNO_QUERY );
_rPosSize = _xWindow->getPosSize();
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( _xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( _xWindow );
if ( pWindow->GetType() == WINDOW_TOOLBOX )
{
- ::Size aSize = static_cast<ToolBox*>(pWindow)->CalcWindowSizePixel( 1 );
+ ::Size aSize = static_cast<ToolBox*>(pWindow.get())->CalcWindowSizePixel( 1 );
_rPosSize.Width = aSize.Width();
_rPosSize.Height = aSize.Height();
}
@@ -291,8 +291,8 @@ bool implts_isFrameOrWindowTop( const uno::Reference< frame::XFrame >& xFrame )
// #i76867# top and system window is required.
SolarMutexGuard aGuard;
uno::Reference< awt::XWindow > xWindow( xWindowCheck, uno::UNO_QUERY );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- return ( pWindow && pWindow->IsSystemWindow() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ return pWindow && pWindow->IsSystemWindow();
}
return false;
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index c43ba899a659..e808aabc70ff 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -897,10 +897,10 @@ void LayoutManager::implts_createProgressBar()
Reference< awt::XWindow > xStatusBarWindow = pWrapper->getStatusBar();
SolarMutexGuard aGuard;
- vcl::Window* pStatusBarWnd = VCLUnoHelper::GetWindow( xStatusBarWindow );
+ VclPtr<vcl::Window> pStatusBarWnd = VCLUnoHelper::GetWindow( xStatusBarWindow );
if ( !pStatusBarWnd )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
if ( pWindow )
{
VclPtrInstance<StatusBar> pStatusBar( pWindow, WinBits( WB_LEFT | WB_3DLOOK ) );
@@ -982,14 +982,14 @@ void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Siz
if ( xWindow.is() )
{
SolarMutexGuard aGuard;
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xContainerWindow );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pParentWindow && ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR ))
{
vcl::Window* pOldParentWindow = pWindow->GetParent();
if ( pParentWindow != pOldParentWindow )
pWindow->SetParent( pParentWindow );
- static_cast<StatusBar *>(pWindow)->SetPosSizePixel( rPos, rSize );
+ static_cast<StatusBar *>(pWindow.get())->SetPosSizePixel( rPos, rSize );
}
}
}
@@ -1024,7 +1024,7 @@ bool LayoutManager::implts_showProgressBar()
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow )
{
if ( !pWindow->IsVisible() )
@@ -1064,7 +1064,7 @@ bool LayoutManager::implts_hideProgressBar()
implts_readStatusBarState( STATUS_BAR_ALIAS );
bHideStatusBar = !m_aStatusBarElement.m_bVisible;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->IsVisible() && ( bHideStatusBar || bInternalStatusBar ))
{
implts_setOffset( 0 );
@@ -1089,7 +1089,7 @@ bool LayoutManager::implts_showStatusBar( bool bStoreState )
Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY );
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && !pWindow->IsVisible() )
{
implts_setOffset( pWindow->GetSizePixel().Height() );
@@ -1115,7 +1115,7 @@ bool LayoutManager::implts_hideStatusBar( bool bStoreState )
Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY );
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->IsVisible() )
{
implts_setOffset( 0 );
@@ -1301,7 +1301,7 @@ throw ( RuntimeException, std::exception )
if ( pToolbarManager )
pToolbarManager->resetDockingArea();
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pContainerWindow )
pContainerWindow->RemoveChildEventListener( LINK( this, LayoutManager, WindowEventListener ) );
}
@@ -1323,7 +1323,7 @@ throw ( RuntimeException, std::exception )
// and we get no notification anymore
{
SolarMutexGuard aGuard;
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
if( pContainerWindow )
m_bParentWindowVisible = pContainerWindow->IsVisible();
}
@@ -1339,7 +1339,7 @@ throw ( RuntimeException, std::exception )
SolarMutexGuard aGuard;
// Add layout manager as listener to get notifications about toolbar button activities
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
if ( pContainerWindow )
pContainerWindow->AddChildEventListener( LINK( this, LayoutManager, WindowEventListener ) );
@@ -1394,8 +1394,8 @@ void LayoutManager::implts_reparentChildWindows()
if ( xStatusBarWindow.is() )
{
SolarMutexGuard aGuard;
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xStatusBarWindow );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xStatusBarWindow );
if ( pWindow && pContainerWindow )
pWindow->SetParent( pContainerWindow );
}
@@ -1666,7 +1666,7 @@ throw (uno::RuntimeException, std::exception)
// we need VCL here to pass special flags to Show()
SolarMutexGuard aGuard;
Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow )
{
pWindow->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
@@ -2118,7 +2118,7 @@ throw (RuntimeException, std::exception)
if ( xWindow.is() )
{
SolarMutexGuard g;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->IsVisible() )
return true;
else
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 4424595343b3..583d622ae3e1 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -279,7 +279,7 @@ Rectangle ToolbarLayoutManager::implts_calcDockingArea()
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && !xDockWindow->isFloating() && pConstIter->m_bVisible && !pConstIter->m_bMasterHide )
{
awt::Rectangle aPosSize = xWindow->getPosSize();
@@ -532,10 +532,10 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL )
SvtCommandOptions aCmdOptions;
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
{
- ToolBox* pToolbar = static_cast<ToolBox *>(pWindow);
+ ToolBox* pToolbar = static_cast<ToolBox *>(pWindow.get());
ToolBoxMenuType nMenuType = pToolbar->GetMenuType();
if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, "ConfigureDialog" ))
pToolbar->SetMenuType( nMenuType & ~ToolBoxMenuType::Customize );
@@ -1157,12 +1157,12 @@ void ToolbarLayoutManager::implts_createAddonsToolBars()
{
// Set generic title for add-on toolbar
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow->GetText().isEmpty() )
pWindow->SetText( aGenericAddonTitle );
if ( pWindow->GetType() == WINDOW_TOOLBOX )
{
- ToolBox* pToolbar = static_cast<ToolBox *>(pWindow);
+ ToolBox* pToolbar = static_cast<ToolBox *>(pWindow.get());
pToolbar->SetMenuType();
}
}
@@ -1329,11 +1329,11 @@ void ToolbarLayoutManager::implts_reparentToolbars()
{
SolarMutexClearableGuard aWriteLock;
UIElementVector aUIElementVector = m_aUIElements;
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
- vcl::Window* pTopDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
- vcl::Window* pBottomDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] );
- vcl::Window* pLeftDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
- vcl::Window* pRightDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
+ VclPtr<vcl::Window> pTopDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
+ VclPtr<vcl::Window> pBottomDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] );
+ VclPtr<vcl::Window> pLeftDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
+ VclPtr<vcl::Window> pRightDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
aWriteLock.clear();
SolarMutexGuard aGuard;
@@ -1360,7 +1360,7 @@ void ToolbarLayoutManager::implts_reparentToolbars()
{
}
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow )
{
// Reparent our child windows according to their current state.
@@ -1696,7 +1696,7 @@ uno::Reference< awt::XWindow > ToolbarLayoutManager::implts_getXWindow( const OU
vcl::Window* ToolbarLayoutManager::implts_getWindow( const OUString& aName )
{
uno::Reference< awt::XWindow > xWindow = implts_getXWindow( aName );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
return pWindow;
}
@@ -1754,7 +1754,7 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos()
if ( xContainerWindow.is() )
{
SolarMutexGuard aGuard;
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
if ( pContainerWindow )
aStartPos = AWTPoint(pContainerWindow->OutputToScreenPixel(VCLPoint(aStartPos)));
}
@@ -1778,7 +1778,7 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos()
if ( xDockWindow.is() && xDockWindow->isFloating() )
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->IsVisible() )
{
awt::Rectangle aFloatRect = xWindow->getPosSize();
@@ -2048,7 +2048,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
if ( xWindow.is() )
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
if ( pWindow && pIter->m_bVisible && xDockWindow.is() && !pIter->m_bFloating )
aWindowVector.push_back( *pIter ); // docked windows
@@ -2145,8 +2145,8 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
else
{
SolarMutexClearableGuard aReadLock;
- vcl::Window* pContainerWindow( VCLUnoHelper::GetWindow( m_xContainerWindow ));
- vcl::Window* pDockingAreaWindow( VCLUnoHelper::GetWindow( m_xDockAreaWindows[DockingArea] ));
+ VclPtr<vcl::Window> pContainerWindow( VCLUnoHelper::GetWindow( m_xContainerWindow ));
+ VclPtr<vcl::Window> pDockingAreaWindow( VCLUnoHelper::GetWindow( m_xDockAreaWindows[DockingArea] ));
aReadLock.clear();
// Calc correct position of the column/row rectangle to be able to compare it with mouse pos/tracking rect
@@ -2468,9 +2468,9 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
SolarMutexGuard aGuard;
{
uno::Reference< awt::XWindow > xWindow = rRowColumnWindowData.aRowColumnWindows[i];
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
- aMinSize = static_cast<ToolBox *>(pWindow)->CalcMinimumWindowSizePixel();
+ aMinSize = static_cast<ToolBox *>(pWindow.get())->CalcMinimumWindowSizePixel();
}
if (( aMinSize.Width() > 0 ) && ( aMinSize.Height() > 0 ))
@@ -2521,7 +2521,7 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
}
SolarMutexClearableGuard aReadLock;
- vcl::Window* pDockAreaWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[nDockingArea] );
+ VclPtr<vcl::Window> pDockAreaWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[nDockingArea] );
aReadLock.clear();
sal_Int32 nCurrPos( 0 );
@@ -2530,7 +2530,7 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
for ( sal_uInt32 i = 0; i < nCount; i++ )
{
uno::Reference< awt::XWindow > xWindow = rRowColumnWindowData.aRowColumnWindows[i];
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
vcl::Window* pOldParentWindow = pWindow->GetParent();
if ( pDockAreaWindow != pOldParentWindow )
@@ -2630,9 +2630,9 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
{
SolarMutexGuard aGuard;
pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow );
- vcl::Window* pDockWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pDockWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pDockWindow && pDockWindow->GetType() == WINDOW_TOOLBOX )
- pToolBox = static_cast<ToolBox *>(pDockWindow);
+ pToolBox = static_cast<ToolBox *>(pDockWindow.get());
aDockingAreaRect = ::Rectangle( pDockingAreaWindow->GetPosPixel(), pDockingAreaWindow->GetSizePixel() );
if ( pToolBox )
@@ -3068,7 +3068,7 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d
{
SolarMutexGuard aGuard;
pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow );
- vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
nDockPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( ::Point( 0, nPosY ))).Y();
}
@@ -3282,10 +3282,10 @@ throw (uno::RuntimeException, std::exception)
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
{
- ToolBox* pToolBox = static_cast<ToolBox *>(pWindow);
+ ToolBox* pToolBox = static_cast<ToolBox *>(pWindow.get());
aUIElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines();
aUIElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox );
}
@@ -3352,7 +3352,7 @@ throw (uno::RuntimeException, std::exception)
::Rectangle aRightDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width ), ( aTmpRect.Y + aTmpRect.Height ));
::Rectangle aHotZoneRightDockRect( implts_calcHotZoneRect( aRightDockRect, nMagneticZone ));
- vcl::Window* pContainerWindow( VCLUnoHelper::GetWindow( xContainerWindow ) );
+ VclPtr<vcl::Window> pContainerWindow( VCLUnoHelper::GetWindow( xContainerWindow ) );
::Point aMousePos( pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y )));
if ( aHotZoneTopDockRect.IsInside( aMousePos ))
@@ -3375,10 +3375,10 @@ throw (uno::RuntimeException, std::exception)
eDockingArea = ui::DockingArea_DOCKINGAREA_RIGHT;
// Determine if we have a toolbar and set alignment according to the docking area!
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
ToolBox* pToolBox = nullptr;
if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
- pToolBox = static_cast<ToolBox *>(pWindow);
+ pToolBox = static_cast<ToolBox *>(pWindow.get());
if ( eDockingArea != -1 )
{
@@ -3528,10 +3528,10 @@ throw (uno::RuntimeException, std::exception)
if ( bDockingInProgress )
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( uno::Reference< awt::XWindow >( e.Source, uno::UNO_QUERY ));
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( uno::Reference< awt::XWindow >( e.Source, uno::UNO_QUERY ));
ToolBox* pToolBox = nullptr;
if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
- pToolBox = static_cast<ToolBox *>(pWindow);
+ pToolBox = static_cast<ToolBox *>(pWindow.get());
if ( pToolBox )
{
@@ -3589,10 +3589,10 @@ throw (uno::RuntimeException, std::exception)
{
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
{
- ToolBox* pToolBox = static_cast< ToolBox *>( pWindow );
+ ToolBox* pToolBox = static_cast< ToolBox *>( pWindow.get() );
aUIDockingElement.m_aFloatingData.m_aPos = AWTPoint(pToolBox->GetPosPixel());
aUIDockingElement.m_aFloatingData.m_aSize = AWTSize(pToolBox->GetOutputSizePixel());
aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines();
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index c225542be62f..27285125f464 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1445,7 +1445,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget()
if (xModified->isModified())
return css::uno::Reference< css::frame::XFrame >();
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xTask->getContainerWindow());
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xTask->getContainerWindow());
if (pWindow && pWindow->IsInModalMode())
return css::uno::Reference< css::frame::XFrame >();
@@ -1519,10 +1519,10 @@ void LoadEnv::impl_reactForLoadingState()
if (bMinimized)
{
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
// check for system window is necessary to guarantee correct pointer cast!
if (pWindow && pWindow->IsSystemWindow())
- static_cast<WorkWindow*>(pWindow)->Minimize();
+ static_cast<WorkWindow*>(pWindow.get())->Minimize();
}
else if (!bHidden)
{
@@ -1627,7 +1627,7 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X
// <- SAFE ----------------------------------
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if ( pWindow )
{
bool const preview( m_lMediaDescriptor.getUnpackedValueOrDefault(
@@ -1671,7 +1671,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw
// SOLAR SAFE ->
SolarMutexClearableGuard aSolarGuard1;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if (!pWindow)
return;
@@ -1682,7 +1682,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw
return;
// don't overwrite this special state!
- WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow);
+ WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get());
if (pWorkWindow->IsMinimized())
return;
@@ -1739,11 +1739,11 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw
// But if we get a valid pointer we can be sure, that it's the system window pointer
// we already checked and used before. Because nobody recycle the same uno reference for
// a new internal c++ implementation ... hopefully .-))
- vcl::Window* pWindowCheck = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindowCheck = VCLUnoHelper::GetWindow(xWindow);
if (! pWindowCheck)
return;
- SystemWindow* pSystemWindow = static_cast<SystemWindow*>(pWindowCheck);
+ SystemWindow* pSystemWindow = static_cast<SystemWindow*>(pWindowCheck.get());
pSystemWindow->SetWindowState(OUStringToOString(sWindowState,RTL_TEXTENCODING_UTF8));
// <- SOLAR SAFE
}
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index a1b4fe6f78f6..09e5104652f6 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -873,7 +873,7 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >&
m_xContainerWindow = xWindow;
// if window is initially visible, we will never get a windowShowing event
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if (pWindow && pWindow->IsVisible())
m_bIsHidden = false;
@@ -1540,7 +1540,7 @@ sal_Bool SAL_CALL Frame::setComponent(const css::uno::Reference< css::awt::XWind
css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow;
css::uno::Reference< css::awt::XWindow > xOldComponentWindow = m_xComponentWindow;
css::uno::Reference< css::frame::XController > xOldController = m_xController;
- vcl::Window* pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ VclPtr<vcl::Window> pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow );
bool bHadFocus = pOwnWindow->HasChildPathFocus();
bool bWasConnected = m_bConnected;
aReadLock.clear();
@@ -2660,7 +2660,7 @@ void SAL_CALL Frame::windowDeactivated( const css::lang::EventObject& )
)
{
css::uno::Reference< css::awt::XWindow > xParentWindow = xParent->getContainerWindow();
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
//#i70261#: dialogs opened from an OLE object will cause a deactivate on the frame of the OLE object
// on Solaris/Linux at that time pFocusWindow is still NULL because the focus handling is different; right after
// the deactivation the focus will be set into the dialog!
@@ -3218,13 +3218,13 @@ void Frame::implts_setIconOnWindow()
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
{
SolarMutexGuard aSolarGuard;
- vcl::Window* pWindow = (VCLUnoHelper::GetWindow( xContainerWindow ));
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
if(
( pWindow != nullptr ) &&
( pWindow->GetType() == WINDOW_WORKWINDOW )
)
{
- WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow);
+ WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get());
pWorkWindow->SetIcon( (sal_uInt16)nIcon );
}
}
diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx
index 11203415d74e..8757f8ae0d12 100644
--- a/framework/source/services/taskcreatorsrv.cxx
+++ b/framework/source/services/taskcreatorsrv.cxx
@@ -216,7 +216,7 @@ void TaskCreatorService::implts_applyDocStyleToWindow(const css::uno::Reference<
{
// SYNCHRONIZED ->
SolarMutexGuard aSolarGuard;
- vcl::Window* pVCLWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pVCLWindow = VCLUnoHelper::GetWindow(xWindow);
if (pVCLWindow)
pVCLWindow->SetExtendedStyle(WB_EXT_DOCUMENT);
// <- SYNCHRONIZED
diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx
index edd628976ff4..be924dbb1519 100644
--- a/framework/source/tabwin/tabwindow.cxx
+++ b/framework/source/tabwin/tabwindow.cxx
@@ -140,9 +140,9 @@ void TabWindow::implts_LayoutWindows() const
TabControl* TabWindow::impl_GetTabControl( const css::uno::Reference< css::awt::XWindow >& rTabControlWindow ) const
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( rTabControlWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( rTabControlWindow );
if ( pWindow )
- return static_cast<TabControl *>(pWindow);
+ return static_cast<TabControl *>(pWindow.get());
else
return nullptr;
}
@@ -151,7 +151,7 @@ void TabWindow::impl_SetTitle( const OUString& rTitle )
{
if ( m_xTopWindow.is() )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(
css::uno::Reference< css::awt::XWindow >(
m_xTopWindow, css::uno::UNO_QUERY ));
if ( pWindow )
@@ -385,7 +385,7 @@ throw (css::uno::Exception, css::uno::RuntimeException, std::exception)
xWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, css::awt::PosSize::POSSIZE );
SolarMutexGuard aGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( pWindow )
pWindow->Show();
@@ -397,7 +397,7 @@ throw (css::uno::Exception, css::uno::RuntimeException, std::exception)
if ( pWindow )
{
pWindow->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
- TabControl* pTabControl = static_cast<TabControl *>(pWindow);
+ TabControl* pTabControl = static_cast<TabControl *>(pWindow.get());
pTabControl->SetActivatePageHdl( LINK( this, TabWindow, Activate ));
pTabControl->SetDeactivatePageHdl( LINK( this, TabWindow, Deactivate ));
}
@@ -507,7 +507,7 @@ throw( css::uno::RuntimeException, std::exception )
if ( m_xContainerWindow.is() )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
if ( pWindow )
pWindow->Show();
}
@@ -519,7 +519,7 @@ throw( css::uno::RuntimeException, std::exception )
SolarMutexGuard g;
if ( m_xContainerWindow.is() )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
if ( pWindow )
pWindow->Hide();
}
diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx
index 5e9a5368bf4d..b3074486d898 100644
--- a/framework/source/uielement/addonstoolbarmanager.cxx
+++ b/framework/source/uielement/addonstoolbarmanager.cxx
@@ -353,7 +353,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
Reference< XWindow > xWindow = xTbxController->createItemWindow( xToolbarWindow );
if ( xWindow.is() )
{
- vcl::Window* pItemWin = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pItemWin = VCLUnoHelper::GetWindow( xWindow );
if ( pItemWin )
{
WindowType nType = pItemWin->GetType();
diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx
index 5ce44fd4ad6a..4de793340e67 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -109,7 +109,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument
AddonsToolBarManager* pToolBarManager = nullptr;
{
SolarMutexGuard aSolarMutexGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
if ( pWindow )
{
sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index c4df1f21c6c1..530df3e77fcd 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -996,7 +996,7 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu, bool )
xList->getByIndex(i) >>= xFrame;
if ( xFrame.is() && nTaskId == nCurItemId )
{
- vcl::Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
pWin->GrabFocus();
pWin->ToTop( ToTopFlags::RestoreWhenMin );
break;
@@ -2012,7 +2012,7 @@ void MenuBarManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XComp
if ( xFrame == xCurrentFrame )
nActiveItemId = nItemId;
- vcl::Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
OUString sWindowTitle;
if ( pWin && pWin->IsVisible() )
sWindowTitle = pWin->GetText();
diff --git a/framework/source/uielement/progressbarwrapper.cxx b/framework/source/uielement/progressbarwrapper.cxx
index 916b0017eef5..c858484ad715 100644
--- a/framework/source/uielement/progressbarwrapper.cxx
+++ b/framework/source/uielement/progressbarwrapper.cxx
@@ -104,10 +104,10 @@ void ProgressBarWrapper::start( const OUString& Text, ::sal_Int32 Range )
if ( xWindow.is() )
{
SolarMutexGuard aSolarMutexGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR )
{
- StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow);
+ StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get());
if ( !pStatusBar->IsProgressMode() )
pStatusBar->StartProgressMode( Text );
else
@@ -142,10 +142,10 @@ void ProgressBarWrapper::end()
if ( xWindow.is() )
{
SolarMutexGuard aSolarMutexGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR )
{
- StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow);
+ StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get());
if ( pStatusBar->IsProgressMode() )
pStatusBar->EndProgressMode();
}
@@ -172,10 +172,10 @@ void ProgressBarWrapper::setText( const OUString& Text )
if ( xWindow.is() )
{
SolarMutexGuard aSolarMutexGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR )
{
- StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow);
+ StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get());
if( pStatusBar->IsProgressMode() )
{
pStatusBar->SetUpdateMode( false );
@@ -225,10 +225,10 @@ void ProgressBarWrapper::setValue( ::sal_Int32 nValue )
if ( xWindow.is() && bSetValue )
{
SolarMutexGuard aSolarMutexGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR )
{
- StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow);
+ StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get());
if ( !pStatusBar->IsProgressMode() )
pStatusBar->StartProgressMode( aText );
pStatusBar->SetProgressValue( sal_uInt16( nValue ));
diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx
index bf843b9cec5d..3456dc78e529 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -104,7 +104,7 @@ void SAL_CALL StatusBarWrapper::initialize( const Sequence< Any >& aArguments )
StatusBarManager* pStatusBarManager( nullptr );
{
SolarMutexGuard aSolarMutexGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
if ( pWindow )
{
sal_uLong nStyles = WinBits( WB_LEFT | WB_3DLOOK );
diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx
index af44f8a1199e..36f679a11a79 100644
--- a/framework/source/uielement/subtoolbarcontroller.cxx
+++ b/framework/source/uielement/subtoolbarcontroller.cxx
@@ -240,10 +240,10 @@ css::uno::Reference< css::awt::XWindow > SubToolBarController::createPopupWindow
disposeUIElement();
m_xUIElement = xUIElement;
- vcl::Window* pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar );
+ VclPtr<vcl::Window> pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar );
if ( pTbxWindow && pTbxWindow->GetType() == WINDOW_TOOLBOX )
{
- ToolBox* pToolBar = static_cast< ToolBox* >( pTbxWindow );
+ ToolBox* pToolBar = static_cast< ToolBox* >( pTbxWindow.get() );
pToolBar->SetParent( pToolBox );
// calc and set size for popup mode
Size aSize = pToolBar->CalcPopupWindowSizePixel();
@@ -381,7 +381,7 @@ void SubToolBarController::endPopupMode( const css::awt::EndPopupModeEvent& e )
OUString aPersistentString( "Persistent" );
try
{
- vcl::Window* pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar );
+ VclPtr<vcl::Window> pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar );
if ( pTbxWindow && pTbxWindow->GetType() == WINDOW_TOOLBOX )
{
css::uno::Any a = xProp->getPropertyValue( aPersistentString );
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 20091251da52..4c330b3e64ce 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -848,7 +848,7 @@ void ToolBarManager::CreateControllers()
Reference< XWindow > xWindow = xTbxController->createItemWindow( xToolbarWindow );
if ( xWindow.is() )
{
- vcl::Window* pItemWin = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pItemWin = VCLUnoHelper::GetWindow( xWindow );
if ( pItemWin )
{
WindowType nType = pItemWin->GetType();
@@ -1869,8 +1869,8 @@ IMPL_STATIC_LINK( ToolBarManager, ExecuteHdl_Impl, void*, p, void )
// Use docking window close to close the toolbar. The toolbar layout manager is
// listener and will react correctly according to the context sensitive
// flag of our toolbar.
- vcl::Window* pWin = VCLUnoHelper::GetWindow( pExecuteInfo->xWindow );
- DockingWindow* pDockWin = dynamic_cast< DockingWindow* >( pWin );
+ VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( pExecuteInfo->xWindow );
+ DockingWindow* pDockWin = dynamic_cast< DockingWindow* >( pWin.get() );
if ( pDockWin )
pDockWin->Close();
}
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index caeaec5bebae..003c74c07723 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -250,7 +250,7 @@ Sequence< Sequence< css::beans::PropertyValue > > ToolbarsMenuController::getLay
SolarMutexGuard aGuard;
Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow )
aToolBarInfo.aToolBarUIName = pWindow->GetText();
diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx
index c57783e23a68..8733666c047b 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -145,7 +145,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) th
ToolBarManager* pToolBarManager = nullptr;
{
SolarMutexGuard aSolarMutexGuard;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
if ( pWindow )
{
sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index e1fff151ebf7..44b783275a9a 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -2070,7 +2070,7 @@ void GeometryHandler::impl_initFieldList_nothrow( uno::Sequence< OUString >& _rF
try
{
uno::Reference< awt::XWindow> xInspectorWindow(m_xContext->getValueByName("DialogParentWindow") ,uno::UNO_QUERY);
- vcl::Window* pInspectorWindow = VCLUnoHelper::GetWindow( xInspectorWindow );
+ VclPtr<vcl::Window> pInspectorWindow = VCLUnoHelper::GetWindow( xInspectorWindow );
WaitObject aWaitCursor( pInspectorWindow );
uno::Reference< sdbc::XPreparedStatement > xStatement;
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index efb4161d14dd..5fcc67c828c0 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -645,7 +645,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
{ SID_ATTR_CHAR_CTL_POSTURE, true },
{ SID_ATTR_CHAR_CTL_WEIGHT, true }
};
- vcl::Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
::std::unique_ptr<FontList> pFontList(new FontList( pParent ));
XColorListRef pColorList( XColorList::CreateStdColorList() );
SfxPoolItem* pDefaults[] =
@@ -745,7 +745,7 @@ bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::R
std::shared_ptr<rptui::OReportModel> pModel = ::reportdesign::OReportDefinition::getSdrModel(_xShape->getSection()->getReportDefinition());
- vcl::Window* pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
bool bSuccess = false;
try
@@ -1015,7 +1015,7 @@ bool openDialogFormula_nothrow( OUString& _in_out_rFormula
{
xFactory = _xContext->getServiceManager();
xServiceFactory.set(xFactory,uno::UNO_QUERY);
- vcl::Window* pParent = VCLUnoHelper::GetWindow( _xInspectorWindow );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( _xInspectorWindow );
uno::Reference< report::meta::XFunctionManager> xMgr(xFactory->createInstanceWithContext("org.libreoffice.report.pentaho.SOFunctionManager",_xContext),uno::UNO_QUERY);
if ( xMgr.is() )
diff --git a/sc/source/ui/miscdlgs/retypepassdlg.cxx b/sc/source/ui/miscdlgs/retypepassdlg.cxx
index 4ab1183674c0..30809d7788c4 100644
--- a/sc/source/ui/miscdlgs/retypepassdlg.cxx
+++ b/sc/source/ui/miscdlgs/retypepassdlg.cxx
@@ -113,7 +113,7 @@ void ScRetypePassDlg::SetDataFromDocument(const ScDocument& rDoc)
VclPtr<FixedText> pFtSheetName = VclPtr<FixedText>::Create(pSheet);
pFtSheetName->Show();
pFtSheetName->SetStyle(WB_VCENTER);
- FixedText* pFtSheetStatus = VclPtr<FixedText>::Create(pSheet);
+ VclPtr<FixedText> pFtSheetStatus = VclPtr<FixedText>::Create(pSheet);
pFtSheetStatus->Show();
pFtSheetStatus->SetStyle(WB_VCENTER);
diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx
index 7665ebfe874e..e7054009704f 100644
--- a/sc/source/ui/sidebar/ScPanelFactory.cxx
+++ b/sc/source/ui/sidebar/ScPanelFactory.cxx
@@ -69,7 +69,7 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==nullptr)
throw RuntimeException(
"PanelFactory::createUIElement called without ParentWindow",
diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx
index 050d41052fa2..67fbf6486d39 100644
--- a/sc/source/ui/vba/vbaeventshelper.cxx
+++ b/sc/source/ui/vba/vbaeventshelper.cxx
@@ -221,7 +221,7 @@ void ScVbaEventListener::startControllerListening( const uno::Reference< frame::
if( xControllerBorder.is() )
try { xControllerBorder->addBorderResizeListener( this ); } catch( uno::Exception& ) {}
- if( vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ) )
+ if( VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ) )
{
maControllers[ pWindow ] = rxController;
}
@@ -243,7 +243,7 @@ void ScVbaEventListener::stopControllerListening( const uno::Reference< frame::X
if( xControllerBorder.is() )
try { xControllerBorder->removeBorderResizeListener( this ); } catch( uno::Exception& ) {}
- if( vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ) )
+ if( VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ) )
{
maControllers.erase( pWindow );
if( pWindow == mpActiveWindow )
@@ -278,8 +278,8 @@ void SAL_CALL ScVbaEventListener::windowActivated( const lang::EventObject& rEve
if( !mbDisposed )
{
uno::Reference< awt::XWindow > xWindow( rEvent.Source, uno::UNO_QUERY );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- OSL_TRACE( "ScVbaEventListener::windowActivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow, mpActiveWindow.get() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ OSL_TRACE( "ScVbaEventListener::windowActivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow.get(), mpActiveWindow.get() );
// do not fire activation event multiple time for the same window
if( pWindow && (pWindow != mpActiveWindow) )
{
@@ -300,8 +300,8 @@ void SAL_CALL ScVbaEventListener::windowDeactivated( const lang::EventObject& rE
if( !mbDisposed )
{
uno::Reference< awt::XWindow > xWindow( rEvent.Source, uno::UNO_QUERY );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- OSL_TRACE( "ScVbaEventListener::windowDeactivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow, mpActiveWindow.get() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ OSL_TRACE( "ScVbaEventListener::windowDeactivated - pWindow = 0x%p, mpActiveWindow = 0x%p", pWindow.get(), mpActiveWindow.get() );
// do not fire the deactivation event, if the window is not active (prevent multiple deactivation)
if( pWindow && (pWindow == mpActiveWindow) )
processWindowActivateEvent( pWindow, false );
diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx
index 941d938282a3..4181ba3c7b84 100644
--- a/sd/source/ui/framework/factories/FullScreenPane.cxx
+++ b/sd/source/ui/framework/factories/FullScreenPane.cxx
@@ -193,13 +193,13 @@ IMPL_LINK(FullScreenPane, WindowEventHandler, VclWindowEvent&, rEvent, void)
Reference<rendering::XCanvas> FullScreenPane::CreateCanvas()
throw (RuntimeException)
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
- if (pWindow != nullptr)
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(mxWindow);
+ if (pWindow)
{
Sequence<Any> aArg (5);
// common: first any is VCL pointer to window (for VCL canvas)
- aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow));
+ aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow.get()));
aArg[1] = Any();
aArg[2] = makeAny(css::awt::Rectangle());
aArg[3] = makeAny(false);
diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
index 1c4be5b1eb60..c89c874aa524 100644
--- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx
+++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
@@ -204,8 +204,8 @@ sal_Bool SAL_CALL ViewShellWrapper::relocateToAnchor (
if (mpViewShell.get() != nullptr)
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xPane->getWindow());
- if (pWindow != nullptr && mpViewShell->RelocateToParentWindow(pWindow))
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xPane->getWindow());
+ if (pWindow && mpViewShell->RelocateToParentWindow(pWindow))
{
bResult = true;
diff --git a/sd/source/ui/presenter/PresenterCanvas.cxx b/sd/source/ui/presenter/PresenterCanvas.cxx
index fd42bdc207b9..6333a536123e 100644
--- a/sd/source/ui/presenter/PresenterCanvas.cxx
+++ b/sd/source/ui/presenter/PresenterCanvas.cxx
@@ -631,9 +631,9 @@ awt::Point PresenterCanvas::GetOffset (const Reference<awt::XWindow>& rxBaseWind
mbOffsetUpdatePending = false;
if (mxWindow.is() && rxBaseWindow.is())
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
- vcl::Window* pSharedWindow = VCLUnoHelper::GetWindow(rxBaseWindow);
- if (pWindow!=nullptr && pSharedWindow!=nullptr)
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(mxWindow);
+ VclPtr<vcl::Window> pSharedWindow = VCLUnoHelper::GetWindow(rxBaseWindow);
+ if (pWindow && pSharedWindow)
{
Rectangle aBox = pWindow->GetWindowExtentsRelative(pSharedWindow);
@@ -652,12 +652,12 @@ awt::Point PresenterCanvas::GetOffset (const Reference<awt::XWindow>& rxBaseWind
{
::basegfx::B2DRectangle aClipRectangle;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
- if (pWindow == nullptr)
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(mxWindow);
+ if (!pWindow)
return ::basegfx::B2DRectangle();
- vcl::Window* pSharedWindow = VCLUnoHelper::GetWindow(mxSharedWindow);
- if (pSharedWindow == nullptr)
+ VclPtr<vcl::Window> pSharedWindow = VCLUnoHelper::GetWindow(mxSharedWindow);
+ if (!pSharedWindow)
return ::basegfx::B2DRectangle();
// Get the bounding box of the window and create a range in the
diff --git a/sd/source/ui/presenter/PresenterHelper.cxx b/sd/source/ui/presenter/PresenterHelper.cxx
index d103a84fa0db..7a7f4856da53 100644
--- a/sd/source/ui/presenter/PresenterHelper.cxx
+++ b/sd/source/ui/presenter/PresenterHelper.cxx
@@ -149,13 +149,13 @@ Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createCanvas (
// No shared window is given or an explicit canvas service name is
// specified. Create a new canvas.
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
- if (pWindow != nullptr)
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
+ if (pWindow)
{
Sequence<Any> aArg (5);
// common: first any is VCL pointer to window (for VCL canvas)
- aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow));
+ aArg[0] = makeAny(reinterpret_cast<sal_Int64>(pWindow.get()));
aArg[1] = Any();
aArg[2] = makeAny(css::awt::Rectangle());
aArg[3] = makeAny(false);
@@ -179,8 +179,8 @@ void SAL_CALL PresenterHelper::toTop (
const Reference<awt::XWindow>& rxWindow)
throw (css::uno::RuntimeException, std::exception)
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
- if (pWindow != nullptr)
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
+ if (pWindow)
{
pWindow->ToTop();
pWindow->SetZOrder(nullptr, ZOrderFlags::Last);
@@ -426,8 +426,8 @@ void SAL_CALL PresenterHelper::captureMouse (
::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
// Capture the mouse (if not already done.)
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
- if (pWindow != nullptr && ! pWindow->IsMouseCaptured())
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
+ if (pWindow && ! pWindow->IsMouseCaptured())
{
pWindow->CaptureMouse();
}
@@ -439,8 +439,8 @@ void SAL_CALL PresenterHelper::releaseMouse (const Reference<awt::XWindow>& rxWi
::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
// Release the mouse (if not already done.)
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(rxWindow);
- if (pWindow != nullptr && pWindow->IsMouseCaptured())
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
+ if (pWindow && pWindow->IsMouseCaptured())
{
pWindow->ReleaseMouse();
}
@@ -451,9 +451,9 @@ awt::Rectangle PresenterHelper::getWindowExtentsRelative (
const Reference<awt::XWindow>& rxParentWindow)
throw (RuntimeException, std::exception)
{
- vcl::Window* pChildWindow = VCLUnoHelper::GetWindow(rxChildWindow);
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(rxParentWindow);
- if (pChildWindow!=nullptr && pParentWindow!=nullptr)
+ VclPtr<vcl::Window> pChildWindow = VCLUnoHelper::GetWindow(rxChildWindow);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(rxParentWindow);
+ if (pChildWindow && pParentWindow)
{
Rectangle aBox (pChildWindow->GetWindowExtentsRelative(pParentWindow));
return awt::Rectangle(aBox.Left(),aBox.Top(),aBox.GetWidth(),aBox.GetHeight());
diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx
index 28f94a9aa2e4..6c83d3bd8529 100644
--- a/sd/source/ui/sidebar/PanelFactory.cxx
+++ b/sd/source/ui/sidebar/PanelFactory.cxx
@@ -80,8 +80,8 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
// Throw exceptions when the arguments are not as expected.
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
- if ( ! xParentWindow.is() || pParentWindow==nullptr)
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ if ( ! xParentWindow.is() || !pParentWindow)
throw RuntimeException(
"PanelFactory::createUIElement called without ParentWindow");
if ( ! xFrame.is())
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 8998c0cc6046..da82353cd0e4 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -274,11 +274,12 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
{
#ifdef ENABLE_SDREMOTE
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
- VclAbstractDialog* pDlg = pFact ?
- pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow() ) :
- nullptr;
- if (pDlg)
- pDlg->Execute();
+ if (pFact)
+ {
+ ScopedVclPtr<VclAbstractDialog> pDlg( pFact->CreateRemoteDialog( mrSlideSorter.GetContentWindow() ) );
+ if (pDlg)
+ pDlg->Execute();
+ }
#endif
}
break;
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
index ddc36a5c50cd..35f53ae46036 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
@@ -89,11 +89,11 @@ void SAL_CALL SlideSorterService::initialize (const Sequence<Any>& rArguments)
// Get the parent window.
mxParentWindow.set(rArguments[2], UNO_QUERY_THROW);
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(mxParentWindow);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(mxParentWindow);
mxParentWindow->addWindowListener(this);
- if (pBase != nullptr && pParentWindow!=nullptr)
+ if (pBase != nullptr && pParentWindow)
mpSlideSorter = SlideSorter::CreateSlideSorter(
*pBase,
nullptr,
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index ba810a1781a9..7345027ab9ec 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -1243,7 +1243,7 @@ namespace
try
{
Reference< awt::XWindow > xContainerWindow( _rxFrame->getContainerWindow(), UNO_SET_THROW );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
OSL_ENSURE( pWindow, "lcl_getDialogParent: cool, somebody implemented a VCL-less toolkit!" );
if ( pWindow )
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 9735cb280471..c803c15f898d 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -2657,7 +2657,7 @@ void SfxHelpWindow_Impl::MakeLayout()
{
if ( nHeight > 0 && xWindow.is() )
{
- vcl::Window* pScreenWin = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pScreenWin = VCLUnoHelper::GetWindow(xWindow);
/* #i55528#
Hide() / Show() will produce strange effects.
@@ -2781,7 +2781,7 @@ void SfxHelpWindow_Impl::SaveConfig()
aUserData += ";";
aUserData += OUString::number( nH );
- vcl::Window* pScreenWin = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pScreenWin = VCLUnoHelper::GetWindow( xWindow );
aWinPos = pScreenWin->GetWindowExtentsRelative( nullptr ).TopLeft();
aUserData += ";";
aUserData += OUString::number( aWinPos.X() );
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 9247ac5cf961..2a4c32566c98 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -406,7 +406,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask ,
// create all internal windows and sub frames ...
Reference< css::awt::XWindow > xParentWindow = xHelpTask->getContainerWindow();
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
VclPtrInstance<SfxHelpWindow_Impl> pHelpWindow( xHelpTask, pParentWindow, WB_DOCKBORDER );
Reference< css::awt::XWindow > xHelpWindow = VCLUnoHelper::GetInterface( pHelpWindow );
diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx
index 43f018de78b5..0e53109a83d3 100644
--- a/sfx2/source/dialog/backingcomp.cxx
+++ b/sfx2/source/dialog/backingcomp.cxx
@@ -700,7 +700,7 @@ void SAL_CALL BackingComp::initialize( /*IN*/ const css::uno::Sequence< css::uno
}
// create the component window
- vcl::Window* pParent = VCLUnoHelper::GetWindow(xParentWindow);
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow(xParentWindow);
VclPtr<vcl::Window> pWindow = VclPtr<BackingWindow>::Create(pParent);
m_xWindow = VCLUnoHelper::GetInterface(pWindow);
@@ -772,8 +772,8 @@ void SAL_CALL BackingComp::dispatch( const css::util::URL& aURL, const css::uno:
// vnd.org.libreoffice.recentdocs:ClearRecentFileList - clear recent files
if ( aURL.Path == "ClearRecentFileList" )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(m_xWindow);
- BackingWindow* pBack = dynamic_cast<BackingWindow*>(pWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(m_xWindow);
+ BackingWindow* pBack = dynamic_cast<BackingWindow*>(pWindow.get());
if( pBack )
{
pBack->clearRecentFileList();
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 76c41d2ac048..a51397d07906 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -197,7 +197,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd ,
{
}
- vcl::Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow);
+ VclPtr<vcl::Window> pContentWindow = VCLUnoHelper::GetWindow(xWindow);
if ( pContentWindow )
pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
pTitleDockWindow->SetWrappedWindow(pContentWindow);
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index e9bc1be90f0e..d7d2b55d3984 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -821,7 +821,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
css::uno::Reference< css::awt::XWindow > xParentWindow = xFrame->getContainerWindow();
SolarMutexGuard aGuard;
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
ScopedVclPtrInstance< MessageDialog > aBox(pParentWindow, "ErrorFindEmailDialog", "sfx/ui/errorfindemaildialog.ui");
aBox->Execute();
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index ca68c676bcb2..d50427043b47 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -168,7 +168,7 @@ throw( uno::RuntimeException, std::exception )
if ( SvtMiscOptions().IsPluginsEnabled() )
{
DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
- vcl::Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
VclPtr<IFrameWindow_Impl> pWin = VclPtr<IFrameWindow_Impl>::Create( pParent, maFrmDescr.IsFrameBorderOn() );
pWin->SetSizePixel( pParent->GetOutputSizePixel() );
pWin->SetBackground();
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 4dadf7f2bf25..87179deafe99 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -3604,7 +3604,7 @@ void SAL_CALL SfxBaseModel::setVisualAreaSize( sal_Int64 nAspect, const awt::Siz
SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get(), false );
if ( pViewFrm && m_pData->m_pObjectShell->GetCreateMode() == SfxObjectCreateMode::EMBEDDED && !pViewFrm->GetFrame().IsInPlace() )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame().GetFrameInterface()->getContainerWindow() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame().GetFrameInterface()->getContainerWindow() );
Size aWinSize = pWindow->GetSizePixel();
awt::Size aCurrent = getVisualAreaSize( nAspect );
Size aDiff( aSize.Width-aCurrent.Width, aSize.Height-aCurrent.Height );
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index dbd3a513a87b..d13ad0371732 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -175,7 +175,7 @@ IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, OpenHdl, SvtURLBox*, void)
Reference< XFrame > xFrame( xDesktop->getActiveFrame(), UNO_QUERY );
if ( xFrame.is() )
{
- vcl::Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
if ( pWin )
{
pWin->GrabFocus();
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index ba277c6ed174..c3821b6d6ff9 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -258,7 +258,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
OUString sFile = lcl_getNotebookbarFileName( eApp );
OUString sNewFile = rUIFile + sFile;
OUString sCurrentFile;
- NotebookBar* pNotebookBar = pSysWindow->GetNotebookBar();
+ VclPtr<NotebookBar> pNotebookBar = pSysWindow->GetNotebookBar();
if ( pNotebookBar )
sCurrentFile = OStringToOUString( pNotebookBar->getUIFile(), RTL_TEXTENCODING_ASCII_US );
diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx
index 085a8ccfe5f0..45d26eb854a4 100644
--- a/sfx2/source/sidebar/ControllerFactory.cxx
+++ b/sfx2/source/sidebar/ControllerFactory.cxx
@@ -106,7 +106,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
if (rxParentWindow.is())
{
Reference<awt::XWindow> xItemWindow (xController->createItemWindow(rxParentWindow));
- vcl::Window* pItemWindow = VCLUnoHelper::GetWindow(xItemWindow);
+ VclPtr<vcl::Window> pItemWindow = VCLUnoHelper::GetWindow(xItemWindow);
if (pItemWindow != nullptr)
{
WindowType nType = pItemWindow->GetType();
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index 1a4350830bb3..2b02b96f6fef 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -253,8 +253,8 @@ void FocusManager::FocusPanel (
void FocusManager::FocusPanelContent (const sal_Int32 nPanelIndex)
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(maPanels[nPanelIndex]->GetElementWindow());
- if (pWindow != nullptr)
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(maPanels[nPanelIndex]->GetElementWindow());
+ if (pWindow)
{
mbObservingContentControlFocus = true;
pWindow->GrabFocus();
diff --git a/sfx2/source/sidebar/UnoDeck.cxx b/sfx2/source/sidebar/UnoDeck.cxx
index 4fc0e158f07f..0c2b2cf1a1d3 100644
--- a/sfx2/source/sidebar/UnoDeck.cxx
+++ b/sfx2/source/sidebar/UnoDeck.cxx
@@ -47,7 +47,7 @@ OUString SAL_CALL SfxUnoDeck::getTitle()
SolarMutexGuard aGuard;
SidebarController* pSidebarController = getSidebarController();
- Deck* pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck;
+ VclPtr<Deck> pDeck = pSidebarController->GetResourceManager()->GetDeckDescriptor(mDeckId)->mpDeck;
if (!pDeck)
{
diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx
index 6ef356dd63fc..1b069cc736a2 100644
--- a/sfx2/source/view/classificationcontroller.cxx
+++ b/sfx2/source/view/classificationcontroller.cxx
@@ -153,8 +153,8 @@ void ClassificationCategoriesController::dispose() throw (uno::RuntimeException,
uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindow(const uno::Reference<awt::XWindow>& rParent) throw (uno::RuntimeException, std::exception)
{
- vcl::Window* pParent = VCLUnoHelper::GetWindow(rParent);
- ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent);
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow(rParent);
+ ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent.get());
if (pToolbar)
{
m_pClassification = VclPtr<ClassificationControl>::Create(pToolbar);
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 6f8e7d43f577..4a88eeacb616 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -280,7 +280,7 @@ SfxFrame* SfxFrame::Create( const Reference < XFrame >& i_rFrame )
{
// create a new TopFrame to an external XFrame object ( wrap controller )
ENSURE_OR_THROW( i_rFrame.is(), "NULL frame not allowed" );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( i_rFrame->getContainerWindow() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( i_rFrame->getContainerWindow() );
ENSURE_OR_THROW( pWindow, "frame without container window not allowed" );
SfxFrame* pFrame = new SfxFrame( *pWindow );
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 3b080e8b7856..504997fb3459 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -1036,7 +1036,7 @@ void SfxInPlaceClient::DeactivateObject()
uno::Reference< frame::XController > xController = xModel->getCurrentController();
if ( xController.is() )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xController->getFrame()->getContainerWindow() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xController->getFrame()->getContainerWindow() );
bHasFocus = pWindow->HasChildPathFocus( true );
}
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 0f7b11db6be7..9240a3a6f1dc 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1614,7 +1614,7 @@ void SfxViewFrame::MakeActive_Impl( bool bGrabFocus )
xSupp->setActiveFrame( uno::Reference < frame::XFrame >() );
css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow();
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xContainerWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xContainerWindow);
if (pWindow && pWindow->HasChildPathFocus() && bGrabFocus)
{
SfxInPlaceClient *pCli = GetViewShell()->GetUIActiveClient();
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index f6f432b87443..135f2ffdbe4b 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -450,8 +450,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
if(xElement.is())
{
uno::Reference< awt::XWindow > xWin( xElement->getRealInterface(), uno::UNO_QUERY_THROW );
- vcl::Window* pWin = VCLUnoHelper::GetWindow( xWin );
- ToolBox* pTextToolbox = dynamic_cast< ToolBox* >( pWin );
+ VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xWin );
+ ToolBox* pTextToolbox = dynamic_cast< ToolBox* >( pWin.get() );
if( pTextToolbox )
{
sal_uInt16 nItemCount = pTextToolbox->GetItemCount();
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index 0f9ad02d0d25..e6dd46ca926d 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/wizardmachine.cxx
@@ -242,7 +242,7 @@ namespace svt
{
if ( nullptr == GetPage( i_nState ) )
{
- TabPage* pNewPage = createPage( i_nState );
+ VclPtr<TabPage> pNewPage = createPage( i_nState );
DBG_ASSERT( pNewPage, "OWizardMachine::GetOrCreatePage: invalid new page (NULL)!" );
// fill up the page sequence of our base class (with dummies)
diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx
index 7a20d452590e..aafcd7fa437b 100644
--- a/svtools/source/hatchwindow/documentcloser.cxx
+++ b/svtools/source/hatchwindow/documentcloser.cxx
@@ -118,7 +118,7 @@ IMPL_STATIC_LINK( MainThreadFrameCloserRequest, worker, void*, p, void )
// reparent the window
xWinPeer->setProperty( "PluginParent", uno::makeAny( (sal_Int64) 0 ) );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow )
Dialog::EndAllDialogs( pWindow );
}
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index f8d6f4775bd6..bffb118e9e22 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -187,7 +187,7 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() th
if( pToolBox )
{
vcl::Window* pItemWindow = pToolBox->GetItemWindow( pToolBox->GetDownItemId() );
- vcl::Window* pWin = createPopupWindow( pItemWindow ? pItemWindow : pToolBox );
+ VclPtr<vcl::Window> pWin = createPopupWindow( pItemWindow ? pItemWindow : pToolBox );
if( pWin )
{
FloatWinPopupFlags eFloatFlags = FloatWinPopupFlags::GrabFocus |
@@ -196,7 +196,7 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() th
WinBits nWinBits;
if ( pWin->GetType() == WINDOW_DOCKINGWINDOW )
- nWinBits = static_cast< DockingWindow* >( pWin )->GetFloatStyle();
+ nWinBits = static_cast< DockingWindow* >( pWin.get() )->GetFloatStyle();
else
nWinBits = pWin->GetStyle();
diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx
index 619e175f7626..d2ae6a6b8c85 100644
--- a/svtools/source/uno/statusbarcontroller.cxx
+++ b/svtools/source/uno/statusbarcontroller.cxx
@@ -286,11 +286,11 @@ throw ( RuntimeException, std::exception )
if ( m_bDisposed )
return;
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( m_xParentWindow );
if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR && m_nID != 0 )
{
OUString aStrValue;
- StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow);
+ StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get());
if ( Event.State >>= aStrValue )
pStatusBar->SetItemText( m_nID, aStrValue );
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 59bb09071a13..79dee627d540 100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -853,7 +853,7 @@ void SVTXGridControl::setEnable( sal_Bool bEnable ) throw(css::uno::RuntimeExcep
SolarMutexGuard aGuard;
m_xTableModel->setEnabled( bEnable );
- vcl::Window * pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
pWindow->Enable( bEnable );
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index f0a914abf26e..ea8324c081fc 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -617,7 +617,7 @@ void VCLXFileControl::setText( const OUString& aText ) throw(css::uno::RuntimeEx
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
pWindow->SetText( aText );
@@ -645,7 +645,7 @@ OUString VCLXFileControl::getText() throw(css::uno::RuntimeException, std::excep
SolarMutexGuard aGuard;
OUString aText;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
aText = pWindow->GetText();
return aText;
@@ -832,7 +832,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::u
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -959,7 +959,7 @@ css::uno::Any SVTXFormattedField::getProperty( const OUString& PropertyName ) th
css::uno::Any aReturn;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1024,7 +1024,7 @@ css::uno::Any SVTXFormattedField::convertEffectiveValue(const css::uno::Any& rVa
{
css::uno::Any aReturn;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (!pField)
return aReturn;
@@ -1082,7 +1082,7 @@ css::uno::Any SVTXFormattedField::convertEffectiveValue(const css::uno::Any& rVa
void SVTXFormattedField::SetMinValue(const css::uno::Any& rValue)
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1111,7 +1111,7 @@ void SVTXFormattedField::SetMinValue(const css::uno::Any& rValue)
css::uno::Any SVTXFormattedField::GetMinValue()
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (!pField || !pField->HasMinValue())
return css::uno::Any();
@@ -1123,7 +1123,7 @@ css::uno::Any SVTXFormattedField::GetMinValue()
void SVTXFormattedField::SetMaxValue(const css::uno::Any& rValue)
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1151,7 +1151,7 @@ void SVTXFormattedField::SetMaxValue(const css::uno::Any& rValue)
css::uno::Any SVTXFormattedField::GetMaxValue()
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (!pField || !pField->HasMaxValue())
return css::uno::Any();
@@ -1163,7 +1163,7 @@ css::uno::Any SVTXFormattedField::GetMaxValue()
void SVTXFormattedField::SetDefaultValue(const css::uno::Any& rValue)
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1196,7 +1196,7 @@ void SVTXFormattedField::SetDefaultValue(const css::uno::Any& rValue)
css::uno::Any SVTXFormattedField::GetDefaultValue()
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (!pField || pField->IsEmptyFieldEnabled())
return css::uno::Any();
@@ -1211,7 +1211,7 @@ css::uno::Any SVTXFormattedField::GetDefaultValue()
bool SVTXFormattedField::GetTreatAsNumber()
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (pField)
return pField->TreatingAsNumber();
@@ -1221,7 +1221,7 @@ bool SVTXFormattedField::GetTreatAsNumber()
void SVTXFormattedField::SetTreatAsNumber(bool bSet)
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (pField)
pField->TreatAsNumber(bSet);
}
@@ -1229,7 +1229,7 @@ void SVTXFormattedField::SetTreatAsNumber(bool bSet)
css::uno::Any SVTXFormattedField::GetValue()
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (!pField)
return css::uno::Any();
@@ -1251,7 +1251,7 @@ css::uno::Any SVTXFormattedField::GetValue()
void SVTXFormattedField::SetValue(const css::uno::Any& rValue)
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1285,7 +1285,7 @@ void SVTXFormattedField::SetValue(const css::uno::Any& rValue)
void SVTXFormattedField::setFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > & xSupplier)
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
SvNumberFormatsSupplierObj* pNew = nullptr;
if (!xSupplier.is())
@@ -1324,14 +1324,14 @@ void SVTXFormattedField::setFormatsSupplier(const css::uno::Reference< css::util
sal_Int32 SVTXFormattedField::getFormatKey() const
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetFormatKey() : 0;
}
void SVTXFormattedField::setFormatKey(sal_Int32 nKey)
{
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if (pField)
{
if (pField->GetFormatter())
@@ -1402,7 +1402,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
case VCLEVENT_ROADMAP_ITEMSELECTED:
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
+ VclPtr<::svt::ORoadmap> pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_Int16 CurItemID = pField->GetCurrentRoadmapItemID();
@@ -1424,7 +1424,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
void SVTXRoadmap::propertyChange( const css::beans::PropertyChangeEvent& evt ) throw (css::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
+ VclPtr<::svt::ORoadmap> pField = GetAs< svt::ORoadmap >();
if ( pField )
{
css::uno::Reference< css::uno::XInterface > xRoadmapItem;
@@ -1496,7 +1496,7 @@ RMItemData SVTXRoadmap::GetRMItemData( const css::container::ContainerEvent& _rE
void SVTXRoadmap::elementInserted( const css::container::ContainerEvent& _rEvent )throw(css::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
+ VclPtr<::svt::ORoadmap> pField = GetAs< svt::ORoadmap >();
if ( pField )
{
RMItemData CurItemData = GetRMItemData( _rEvent );
@@ -1509,7 +1509,7 @@ void SVTXRoadmap::elementInserted( const css::container::ContainerEvent& _rEvent
void SVTXRoadmap::elementRemoved( const css::container::ContainerEvent& _rEvent )throw(css::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
+ VclPtr<::svt::ORoadmap> pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_Int32 DelIndex = 0;
@@ -1521,7 +1521,7 @@ void SVTXRoadmap::elementRemoved( const css::container::ContainerEvent& _rEvent
void SVTXRoadmap::elementReplaced( const css::container::ContainerEvent& _rEvent )throw(css::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
+ VclPtr<::svt::ORoadmap> pField = GetAs< svt::ORoadmap >();
if ( pField )
{
RMItemData CurItemData = GetRMItemData( _rEvent );
@@ -1536,7 +1536,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const css::uno::Any
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
+ VclPtr<::svt::ORoadmap> pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1592,7 +1592,7 @@ css::uno::Any SVTXRoadmap::getProperty( const OUString& PropertyName ) throw(css
css::uno::Any aReturn;
- ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
+ VclPtr<::svt::ORoadmap> pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1664,7 +1664,7 @@ void SVTXNumericField::setValue( double Value ) throw(css::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetValue( Value );
}
@@ -1673,7 +1673,7 @@ double SVTXNumericField::getValue() throw(css::uno::RuntimeException, std::excep
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1681,7 +1681,7 @@ void SVTXNumericField::setMin( double Value ) throw(css::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetMinValue( Value );
}
@@ -1690,7 +1690,7 @@ double SVTXNumericField::getMin() throw(css::uno::RuntimeException, std::excepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1698,7 +1698,7 @@ void SVTXNumericField::setMax( double Value ) throw(css::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetMaxValue( Value );
}
@@ -1707,7 +1707,7 @@ double SVTXNumericField::getMax() throw(css::uno::RuntimeException, std::excepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1715,7 +1715,7 @@ void SVTXNumericField::setFirst( double Value ) throw(css::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinFirst( Value );
}
@@ -1724,7 +1724,7 @@ double SVTXNumericField::getFirst() throw(css::uno::RuntimeException, std::excep
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1732,7 +1732,7 @@ void SVTXNumericField::setLast( double Value ) throw(css::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinLast( Value );
}
@@ -1741,7 +1741,7 @@ double SVTXNumericField::getLast() throw(css::uno::RuntimeException, std::except
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1749,7 +1749,7 @@ void SVTXNumericField::setSpinSize( double Value ) throw(css::uno::RuntimeExcept
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinSize( Value );
}
@@ -1758,7 +1758,7 @@ double SVTXNumericField::getSpinSize() throw(css::uno::RuntimeException, std::ex
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1766,7 +1766,7 @@ void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) throw(css::uno::Runti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetDecimalDigits( Value );
}
@@ -1775,7 +1775,7 @@ sal_Int16 SVTXNumericField::getDecimalDigits() throw(css::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetDecimalDigits() : 0;
}
@@ -1783,7 +1783,7 @@ void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) throw(css::uno::Runti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetStrictFormat( bStrict );
}
@@ -1792,7 +1792,7 @@ sal_Bool SVTXNumericField::isStrictFormat() throw(css::uno::RuntimeException, st
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField && pField->IsStrictFormat();
}
@@ -1830,7 +1830,7 @@ void SVTXCurrencyField::setValue( double Value ) throw(css::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetValue( Value );
}
@@ -1839,7 +1839,7 @@ double SVTXCurrencyField::getValue() throw(css::uno::RuntimeException, std::exce
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1847,7 +1847,7 @@ void SVTXCurrencyField::setMin( double Value ) throw(css::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetMinValue( Value );
}
@@ -1856,7 +1856,7 @@ double SVTXCurrencyField::getMin() throw(css::uno::RuntimeException, std::except
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1864,7 +1864,7 @@ void SVTXCurrencyField::setMax( double Value ) throw(css::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetMaxValue( Value );
}
@@ -1873,7 +1873,7 @@ double SVTXCurrencyField::getMax() throw(css::uno::RuntimeException, std::except
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1881,7 +1881,7 @@ void SVTXCurrencyField::setFirst( double Value ) throw(css::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinFirst( Value );
}
@@ -1890,7 +1890,7 @@ double SVTXCurrencyField::getFirst() throw(css::uno::RuntimeException, std::exce
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1898,7 +1898,7 @@ void SVTXCurrencyField::setLast( double Value ) throw(css::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinLast( Value );
}
@@ -1907,7 +1907,7 @@ double SVTXCurrencyField::getLast() throw(css::uno::RuntimeException, std::excep
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1915,7 +1915,7 @@ void SVTXCurrencyField::setSpinSize( double Value ) throw(css::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinSize( Value );
}
@@ -1924,7 +1924,7 @@ double SVTXCurrencyField::getSpinSize() throw(css::uno::RuntimeException, std::e
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1932,7 +1932,7 @@ void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(css::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetDecimalDigits( Value );
}
@@ -1941,7 +1941,7 @@ sal_Int16 SVTXCurrencyField::getDecimalDigits() throw(css::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField ? pField->GetDecimalDigits() : 0;
}
@@ -1949,7 +1949,7 @@ void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(css::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
if ( pField )
pField->SetStrictFormat( bStrict );
}
@@ -1958,7 +1958,7 @@ sal_Bool SVTXCurrencyField::isStrictFormat() throw(css::uno::RuntimeException, s
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetAs< FormattedField >();
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
return pField && pField->IsStrictFormat();
}
@@ -2119,7 +2119,7 @@ void VCLXProgressBar::setForegroundColor( sal_Int32 nColor ) throw(css::uno::Run
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
Color aColor( nColor );
@@ -2131,7 +2131,7 @@ void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor ) throw(css::uno::Run
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
Color aColor( nColor );
@@ -2207,7 +2207,7 @@ void VCLXProgressBar::setProperty( const OUString& PropertyName, const css::uno:
break;
case BASEPROPERTY_FILLCOLOR:
{
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx
index 5958226fb9b2..4268799640c6 100644
--- a/svtools/source/uno/wizard/wizardpagecontroller.cxx
+++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx
@@ -93,8 +93,8 @@ namespace svt { namespace uno
try
{
Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW );
- vcl::Window* pPageWindow = VCLUnoHelper::GetWindow( xPageWindow );
- if ( pPageWindow == nullptr )
+ VclPtr<vcl::Window> pPageWindow = VCLUnoHelper::GetWindow( xPageWindow );
+ if ( pPageWindow )
{
// windows created via the XContainerWindowProvider might be controls, not real windows, so resolve
// that one indirection
@@ -103,8 +103,8 @@ namespace svt { namespace uno
pPageWindow = VCLUnoHelper::GetWindow( xPageWindow );
}
- OSL_ENSURE( pPageWindow != nullptr, "WizardPageController::getTabPage: unable to find the Window implementation for the page's window!" );
- return dynamic_cast< TabPage* >( pPageWindow );
+ OSL_ENSURE( pPageWindow, "WizardPageController::getTabPage: unable to find the Window implementation for the page's window!" );
+ return dynamic_cast< TabPage* >( pPageWindow.get() );
}
catch( const Exception& )
{
diff --git a/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
index aafb7df1bb73..2430b5420b7b 100644
--- a/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
+++ b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
@@ -39,10 +39,10 @@ VCLXAccessibleSvxFindReplaceDialog::~VCLXAccessibleSvxFindReplaceDialog()
void VCLXAccessibleSvxFindReplaceDialog::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
{
VCLXAccessibleComponent::FillAccessibleRelationSet( rRelationSet );
- vcl::Window* pDlg = GetWindow();
+ VclPtr<vcl::Window> pDlg = GetWindow();
if ( pDlg )
{
- SvxSearchDialog* pSrchDlg = static_cast<SvxSearchDialog*>( pDlg );
+ SvxSearchDialog* pSrchDlg = static_cast<SvxSearchDialog*>( pDlg.get() );
vcl::Window* pDocWin = pSrchDlg->GetDocWin();
if ( !pDocWin )
{
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index c940c1435559..936b4f6fe924 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1060,7 +1060,7 @@ VclPtr<FmGridControl> FmXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBi
void FmXGridPeer::Create(vcl::Window* pParent, WinBits nStyle)
{
- FmGridControl* pWin = imp_CreateControl(pParent, nStyle);
+ VclPtr<FmGridControl> pWin = imp_CreateControl(pParent, nStyle);
DBG_ASSERT(pWin != nullptr, "FmXGridPeer::Create : imp_CreateControl didn't return a control !");
pWin->SetStateProvider(LINK(this, FmXGridPeer, OnQueryGridSlotState));
@@ -1693,9 +1693,9 @@ void FmXGridPeer::setDesignMode(sal_Bool bOn) throw( RuntimeException, std::exce
{
if (bOn != isDesignMode())
{
- vcl::Window* pWin = GetWindow();
+ VclPtr<vcl::Window> pWin = GetWindow();
if (pWin)
- static_cast<FmGridControl*>(pWin)->SetDesignMode(bOn);
+ static_cast<FmGridControl*>(pWin.get())->SetDesignMode(bOn);
}
if (bOn)
@@ -1707,9 +1707,9 @@ void FmXGridPeer::setDesignMode(sal_Bool bOn) throw( RuntimeException, std::exce
sal_Bool FmXGridPeer::isDesignMode() throw( RuntimeException, std::exception )
{
- vcl::Window* pWin = GetWindow();
+ VclPtr<vcl::Window> pWin = GetWindow();
if (pWin)
- return static_cast<FmGridControl*>(pWin)->IsDesignMode();
+ return static_cast<FmGridControl*>(pWin.get())->IsDesignMode();
else
return false;
}
@@ -2007,7 +2007,7 @@ Reference< XAccessibleContext > FmXGridPeer::CreateAccessibleContext()
Reference< XAccessibleContext > xContext;
// use the AccessibleContext provided by the VCL window
- vcl::Window* pGrid = GetWindow();
+ VclPtr<vcl::Window> pGrid = GetWindow();
if ( pGrid )
{
Reference< XAccessible > xAcc( pGrid->GetAccessible() );
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index b6e46a863074..9457839c1c70 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -991,7 +991,7 @@ void DbGridControl::InsertHandleColumn()
void DbGridControl::Init()
{
- BrowserHeader* pNewHeader = CreateHeaderBar(this);
+ VclPtr<BrowserHeader> pNewHeader = CreateHeaderBar(this);
pHeader->SetMouseTransparent(false);
SetHeaderBar(pNewHeader);
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 56028365e36a..dbd09be8f738 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -265,7 +265,7 @@ void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, b
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
assert(pFact && "Got no AbstractDialogFactory!");
- VclAbstractDialog2* pThemeProps = pFact->CreateGalleryThemePropertiesDialog( mpExchangeData, mpThemePropsDlgItemSet );
+ VclPtr<VclAbstractDialog2> pThemeProps = pFact->CreateGalleryThemePropertiesDialog( mpExchangeData, mpThemePropsDlgItemSet );
assert(pThemeProps && "Got no GalleryThemePropertiesDialog!");
if ( bCreateNew )
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 06009352fa80..2e6792b713b4 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -253,7 +253,7 @@ namespace sdr { namespace contact {
Reference< XWindowPeer > xPeer( m_xControl->getPeer() );
if ( xPeer.is() )
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xPeer );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xPeer );
OSL_ENSURE( pWindow, "ControlHolder::invalidate: no implementation access!" );
if ( pWindow )
pWindow->Invalidate();
@@ -266,7 +266,7 @@ namespace sdr { namespace contact {
// no check whether we're valid, this is the responsibility of the caller
// Argh. Why does XView have a setZoom only, but not a getZoom?
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( m_xControl->getPeer() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( m_xControl->getPeer() );
OSL_ENSURE( pWindow, "ControlHolder::getZoom: no implementation access!" );
::basegfx::B2DVector aZoom( 1, 1 );
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx
index 574145b8c43b..664586e1789e 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -120,7 +120,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
aArguments.getOrDefault("ApplicationName", OUString()),
aArguments.getOrDefault("ContextName", OUString()));
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==nullptr)
throw RuntimeException(
"PanelFactory::createUIElement called without ParentWindow",
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 22cc91850634..114f23f0fe03 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -710,7 +710,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
assert(pFact && "Dialog creation failed!");
::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_GRFCROP );
assert(fnCreatePage && "Dialog creation failed!");
- SfxTabPage* pTabPage = (*fnCreatePage)( aCropDialog->get_content_area(), &aCropDlgAttr );
+ VclPtr<SfxTabPage> pTabPage = (*fnCreatePage)( aCropDialog->get_content_area(), &aCropDlgAttr );
pTabPage->SetText( aCropStr );
aCropDialog->SetTabPage( pTabPage );
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 98d3ffbaede0..3e7316647d66 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -570,8 +570,7 @@ SvxLineEndToolBoxControl::~SvxLineEndToolBoxControl()
VclPtr<SfxPopupWindow> SvxLineEndToolBoxControl::CreatePopupWindow()
{
- SvxLineEndWindow* pLineEndWin =
- VclPtr<SvxLineEndWindow>::Create( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) );
+ VclPtrInstance<SvxLineEndWindow> pLineEndWin( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) );
pLineEndWin->StartPopupMode( &GetToolBox(),
FloatWinPopupFlags::GrabFocus |
FloatWinPopupFlags::AllowTearOff |
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index c5c0d568227c..f774559ab0c1 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2822,9 +2822,7 @@ void SvxColorToolBoxControl::setColorSelectFunction(const ColorSelectFunction& a
VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow()
{
- SvxColorWindow* pColorWin =
- VclPtr<SvxColorWindow>::Create(
-
+ VclPtrInstance<SvxColorWindow> pColorWin(
m_aCommandURL,
m_aPaletteManager,
m_aBorderColorStatus,
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index c6fc28f4a469..c7e74bd51c37 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -385,7 +385,7 @@ uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWind
{
uno::Reference< awt::XWindow > xItemWindow;
- vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xParent );
if ( pParent )
{
SolarMutexGuard aSolarMutexGuard;
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 9628b8b952e6..b411c6cf18b2 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -430,8 +430,8 @@ void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< c
{
svt::ToolboxController::initialize(aArguments);
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
- ToolBox* pToolBox = static_cast<ToolBox*>(pWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( getParent() );
+ ToolBox* pToolBox = static_cast<ToolBox*>(pWindow.get());
if ( pToolBox )
{
sal_uInt16 nItemCount = pToolBox->GetItemCount();
@@ -452,10 +452,10 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::cre
{
css::uno::Reference< css::awt::XWindow > xItemWindow;
- vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xParent );
if ( pParent )
{
- ToolBox* pToolbar = static_cast<ToolBox*>(pParent);
+ ToolBox* pToolbar = static_cast<ToolBox*>(pParent.get());
m_pFindTextFieldControl = VclPtr<FindTextFieldControl>::Create( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xContext );
Size aSize(250, m_pFindTextFieldControl->GetTextHeight() + 200);
@@ -491,8 +491,8 @@ IMPL_LINK_NOARG(FindTextToolbarController, EditModifyHdl, Edit&, void)
void FindTextToolbarController::textfieldChanged() {
// enable or disable item DownSearch/UpSearch of findbar
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
- ToolBox* pToolBox = static_cast<ToolBox*>(pWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( getParent() );
+ ToolBox* pToolBox = static_cast<ToolBox*>(pWindow.get());
if ( pToolBox && m_pFindTextFieldControl )
{
bool enableButtons = !m_pFindTextFieldControl->GetText().isEmpty();
@@ -575,8 +575,8 @@ void SAL_CALL UpDownSearchToolboxController::execute( sal_Int16 /*KeyModifier*/
if ( m_bDisposed )
throw css::lang::DisposedException();
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
- ToolBox* pToolBox = static_cast<ToolBox*>(pWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( getParent() );
+ ToolBox* pToolBox = static_cast<ToolBox*>(pWindow.get());
impl_executeSearch(m_xContext, m_xFrame, pToolBox, meType == UP );
@@ -665,10 +665,10 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL MatchCaseToolboxController::cr
{
css::uno::Reference< css::awt::XWindow > xItemWindow;
- vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xParent );
if ( pParent )
{
- ToolBox* pToolbar = static_cast<ToolBox*>(pParent);
+ ToolBox* pToolbar = static_cast<ToolBox*>(pParent.get());
m_pMatchCaseControl = VclPtr<CheckBox>::Create( pToolbar, 0 );
m_pMatchCaseControl->SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_MATCHCASE ) );
Size aSize( m_pMatchCaseControl->GetOptimalSize() );
@@ -757,10 +757,10 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL SearchFormattedToolboxControll
{
css::uno::Reference< css::awt::XWindow > xItemWindow;
- vcl::Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xParent );
if ( pParent )
{
- ToolBox* pToolbar = static_cast<ToolBox*>(pParent);
+ ToolBox* pToolbar = static_cast<ToolBox*>(pParent.get());
m_pSearchFormattedControl = VclPtr<CheckBox>::Create( pToolbar, 0 );
m_pSearchFormattedControl->SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_SEARCHFORMATTED ) );
Size aSize( m_pSearchFormattedControl->GetOptimalSize() );
@@ -848,8 +848,8 @@ void SAL_CALL FindAllToolboxController::execute( sal_Int16 /*KeyModifier*/ ) thr
if ( m_bDisposed )
throw css::lang::DisposedException();
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
- ToolBox* pToolBox = static_cast<ToolBox*>(pWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( getParent() );
+ ToolBox* pToolBox = static_cast<ToolBox*>(pWindow.get());
impl_executeSearch(m_xContext, m_xFrame, pToolBox, false, true);
}
@@ -1142,8 +1142,8 @@ void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css
}
css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- ToolBox* pToolBox = static_cast<ToolBox*>(pWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ ToolBox* pToolBox = static_cast<ToolBox*>(pWindow.get());
if ( pToolBox )
{
sal_uInt16 nItemCount = pToolBox->GetItemCount();
diff --git a/sw/source/ui/chrdlg/tblnumfm.cxx b/sw/source/ui/chrdlg/tblnumfm.cxx
index 108b6b3eb19c..5220ee5c53a3 100644
--- a/sw/source/ui/chrdlg/tblnumfm.cxx
+++ b/sw/source/ui/chrdlg/tblnumfm.cxx
@@ -40,7 +40,7 @@ SwNumFormatDlg::SwNumFormatDlg(vcl::Window* pParent, const SfxItemSet& rSet)
if ( fnCreatePage )
{
- SfxTabPage* pNewPage = (*fnCreatePage)( get_content_area(), &rSet );
+ VclPtr<SfxTabPage> pNewPage = (*fnCreatePage)( get_content_area(), &rSet );
SfxAllItemSet aSet(*(rSet.GetPool()));
aSet.Put ( SvxNumberInfoItem( static_cast<const SvxNumberInfoItem&>(pNewPage->GetItemSet().Get( SID_ATTR_NUMBERFORMAT_INFO ))));
pNewPage->PageCreated(aSet);
diff --git a/sw/source/ui/dialog/addrdlg.cxx b/sw/source/ui/dialog/addrdlg.cxx
index 2370e35a6c4d..a4d57570ba45 100644
--- a/sw/source/ui/dialog/addrdlg.cxx
+++ b/sw/source/ui/dialog/addrdlg.cxx
@@ -29,7 +29,7 @@ SwAddrDlg::SwAddrDlg(vcl::Window* pParent, const SfxItemSet& rSet)
::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SFXPAGE_GENERAL );
if ( fnCreatePage )
{
- SfxTabPage* pPage2 = (*fnCreatePage)(get_content_area(), &rSet);
+ VclPtr<SfxTabPage> pPage2 = (*fnCreatePage)(get_content_area(), &rSet);
SetTabPage(pPage2);
}
}
diff --git a/sw/source/ui/frmdlg/uiborder.cxx b/sw/source/ui/frmdlg/uiborder.cxx
index 5108a122832f..0b9e07793b0a 100644
--- a/sw/source/ui/frmdlg/uiborder.cxx
+++ b/sw/source/ui/frmdlg/uiborder.cxx
@@ -41,7 +41,7 @@ SwBorderDlg::SwBorderDlg(vcl::Window* pParent, SfxItemSet& rSet, SwBorderModes n
if ( fnCreatePage )
{
- SfxTabPage* pNewPage = (*fnCreatePage)( get_content_area(), &rSet );
+ VclPtr<SfxTabPage> pNewPage = (*fnCreatePage)( get_content_area(), &rSet );
SfxAllItemSet aSet(*(rSet.GetPool()));
aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE, static_cast<sal_uInt16>(nType)));
if(SwBorderModes::TABLE == nType)
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 57a62d38c37b..5e7fb3496947 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -2873,7 +2873,7 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken&
if(!aControlList.empty())
{
- Control* pLast = *(aControlList.rbegin());
+ Control* pLast = aControlList.rbegin()->get();
aControlSize = pLast->GetSizePixel();
aControlPos = pLast->GetPosPixel();
@@ -3230,8 +3230,8 @@ void SwTokenWindow::AdjustScrolling()
if(aControlList.size() > 1)
{
//validate scroll buttons
- Control* pFirstCtrl = *(aControlList.begin());
- Control* pLastCtrl = *(aControlList.rbegin());
+ Control* pFirstCtrl = aControlList.begin()->get();
+ Control* pLastCtrl = aControlList.rbegin()->get();
long nSpace = m_pCtrlParentWin->GetSizePixel().Width();
long nWidth = pLastCtrl->GetPosPixel().X() - pFirstCtrl->GetPosPixel().X()
@@ -3551,7 +3551,7 @@ void SwTokenWindow::GetFocus()
{
if (!aControlList.empty())
{
- Control *pFirst = *aControlList.begin();
+ Control *pFirst = aControlList.begin()->get();
if (pFirst)
{
diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx
index 9910fe0756f8..2ba1b834fa9b 100644
--- a/sw/source/uibase/dbui/mailmergehelper.cxx
+++ b/sw/source/uibase/dbui/mailmergehelper.cxx
@@ -613,8 +613,7 @@ OUString SwAuthenticator::getPassword( ) throw (RuntimeException, std::exceptio
{
if(!m_aUserName.isEmpty() && m_aPassword.isEmpty() && m_pParentWindow)
{
- SfxPasswordDialog* pPasswdDlg =
- VclPtr<SfxPasswordDialog>::Create( m_pParentWindow );
+ ScopedVclPtrInstance<SfxPasswordDialog> pPasswdDlg( m_pParentWindow );
pPasswdDlg->SetMinLen( 0 );
if(RET_OK == pPasswdDlg->Execute())
m_aPassword = pPasswdDlg->GetPassword();
diff --git a/sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx b/sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx
index e119d5f790ce..c2783bb3acc0 100644
--- a/sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx
+++ b/sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx
@@ -176,8 +176,8 @@ void MMCurrentEntryController::dispose() throw (uno::RuntimeException, std::exce
uno::Reference<awt::XWindow> MMCurrentEntryController::createItemWindow(const uno::Reference<awt::XWindow>& rParent) throw (uno::RuntimeException, std::exception)
{
- vcl::Window* pParent = VCLUnoHelper::GetWindow(rParent);
- ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent);
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow(rParent);
+ ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent.get());
if (pToolbar)
{
// make it visible
@@ -247,8 +247,8 @@ void MMExcludeEntryController::dispose() throw (uno::RuntimeException, std::exce
uno::Reference<awt::XWindow> MMExcludeEntryController::createItemWindow(const uno::Reference<awt::XWindow>& rParent) throw (uno::RuntimeException, std::exception)
{
- vcl::Window* pParent = VCLUnoHelper::GetWindow(rParent);
- ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent);
+ VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow(rParent);
+ ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent.get());
if (pToolbar)
{
// make it visible
diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx
index 985000c491f5..d1d85d1d5f22 100644
--- a/sw/source/uibase/sidebar/SwPanelFactory.cxx
+++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx
@@ -109,7 +109,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==nullptr)
throw RuntimeException(
"PanelFactory::createUIElement called without ParentWindow",
diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
index 8eb7fbce65a5..8410554d2612 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -102,7 +102,7 @@ namespace toolkit
WindowStyleSettings::WindowStyleSettings(::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow )
:m_pData( new WindowStyleSettings_Data(i_rListenerMutex, i_rOwningWindow ) )
{
- vcl::Window* pWindow = i_rOwningWindow.GetWindow();
+ VclPtr<vcl::Window> pWindow = i_rOwningWindow.GetWindow();
if ( !pWindow )
throw RuntimeException();
pWindow->AddEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) );
@@ -118,7 +118,7 @@ namespace toolkit
{
StyleMethodGuard aGuard( *m_pData );
- vcl::Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ VclPtr<vcl::Window> pWindow = m_pData->pOwningWindow->GetWindow();
OSL_ENSURE( pWindow, "WindowStyleSettings::dispose: window has been reset before we could revoke the listener!" );
if ( pWindow )
pWindow->RemoveEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) );
@@ -142,7 +142,7 @@ namespace toolkit
void lcl_setStyleColor( WindowStyleSettings_Data& i_rData, void (StyleSettings::*i_pSetter)( Color const & ), const sal_Int32 i_nColor )
{
- vcl::Window* pWindow = i_rData.pOwningWindow->GetWindow();
+ VclPtr<vcl::Window> pWindow = i_rData.pOwningWindow->GetWindow();
AllSettings aAllSettings = pWindow->GetSettings();
StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
(aStyleSettings.*i_pSetter)( Color( i_nColor ) );
@@ -161,7 +161,7 @@ namespace toolkit
void lcl_setStyleFont( WindowStyleSettings_Data& i_rData, void (StyleSettings::*i_pSetter)( vcl::Font const &),
vcl::Font const & (StyleSettings::*i_pGetter)() const, const FontDescriptor& i_rFont )
{
- vcl::Window* pWindow = i_rData.pOwningWindow->GetWindow();
+ VclPtr<vcl::Window> pWindow = i_rData.pOwningWindow->GetWindow();
AllSettings aAllSettings = pWindow->GetSettings();
StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
const vcl::Font aNewFont = VCLUnoHelper::CreateFont( i_rFont, (aStyleSettings.*i_pGetter)() );
@@ -751,7 +751,7 @@ namespace toolkit
void SAL_CALL WindowStyleSettings::setHighContrastMode( sal_Bool _highcontrastmode ) throw (RuntimeException, std::exception)
{
StyleMethodGuard aGuard( *m_pData );
- vcl::Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ VclPtr<vcl::Window> pWindow = m_pData->pOwningWindow->GetWindow();
AllSettings aAllSettings = pWindow->GetSettings();
StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
aStyleSettings.SetHighContrastMode( _highcontrastmode );
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index 20c39d111cfb..a02db4444e1e 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -696,7 +696,7 @@ awt::Rectangle VCLXAccessibleComponent::implGetBounds() throw (uno::RuntimeExcep
{
awt::Rectangle aBounds ( 0, 0, 0, 0 );
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
Rectangle aRect = pWindow->GetWindowExtentsRelative( nullptr );
@@ -773,7 +773,7 @@ sal_Int32 SAL_CALL VCLXAccessibleComponent::getForeground( ) throw (uno::Runtim
OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
if ( pWindow->IsControlForeground() )
@@ -800,7 +800,7 @@ sal_Int32 SAL_CALL VCLXAccessibleComponent::getBackground( ) throw (uno::Runtim
OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
if ( pWindow->IsControlBackground() )
@@ -819,7 +819,7 @@ uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( ) throw
OExternalLockGuard aGuard( this );
uno::Reference< awt::XFont > xFont;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
uno::Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), uno::UNO_QUERY );
diff --git a/toolkit/source/awt/vclxcontainer.cxx b/toolkit/source/awt/vclxcontainer.cxx
index 7ec45d791f51..0bd1ecdcdf43 100644
--- a/toolkit/source/awt/vclxcontainer.cxx
+++ b/toolkit/source/awt/vclxcontainer.cxx
@@ -85,7 +85,7 @@ css::uno::Sequence< css::uno::Reference< css::awt::XWindow > > VCLXContainer::ge
// Request container interface from all children
css::uno::Sequence< css::uno::Reference< css::awt::XWindow > > aSeq;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
sal_uInt16 nChildren = pWindow->GetChildCount();
@@ -111,7 +111,7 @@ void VCLXContainer::enableDialogControl( sal_Bool bEnable ) throw(css::uno::Runt
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
WinBits nStyle = pWindow->GetStyle();
@@ -136,7 +136,7 @@ void VCLXContainer::setTabOrder( const css::uno::Sequence< css::uno::Reference<
for ( sal_uInt32 n = 0; n < nCount; n++ )
{
// css::style::TabStop
- vcl::Window* pWin = VCLUnoHelper::GetWindow( pComps[n] );
+ VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( pComps[n] );
// May be NULL if a css::uno::Sequence is originated from TabController and is missing a peer!
if ( pWin )
{
@@ -179,7 +179,7 @@ void VCLXContainer::setGroup( const css::uno::Sequence< css::uno::Reference< css
vcl::Window* pPrevRadio = nullptr;
for ( sal_uInt32 n = 0; n < nCount; n++ )
{
- vcl::Window* pWin = VCLUnoHelper::GetWindow( pComps[n] );
+ VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( pComps[n] );
if ( pWin )
{
vcl::Window* pSortBehind = pPrevWin;
@@ -243,9 +243,9 @@ throw(css::uno::RuntimeException, std::exception)
sal_Int32 nVal =0;
Value >>= nVal;
Size aSize( nVal, nVal );
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
MapMode aMode( MapUnit::MapAppFont );
- toolkit::ScrollableInterface* pScrollable = dynamic_cast< toolkit::ScrollableInterface* >( pWindow );
+ toolkit::ScrollableInterface* pScrollable = dynamic_cast< toolkit::ScrollableInterface* >( pWindow.get() );
if ( pWindow && pScrollable )
{
OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
diff --git a/toolkit/source/awt/vclxsystemdependentwindow.cxx b/toolkit/source/awt/vclxsystemdependentwindow.cxx
index 18e4a0224122..6baa157cab9e 100644
--- a/toolkit/source/awt/vclxsystemdependentwindow.cxx
+++ b/toolkit/source/awt/vclxsystemdependentwindow.cxx
@@ -69,10 +69,10 @@ css::uno::Any VCLXSystemDependentWindow::getWindowHandle( const css::uno::Sequen
// TODO, check the process id
css::uno::Any aRet;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
- const SystemEnvData* pSysData = static_cast<SystemChildWindow *>(pWindow)->GetSystemData();
+ const SystemEnvData* pSysData = static_cast<SystemChildWindow *>(pWindow.get())->GetSystemData();
if( pSysData )
{
#if defined(_WIN32)
diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx
index 2e862e3b6a18..7e8b451dd7d8 100644
--- a/toolkit/source/awt/vclxtabpagecontainer.cxx
+++ b/toolkit/source/awt/vclxtabpagecontainer.cxx
@@ -185,8 +185,8 @@ void SAL_CALL VCLXTabPageContainer::elementInserted( const css::container::Conta
Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
sal_Int16 nPageID = xP->getTabPageID();
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
- TabPage* pPage = static_cast<TabPage*>(pWindow);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
+ TabPage* pPage = static_cast<TabPage*>(pWindow.get());
pTabCtrl->InsertPage(nPageID,pPage->GetText());
pPage->Hide();
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index b3469f2e9ef3..12948c3e8d67 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1506,7 +1506,7 @@ css::uno::Reference< css::awt::XMessageBox > SAL_CALL VCLXToolkit::createMessage
css::uno::Reference< css::awt::XWindow > xWindow( xMsgBox, css::uno::UNO_QUERY );
if ( xMsgBox.is() && xWindow.is() )
{
- vcl::Window * pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow )
{
SolarMutexGuard aGuard;
@@ -1522,7 +1522,7 @@ css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > SAL_CALL V
{
SolarMutexGuard g;
- vcl::Window * pWindow = VCLUnoHelper::GetWindow( window );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( window );
if( pWindow )
return pWindow->GetDragGestureRecognizer();
@@ -1534,7 +1534,7 @@ css::uno::Reference< css::datatransfer::dnd::XDragSource > SAL_CALL VCLXToolkit:
{
SolarMutexGuard g;
- vcl::Window * pWindow = VCLUnoHelper::GetWindow( window );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( window );
if( pWindow )
return pWindow->GetDragSource();
@@ -1546,7 +1546,7 @@ css::uno::Reference< css::datatransfer::dnd::XDropTarget > SAL_CALL VCLXToolkit:
{
SolarMutexGuard g;
- vcl::Window * pWindow = VCLUnoHelper::GetWindow( window );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( window );
if( pWindow )
return pWindow->GetDropTarget();
@@ -1986,7 +1986,7 @@ void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent )
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
- vcl::Window * pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
@@ -2001,7 +2001,7 @@ void SAL_CALL VCLXToolkit::keyRelease( const css::awt::KeyEvent & aKeyEvent )
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
- vcl::Window * pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
@@ -2017,7 +2017,7 @@ void SAL_CALL VCLXToolkit::mousePress( const css::awt::MouseEvent & aMouseEvent
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
- vcl::Window * pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
@@ -2032,7 +2032,7 @@ void SAL_CALL VCLXToolkit::mouseRelease( const css::awt::MouseEvent & aMouseEven
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
- vcl::Window * pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
@@ -2047,7 +2047,7 @@ void SAL_CALL VCLXToolkit::mouseMove( const css::awt::MouseEvent & aMouseEvent )
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
- vcl::Window * pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 2f21102e5a4b..f8b90098c78f 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -876,7 +876,7 @@ Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const
{
Size aSz = rOutSz;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
sal_Int32 nLeft, nTop, nRight, nBottom;
@@ -1001,7 +1001,7 @@ void VCLXWindow::setVisible( sal_Bool bVisible ) throw(css::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
mpImpl->setDirectVisible( bVisible );
@@ -1013,7 +1013,7 @@ void VCLXWindow::setEnable( sal_Bool bEnable ) throw(css::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
pWindow->Enable( bEnable, false ); // #95824# without children!
@@ -1179,10 +1179,10 @@ sal_Bool VCLXWindow::isChild( const css::uno::Reference< css::awt::XWindowPeer >
SolarMutexGuard aGuard;
bool bIsChild = false;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
- vcl::Window* pPeerWindow = VCLUnoHelper::GetWindow( rxPeer );
+ VclPtr<vcl::Window> pPeerWindow = VCLUnoHelper::GetWindow( rxPeer );
bIsChild = pPeerWindow && pWindow->IsChild( pPeerWindow );
}
@@ -1389,7 +1389,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( !pWindow )
return;
@@ -1401,7 +1401,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
{
case BASEPROPERTY_REFERENCE_DEVICE:
{
- Control* pControl = dynamic_cast< Control* >( pWindow );
+ Control* pControl = dynamic_cast< Control* >( pWindow.get() );
OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
if ( !pControl )
break;
@@ -2238,7 +2238,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(css::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( !pWindow )
return;
@@ -2247,7 +2247,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(css::uno::RuntimeExcep
OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics );
if (!pDev)
pDev = pWindow->GetParent();
- TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow );
+ TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow.get() );
if ( pTabPage )
{
Point aPos( nX, nY );
@@ -2406,7 +2406,7 @@ void SAL_CALL VCLXWindow::enableDocking( sal_Bool bEnable ) throw (css::uno::Run
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
pWindow->EnableDocking( bEnable );
}
@@ -2415,7 +2415,7 @@ sal_Bool SAL_CALL VCLXWindow::isFloating( ) throw (css::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if( pWindow )
return vcl::Window::GetDockingManager()->IsFloating( pWindow );
else
@@ -2426,7 +2426,7 @@ void SAL_CALL VCLXWindow::setFloatingMode( sal_Bool bFloating ) throw (css::uno:
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if( pWindow )
vcl::Window::GetDockingManager()->SetFloatingMode( pWindow, bFloating );
}
@@ -2435,7 +2435,7 @@ sal_Bool SAL_CALL VCLXWindow::isLocked( ) throw (css::uno::RuntimeException, st
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if( pWindow )
return vcl::Window::GetDockingManager()->IsLocked( pWindow );
else
@@ -2446,7 +2446,7 @@ void SAL_CALL VCLXWindow::lock( ) throw (css::uno::RuntimeException, std::excep
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if( pWindow && !vcl::Window::GetDockingManager()->IsFloating( pWindow ) )
vcl::Window::GetDockingManager()->Lock( pWindow );
}
@@ -2455,10 +2455,11 @@ void SAL_CALL VCLXWindow::unlock( ) throw (css::uno::RuntimeException, std::exc
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if( pWindow && !vcl::Window::GetDockingManager()->IsFloating( pWindow ) )
vcl::Window::GetDockingManager()->Unlock( pWindow );
}
+
void SAL_CALL VCLXWindow::startPopupMode( const css::awt::Rectangle& ) throw (css::uno::RuntimeException, std::exception)
{
// TODO: remove interface in the next incompatible build
diff --git a/toolkit/source/awt/vclxwindow1.cxx b/toolkit/source/awt/vclxwindow1.cxx
index cbace5c381c5..e706418db73b 100644
--- a/toolkit/source/awt/vclxwindow1.cxx
+++ b/toolkit/source/awt/vclxwindow1.cxx
@@ -37,7 +37,7 @@
void VCLXWindow::SetSystemParent_Impl( const css::uno::Any& rHandle )
{
// does only work for WorkWindows
- vcl::Window *pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow->GetType() != WINDOW_WORKWINDOW )
{
css::uno::RuntimeException aException;
@@ -91,7 +91,7 @@ void VCLXWindow::SetSystemParent_Impl( const css::uno::Any& rHandle )
#endif
// set system parent
- static_cast<WorkWindow*>(pWindow)->SetPluginParent( &aSysParentData );
+ static_cast<WorkWindow*>(pWindow.get())->SetPluginParent( &aSysParentData );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index a4b87e7f7783..4c3b6041c9c7 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -423,7 +423,7 @@ void VCLXButton::setLabel( const OUString& rLabel ) throw(css::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
pWindow->SetText( rLabel );
}
@@ -847,7 +847,7 @@ void VCLXCheckBox::setLabel( const OUString& rLabel ) throw(css::uno::RuntimeExc
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
pWindow->SetText( rLabel );
}
@@ -1213,7 +1213,7 @@ void VCLXRadioButton::setLabel( const OUString& rLabel ) throw(css::uno::Runtime
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
pWindow->SetText( rLabel );
}
@@ -1410,7 +1410,7 @@ void VCLXSpinField::enableRepeat( sal_Bool bRepeat ) throw(css::uno::RuntimeExce
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
WinBits nStyle = pWindow->GetStyle();
@@ -2185,7 +2185,7 @@ void VCLXMessageBox::setCaptionText( const OUString& rText ) throw(css::uno::Run
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
pWindow->SetText( rText );
}
@@ -2195,7 +2195,7 @@ OUString VCLXMessageBox::getCaptionText() throw(css::uno::RuntimeException, std:
SolarMutexGuard aGuard;
OUString aText;
- vcl::Window* pWindow = GetWindow();
+ VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
aText = pWindow->GetText();
return aText;
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index adb398993403..3bf3d5d51d43 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -641,7 +641,7 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent
VCLXWindow* pPeer;
{
SolarMutexGuard g;
- vcl::Window* pVclPeer = VCLUnoHelper::GetWindow( getPeer() );
+ VclPtr<vcl::Window> pVclPeer = VCLUnoHelper::GetWindow( getPeer() );
pPeer = pVclPeer ? pVclPeer->GetWindowPeer() : nullptr;
}
VclListenerLock aNoVclEventMultiplexing( pPeer );
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 16dead5c76ad..69e16518838c 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -495,7 +495,7 @@ static Pointer lcl_msoPointerToLOPointer( long msoPointerStyle )
ScVbaControl::getMousePointer() throw (css::uno::RuntimeException, std::exception)
{
PointerStyle eType = PointerStyle::Arrow; // default ?
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( getWindowPeer() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( getWindowPeer() );
if ( pWindow )
{
eType = pWindow->GetPointer().GetStyle();
@@ -506,7 +506,7 @@ ScVbaControl::getMousePointer() throw (css::uno::RuntimeException, std::exceptio
void SAL_CALL
ScVbaControl::setMousePointer( ::sal_Int32 _mousepointer ) throw (css::uno::RuntimeException, std::exception)
{
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( getWindowPeer() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( getWindowPeer() );
if ( pWindow )
{
Pointer aPointer( PointerStyle::Arrow );
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index e19c1288ef0b..598907a5d575 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -722,7 +722,7 @@ void setCursorHelper( const uno::Reference< frame::XModel >& xModel, const Point
const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW );
const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
- vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
SAL_WARN_IF( !pWindow, "vbahelper", "ScVbaApplication::setCursor: no window!" );
if ( !pWindow )
continue;
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index cf93ac4b2e5b..2b212af24313 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -1156,9 +1156,7 @@ void ImplDockingWindowWrapper::SetFloatingMode( bool bFloatMode )
if( mpOldBorderWin == mpDockingWindow )
mpOldBorderWin = nullptr; // no border window found
- ImplDockFloatWin2* pWin =
- VclPtr<ImplDockFloatWin2>::Create(
-
+ VclPtrInstance<ImplDockFloatWin2> pWin(
mpParent,
mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ?
mnFloatBits | WB_SYSTEMWINDOW
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index c07dc2102e99..0a2518ee891d 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -714,9 +714,7 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
vcl::Window* pRealParent = mpWindowImpl->mpRealParent;
mpOldBorderWin = mpWindowImpl->mpBorderWindow;
- ImplDockFloatWin* pWin =
- VclPtr<ImplDockFloatWin>::Create(
-
+ VclPtrInstance<ImplDockFloatWin> pWin(
mpImplData->mpParent,
mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ? mnFloatBits | WB_SYSTEMWINDOW : mnFloatBits,
this );
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 872c2357d504..800a6ecfe78d 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2106,8 +2106,7 @@ void VclSizeGroup::trigger_queue_resize()
//sufficient to trigger one widget to trigger all of them
if (!m_aWindows.empty())
{
- vcl::Window *pWindow = *m_aWindows.begin();
- pWindow->queue_resize();
+ (*m_aWindows.begin())->queue_resize();
}
}