[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Wed May 25 21:01:12 UTC 2016
sc/source/ui/docshell/docsh.cxx | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
New commits:
commit d9e7a54809c88c4ac166630c11038188c8f50a6f
Author: Eike Rathke <erack at redhat.com>
Date: Wed May 25 22:41:19 2016 +0200
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
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 6559d9f..163024e 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();
More information about the Libreoffice-commits
mailing list