[Libreoffice-commits] core.git: accessibility/source basctl/source canvas/source chart2/source compilerplugins/clang cui/source dbaccess/source desktop/source drawinglayer/source extensions/source framework/source reportdesign/source sc/source sd/source sfx2/source svtools/source svx/source sw/source toolkit/source vbahelper/source vcl/source
Noel Grandin
noel.grandin at collabora.co.uk
Fri Nov 11 06:56:18 UTC 2016
accessibility/source/extended/accessibleiconchoicectrl.cxx | 16 -
accessibility/source/extended/accessiblelistbox.cxx | 6
accessibility/source/extended/textwindowaccessibility.cxx | 2
accessibility/source/helper/acc_factory.cxx | 2
accessibility/source/standard/floatingwindowaccessible.cxx | 2
accessibility/source/standard/vclxaccessiblebox.cxx | 2
accessibility/source/standard/vclxaccessiblebutton.cxx | 2
accessibility/source/standard/vclxaccessiblecheckbox.cxx | 2
accessibility/source/standard/vclxaccessibleedit.cxx | 6
accessibility/source/standard/vclxaccessibleradiobutton.cxx | 2
basctl/source/basicide/basicrenderable.cxx | 6
basctl/source/basicide/baside2.cxx | 2
basctl/source/basicide/basides1.cxx | 16 -
basctl/source/basicide/basides2.cxx | 4
basctl/source/basicide/basides3.cxx | 4
basctl/source/basicide/basidesh.cxx | 4
basctl/source/basicide/basobj2.cxx | 2
basctl/source/basicide/basobj3.cxx | 4
basctl/source/basicide/localizationmgr.cxx | 2
canvas/source/cairo/cairo_spritecanvas.cxx | 2
canvas/source/opengl/ogl_spritecanvas.cxx | 2
canvas/source/tools/canvastools.cxx | 2
canvas/source/vcl/windowoutdevholder.cxx | 2
chart2/source/controller/accessibility/AccessibleBase.cxx | 2
chart2/source/controller/accessibility/AccessibleChartView.cxx | 4
chart2/source/controller/accessibility/AccessibleTextHelper.cxx | 2
chart2/source/controller/dialogs/dlg_NumberFormat.cxx | 2
chart2/source/controller/main/ElementSelector.cxx | 2
chart2/source/controller/sidebar/Chart2PanelFactory.cxx | 2
compilerplugins/clang/vclwidgets.cxx | 60 ++++-
cui/source/dialogs/cuigaldlg.cxx | 2
cui/source/factory/dlgfact.cxx | 2
cui/source/options/treeopt.cxx | 2
cui/source/tabpages/macroass.cxx | 2
dbaccess/source/filter/xml/xmlfilter.cxx | 2
dbaccess/source/ui/browser/unodatbr.cxx | 4
dbaccess/source/ui/misc/databaseobjectview.cxx | 2
dbaccess/source/ui/querydesign/ConnectionLine.cxx | 2
dbaccess/source/ui/querydesign/JoinTableView.cxx | 4
dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 2
dbaccess/source/ui/querydesign/limitboxcontroller.cxx | 2
dbaccess/source/ui/querydesign/querycontroller.cxx | 2
desktop/source/app/app.cxx | 4
drawinglayer/source/primitive2d/controlprimitive2d.cxx | 9
extensions/source/bibliography/bibload.cxx | 2
extensions/source/bibliography/framectr.cxx | 2
extensions/source/bibliography/general.cxx | 4
extensions/source/propctrlr/formcomponenthandler.cxx | 2
framework/source/dispatch/closedispatcher.cxx | 6
framework/source/dispatch/windowcommanddispatch.cxx | 4
framework/source/helper/persistentwindowstate.cxx | 10
framework/source/helper/statusindicatorfactory.cxx | 2
framework/source/helper/tagwindowasmodified.cxx | 2
framework/source/helper/titlebarupdate.cxx | 12 -
framework/source/helper/vclstatusindicator.cxx | 2
framework/source/inc/pattern/window.hxx | 2
framework/source/layoutmanager/helpers.cxx | 12 -
framework/source/layoutmanager/layoutmanager.cxx | 32 +-
framework/source/layoutmanager/toolbarlayoutmanager.cxx | 66 ++---
framework/source/loadenv/loadenv.cxx | 16 -
framework/source/services/frame.cxx | 10
framework/source/services/taskcreatorsrv.cxx | 2
framework/source/tabwin/tabwindow.cxx | 14 -
framework/source/uielement/addonstoolbarmanager.cxx | 2
framework/source/uielement/addonstoolbarwrapper.cxx | 2
framework/source/uielement/menubarmanager.cxx | 4
framework/source/uielement/progressbarwrapper.cxx | 16 -
framework/source/uielement/statusbarwrapper.cxx | 2
framework/source/uielement/subtoolbarcontroller.cxx | 6
framework/source/uielement/toolbarmanager.cxx | 6
framework/source/uielement/toolbarsmenucontroller.cxx | 2
framework/source/uielement/toolbarwrapper.cxx | 2
reportdesign/source/ui/inspection/GeometryHandler.cxx | 2
reportdesign/source/ui/misc/UITools.cxx | 6
sc/source/ui/miscdlgs/retypepassdlg.cxx | 2
sc/source/ui/sidebar/ScPanelFactory.cxx | 2
sc/source/ui/vba/vbaeventshelper.cxx | 12 -
sd/source/ui/framework/factories/FullScreenPane.cxx | 6
sd/source/ui/framework/factories/ViewShellWrapper.cxx | 4
sd/source/ui/presenter/PresenterCanvas.cxx | 14 -
sd/source/ui/presenter/PresenterHelper.cxx | 24 +-
sd/source/ui/sidebar/PanelFactory.cxx | 4
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 11
sd/source/ui/slidesorter/shell/SlideSorterService.cxx | 4
sfx2/source/appl/appserv.cxx | 2
sfx2/source/appl/newhelp.cxx | 4
sfx2/source/appl/sfxhelp.cxx | 2
sfx2/source/dialog/backingcomp.cxx | 6
sfx2/source/dialog/dockwin.cxx | 2
sfx2/source/dialog/mailmodel.cxx | 2
sfx2/source/doc/iframe.cxx | 2
sfx2/source/doc/sfxbasemodel.cxx | 2
sfx2/source/inet/inettbc.cxx | 2
sfx2/source/notebookbar/SfxNotebookBar.cxx | 2
sfx2/source/sidebar/ControllerFactory.cxx | 2
sfx2/source/sidebar/FocusManager.cxx | 4
sfx2/source/sidebar/UnoDeck.cxx | 2
sfx2/source/view/classificationcontroller.cxx | 4
sfx2/source/view/frame2.cxx | 2
sfx2/source/view/ipclient.cxx | 2
sfx2/source/view/viewfrm.cxx | 2
sfx2/source/view/viewsh.cxx | 4
svtools/source/dialogs/wizardmachine.cxx | 2
svtools/source/hatchwindow/documentcloser.cxx | 2
svtools/source/uno/popupwindowcontroller.cxx | 4
svtools/source/uno/statusbarcontroller.cxx | 4
svtools/source/uno/svtxgridcontrol.cxx | 2
svtools/source/uno/unoiface.cxx | 120 +++++-----
svtools/source/uno/wizard/wizardpagecontroller.cxx | 8
svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx | 4
svx/source/fmcomp/fmgridif.cxx | 12 -
svx/source/fmcomp/gridctrl.cxx | 2
svx/source/gallery2/galbrws1.cxx | 2
svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 4
svx/source/sidebar/PanelFactory.cxx | 2
svx/source/tbxctrls/grafctrl.cxx | 2
svx/source/tbxctrls/linectrl.cxx | 3
svx/source/tbxctrls/tbcontrl.cxx | 4
svx/source/tbxctrls/tbunocontroller.cxx | 2
svx/source/tbxctrls/tbunosearchcontrollers.cxx | 32 +-
sw/source/ui/chrdlg/tblnumfm.cxx | 2
sw/source/ui/dialog/addrdlg.cxx | 2
sw/source/ui/frmdlg/uiborder.cxx | 2
sw/source/ui/index/cnttab.cxx | 8
sw/source/uibase/dbui/mailmergehelper.cxx | 3
sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx | 8
sw/source/uibase/sidebar/SwPanelFactory.cxx | 2
toolkit/source/awt/stylesettings.cxx | 10
toolkit/source/awt/vclxaccessiblecomponent.cxx | 8
toolkit/source/awt/vclxcontainer.cxx | 12 -
toolkit/source/awt/vclxsystemdependentwindow.cxx | 4
toolkit/source/awt/vclxtabpagecontainer.cxx | 4
toolkit/source/awt/vclxtoolkit.cxx | 18 -
toolkit/source/awt/vclxwindow.cxx | 31 +-
toolkit/source/awt/vclxwindow1.cxx | 4
toolkit/source/awt/vclxwindows.cxx | 12 -
toolkit/source/controls/unocontrol.cxx | 2
vbahelper/source/msforms/vbacontrol.cxx | 4
vbahelper/source/vbahelper/vbahelper.cxx | 2
vcl/source/window/dockmgr.cxx | 4
vcl/source/window/dockwin.cxx | 4
vcl/source/window/layout.cxx | 3
142 files changed, 499 insertions(+), 453 deletions(-)
New commits:
commit 78b4a1fb01af9ad3b3395a22f6e396be914b553e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Nov 10 12:53:02 2016 +0200
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 at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx
index cacf65c5..194e52a 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 fb9b580..367e92a 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 5fd3788..07a6708 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 a147cb9..7b5d872 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 7a3f1f5..51aee0c 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 9af428e..6f3997e 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 8b0faab..b7feea9 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 c50c827..9221c10 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 68e91f0..432315a 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 131cd03..23cae20 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 4e5a967..d1b7bce 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 351ce03..0afd147 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 59c3006..3f8f34c 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 40bd5c4..378d4c5 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 f8458f6..218ef57 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 2cea9d1..e24794b 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 5d939a7..b88a89f 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 d406120..f3cdc49 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 6ee7bdd..decf6d4 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 921850d..906c220 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 7e6bc04..c3bc92a 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 0b874e5..fdf8ab7 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 1afde92..4776ee5 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 a903d4b..b06f6d4 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 f249513..823c3b5 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 e715e07..d7d4fdd 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 9d0e54c..bcffbbd 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 e03a43c..e45b280 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 7265a07..1da8c63 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 2b1da02..d6007a6 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 3667772..b41dd00 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 01e97c7..8bf720f 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 7d968e3..a9e9e30 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 3325b3f..b05a057 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 2a2ddb2..43f4e01 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 5aa5f4f..6a60cec 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 6b91673..d764b50 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 0bd4d51..1ddeaf5 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 52d2de8..d87cff6 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 4f26fc9..ea8f22f 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 d4b3a13..cf17ee4 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 6dac16d..718611b 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 badeca5..7abfdda 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 8a06c03..8463055 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 6144d9e..c48bbe5 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 f07e61b..c197982 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 1cc434f..c963356 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 ae1f136..43fdf3e 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 eedefcd..afab7e8 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 bc9e638..1470007 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 9118335..6cfb1f0 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 6743289..9f4d658 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 5f47e85..47eb85b 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 4977e97..0f600e5 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 463cba6..1ca763e 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 87c95ad..04aa9d0 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 e7f1d0d..7bf7a3d 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 c43ba89..e808aab 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 4424595..583d622 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 c225542..2728512 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 a1b4fe6..09e5104 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 1120341..8757f8a 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 edd6289..be924db 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 5e9a536..b307448 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 5ce44fd..4de7933 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 c4df1f2..530df3e 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 916b001..c858484 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 bf843b9..3456dc7 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 af44f8a..36f679a 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 2009125..4c330b3 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 );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list