summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/accessibility/accessibledialogcontrolshape.cxx2
-rw-r--r--basctl/source/basicide/basidesh.cxx13
-rw-r--r--basctl/source/basicide/bastypes.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx2
-rw-r--r--chart2/source/controller/main/ChartController.cxx2
-rw-r--r--compilerplugins/clang/test/vclwidgets.cxx86
-rw-r--r--compilerplugins/clang/vclwidgets.cxx84
-rw-r--r--cui/source/customize/cfg.cxx2
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx4
-rw-r--r--cui/source/dialogs/passwdomdlg.cxx4
-rw-r--r--cui/source/tabpages/chardlg.cxx2
-rw-r--r--cui/source/tabpages/swpossizetabpage.cxx4
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx4
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx18
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx5
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclhelperbufferdevice.cxx6
-rw-r--r--extensions/source/dbpilots/gridwizard.cxx2
-rw-r--r--extensions/source/propctrlr/defaulthelpprovider.cxx2
-rw-r--r--extensions/source/propctrlr/formlinkdialog.cxx4
-rw-r--r--extensions/source/propctrlr/handlerhelper.cxx2
-rw-r--r--forms/source/richtext/richtextcontrol.cxx2
-rw-r--r--forms/source/solar/component/navbarcontrol.cxx2
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx2
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx18
-rw-r--r--framework/source/uielement/addonstoolbarwrapper.cxx2
-rw-r--r--framework/source/uielement/toolbarwrapper.cxx2
-rw-r--r--include/vcl/menu.hxx2
-rw-r--r--reportdesign/source/ui/dlg/CondFormat.cxx2
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx34
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx6
-rw-r--r--sc/source/ui/dbgui/pfiltdlg.cxx4
-rw-r--r--sc/source/ui/dbgui/pvfundlg.cxx2
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx3
-rw-r--r--sc/source/ui/unoobj/docuno.cxx2
-rw-r--r--sc/source/ui/view/tabview.cxx8
-rw-r--r--sc/source/ui/view/tabview3.cxx8
-rw-r--r--sc/source/ui/view/tabview4.cxx4
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx2
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx4
-rw-r--r--sd/source/ui/inc/PresentationViewShell.hxx4
-rw-r--r--sd/source/ui/inc/ViewShell.hxx4
-rw-r--r--sd/source/ui/slidesorter/controller/SlideSorterController.cxx10
-rw-r--r--sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx2
-rw-r--r--sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx6
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx2
-rw-r--r--sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx4
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorter.cxx6
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx2
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx18
-rw-r--r--sd/source/ui/slidesorter/view/SlsToolTip.cxx6
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.cxx2
-rw-r--r--sd/source/ui/view/drviews1.cxx8
-rw-r--r--sd/source/ui/view/presvish.cxx7
-rw-r--r--sd/source/ui/view/viewshe2.cxx4
-rw-r--r--sfx2/source/appl/workwin.cxx8
-rw-r--r--sfx2/source/dialog/backingwindow.cxx6
-rw-r--r--sfx2/source/doc/guisaveas.cxx2
-rw-r--r--sfx2/source/doc/objmisc.cxx2
-rw-r--r--sfx2/source/doc/printhelper.cxx4
-rw-r--r--sfx2/source/doc/printhelper.hxx2
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx2
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx2
-rw-r--r--sfx2/source/sidebar/UnoPanel.cxx2
-rw-r--r--solenv/CompilerTest_compilerplugins_clang.mk1
-rw-r--r--svtools/source/hatchwindow/hatchwindow.cxx2
-rw-r--r--svtools/source/uno/genericunodialog.cxx2
-rw-r--r--svx/source/dialog/srchdlg.cxx2
-rw-r--r--svx/source/fmcomp/fmgridif.cxx2
-rw-r--r--svx/source/form/datanavi.cxx2
-rw-r--r--svx/source/form/fmtextcontrolshell.cxx2
-rw-r--r--svx/source/form/formcontroller.cxx2
-rw-r--r--svx/source/svdraw/sdrpaintwindow.cxx2
-rw-r--r--svx/source/tbxctrls/layctrl.cxx2
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx2
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.cxx2
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx2
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.cxx2
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx4
-rw-r--r--sw/source/ui/index/cnttab.cxx42
-rw-r--r--sw/source/uibase/app/docsh2.cxx2
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx4
-rw-r--r--toolkit/source/awt/stylesettings.cxx10
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx34
-rw-r--r--toolkit/source/awt/vclxwindow.cxx8
-rw-r--r--toolkit/source/helper/vclunohelper.cxx2
-rw-r--r--vcl/source/app/help.cxx2
-rw-r--r--vcl/source/control/button.cxx6
-rw-r--r--vcl/source/window/accessibility.cxx7
-rw-r--r--vcl/source/window/builder.cxx7
-rw-r--r--vcl/source/window/menu.cxx4
-rw-r--r--vcl/source/window/syswin.cxx2
-rw-r--r--vcl/source/window/taskpanelist.cxx6
-rw-r--r--vcl/source/window/toolbox.cxx4
-rw-r--r--vcl/source/window/window2.cxx3
97 files changed, 374 insertions, 280 deletions
diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
index 05e16b6e3d17..ade2d1b2960d 100644
--- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx
+++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
@@ -176,7 +176,7 @@ vcl::Window* AccessibleDialogControlShape::GetWindow() const
{
Reference< awt::XControl > xControl( m_pDlgEdObj->GetControl(), UNO_QUERY );
if ( xControl.is() )
- pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() );
+ pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ).get();
}
return pWindow;
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index bcbbf46358fd..b8ad85cd725b 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -313,9 +313,8 @@ void Shell::onDocumentClosed( const ScriptDocument& _rDocument )
}
}
// delete windows outside main loop so we don't invalidate the original iterator
- for (auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it)
+ for (VclPtr<BaseWindow> const & pWin : aDeleteVec)
{
- BaseWindow* pWin = *it;
pWin->StoreData();
if ( pWin == pCurWin )
bSetCurWindow = true;
@@ -440,7 +439,7 @@ void Shell::OuterResizePixel( const Point &rPos, const Size &rSize )
IMPL_LINK( Shell, TabBarHdl, ::TabBar *, pCurTabBar, void )
{
sal_uInt16 nCurId = pCurTabBar->GetCurPageId();
- BaseWindow* pWin = aWindowTable[ nCurId ];
+ BaseWindow* pWin = aWindowTable[ nCurId ].get();
DBG_ASSERT( pWin, "Eintrag in TabBar passt zu keinem Fenster!" );
SetCurWindow( pWin );
}
@@ -559,9 +558,8 @@ void Shell::CheckWindows()
if ( pWin->GetStatus() & BASWIN_TOBEKILLED )
aDeleteVec.push_back( pWin );
}
- for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
+ for ( VclPtr<BaseWindow> const & pWin : aDeleteVec )
{
- BaseWindow* pWin = *it;
pWin->StoreData();
if ( pWin == pCurWin )
bSetCurWindow = true;
@@ -582,9 +580,8 @@ void Shell::RemoveWindows( const ScriptDocument& rDocument, const OUString& rLib
if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName )
aDeleteVec.push_back( pWin );
}
- for ( auto it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it )
+ for ( VclPtr<BaseWindow> const & pWin : aDeleteVec )
{
- BaseWindow* pWin = *it;
if ( pWin == pCurWin )
bChangeCurWindow = true;
pWin->StoreData();
@@ -737,7 +734,7 @@ void Shell::UpdateWindows()
{
if ( !pNextActiveWindow )
{
- pNextActiveWindow = FindApplicationWindow();
+ pNextActiveWindow = FindApplicationWindow().get();
}
SetCurWindow( pNextActiveWindow, true );
}
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 5b0f9debc066..337d44021411 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -585,7 +585,7 @@ void TabBar::Sort()
sal_uInt16 nId = GetPageId( i );
aTabBarSortHelper.nPageId = nId;
aTabBarSortHelper.aPageText = GetPageText( nId );
- BaseWindow* pWin = aWindowTable[ nId ];
+ BaseWindow* pWin = aWindowTable[ nId ].get();
if (dynamic_cast<ModulWindow*>(pWin))
{
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
index c1138a17e217..c800580f7af4 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
@@ -187,7 +187,7 @@ void CreationWizardUnoDlg::createDialogOnDemand()
{
VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParentWindow);
if (pImplementation)
- pParent = pImplementation->GetWindow();
+ pParent = pImplementation->GetWindow().get();
}
uno::Reference< XComponent > xComp( this );
if( m_xChartModel.is() )
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 40f2857859bb..3151d6c0acc0 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -396,7 +396,7 @@ IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewSelectHdl, SvxLightCtl3
IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton, void )
{
bool bIsAmbientLight = (pButton==m_pBtn_AmbientLight_Color);
- SvxColorListBox* pListBox = ( bIsAmbientLight ? m_pLB_AmbientLight : m_pLB_LightSource);
+ SvxColorListBox* pListBox = bIsAmbientLight ? m_pLB_AmbientLight.get() : m_pLB_LightSource.get();
SvColorDialog aColorDlg( this );
aColorDlg.SetColor( pListBox->GetSelectEntryColor() );
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 5998cfd8343f..d40782f48920 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -460,7 +460,7 @@ void SAL_CALL ChartController::attachFrame(
if (pParentComponent)
pParentComponent->setVisible(true);
- pParent = VCLUnoHelper::GetWindow( xContainerWindow );
+ pParent = VCLUnoHelper::GetWindow( xContainerWindow ).get();
}
if(m_pChartWindow)
diff --git a/compilerplugins/clang/test/vclwidgets.cxx b/compilerplugins/clang/test/vclwidgets.cxx
new file mode 100644
index 000000000000..c18c775c054a
--- /dev/null
+++ b/compilerplugins/clang/test/vclwidgets.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+#include <vcl/vclreferencebase.hxx>
+
+struct Widget : public VclReferenceBase
+{
+ VclPtr<Widget> mpParent;
+
+ void widget1() // expected-error {{Unreferenced externally visible function definition [loplugin:unreffun]}}
+ {
+ // test that we ignore assignments from a member field
+ Widget* p = mpParent;
+ (void)p;
+ // test against false+
+ p = true ? mpParent.get() : nullptr;
+ }
+
+ ~Widget() override
+ {
+ disposeOnce();
+ }
+
+ void dispose() override
+ {
+ mpParent.clear();
+ VclReferenceBase::dispose();
+ }
+};
+
+VclPtr<Widget> f()
+{
+ return nullptr;
+}
+
+Widget* g()
+{
+ return nullptr;
+}
+
+// test the variable init detection
+void bar() // expected-error {{Unreferenced externally visible function definition [loplugin:unreffun]}}
+{
+ Widget* p = f(); // expected-error {{assigning a returned-by-value VclPtr<T> to a T* variable is dodgy, should be assigned to a VclPtr. If you know that the RHS does not return a newly created T, then add a '.get()' to the RHS [loplugin:vclwidgets]}}
+ (void)p;
+ Widget* q = g();
+ (void)q;
+ Widget* r = nullptr;
+ (void)r;
+}
+
+// test the assignment detection
+void bar2() // expected-error {{Unreferenced externally visible function definition [loplugin:unreffun]}}
+{
+ Widget* p;
+ p = nullptr;
+ p = f(); // expected-error {{assigning a returned-by-value VclPtr<T> to a T* variable is dodgy, should be assigned to a VclPtr. If you know that the RHS does not return a newly created T, then add a '.get()' to the RHS [loplugin:vclwidgets]}}
+ (void)p;
+ Widget* q;
+ q = g();
+ (void)q;
+}
+
+
+// test against false+
+
+template<class T>
+T * get() { return nullptr; }
+
+void bar3() // expected-error {{Unreferenced externally visible function definition [loplugin:unreffun]}}
+{
+ Widget* p;
+ p = get<Widget>();
+}
+
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index d6007a65537b..b373d93cec98 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -46,7 +46,7 @@ public:
bool VisitCXXConstructExpr(const CXXConstructExpr *);
bool VisitBinaryOperator(const BinaryOperator *);
private:
- void checkAssignmentForVclPtrToRawConversion(const Type* lhsType, const Expr* rhs);
+ void checkAssignmentForVclPtrToRawConversion(const SourceLocation& sourceLoc, const Type* lhsType, const Expr* rhs);
bool isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl);
bool mbCheckingMemcpy = false;
};
@@ -251,13 +251,15 @@ bool VCLWidgets::VisitBinaryOperator(const BinaryOperator * binaryOperator)
if ( !binaryOperator->isAssignmentOp() ) {
return true;
}
- checkAssignmentForVclPtrToRawConversion(binaryOperator->getLHS()->getType().getTypePtr(), binaryOperator->getRHS());
+ SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
+ binaryOperator->getLocStart());
+ checkAssignmentForVclPtrToRawConversion(spellingLocation, 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)
+void VCLWidgets::checkAssignmentForVclPtrToRawConversion(const SourceLocation& spellingLocation, const Type* lhsType, const Expr* rhs)
{
if (!lhsType || !isa<PointerType>(lhsType)) {
return;
@@ -265,32 +267,72 @@ void VCLWidgets::checkAssignmentForVclPtrToRawConversion(const Type* lhsType, co
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;
- }
- }
+ StringRef filename = compiler.getSourceManager().getFilename(spellingLocation);
+ if (filename == SRCDIR "/include/rtl/ref.hxx") {
+ return;
}
const CXXRecordDecl* pointeeClass = lhsType->getPointeeType()->getAsCXXRecordDecl();
if (!isDerivedFromVclReferenceBase(pointeeClass)) {
return;
}
- const ExprWithCleanups* exprWithCleanups = dyn_cast<ExprWithCleanups>(rhs);
- if (!exprWithCleanups) {
+
+ // if we have T* on the LHS and VclPtr<T> on the RHS, we expect to see either
+ // an ImplicitCastExpr
+ // or a ExprWithCleanups and then an ImplicitCastExpr
+ if (auto implicitCastExpr = dyn_cast<ImplicitCastExpr>(rhs)) {
+ if (implicitCastExpr->getCastKind() != CK_UserDefinedConversion) {
+ return;
+ }
+ rhs = rhs->IgnoreCasts();
+ } else if (auto exprWithCleanups = dyn_cast<ExprWithCleanups>(rhs)) {
+ if (auto implicitCastExpr = dyn_cast<ImplicitCastExpr>(exprWithCleanups->getSubExpr())) {
+ if (implicitCastExpr->getCastKind() != CK_UserDefinedConversion) {
+ return;
+ }
+ rhs = exprWithCleanups->IgnoreCasts();
+ } else {
+ return;
+ }
+ } else {
+ return;
+ }
+ if (isa<CXXNullPtrLiteralExpr>(rhs)) {
return;
}
- const ImplicitCastExpr* implicitCast = dyn_cast<ImplicitCastExpr>(exprWithCleanups->getSubExpr());
- if (!implicitCast) {
+ if (isa<CXXThisExpr>(rhs)) {
return;
}
- //rhs->getType().dump();
+
+ // ignore assignments from a member field to a local variable, to avoid unnecessary refcounting traffic
+ if (auto callExpr = dyn_cast<CXXMemberCallExpr>(rhs)) {
+ if (auto calleeMemberExpr = dyn_cast<MemberExpr>(callExpr->getCallee())) {
+ if ((calleeMemberExpr = dyn_cast<MemberExpr>(calleeMemberExpr->getBase()->IgnoreImpCasts()))) {
+ if (isa<FieldDecl>(calleeMemberExpr->getMemberDecl())) {
+ return;
+ }
+ }
+ }
+ }
+
+ // ignore assignments from a local variable to a local variable, to avoid unnecessary refcounting traffic
+ if (auto callExpr = dyn_cast<CXXMemberCallExpr>(rhs)) {
+ if (auto calleeMemberExpr = dyn_cast<MemberExpr>(callExpr->getCallee())) {
+ if (auto declRefExpr = dyn_cast<DeclRefExpr>(calleeMemberExpr->getBase()->IgnoreImpCasts())) {
+ if (isa<VarDecl>(declRefExpr->getDecl())) {
+ return;
+ }
+ }
+ }
+ }
+ if (auto declRefExpr = dyn_cast<DeclRefExpr>(rhs->IgnoreImpCasts())) {
+ if (isa<VarDecl>(declRefExpr->getDecl())) {
+ return;
+ }
+ }
+
report(
DiagnosticsEngine::Warning,
- "assigning a returned-by-value VclPtr<T> to a T* variable is dodgy, should be assigned to a VclPtr",
+ "assigning a returned-by-value VclPtr<T> to a T* variable is dodgy, should be assigned to a VclPtr. If you know that the RHS does not return a newly created T, then add a '.get()' to the RHS",
rhs->getSourceRange().getBegin())
<< rhs->getSourceRange();
}
@@ -302,10 +344,12 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
if (isa<ParmVarDecl>(pVarDecl)) {
return true;
}
+ SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
+ pVarDecl->getLocStart());
if (pVarDecl->getInit()) {
- checkAssignmentForVclPtrToRawConversion(pVarDecl->getType().getTypePtr(), pVarDecl->getInit());
+ checkAssignmentForVclPtrToRawConversion(spellingLocation, pVarDecl->getType().getTypePtr(), pVarDecl->getInit());
}
- StringRef aFileName = compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(pVarDecl->getLocStart()));
+ StringRef aFileName = compiler.getSourceManager().getFilename(spellingLocation);
if (aFileName == SRCDIR "/include/vcl/vclptr.hxx")
return true;
if (aFileName == SRCDIR "/vcl/source/window/layout.cxx")
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 93139cae0cf3..42734d123479 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3730,7 +3730,7 @@ void ToolbarSaveInData::SetSystemStyle(
if ( xUIElement.is() )
xWindow.set( xUIElement->getRealInterface(), uno::UNO_QUERY );
- window = VCLUnoHelper::GetWindow( xWindow );
+ window = VCLUnoHelper::GetWindow( xWindow ).get();
}
if ( window != nullptr && window->GetType() == WINDOW_TOOLBOX )
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 2f6c5279eb7d..b4ffdc73c751 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -851,8 +851,8 @@ namespace svx
if (!_bTryBothDirections)
{
- CheckBox *pBox = _ePrimaryConversionDirection == HHC::eHangulToHanja?
- m_pHangulOnly : m_pHanjaOnly;
+ CheckBox *pBox = _ePrimaryConversionDirection == HHC::eHangulToHanja ?
+ m_pHangulOnly.get() : m_pHanjaOnly.get();
pBox->Check();
OnConversionDirectionClicked( pBox );
}
diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx
index 21b88d5e4c78..92866f30d842 100644
--- a/cui/source/dialogs/passwdomdlg.cxx
+++ b/cui/source/dialogs/passwdomdlg.cxx
@@ -115,8 +115,8 @@ IMPL_LINK_NOARG( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, Button *, void
ScopedVclPtrInstance< MessageDialog > aErrorBox(m_pParent, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch);
aErrorBox->Execute();
- Edit* pEdit = !bToOpenMatch ? m_pPasswdToOpenED : m_pPasswdToModifyED;
- Edit* pRepeatEdit = !bToOpenMatch? m_pReenterPasswdToOpenED : m_pReenterPasswdToModifyED;
+ Edit* pEdit = !bToOpenMatch ? m_pPasswdToOpenED.get() : m_pPasswdToModifyED.get();
+ Edit* pRepeatEdit = !bToOpenMatch? m_pReenterPasswdToOpenED.get() : m_pReenterPasswdToModifyED.get();
if (nMismatch == 1)
{
pEdit->SetText( "" );
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index fb2d9a5b995b..5bb00f455dc9 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -3206,7 +3206,7 @@ void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox )
void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket, bool bStart )
{
sal_Int32 nEntryPos = 0;
- ListBox* pBox = bStart ? m_pStartBracketLB : m_pEndBracketLB;
+ ListBox* pBox = bStart ? m_pStartBracketLB.get() : m_pEndBracketLB.get();
if ( 0 == cBracket )
pBox->SelectEntryPos(0);
else
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 43d95f5b129d..37324f46c139 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -1286,8 +1286,8 @@ IMPL_LINK( SvxSwPosSizeTabPage, RelHdl, ListBox&, rLB, void )
IMPL_LINK( SvxSwPosSizeTabPage, PosHdl, ListBox&, rLB, void )
{
bool bHori = &rLB == m_pHoriLB;
- ListBox *pRelLB = bHori ? m_pHoriToLB : m_pVertToLB;
- FixedText *pRelFT = bHori ? m_pHoriToFT : m_pVertToFT;
+ ListBox *pRelLB = bHori ? m_pHoriToLB.get() : m_pVertToLB.get();
+ FixedText *pRelFT = bHori ? m_pHoriToFT.get() : m_pVertToFT.get();
FrmMap *pMap = bHori ? m_pHMap : m_pVMap;
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 74706f5a3889..706a886e5778 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -687,7 +687,7 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine
OSL_ENSURE(_xContainer.is(),"Data source is NULL! -> GPF");
OSL_ENSURE( ( _eType >= E_TABLE ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OAppDetailPageHelper::fillNames: invalid type!" );
- DBTreeListBox* pList = m_pLists[ _eType ];
+ DBTreeListBox* pList = m_pLists[ _eType ].get();
OSL_ENSURE( pList, "OAppDetailPageHelper::fillNames: you really should create the list before calling this!" );
if ( !pList )
return;
@@ -809,7 +809,7 @@ void OAppDetailPageHelper::elementReplaced(ElementType _eType
SvTreeListEntry* OAppDetailPageHelper::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
{
SvTreeListEntry* pRet = nullptr;
- DBTreeListBox* pTreeView = m_pLists[_eType];
+ DBTreeListBox* pTreeView = m_pLists[_eType].get();
if( _eType == E_TABLE && pTreeView )
{
pRet = static_cast<OTableTreeListBox*>(pTreeView)->addedTable( _rName );
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index fb0a4d546c33..9b00cfa17a9b 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -452,7 +452,7 @@ namespace dbaui
Reference< XWindow > xWindow = getTopMostContainerWindow();
vcl::Window* pWin = nullptr;
if ( xWindow.is() )
- pWin = VCLUnoHelper::GetWindow(xWindow);
+ pWin = VCLUnoHelper::GetWindow(xWindow).get();
if ( !pWin )
pWin = getView()->Window::GetParent();
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index d87cff6e5b79..f08beeefdb3a 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -892,8 +892,8 @@ void OJoinTableView::SelectConn(OTableConnection* pConn)
OTableWindow* pConnDest = pConn->GetDestWin();
if (pConnSource && pConnDest)
{
- OTableWindowListBox* pSourceBox = pConnSource->GetListBox();
- OTableWindowListBox* pDestBox = pConnDest->GetListBox();
+ OTableWindowListBox* pSourceBox = pConnSource->GetListBox().get();
+ OTableWindowListBox* pDestBox = pConnDest->GetListBox().get();
if (pSourceBox && pDestBox)
{
pSourceBox->SelectAll(false);
@@ -1200,12 +1200,8 @@ OTableConnection* OJoinTableView::GetTabConn(const OTableWindow* pLhs,const OTab
if ((!pLhs || pLhs->ExistsAConn()) && (!pRhs || pRhs->ExistsAConn()))
{
- auto aIter = m_vTableConnection.begin();
- auto aEnd = m_vTableConnection.end();
- for(;aIter != aEnd;++aIter)
+ for(VclPtr<OTableConnection> const & pData : m_vTableConnection)
{
- OTableConnection* pData = *aIter;
-
if ( ( (pData->GetSourceWin() == pLhs)
&& ( (pData->GetDestWin() == pRhs)
|| (nullptr == pRhs)
@@ -1287,10 +1283,10 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt)
{
if ((aIter->second == m_aTableMap.rbegin()->second) && bForward)
// the last win is active and we're travelling forward -> select the first conn
- pNextConn = *m_vTableConnection.begin();
+ pNextConn = m_vTableConnection.begin()->get();
if ((aIter == m_aTableMap.begin()) && !bForward)
// the first win is active an we're traveling backward -> select the last conn
- pNextConn = *m_vTableConnection.rbegin();
+ pNextConn = m_vTableConnection.rbegin()->get();
}
if (!pNextConn)
@@ -1343,11 +1339,11 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt)
// no win for any reason -> select the next or previous conn
if (i < (sal_Int32)m_vTableConnection.size())
// there is a currently active conn
- pNextConn = m_vTableConnection[(i + (bForward ? 1 : m_vTableConnection.size() - 1)) % m_vTableConnection.size()];
+ pNextConn = m_vTableConnection[(i + (bForward ? 1 : m_vTableConnection.size() - 1)) % m_vTableConnection.size()].get();
else
{ // no tab win selected, no conn selected
if (!m_vTableConnection.empty())
- pNextConn = m_vTableConnection[bForward ? 0 : m_vTableConnection.size() - 1];
+ pNextConn = m_vTableConnection[bForward ? 0 : m_vTableConnection.size() - 1].get();
else if (!m_aTableMap.empty())
{
if(bForward)
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index f0c4fbc75d0f..f0dd20842eb6 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -171,11 +171,8 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
OTableWindow* pSourceWin = jxdSource.pListBox->GetTabWin();
OTableWindow* pDestWin = jxdDest.pListBox->GetTabWin();
- auto aIter = getTableConnections().begin();
- auto aEnd = getTableConnections().end();
- for(;aIter != aEnd;++aIter)
+ for(VclPtr<OTableConnection> const & pFirst : getTableConnections())
{
- OTableConnection* pFirst = *aIter;
if((pFirst->GetSourceWin() == pSourceWin && pFirst->GetDestWin() == pDestWin) ||
(pFirst->GetSourceWin() == pDestWin && pFirst->GetDestWin() == pSourceWin))
{
diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx
index 580dc1ca6ec8..0fbe95b96031 100644
--- a/dbaccess/source/ui/uno/ColumnControl.cxx
+++ b/dbaccess/source/ui/uno/ColumnControl.cxx
@@ -70,7 +70,7 @@ void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit
{
VCLXWindow* pParent = VCLXWindow::GetImplementation(rParentPeer);
if (pParent)
- pParentWin = pParent->GetWindow();
+ pParentWin = pParent->GetWindow().get();
}
OColumnPeer* pPeer = new OColumnPeer( pParentWin, m_xContext );
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 38ca3b11c6dc..abeb6fcdf8f4 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -58,7 +58,7 @@ namespace
VDevBuffer();
virtual ~VDevBuffer() override;
- VirtualDevice* alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMonoChrome);
+ VclPtr<VirtualDevice> alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMonoChrome);
void free(VirtualDevice& rDevice);
// Timer virtuals
@@ -91,10 +91,10 @@ namespace
}
}
- VirtualDevice* VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMonoChrome)
+ VclPtr<VirtualDevice> VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMonoChrome)
{
::osl::MutexGuard aGuard(m_aMutex);
- VirtualDevice* pRetval = nullptr;
+ VclPtr<VirtualDevice> pRetval;
sal_Int32 nBits = bMonoChrome ? 1 : rOutDev.GetBitCount();
diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx
index 698318bdae73..8be4a22e91e9 100644
--- a/extensions/source/dbpilots/gridwizard.cxx
+++ b/extensions/source/dbpilots/gridwizard.cxx
@@ -390,7 +390,7 @@ namespace dbp
IMPL_LINK(OGridFieldsSelection, OnEntryDoubleClicked, ListBox&, _rList, void)
{
- PushButton* pSimulateButton = m_pExistFields == &_rList ? m_pSelectOne : m_pDeselectOne;
+ PushButton* pSimulateButton = m_pExistFields == &_rList ? m_pSelectOne.get() : m_pDeselectOne.get();
if (pSimulateButton->IsEnabled())
{
OnMoveOneEntry( pSimulateButton );
diff --git a/extensions/source/propctrlr/defaulthelpprovider.cxx b/extensions/source/propctrlr/defaulthelpprovider.cxx
index f85e849e39af..776dabfab267 100644
--- a/extensions/source/propctrlr/defaulthelpprovider.cxx
+++ b/extensions/source/propctrlr/defaulthelpprovider.cxx
@@ -154,7 +154,7 @@ namespace pcr
try
{
Reference< XWindow > xControlWindow( _rxControl->getControlWindow(), UNO_QUERY_THROW );
- pControlWindow = VCLUnoHelper::GetWindow( xControlWindow );
+ pControlWindow = VCLUnoHelper::GetWindow( xControlWindow ).get();
}
catch( const Exception& )
{
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index dfaf22fdae94..b665f7a090c0 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -122,7 +122,7 @@ namespace pcr
void FieldLinkRow::fillList( LinkParticipant _eWhich, const Sequence< OUString >& _rFieldNames )
{
- ComboBox* pBox = ( _eWhich == eDetailField ) ? m_pDetailColumn : m_pMasterColumn;
+ ComboBox* pBox = ( _eWhich == eDetailField ) ? m_pDetailColumn.get() : m_pMasterColumn.get();
const OUString* pFieldName = _rFieldNames.getConstArray();
const OUString* pFieldNameEnd = pFieldName + _rFieldNames.getLength();
@@ -141,7 +141,7 @@ namespace pcr
void FieldLinkRow::SetFieldName( LinkParticipant _eWhich, const OUString& _rName )
{
- ComboBox* pBox = ( _eWhich == eDetailField ) ? m_pDetailColumn : m_pMasterColumn;
+ ComboBox* pBox = ( _eWhich == eDetailField ) ? m_pDetailColumn.get() : m_pMasterColumn.get();
pBox->SetText( _rName );
}
diff --git a/extensions/source/propctrlr/handlerhelper.cxx b/extensions/source/propctrlr/handlerhelper.cxx
index a4feb71ee2bd..d2e21a2dc5ac 100644
--- a/extensions/source/propctrlr/handlerhelper.cxx
+++ b/extensions/source/propctrlr/handlerhelper.cxx
@@ -287,7 +287,7 @@ namespace pcr
try
{
Reference< XWindow > xInspectorWindow( _rContext->getValueByName( "DialogParentWindow" ), UNO_QUERY_THROW );
- pInspectorWindow = VCLUnoHelper::GetWindow( xInspectorWindow );
+ pInspectorWindow = VCLUnoHelper::GetWindow( xInspectorWindow ).get();
}
catch( const Exception& )
{
diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx
index a9f8775c415e..4d2916dee931 100644
--- a/forms/source/richtext/richtextcontrol.cxx
+++ b/forms/source/richtext/richtextcontrol.cxx
@@ -175,7 +175,7 @@ namespace frm
{
VCLXWindow* pParentXWin = VCLXWindow::GetImplementation( _rParentPeer );
if ( pParentXWin )
- pParentWin = pParentXWin->GetWindow();
+ pParentWin = pParentXWin->GetWindow().get();
DBG_ASSERT( pParentWin, "ORichTextControl::createPeer: could not obtain the VCL-level parent window!" );
}
diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx
index c12b0e289118..cd0f1c33fe47 100644
--- a/forms/source/solar/component/navbarcontrol.cxx
+++ b/forms/source/solar/component/navbarcontrol.cxx
@@ -126,7 +126,7 @@ namespace frm
{
VCLXWindow* pParentXWin = VCLXWindow::GetImplementation( _rParentPeer );
if ( pParentXWin )
- pParentWin = pParentXWin->GetWindow();
+ pParentWin = pParentXWin->GetWindow().get();
DBG_ASSERT( pParentWin, "ONavigationBarControl::createPeer: could not obtain the VCL-level parent window!" );
}
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 83fc164c4805..756205886d34 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -711,7 +711,7 @@ void LayoutManager::implts_writeWindowStateData( const OUString& aName, const UI
// Retrieve output size from container Window
SolarMutexGuard aGuard;
- pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
+ pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ).get();
if ( pContainerWindow )
aContainerWinSize = pContainerWindow->GetOutputSizePixel();
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 2e28756a7bd0..a22381e560df 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -828,7 +828,7 @@ bool ToolbarLayoutManager::dockToolbar( const OUString& rResourceURL, ui::Dockin
{
SolarMutexGuard aGuard;
- pWindow = VCLUnoHelper::GetWindow( xWindow );
+ pWindow = VCLUnoHelper::GetWindow( xWindow ).get();
if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
{
pToolBox = static_cast<ToolBox *>(pWindow);
@@ -1421,7 +1421,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno
{
{
SolarMutexGuard aGuard;
- pWindow = VCLUnoHelper::GetWindow( xWindow );
+ pWindow = VCLUnoHelper::GetWindow( xWindow ).get();
if ( pWindow )
{
OUString aText = pWindow->GetText();
@@ -2262,7 +2262,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre
{
// Retrieve output size from container Window
SolarMutexGuard aGuard;
- pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow );
+ pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow ).get();
if ( pDockingWindow )
aDockingWinSize = pDockingWindow->GetOutputSizePixel();
}
@@ -2600,7 +2600,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
SolarMutexResettableGuard aReadLock;
uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
::Size aContainerWinSize;
- vcl::Window* pContainerWindow( nullptr );
+ vcl::Window* pContainerWindow( nullptr );
::Rectangle aDockingAreaOffsets( m_aDockingAreaOffsets );
aReadLock.clear();
@@ -2613,7 +2613,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
{
// Retrieve output size from container Window
SolarMutexGuard aGuard;
- pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ).get();
aContainerWinSize = pContainerWindow->GetOutputSizePixel();
}
@@ -2640,7 +2640,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
{
SolarMutexGuard aGuard;
- pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow );
+ pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ).get();
VclPtr<vcl::Window> pDockWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pDockWindow && pDockWindow->GetType() == WINDOW_TOOLBOX )
pToolBox = static_cast<ToolBox *>(pDockWindow.get());
@@ -3078,7 +3078,7 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d
vcl::Window* pDockingAreaWindow( nullptr );
{
SolarMutexGuard aGuard;
- pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow );
+ pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ).get();
VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
nDockPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( ::Point( 0, nPosY ))).Y();
}
@@ -3273,7 +3273,7 @@ throw (uno::RuntimeException, std::exception)
::Point aMousePos;
{
SolarMutexGuard aGuard;
- pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ).get();
aMousePos = pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y ));
}
@@ -3642,7 +3642,7 @@ throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
xWindow.set( e.Source, uno::UNO_QUERY );
- pWindow = VCLUnoHelper::GetWindow( xWindow );
+ pWindow = VCLUnoHelper::GetWindow( xWindow ).get();
if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
pToolBox = static_cast<ToolBox *>(pWindow);
diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx
index 4de793340e67..0214754d0dca 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -105,7 +105,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument
if ( xFrame.is() && m_aConfigData.getLength() > 0 )
{
// Create VCL based toolbar which will be filled with settings data
- ToolBox* pToolBar = nullptr;
+ VclPtr<ToolBox> pToolBar;
AddonsToolBarManager* pToolBarManager = nullptr;
{
SolarMutexGuard aSolarMutexGuard;
diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx
index 8733666c047b..288294ada9ac 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -141,7 +141,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) th
if ( xFrame.is() && m_xConfigSource.is() )
{
// Create VCL based toolbar which will be filled with settings data
- ToolBox* pToolBar = nullptr;
+ VclPtr<ToolBox> pToolBar;
ToolBarManager* pToolBarManager = nullptr;
{
SolarMutexGuard aSolarMutexGuard;
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 959d54d9f118..8b996df37bd6 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -413,7 +413,7 @@ class VCL_DLLPUBLIC MenuBar : public Menu
friend class MenuFloatingWindow;
friend class SystemWindow;
- SAL_DLLPRIVATE static vcl::Window* ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu);
+ SAL_DLLPRIVATE static VclPtr<vcl::Window> ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu);
SAL_DLLPRIVATE static void ImplDestroy(MenuBar* pMenu, bool bDelete);
SAL_DLLPRIVATE bool ImplHandleKeyEvent(const KeyEvent& rKEvent);
SAL_DLLPRIVATE bool ImplHandleCmdEvent(const CommandEvent& rCEvent);
diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx
index 5f398ffceaf1..32d81f7fa689 100644
--- a/reportdesign/source/ui/dlg/CondFormat.cxx
+++ b/reportdesign/source/ui/dlg/CondFormat.cxx
@@ -284,7 +284,7 @@ namespace rptui
m_xCopy->removeByIndex( (sal_Int32)nOldConditionIndex );
Conditions::iterator aRemovePos( m_aConditions.begin() + nOldConditionIndex );
- pMovedCondition = *aRemovePos;
+ pMovedCondition = aRemovePos->get();
m_aConditions.erase( aRemovePos );
}
catch( const Exception& )
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 33f9669f6562..c1a4d5e8db91 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -219,11 +219,8 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)
{
bool bSet = false;
Point aStartPoint;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (;aIter != aEnd ; ++aIter)
+ for (VclPtr<OSectionWindow> const & pSectionWindow : m_aSections)
{
- OSectionWindow* pSectionWindow = (*aIter);
if ( pSectionWindow == &_rSectionWindow )
{
aStartPoint = pSectionWindow->GetPosPixel();
@@ -248,11 +245,8 @@ void OViewsWindow::Resize()
{
const Point aOffset(m_pParent->getThumbPos());
Point aStartPoint(0,-aOffset.Y());
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (;aIter != aEnd ; ++aIter)
+ for (VclPtr<OSectionWindow> const & pSectionWindow : m_aSections)
{
- OSectionWindow* pSectionWindow = (*aIter);
impl_resizeSectionWindow(*pSectionWindow,aStartPoint,true);
}
}
@@ -420,13 +414,11 @@ OSectionWindow* OViewsWindow::getSectionWindow(const uno::Reference< report::XSe
OSL_ENSURE(_xSection.is(),"Section is NULL!");
OSectionWindow* pSectionWindow = nullptr;
- TSectionsMap::const_iterator aIter = m_aSections.begin();
- TSectionsMap::const_iterator aEnd = m_aSections.end();
- for (; aIter != aEnd ; ++aIter)
+ for (VclPtr<OSectionWindow> const & p : m_aSections)
{
- if ((*aIter)->getReportSection().getSection() == _xSection)
+ if (p->getReportSection().getSection() == _xSection)
{
- pSectionWindow = (*aIter);
+ pSectionWindow = p.get();
break;
}
}
@@ -447,23 +439,23 @@ OSectionWindow* OViewsWindow::getMarkedSection(NearSectionAccess nsa) const
{
if (nsa == CURRENT)
{
- pRet = (*aIter);
+ pRet = aIter->get();
break;
}
else if ( nsa == PREVIOUS )
{
if (nCurrentPosition > 0)
{
- pRet = (*(--aIter));
+ pRet = (--aIter)->get();
if (pRet == nullptr)
{
- pRet = (*m_aSections.begin());
+ pRet = m_aSections.begin()->get();
}
}
else
{
// if we are out of bounds return the first one
- pRet = (*m_aSections.begin());
+ pRet = m_aSections.begin()->get();
}
break;
}
@@ -472,16 +464,16 @@ OSectionWindow* OViewsWindow::getMarkedSection(NearSectionAccess nsa) const
sal_uInt32 nSize = m_aSections.size();
if ((nCurrentPosition + 1) < nSize)
{
- pRet = *(++aIter);
+ pRet = (++aIter)->get();
if (pRet == nullptr)
{
- pRet = (*(--aEnd));
+ pRet = (--aEnd)->get();
}
}
else
{
// if we are out of bounds return the last one
- pRet = (*(--aEnd));
+ pRet = (--aEnd)->get();
}
break;
}
@@ -946,7 +938,7 @@ OSectionWindow* OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const
OSectionWindow* aReturn = nullptr;
if ( _nPos < m_aSections.size() )
- aReturn = m_aSections[_nPos];
+ aReturn = m_aSections[_nPos].get();
return aReturn;
}
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 357bb05a00eb..f1b055697e94 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -465,7 +465,7 @@ void ScFilterDlg::UpdateValueList( size_t nList )
if (pDoc && nList > 0 && nList <= QUERY_ENTRY_COUNT)
{
- ComboBox* pValList = maValueEdArr[nList-1];
+ ComboBox* pValList = maValueEdArr[nList-1].get();
const sal_Int32 nFieldSelPos = maFieldLbArr[nList-1]->GetSelectEntryPos();
sal_Int32 nListPos = 0;
OUString aCurValue = pValList->GetText();
@@ -576,7 +576,7 @@ void ScFilterDlg::UpdateHdrInValueList( size_t nList )
if (nPos == INVALID_HEADER_POS)
return;
- ComboBox* pValList = maValueEdArr[nList-1];
+ ComboBox* pValList = maValueEdArr[nList-1].get();
size_t nListPos = nPos + 2; // for "empty" and "non-empty"
const ScTypedStrData& rHdrEntry = m_EntryLists[nColumn]->maList[nPos];
@@ -601,7 +601,7 @@ void ScFilterDlg::ClearValueList( size_t nList )
{
if (nList > 0 && nList <= QUERY_ENTRY_COUNT)
{
- ComboBox* pValList = maValueEdArr[nList-1];
+ ComboBox* pValList = maValueEdArr[nList-1].get();
pValList->Clear();
pValList->InsertEntry( aStrNotEmpty, 0 );
pValList->InsertEntry( aStrEmpty, 1 );
diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx
index 7c2b75631221..33e7dfe70927 100644
--- a/sc/source/ui/dbgui/pfiltdlg.cxx
+++ b/sc/source/ui/dbgui/pfiltdlg.cxx
@@ -294,7 +294,7 @@ void ScPivotFilterDlg::UpdateValueList( sal_uInt16 nList )
{
if ( pDoc && nList>0 && nList<=3 )
{
- ComboBox* pValList = aValueEdArr[nList-1];
+ ComboBox* pValList = aValueEdArr[nList-1].get();
sal_Int32 nFieldSelPos = aFieldLbArr[nList-1]->GetSelectEntryPos();
sal_Int32 nListPos = 0;
OUString aCurValue = pValList->GetText();
@@ -338,7 +338,7 @@ void ScPivotFilterDlg::ClearValueList( sal_uInt16 nList )
{
if ( nList>0 && nList<=3 )
{
- ComboBox* pValList = aValueEdArr[nList-1];
+ ComboBox* pValList = aValueEdArr[nList-1].get();
pValList->Clear();
pValList->InsertEntry( aStrNotEmpty, 0 );
pValList->InsertEntry( aStrEmpty, 1 );
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 5a9ad2b33621..942ec571fe27 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -702,7 +702,7 @@ void ScDPSubtotalOptDlg::Init( const ScDPNameVec& rDataFields, bool bEnableLayou
pRBtn = m_pRbSortMan;
break;
default:
- pRBtn = maLabelData.maSortInfo.IsAscending ? m_pRbSortAsc : m_pRbSortDesc;
+ pRBtn = maLabelData.maSortInfo.IsAscending ? m_pRbSortAsc.get() : m_pRbSortDesc.get();
}
pRBtn->Check();
RadioClickHdl( pRBtn );
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 512af1b54b35..48a3449fb6f3 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -399,9 +399,8 @@ void ScFormulaReferenceHelper::RefInputDone( bool bForced )
pRefBtn->SetStartImage();
// All others: Show();
- for (auto aI = m_aHiddenWidgets.begin(); aI != m_aHiddenWidgets.end(); ++aI)
+ for (VclPtr<vcl::Window> const & pWindow : m_aHiddenWidgets)
{
- vcl::Window *pWindow = *aI;
pWindow->Show();
}
m_aHiddenWidgets.clear();
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7c3124930aca..7b61def5cb14 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1197,7 +1197,7 @@ static OutputDevice* lcl_GetRenderDevice( const uno::Sequence<beans::PropertyVal
VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
if ( pDevice )
{
- pRet = pDevice->GetOutputDevice();
+ pRet = pDevice->GetOutputDevice().get();
pRet->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
}
}
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 81ae3c778551..c05d098dcf21 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1715,7 +1715,7 @@ Point ScTabView::GetChartInsertPos( const Size& rSize, const ScRange& rCellRange
if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
eUsedPart = (WhichH(eUsedPart)==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
- ScGridWindow* pWin = pGridWin[eUsedPart];
+ ScGridWindow* pWin = pGridWin[eUsedPart].get();
OSL_ENSURE( pWin, "Window not found" );
if (pWin)
{
@@ -1832,7 +1832,7 @@ Point ScTabView::GetChartDialogPos( const Size& rDialogSize, const Rectangle& rL
if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
eUsedPart = (WhichH(eUsedPart)==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
- ScGridWindow* pWin = pGridWin[eUsedPart];
+ ScGridWindow* pWin = pGridWin[eUsedPart].get();
OSL_ENSURE( pWin, "Window not found" );
if (pWin)
{
@@ -2181,7 +2181,7 @@ void ScTabView::SetNewVisArea()
bool ScTabView::HasPageFieldDataAtCursor() const
{
- ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
+ ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()].get();
SCCOL nCol = aViewData.GetCurX();
SCROW nRow = aViewData.GetCurY();
if (pWin)
@@ -2192,7 +2192,7 @@ bool ScTabView::HasPageFieldDataAtCursor() const
void ScTabView::StartDataSelect()
{
- ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
+ ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()].get();
SCCOL nCol = aViewData.GetCurX();
SCROW nRow = aViewData.GetCurY();
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 7dce8524fec7..fb3d6b47ee50 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -717,7 +717,7 @@ void ScTabView::TestHintWindow()
if ( pData && pData->GetInput( aTitle, aMessage ) && !aMessage.isEmpty() )
{
ScSplitPos eWhich = aViewData.GetActivePart();
- ScGridWindow* pWin = pGridWin[eWhich];
+ ScGridWindow* pWin = pGridWin[eWhich].get();
SCCOL nCol = aViewData.GetCurX();
SCROW nRow = aViewData.GetCurY();
Point aPos = aViewData.GetScrPos( nCol, nRow, eWhich );
@@ -2112,7 +2112,7 @@ void ScTabView::KillEditView( bool bNoPaint )
auto lInvalidateWindows =
[&rInvRect] (ScTabView* pTabView)
{
- for (ScGridWindow* pWin: pTabView->pGridWin)
+ for (VclPtr<ScGridWindow> const & pWin: pTabView->pGridWin)
{
if (pWin)
pWin->Invalidate(rInvRect);
@@ -2808,7 +2808,7 @@ void ScTabView::HideListBox()
void ScTabView::UpdateInputContext()
{
- ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
+ ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()].get();
if (pWin)
pWin->UpdateInputContext();
@@ -2879,7 +2879,7 @@ void ScTabView::ZoomChanged()
HideNoteMarker();
// AW: To not change too much, use pWin here
- ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()];
+ ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()].get();
if ( pWin && aViewData.HasEditView( aViewData.GetActivePart() ) )
{
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index fbb40fa31e5a..fdc633dfaa2e 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -442,7 +442,7 @@ void ScTabView::InvertHorizontal( ScVSplitPos eWhich, long nDragPos )
for (sal_uInt16 i=0; i<4; i++)
if (WhichV((ScSplitPos)i)==eWhich)
{
- ScGridWindow* pWin = pGridWin[i];
+ ScGridWindow* pWin = pGridWin[i].get();
if (pWin)
{
Rectangle aRect( 0,nDragPos, pWin->GetOutputSizePixel().Width()-1,nDragPos+HDR_SLIDERSIZE-1 );
@@ -457,7 +457,7 @@ void ScTabView::InvertVertical( ScHSplitPos eWhich, long nDragPos )
for (sal_uInt16 i=0; i<4; i++)
if (WhichH((ScSplitPos)i)==eWhich)
{
- ScGridWindow* pWin = pGridWin[i];
+ ScGridWindow* pWin = pGridWin[i].get();
if (pWin)
{
Rectangle aRect( nDragPos,0, nDragPos+HDR_SLIDERSIZE-1,pWin->GetOutputSizePixel().Height()-1 );
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 5bf6eb97fa59..387dafc430ea 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -153,7 +153,7 @@ Reference<XResource> SAL_CALL BasicViewFactory::createResource (
// Get Window pointer for XWindow of the pane.
vcl::Window* pWindow = nullptr;
if (xPane.is())
- pWindow = VCLUnoHelper::GetWindow(xPane->getWindow());
+ pWindow = VCLUnoHelper::GetWindow(xPane->getWindow()).get();
// Get the view frame.
SfxViewFrame* pFrame = nullptr;
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index a752df79070e..20543b0fcd99 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -390,8 +390,8 @@ protected:
void DeleteActualPage();
void DeleteActualLayer();
- virtual SvxRuler* CreateHRuler(::sd::Window* pWin) override;
- virtual SvxRuler* CreateVRuler(::sd::Window* pWin) override;
+ virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin) override;
+ virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin) override;
virtual void UpdateHRuler() override;
virtual void UpdateVRuler() override;
virtual void SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY) override;
diff --git a/sd/source/ui/inc/PresentationViewShell.hxx b/sd/source/ui/inc/PresentationViewShell.hxx
index 3651222cceb2..f5dfc5090dc7 100644
--- a/sd/source/ui/inc/PresentationViewShell.hxx
+++ b/sd/source/ui/inc/PresentationViewShell.hxx
@@ -53,8 +53,8 @@ public:
virtual void Resize() override;
protected:
- virtual SvxRuler* CreateHRuler(::sd::Window* pWin) override;
- virtual SvxRuler* CreateVRuler(::sd::Window* pWin) override;
+ virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin) override;
+ virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin) override;
private:
Rectangle maOldVisArea;
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index ab3c480acac6..fa1a6962cece 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -513,8 +513,8 @@ protected:
virtual void VirtVScrollHdl(ScrollBar* pVScroll);
// virtual functions ruler handling
- virtual SvxRuler* CreateHRuler(::sd::Window* pWin);
- virtual SvxRuler* CreateVRuler(::sd::Window* pWin);
+ virtual VclPtr<SvxRuler> CreateHRuler(::sd::Window* pWin);
+ virtual VclPtr<SvxRuler> CreateVRuler(::sd::Window* pWin);
virtual void UpdateHRuler();
virtual void UpdateVRuler();
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index c66987be6f8d..1fa0e030875c 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -120,7 +120,7 @@ SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter)
mnPaintEntranceCount(0),
mbIsContextMenuOpen(false)
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
OSL_ASSERT(pWindow);
if (pWindow)
{
@@ -483,7 +483,7 @@ void SlideSorterController::PostModelChange()
mbPostModelChangePending = false;
mrModel.Resync();
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow)
{
GetCurrentSlideManager()->HandleModelChange();
@@ -527,7 +527,7 @@ IMPL_LINK(SlideSorterController, ApplicationEventHandler, VclSimpleEvent&, rEven
IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent&, rEvent, void)
{
vcl::Window* pWindow = rEvent.GetWindow();
- sd::Window *pActiveWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pActiveWindow (mrSlideSorter.GetContentWindow().get());
switch (rEvent.GetId())
{
case VCLEVENT_WINDOW_ACTIVATE:
@@ -685,7 +685,7 @@ void SlideSorterController::Rearrange (bool bForce)
else
mbIsForcedRearrangePending = false;
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow)
{
if (bForce)
@@ -832,7 +832,7 @@ void SlideSorterController::PageNameHasChanged (int nPageIndex, const OUString&
// Get a pointer to the corresponding accessible object and notify
// that of the name change.
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if ( ! pWindow)
return;
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
index cbaf2dab436c..801e2a3c305b 100644
--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
@@ -86,7 +86,7 @@ void DragAndDropContext::UpdatePosition (
// Convert window coordinates into model coordinates (we need the
// window coordinates for auto-scrolling because that remains
// constant while scrolling.)
- sd::Window *pWindow (mpTargetSlideSorter->GetContentWindow());
+ sd::Window *pWindow = mpTargetSlideSorter->GetContentWindow().get();
const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
std::shared_ptr<InsertionIndicatorHandler> pInsertionIndicatorHandler (
mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler());
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
index 171b61226b75..f38ed105997c 100644
--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -175,7 +175,7 @@ void ScrollBarManager::PlaceFiller (const Rectangle& aArea)
void ScrollBarManager::UpdateScrollBars(bool bUseScrolling)
{
Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea());
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
Size aWindowModelSize (pWindow->PixelToLogic(pWindow->GetSizePixel()));
// The horizontal scroll bar is only shown when the window is
@@ -275,7 +275,7 @@ void ScrollBarManager::SetWindowOrigin (
mnHorizontalPosition = nHorizontalPosition;
mnVerticalPosition = nVerticalPosition;
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
Size aViewSize (pWindow->GetViewSize());
Point aOrigin (
(long int) (mnHorizontalPosition * aViewSize.Width()),
@@ -431,7 +431,7 @@ int ScrollBarManager::GetHorizontalScrollBarHeight() const
void ScrollBarManager::CalcAutoScrollOffset (const Point& rMouseWindowPosition)
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
int nDx = 0;
int nDy = 0;
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 8c18d5683f9d..c2ea99198f71 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -1367,7 +1367,7 @@ void MultiSelectionModeHandler::UpdatePosition (
// Convert window coordinates into model coordinates (we need the
// window coordinates for auto-scrolling because that remains
// constant while scrolling.)
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
bool bDoAutoScroll = bAllowAutoScroll && mrSlideSorter.GetController().GetScrollBarManager().AutoScroll(
diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
index 5af575cd4fdb..03e38021800e 100644
--- a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
@@ -104,7 +104,7 @@ void VisibleAreaManager::MakeVisible()
if (maVisibleRequests.empty())
return;
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if ( ! pWindow)
return;
const Point aCurrentTopLeft (pWindow->PixelToLogic(Point(0,0)));
@@ -147,7 +147,7 @@ void VisibleAreaManager::MakeVisible()
::boost::optional<Point> VisibleAreaManager::GetRequestedTopLeft() const
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if ( ! pWindow)
return ::boost::optional<Point>();
diff --git a/sd/source/ui/slidesorter/shell/SlideSorter.cxx b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
index 78dd6be59b5e..90698a2a73cd 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorter.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorter.cxx
@@ -168,7 +168,7 @@ void SlideSorter::Init()
SetupListeners ();
// Initialize the window.
- sd::Window *pContentWindow (GetContentWindow());
+ sd::Window *pContentWindow = GetContentWindow().get();
if (pContentWindow)
{
vcl::Window* pParentWindow = pContentWindow->GetParent();
@@ -249,7 +249,7 @@ void SlideSorter::SetupControls (vcl::Window* )
void SlideSorter::SetupListeners()
{
- sd::Window *pWindow (GetContentWindow());
+ sd::Window *pWindow = GetContentWindow().get();
if (pWindow)
{
vcl::Window* pParentWindow = pWindow->GetParent();
@@ -278,7 +278,7 @@ void SlideSorter::ReleaseListeners()
{
mpSlideSorterController->GetScrollBarManager().Disconnect();
- sd::Window *pWindow (GetContentWindow());
+ sd::Window *pWindow (GetContentWindow().get());
if (pWindow)
{
pWindow->RemoveEventListener(
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 344b076386f0..681385ac93fe 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -180,7 +180,7 @@ void SlideSorterViewShell::Initialize()
// the new view shell. (One is created earlier while the constructor
// of the base class is executed. At that time the correct
// accessibility object can not be constructed.)
- sd::Window *pWindow (mpSlideSorter->GetContentWindow());
+ sd::Window *pWindow (mpSlideSorter->GetContentWindow().get());
if (pWindow)
{
pWindow->Hide();
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index f7cbdcf762c6..2d5aa2ef48ce 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -209,7 +209,7 @@ sal_Int32 SlideSorterView::GetPageIndexAtPoint (const Point& rWindowPosition) co
{
sal_Int32 nIndex (-1);
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow)
{
nIndex = mpLayouter->GetIndexAtPoint(pWindow->PixelToLogic(rWindowPosition), false, false);
@@ -309,7 +309,7 @@ void SlideSorterView::Rearrange()
if (mrModel.GetPageCount() <= 0)
return;
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if ( ! pWindow)
return;
const Size aWindowSize (pWindow->GetSizePixel());
@@ -401,7 +401,7 @@ void SlideSorterView::UpdateOrientation()
void SlideSorterView::Layout ()
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow)
{
// Set the model area, i.e. the smallest rectangle that includes all
@@ -443,7 +443,7 @@ void SlideSorterView::InvalidatePageObjectVisibilities()
void SlideSorterView::DeterminePageObjectVisibilities()
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow)
{
// Set this flag to true here so that an invalidate during the
@@ -538,7 +538,7 @@ bool SlideSorterView::SetOrientation (const Layouter::Orientation eOrientation)
void SlideSorterView::RequestRepaint()
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow)
{
mpLayeredDevice->InvalidateAllLayers(
@@ -557,7 +557,7 @@ void SlideSorterView::RequestRepaint (const model::SharedPageDescriptor& rpDescr
void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow)
{
mpLayeredDevice->InvalidateAllLayers(rRepaintBox);
@@ -567,7 +567,7 @@ void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)
void SlideSorterView::RequestRepaint (const vcl::Region& rRepaintRegion)
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow)
{
mpLayeredDevice->InvalidateAllLayers(rRepaintRegion);
@@ -691,7 +691,7 @@ void SlideSorterView::ConfigurationChanged (
std::shared_ptr<cache::PageCache> const & SlideSorterView::GetPreviewCache()
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow && mpPreviewCache.get() == nullptr)
{
mpPreviewCache.reset(
@@ -757,7 +757,7 @@ void SlideSorterView::UpdatePageUnderMouse ()
return;
}
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (pWindow && pWindow->IsVisible() && ! pWindow->IsMouseCaptured())
{
const Window::PointerState aPointerState (pWindow->GetPointerState());
diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
index 33e08c10d1e4..4077e83068df 100644
--- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx
+++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
@@ -37,7 +37,7 @@ ToolTip::ToolTip (SlideSorter& rSlideSorter)
maShowTimer(),
maHiddenTimer()
{
- sd::Window *window = rSlideSorter.GetContentWindow();
+ sd::Window *window = rSlideSorter.GetContentWindow().get();
const HelpSettings& rHelpSettings = window->GetSettings().GetHelpSettings();
maShowTimer.SetTimeout(rHelpSettings.GetTipDelay());
maShowTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger));
@@ -104,7 +104,7 @@ void ToolTip::DoShow()
return;
}
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
if (!msCurrentHelpText.isEmpty() && pWindow)
{
Rectangle aBox (
@@ -141,7 +141,7 @@ bool ToolTip::Hide()
{
if (mnHelpWindowHandle>0)
{
- sd::Window *pWindow (mrSlideSorter.GetContentWindow());
+ sd::Window *pWindow (mrSlideSorter.GetContentWindow().get());
Help::HidePopover(pWindow, mnHelpWindowHandle);
mnHelpWindowHandle = 0;
return true;
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 8e408bb28bee..22e1151a7b5d 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -414,7 +414,7 @@ throw (UnknownPropertyException, PropertyVetoException,
SdOptionsPrintItem aOptionsPrintItem;
- SfxPrinter* pPrinter = pDocSh->GetPrinter( false );
+ VclPtr<SfxPrinter> pPrinter = pDocSh->GetPrinter( false );
if( pPrinter )
{
SdOptionsPrintItem const * pPrinterOptions = nullptr;
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 02b965c35346..f17f1c11a175 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -500,9 +500,9 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
* Generate horizontal ruler
*/
-SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin)
+VclPtr<SvxRuler> DrawViewShell::CreateHRuler (::sd::Window* pWin)
{
- Ruler* pRuler;
+ VclPtr<Ruler> pRuler;
WinBits aWBits;
SvxRulerSupportFlags nFlags = SvxRulerSupportFlags::OBJECT;
@@ -538,9 +538,9 @@ SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin)
* Generate vertical ruler
*/
-SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin)
+VclPtr<SvxRuler> DrawViewShell::CreateVRuler(::sd::Window* pWin)
{
- Ruler* pRuler;
+ VclPtr<SvxRuler> pRuler;
WinBits aWBits = WB_VSCROLL | WB_3DLOOK | WB_BORDER;
SvxRulerSupportFlags nFlags = SvxRulerSupportFlags::OBJECT;
diff --git a/sd/source/ui/view/presvish.cxx b/sd/source/ui/view/presvish.cxx
index cf83969ba7ba..db837f9c6460 100644
--- a/sd/source/ui/view/presvish.cxx
+++ b/sd/source/ui/view/presvish.cxx
@@ -28,10 +28,9 @@
#include "sddll.hxx"
#include <sfx2/request.hxx>
#include <sfx2/dispatch.hxx>
-
#include <sfx2/objface.hxx>
-
#include <svx/svxids.hrc>
+#include <svx/ruler.hxx>
#include "FrameView.hxx"
#include "sdresid.hxx"
#include "DrawDocShell.hxx"
@@ -107,12 +106,12 @@ void PresentationViewShell::FinishInitialization( FrameView* pFrameView )
GetActiveWindow()->GrabFocus();
}
-SvxRuler* PresentationViewShell::CreateHRuler(::sd::Window*)
+VclPtr<SvxRuler> PresentationViewShell::CreateHRuler(::sd::Window*)
{
return nullptr;
}
-SvxRuler* PresentationViewShell::CreateVRuler(::sd::Window*)
+VclPtr<SvxRuler> PresentationViewShell::CreateVRuler(::sd::Window*)
{
return nullptr;
}
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 4dcaa0f18af4..82b529e869d3 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -244,12 +244,12 @@ void ViewShell::VirtVScrollHdl(ScrollBar* pVScroll)
}
}
-SvxRuler* ViewShell::CreateHRuler(::sd::Window* )
+VclPtr<SvxRuler> ViewShell::CreateHRuler(::sd::Window* )
{
return nullptr;
}
-SvxRuler* ViewShell::CreateVRuler(::sd::Window* )
+VclPtr<SvxRuler> ViewShell::CreateVRuler(::sd::Window* )
{
return nullptr;
}
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 61a688ce6f4e..a030bb88e6bb 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -581,7 +581,7 @@ void SfxWorkWindow::DeleteControllers_Impl()
// DockingWindows)
for (size_t n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- SfxSplitWindow *p = pSplit[n];
+ VclPtr<SfxSplitWindow> const &p = pSplit[n];
if (p->GetWindowCount())
p->Lock();
}
@@ -1165,7 +1165,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
sal_uInt16 n;
for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- SfxSplitWindow *p = pSplit[n];
+ VclPtr<SfxSplitWindow> const & p = pSplit[n];
if (p->GetWindowCount())
p->Lock();
}
@@ -1250,7 +1250,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
// Unlock the SplitWindows again
for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- SfxSplitWindow *p = pSplit[n];
+ VclPtr<SfxSplitWindow> const & p = pSplit[n];
if (p->GetWindowCount())
p->Lock(false);
}
@@ -2388,7 +2388,7 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin )
// (not pinned, FadeIn).
// Only the abandoned window may be invisible, because perhaps its
// size is just being calculated before it is displayed.
- SfxSplitWindow* pSplitWin = pSplit[n];
+ VclPtr<SfxSplitWindow> const & pSplitWin = pSplit[n];
bool bDummyWindow = !pSplitWin->IsFadeIn();
vcl::Window *pDummy = pSplitWin->GetSplitWindow();
vcl::Window *pWin = bDummyWindow ? pDummy : pSplitWin;
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 15fa22588712..3afb9420b230 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -175,9 +175,8 @@ void BackingWindow::dispose()
// deregister drag&drop helper
if (mxDropTargetListener.is())
{
- for (auto aI = maDndWindows.begin(), aEnd = maDndWindows.end(); aI != aEnd; ++aI)
+ for (auto const & pDndWin : maDndWindows)
{
- vcl::Window *pDndWin = *aI;
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
pDndWin->GetDropTarget();
if (xDropTarget.is())
@@ -499,9 +498,8 @@ void BackingWindow::setOwningFrame( const css::uno::Reference< css::frame::XFram
// establish drag&drop mode
mxDropTargetListener.set(new OpenFileDropTargetListener(mxContext, mxFrame));
- for (auto aI = maDndWindows.begin(), aEnd = maDndWindows.end(); aI != aEnd; ++aI)
+ for (auto const & pDndWin : maDndWindows)
{
- vcl::Window *pDndWin = *aI;
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
pDndWin->GetDropTarget();
if (xDropTarget.is())
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 03b005fc4d11..7dcc6286271c 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1832,7 +1832,7 @@ bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XMod
vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel )
{
- vcl::Window* pWin = nullptr;
+ VclPtr<vcl::Window> pWin;
try {
if ( xModel.is() )
{
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index f750d1ee74dd..c862ad74001c 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1659,7 +1659,7 @@ bool SfxObjectShell::AdjustMacroMode()
vcl::Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium )
{
- vcl::Window* pWindow = nullptr;
+ VclPtr<vcl::Window> pWindow;
SfxItemSet* pSet = pLoadingMedium ? pLoadingMedium->GetItemSet() : GetMedium()->GetItemSet();
const SfxUnoFrameItem* pUnoItem = SfxItemSet::GetItem<SfxUnoFrameItem>(pSet, SID_FILLFRAME, false);
if ( pUnoItem )
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index d84f56b556a2..8887ca079ac6 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -313,7 +313,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro
void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >& rPrinter,
- SfxPrinter*& pPrinter,
+ VclPtr<SfxPrinter>& pPrinter,
SfxPrinterChangeFlags& nChangeFlags,
SfxViewShell*& pViewSh)
@@ -457,7 +457,7 @@ void SAL_CALL SfxPrintHelper::setPrinter(const uno::Sequence< beans::PropertyVal
SolarMutexGuard aGuard;
SfxViewShell* pViewSh = nullptr;
- SfxPrinter* pPrinter = nullptr;
+ VclPtr<SfxPrinter> pPrinter;
SfxPrinterChangeFlags nChangeFlags = SfxPrinterChangeFlags::NONE;
impl_setPrinter(rPrinter,pPrinter,nChangeFlags,pViewSh);
// set new printer
diff --git a/sfx2/source/doc/printhelper.hxx b/sfx2/source/doc/printhelper.hxx
index aedd9e211b6c..a91e5b5c384c 100644
--- a/sfx2/source/doc/printhelper.hxx
+++ b/sfx2/source/doc/printhelper.hxx
@@ -62,7 +62,7 @@ private:
osl::Mutex m_aMutex;
IMPL_PrintListener_DataContainer* m_pData ;
void impl_setPrinter(const css::uno::Sequence< css::beans::PropertyValue >& rPrinter,
- SfxPrinter*& pPrinter,
+ VclPtr<SfxPrinter>& pPrinter,
SfxPrinterChangeFlags& nChangeFlags,
SfxViewShell*& pViewSh);
} ;
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 87179deafe99..9994b5825087 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -419,7 +419,7 @@ SfxOwnFramesLocker::~SfxOwnFramesLocker()
vcl::Window* SfxOwnFramesLocker::GetVCLWindow( const Reference< frame::XFrame >& xFrame )
{
- vcl::Window* pWindow = nullptr;
+ VclPtr<vcl::Window> pWindow;
if ( xFrame.is() )
{
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index d6a51a01f2e9..97742b73b5fc 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -346,7 +346,7 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc)
for ( SharedPanelContainer::iterator iPanel(rPanels.begin()), iEnd(rPanels.end());
iPanel!=iEnd; ++iPanel)
{
- Panel* aPanel = *iPanel;
+ VclPtr<Panel> const & aPanel = *iPanel;
OUString panelId = aPanel->GetId();
std::shared_ptr<PanelDescriptor> xPanelDesc = GetPanelDescriptor(panelId);
diff --git a/sfx2/source/sidebar/UnoPanel.cxx b/sfx2/source/sidebar/UnoPanel.cxx
index 917a23692919..e696e32b0b88 100644
--- a/sfx2/source/sidebar/UnoPanel.cxx
+++ b/sfx2/source/sidebar/UnoPanel.cxx
@@ -98,7 +98,7 @@ void SAL_CALL SfxUnoPanel::expand( const sal_Bool bCollapseOther )
for ( SharedPanelContainer::iterator iPanel(aPanels.begin()), iEnd(aPanels.end());
iPanel!=iEnd; ++iPanel)
{
- Panel* aPanel = *iPanel;
+ VclPtr<Panel> const & aPanel = *iPanel;
if (! aPanel->HasIdPredicate(mPanelId))
aPanel->SetExpanded(false);
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index 1258aa6339a2..8bae92443fa8 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
compilerplugins/clang/test/oslendian-2 \
compilerplugins/clang/test/oslendian-3 \
compilerplugins/clang/test/salbool \
+ compilerplugins/clang/test/vclwidgets \
))
# vim: set noet sw=4 ts=4:
diff --git a/svtools/source/hatchwindow/hatchwindow.cxx b/svtools/source/hatchwindow/hatchwindow.cxx
index 148ff37d0d9f..e7216d25f256 100644
--- a/svtools/source/hatchwindow/hatchwindow.cxx
+++ b/svtools/source/hatchwindow/hatchwindow.cxx
@@ -45,7 +45,7 @@ void VCLXHatchWindow::initializeWindow( const uno::Reference< awt::XWindowPeer >
{
SolarMutexGuard aGuard;
- vcl::Window* pParent = nullptr;
+ VclPtr<vcl::Window> pParent;
VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( xParent );
if ( pParentComponent )
diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx
index 7f1b54b49fc5..1a6fab51fd62 100644
--- a/svtools/source/uno/genericunodialog.cxx
+++ b/svtools/source/uno/genericunodialog.cxx
@@ -168,7 +168,7 @@ bool OGenericUnoDialog::impl_ensureDialog_lck()
// get the parameters for the dialog from the current settings
// the parent window
- vcl::Window* pParent = nullptr;
+ VclPtr<vcl::Window> pParent;
VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParent);
if (pImplementation)
pParent = pImplementation->GetWindow();
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 4cea9248a627..6eade1edbddd 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -1593,7 +1593,7 @@ void SvxSearchDialog::Remember_Impl( const OUString &rStr, bool _bSearch )
return;
std::vector<OUString>* pArr = _bSearch ? &aSearchStrings : &aReplaceStrings;
- ComboBox* pListBox = _bSearch ? m_pSearchLB : m_pReplaceLB;
+ ComboBox* pListBox = _bSearch ? m_pSearchLB.get() : m_pReplaceLB.get();
// ignore identical strings
for (std::vector<OUString>::const_iterator i = pArr->begin(); i != pArr->end(); ++i)
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 936b4f6fe924..57f359ea8001 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -479,7 +479,7 @@ void SAL_CALL FmXGridControl::createPeer(const Reference< css::awt::XToolkit >&
{
VCLXWindow* pParent = VCLXWindow::GetImplementation(rParentPeer);
if (pParent)
- pParentWin = pParent->GetWindow();
+ pParentWin = pParent->GetWindow().get();
}
FmXGridPeer* pPeer = imp_CreatePeer(pParentWin);
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 3ce5917d35e5..7b921cad373b 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -1814,7 +1814,7 @@ namespace svxform
XFormsPage* DataNavigatorWindow::GetCurrentPage( sal_uInt16& rCurId )
{
rCurId = m_pTabCtrl->GetCurPageId();
- XFormsPage* pPage = nullptr;
+ VclPtr<XFormsPage> pPage;
OString sName(m_pTabCtrl->GetPageName(rCurId));
if (sName == "submissions")
{
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index 1110e8fc71f2..fc617478d000 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -491,7 +491,7 @@ namespace svx
if ( _rxControl.is() )
xControlPeer = _rxControl->getPeer();
if ( xControlPeer.is() )
- pWindow = VCLUnoHelper::GetWindow( xControlPeer );
+ pWindow = VCLUnoHelper::GetWindow( xControlPeer ).get();
}
catch( const Exception& )
{
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index f1773ea316ca..0a946926297c 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -3513,7 +3513,7 @@ vcl::Window* FormController::getDialogParentWindow()
{
Reference< XControl > xContainerControl( getContainer(), UNO_QUERY_THROW );
Reference< XWindowPeer > xContainerPeer( xContainerControl->getPeer(), UNO_QUERY_THROW );
- pParentWindow = VCLUnoHelper::GetWindow( xContainerPeer );
+ pParentWindow = VCLUnoHelper::GetWindow( xContainerPeer ).get();
}
catch( const Exception& )
{
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index 0467ab6495dd..46897dfc1b9f 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -93,7 +93,7 @@ void CandidateMgr::PaintTransparentChildren(vcl::Window & rWindow, Rectangle con
for (auto aI = m_aCandidates.begin(); aI != m_aCandidates.end(); ++aI)
{
- pCandidate = *aI;
+ pCandidate = aI->get();
if (m_aDeletedCandidates.find(pCandidate) != m_aDeletedCandidates.end())
continue;
//rhbz#1007697 this can cause the window itself to be
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index b0e707f58cfe..c6acafaffbe0 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -731,7 +731,7 @@ SvxColumnsToolBoxControl::~SvxColumnsToolBoxControl()
VclPtr<SfxPopupWindow> SvxColumnsToolBoxControl::CreatePopupWindow()
{
- ColumnsWindow* pWin = nullptr;
+ VclPtr<ColumnsWindow> pWin;
if(bEnabled)
{
pWin = VclPtr<ColumnsWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), m_xFrame );
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
index 1ec7821a5c92..832cc0dd8c0f 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -131,7 +131,7 @@ sal_Int16 SAL_CALL ChineseTranslation_UnoDialog::execute() throw(uno::RuntimeExc
{
VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParentWindow);
if (pImplementation)
- pParent = pImplementation->GetWindow();
+ pParent = pImplementation->GetWindow().get();
}
uno::Reference< XComponent > xComp( this );
m_pDialog = VclPtr<ChineseTranslationDialog>::Create( pParent );
diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx
index cf8b9f83e545..27086a9338f0 100644
--- a/sw/source/ui/dbui/createaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/createaddresslistdialog.cxx
@@ -314,7 +314,7 @@ void SwAddressControl_Impl::SetCursorTo(sal_uInt32 nElement)
{
if(nElement < m_aEdits.size())
{
- Edit* pEdit = m_aEdits[nElement];
+ Edit* pEdit = m_aEdits[nElement].get();
pEdit->GrabFocus();
Rectangle aRect(pEdit->GetPosPixel(), pEdit->GetSizePixel());
MakeVisible(aRect);
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 07526e03c151..8463afda22ce 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -404,7 +404,7 @@ void SwSelectAddressBlockDialog::SetSettings(
RadioButton *pActive = m_pNeverRB;
if(bIsCountry)
{
- pActive = !rCountry.isEmpty() ? m_pDependentRB : m_pAlwaysRB;
+ pActive = !rCountry.isEmpty() ? m_pDependentRB.get() : m_pAlwaysRB.get();
m_pCountryED->SetText(rCountry);
}
pActive->Check();
diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx
index 54cddf71f813..5bd89925b656 100644
--- a/sw/source/ui/dbui/mmgreetingspage.cxx
+++ b/sw/source/ui/dbui/mmgreetingspage.cxx
@@ -112,7 +112,7 @@ IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, Button*, pButton, void)
SwCustomizeAddressBlockDialog::GREETING_FEMALE ));
if(RET_OK == pDlg->Execute())
{
- ListBox* pToInsert = pButton == m_pMalePB ? m_pMaleLB : m_pFemaleLB;
+ ListBox* pToInsert = pButton == m_pMalePB ? m_pMaleLB.get() : m_pFemaleLB.get();
pToInsert->SelectEntryPos(pToInsert->InsertEntry(pDlg->GetAddress()));
if(m_bIsTabPage)
{
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index eab95eee09fc..034ab93583b7 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1952,8 +1952,8 @@ IMPL_LINK_NOARG(SwFramePage, AnchorTypeHdl, Button*, void)
IMPL_LINK( SwFramePage, PosHdl, ListBox&, rLB, void )
{
bool bHori = &rLB == m_pHorizontalDLB;
- ListBox *pRelLB = bHori ? m_pHoriRelationLB : m_pVertRelationLB;
- FixedText *pRelFT = bHori ? m_pHoriRelationFT : m_pVertRelationFT;
+ ListBox *pRelLB = bHori ? m_pHoriRelationLB.get() : m_pVertRelationLB.get();
+ FixedText *pRelFT = bHori ? m_pHoriRelationFT.get() : m_pVertRelationFT.get();
FrameMap *pMap = bHori ? m_pHMap : m_pVMap;
const sal_Int32 nMapPos = GetMapPos(pMap, rLB);
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 8105357a9976..72a0195cda58 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -2730,9 +2730,8 @@ void SwTokenWindow::setAllocation(const Size &rAllocation)
return;
Size aControlSize(m_pCtrlParentWin->GetSizePixel());
- for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
+ for (VclPtr<Control> const & pControl : aControlList)
{
- Control* pControl = (*it);
Size aSize(pControl->GetSizePixel());
aSize.Height() = aControlSize.Height();
pControl->SetSizePixel(aSize);
@@ -2747,9 +2746,8 @@ SwTokenWindow::~SwTokenWindow()
void SwTokenWindow::dispose()
{
- for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
+ for (VclPtr<Control> & pControl : aControlList)
{
- VclPtr<Control> pControl = (*it);
pControl->SetGetFocusHdl( Link<Control&,void>() );
pControl->SetLoseFocusHdl( Link<Control&,void>() );
pControl.disposeAndClear();
@@ -3195,7 +3193,7 @@ void SwTokenWindow::AdjustPositions()
if(aControlList.size() > 1)
{
ctrl_iterator it = aControlList.begin();
- Control* pCtrl = *it;
+ Control* pCtrl = it->get();
++it;
Point aNextPos = pCtrl->GetPosPixel();
@@ -3203,7 +3201,7 @@ void SwTokenWindow::AdjustPositions()
for(; it != aControlList.end(); ++it)
{
- pCtrl = *it;
+ pCtrl = it->get();
pCtrl->SetPosPixel(aNextPos);
aNextPos.X() += pCtrl->GetSizePixel().Width();
}
@@ -3215,10 +3213,8 @@ void SwTokenWindow::AdjustPositions()
void SwTokenWindow::MoveControls(long nOffset)
{
// move the complete list
- for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
+ for (VclPtr<Control> const & pCtrl : aControlList)
{
- Control *pCtrl = *it;
-
Point aPos = pCtrl->GetPosPixel();
aPos.X() += nOffset;
@@ -3282,10 +3278,8 @@ IMPL_LINK(SwTokenWindow, ScrollHdl, Button*, pBtn, void )
//find all start/end positions and print it
OUString sMessage("Space: " + OUString::number(nSpace) + " | ");
- for (ctrl_const_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
+ for (VclPtr<Control> const & pDebugCtrl : aControlList)
{
- Control *pDebugCtrl = *it;
-
long nDebugXPos = pDebugCtrl->GetPosPixel().X();
long nDebugWidth = pDebugCtrl->GetSizePixel().Width();
@@ -3301,7 +3295,7 @@ IMPL_LINK(SwTokenWindow, ScrollHdl, Button*, pBtn, void )
//find the first completely visible control (left edge visible)
for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
{
- Control *pCtrl = *it;
+ Control *pCtrl = it->get();
long nXPos = pCtrl->GetPosPixel().X();
@@ -3317,7 +3311,7 @@ IMPL_LINK(SwTokenWindow, ScrollHdl, Button*, pBtn, void )
//move the left neighbor to the start position
ctrl_iterator itLeft = it;
--itLeft;
- Control *pLeft = *itLeft;
+ Control *pLeft = itLeft->get();
nMove = -pLeft->GetPosPixel().X();
}
@@ -3331,7 +3325,7 @@ IMPL_LINK(SwTokenWindow, ScrollHdl, Button*, pBtn, void )
//find the first completely visible control (right edge visible)
for (ctrl_reverse_iterator it = aControlList.rbegin(); it != aControlList.rend(); ++it)
{
- Control *pCtrl = *it;
+ Control *pCtrl = it->get();
long nCtrlWidth = pCtrl->GetSizePixel().Width();
long nXPos = pCtrl->GetPosPixel().X() + nCtrlWidth;
@@ -3343,7 +3337,7 @@ IMPL_LINK(SwTokenWindow, ScrollHdl, Button*, pBtn, void )
//move the right neighbor to the right edge right aligned
ctrl_reverse_iterator itRight = it;
--itRight;
- Control *pRight = *itRight;
+ Control *pRight = itRight->get();
nMove = nSpace - pRight->GetPosPixel().X() - pRight->GetSizePixel().Width();
}
@@ -3361,10 +3355,10 @@ IMPL_LINK(SwTokenWindow, ScrollHdl, Button*, pBtn, void )
Control *pCtrl = nullptr;
- pCtrl = *(aControlList.begin());
+ pCtrl = aControlList.begin()->get();
m_pLeftScrollWin->Enable(pCtrl->GetPosPixel().X() < 0);
- pCtrl = *(aControlList.rbegin());
+ pCtrl = aControlList.rbegin()->get();
m_pRightScrollWin->Enable((pCtrl->GetPosPixel().X() + pCtrl->GetSizePixel().Width()) > nSpace);
}
}
@@ -3473,7 +3467,7 @@ IMPL_LINK(SwTokenWindow, NextItemHdl, SwTOXEdit&, rEdit, void)
ctrl_iterator iterFocus = it;
rEdit.IsNextControl() ? ++iterFocus : --iterFocus;
- Control *pCtrlFocus = *iterFocus;
+ Control *pCtrlFocus = iterFocus->get();
pCtrlFocus->GrabFocus();
static_cast<SwTOXButton*>(pCtrlFocus)->Check();
@@ -3484,12 +3478,10 @@ IMPL_LINK(SwTokenWindow, NextItemHdl, SwTOXEdit&, rEdit, void)
IMPL_LINK(SwTokenWindow, TbxFocusHdl, Control&, rControl, void)
{
SwTOXEdit* pEdit = static_cast<SwTOXEdit*>(&rControl);
- for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
+ for (VclPtr<Control> const & pCtrl : aControlList)
{
- Control *pCtrl = *it;
-
if (pCtrl && pCtrl->GetType() != WINDOW_EDIT)
- static_cast<SwTOXButton*>(pCtrl)->Check(false);
+ static_cast<SwTOXButton*>(pCtrl.get())->Check(false);
}
SetActiveControl(pEdit);
@@ -3512,7 +3504,7 @@ IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton&, rBtn, void )
ctrl_iterator iterFocus = it;
isNext ? ++iterFocus : --iterFocus;
- Control *pCtrlFocus = *iterFocus;
+ Control *pCtrlFocus = iterFocus->get();
pCtrlFocus->GrabFocus();
Selection aSel(0,0);
@@ -3537,7 +3529,7 @@ IMPL_LINK(SwTokenWindow, TbxFocusBtnHdl, Control&, rControl, void )
SwTOXButton* pBtn = static_cast<SwTOXButton*>(&rControl);
for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it)
{
- Control *pControl = *it;
+ Control *pControl = it->get();
if (pControl && WINDOW_EDIT != pControl->GetType())
static_cast<SwTOXButton*>(pControl)->Check(pBtn == pControl);
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 21c1b4854183..4198d18ec46b 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -641,7 +641,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
// the SourceView is not the 1 for SwWebDocShell
sal_uInt16 nSlot = SID_VIEWSHELL1;
bool bSetModified = false;
- SfxPrinter* pSavePrinter = nullptr;
+ VclPtr<SfxPrinter> pSavePrinter;
if( nullptr != pSrcView)
{
SfxPrinter* pTemp = GetDoc()->getIDocumentDeviceAccess().getPrinter( false );
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 7caf925b6464..a681f9ce1bfd 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -708,7 +708,7 @@ void SwPostItMgr::LayoutPostIts()
for(SwSidebarItem_iterator i = pPage->mList->begin(); i != pPage->mList->end(); ++i)
{
SwSidebarItem* pItem = (*i);
- SwSidebarWin* pPostIt = pItem->pPostIt;
+ VclPtr<SwSidebarWin> pPostIt = pItem->pPostIt;
if (pPage->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT )
{
@@ -745,7 +745,7 @@ void SwPostItMgr::LayoutPostIts()
if (mpAnswer)
{
if (pPostIt->CalcFollow()) //do we really have another note in front of this one
- static_cast<sw::annotation::SwAnnotationWin*>(pPostIt)->InitAnswer(mpAnswer);
+ static_cast<sw::annotation::SwAnnotationWin*>(pPostIt.get())->InitAnswer(mpAnswer);
delete mpAnswer;
mpAnswer = nullptr;
}
diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
index 8410554d2612..86ab25ce80bb 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -134,7 +134,7 @@ namespace toolkit
{
sal_Int32 lcl_getStyleColor( WindowStyleSettings_Data& i_rData, Color const & (StyleSettings::*i_pGetter)() const )
{
- const vcl::Window* pWindow = i_rData.pOwningWindow->GetWindow();
+ const VclPtr<vcl::Window>& pWindow = i_rData.pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return (aStyleSettings.*i_pGetter)().GetColor();
@@ -152,7 +152,7 @@ namespace toolkit
FontDescriptor lcl_getStyleFont( WindowStyleSettings_Data& i_rData, vcl::Font const & (StyleSettings::*i_pGetter)() const )
{
- const vcl::Window* pWindow = i_rData.pOwningWindow->GetWindow();
+ const VclPtr<vcl::Window>& pWindow = i_rData.pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return VCLUnoHelper::CreateFontDescriptor( (aStyleSettings.*i_pGetter)() );
@@ -385,7 +385,7 @@ namespace toolkit
::sal_Int32 SAL_CALL WindowStyleSettings::getFaceGradientColor() throw (RuntimeException, std::exception)
{
StyleMethodGuard aGuard( *m_pData );
- const vcl::Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return aStyleSettings.GetFaceGradientColor().GetColor();
@@ -675,7 +675,7 @@ namespace toolkit
::sal_Int32 SAL_CALL WindowStyleSettings::getSeparatorColor() throw (RuntimeException, std::exception)
{
StyleMethodGuard aGuard( *m_pData );
- const vcl::Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return aStyleSettings.GetSeparatorColor().GetColor();
@@ -741,7 +741,7 @@ namespace toolkit
sal_Bool SAL_CALL WindowStyleSettings::getHighContrastMode() throw (RuntimeException, std::exception)
{
StyleMethodGuard aGuard( *m_pData );
- const vcl::Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return aStyleSettings.GetHighContrastMode();
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 12948c3e8d67..116e77cb68ff 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -831,7 +831,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
OUString aServiceName( rDescriptor.WindowServiceName );
aServiceName = aServiceName.toAsciiLowerCase();
- vcl::Window* pNewWindow = nullptr;
+ VclPtr<vcl::Window> pNewWindow;
sal_uInt16 nType = ImplGetComponentType( aServiceName );
bool bFrameControl = false;
if ( aServiceName == "frame" )
@@ -886,7 +886,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_COMBOBOX:
pNewWindow = VclPtr<ComboBox>::Create( pParent, nWinBits|WB_AUTOHSCROLL );
- static_cast<ComboBox*>(pNewWindow)->EnableAutoSize( false );
+ static_cast<ComboBox*>(pNewWindow.get())->EnableAutoSize( false );
*ppNewComp = new VCLXComboBox;
break;
case WINDOW_CURRENCYBOX:
@@ -894,18 +894,18 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_CURRENCYFIELD:
pNewWindow = VclPtr<CurrencyField>::Create( pParent, nWinBits );
- static_cast<CurrencyField*>(pNewWindow)->EnableEmptyFieldValue( true );
+ static_cast<CurrencyField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXNumericField;
- static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<CurrencyField*>(pNewWindow)) );
+ static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<CurrencyField*>(pNewWindow.get())) );
break;
case WINDOW_DATEBOX:
pNewWindow = VclPtr<DateBox>::Create( pParent, nWinBits );
break;
case WINDOW_DATEFIELD:
pNewWindow = VclPtr<DateField>::Create( pParent, nWinBits );
- static_cast<DateField*>(pNewWindow)->EnableEmptyFieldValue( true );
+ static_cast<DateField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXDateField;
- static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<DateField*>(pNewWindow)) );
+ static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<DateField*>(pNewWindow.get())) );
break;
case WINDOW_DOCKINGAREA:
pNewWindow = VclPtr<DockingAreaWindow>::Create( pParent );
@@ -940,7 +940,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
pNewWindow = VclPtr<GroupBox>::Create( pParent, nWinBits );
if ( bFrameControl )
{
- GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow );
+ GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow.get() );
*ppNewComp = new VCLXFrame;
// Frame control needs to receive
// Mouse events
@@ -961,7 +961,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_LISTBOX:
pNewWindow = VclPtr<ListBox>::Create( pParent, nWinBits|WB_SIMPLEMODE|WB_AUTOHSCROLL );
- static_cast<ListBox*>(pNewWindow)->EnableAutoSize( false );
+ static_cast<ListBox*>(pNewWindow.get())->EnableAutoSize( false );
*ppNewComp = new VCLXListBox;
break;
case WINDOW_LONGCURRENCYBOX:
@@ -970,7 +970,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WINDOW_LONGCURRENCYFIELD:
pNewWindow = VclPtr<LongCurrencyField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXCurrencyField;
- static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<LongCurrencyField*>(pNewWindow)) );
+ static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<LongCurrencyField*>(pNewWindow.get())) );
break;
case WINDOW_MENUBUTTON:
pNewWindow = VclPtr<MenuButton>::Create( pParent, nWinBits );
@@ -986,7 +986,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WINDOW_METRICFIELD:
pNewWindow = VclPtr<MetricField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXMetricField;
- static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<MetricField*>(pNewWindow)) );
+ static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<MetricField*>(pNewWindow.get())) );
break;
case WINDOW_DIALOG:
case WINDOW_MODALDIALOG:
@@ -1020,9 +1020,9 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_NUMERICFIELD:
pNewWindow = VclPtr<NumericField>::Create( pParent, nWinBits );
- static_cast<NumericField*>(pNewWindow)->EnableEmptyFieldValue( true );
+ static_cast<NumericField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXNumericField;
- static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<NumericField*>(pNewWindow)) );
+ static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<NumericField*>(pNewWindow.get())) );
break;
case WINDOW_OKBUTTON:
pNewWindow = VclPtr<OKButton>::Create( pParent, nWinBits );
@@ -1034,7 +1034,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WINDOW_PATTERNFIELD:
pNewWindow = VclPtr<PatternField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXPatternField;
- static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<PatternField*>(pNewWindow)) );
+ static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<PatternField*>(pNewWindow.get())) );
break;
case WINDOW_PUSHBUTTON:
pNewWindow = VclPtr<PushButton>::Create( pParent, nWinBits );
@@ -1057,7 +1057,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
// is not really valid: the controls are grouped after they have been created, but we're still in
// the creation process, so the RadioButton::Check relies on invalid grouping information.
// 07.08.2001 - #87254# - frank.schoenheit@sun.com
- static_cast<RadioButton*>(pNewWindow)->EnableRadioCheck( false );
+ static_cast<RadioButton*>(pNewWindow.get())->EnableRadioCheck( false );
break;
case WINDOW_SCROLLBAR:
pNewWindow = VclPtr<ScrollBar>::Create( pParent, nWinBits );
@@ -1105,9 +1105,9 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_TIMEFIELD:
pNewWindow = VclPtr<TimeField>::Create( pParent, nWinBits );
- static_cast<TimeField*>(pNewWindow)->EnableEmptyFieldValue( true );
+ static_cast<TimeField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXTimeField;
- static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<TimeField*>(pNewWindow)) );
+ static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<TimeField*>(pNewWindow.get())) );
break;
case WINDOW_TOOLBOX:
pNewWindow = VclPtr<ToolBox>::Create( pParent, nWinBits );
@@ -1256,7 +1256,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
css::uno::Reference< css::awt::XWindowPeer > xRef;
- vcl::Window* pParent = nullptr;
+ VclPtr<vcl::Window> pParent;
if ( rDescriptor.Parent.is() )
{
VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( rDescriptor.Parent );
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index f8b90098c78f..e4a449925886 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -2480,10 +2480,10 @@ sal_Bool SAL_CALL VCLXWindow::isInPopupMode( ) throw (css::uno::RuntimeExceptio
void SAL_CALL VCLXWindow::setOutputSize( const css::awt::Size& aSize ) throw (css::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- vcl::Window *pWindow;
+ VclPtr<vcl::Window> pWindow;
if( (pWindow = GetWindow()) != nullptr )
{
- DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
+ DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow.get());
if( pDockingWindow )
pDockingWindow->SetOutputSizePixel( VCLSize( aSize ) );
else
@@ -2494,10 +2494,10 @@ void SAL_CALL VCLXWindow::setOutputSize( const css::awt::Size& aSize ) throw (cs
css::awt::Size SAL_CALL VCLXWindow::getOutputSize( ) throw (css::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- vcl::Window *pWindow;
+ VclPtr<vcl::Window> pWindow;
if( (pWindow = GetWindow()) != nullptr )
{
- DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
+ DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow.get());
if( pDockingWindow )
return AWTSize( pDockingWindow->GetOutputSizePixel() );
else
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
index e6c8dfcbcdac..a1d977f53c68 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -152,7 +152,7 @@ css::uno::Reference< css::awt::XWindow> VCLUnoHelper::GetInterface( vcl::Window*
OutputDevice* VCLUnoHelper::GetOutputDevice( const css::uno::Reference< css::awt::XDevice>& rxDevice )
{
- OutputDevice* pOutDev = nullptr;
+ VclPtr<OutputDevice> pOutDev;
VCLXDevice* pDev = VCLXDevice::GetImplementation( rxDevice );
if ( pDev )
pOutDev = pDev->GetOutputDevice();
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index d63011b4cb2e..90f11d766732 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -502,7 +502,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHe
if (rHelpText.isEmpty() && !pSVData->maHelpData.mbRequestingHelp)
return;
- HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin;
+ VclPtr<HelpTextWindow> pHelpWin = pSVData->maHelpData.mpHelpWin;
sal_uInt16 nDelayMode = HELPDELAY_NORMAL;
if ( pHelpWin )
{
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 47dc44a22564..2feddafde72a 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2202,9 +2202,8 @@ void RadioButton::group(RadioButton &rOther)
}
//make all members of the group share the same button group
- for (auto aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI)
+ for (VclPtr<RadioButton> const & pButton : *m_xGroup)
{
- RadioButton* pButton = *aI;
pButton->m_xGroup = m_xGroup;
}
}
@@ -2221,9 +2220,8 @@ std::vector< VclPtr<RadioButton> > RadioButton::GetRadioButtonGroup(bool bInclud
if (bIncludeThis)
return *m_xGroup;
std::vector< VclPtr<RadioButton> > aGroup;
- for (auto aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI)
+ for (VclPtr<RadioButton> const & pRadioButton : *m_xGroup)
{
- RadioButton *pRadioButton = *aI;
if (pRadioButton == this)
continue;
aGroup.push_back(pRadioButton);
diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx
index 55c9d3071d36..ab2ac82bee85 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -605,11 +605,10 @@ vcl::Window* Window::GetAccessibleRelationLabeledBy() const
if (!aMnemonicLabels.empty())
{
//if we have multiple labels, then prefer the first that is visible
- for (auto aI = aMnemonicLabels.begin(), aEnd = aMnemonicLabels.end(); aI != aEnd; ++aI)
+ for (auto const & rCandidate : aMnemonicLabels)
{
- vcl::Window *pCandidate = *aI;
- if (pCandidate->IsVisible())
- return pCandidate;
+ if (rCandidate->IsVisible())
+ return rCandidate;
}
return aMnemonicLabels[0];
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index a3d626964eaf..32bd8b8e9d29 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -472,11 +472,8 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
}
//fdo#67378 merge the label into the disclosure button
- for (auto aI = m_pParserState->m_aExpanderWidgets.begin(),
- aEnd = m_pParserState->m_aExpanderWidgets.end(); aI != aEnd; ++aI)
+ for (VclPtr<VclExpander> const & pOne : m_pParserState->m_aExpanderWidgets)
{
- VclExpander *pOne = *aI;
-
vcl::Window *pChild = pOne->get_child();
vcl::Window* pLabel = pOne->GetWindow(GetWindowType::LastChild);
if (pLabel && pLabel != pChild && pLabel->GetType() == WINDOW_FIXEDTEXT)
@@ -2111,7 +2108,7 @@ void VclBuilder::handleChild(vcl::Window *pParent, xmlreader::XmlReader &reader)
{
if (name.equals("object") || name.equals("placeholder"))
{
- pCurrentChild = handleObject(pParent, reader);
+ pCurrentChild = handleObject(pParent, reader).get();
bool bObjectInserted = pCurrentChild && pParent != pCurrentChild;
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index e88914c2d361..ba1e6fd92e3e 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2478,9 +2478,9 @@ void MenuBar::SetDisplayable( bool bDisplayable )
}
}
-vcl::Window* MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu)
+VclPtr<vcl::Window> MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu)
{
- MenuBarWindow *pMenuBarWindow = dynamic_cast<MenuBarWindow*>(pWindow);
+ VclPtr<MenuBarWindow> pMenuBarWindow = dynamic_cast<MenuBarWindow*>(pWindow);
if (!pMenuBarWindow)
{
pWindow = pMenuBarWindow = VclPtr<MenuBarWindow>::Create( pParent );
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index f31dff20abf4..95c1652be2af 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -925,7 +925,7 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar)
{
MenuBar* pOldMenuBar = mpMenuBar;
vcl::Window* pOldWindow = nullptr;
- vcl::Window* pNewWindow=nullptr;
+ VclPtr<vcl::Window> pNewWindow;
mpMenuBar = pMenuBar;
if ( mpWindowImpl->mpBorderWindow && (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) )
diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx
index b5d1738de2d8..0cd840779a5a 100644
--- a/vcl/source/window/taskpanelist.cxx
+++ b/vcl/source/window/taskpanelist.cxx
@@ -176,7 +176,7 @@ bool TaskPaneList::HandleKeyEvent(const KeyEvent& rKeyEvent)
auto p = mTaskPanes.begin();
while( p != mTaskPanes.end() )
{
- vcl::Window *pWin = *p;
+ vcl::Window *pWin = p->get();
if( pWin->HasChildPathFocus( true ) )
{
// Ctrl-F6 goes directly to the document
@@ -252,7 +252,7 @@ vcl::Window* TaskPaneList::FindNextSplitter( vcl::Window *pWindow )
p = mTaskPanes.begin();
if( (*p)->ImplIsSplitter() && (*p)->IsReallyVisible() && !(*p)->IsDialog() && (*p)->GetParent()->HasChildPathFocus() )
{
- pWindow = *p;
+ pWindow = (*p).get();
break;
}
if( !pWindow ) // increment after test, otherwise first element is skipped
@@ -291,7 +291,7 @@ vcl::Window* TaskPaneList::FindNextFloat( vcl::Window *pWindow, bool bForward )
if( (*p)->IsReallyVisible() && !(*p)->ImplIsSplitter() &&
( (*p)->GetType() != WINDOW_MENUBARWINDOW || static_cast<MenuBarWindow*>(p->get())->CanGetFocus() ) )
{
- pWindow = *p;
+ pWindow = (*p).get();
break;
}
if( !pWindow ) // increment after test, otherwise first element is skipped
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 14579fafe3dc..a8be10972635 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -5590,7 +5590,7 @@ void ToolBox::ImplShowFocus()
ImplToolItem* pItem = ImplGetItem( mnHighItemId );
if( pItem->mpWindow && !pItem->mpWindow->IsDisposed() )
{
- vcl::Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow : pItem->mpWindow;
+ vcl::Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow.get() : pItem->mpWindow.get();
pWin->ImplGetWindowImpl()->mbDrawSelectionBackground = true;
pWin->Invalidate();
}
@@ -5604,7 +5604,7 @@ void ToolBox::ImplHideFocus()
ImplToolItem* pItem = ImplGetItem( mnHighItemId );
if( pItem && pItem->mpWindow )
{
- vcl::Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow : pItem->mpWindow;
+ vcl::Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow.get() : pItem->mpWindow.get();
pWin->ImplGetWindowImpl()->mbDrawSelectionBackground = false;
pWin->Invalidate();
}
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 24d1fa79eae2..095452df7b17 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1390,9 +1390,8 @@ void Window::queue_resize(StateChangedType eReason)
if (pWindowImpl->m_xSizeGroup && pWindowImpl->m_xSizeGroup->get_mode() != VCL_SIZE_GROUP_NONE)
{
std::set<VclPtr<vcl::Window> > &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
- for (auto aI = rWindows.begin(), aEnd = rWindows.end(); aI != aEnd; ++aI)
+ for (VclPtr<vcl::Window> const & pOther : rWindows)
{
- vcl::Window *pOther = *aI;
if (pOther == this)
continue;
queue_ungrouped_resize(pOther);