diff options
Diffstat (limited to 'filter/source/pdf/pdfdialog.cxx')
-rw-r--r-- | filter/source/pdf/pdfdialog.cxx | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx index 44953c242fb3..a5c9e8aaa007 100644 --- a/filter/source/pdf/pdfdialog.cxx +++ b/filter/source/pdf/pdfdialog.cxx @@ -62,6 +62,13 @@ std::unique_ptr<weld::DialogController> PDFDialog::createDialog(const css::uno:: return nullptr; } +std::shared_ptr<SfxTabDialogController> PDFDialog::createAsyncDialog(const css::uno::Reference<css::awt::XWindow>& rParent) +{ + if( mxSrcDoc.is() ) + return std::make_shared<ImpPDFTabDialog>(Application::GetFrameWeld(rParent), maFilterData, mxSrcDoc); + return nullptr; +} + void PDFDialog::executedDialog( sal_Int16 nExecutionResult ) { if (nExecutionResult && m_xDialog) @@ -69,6 +76,24 @@ void PDFDialog::executedDialog( sal_Int16 nExecutionResult ) destroyDialog(); } +void PDFDialog::runAsync(const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener) +{ + SfxTabDialogController::runAsync(m_xAsyncDialog, [this, xListener](sal_Int32 nResponse) { + rtl::Reference<PDFDialog> xThis(this); // keep alive for scope, dialogClosed can cause owner to drop this + executedAsyncDialog( m_xAsyncDialog, nResponse ); + css::ui::dialogs::DialogClosedEvent aEvent; + aEvent.DialogResult = nResponse; + xListener->dialogClosed( aEvent ); + destroyAsyncDialog(); + }); +} + +void PDFDialog::executedAsyncDialog( std::shared_ptr<SfxTabDialogController> xAsyncDialog, sal_Int32 nExecutionResult ) +{ + if (nExecutionResult && xAsyncDialog) + maFilterData = static_cast<ImpPDFTabDialog*>(xAsyncDialog.get())->GetFilterData(); +} + Reference< XPropertySetInfo > SAL_CALL PDFDialog::getPropertySetInfo() { Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); @@ -100,9 +125,10 @@ Sequence< PropertyValue > SAL_CALL PDFDialog::getPropertyValues() if( i == nCount ) maMediaDescriptor.realloc( ++nCount ); + auto pMediaDescriptor = maMediaDescriptor.getArray(); - maMediaDescriptor[ i ].Name = "FilterData"; - maMediaDescriptor[ i ].Value <<= maFilterData; + pMediaDescriptor[ i ].Name = "FilterData"; + pMediaDescriptor[ i ].Value <<= maFilterData; return maMediaDescriptor; } @@ -112,7 +138,7 @@ void SAL_CALL PDFDialog::setPropertyValues( const Sequence< PropertyValue >& rPr { maMediaDescriptor = rProps; - for( const PropertyValue& rProp : std::as_const(maMediaDescriptor) ) + for (const PropertyValue& rProp : maMediaDescriptor) { if ( rProp.Name == "FilterData" ) { |