From 024a57017384a61b4a61056f1de275f44642bef3 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 15 Sep 2019 20:41:25 +0100 Subject: drop newly unnecessary OGenericUnoDialog::Dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If047d08cea93fdfacff9ee00c69cf57ba08c916c Reviewed-on: https://gerrit.libreoffice.org/78972 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- svtools/source/uno/addrtempuno.cxx | 13 +++++----- svtools/source/uno/genericunodialog.cxx | 26 +++++++++---------- svtools/source/uno/wizard/unowizard.cxx | 44 ++++++++++++++++----------------- 3 files changed, 41 insertions(+), 42 deletions(-) (limited to 'svtools/source') diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index 777883ae0615..7af43f88e95c 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -71,7 +71,7 @@ namespace { protected: // OGenericUnoDialog overridables - virtual svt::OGenericUnoDialog::Dialog createDialog(const css::uno::Reference& rParent) override; + virtual std::unique_ptr createDialog(const css::uno::Reference& rParent) override; virtual void implInitialize(const css::uno::Any& _rValue) override; @@ -128,8 +128,8 @@ namespace { { OGenericUnoDialog::executedDialog(_nExecutionResult); - if ( _nExecutionResult && m_aDialog ) - static_cast(m_aDialog.m_xWeldDialog.get())->getFieldMapping(m_aAliases); + if ( _nExecutionResult && m_xDialog ) + static_cast(m_xDialog.get())->getFieldMapping(m_aAliases); } void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments) @@ -194,13 +194,12 @@ namespace { OGenericUnoDialog::implInitialize( _rValue ); } - svt::OGenericUnoDialog::Dialog OAddressBookSourceDialogUno::createDialog(const css::uno::Reference& rParent) + std::unique_ptr OAddressBookSourceDialogUno::createDialog(const css::uno::Reference& rParent) { weld::Window* pParent = Application::GetFrameWeld(rParent); if ( m_xDataSource.is() && !m_sTable.isEmpty() ) - return svt::OGenericUnoDialog::Dialog(std::make_unique(pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases)); - else - return svt::OGenericUnoDialog::Dialog(std::make_unique(pParent, m_aContext)); + return std::make_unique(pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases); + return std::make_unique(pParent, m_aContext); } } diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx index d99c2593531f..e4e61c2d52cd 100644 --- a/svtools/source/uno/genericunodialog.cxx +++ b/svtools/source/uno/genericunodialog.cxx @@ -58,11 +58,11 @@ OGenericUnoDialog::OGenericUnoDialog(const Reference< XComponentContext >& _rxCo OGenericUnoDialog::~OGenericUnoDialog() { - if (m_aDialog) + if (m_xDialog) { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - if (m_aDialog) + if (m_xDialog) destroyDialog(); } } @@ -108,8 +108,8 @@ void OGenericUnoDialog::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, con // from now on m_sTitle is valid m_bTitleAmbiguous = false; - if (m_aDialog) - m_aDialog.set_title(m_sTitle); + if (m_xDialog) + m_xDialog->set_title(m_sTitle); } } @@ -157,7 +157,7 @@ void SAL_CALL OGenericUnoDialog::setTitle( const OUString& _rTitle ) bool OGenericUnoDialog::impl_ensureDialog_lck() { - if (m_aDialog) + if (m_xDialog) return true; // get the parameters for the dialog from the current settings @@ -165,16 +165,16 @@ bool OGenericUnoDialog::impl_ensureDialog_lck() // the title OUString sTitle = m_sTitle; - OGenericUnoDialog::Dialog aDialog(createDialog(m_xParent)); - OSL_ENSURE(aDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!"); - if (!aDialog) + auto xDialog(createDialog(m_xParent)); + OSL_ENSURE(xDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!"); + if (!xDialog) return false; // do some initialisations if (!m_bTitleAmbiguous) - aDialog.set_title(sTitle); + xDialog->set_title(sTitle); - m_aDialog = std::move(aDialog); + m_xDialog = std::move(xDialog); return true; } @@ -202,8 +202,8 @@ sal_Int16 SAL_CALL OGenericUnoDialog::execute() // start execution sal_Int16 nReturn(0); - if (m_aDialog.m_xWeldDialog) - nReturn = m_aDialog.m_xWeldDialog->run(); + if (m_xDialog) + nReturn = m_xDialog->run(); { ::osl::MutexGuard aGuard(m_aMutex); @@ -254,7 +254,7 @@ void SAL_CALL OGenericUnoDialog::initialize( const Sequence< Any >& aArguments ) void OGenericUnoDialog::destroyDialog() { SolarMutexGuard aSolarGuard; - m_aDialog.m_xWeldDialog.reset(); + m_xDialog.reset(); } } // namespace svt diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index 856d0ba3dafc..decbada6b887 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -130,7 +130,7 @@ namespace { virtual ~Wizard() override; protected: - virtual OGenericUnoDialog::Dialog createDialog(const css::uno::Reference& rParent) override; + virtual std::unique_ptr createDialog(const css::uno::Reference& rParent) override; private: css::uno::Sequence< css::uno::Sequence< sal_Int16 > > m_aWizardSteps; @@ -157,12 +157,12 @@ namespace { Wizard::~Wizard() { - if (m_aDialog) + if (m_xDialog) { ::osl::MutexGuard aGuard( m_aMutex ); - if (m_aDialog) + if (m_xDialog) { - m_sHelpURL = lcl_getHelpURL(m_aDialog.get_help_id()); + m_sHelpURL = lcl_getHelpURL(m_xDialog->get_help_id()); destroyDialog(); } } @@ -245,12 +245,12 @@ namespace { return OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 ); } - svt::OGenericUnoDialog::Dialog Wizard::createDialog(const css::uno::Reference& rParent) + std::unique_ptr Wizard::createDialog(const css::uno::Reference& rParent) { auto xDialog = std::make_unique(Application::GetFrameWeld(rParent), m_xController, m_aWizardSteps); xDialog->set_help_id(lcl_getHelpId(m_sHelpURL)); xDialog->setTitleBase( m_sTitle ); - return OGenericUnoDialog::Dialog(std::move(xDialog)); + return xDialog; } OUString SAL_CALL Wizard::getImplementationName() @@ -286,10 +286,10 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - if (!m_aDialog) + if (!m_xDialog) return m_sHelpURL; - return lcl_getHelpURL(m_aDialog.get_help_id()); + return lcl_getHelpURL(m_xDialog->get_help_id()); } void SAL_CALL Wizard::setHelpURL( const OUString& i_HelpURL ) @@ -297,10 +297,10 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - if (!m_aDialog) + if (!m_xDialog) m_sHelpURL = i_HelpURL; else - m_aDialog.set_help_id(lcl_getHelpId(i_HelpURL)); + m_xDialog->set_help_id(lcl_getHelpId(i_HelpURL)); } Reference< XWindow > SAL_CALL Wizard::getDialogWindow() @@ -308,8 +308,8 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_RETURN( m_aDialog.m_xWeldDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", nullptr ); - return m_aDialog.m_xWeldDialog->getDialog()->GetXWindow(); + ENSURE_OR_RETURN( m_xDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", nullptr ); + return m_xDialog->getDialog()->GetXWindow(); } void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, sal_Bool i_Enable ) @@ -317,7 +317,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" ); pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable ); @@ -328,7 +328,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" ); pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) ); @@ -339,7 +339,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" ); return pWizardImpl->travelNext(); @@ -350,7 +350,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" ); return pWizardImpl->travelPrevious(); @@ -361,7 +361,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" ); if ( !pWizardImpl->knowsPage( i_PageID ) ) @@ -378,7 +378,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" ); pWizardImpl->updateTravelUI(); @@ -389,7 +389,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" ); return pWizardImpl->advanceTo( i_PageId ); @@ -400,7 +400,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" ); return pWizardImpl->goBackTo( i_PageId ); @@ -411,7 +411,7 @@ namespace { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() ); return pWizardImpl->getCurrentWizardPage(); @@ -425,7 +425,7 @@ namespace { if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) ) throw NoSuchElementException( OUString(), *this ); - WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() ); + WizardShell* pWizardImpl = dynamic_cast(m_xDialog.get()); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" ); pWizardImpl->activatePath( i_PathIndex, i_Final ); -- cgit