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 <samuel.mehrbrodt@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Samuel Mehrbrodt 2025-04-11 19:39:27 +02:00
parent 878e48d92d
commit 7bc7ff06d7
18 changed files with 36 additions and 215 deletions

View File

@ -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() )
@ -440,14 +434,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;
}
@ -952,19 +939,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;
}
@ -985,11 +960,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" )
{
@ -1042,14 +1012,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;
}

View File

@ -70,7 +70,6 @@ protected:
OUString m_aOldDisplayDirectory;
OUString m_aOldHideDirectory;
OUString m_aStandardDir;
css::uno::Sequence< OUString >
m_aDenyList;

View File

@ -931,16 +931,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;

View File

@ -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;

View File

@ -69,8 +69,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;

View File

@ -259,18 +259,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
@ -327,10 +315,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 ) );
@ -1472,37 +1456,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() )
{
static constexpr ErrMsgCode ids[]
= { { STR_SVT_NOREMOVABLEDEVICE, ERRCODE_IO_INVALIDDEVICE }, { {}, {} } };
SfxErrorHandler handler(ids, ErrCodeArea::Io, ErrCodeArea::Io, FpsResLocale());
ErrorHandler::HandleError(ERRCODE_IO_INVALIDDEVICE, m_xDialog.get());
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?
@ -1520,20 +1473,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
@ -1668,18 +1617,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 );
@ -1691,17 +1628,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();
@ -2303,9 +2229,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());

View File

@ -158,8 +158,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,

View File

@ -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 )
{

View File

@ -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(); }

View File

@ -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);
@ -301,7 +301,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,
std::optional<bool>& rShowFilterDialog );

View File

@ -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

View File

@ -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;

View File

@ -644,12 +644,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);
@ -661,7 +655,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
ErrCode nErr = sfx2::FileOpenDialog_Impl(pTopWindow,
nDialogType,
eDialogFlags, aURLList,
aFilter, pSet, &aPath, nDialog, sStandardDir, aDenyList, bShowFilterDialog);
aFilter, pSet, &aPath, nDialog, "", aDenyList, bShowFilterDialog);
if ( nErr == ERRCODE_ABORT )
{

View File

@ -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;

View File

@ -923,10 +923,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 )
@ -1124,7 +1124,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
@ -1146,18 +1146,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
@ -2224,7 +2219,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());
}
@ -2235,10 +2230,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
{
@ -2483,11 +2478,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(
@ -2505,11 +2500,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;
@ -2947,7 +2942,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,
std::optional<bool>& rShowFilterDialog )
{
@ -2957,9 +2952,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 )

View File

@ -62,7 +62,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;

View File

@ -339,7 +339,6 @@ public:
bool bPreselectPassword,
OUString& aSuggestedDir,
sal_Int16 nDialog,
OUString& rStandardDir,
const css::uno::Sequence<OUString>& rDenyList,
SignatureState const nScriptingSignatureState
);
@ -896,7 +895,6 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode,
bool bPreselectPassword,
OUString& aSuggestedDir,
sal_Int16 nDialog,
OUString& rStandardDir,
const css::uno::Sequence<OUString>& rDenyList,
SignatureState const nScriptingSignatureState)
{
@ -956,6 +954,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());
@ -964,26 +963,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;
@ -1013,7 +1012,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;
@ -1709,12 +1708,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 =
@ -1725,7 +1718,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, nScriptingSignatureState);
bUseFilterOptions = aModelData.OutputFileDialog( nStoreMode, aFilterProps, bSetStandardName, aSuggestedName, bPreselectPassword, aSuggestedDir, nDialog, aDenyList, nScriptingSignatureState );
if ( nStoreMode == SAVEAS_REQUESTED )
{
// in case of saving check filter for possible alien warning

View File

@ -3219,7 +3219,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 )