Kaydet (Commit) 6a58859b authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: rhbz#1673198 cannot overwrite open file with export

this reverts

commit 3c4cfa20
Date:   Mon Nov 26 12:51:05 2007 +0000

    INTEGRATION: CWS fwk72 (1.195.14); FILE MERGED
    2007/09/10 14:55:01 mav 1.195.14.1: #i81437# do not allow to export to the file the document is based on

Change-Id: I8bf1524a8cc2d6d1911bdd228f33f1b7723e1d6e
Reviewed-on: https://gerrit.libreoffice.org/67491
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst d2c71361
...@@ -1166,15 +1166,6 @@ bool SfxObjectShell::SaveTo_Impl ...@@ -1166,15 +1166,6 @@ bool SfxObjectShell::SaveTo_Impl
} }
} }
bool bCopyTo = false;
SfxItemSet *pMedSet = rMedium.GetItemSet();
if( pMedSet )
{
const SfxBoolItem* pSaveToItem = SfxItemSet::GetItem<SfxBoolItem>(pMedSet, SID_SAVETO, false);
bCopyTo = GetCreateMode() == SfxObjectCreateMode::EMBEDDED ||
(pSaveToItem && pSaveToItem->GetValue());
}
// use UCB for case sensitive/insensitive file name comparison // use UCB for case sensitive/insensitive file name comparison
if ( !pMedium->GetName().equalsIgnoreAsciiCase("private:stream") if ( !pMedium->GetName().equalsIgnoreAsciiCase("private:stream")
&& !rMedium.GetName().equalsIgnoreAsciiCase("private:stream") && !rMedium.GetName().equalsIgnoreAsciiCase("private:stream")
...@@ -1185,13 +1176,6 @@ bool SfxObjectShell::SaveTo_Impl ...@@ -1185,13 +1176,6 @@ bool SfxObjectShell::SaveTo_Impl
if ( pMedium->DocNeedsFileDateCheck() ) if ( pMedium->DocNeedsFileDateCheck() )
rMedium.CheckFileDate( pMedium->GetInitFileDate( false ) ); rMedium.CheckFileDate( pMedium->GetInitFileDate( false ) );
if ( bCopyTo && GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
{
// export to the same location is forbidden
SetError(ERRCODE_IO_CANTWRITE);
}
else
{
// before we overwrite the original file, we will make a backup if there is a demand for that // before we overwrite the original file, we will make a backup if there is a demand for that
// if the backup is not created here it will be created internally and will be removed in case of successful saving // if the backup is not created here it will be created internally and will be removed in case of successful saving
const bool bDoBackup = SvtSaveOptions().IsBackup(); const bool bDoBackup = SvtSaveOptions().IsBackup();
...@@ -1280,7 +1264,6 @@ bool SfxObjectShell::SaveTo_Impl ...@@ -1280,7 +1264,6 @@ bool SfxObjectShell::SaveTo_Impl
} }
} }
} }
}
else else
{ {
// This is SaveAs or export action, prepare the target medium // This is SaveAs or export action, prepare the target medium
...@@ -1347,6 +1330,15 @@ bool SfxObjectShell::SaveTo_Impl ...@@ -1347,6 +1330,15 @@ bool SfxObjectShell::SaveTo_Impl
// lock user interface while saving the document // lock user interface while saving the document
LockUIGuard aLockUIGuard(this); LockUIGuard aLockUIGuard(this);
bool bCopyTo = false;
SfxItemSet *pMedSet = rMedium.GetItemSet();
if( pMedSet )
{
const SfxBoolItem* pSaveToItem = SfxItemSet::GetItem<SfxBoolItem>(pMedSet, SID_SAVETO, false);
bCopyTo = GetCreateMode() == SfxObjectCreateMode::EMBEDDED ||
(pSaveToItem && pSaveToItem->GetValue());
}
bool bOk = false; bool bOk = false;
// TODO/LATER: get rid of bOk // TODO/LATER: get rid of bOk
if (bOwnTarget && pFilter && !(pFilter->GetFilterFlags() & SfxFilterFlags::STARONEFILTER)) if (bOwnTarget && pFilter && !(pFilter->GetFilterFlags() & SfxFilterFlags::STARONEFILTER))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment