tdf#91239 - return VclPtr's from Create Fn.s and add missing dispose logic.
Change-Id: I802b841040f608b5586704745cc9817603fb1879
This commit is contained in:
@@ -1200,7 +1200,7 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script
|
||||
bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
|
||||
if( bSuccess )
|
||||
{
|
||||
DialogWindow* pNewDlgWin = pShell->CreateDlgWin( rDocument, aLibName, aNewDlgName );
|
||||
VclPtr<DialogWindow> pNewDlgWin = pShell->CreateDlgWin( rDocument, aLibName, aNewDlgName );
|
||||
pShell->SetCurWindow( pNewDlgWin, true );
|
||||
}
|
||||
|
||||
|
@@ -485,14 +485,14 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
|
||||
break;
|
||||
case SID_BASICIDE_NEWMODULE:
|
||||
{
|
||||
ModulWindow* pWin = CreateBasWin( m_aCurDocument, m_aCurLibName, OUString() );
|
||||
VclPtr<ModulWindow> pWin = CreateBasWin( m_aCurDocument, m_aCurLibName, OUString() );
|
||||
DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" );
|
||||
SetCurWindow( pWin, true );
|
||||
}
|
||||
break;
|
||||
case SID_BASICIDE_NEWDIALOG:
|
||||
{
|
||||
DialogWindow* pWin = CreateDlgWin( m_aCurDocument, m_aCurLibName, OUString() );
|
||||
VclPtr<DialogWindow> pWin = CreateDlgWin( m_aCurDocument, m_aCurLibName, OUString() );
|
||||
DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" );
|
||||
SetCurWindow( pWin, true );
|
||||
}
|
||||
@@ -1088,12 +1088,12 @@ void Shell::ManageToolbars()
|
||||
}
|
||||
}
|
||||
|
||||
BaseWindow* Shell::FindApplicationWindow()
|
||||
VclPtr<BaseWindow> Shell::FindApplicationWindow()
|
||||
{
|
||||
return FindWindow( ScriptDocument::getApplicationScriptDocument() );
|
||||
}
|
||||
|
||||
BaseWindow* Shell::FindWindow(
|
||||
VclPtr<BaseWindow> Shell::FindWindow(
|
||||
ScriptDocument const& rDocument,
|
||||
OUString const& rLibName, OUString const& rName,
|
||||
ItemType eType, bool bFindSuspended
|
||||
@@ -1147,7 +1147,7 @@ long Shell::CallBasicBreakHdl( StarBASIC* pBasic )
|
||||
return nRet;
|
||||
}
|
||||
|
||||
ModulWindow* Shell::ShowActiveModuleWindow( StarBASIC* pBasic )
|
||||
VclPtr<ModulWindow> Shell::ShowActiveModuleWindow( StarBASIC* pBasic )
|
||||
{
|
||||
SetCurLib( ScriptDocument::getApplicationScriptDocument(), OUString(), false );
|
||||
|
||||
@@ -1158,7 +1158,7 @@ ModulWindow* Shell::ShowActiveModuleWindow( StarBASIC* pBasic )
|
||||
DBG_ASSERT( pActiveModule, "Kein aktives Modul im ErrorHdl?!" );
|
||||
if ( pActiveModule )
|
||||
{
|
||||
ModulWindow* pWin = 0;
|
||||
VclPtr<ModulWindow> pWin;
|
||||
SbxObject* pParent = pActiveModule->GetParent();
|
||||
if (StarBASIC* pLib = dynamic_cast<StarBASIC*>(pParent))
|
||||
{
|
||||
|
@@ -129,12 +129,12 @@ void Shell::SetMDITitle()
|
||||
}
|
||||
}
|
||||
|
||||
ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName )
|
||||
VclPtr<ModulWindow> Shell::CreateBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName )
|
||||
{
|
||||
bCreatingWindow = true;
|
||||
|
||||
sal_uLong nKey = 0;
|
||||
ModulWindow* pWin = 0;
|
||||
VclPtr<ModulWindow> pWin;
|
||||
|
||||
OUString aLibName( rLibName );
|
||||
OUString aModName( rModName );
|
||||
@@ -203,14 +203,14 @@ ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const OUStrin
|
||||
return pWin;
|
||||
}
|
||||
|
||||
ModulWindow* Shell::FindBasWin (
|
||||
VclPtr<ModulWindow> Shell::FindBasWin (
|
||||
ScriptDocument const& rDocument,
|
||||
OUString const& rLibName, OUString const& rName,
|
||||
bool bCreateIfNotExist, bool bFindSuspended
|
||||
)
|
||||
{
|
||||
if (BaseWindow* pWin = FindWindow(rDocument, rLibName, rName, TYPE_MODULE, bFindSuspended))
|
||||
return static_cast<ModulWindow*>(pWin);
|
||||
return VclPtr<ModulWindow>(static_cast<ModulWindow*>(pWin));
|
||||
return bCreateIfNotExist ? CreateBasWin(rDocument, rLibName, rName) : 0;
|
||||
}
|
||||
|
||||
|
@@ -35,12 +35,12 @@ using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::io;
|
||||
|
||||
DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName )
|
||||
VclPtr<DialogWindow> Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName )
|
||||
{
|
||||
bCreatingWindow = true;
|
||||
|
||||
sal_uLong nKey = 0;
|
||||
DialogWindow* pWin = 0;
|
||||
VclPtr<DialogWindow> pWin;
|
||||
OUString aLibName( rLibName );
|
||||
OUString aDlgName( rDlgName );
|
||||
|
||||
@@ -107,7 +107,7 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri
|
||||
return pWin;
|
||||
}
|
||||
|
||||
DialogWindow* Shell::FindDlgWin (
|
||||
VclPtr<DialogWindow> Shell::FindDlgWin (
|
||||
ScriptDocument const& rDocument,
|
||||
OUString const& rLibName, OUString const& rName,
|
||||
bool bCreateIfNotExist, bool bFindSuspended
|
||||
|
@@ -225,7 +225,6 @@ Shell::~Shell()
|
||||
SetWindow( 0 );
|
||||
SetCurWindow( 0 );
|
||||
|
||||
pTabBar.disposeAndClear();
|
||||
aObjectCatalog.disposeAndClear();
|
||||
aScrollBarBox.disposeAndClear();
|
||||
aVScrollBar.disposeAndClear();
|
||||
@@ -247,6 +246,10 @@ Shell::~Shell()
|
||||
GetExtraData()->ShellInCriticalSection() = false;
|
||||
|
||||
nShellCount--;
|
||||
|
||||
pDialogLayout.disposeAndClear();
|
||||
pModulLayout.disposeAndClear();
|
||||
pTabBar.disposeAndClear();
|
||||
}
|
||||
|
||||
void Shell::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
|
||||
@@ -761,7 +764,7 @@ void Shell::UpdateWindows()
|
||||
OUString aDlgName = pDlgNames[ j ];
|
||||
// this find only looks for non-suspended windows;
|
||||
// suspended windows are handled in CreateDlgWin
|
||||
DialogWindow* pWin = FindDlgWin( *doc, aLibName, aDlgName, false );
|
||||
VclPtr<DialogWindow> pWin = FindDlgWin( *doc, aLibName, aDlgName, false );
|
||||
if ( !pWin )
|
||||
pWin = CreateDlgWin( *doc, aLibName, aDlgName );
|
||||
if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aDlgName &&
|
||||
|
@@ -60,6 +60,8 @@ Layout::~Layout()
|
||||
|
||||
void Layout::dispose()
|
||||
{
|
||||
aLeftSide.dispose();
|
||||
aBottomSide.dispose();
|
||||
pChild.clear();
|
||||
Window::dispose();
|
||||
}
|
||||
@@ -178,6 +180,12 @@ Layout::SplittedSide::SplittedSide (Layout* pParent, Side eSide) :
|
||||
InitSplitter(*aSplitter.get());
|
||||
}
|
||||
|
||||
void Layout::SplittedSide::dispose()
|
||||
{
|
||||
aSplitter.disposeAndClear();
|
||||
for (auto i = vItems.begin(); i != vItems.end(); ++i)
|
||||
i->pSplit.disposeAndClear();
|
||||
}
|
||||
|
||||
// Add() -- adds a new window to the side (after construction)
|
||||
void Layout::SplittedSide::Add (DockingWindow* pWin, Size const& rSize)
|
||||
|
@@ -86,6 +86,7 @@ private:
|
||||
bool IsEmpty () const;
|
||||
long GetSize () const;
|
||||
void ArrangeIn (Rectangle const&);
|
||||
void dispose();
|
||||
|
||||
private:
|
||||
// the layout window
|
||||
|
@@ -120,10 +120,10 @@ private:
|
||||
void ManageToolbars();
|
||||
void ArrangeTabBar();
|
||||
|
||||
ModulWindow* CreateBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName );
|
||||
DialogWindow* CreateDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName );
|
||||
VclPtr<ModulWindow> CreateBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName );
|
||||
VclPtr<DialogWindow> CreateDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rDlgName );
|
||||
|
||||
ModulWindow* ShowActiveModuleWindow( StarBASIC* pBasic );
|
||||
VclPtr<ModulWindow> ShowActiveModuleWindow( StarBASIC* pBasic );
|
||||
|
||||
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
|
||||
const SfxHint& rHint, const TypeId& rHintType ) SAL_OVERRIDE;
|
||||
@@ -193,11 +193,11 @@ public:
|
||||
bool CallBasicErrorHdl( StarBASIC* pBasic );
|
||||
long CallBasicBreakHdl( StarBASIC* pBasic );
|
||||
|
||||
BaseWindow* FindWindow( const ScriptDocument& rDocument, const OUString& rLibName = OUString(), const OUString& rName = OUString(), ItemType nType = TYPE_UNKNOWN, bool bFindSuspended = false );
|
||||
DialogWindow* FindDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
|
||||
ModulWindow* FindBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
|
||||
BaseWindow* FindApplicationWindow();
|
||||
bool NextPage( bool bPrev = false );
|
||||
VclPtr<BaseWindow> FindWindow( const ScriptDocument& rDocument, const OUString& rLibName = OUString(), const OUString& rName = OUString(), ItemType nType = TYPE_UNKNOWN, bool bFindSuspended = false );
|
||||
VclPtr<DialogWindow> FindDlgWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
|
||||
VclPtr<ModulWindow> FindBasWin( const ScriptDocument& rDocument, const OUString& rLibName, const OUString& rModName, bool bCreateIfNotExist = false, bool bFindSuspended = false );
|
||||
VclPtr<BaseWindow> FindApplicationWindow();
|
||||
bool NextPage( bool bPrev = false );
|
||||
|
||||
bool IsAppBasicModified () const { return m_bAppBasicModified; }
|
||||
void SetAppBasicModified (bool bModified = true) { m_bAppBasicModified = bModified; }
|
||||
|
Reference in New Issue
Block a user