[Libreoffice-commits] core.git: basctl/source chart2/source compilerplugins/clang cui/source dbaccess/source drawinglayer/source extensions/source forms/source framework/source include/vcl reportdesign/source sc/source sd/source sfx2/source solenv/CompilerTest_compilerplugins_clang.mk svtools/source svx/source sw/source toolkit/source vcl/source
Noel Grandin
noel.grandin at collabora.co.uk
Tue Nov 29 06:46:11 UTC 2016
basctl/source/accessibility/accessibledialogcontrolshape.cxx | 2
basctl/source/basicide/basidesh.cxx | 13 -
basctl/source/basicide/bastypes.cxx | 2
chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx | 2
chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx | 2
chart2/source/controller/main/ChartController.cxx | 2
compilerplugins/clang/test/vclwidgets.cxx | 86 ++++++++++
compilerplugins/clang/vclwidgets.cxx | 84 +++++++--
cui/source/customize/cfg.cxx | 2
cui/source/dialogs/hangulhanjadlg.cxx | 4
cui/source/dialogs/passwdomdlg.cxx | 4
cui/source/tabpages/chardlg.cxx | 2
cui/source/tabpages/swpossizetabpage.cxx | 4
dbaccess/source/ui/app/AppDetailPageHelper.cxx | 4
dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx | 2
dbaccess/source/ui/querydesign/JoinTableView.cxx | 18 --
dbaccess/source/ui/relationdesign/RelationTableView.cxx | 5
dbaccess/source/ui/uno/ColumnControl.cxx | 2
drawinglayer/source/processor2d/vclhelperbufferdevice.cxx | 6
extensions/source/dbpilots/gridwizard.cxx | 2
extensions/source/propctrlr/defaulthelpprovider.cxx | 2
extensions/source/propctrlr/formlinkdialog.cxx | 4
extensions/source/propctrlr/handlerhelper.cxx | 2
forms/source/richtext/richtextcontrol.cxx | 2
forms/source/solar/component/navbarcontrol.cxx | 2
framework/source/layoutmanager/layoutmanager.cxx | 2
framework/source/layoutmanager/toolbarlayoutmanager.cxx | 18 +-
framework/source/uielement/addonstoolbarwrapper.cxx | 2
framework/source/uielement/toolbarwrapper.cxx | 2
include/vcl/menu.hxx | 2
reportdesign/source/ui/dlg/CondFormat.cxx | 2
reportdesign/source/ui/report/ViewsWindow.cxx | 34 +--
sc/source/ui/dbgui/filtdlg.cxx | 6
sc/source/ui/dbgui/pfiltdlg.cxx | 4
sc/source/ui/dbgui/pvfundlg.cxx | 2
sc/source/ui/miscdlgs/anyrefdg.cxx | 3
sc/source/ui/unoobj/docuno.cxx | 2
sc/source/ui/view/tabview.cxx | 8
sc/source/ui/view/tabview3.cxx | 8
sc/source/ui/view/tabview4.cxx | 4
sd/source/ui/framework/factories/BasicViewFactory.cxx | 2
sd/source/ui/inc/DrawViewShell.hxx | 4
sd/source/ui/inc/PresentationViewShell.hxx | 4
sd/source/ui/inc/ViewShell.hxx | 4
sd/source/ui/slidesorter/controller/SlideSorterController.cxx | 10 -
sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx | 2
sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx | 6
sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx | 2
sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx | 4
sd/source/ui/slidesorter/shell/SlideSorter.cxx | 6
sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 2
sd/source/ui/slidesorter/view/SlideSorterView.cxx | 18 +-
sd/source/ui/slidesorter/view/SlsToolTip.cxx | 6
sd/source/ui/unoidl/UnoDocumentSettings.cxx | 2
sd/source/ui/view/drviews1.cxx | 8
sd/source/ui/view/presvish.cxx | 7
sd/source/ui/view/viewshe2.cxx | 4
sfx2/source/appl/workwin.cxx | 8
sfx2/source/dialog/backingwindow.cxx | 6
sfx2/source/doc/guisaveas.cxx | 2
sfx2/source/doc/objmisc.cxx | 2
sfx2/source/doc/printhelper.cxx | 4
sfx2/source/doc/printhelper.hxx | 2
sfx2/source/doc/sfxbasemodel.cxx | 2
sfx2/source/sidebar/ResourceManager.cxx | 2
sfx2/source/sidebar/UnoPanel.cxx | 2
solenv/CompilerTest_compilerplugins_clang.mk | 1
svtools/source/hatchwindow/hatchwindow.cxx | 2
svtools/source/uno/genericunodialog.cxx | 2
svx/source/dialog/srchdlg.cxx | 2
svx/source/fmcomp/fmgridif.cxx | 2
svx/source/form/datanavi.cxx | 2
svx/source/form/fmtextcontrolshell.cxx | 2
svx/source/form/formcontroller.cxx | 2
svx/source/svdraw/sdrpaintwindow.cxx | 2
svx/source/tbxctrls/layctrl.cxx | 2
svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx | 2
sw/source/ui/dbui/createaddresslistdialog.cxx | 2
sw/source/ui/dbui/mmaddressblockpage.cxx | 2
sw/source/ui/dbui/mmgreetingspage.cxx | 2
sw/source/ui/frmdlg/frmpage.cxx | 4
sw/source/ui/index/cnttab.cxx | 42 +---
sw/source/uibase/app/docsh2.cxx | 2
sw/source/uibase/docvw/PostItMgr.cxx | 4
toolkit/source/awt/stylesettings.cxx | 10 -
toolkit/source/awt/vclxtoolkit.cxx | 34 +--
toolkit/source/awt/vclxwindow.cxx | 8
toolkit/source/helper/vclunohelper.cxx | 2
vcl/source/app/help.cxx | 2
vcl/source/control/button.cxx | 6
vcl/source/window/accessibility.cxx | 7
vcl/source/window/builder.cxx | 7
vcl/source/window/menu.cxx | 4
vcl/source/window/syswin.cxx | 2
vcl/source/window/taskpanelist.cxx | 6
vcl/source/window/toolbox.cxx | 4
vcl/source/window/window2.cxx | 3
97 files changed, 374 insertions(+), 280 deletions(-)
New commits:
commit e6ffb539ee232ea0c679928ff456c1cf97429f63
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Nov 25 16:23:17 2016 +0200
loplugin:vclwidgets check for assigning from VclPt<T> to T*
Inspired by a recent bug report where we were assigning the result
of VclPtr<T>::Create to a raw pointer.
As a consequence, we also need to change various methods that were
returning newly created Window subclasses via raw pointer, to
instead return those via VclPtr
Change-Id: I8118e0195a5b2b4780e646cfb0e151692e54ae2b
Reviewed-on: https://gerrit.libreoffice.org/31318
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
index 05e16b6..ade2d1b 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 417a987..762b90b 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -309,9 +309,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;
@@ -436,7 +435,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 );
}
@@ -555,9 +554,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;
@@ -578,9 +576,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();
@@ -733,7 +730,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 11f8342..c186b8f 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 c1138a1..c800580 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 40f2857..3151d6c 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 5998cfd..d40782f 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 0000000..c18c775
--- /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 d6007a6..b373d93 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 27b6ea1..c5588c0 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3728,7 +3728,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 2f6c527..b4ffdc73 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 21b88d5..92866f3 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 fb2d9a5..5bb00f4 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 43d95f5..37324f4 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 7a2db42..512005e 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 fb0a4d5..9b00cfa 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 d87cff6..f08beee 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 f0c4fbc..f0dd208 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 580dc1c..0fbe95b 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 38ca3b1..abeb6fc 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 698318b..8be4a22 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 f85e849..776dabf 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 dfaf22f..b665f7a 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 a4feb71..d2e21a2 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 a9f8775..4d2916d 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 c12b0e2..cd0f1c3 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 83fc164..7562058 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 b770fd8..98cbace 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -817,7 +817,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);
@@ -1410,7 +1410,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();
@@ -2251,7 +2251,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();
}
@@ -2589,7 +2589,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();
@@ -2602,7 +2602,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();
}
@@ -2629,7 +2629,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());
@@ -3067,7 +3067,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();
}
@@ -3262,7 +3262,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 ));
}
@@ -3631,7 +3631,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 4de7933..0214754 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 8733666..288294a 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 313ae53..ca6f457 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -409,7 +409,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 da28331..84dd2b9 100644
--- a/reportdesign/source/ui/dlg/CondFormat.cxx
+++ b/reportdesign/source/ui/dlg/CondFormat.cxx
@@ -279,7 +279,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 bdeaf06..03f3574 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 357bb05..f1b0556 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 7c2b756..33e7dfe 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 5a9ad2b..942ec57 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 512af1b..48a3449 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 7c31249..7b61def 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 81ae3c7..c05d098 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 7dce852..fb3d6b4 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 fbb40fa..fdc633d 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 5bf6eb9..387dafc 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 9a20e34..fbb33d1 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 3651222..f5dfc50 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 ab3c480..fa1a696 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 c66987b..1fa0e03 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 cbaf2da..801e2a3 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 171b612..f38ed10 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 8c18d56..c2ea991 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 5af575c..03e3802 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 0c7b22a..98835c7 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 344b076..681385a 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 e41790b..222f2df 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 33e08c1..4077e83 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 89a62dd..2f61531 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 02b965c..f17f1c1 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 fd1c5c2..7d78cdd 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 4dcaa0f..82b529e 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 a8ad4db..1c15d90 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();
}
@@ -1162,7 +1162,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();
}
@@ -1246,7 +1246,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);
}
@@ -2383,7 +2383,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 15fa225..3afb942 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 03b005f..7dcc628 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 f750d1e..c862ad7 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 d84f56b..8887ca0 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 aedd9e2..a91e5b5 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 87179de..9994b58 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 d6a51a0..97742b7 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 917a236..e696e32 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 1258aa6..8bae924 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 148ff37..e7216d2 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 7f1b54b..1a6fab5 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 e080edc..5d6e356 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -1600,7 +1600,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 936b4f6..57f359e 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 6ee7271..e6811cc 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 1110e8f..fc61747 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 f1773ea..0a94692 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 0467ab6..46897df 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 b0e707f..c6acafa 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 2023bc6..39f6079 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 cf8b9f8..27086a9 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 07526e0..8463afd 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 54cddf7..5bd8992 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 1312236..b9d850a 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 d050794..450b5c2 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);
@@ -2746,9 +2745,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();
@@ -3194,7 +3192,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();
@@ -3202,7 +3200,7 @@ void SwTokenWindow::AdjustPositions()
for(; it != aControlList.end(); ++it)
{
- pCtrl = *it;
+ pCtrl = it->get();
pCtrl->SetPosPixel(aNextPos);
aNextPos.X() += pCtrl->GetSizePixel().Width();
}
@@ -3214,10 +3212,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;
@@ -3281,10 +3277,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();
@@ -3300,7 +3294,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();
@@ -3316,7 +3310,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();
}
@@ -3330,7 +3324,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;
@@ -3342,7 +3336,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();
}
@@ -3360,10 +3354,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);
}
}
@@ -3472,7 +3466,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();
@@ -3483,12 +3477,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);
@@ -3511,7 +3503,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);
@@ -3536,7 +3528,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 eff2461..7c555b2 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -640,7 +640,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 4199cc0..8b2656a 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -620,7 +620,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 )
{
@@ -657,7 +657,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 8410554..86ab25c 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 12948c3..116e77c 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 );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list