diff options
author | Eike Rathke <erack@redhat.com> | 2016-05-25 22:41:19 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-05-25 23:00:49 +0200 |
commit | d9e7a54809c88c4ac166630c11038188c8f50a6f (patch) | |
tree | ded94ed1df9bdeffa36ee3134080933f194d6517 /sc/source | |
parent | 0b37b431329cfe32ad6a824ff9e99dd5d015456a (diff) |
tdf#86282 switch to base name sheet name again for external references CSV
... now that we can handle both, a base name and Sheet1 name.
For the following reasons:
* Since 4.3 we write and expect the base name as sheet name for CSV.
While 43030487c45f49bccdfad987c60d9483b938ebac switched that back to
Sheet1 or its equivalent to be able to load older documents, a mixed
environment of earlier and later versions gets confused by this.
* The name Sheet1 can be localized and even customized by the user and
thus fails to update/refresh in a different localized or customized
environment. This also was already the case for all versions prior to
4.3 but apparently wasn't recognized or brought in connection with
some possible failures when updating externally referenced CSV files.
* Deriving the sheet name to be stored from the base name prevents all
problems related to localized or customized environments, and keeps
interoperability with all versions from 4.3 on.
Change-Id: I8d71b3ad6370747115ea419a21094b649326642c
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 6559d9f9d836..163024e2d1b5 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1199,15 +1199,19 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) aDocument.StartAllListeners(); sc::SetFormulaDirtyContext aCxt; aDocument.SetAllFormulasDirty(aCxt); - if (GetCreateMode() != SfxObjectCreateMode::INTERNAL) - { - // ScDocShell was not created with - // SfxModelFlags::EXTERNAL_LINK for which we do not - // want Sheet1 renamed in order to get predictable - // sheet names for external references. - INetURLObject aURLObjForDefaultNameSheetName(rMedium.GetName()); - aDocument.RenameTab(0,aURLObjForDefaultNameSheetName.GetBase()); - } + + // The same resulting name has to be handled in + // ScExternalRefCache::initializeDoc() and related, hence + // pass 'true' for RenameTab()'s bExternalDocument for a + // composed name so ValidTabName() will not be checked, + // which could veto the rename in case it contained + // characters that Excel does not handle. If we wanted to + // change that then it needed to be handled in all + // corresponding places of the external references + // manager/cache. Likely then we'd also need a method to + // compose a name excluding such characters. + aDocument.RenameTab( 0, INetURLObject( rMedium.GetName()).GetBase(), true, true); + bOverflowRow = aImpEx.IsOverflowRow(); bOverflowCol = aImpEx.IsOverflowCol(); bOverflowCell = aImpEx.IsOverflowCell(); |