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@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2016-11-25 16:23:17 +02:00
parent bbc7ed9c37
commit e6ffb539ee
97 changed files with 374 additions and 280 deletions

View File

@ -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;

View File

@ -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 );
}

View File

@ -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))
{

View File

@ -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() )

View File

@ -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() );

View File

@ -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)

View File

@ -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: */

View File

@ -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;
}
const ImplicitCastExpr* implicitCast = dyn_cast<ImplicitCastExpr>(exprWithCleanups->getSubExpr());
if (!implicitCast) {
if (isa<CXXNullPtrLiteralExpr>(rhs)) {
return;
}
//rhs->getType().dump();
if (isa<CXXThisExpr>(rhs)) {
return;
}
// 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")

View File

@ -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 )

View File

@ -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 );
}

View File

@ -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( "" );

View File

@ -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

View File

@ -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;

View File

@ -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 );

View File

@ -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();

View File

@ -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)

View File

@ -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))
{

View File

@ -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 );

View File

@ -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();

View File

@ -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 );

View File

@ -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& )
{

View File

@ -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 );
}

View File

@ -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& )
{

View File

@ -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!" );
}

View File

@ -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!" );
}

View File

@ -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();

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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& )

View File

@ -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;
}

View File

@ -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 );

View File

@ -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 );

View File

@ -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 );

View File

@ -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();

View File

@ -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() );
}
}

View File

@ -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();

View File

@ -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() ) )
{

View File

@ -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 );

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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());

View File

@ -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;

View File

@ -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(

View File

@ -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>();

View File

@ -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(

View File

@ -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();

View File

@ -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());

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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())

View File

@ -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() )
{

View File

@ -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 )

View File

@ -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

View File

@ -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);
} ;

View File

@ -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() )
{

View File

@ -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);

View File

@ -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);

View File

@ -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:

View File

@ -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 )

View File

@ -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();

View File

@ -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)

View File

@ -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);

View File

@ -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")
{

View File

@ -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& )
{

View File

@ -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& )
{

View File

@ -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

View File

@ -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 );

View File

@ -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 );

View File

@ -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);

View File

@ -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();

View File

@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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 );

View File

@ -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;
}

View File

@ -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();

View File

