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