fpicker/source/office/OfficeFilePicker.cxx | 43 --------- fpicker/source/office/OfficeFilePicker.hxx | 1 fpicker/source/office/RemoteFilesDialog.cxx | 10 -- fpicker/source/office/RemoteFilesDialog.hxx | 2 fpicker/source/office/fpdialogbase.hxx | 2 fpicker/source/office/iodlg.cxx | 81 ----------------- fpicker/source/office/iodlg.hxx | 2 fpicker/source/office/iodlgimp.cxx | 7 - fpicker/source/office/iodlgimp.hxx | 2 include/sfx2/filedlghelper.hxx | 6 - include/sfx2/objsh.hxx | 1 include/sfx2/sfxsids.hrc | 1 offapi/com/sun/star/document/MediaDescriptor.idl | 2 sc/source/ui/xmlsource/xmlsourcedlg.cxx | 9 - sfx2/source/appl/appopen.cxx | 8 - sfx2/source/appl/appuno.cxx | 18 --- sfx2/source/dialog/filedlghelper.cxx | 34 ++----- sfx2/source/dialog/filedlgimpl.hxx | 4 sfx2/source/doc/guisaveas.cxx | 109 +++++------------------ sfx2/source/doc/objcont.cxx | 10 ++ sfx2/source/doc/objstor.cxx | 1 21 files changed, 69 insertions(+), 284 deletions(-)
New commits: commit 06c6c78d40f2eae0a404f15da8fe02d7f64ffb40 Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Mon Sep 8 10:04:49 2025 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Mon Oct 27 01:22:42 2025 +0100 tdf#167897 Fix save/export directory preselection with empty user profile In the case of an empty user profile, the logic to display the correct directory was twisted. This also reverts the fix for tdf#165228 since the root cause now has been fixed. Change-Id: I0e33c53b7e1d8a7366caad0e1375a2f95a3ae313 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190655 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <[email protected]> diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 7d8fa5e990b2..c0981bd0a11b 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1472,7 +1472,6 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList, } rpURLList.clear(); - maPath.clear(); // tdf#147202 This should not survive between calls to execute if ( ! mxFileDlg.is() ) return ERRCODE_ABORT; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 87667b6287c9..ebb740e9401b 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -334,7 +334,6 @@ public: bool ShowDocumentInfoDialog(); static OUString GetRecommendedExtension( const OUString& aTypeName ); - OUString GetRecommendedDir( const OUString& aSuggestedDir ); OUString GetRecommendedName( const OUString& aSuggestedName, const OUString& aTypeName ); }; @@ -945,9 +944,15 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, if (SfxViewShell* pViewShell = SfxViewShell::Current()) { SfxObjectShell* pDocShell = pViewShell->GetObjectShell(); - if (sPreselectedDir.isEmpty() && pDocShell && !pDocShell->IsBasedOnTemplate()) - sPreselectedDir = GetDocProps().getUnpackedValueOrDefault("DocumentBaseURL", OUString()); + if (pDocShell && !pDocShell->IsBasedOnTemplate()) + { + if (sPreselectedDir.isEmpty()) + sPreselectedDir = GetDocProps().getUnpackedValueOrDefault("DocumentBaseURL", OUString()); + if (sPreselectedDir.isEmpty() && GetStorable()->hasLocation()) + sPreselectedDir = GetStorable()->getLocation(); + } } + INetURLObject aObj(sPreselectedDir); aObj.removeSegment(); // remove file name from URL sPreselectedDir = aObj.GetMainURL(INetURLObject::DecodeMechanism::NONE); @@ -1054,9 +1059,8 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, } } - const OUString aRecommendedDir {GetRecommendedDir( aSuggestedDir )}; - if ( !aRecommendedDir.isEmpty() ) - pFileDlg->SetDisplayFolder( aRecommendedDir ); + if ( !aSuggestedDir.isEmpty() ) + pFileDlg->SetDisplayFolder( aSuggestedDir ); const OUString aRecommendedName {GetRecommendedName( aSuggestedName, aAdjustToType )}; if ( !aRecommendedName.isEmpty() ) pFileDlg->SetFileName( aRecommendedName ); @@ -1324,63 +1328,6 @@ OUString ModelData_Impl::GetRecommendedExtension( const OUString& aTypeName ) return OUString(); } - -OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir ) -{ - if ( ( !aSuggestedDir.isEmpty() || GetStorable()->hasLocation() ) - && !GetMediaDescr().getUnpackedValueOrDefault(u"RepairPackage"_ustr, false ) ) - { - INetURLObject aLocation; - if ( !aSuggestedDir.isEmpty() ) - aLocation = INetURLObject( aSuggestedDir ); - else - { - const OUString aOldURL = GetStorable()->getLocation(); - if ( !aOldURL.isEmpty() ) - { - INetURLObject aTmp( aOldURL ); - if ( aTmp.removeSegment() ) - aLocation = aTmp; - } - - if ( aLocation.HasError() ) - aLocation = INetURLObject(); - } - - OUString sLocationURL( aLocation.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); - bool bIsInTempPath( false ); - OUString sSysTempPath; - if( osl::FileBase::getTempDirURL( sSysTempPath ) == osl::FileBase::E_None ) - bIsInTempPath = !sSysTempPath.isEmpty() && sLocationURL.startsWith( sSysTempPath ); -#ifdef _WIN32 - if( !bIsInTempPath ) - { - PWSTR sPath; - HRESULT hRes = SHGetKnownFolderPath(FOLDERID_InternetCache, 0, nullptr, &sPath); - if( SUCCEEDED(hRes) ) - { - OUString sTempINetFiles; - if( osl::FileBase::getFileURLFromSystemPath(OUString(o3tl::toU(sPath)), sTempINetFiles) == osl::FileBase::E_None ) - bIsInTempPath = !sTempINetFiles.isEmpty() && sLocationURL.startsWith( sTempINetFiles ); - } - CoTaskMemFree(sPath); - } -#endif - // Suggest somewhere other than the system's temp directory - if( bIsInTempPath ) - aLocation = INetURLObject(); - - aLocation.setFinalSlash(); - if ( !aLocation.HasError() ) - return aLocation.GetMainURL( INetURLObject::DecodeMechanism::NONE ); - - return OUString(); - } - - return OUString(); -} - - OUString ModelData_Impl::GetRecommendedName( const OUString& aSuggestedName, const OUString& aTypeName ) { // the last used name might be provided by aSuggestedName from the old selection, or from the MediaDescriptor commit 16932b370d855fa1f311f671287d7f094871a663 Author: Xisco Fauli <[email protected]> AuthorDate: Mon Sep 1 14:04:52 2025 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Mon Oct 27 01:20:21 2025 +0100 sfx2: check SfxViewShell::Current() Seen in https://crashreport.libreoffice.org/stats/crash_details/4aabe4e5-c568-4fa8-bcbf-6fb787cd603a Regression after commit a4349c502eb2169b3f83d58e49a7871a341daf76 Author: Samuel Mehrbrodt <[email protected]> Date: Thu Aug 7 10:51:48 2025 +0200 tdf#167845 Don't preselect the template path Change-Id: If816b4d5aa8810028de682a79a2e37ac2855c250 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190476 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 190ebc15283f..87667b6287c9 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -942,9 +942,12 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, // Fall back to the document base URL - but only if the document is not based on a template. // Otherwise the template's directory would be used, which is not what we want. - SfxObjectShell* pDocShell = SfxViewShell::Current()->GetObjectShell(); - if (sPreselectedDir.isEmpty() && pDocShell && !pDocShell->IsBasedOnTemplate()) - sPreselectedDir = GetDocProps().getUnpackedValueOrDefault("DocumentBaseURL", OUString()); + if (SfxViewShell* pViewShell = SfxViewShell::Current()) + { + SfxObjectShell* pDocShell = pViewShell->GetObjectShell(); + if (sPreselectedDir.isEmpty() && pDocShell && !pDocShell->IsBasedOnTemplate()) + sPreselectedDir = GetDocProps().getUnpackedValueOrDefault("DocumentBaseURL", OUString()); + } INetURLObject aObj(sPreselectedDir); aObj.removeSegment(); // remove file name from URL sPreselectedDir = aObj.GetMainURL(INetURLObject::DecodeMechanism::NONE); commit 735d0cc268e58028ad04d6de9bb4d0faa72e56c5 Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Thu Aug 7 10:51:48 2025 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Mon Oct 27 01:20:13 2025 +0100 tdf#167845 Don't preselect the template path When saving a doc which was based on a template, don't preselect the path where the template was stored. Instead, preselect the last used path from the Save dialog. Change-Id: I484e5a908cc739618683b6c2e2b4a7fda4a66232 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189053 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <[email protected]> (cherry picked from commit a4349c502eb2169b3f83d58e49a7871a341daf76) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189072 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index e32ad525a5d4..01392aabf6e0 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -419,6 +419,7 @@ public: void SetHeaderAttributesForSourceViewHack(); bool IsQueryLoadTemplate() const; + bool IsBasedOnTemplate() const; // Whether the document is based on a template bool IsUseUserData() const; bool IsUseThumbnailSave() const; bool IsLoadReadonly() const; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index de2e65dbc2e5..190ebc15283f 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -73,6 +73,7 @@ #include <unotools/tempfile.hxx> #include <unotools/useroptions.hxx> +#include <sfx2/docfile.hxx> #include <sfx2/objsh.hxx> #include <sfx2/sfxsids.hrc> #include <sfx2/strings.hrc> @@ -936,8 +937,14 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, SfxFilterFlags nMust = getMustFlags( nStoreMode ); SfxFilterFlags nDont = getDontFlags( nStoreMode ); weld::Window* pFrameWin = SfxStoringHelper::GetModelWindow(m_xModel); - OUString sPreselectedDir = GetDocProps().getUnpackedValueOrDefault( - "ExportDirectory", GetDocProps().getUnpackedValueOrDefault("DocumentBaseURL", OUString())); + OUString sPreselectedDir + = GetDocProps().getUnpackedValueOrDefault("ExportDirectory", OUString()); + + // Fall back to the document base URL - but only if the document is not based on a template. + // Otherwise the template's directory would be used, which is not what we want. + SfxObjectShell* pDocShell = SfxViewShell::Current()->GetObjectShell(); + if (sPreselectedDir.isEmpty() && pDocShell && !pDocShell->IsBasedOnTemplate()) + sPreselectedDir = GetDocProps().getUnpackedValueOrDefault("DocumentBaseURL", OUString()); INetURLObject aObj(sPreselectedDir); aObj.removeSegment(); // remove file name from URL sPreselectedDir = aObj.GetMainURL(INetURLObject::DecodeMechanism::NONE); diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index ba4864fa9a7b..cd66086f0015 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -29,6 +29,8 @@ #include <svl/style.hxx> #include <svl/intitem.hxx> +#include <svl/itemset.hxx> +#include <svl/eitem.hxx> #include <svl/ctloptions.hxx> #include <comphelper/processfactory.hxx> #include <unotools/securityoptions.hxx> @@ -628,6 +630,14 @@ bool SfxObjectShell::IsQueryLoadTemplate() const return pImpl->bQueryLoadTemplate; } +bool SfxObjectShell::IsBasedOnTemplate() const +{ + if (!pMedium) + return false; + const SfxBoolItem* pTemplateItem = pMedium->GetItemSet().GetItem(SID_TEMPLATE, false); + return pTemplateItem && pTemplateItem->GetValue(); +} + bool SfxObjectShell::IsUseUserData() const { return pImpl->bUseUserData; commit 50386f1e8decfffc340ebddf6a892098e30b5cd3 Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Thu Apr 24 11:01:48 2025 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Mon Oct 27 01:19:49 2025 +0100 tdf#165392 Save as should default to current document directory as well As done in 3fa39a4dadc8e2777185465a6f7c9968c8cf44d1 for Export, do the same for "Save as"/"Save a copy" as well. Change-Id: I5135cff0f74d6673fcfc7fa090ed752bea1d59cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184542 Reviewed-by: Samuel Mehrbrodt <[email protected]> Tested-by: Jenkins diff --git a/offapi/com/sun/star/document/MediaDescriptor.idl b/offapi/com/sun/star/document/MediaDescriptor.idl index e6f73d3afdcd..6cf7c8cc870c 100644 --- a/offapi/com/sun/star/document/MediaDescriptor.idl +++ b/offapi/com/sun/star/document/MediaDescriptor.idl @@ -449,7 +449,7 @@ service MediaDescriptor */ [optional,property] string SuggestedSaveAsName; - /** Directory to be used when exporting (to PDF, epub, ...). + /** Directory to be used when saving (save as, save a copy) or exporting (to PDF, epub, ...). Defaults to the current document directory. */ [optional,property] string ExportDirectory; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index ec36d7699500..de2e65dbc2e5 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -936,16 +936,13 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, SfxFilterFlags nMust = getMustFlags( nStoreMode ); SfxFilterFlags nDont = getDontFlags( nStoreMode ); weld::Window* pFrameWin = SfxStoringHelper::GetModelWindow(m_xModel); - OUString sPreselectedDir; + OUString sPreselectedDir = GetDocProps().getUnpackedValueOrDefault( + "ExportDirectory", GetDocProps().getUnpackedValueOrDefault("DocumentBaseURL", OUString())); + INetURLObject aObj(sPreselectedDir); + aObj.removeSegment(); // remove file name from URL + sPreselectedDir = aObj.GetMainURL(INetURLObject::DecodeMechanism::NONE); if ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) { - const OUString aBaseUrl = GetDocProps().getUnpackedValueOrDefault("DocumentBaseURL", OUString()); - OUString aExportDir = GetDocProps().getUnpackedValueOrDefault("ExportDirectory", aBaseUrl); - INetURLObject aObj( aExportDir ); - aObj.removeSegment(); - aExportDir = aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); - if (!aExportDir.isEmpty()) - sPreselectedDir = aExportDir; if ( ( nStoreMode & PDFEXPORT_REQUESTED ) && !aPreselectedFilterPropsHM.empty() ) { // this is a PDF export commit 75ca8b28093cbd82ba191c43395cf5eaa6fd6124 Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Fri Apr 11 19:39:27 2025 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Mon Oct 27 01:18:27 2025 +0100 Remove "StandardDir" This was supposed to set some kind of "default directory" for file pickers. It was never implemented for anything except the "gen" vcl plugin - and is also not really needed. Change-Id: I94c6ff04984fc7b1d600530dc26bd8a7672646cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184064 Reviewed-by: Samuel Mehrbrodt <[email protected]> Tested-by: Jenkins diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index e348789037e9..4d08e1ba532f 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -160,12 +160,6 @@ void SvtFilePicker::prepareExecute() m_xDlg->SetHasFilename( true ); } } - else - { - // set the default standard dir - INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() ); - m_xDlg->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); - } // set the control values and set the control labels, too if ( m_pElemList && !m_pElemList->empty() ) @@ -436,14 +430,7 @@ std::shared_ptr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( weld::Windo PickerFlags nBits = getPickerFlags(); auto dialog = o3tl::make_shared<SvtFileDialog>(pParent, nBits); - - // Set StandardDir if present - if ( !m_aStandardDir.isEmpty()) - { - OUString sStandardDir = m_aStandardDir; - dialog->SetStandardDir( sStandardDir ); - dialog->SetDenyList( m_aDenyList ); - } + dialog->SetDenyList( m_aDenyList ); return dialog; } @@ -973,19 +960,7 @@ void SAL_CALL SvtFilePicker::initialize( const Sequence< Any >& _rArguments ) if (aArguments[i] >>= namedValue ) { - if ( namedValue.Name == "StandardDir" ) - { - OUString sStandardDir; - - namedValue.Value >>= sStandardDir; - - // Set the directory for the "back to the default dir" button - if ( !sStandardDir.isEmpty() ) - { - m_aStandardDir = sStandardDir; - } - } - else if ( namedValue.Name == "DenyList" ) + if ( namedValue.Name == "DenyList" ) { namedValue.Value >>= m_aDenyList; } @@ -1006,11 +981,6 @@ bool SvtFilePicker::implHandleInitializationArgument( const OUString& _rName, co OSL_VERIFY( _rValue >>= m_nServiceType ); return true; } - if ( _rName == "StandardDir" ) - { - OSL_VERIFY( _rValue >>= m_aStandardDir ); - return true; - } if ( _rName == "DenyList" ) { @@ -1063,14 +1033,7 @@ std::shared_ptr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog(weld:: PickerFlags nBits = getPickerFlags(); auto dialog = std::make_shared<RemoteFilesDialog>(pParent, nBits); - - // Set StandardDir if present - if ( !m_aStandardDir.isEmpty()) - { - OUString sStandardDir = m_aStandardDir; - dialog->SetStandardDir( sStandardDir ); - dialog->SetDenyList( m_aDenyList ); - } + dialog->SetDenyList( m_aDenyList ); return dialog; } diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx index b75a3f6368db..fb7a9d686e8b 100644 --- a/fpicker/source/office/OfficeFilePicker.hxx +++ b/fpicker/source/office/OfficeFilePicker.hxx @@ -71,7 +71,6 @@ protected: OUString m_aOldDisplayDirectory; OUString m_aOldHideDirectory; - OUString m_aStandardDir; css::uno::Sequence< OUString > m_aDenyList; diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 50c897f35b48..ba3a467641a6 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -933,16 +933,6 @@ const css::uno::Sequence< OUString >& RemoteFilesDialog::GetDenyList() const return m_aDenyList; } -void RemoteFilesDialog::SetStandardDir( const OUString& rStdDir ) -{ - m_sStdDir = rStdDir; -} - -const OUString& RemoteFilesDialog::GetStandardDir() const -{ - return m_sStdDir; -} - void RemoteFilesDialog::SetPath( const OUString& rNewURL ) { m_sPath = rNewURL; diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx index 8c4fa0a4cbb3..910c18e1634c 100644 --- a/fpicker/source/office/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -62,8 +62,6 @@ public: virtual void SetHasFilename( bool ) override; virtual void SetDenyList( const css::uno::Sequence< OUString >& rDenyList ) override; virtual const css::uno::Sequence< OUString >& GetDenyList() const override; - virtual void SetStandardDir( const OUString& rStdDir ) override; - virtual const OUString& GetStandardDir() const override; virtual void SetPath( const OUString& rNewURL ) override; virtual const OUString& GetPath() override; virtual std::vector<OUString> GetPathList() const override; diff --git a/fpicker/source/office/fpdialogbase.hxx b/fpicker/source/office/fpdialogbase.hxx index 60205695b719..7a9084bf5c56 100644 --- a/fpicker/source/office/fpdialogbase.hxx +++ b/fpicker/source/office/fpdialogbase.hxx @@ -71,8 +71,6 @@ public: virtual void SetHasFilename( bool bHasFilename ) = 0; virtual void SetDenyList( const css::uno::Sequence< OUString >& rDenyList ) = 0; virtual const css::uno::Sequence< OUString >& GetDenyList() const = 0; - virtual void SetStandardDir( const OUString& rStdDir ) = 0; - virtual const OUString& GetStandardDir() const = 0; virtual void SetPath( const OUString& rNewURL ) = 0; virtual const OUString& GetPath() = 0; virtual std::vector<OUString> GetPathList() const = 0; diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index d154cb928832..259e7d5a1c83 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -258,18 +258,6 @@ namespace aWorkPathObj.setFinalSlash(); return aWorkPathObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); } - - - /** retrieves the value of an environment variable - @return <TRUE/> if and only if the retrieved string value is not empty - */ - bool getEnvironmentValue( const char* _pAsciiEnvName, OUString& _rValue ) - { - _rValue.clear(); - OUString sEnvName = OUString::createFromAscii( _pAsciiEnvName ); - osl_getEnvironment( sEnvName.pData, &_rValue.pData ); - return !_rValue.isEmpty(); - } } // SvtFileDialog @@ -325,10 +313,6 @@ SvtFileDialog::SvtFileDialog(weld::Window* pParent, PickerFlags nStyle) if (nStyle & PickerFlags::PathDialog) m_xImpl->m_eDlgType = FILEDLG_TYPE_PATHDLG; - // Set the directory for the "back to the default dir" button - INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() ); - SetStandardDir( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); - // Create control element, the order defines the tab control. m_xImpl->m_xEdFileName->connect_changed( LINK( this, SvtFileDialog, EntrySelectHdl_Impl ) ); m_xImpl->m_xEdFileName->connect_entry_activate( LINK( this, SvtFileDialog, OpenUrlHdl_Impl ) ); @@ -1453,37 +1437,6 @@ bool SvtFileDialog::PrepareExecute() if (comphelper::LibreOfficeKit::isActive()) return false; - OUString aEnvValue; - if ( getEnvironmentValue( "WorkDirMustContainRemovableMedia", aEnvValue ) && aEnvValue == "1" ) - { - try - { - INetURLObject aStdDir( GetStandardDir() ); - ::ucbhelper::Content aCnt( aStdDir.GetMainURL( - INetURLObject::DecodeMechanism::NONE ), - Reference< XCommandEnvironment >(), - comphelper::getProcessComponentContext() ); - Sequence< OUString > aProps { u"IsVolume"_ustr, u"IsRemoveable"_ustr }; - - Reference< XResultSet > xResultSet - = aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_ONLY ); - if ( xResultSet.is() && !xResultSet->next() ) - { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(), - VclMessageType::Warning, VclButtonsType::Ok, - FpsResId(STR_SVT_NOREMOVABLEDEVICE))); - xBox->run(); - return false; - } - } - catch ( ContentCreationException const & ) - { - } - catch ( CommandAbortedException const & ) - { - } - } - if ( ( m_xImpl->m_nStyle & PickerFlags::SaveAs ) && m_bHasFilename ) // when doing a save-as, we do not want the handler to handle "this file does not exist" messages // - finally we're going to save that file, aren't we? @@ -1501,20 +1454,16 @@ bool SvtFileDialog::PrepareExecute() aFileNameOnly = m_aPath; m_aPath.clear(); } - // no starting path specified? if ( m_aPath.isEmpty() ) { // then use the standard directory - m_aPath = lcl_ensureFinalSlash( m_xImpl->GetStandardDir() ); - + m_aPath = lcl_ensureFinalSlash( SvtPathOptions().GetWorkPath() ); // attach given filename to path if ( !aFileNameOnly.isEmpty() ) m_aPath += aFileNameOnly; } - - - m_aPath = implGetInitialURL( m_aPath, GetStandardDir() ); + m_aPath = implGetInitialURL( m_aPath, SvtPathOptions().GetWorkPath() ); if ( m_xImpl->m_nStyle & PickerFlags::SaveAs && !m_bHasFilename ) // when doing a save-as, we do not want the handler to handle "this file does not exist" messages @@ -1648,18 +1597,6 @@ void SvtFileDialog::FilterSelect() } -/* [Description] - - This method sets the path for the default button. -*/ -void SvtFileDialog::SetStandardDir( const OUString& rStdDir ) -{ - INetURLObject aObj( rStdDir ); - SAL_WARN_IF( aObj.GetProtocol() == INetProtocol::NotValid, "fpicker.office", "Invalid protocol!" ); - aObj.setFinalSlash(); - m_xImpl->SetStandardDir( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); -} - void SvtFileDialog::SetDenyList( const css::uno::Sequence< OUString >& rDenyList ) { m_xImpl->SetDenyList( rDenyList ); @@ -1671,17 +1608,6 @@ const css::uno::Sequence< OUString >& SvtFileDialog::GetDenyList() const return m_xImpl->GetDenyList(); } - -/* [Description] - - This method returns the standard path. -*/ -const OUString& SvtFileDialog::GetStandardDir() const -{ - return m_xImpl->GetStandardDir(); -} - - void SvtFileDialog::PrevLevel_Impl() { m_xFileView->EndInplaceEditing(); @@ -2279,9 +2205,6 @@ void SvtFileDialog::appendDefaultExtension(OUString& rFileName, void SvtFileDialog::initDefaultPlaces( ) { - PlacePtr pRootPlace = std::make_shared<Place>( FpsResId(STR_DEFAULT_DIRECTORY), GetStandardDir() ); - m_xImpl->m_xPlaces->AppendPlace( pRootPlace ); - // Load from user settings Sequence< OUString > placesUrlsList(officecfg::Office::Common::Misc::FilePickerPlacesUrls::get()); Sequence< OUString > placesNamesList(officecfg::Office::Common::Misc::FilePickerPlacesNames::get()); diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index 9de9261af2d7..44ca03815aac 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -159,8 +159,6 @@ public: void SetDenyList( const css::uno::Sequence< OUString >& rDenyList ) override; const css::uno::Sequence< OUString >& GetDenyList() const override; - void SetStandardDir( const OUString& rStdDir ) override; - const OUString& GetStandardDir() const override; std::vector<OUString> GetPathList() const override; // for MultiSelection void AddFilter( const OUString& rFilter, diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index 71886c87a9e4..c6286284cc50 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -132,13 +132,6 @@ SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl() { } -void SvtExpFileDlg_Impl::SetStandardDir( const OUString& _rDir ) -{ - m_aStdDir = _rDir; - if (m_aStdDir.isEmpty()) - m_aStdDir = "file:///"; -} - namespace { OUString lcl_DecoratedFilter( std::u16string_view _rOriginalFilter ) { diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index 3a02dbbee641..5bc06ab5d055 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -157,8 +157,6 @@ public: void SetDenyList( const css::uno::Sequence< OUString >& rDenyList ) { m_aDenyList = rDenyList; } const css::uno::Sequence< OUString >& GetDenyList() const { return m_aDenyList; } - void SetStandardDir( const OUString& rDir ); - const OUString& GetStandardDir() const { return m_aStdDir; } // access to the filter listbox only as weld::Widget* - we want to maintain the entries/userdata ourself weld::Widget* GetFilterListControl() { return m_xLbFilter.get(); } diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx index d637a4194c2a..8301c1cc863c 100644 --- a/include/sfx2/filedlghelper.hxx +++ b/include/sfx2/filedlghelper.hxx @@ -164,7 +164,7 @@ public: sal_Int16 nDialog, SfxFilterFlags nMust, SfxFilterFlags nDont, - const OUString& rStandardDir, + const OUString& rPreselectedDir, const css::uno::Sequence< OUString >& rDenyList, weld::Window* pPreferredParent); @@ -172,7 +172,7 @@ public: FileDialogFlags nFlags, const OUString& aFilterUIName, std::u16string_view aExtName, - const OUString& rStandardDir, + const OUString& rPreselectedDir, const css::uno::Sequence< OUString >& rDenyList, weld::Window* pPreferredParent); @@ -299,7 +299,7 @@ ErrCode FileOpenDialog_Impl( weld::Window* pParent, std::optional<SfxAllItemSet>& rpSet, const OUString* pPath, sal_Int16 nDialog, - const OUString& rStandardDir, + const OUString& rPreselectedDir, const css::uno::Sequence< OUString >& rDenyList = css::uno::Sequence< OUString >()); css::uno::Reference<css::ui::dialogs::XFolderPicker2> SFX2_DLLPUBLIC createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>& rContext, weld::Window* pPreferredParent); diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 52ed9e996aa1..062687c49548 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -175,7 +175,6 @@ class SvxZoomItem; #define SID_REMOTE_DIALOG TypedWhichId<SfxBoolItem>(SID_SFX_START + 305) #define SID_PATH TypedWhichId<SfxStringItem>(SID_SFX_START + 308) #define SID_SAVEDOCS (SID_SFX_START + 309) -#define SID_STANDARD_DIR TypedWhichId<SfxStringItem>(SID_SFX_START + 450) #define SID_DENY_LIST TypedWhichId<SfxStringListItem>(SID_SFX_START + 451) // browse-ids diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx index 4740fec17143..0ba7a835f85f 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -164,20 +164,19 @@ void ScXMLSourceDlg::SelectSourceFile() FileDialogFlags::NONE, m_xDialog.get()); aDlgHelper.SetContext(sfx2::FileDialogHelper::CalcXMLSource); - uno::Reference<ui::dialogs::XFilePicker3> xFilePicker = aDlgHelper.GetFilePicker(); - // Use the directory of current source file. INetURLObject aURL(maSrcPath); aURL.removeSegment(); aURL.removeFinalSlash(); OUString aPath = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); - xFilePicker->setDisplayDirectory(aPath); - if (xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK) + if (!aPath.isEmpty()) + aDlgHelper.SetDisplayFolder(aPath); + if (aDlgHelper.Execute() != ERRCODE_NONE) // File picker dialog cancelled. return; - uno::Sequence<OUString> aFiles = xFilePicker->getSelectedFiles(); + uno::Sequence<OUString> aFiles = aDlgHelper.GetSelectedFiles(); if (!aFiles.hasElements()) return; diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 0564625ee8be..7f9ba8f86ba8 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -643,12 +643,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) nDialogType = ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE; } - OUString sStandardDir; - - const SfxStringItem* pStandardDirItem = rReq.GetArg<SfxStringItem>(SID_STANDARD_DIR); - if ( pStandardDirItem ) - sStandardDir = pStandardDirItem->GetValue(); - css::uno::Sequence< OUString > aDenyList; const SfxStringListItem* pDenyListItem = rReq.GetArg<SfxStringListItem>(SID_DENY_LIST); @@ -659,7 +653,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) ErrCode nErr = sfx2::FileOpenDialog_Impl(pTopWindow, nDialogType, eDialogFlags, aURLList, - aFilter, pSet, &aPath, nDialog, sStandardDir, aDenyList); + aFilter, pSet, &aPath, nDialog, "", aDenyList); if ( nErr == ERRCODE_ABORT ) { diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 8da9d9c81033..c1a38b26eab7 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -139,7 +139,6 @@ constexpr OUString sCopyStreamIfPossible = u"CopyStreamIfPossible"_ustr; constexpr OUString sNoAutoSave = u"NoAutoSave"_ustr; constexpr OUString sFolderName = u"FolderName"_ustr; constexpr OUString sUseSystemDialog = u"UseSystemDialog"_ustr; -constexpr OUString sStandardDir = u"StandardDir"_ustr; constexpr OUString sDenyList = u"DenyList"_ustr; constexpr OUString sModifyPasswordInfo = u"ModifyPasswordInfo"_ustr; constexpr OUString sSuggestedSaveAsDir = u"SuggestedSaveAsDir"_ustr; @@ -614,14 +613,6 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert if (bOK) rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) ); } - else if ( aName == sStandardDir ) - { - OUString sVal; - bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty()); - DBG_ASSERT( bOK, "invalid type or value for StandardDir" ); - if (bOK) - rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) ); - } else if ( aName == sDenyList ) { uno::Sequence<OUString> xVal; @@ -1003,8 +994,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b nAdditional++; if ( rSet.GetItemState( SID_FILE_DIALOG ) == SfxItemState::SET ) nAdditional++; - if ( rSet.GetItemState( SID_STANDARD_DIR ) == SfxItemState::SET ) - nAdditional++; if ( rSet.GetItemState( SID_DENY_LIST ) == SfxItemState::SET ) nAdditional++; if ( rSet.GetItemState( SID_CONTENT ) == SfxItemState::SET ) @@ -1217,8 +1206,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b continue; if ( nId == SID_FILE_DIALOG ) continue; - if ( nId == SID_STANDARD_DIR ) - continue; if ( nId == SID_DENY_LIST ) continue; if ( nId == SID_CONTENTTYPE ) @@ -1547,11 +1534,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b pValue[nActProp].Name = sUseSystemDialog; pValue[nActProp++].Value <<= pItem->GetValue(); } - if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_STANDARD_DIR, false) ) - { - pValue[nActProp].Name = sStandardDir; - pValue[nActProp++].Value <<= pItem->GetValue(); - } if ( const SfxStringListItem *pItem = rSet.GetItemIfSet( SID_DENY_LIST, false) ) { pValue[nActProp].Name = sDenyList; diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 7f041839286e..7d8fa5e990b2 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -885,10 +885,10 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( FileDialogFlags nFlags, sal_Int16 nDialog, weld::Window* pFrameWeld, - const OUString& sStandardDir, + const OUString& sPreselectedDir, const css::uno::Sequence< OUString >& rDenyList ) - :msStandardDir ( sStandardDir ) + :msPreselectedDir( sPreselectedDir ) ,maPreviewIdle("sfx2 FileDialogHelper_Impl maPreviewIdle") ,m_nDialogType ( nDialogType ) ,meContext ( FileDialogHelper::UnknownContext ) @@ -1072,7 +1072,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( auto xWindow = GetFrameInterface(); - Sequence < Any > aInitArguments(!xWindow.is() ? 3 : 4); + Sequence < Any > aInitArguments(!xWindow.is() ? 2 : 3); auto pInitArguments = aInitArguments.getArray(); // This is a hack. We currently know that the internal file picker implementation @@ -1094,18 +1094,13 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( ); pInitArguments[1] <<= NamedValue( - u"StandardDir"_ustr, - Any( sStandardDir ) - ); - - pInitArguments[2] <<= NamedValue( u"DenyList"_ustr, Any( rDenyList ) ); if (xWindow.is()) - pInitArguments[3] <<= NamedValue(u"ParentWindow"_ustr, Any(xWindow)); + pInitArguments[2] <<= NamedValue(u"ParentWindow"_ustr, Any(xWindow)); } try @@ -2145,7 +2140,7 @@ void FileDialogHelper_Impl::saveConfig() } // Store to config, if explicit context is set (and default directory is not given) - if (meContext != FileDialogHelper::UnknownContext && msStandardDir.isEmpty()) + if (meContext != FileDialogHelper::UnknownContext && msPreselectedDir.isEmpty()) { SaveLastDirectory(FileDialogHelper::contextToString(meContext), getPath()); } @@ -2156,10 +2151,10 @@ OUString FileDialogHelper_Impl::getInitPath(std::u16string_view _rFallback, { OUString sPath; // Load from config, if explicit context is set. Otherwise load from (global) runtime var. - if (meContext == FileDialogHelper::UnknownContext || !msStandardDir.isEmpty()) + if (meContext == FileDialogHelper::UnknownContext || !msPreselectedDir.isEmpty()) { // For export, the default directory is passed on - sPath = msStandardDir; + sPath = msPreselectedDir; } else { @@ -2404,11 +2399,11 @@ FileDialogHelper::FileDialogHelper( sal_Int16 nDialog, SfxFilterFlags nMust, SfxFilterFlags nDont, - const OUString& rStandardDir, + const OUString& rPreselectedDir, const css::uno::Sequence< OUString >& rDenyList, weld::Window* pPreferredParent) : m_nError(0), - mpImpl( new FileDialogHelper_Impl( this, nDialogType, nFlags, nDialog, pPreferredParent, rStandardDir, rDenyList ) ) + mpImpl( new FileDialogHelper_Impl( this, nDialogType, nFlags, nDialog, pPreferredParent, rPreselectedDir, rDenyList ) ) { // create the list of filters mpImpl->addFilters( @@ -2426,11 +2421,11 @@ FileDialogHelper::FileDialogHelper( FileDialogFlags nFlags, const OUString& aFilterUIName, std::u16string_view aExtName, - const OUString& rStandardDir, + const OUString& rPreselectedDir, const css::uno::Sequence< OUString >& rDenyList, weld::Window* pPreferredParent ) : m_nError(0), - mpImpl( new FileDialogHelper_Impl( this, nDialogType, nFlags, SFX2_IMPL_DIALOG_CONFIG, pPreferredParent, rStandardDir, rDenyList ) ) + mpImpl( new FileDialogHelper_Impl( this, nDialogType, nFlags, SFX2_IMPL_DIALOG_CONFIG, pPreferredParent, rPreselectedDir, rDenyList ) ) { // the wildcard here is expected in form "*.extension" OUString aWildcard; @@ -2864,7 +2859,7 @@ ErrCode FileOpenDialog_Impl( weld::Window* pParent, std::optional<SfxAllItemSet>& rpSet, const OUString* pPath, sal_Int16 nDialog, - const OUString& rStandardDir, + const OUString& rPreselectedDir, const css::uno::Sequence< OUString >& rDenyList ) { ErrCode nRet; @@ -2873,9 +2868,9 @@ ErrCode FileOpenDialog_Impl( weld::Window* pParent, // read-only to discourage editing (which would invalidate existing // signatures). if (nFlags & FileDialogFlags::SignPDF) - pDialog.reset(new FileDialogHelper(nDialogType, nFlags, SfxResId(STR_SFX_FILTERNAME_PDF), u"pdf", rStandardDir, rDenyList, pParent)); + pDialog.reset(new FileDialogHelper(nDialogType, nFlags, SfxResId(STR_SFX_FILTERNAME_PDF), u"pdf", rPreselectedDir, rDenyList, pParent)); else - pDialog.reset(new FileDialogHelper(nDialogType, nFlags, OUString(), nDialog, SfxFilterFlags::NONE, SfxFilterFlags::NONE, rStandardDir, rDenyList, pParent)); + pDialog.reset(new FileDialogHelper(nDialogType, nFlags, OUString(), nDialog, SfxFilterFlags::NONE, SfxFilterFlags::NONE, rPreselectedDir, rDenyList, pParent)); OUString aPath; if ( pPath ) diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index ae737c5850f1..cd910b17edae 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -61,7 +61,7 @@ namespace sfx2 OUString maCurFilter; OUString maSelectFilter; OUString maButtonLabel; - OUString msStandardDir; + OUString msPreselectedDir; Idle maPreviewIdle; Graphic maGraphic; @@ -175,7 +175,7 @@ namespace sfx2 FileDialogFlags nFlags, sal_Int16 nDialog, weld::Window* pFrameWeld, - const OUString& sStandardDir = OUString(), + const OUString& sPreselectedDir = OUString(), const css::uno::Sequence< OUString >& rDenyList = css::uno::Sequence< OUString >() ); virtual ~FileDialogHelper_Impl() override; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 6b4fdd77f000..ec36d7699500 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -327,7 +327,6 @@ public: bool bPreselectPassword, OUString& aSuggestedDir, sal_Int16 nDialog, - OUString& rStandardDir, const css::uno::Sequence< OUString >& rDenyList ); @@ -879,7 +878,6 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, bool bPreselectPassword, OUString& aSuggestedDir, sal_Int16 nDialog, - OUString& rStandardDir, const css::uno::Sequence< OUString >& rDenyList) { if ( nStoreMode == SAVEASREMOTE_REQUESTED ) @@ -938,6 +936,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, SfxFilterFlags nMust = getMustFlags( nStoreMode ); SfxFilterFlags nDont = getDontFlags( nStoreMode ); weld::Window* pFrameWin = SfxStoringHelper::GetModelWindow(m_xModel); + OUString sPreselectedDir; if ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) { const OUString aBaseUrl = GetDocProps().getUnpackedValueOrDefault("DocumentBaseURL", OUString()); @@ -946,26 +945,26 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, aObj.removeSegment(); aExportDir = aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); if (!aExportDir.isEmpty()) - rStandardDir = aExportDir; + sPreselectedDir = aExportDir; if ( ( nStoreMode & PDFEXPORT_REQUESTED ) && !aPreselectedFilterPropsHM.empty() ) { // this is a PDF export // the filter options has been shown already const OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( u"UIName"_ustr, OUString() ); - pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aFilterUIName, u"pdf", rStandardDir, rDenyList, pFrameWin )); + pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aFilterUIName, u"pdf", sPreselectedDir, rDenyList, pFrameWin )); pFileDlg->SetCurrentFilter( aFilterUIName ); } else if ((nStoreMode & EPUBEXPORT_REQUESTED) && !aPreselectedFilterPropsHM.empty()) { // This is an EPUB export, the filter options has been shown already. const OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( u"UIName"_ustr, OUString() ); - pFileDlg.reset(new sfx2::FileDialogHelper(aDialogMode, aDialogFlags, aFilterUIName, u"epub", rStandardDir, rDenyList, pFrameWin)); + pFileDlg.reset(new sfx2::FileDialogHelper(aDialogMode, aDialogFlags, aFilterUIName, u"epub", sPreselectedDir, rDenyList, pFrameWin)); pFileDlg->SetCurrentFilter(aFilterUIName); } else { // This is the normal dialog - pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rDenyList, pFrameWin )); + pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, sPreselectedDir, rDenyList, pFrameWin )); } sfx2::FileDialogHelper::Context eCtxt = sfx2::FileDialogHelper::UnknownContext; @@ -995,7 +994,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, { // This is the normal save as dialog pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, - nMust, nDont, rStandardDir, rDenyList, pFrameWin )); + nMust, nDont, sPreselectedDir, rDenyList, pFrameWin )); pFileDlg->CreateMatcher( aDocServiceName ); sfx2::FileDialogHelper::Context eCtxt = sfx2::FileDialogHelper::UnknownContext; @@ -1683,12 +1682,6 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons if ( aSuggestedName.isEmpty() ) aSuggestedName = aModelData.GetDocProps().getUnpackedValueOrDefault(u"SuggestedSaveAsName"_ustr, OUString() ); - OUString sStandardDir; - ::comphelper::SequenceAsHashMap::const_iterator aStdDirIter = - aModelData.GetMediaDescr().find( u"StandardDir"_ustr ); - if ( aStdDirIter != aModelData.GetMediaDescr().end() ) - aStdDirIter->second >>= sStandardDir; - css::uno::Sequence< OUString > aDenyList; ::comphelper::SequenceAsHashMap::const_iterator aDenyListIter = @@ -1699,7 +1692,7 @@ bool SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons for (;;) { // in case the dialog is opened a second time the folder should be the same as previously navigated to by the user, not what was handed over by initial parameters - bUseFilterOptions = aModelData.OutputFileDialog( nStoreMode, aFilterProps, bSetStandardName, aSuggestedName, bPreselectPassword, aSuggestedDir, nDialog, sStandardDir, aDenyList ); + bUseFilterOptions = aModelData.OutputFileDialog( nStoreMode, aFilterProps, bSetStandardName, aSuggestedName, bPreselectPassword, aSuggestedDir, nDialog, aDenyList ); if ( nStoreMode == SAVEAS_REQUESTED ) { // in case of saving check filter for possible alien warning diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 18e268ff1462..ca61b1927b7b 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2924,7 +2924,6 @@ bool SfxObjectShell::CommonSaveAs_Impl(const INetURLObject& aURL, const OUString SfxItemSet& rSet = GetMedium()->GetItemSet(); rSet.ClearItem( SID_INTERACTIONHANDLER ); rSet.ClearItem( SID_PROGRESS_STATUSBAR_CONTROL ); - rSet.ClearItem( SID_STANDARD_DIR ); rSet.ClearItem( SID_PATH ); if ( !bSaveTo )