@ -831,7 +831,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
OUString aServiceName( rDescriptor.WindowServiceName );
aServiceName = aServiceName.toAsciiLowerCase();
vcl::Window* pNewWindow = nullptr;
VclPtr<vcl::Window> pNewWindow;
sal_uInt16 nType = ImplGetComponentType( aServiceName );
bool bFrameControl = false;
if ( aServiceName == "frame" )
@ -886,7 +886,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_COMBOBOX:
pNewWindow = VclPtr<ComboBox>::Create( pParent, nWinBits|WB_AUTOHSCROLL );
static_cast<ComboBox*>(pNewWindow)->EnableAutoSize( false );
static_cast<ComboBox*>(pNewWindow.get())->EnableAutoSize( false );
*ppNewComp = new VCLXComboBox;
break;
case WINDOW_CURRENCYBOX:
@ -894,18 +894,18 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_CURRENCYFIELD:
pNewWindow = VclPtr<CurrencyField>::Create( pParent, nWinBits );
static_cast<CurrencyField*>(pNewWindow)->EnableEmptyFieldValue( true );
static_cast<CurrencyField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXNumericField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<CurrencyField*>(pNewWindow)) );
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<CurrencyField*>(pNewWindow.get())) );
break;
case WINDOW_DATEBOX:
pNewWindow = VclPtr<DateBox>::Create( pParent, nWinBits );
break;
case WINDOW_DATEFIELD:
pNewWindow = VclPtr<DateField>::Create( pParent, nWinBits );
static_cast<DateField*>(pNewWindow)->EnableEmptyFieldValue( true );
static_cast<DateField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXDateField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<DateField*>(pNewWindow)) );
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<DateField*>(pNewWindow.get())) );
break;
case WINDOW_DOCKINGAREA:
pNewWindow = VclPtr<DockingAreaWindow>::Create( pParent );
@ -940,7 +940,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
pNewWindow = VclPtr<GroupBox>::Create( pParent, nWinBits );
if ( bFrameControl )
{
GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow );
GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow.get() );
*ppNewComp = new VCLXFrame;
// Frame control needs to receive
// Mouse events
@ -961,7 +961,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_LISTBOX:
pNewWindow = VclPtr<ListBox>::Create( pParent, nWinBits|WB_SIMPLEMODE|WB_AUTOHSCROLL );
static_cast<ListBox*>(pNewWindow)->EnableAutoSize( false );
static_cast<ListBox*>(pNewWindow.get())->EnableAutoSize( false );
*ppNewComp = new VCLXListBox;
break;
case WINDOW_LONGCURRENCYBOX:
@ -970,7 +970,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WINDOW_LONGCURRENCYFIELD:
pNewWindow = VclPtr<LongCurrencyField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXCurrencyField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<LongCurrencyField*>(pNewWindow)) );
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<LongCurrencyField*>(pNewWindow.get())) );
break;
case WINDOW_MENUBUTTON:
pNewWindow = VclPtr<MenuButton>::Create( pParent, nWinBits );
@ -986,7 +986,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WINDOW_METRICFIELD:
pNewWindow = VclPtr<MetricField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXMetricField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<MetricField*>(pNewWindow)) );
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<MetricField*>(pNewWindow.get())) );
break;
case WINDOW_DIALOG:
case WINDOW_MODALDIALOG:
@ -1020,9 +1020,9 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_NUMERICFIELD:
pNewWindow = VclPtr<NumericField>::Create( pParent, nWinBits );
static_cast<NumericField*>(pNewWindow)->EnableEmptyFieldValue( true );
static_cast<NumericField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXNumericField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<NumericField*>(pNewWindow)) );
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<NumericField*>(pNewWindow.get())) );
break;
case WINDOW_OKBUTTON:
pNewWindow = VclPtr<OKButton>::Create( pParent, nWinBits );
@ -1034,7 +1034,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WINDOW_PATTERNFIELD:
pNewWindow = VclPtr<PatternField>::Create( pParent, nWinBits );
*ppNewComp = new VCLXPatternField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<PatternField*>(pNewWindow)) );
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<PatternField*>(pNewWindow.get())) );
break;
case WINDOW_PUSHBUTTON:
pNewWindow = VclPtr<PushButton>::Create( pParent, nWinBits );
@ -1057,7 +1057,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
// is not really valid: the controls are grouped after they have been created, but we're still in
// the creation process, so the RadioButton::Check relies on invalid grouping information.
// 07.08.2001 - #87254# - frank.schoenheit@sun.com
static_cast<RadioButton*>(pNewWindow)->EnableRadioCheck( false );
static_cast<RadioButton*>(pNewWindow.get())->EnableRadioCheck( false );
break;
case WINDOW_SCROLLBAR:
pNewWindow = VclPtr<ScrollBar>::Create( pParent, nWinBits );
@ -1105,9 +1105,9 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_TIMEFIELD:
pNewWindow = VclPtr<TimeField>::Create( pParent, nWinBits );
static_cast<TimeField*>(pNewWindow)->EnableEmptyFieldValue( true );
static_cast<TimeField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
*ppNewComp = new VCLXTimeField;
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<TimeField*>(pNewWindow)) );
static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<TimeField*>(pNewWindow.get())) );
break;
case WINDOW_TOOLBOX:
pNewWindow = VclPtr<ToolBox>::Create( pParent, nWinBits );
@ -1256,7 +1256,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
css::uno::Reference< css::awt::XWindowPeer > xRef;
vcl::Window* pParent = nullptr;
VclPtr<vcl::Window> pParent;
if ( rDescriptor.Parent.is() )
{
VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( rDescriptor.Parent );

View File

@ -2480,10 +2480,10 @@ sal_Bool SAL_CALL VCLXWindow::isInPopupMode( ) throw (css::uno::RuntimeExceptio
void SAL_CALL VCLXWindow::setOutputSize( const css::awt::Size& aSize ) throw (css::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
vcl::Window *pWindow;
VclPtr<vcl::Window> pWindow;
if( (pWindow = GetWindow()) != nullptr )
{
DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow.get());
if( pDockingWindow )
pDockingWindow->SetOutputSizePixel( VCLSize( aSize ) );
else
@ -2494,10 +2494,10 @@ void SAL_CALL VCLXWindow::setOutputSize( const css::awt::Size& aSize ) throw (cs
css::awt::Size SAL_CALL VCLXWindow::getOutputSize( ) throw (css::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
vcl::Window *pWindow;
VclPtr<vcl::Window> pWindow;
if( (pWindow = GetWindow()) != nullptr )
{
DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow.get());
if( pDockingWindow )
return AWTSize( pDockingWindow->GetOutputSizePixel() );
else

View File

@ -152,7 +152,7 @@ css::uno::Reference< css::awt::XWindow> VCLUnoHelper::GetInterface( vcl::Window*
OutputDevice* VCLUnoHelper::GetOutputDevice( const css::uno::Reference< css::awt::XDevice>& rxDevice )
{
OutputDevice* pOutDev = nullptr;
VclPtr<OutputDevice> pOutDev;
VCLXDevice* pDev = VCLXDevice::GetImplementation( rxDevice );
if ( pDev )
pOutDev = pDev->GetOutputDevice();

View File

@ -502,7 +502,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHe
if (rHelpText.isEmpty() && !pSVData->maHelpData.mbRequestingHelp)
return;
HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin;
VclPtr<HelpTextWindow> pHelpWin = pSVData->maHelpData.mpHelpWin;
sal_uInt16 nDelayMode = HELPDELAY_NORMAL;
if ( pHelpWin )
{

View File

@ -2201,9 +2201,8 @@ void RadioButton::group(RadioButton &rOther)
}
//make all members of the group share the same button group
for (auto aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI)
for (VclPtr<RadioButton> const & pButton : *m_xGroup)
{
RadioButton* pButton = *aI;
pButton->m_xGroup = m_xGroup;
}
}
@ -2220,9 +2219,8 @@ std::vector< VclPtr<RadioButton> > RadioButton::GetRadioButtonGroup(bool bInclud
if (bIncludeThis)
return *m_xGroup;
std::vector< VclPtr<RadioButton> > aGroup;
for (auto aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI)
for (VclPtr<RadioButton> const & pRadioButton : *m_xGroup)
{
RadioButton *pRadioButton = *aI;
if (pRadioButton == this)
continue;
aGroup.push_back(pRadioButton);

View File

@ -605,11 +605,10 @@ vcl::Window* Window::GetAccessibleRelationLabeledBy() const
if (!aMnemonicLabels.empty())
{
//if we have multiple labels, then prefer the first that is visible
for (auto aI = aMnemonicLabels.begin(), aEnd = aMnemonicLabels.end(); aI != aEnd; ++aI)
for (auto const & rCandidate : aMnemonicLabels)
{
vcl::Window *pCandidate = *aI;
if (pCandidate->IsVisible())
return pCandidate;
if (rCandidate->IsVisible())
return rCandidate;
}
return aMnemonicLabels[0];
}

View File

@ -472,11 +472,8 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
}
//fdo#67378 merge the label into the disclosure button
for (auto aI = m_pParserState->m_aExpanderWidgets.begin(),
aEnd = m_pParserState->m_aExpanderWidgets.end(); aI != aEnd; ++aI)
for (VclPtr<VclExpander> const & pOne : m_pParserState->m_aExpanderWidgets)
{
VclExpander *pOne = *aI;
vcl::Window *pChild = pOne->get_child();
vcl::Window* pLabel = pOne->GetWindow(GetWindowType::LastChild);
if (pLabel && pLabel != pChild && pLabel->GetType() == WINDOW_FIXEDTEXT)
@ -2111,7 +2108,7 @@ void VclBuilder::handleChild(vcl::Window *pParent, xmlreader::XmlReader &reader)
{
if (name.equals("object") || name.equals("placeholder"))
{
pCurrentChild = handleObject(pParent, reader);
pCurrentChild = handleObject(pParent, reader).get();
bool bObjectInserted = pCurrentChild && pParent != pCurrentChild;

View File

@ -2476,9 +2476,9 @@ void MenuBar::SetDisplayable( bool bDisplayable )
}
}
vcl::Window* MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu)
VclPtr<vcl::Window> MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu)
{
MenuBarWindow *pMenuBarWindow = dynamic_cast<MenuBarWindow*>(pWindow);
VclPtr<MenuBarWindow> pMenuBarWindow = dynamic_cast<MenuBarWindow*>(pWindow);
if (!pMenuBarWindow)
{
pWindow = pMenuBarWindow = VclPtr<MenuBarWindow>::Create( pParent );

View File

@ -925,7 +925,7 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar)
{
MenuBar* pOldMenuBar = mpMenuBar;
vcl::Window* pOldWindow = nullptr;
vcl::Window* pNewWindow=nullptr;
VclPtr<vcl::Window> pNewWindow;
mpMenuBar = pMenuBar;
if ( mpWindowImpl->mpBorderWindow && (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) )

View File

@ -176,7 +176,7 @@ bool TaskPaneList::HandleKeyEvent(const KeyEvent& rKeyEvent)
auto p = mTaskPanes.begin();
while( p != mTaskPanes.end() )
{
vcl::Window *pWin = *p;
vcl::Window *pWin = p->get();
if( pWin->HasChildPathFocus( true ) )
{
// Ctrl-F6 goes directly to the document
@ -252,7 +252,7 @@ vcl::Window* TaskPaneList::FindNextSplitter( vcl::Window *pWindow )
p = mTaskPanes.begin();
if( (*p)->ImplIsSplitter() && (*p)->IsReallyVisible() && !(*p)->IsDialog() && (*p)->GetParent()->HasChildPathFocus() )
{
pWindow = *p;
pWindow = (*p).get();
break;
}
if( !pWindow ) // increment after test, otherwise first element is skipped
@ -291,7 +291,7 @@ vcl::Window* TaskPaneList::FindNextFloat( vcl::Window *pWindow, bool bForward )
if( (*p)->IsReallyVisible() && !(*p)->ImplIsSplitter() &&
( (*p)->GetType() != WINDOW_MENUBARWINDOW || static_cast<MenuBarWindow*>(p->get())->CanGetFocus() ) )
{
pWindow = *p;
pWindow = (*p).get();
break;
}
if( !pWindow ) // increment after test, otherwise first element is skipped

View File

@ -5591,7 +5591,7 @@ void ToolBox::ImplShowFocus()
ImplToolItem* pItem = ImplGetItem( mnHighItemId );
if( pItem->mpWindow && !pItem->mpWindow->IsDisposed() )
{
vcl::Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow : pItem->mpWindow;
vcl::Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow.get() : pItem->mpWindow.get();
pWin->ImplGetWindowImpl()->mbDrawSelectionBackground = true;
pWin->Invalidate();
}
@ -5605,7 +5605,7 @@ void ToolBox::ImplHideFocus()
ImplToolItem* pItem = ImplGetItem( mnHighItemId );
if( pItem && pItem->mpWindow )
{
vcl::Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow : pItem->mpWindow;
vcl::Window *pWin = pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow ? pItem->mpWindow->ImplGetWindowImpl()->mpBorderWindow.get() : pItem->mpWindow.get();
pWin->ImplGetWindowImpl()->mbDrawSelectionBackground = false;
pWin->Invalidate();
}

View File

@ -1386,9 +1386,8 @@ void Window::queue_resize(StateChangedType eReason)
if (pWindowImpl->m_xSizeGroup && pWindowImpl->m_xSizeGroup->get_mode() != VCL_SIZE_GROUP_NONE)
{
std::set<VclPtr<vcl::Window> > &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
for (auto aI = rWindows.begin(), aEnd = rWindows.end(); aI != aEnd; ++aI)
for (VclPtr<vcl::Window> const & pOther : rWindows)
{
vcl::Window *pOther = *aI;
if (pOther == this)
continue;
queue_ungrouped_resize(pOther);