diff options
Diffstat (limited to 'desktop/source')
21 files changed, 365 insertions, 231 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index f0c5d8090458..389389294551 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -709,9 +709,9 @@ void Desktop::HandleBootstrapPathErrors( ::utl::Bootstrap::Status aBootstrapStat OUString const aMessage(aDiagnosticMessage + "\n"); - MessageDialog aBootstrapFailedBox(NULL, aMessage); - aBootstrapFailedBox.SetText( aProductKey ); - aBootstrapFailedBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aBootstrapFailedBox(nullptr, aMessage); + aBootstrapFailedBox->SetText( aProductKey ); + aBootstrapFailedBox->Execute(); } } @@ -2355,8 +2355,8 @@ void Desktop::OpenClients() ResMgr* pDtResMgr = GetDesktopResManager(); if( pDtResMgr ) { - MessageDialog aBox(NULL, ResId(STR_ERR_PRINTDISABLED, *pDtResMgr)); - aBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aBox(nullptr, ResId(STR_ERR_PRINTDISABLED, *pDtResMgr)); + aBox->Execute(); } } diff --git a/desktop/source/app/cmdlinehelp.hxx b/desktop/source/app/cmdlinehelp.hxx index 07b4f520979d..d7b7233ab3ac 100644 --- a/desktop/source/app/cmdlinehelp.hxx +++ b/desktop/source/app/cmdlinehelp.hxx @@ -34,10 +34,10 @@ namespace desktop public: CmdlineHelpDialog(); - FixedText* m_pftHead; - FixedText* m_pftLeft; - FixedText* m_pftRight; - FixedText* m_pftBottom; + VclPtr<FixedText> m_pftHead; + VclPtr<FixedText> m_pftLeft; + VclPtr<FixedText> m_pftRight; + VclPtr<FixedText> m_pftBottom; }; #endif } diff --git a/desktop/source/app/lockfile2.cxx b/desktop/source/app/lockfile2.cxx index c590ab7cf799..7636431048a6 100644 --- a/desktop/source/app/lockfile2.cxx +++ b/desktop/source/app/lockfile2.cxx @@ -38,22 +38,22 @@ bool Lockfile_execWarning( Lockfile * that ) OString aTime = aConfig.ReadKey( LOCKFILE_TIMEKEY ); // display warning and return response - MessageDialog aBox(NULL, DesktopResId(STR_QUERY_USERDATALOCKED), - VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + ScopedVclPtrInstance<MessageDialog> aBox(nullptr, DesktopResId(STR_QUERY_USERDATALOCKED), + VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); // set box title OUString aTitle = OUString( DesktopResId( STR_TITLE_USERDATALOCKED )); - aBox.SetText( aTitle ); + aBox->SetText( aTitle ); // insert values... - OUString aMsgText = aBox.get_primary_text(); + OUString aMsgText = aBox->get_primary_text(); aMsgText = aMsgText.replaceFirst( "$u", OStringToOUString( aUser, RTL_TEXTENCODING_ASCII_US) ); aMsgText = aMsgText.replaceFirst( "$h", OStringToOUString( aHost, RTL_TEXTENCODING_ASCII_US) ); aMsgText = aMsgText.replaceFirst( "$t", OStringToOUString( aTime, RTL_TEXTENCODING_ASCII_US) ); - aBox.set_primary_text(aMsgText); + aBox->set_primary_text(aMsgText); // do it - return aBox.Execute( ) == RET_YES; + return aBox->Execute( ) == RET_YES; } } diff --git a/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx b/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx index da831ad9b38f..56db76bd1b64 100644 --- a/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx @@ -50,6 +50,14 @@ DependencyDialog::DependencyDialog( } } -DependencyDialog::~DependencyDialog() {} +DependencyDialog::~DependencyDialog() +{ + disposeOnce(); +} +void DependencyDialog::dispose() +{ + m_list.clear(); + ModalDialog::dispose(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx b/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx index 1175470c33d5..2d7d3e9a13da 100644 --- a/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx @@ -37,14 +37,14 @@ class DependencyDialog: public ModalDialog { public: DependencyDialog( vcl::Window * parent, std::vector< OUString > const & dependencies); - virtual ~DependencyDialog(); + virtual void dispose() SAL_OVERRIDE; private: DependencyDialog(DependencyDialog &) SAL_DELETED_FUNCTION; void operator =(DependencyDialog &) SAL_DELETED_FUNCTION; - ListBox* m_list; + VclPtr<ListBox> m_list; }; } diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 0aba4b407dcb..60c9db1ee306 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -116,11 +116,11 @@ class ExtBoxWithBtns_Impl : public ExtensionBox_Impl { bool m_bInterfaceLocked; - PushButton *m_pOptionsBtn; - PushButton *m_pEnableBtn; - PushButton *m_pRemoveBtn; + VclPtr<PushButton> m_pOptionsBtn; + VclPtr<PushButton> m_pEnableBtn; + VclPtr<PushButton> m_pRemoveBtn; - ExtMgrDialog *m_pParent; + VclPtr<ExtMgrDialog> m_pParent; void SetButtonPos( const Rectangle& rRect ); void SetButtonStatus( const TEntry_Impl& rEntry ); @@ -137,6 +137,7 @@ class ExtBoxWithBtns_Impl : public ExtensionBox_Impl public: ExtBoxWithBtns_Impl(vcl::Window* pParent); virtual ~ExtBoxWithBtns_Impl(); + virtual void dispose() SAL_OVERRIDE; void InitFromDialog(ExtMgrDialog *pParentDialog); @@ -165,9 +166,9 @@ void ExtBoxWithBtns_Impl::InitFromDialog(ExtMgrDialog *pParentDialog) m_pParent = pParentDialog; - m_pOptionsBtn = new PushButton( this, WB_TABSTOP ); - m_pEnableBtn = new PushButton( this, WB_TABSTOP ); - m_pRemoveBtn = new PushButton( this, WB_TABSTOP ); + m_pOptionsBtn = VclPtr<PushButton>::Create( this, WB_TABSTOP ); + m_pEnableBtn = VclPtr<PushButton>::Create( this, WB_TABSTOP ); + m_pRemoveBtn = VclPtr<PushButton>::Create( this, WB_TABSTOP ); SetHelpId( HID_EXTENSION_MANAGER_LISTBOX ); m_pOptionsBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_OPTIONS ); @@ -202,9 +203,16 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeExtBoxWithBtns(vcl::Wi ExtBoxWithBtns_Impl::~ExtBoxWithBtns_Impl() { - delete m_pOptionsBtn; - delete m_pEnableBtn; - delete m_pRemoveBtn; + disposeOnce(); +} + +void ExtBoxWithBtns_Impl::dispose() +{ + m_pOptionsBtn.disposeAndClear(); + m_pEnableBtn.disposeAndClear(); + m_pRemoveBtn.disposeAndClear(); + m_pParent.clear(); + ExtensionBox_Impl::dispose(); } @@ -400,8 +408,8 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt ) break; case CMD_SHOW_LICENSE: { - ShowLicenseDialog aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage ); - aLicenseDlg.Execute(); + ScopedVclPtrInstance< ShowLicenseDialog > aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage ); + aLicenseDlg->Execute(); break; } } @@ -587,12 +595,11 @@ bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment:: if ( !bHadWarning && IsSharedPkgMgr( xPackage ) ) { const SolarMutexGuard guard; - MessageDialog aInfoBox(pParent, getResId(nResID), - VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL); - + ScopedVclPtrInstance<MessageDialog> aInfoBox(pParent, getResId(nResID), + VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL); bHadWarning = true; - if ( RET_OK == aInfoBox.Execute() ) + if ( RET_OK == aInfoBox->Execute() ) return true; else return false; @@ -619,32 +626,32 @@ void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle uno::Any exc( ::cppu::getCaughtException() ); OUString msg( ::comphelper::anyToString( exc ) ); const SolarMutexGuard guard; - MessageDialog aErrorBox(NULL, msg); - aErrorBox.SetText( sTitle ); - aErrorBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg); + aErrorBox->SetText( sTitle ); + aErrorBox->Execute(); } } bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const { const SolarMutexGuard guard; - MessageDialog aInfo(m_pVCLWindow, getResId(RID_STR_WARNING_INSTALL_EXTENSION), - VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL); + ScopedVclPtrInstance<MessageDialog> aInfo(m_pVCLWindow, getResId(RID_STR_WARNING_INSTALL_EXTENSION), + VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL); - OUString sText(aInfo.get_primary_text()); + OUString sText(aInfo->get_primary_text()); sText = sText.replaceAll("%NAME", rExtensionName); - aInfo.set_primary_text(sText); + aInfo->set_primary_text(sText); - return ( RET_OK == aInfo.Execute() ); + return ( RET_OK == aInfo->Execute() ); } bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const { const SolarMutexGuard guard; - MessageDialog aQuery(m_pVCLWindow, "InstallForAllDialog", - "desktop/ui/installforalldialog.ui"); + ScopedVclPtrInstance<MessageDialog> aQuery(m_pVCLWindow, "InstallForAllDialog", + "desktop/ui/installforalldialog.ui"); - short nRet = aQuery.Execute(); + short nRet = aQuery->Execute(); if (nRet == RET_CANCEL) return false; @@ -716,7 +723,24 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager) ExtMgrDialog::~ExtMgrDialog() { + disposeOnce(); +} + +void ExtMgrDialog::dispose() +{ m_aIdle.Stop(); + m_pExtensionBox.clear(); + m_pAddBtn.clear(); + m_pUpdateBtn.clear(); + m_pCloseBtn.clear(); + m_pBundledCbx.clear(); + m_pSharedCbx.clear(); + m_pUserCbx.clear(); + m_pGetExtensions.clear(); + m_pProgressText.clear(); + m_pProgressBar.clear(); + m_pCancelBtn.clear(); + ModelessDialog::dispose(); } @@ -769,14 +793,14 @@ void ExtMgrDialog::checkEntries() bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const { const SolarMutexGuard guard; - MessageDialog aInfo(const_cast<ExtMgrDialog*>(this), getResId(RID_STR_WARNING_REMOVE_EXTENSION), - VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL); + ScopedVclPtrInstance<MessageDialog> aInfo(const_cast<ExtMgrDialog*>(this), getResId(RID_STR_WARNING_REMOVE_EXTENSION), + VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL); - OUString sText(aInfo.get_primary_text()); + OUString sText(aInfo->get_primary_text()); sText = sText.replaceAll("%NAME", rExtensionName); - aInfo.set_primary_text(sText); + aInfo->set_primary_text(sText); - return ( RET_OK == aInfo.Execute() ); + return ( RET_OK == aInfo->Execute() ); } bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage, @@ -1197,7 +1221,20 @@ UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionMan UpdateRequiredDialog::~UpdateRequiredDialog() { + disposeOnce(); +} + +void UpdateRequiredDialog::dispose() +{ m_aIdle.Stop(); + m_pExtensionBox.clear(); + m_pUpdateNeeded.clear(); + m_pUpdateBtn.clear(); + m_pCloseBtn.clear(); + m_pCancelBtn.clear(); + m_pProgressText.clear(); + m_pProgressBar.clear(); + ModalDialog::dispose(); } long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage, @@ -1570,6 +1607,16 @@ ShowLicenseDialog::ShowLicenseDialog( vcl::Window * pParent, m_pLicenseText->SetText(xPackage->getLicenseText()); } +ShowLicenseDialog::~ShowLicenseDialog() +{ + disposeOnce(); +} + +void ShowLicenseDialog::dispose() +{ + m_pLicenseText.clear(); + ModalDialog::dispose(); +} // UpdateRequiredDialogService diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 0db6be025f18..2f6052be71af 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -55,7 +55,7 @@ class TheExtensionManager; class DialogHelper { ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - Dialog* m_pVCLWindow; + VclPtr<Dialog> m_pVCLWindow; ImplSVEvent * m_nEventID; bool m_bIsBusy; @@ -99,17 +99,17 @@ public: class ExtMgrDialog : public ModelessDialog, public DialogHelper { - ExtBoxWithBtns_Impl *m_pExtensionBox; - PushButton *m_pAddBtn; - PushButton *m_pUpdateBtn; - CloseButton *m_pCloseBtn; - CheckBox *m_pBundledCbx; - CheckBox *m_pSharedCbx; - CheckBox *m_pUserCbx; - FixedHyperlink *m_pGetExtensions; - FixedText *m_pProgressText; - ProgressBar *m_pProgressBar; - CancelButton *m_pCancelBtn; + VclPtr<ExtBoxWithBtns_Impl> m_pExtensionBox; + VclPtr<PushButton> m_pAddBtn; + VclPtr<PushButton> m_pUpdateBtn; + VclPtr<CloseButton> m_pCloseBtn; + VclPtr<CheckBox> m_pBundledCbx; + VclPtr<CheckBox> m_pSharedCbx; + VclPtr<CheckBox> m_pUserCbx; + VclPtr<FixedHyperlink> m_pGetExtensions; + VclPtr<FixedText> m_pProgressText; + VclPtr<ProgressBar> m_pProgressBar; + VclPtr<CancelButton> m_pCancelBtn; const OUString m_sAddPackages; OUString m_sProgressText; OUString m_sLastFolderURL; @@ -141,6 +141,7 @@ class ExtMgrDialog : public ModelessDialog, public: ExtMgrDialog( vcl::Window * pParent, TheExtensionManager *pManager ); virtual ~ExtMgrDialog(); + virtual void dispose() SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; @@ -173,13 +174,13 @@ public: class UpdateRequiredDialog : public ModalDialog, public DialogHelper { - ExtensionBox_Impl* m_pExtensionBox; - FixedText* m_pUpdateNeeded; - PushButton* m_pUpdateBtn; - PushButton* m_pCloseBtn; - CancelButton* m_pCancelBtn; - FixedText* m_pProgressText; - ProgressBar* m_pProgressBar; + VclPtr<ExtensionBox_Impl> m_pExtensionBox; + VclPtr<FixedText> m_pUpdateNeeded; + VclPtr<PushButton> m_pUpdateBtn; + VclPtr<PushButton> m_pCloseBtn; + VclPtr<CancelButton> m_pCancelBtn; + VclPtr<FixedText> m_pProgressText; + VclPtr<ProgressBar> m_pProgressBar; const OUString m_sAddPackages; const OUString m_sCloseText; OUString m_sProgressText; @@ -212,6 +213,7 @@ class UpdateRequiredDialog : public ModalDialog, public: UpdateRequiredDialog( vcl::Window * pParent, TheExtensionManager *pManager ); virtual ~UpdateRequiredDialog(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; @@ -240,9 +242,11 @@ public: class ShowLicenseDialog : public ModalDialog { - VclMultiLineEdit* m_pLicenseText; + VclPtr<VclMultiLineEdit> m_pLicenseText; public: ShowLicenseDialog(vcl::Window * pParent, const css::uno::Reference< css::deployment::XPackage > &xPackage); + virtual ~ShowLicenseDialog(); + virtual void dispose() SAL_OVERRIDE; }; diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index adcb6c740fa3..7e97c526d33c 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -451,12 +451,12 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & verExc.Deployed->getDisplayName()); { SolarMutexGuard guard; - MessageDialog box(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, - ResId(id, *DeploymentGuiResMgr::get()), VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL); + ScopedVclPtrInstance<MessageDialog> box(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, + ResId(id, *DeploymentGuiResMgr::get()), VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL); OUString s; if (bEqualNames) { - s = box.get_primary_text(); + s = box->get_primary_text(); } else if (id == RID_STR_WARNING_VERSION_EQUAL) { @@ -477,8 +477,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & s = s.replaceAll("$OLDNAME", verExc.Deployed->getDisplayName()); s = s.replaceAll("$NEW", getVersion(verExc.NewVersion)); s = s.replaceAll("$DEPLOYED", getVersion(verExc.Deployed)); - box.set_primary_text(s); - approve = box.Execute() == RET_OK; + box->set_primary_text(s); + approve = box->Execute() == RET_OK; abort = !approve; } } @@ -506,8 +506,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & SolarMutexGuard guard; OUString sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *DeploymentGuiResMgr::get()).toString()); sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName()); - MessageDialog box(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, sMsg); - box.Execute(); + ScopedVclPtrInstance< MessageDialog > box(m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr, sMsg); + box->Execute(); approve = true; } @@ -571,7 +571,7 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus ) text = ::comphelper::anyToString( rStatus ); // fallback const SolarMutexGuard aGuard; - const boost::scoped_ptr<MessageDialog> aBox(new MessageDialog(m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, text)); + ScopedVclPtrInstance< MessageDialog > aBox(m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr, text); aBox->Execute(); } ++m_nCurrentProgress; @@ -813,8 +813,8 @@ void ExtensionCmdQueue::Thread::execute() msg = ::comphelper::anyToString(exc); const SolarMutexGuard guard; - boost::scoped_ptr<MessageDialog> box( - new MessageDialog(currentCmdEnv->activeDialog(), msg)); + ScopedVclPtr<MessageDialog> box( + VclPtr<MessageDialog>::Create(currentCmdEnv->activeDialog(), msg)); if ( m_pDialogHelper ) box->SetText( m_pDialogHelper->getWindow()->GetText() ); box->Execute(); @@ -923,12 +923,10 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE void ExtensionCmdQueue::Thread::_checkForUpdates( const std::vector<uno::Reference<deployment::XPackage > > &vExtensionList ) { - UpdateDialog* pUpdateDialog; - std::vector< UpdateData > vData; - const SolarMutexGuard guard; - pUpdateDialog = new UpdateDialog( m_xContext, m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, vExtensionList, &vData ); + std::vector< UpdateData > vData; + ScopedVclPtrInstance<UpdateDialog> pUpdateDialog( m_xContext, m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr, vExtensionList, &vData ); pUpdateDialog->notifyMenubar( true, false ); // prepare the checking, if there updates to be notified via menu bar icon @@ -970,7 +968,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates( else pUpdateDialog->notifyMenubar( false, false ); // check if there updates to be notified via menu bar icon - delete pUpdateDialog; + pUpdateDialog.disposeAndClear(); } diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index ade275724174..1b3f6a17fc8e 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -201,7 +201,7 @@ void ExtensionBox_Impl::Init() { SetHelpId( HID_EXTENSION_MANAGER_LISTBOX ); - m_pScrollBar = new ScrollBar( this, WB_VERT ); + m_pScrollBar = VclPtr<ScrollBar>::Create( this, WB_VERT ); m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) ); m_pScrollBar->EnableDrag(); @@ -239,6 +239,11 @@ void ExtensionBox_Impl::Init() ExtensionBox_Impl::~ExtensionBox_Impl() { + disposeOnce(); +} + +void ExtensionBox_Impl::dispose() +{ if ( ! m_bInDelete ) DeleteRemoved(); @@ -248,22 +253,19 @@ ExtensionBox_Impl::~ExtensionBox_Impl() for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) { - if ( (*iIndex)->m_pPublisher ) - { - delete (*iIndex)->m_pPublisher; - (*iIndex)->m_pPublisher = NULL; - } + (*iIndex)->m_pPublisher.disposeAndClear(); (*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); } m_vEntries.clear(); - delete m_pScrollBar; + m_pScrollBar.disposeAndClear(); m_xRemoveListener.clear(); delete m_pLocale; delete m_pCollator; + ::svt::IExtensionListBox::dispose(); } @@ -433,11 +435,7 @@ void ExtensionBox_Impl::DeleteRemoved() for ( ITER iIndex = m_vRemovedEntries.begin(); iIndex < m_vRemovedEntries.end(); ++iIndex ) { - if ( (*iIndex)->m_pPublisher ) - { - delete (*iIndex)->m_pPublisher; - (*iIndex)->m_pPublisher = NULL; - } + (*iIndex)->m_pPublisher.disposeAndClear(); } m_vRemovedEntries.clear(); @@ -546,7 +544,7 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl& rEnt // Init publisher link here if ( !rEntry->m_pPublisher && !rEntry->m_sPublisher.isEmpty() ) { - rEntry->m_pPublisher = new FixedHyperlink( this ); + rEntry->m_pPublisher = VclPtr<FixedHyperlink>::Create( this ); rEntry->m_pPublisher->SetBackground(); rEntry->m_pPublisher->SetPaintTransparent( true ); rEntry->m_pPublisher->SetURL( rEntry->m_sPublisherURL ); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 1590f82500a5..d49e4a132690 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -78,7 +78,7 @@ struct Entry_Impl OUString m_sLicenseText; Image m_aIcon; Image m_aIconHC; - FixedHyperlink* m_pPublisher; + VclPtr<FixedHyperlink> m_pPublisher; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage; @@ -99,7 +99,7 @@ class ExtensionBox_Impl; class ExtensionRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener > { - ExtensionBox_Impl *m_pParent; + VclPtr<ExtensionBox_Impl> m_pParent; public: @@ -134,7 +134,7 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox Image m_aDefaultImage; Link m_aClickHdl; - ScrollBar *m_pScrollBar; + VclPtr<ScrollBar> m_pScrollBar; com::sun::star::uno::Reference< ExtensionRemovedListener > m_xRemoveListener; @@ -182,6 +182,7 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox public: ExtensionBox_Impl(vcl::Window* pParent); virtual ~ExtensionBox_Impl(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void Paint( const Rectangle &rPaintRect ) SAL_OVERRIDE; diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 45839a498619..f07042d44a23 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -223,9 +223,8 @@ void ServiceImpl::startExecuteModal( catch (const Exception & exc) { if (bAppUp) { const SolarMutexGuard guard; - boost::scoped_ptr<MessageDialog> box( - new MessageDialog(Application::GetActiveTopWindow(), - exc.Message)); + ScopedVclPtrInstance<MessageDialog> box( + Application::GetActiveTopWindow(), exc.Message); box->Execute(); } throw; diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index f3584d043640..3980a2396b81 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -98,8 +98,8 @@ TheExtensionManager::TheExtensionManager( vcl::Window *pParent, TheExtensionManager::~TheExtensionManager() { - delete m_pUpdReqDialog; - delete m_pExtMgrDialog; + m_pUpdReqDialog.disposeAndClear(); + m_pExtMgrDialog.disposeAndClear(); delete m_pExecuteCmdQueue; } @@ -112,7 +112,7 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) { if ( !m_pUpdReqDialog ) { - m_pUpdReqDialog = new UpdateRequiredDialog( NULL, this ); + m_pUpdReqDialog = VclPtr<UpdateRequiredDialog>::Create( nullptr, this ); delete m_pExecuteCmdQueue; m_pExecuteCmdQueue = new ExtensionCmdQueue( (DialogHelper*) m_pUpdReqDialog, this, m_xContext ); createPackageList(); @@ -120,7 +120,7 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) } else if ( !m_pExtMgrDialog ) { - m_pExtMgrDialog = new ExtMgrDialog( m_pParent, this ); + m_pExtMgrDialog = VclPtr<ExtMgrDialog>::Create( m_pParent, this ); delete m_pExecuteCmdQueue; m_pExecuteCmdQueue = new ExtensionCmdQueue( (DialogHelper*) m_pExtMgrDialog, this, m_xContext ); m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL ); @@ -171,8 +171,7 @@ sal_Int16 TheExtensionManager::execute() if ( m_pUpdReqDialog ) { nRet = m_pUpdReqDialog->Execute(); - delete m_pUpdReqDialog; - m_pUpdReqDialog = NULL; + m_pUpdReqDialog.disposeAndClear(); } return nRet; @@ -259,10 +258,8 @@ void TheExtensionManager::terminateDialog() if ( ! dp_misc::office_is_running() ) { const SolarMutexGuard guard; - delete m_pExtMgrDialog; - m_pExtMgrDialog = NULL; - delete m_pUpdReqDialog; - m_pUpdReqDialog = NULL; + m_pExtMgrDialog.disposeAndClear(); + m_pUpdReqDialog.disposeAndClear(); Application::Quit(); } } @@ -426,10 +423,8 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt ) if ( dp_misc::office_is_running() ) { const SolarMutexGuard guard; - delete m_pExtMgrDialog; - m_pExtMgrDialog = NULL; - delete m_pUpdReqDialog; - m_pUpdReqDialog = NULL; + m_pExtMgrDialog.disposeAndClear(); + m_pUpdReqDialog.disposeAndClear(); } s_ExtMgr.clear(); } diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 67836b2223d3..9281ddef4c05 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -53,9 +53,9 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes; - vcl::Window *m_pParent; - ExtMgrDialog *m_pExtMgrDialog; - UpdateRequiredDialog *m_pUpdReqDialog; + VclPtr<vcl::Window> m_pParent; + VclPtr<ExtMgrDialog> m_pExtMgrDialog; + VclPtr<UpdateRequiredDialog> m_pUpdReqDialog; ExtensionCmdQueue *m_pExecuteCmdQueue; OUString m_sGetExtensionsURL; diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 5a66653d400e..8e75bd04b42a 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -520,7 +520,7 @@ UpdateDialog::UpdateDialog( get(m_pthrobber, "THROBBER"); get(m_pUpdate, "UPDATE_LABEL"); get(m_pContainer, "UPDATES_CONTAINER"); - m_pUpdates = new UpdateDialog::CheckListBox(m_pContainer, *this); + m_pUpdates = VclPtr<UpdateDialog::CheckListBox>::Create(m_pContainer, *this); Size aSize(LogicToPixel(Size(240, 51), MAP_APPFONT)); m_pUpdates->set_width_request(aSize.Width()); m_pUpdates->set_height_request(aSize.Height()); @@ -564,6 +564,11 @@ UpdateDialog::UpdateDialog( UpdateDialog::~UpdateDialog() { + disposeOnce(); +} + +void UpdateDialog::dispose() +{ storeIgnoredUpdates(); for ( std::vector< UpdateDialog::Index* >::iterator i( m_ListboxEntries.begin() ); i != m_ListboxEntries.end(); ++i ) @@ -574,7 +579,22 @@ UpdateDialog::~UpdateDialog() { delete (*i); } - delete m_pUpdates; + m_pUpdates.disposeAndClear(); + m_pchecking.clear(); + m_pthrobber.clear(); + m_pUpdate.clear(); + m_pContainer.clear(); + m_pAll.clear(); + m_pDescription.clear(); + m_pPublisherLabel.clear(); + m_pPublisherLink.clear(); + m_pReleaseNotesLabel.clear(); + m_pReleaseNotesLink.clear(); + m_pDescriptions.clear(); + m_pHelp.clear(); + m_pOk.clear(); + m_pClose.clear(); + ModalDialog::dispose(); } @@ -599,9 +619,6 @@ UpdateDialog::CheckListBox::CheckListBox( vcl::Window* pParent, UpdateDialog & d SetNormalStaticImage(Image(DpGuiResId(RID_DLG_UPDATE_NORMALALERT))); } -UpdateDialog::CheckListBox::~CheckListBox() {} - - sal_uInt16 UpdateDialog::CheckListBox::getItemCount() const { sal_uLong i = GetEntryCount(); OSL_ASSERT(i <= std::numeric_limits< sal_uInt16 >::max()); diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index c2eedcbba4b2..18fa9de6ebde 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -85,6 +85,7 @@ public: std::vector< dp_gui::UpdateData > * updateData); virtual ~UpdateDialog(); + virtual void dispose() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE; @@ -111,8 +112,6 @@ private: CheckListBox( vcl::Window* pParent, UpdateDialog & dialog); - virtual ~CheckListBox(); - sal_uInt16 getItemCount() const; private: @@ -169,21 +168,21 @@ private: com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_context; - FixedText* m_pchecking; - Throbber* m_pthrobber; - FixedText* m_pUpdate; - VclViewport* m_pContainer; - UpdateDialog::CheckListBox* m_pUpdates; - CheckBox* m_pAll; - FixedText* m_pDescription; - FixedText* m_pPublisherLabel; - FixedHyperlink* m_pPublisherLink; - FixedText* m_pReleaseNotesLabel; - FixedHyperlink* m_pReleaseNotesLink; - VclMultiLineEdit* m_pDescriptions; - HelpButton* m_pHelp; - PushButton* m_pOk; - PushButton* m_pClose; + VclPtr<FixedText> m_pchecking; + VclPtr<Throbber> m_pthrobber; + VclPtr<FixedText> m_pUpdate; + VclPtr<VclViewport> m_pContainer; + VclPtr<UpdateDialog::CheckListBox> m_pUpdates; + VclPtr<CheckBox> m_pAll; + VclPtr<FixedText> m_pDescription; + VclPtr<FixedText> m_pPublisherLabel; + VclPtr<FixedHyperlink> m_pPublisherLink; + VclPtr<FixedText> m_pReleaseNotesLabel; + VclPtr<FixedHyperlink> m_pReleaseNotesLink; + VclPtr<VclMultiLineEdit> m_pDescriptions; + VclPtr<HelpButton> m_pHelp; + VclPtr<PushButton> m_pOk; + VclPtr<PushButton> m_pClose; OUString m_error; OUString m_none; OUString m_noInstallable; diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index e844e35fa5bd..69c49d8bbeac 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -237,7 +237,22 @@ UpdateInstallDialog::UpdateInstallDialog( m_pHelp->Disable(); } -UpdateInstallDialog::~UpdateInstallDialog() {} +UpdateInstallDialog::~UpdateInstallDialog() +{ + disposeOnce(); +} + +void UpdateInstallDialog::dispose() +{ + m_pFt_action.clear(); + m_pStatusbar.clear(); + m_pFt_extension_name.clear(); + m_pMle_info.clear(); + m_pHelp.clear(); + m_pOk.clear(); + m_pCancel.clear(); + ModalDialog::dispose(); +} bool UpdateInstallDialog::Close() { diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx index bff71e788820..9c05abd36358 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx @@ -60,6 +60,7 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xCtx); virtual ~UpdateInstallDialog(); + virtual void dispose() SAL_OVERRIDE; bool Close() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; @@ -104,13 +105,13 @@ private: OUString m_sNoInstall; OUString m_sThisErrorOccurred; - FixedText *m_pFt_action; - ProgressBar *m_pStatusbar; - FixedText *m_pFt_extension_name; - VclMultiLineEdit *m_pMle_info; - HelpButton *m_pHelp; - OKButton *m_pOk; - CancelButton *m_pCancel; + VclPtr<FixedText> m_pFt_action; + VclPtr<ProgressBar> m_pStatusbar; + VclPtr<FixedText> m_pFt_extension_name; + VclPtr<VclMultiLineEdit> m_pMle_info; + VclPtr<HelpButton> m_pHelp; + VclPtr<OKButton> m_pOk; + VclPtr<CancelButton> m_pCancel; }; } diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index c9aab531d127..710052f3180f 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -57,6 +57,7 @@ class LicenseView : public MultiLineEdit, public SfxListener public: LicenseView( vcl::Window* pParent, WinBits nStyle ); virtual ~LicenseView(); + virtual void dispose() SAL_OVERRIDE; void ScrollDown( ScrollType eScroll ); @@ -76,14 +77,14 @@ protected: struct LicenseDialogImpl : public ModalDialog { cssu::Reference<cssu::XComponentContext> m_xComponentContext; - FixedText* m_pFtHead; - FixedImage* m_pArrow1; - FixedImage* m_pArrow2; - LicenseView* m_pLicense; - PushButton* m_pDown; + VclPtr<FixedText> m_pFtHead; + VclPtr<FixedImage> m_pArrow1; + VclPtr<FixedImage> m_pArrow2; + VclPtr<LicenseView> m_pLicense; + VclPtr<PushButton> m_pDown; - PushButton* m_pAcceptButton; - PushButton* m_pDeclineButton; + VclPtr<PushButton> m_pAcceptButton; + VclPtr<PushButton> m_pDeclineButton; DECL_LINK(PageDownHdl, void *); DECL_LINK(ScrolledHdl, void *); @@ -98,11 +99,26 @@ struct LicenseDialogImpl : public ModalDialog css::uno::Reference< css::uno::XComponentContext > const & xContext, const OUString & sExtensionName, const OUString & sLicenseText); + virtual ~LicenseDialogImpl() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE; virtual void Activate() SAL_OVERRIDE; }; +void LicenseDialogImpl::dispose() +{ + m_pFtHead.clear(); + m_pArrow1.clear(); + m_pArrow2.clear(); + m_pLicense.clear(); + m_pDown.clear(); + m_pAcceptButton.clear(); + m_pDeclineButton.clear(); + ModalDialog::dispose(); +} + + LicenseView::LicenseView( vcl::Window* pParent, WinBits nStyle ) : MultiLineEdit( pParent, nStyle ) { @@ -122,9 +138,15 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLicenseView(vcl::Windo LicenseView::~LicenseView() { + disposeOnce(); +} + +void LicenseView::dispose() +{ maEndReachedHdl = Link(); maScrolledHdl = Link(); EndListeningAll(); + MultiLineEdit::dispose(); } void LicenseView::ScrollDown( ScrollType eScroll ) @@ -307,8 +329,9 @@ sal_Int16 LicenseDialog::execute() throw (RuntimeException, std::exception) sal_Int16 LicenseDialog::solar_execute() { - std::unique_ptr<LicenseDialogImpl> dlg( - new LicenseDialogImpl( + VclPtr<LicenseDialogImpl> dlg( + VclPtr<LicenseDialogImpl>::Create( + VCLUnoHelper::GetWindow(m_parent), m_xComponentContext, m_sExtensionName, m_sLicenseText)); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b783612ecb73..67e4750c05cb 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -610,21 +610,21 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, #ifndef IOS InitSvpForLibreOfficeKit(); - VirtualDevice aDevice(0, Size(1, 1), (sal_uInt16)32); + ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), (sal_uInt16)32) ; boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); - aDevice.SetOutputSizePixelScaleOffsetAndBuffer( + pDevice->SetOutputSizePixelScaleOffsetAndBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), aBuffer, true ); - pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight, + pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); #else SystemGraphicsData aData; aData.rCGContext = reinterpret_cast<CGContextRef>(pBuffer); // the Size argument is irrelevant, I hope - VirtualDevice aDevice(&aData, Size(1, 1), (sal_uInt16)0); + ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), (sal_uInt16)0); - pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight, + pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); #endif @@ -633,12 +633,12 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, { // Draw a small red rectangle in the top left corner so that it's easy to see where a new tile begins. Rectangle aRect(0, 0, 5, 5); - aRect = aDevice.PixelToLogic(aRect); - aDevice.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR); - aDevice.SetFillColor(COL_LIGHTRED); - aDevice.SetLineColor(); - aDevice.DrawRect(aRect); - aDevice.Pop(); + aRect = pDevice->PixelToLogic(aRect); + pDevice->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR); + pDevice->SetFillColor(COL_LIGHTRED); + pDevice->SetLineColor(); + pDevice->DrawRect(aRect); + pDevice->Pop(); } #else diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index b4ab62a5a309..d86a455238cf 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -472,10 +472,10 @@ Reference<XComponentContext> getUNO( if ( ! InitVCL() ) throw RuntimeException( "Cannot initialize VCL!" ); { - WarningBox warn(NULL, WB_OK | WB_DEF_OK, sMsg); - warn.SetText(utl::ConfigManager::getProductName()); - warn.SetIcon(0); - warn.Execute(); + ScopedVclPtrInstance< WarningBox > warn(nullptr, WB_OK | WB_DEF_OK, sMsg); + warn->SetText(utl::ConfigManager::getProductName()); + warn->SetIcon(0); + warn->Execute(); } DeInitVCL(); } diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 2cfba719e758..156a2d103f11 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -47,13 +47,29 @@ using namespace ::com::sun::star::uno; namespace { +class SplashScreen; + +class SplashScreenWindow : public IntroWindow +{ +public: + SplashScreen *pSpl; + ScopedVclPtr<VirtualDevice> _vdev; + SplashScreenWindow(SplashScreen *); + virtual ~SplashScreenWindow() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE; + // workwindow + virtual void Paint( const Rectangle& ) SAL_OVERRIDE; +}; + class SplashScreen : public ::cppu::WeakImplHelper3< XStatusIndicator, XInitialization, XServiceInfo > - , public IntroWindow { + friend SplashScreenWindow; private: enum BitmapMode { BM_FULLSCREEN, BM_DEFAULTMODE }; + VclPtr<SplashScreenWindow> pWindow; + DECL_LINK( AppEventListenerHdl, VclWindowEvent * ); virtual ~SplashScreen(); void loadConfig(); @@ -63,7 +79,6 @@ private: static osl::Mutex _aMutex; - VirtualDevice _vdev; BitmapEx _aIntroBmp; Color _cProgressFrameColor; Color _cProgressBarColor; @@ -112,15 +127,24 @@ public: virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE { return desktop::splash::getSupportedServiceNames(); } +}; - // workwindow - virtual void Paint( const Rectangle& ) SAL_OVERRIDE; +SplashScreenWindow::SplashScreenWindow(SplashScreen *pSplash) + : IntroWindow() + , pSpl( pSplash ) + , _vdev(VclPtr<VirtualDevice>::Create(*this)) +{ + _vdev->EnableRTL(IsRTLEnabled()); +} -}; +void SplashScreenWindow::dispose() +{ + pSpl = NULL; + IntroWindow::dispose(); +} SplashScreen::SplashScreen() - : IntroWindow() - , _vdev(*((IntroWindow*)this)) + : pWindow( new SplashScreenWindow (this) ) , _cProgressFrameColor(sal::static_int_cast< ColorData >(NOT_LOADED)) , _cProgressBarColor(sal::static_int_cast< ColorData >(NOT_LOADED)) , _cProgressTextColor(sal::static_int_cast< ColorData >(NOT_LOADED)) @@ -150,15 +174,14 @@ SplashScreen::SplashScreen() , _yoffset(18) { loadConfig(); - _vdev.EnableRTL(IsRTLEnabled()); } SplashScreen::~SplashScreen() { Application::RemoveEventListener( LINK( this, SplashScreen, AppEventListenerHdl ) ); - Hide(); - + pWindow->Hide(); + pWindow.disposeAndClear(); } void SAL_CALL SplashScreen::start(const OUString&, sal_Int32 nRange) @@ -169,10 +192,10 @@ void SAL_CALL SplashScreen::start(const OUString&, sal_Int32 nRange) _bProgressEnd = false; SolarMutexGuard aSolarGuard; if ( _eBitmapMode == BM_FULLSCREEN ) - ShowFullScreenMode( true ); - Show(); - Paint(Rectangle()); - Flush(); + pWindow->ShowFullScreenMode( true ); + pWindow->Show(); + pWindow->Paint(Rectangle()); + pWindow->Flush(); } } @@ -183,8 +206,8 @@ void SAL_CALL SplashScreen::end() if (_bVisible ) { if ( _eBitmapMode == BM_FULLSCREEN ) - EndFullScreenMode(); - Hide(); + pWindow->EndFullScreenMode(); + pWindow->Hide(); } _bProgressEnd = true; } @@ -196,8 +219,8 @@ void SAL_CALL SplashScreen::reset() if (_bVisible && !_bProgressEnd ) { if ( _eBitmapMode == BM_FULLSCREEN ) - ShowFullScreenMode( true ); - Show(); + pWindow->ShowFullScreenMode( true ); + pWindow->Show(); updateStatus(); } } @@ -213,8 +236,8 @@ void SAL_CALL SplashScreen::setText(const OUString& rText) if (_bVisible && !_bProgressEnd) { if ( _eBitmapMode == BM_FULLSCREEN ) - ShowFullScreenMode( true ); - Show(); + pWindow->ShowFullScreenMode( true ); + pWindow->Show(); updateStatus(); } } @@ -228,11 +251,13 @@ void SAL_CALL SplashScreen::setValue(sal_Int32 nValue) SolarMutexGuard aSolarGuard; if (_bVisible && !_bProgressEnd) { if ( _eBitmapMode == BM_FULLSCREEN ) - ShowFullScreenMode( true ); - Show(); - if (nValue >= _iMax) _iProgress = _iMax; - else _iProgress = nValue; - updateStatus(); + pWindow->ShowFullScreenMode( true ); + pWindow->Show(); + if (nValue >= _iMax) + _iProgress = _iMax; + else + _iProgress = nValue; + updateStatus(); } } @@ -252,8 +277,8 @@ SplashScreen::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::sta if ( _bShowLogo ) SetScreenBitmap (_aIntroBmp); Size aSize = _aIntroBmp.GetSizePixel(); - SetOutputSizePixel( aSize ); - _vdev.SetOutputSizePixel( aSize ); + pWindow->SetOutputSizePixel( aSize ); + pWindow->_vdev->SetOutputSizePixel( aSize ); _height = aSize.Height(); _width = aSize.Width(); if (_width > 500) @@ -323,10 +348,12 @@ SplashScreen::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::sta void SplashScreen::updateStatus() { - if (!_bVisible || _bProgressEnd) return; - if (!_bPaintProgress) _bPaintProgress = true; - Paint(Rectangle()); - Flush(); + if (!_bVisible || _bProgressEnd) + return; + if (!_bPaintProgress) + _bPaintProgress = true; + pWindow->Paint(Rectangle()); + pWindow->Flush(); } // internal private methods @@ -337,7 +364,7 @@ IMPL_LINK( SplashScreen, AppEventListenerHdl, VclWindowEvent *, inEvent ) switch ( inEvent->GetId() ) { case VCLEVENT_WINDOW_SHOW: - Paint( Rectangle() ); + pWindow->Paint( Rectangle() ); break; default: break; @@ -578,18 +605,19 @@ void SplashScreen::determineProgressRatioValues( } } -void SplashScreen::Paint( const Rectangle&) +void SplashScreenWindow::Paint( const Rectangle&) { - if(!_bVisible) return; + if (!pSpl || !pSpl->_bVisible) + return; //native drawing // in case of native controls we need to draw directly to the window - if( _bNativeProgress && IsNativeControlSupported( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL ) ) + if( pSpl->_bNativeProgress && IsNativeControlSupported( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL ) ) { - DrawBitmapEx( Point(), _aIntroBmp ); + DrawBitmapEx( Point(), pSpl->_aIntroBmp ); - ImplControlValue aValue( _iProgress * _barwidth / _iMax); - Rectangle aDrawRect( Point(_tlx, _tly), Size( _barwidth, _barheight ) ); + ImplControlValue aValue( pSpl->_iProgress * pSpl->_barwidth / pSpl->_iMax); + Rectangle aDrawRect( Point(pSpl->_tlx, pSpl->_tly), Size( pSpl->_barwidth, pSpl->_barheight ) ); Rectangle aNativeControlRegion, aNativeContentRegion; if( GetNativeControlRegion( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect, @@ -597,41 +625,42 @@ void SplashScreen::Paint( const Rectangle&) aNativeControlRegion, aNativeContentRegion ) ) { long nProgressHeight = aNativeControlRegion.GetHeight(); - aDrawRect.Top() -= (nProgressHeight - _barheight)/2; - aDrawRect.Bottom() += (nProgressHeight - _barheight)/2; + aDrawRect.Top() -= (nProgressHeight - pSpl->_barheight)/2; + aDrawRect.Bottom() += (nProgressHeight - pSpl->_barheight)/2; } if( (DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect, - ControlState::ENABLED, aValue, _sProgressText )) ) + ControlState::ENABLED, aValue, pSpl->_sProgressText )) ) { return; } } - //non native drawing + + // non native drawing // draw bitmap - if (_bPaintBitmap) - _vdev.DrawBitmapEx( Point(), _aIntroBmp ); + if (pSpl->_bPaintBitmap) + _vdev->DrawBitmapEx( Point(), pSpl->_aIntroBmp ); - if (_bPaintProgress) { + if (pSpl->_bPaintProgress) { // draw progress... - long length = (_iProgress * _barwidth / _iMax) - (2 * _barspace); + long length = (pSpl->_iProgress * pSpl->_barwidth / pSpl->_iMax) - (2 * pSpl->_barspace); if (length < 0) length = 0; // border - _vdev.SetFillColor(); - _vdev.SetLineColor( _cProgressFrameColor ); - _vdev.DrawRect(Rectangle(_tlx, _tly, _tlx+_barwidth, _tly+_barheight)); - _vdev.SetFillColor( _cProgressBarColor ); - _vdev.SetLineColor(); - _vdev.DrawRect(Rectangle(_tlx+_barspace, _tly+_barspace, _tlx+_barspace+length, _tly+_barheight-_barspace)); + _vdev->SetFillColor(); + _vdev->SetLineColor( pSpl->_cProgressFrameColor ); + _vdev->DrawRect(Rectangle(pSpl->_tlx, pSpl->_tly, pSpl->_tlx+pSpl->_barwidth, pSpl->_tly+pSpl->_barheight)); + _vdev->SetFillColor( pSpl->_cProgressBarColor ); + _vdev->SetLineColor(); + _vdev->DrawRect(Rectangle(pSpl->_tlx+pSpl->_barspace, pSpl->_tly+pSpl->_barspace, pSpl->_tlx+pSpl->_barspace+length, pSpl->_tly+pSpl->_barheight-pSpl->_barspace)); vcl::Font aFont; aFont.SetSize(Size(0, 12)); aFont.SetAlign(ALIGN_BASELINE); - _vdev.SetFont(aFont); - _vdev.SetTextColor(_cProgressTextColor); - _vdev.DrawText(Point(_tlx, _textBaseline), _sProgressText); + _vdev->SetFont(aFont); + _vdev->SetTextColor(pSpl->_cProgressTextColor); + _vdev->DrawText(Point(pSpl->_tlx, pSpl->_textBaseline), pSpl->_sProgressText); } - DrawOutDev(Point(), GetOutputSizePixel(), Point(), _vdev.GetOutputSizePixel(), _vdev ); + DrawOutDev(Point(), GetOutputSizePixel(), Point(), _vdev->GetOutputSizePixel(), *_vdev.get() ); } |