tdf#165392 Save as should default to current document directory as well
As done in 3fa39a4dad
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 <samuel.mehrbrodt@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
@@ -449,7 +449,7 @@ service MediaDescriptor
|
|||||||
*/
|
*/
|
||||||
[optional,property] string SuggestedSaveAsName;
|
[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.
|
Defaults to the current document directory.
|
||||||
*/
|
*/
|
||||||
[optional,property] string ExportDirectory;
|
[optional,property] string ExportDirectory;
|
||||||
|
@@ -954,16 +954,13 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode,
|
|||||||
SfxFilterFlags nMust = getMustFlags( nStoreMode );
|
SfxFilterFlags nMust = getMustFlags( nStoreMode );
|
||||||
SfxFilterFlags nDont = getDontFlags( nStoreMode );
|
SfxFilterFlags nDont = getDontFlags( nStoreMode );
|
||||||
weld::Window* pFrameWin = SfxStoringHelper::GetModelWindow(m_xModel);
|
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 ) )
|
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() )
|
if ( ( nStoreMode & PDFEXPORT_REQUESTED ) && !aPreselectedFilterPropsHM.empty() )
|
||||||
{
|
{
|
||||||
// this is a PDF export
|
// this is a PDF export
|
||||||
|
Reference in New Issue
Block a user