Revert "tdf#120343 show pdf in async pdf export dialog callback"

This reverts commit 9df8a2eb8c216b16927aac2182b881b21d8b2d14 to try
an alternative approach.

Change-Id: I2f1e2cd28cbaee5ab3d7a3cec808ec5bb7777cb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124604
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 4c50b5e..d5eb336 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1305,22 +1305,6 @@ uno::Reference< css::frame::XModuleManager2 > const & SfxStoringHelper::GetModul
    return m_xModuleManager;
}

namespace
{
    void LaunchPDFViewer(const INetURLObject& rURL)
    {
        // Launch PDF viewer
        FilterConfigItem aItem( u"Office.Common/Filter/PDF/Export/" );
        bool aViewPDF = aItem.ReadBool( "ViewPDFAfterExport", false );

        if ( aViewPDF )
        {
            uno::Reference<XSystemShellExecute> xSystemShellExecute(SystemShellExecute::create(::comphelper::getProcessComponentContext()));
            xSystemShellExecute->execute(rURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), "", SystemShellExecuteFlags::URIS_ONLY);
        }
    }
}

bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xModel,
                                            std::u16string_view aSlotName,
                                            uno::Sequence< beans::PropertyValue >& aArgsSequence,
@@ -1672,11 +1656,6 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo
            {
                SfxStoringHelper::SetDocInfoState(aModel.GetModel(), xOldDocProps);
            }

            // Launch PDF viewer
            if (nStoreMode & PDFEXPORT_REQUESTED)
                LaunchPDFViewer(aURL);

        };

        // use dispatch API to show document info dialog
@@ -1698,10 +1677,19 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo
            aModelData.GetStorable()->storeToURL( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aArgsSequence );
        else
            aModelData.GetStorable()->storeAsURL( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aArgsSequence );
    }

        // Launch PDF viewer
        if (nStoreMode & PDFEXPORT_REQUESTED)
            LaunchPDFViewer(aURL);
    // Launch PDF viewer
    if ( nStoreMode & PDFEXPORT_REQUESTED )
    {
        FilterConfigItem aItem(u"Office.Common/Filter/PDF/Export/");
        bool aViewPDF = aItem.ReadBool( "ViewPDFAfterExport", false );

        if ( aViewPDF )
        {
            uno::Reference<XSystemShellExecute> xSystemShellExecute(SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) );
            xSystemShellExecute->execute( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), "", SystemShellExecuteFlags::URIS_ONLY );
        }
    }

    return bDialogUsed;