summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2022-04-05 15:02:27 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-04-26 08:33:16 +0200
commit4529690cf65f621554f3c829c04b579bd11989c9 (patch)
tree4891d72aebb9b7021288bc016802b8b4f50f8593 /writerfilter
parent7f5d7a3cbe4a71a44a273c9599df1a5094b2fc5a (diff)
tdf#132475 sw ms: import/export DI_CHANGE as field
and (only) the AUTHOR portion as FIXED for DOC/DOCX/RTF. The SAVEDATE import was failing as a field because of exception writerfilter/source/dmapper/DomainMapper_Impl.cxx:6950: Exception in CloseFieldCommand() com.sun.star.lang.ServiceNotRegisteredException message: "unknown service: com.sun.star.text.TextField.DocInfo.Change at /persistent/git/libreoffice2/svx/source/unodraw/unomod.cxx:191" In terms of marking the field FIXED: MS Word doesn't update the save date while the document is being edited (although a user could force an update via F9) but it does update the field at FILEOPEN! So, since it updates the date on FILEOPEN, it makes perfect sense to treat this as a normal SAVEDATE field in LO - not fixed at all. At opening time, it will ignore the last-displayed-text and load the values from the field just like Word. The difference will be that it updates the field immediately after a while-editing-save, but that's fine, because when Word opens the same file, that is what it will see. However, curiously enough, MS Word does NOT update the LASTSAVEBY user, and thus the modified author can be set as FIXED, with the normal caveat that a LO user won't be able to update the field (except by deleting and re-creating it). Change-Id: I5640432708cf3eebb6a60eaa500fdf0b8f3a6e1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133209 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index d8327fa8d248..5422d261d992 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5192,7 +5192,7 @@ static const FieldConversionMap_t & lcl_GetFieldConversion()
{"PRINTDATE", {"DocInfo.PrintDateTime", FIELD_PRINTDATE }},
{"REF", {"GetReference", FIELD_REF }},
{"REVNUM", {"DocInfo.Revision", FIELD_REVNUM }},
- {"SAVEDATE", {"DocInfo.Change", FIELD_SAVEDATE }},
+ {"SAVEDATE", {"DocInfo.ChangeDateTime", FIELD_SAVEDATE }},
// {"SECTION", {"", FIELD_SECTION }},
// {"SECTIONPAGES", {"", FIELD_SECTIONPAGES }},
{"SEQ", {"SetExpression", FIELD_SEQ }},
@@ -6393,6 +6393,7 @@ void DomainMapper_Impl::CloseFieldCommand()
break;
case FIELD_CREATEDATE :
case FIELD_PRINTDATE:
+ case FIELD_SAVEDATE:
{
xFieldProperties->setPropertyValue(
getPropertyName( PROP_IS_DATE ), uno::makeAny( true ));
@@ -6621,7 +6622,10 @@ void DomainMapper_Impl::CloseFieldCommand()
}
}
break;
- case FIELD_LASTSAVEDBY : break;
+ case FIELD_LASTSAVEDBY :
+ xFieldProperties->setPropertyValue(
+ getPropertyName(PROP_IS_FIXED), uno::makeAny(true));
+ break;
case FIELD_MACROBUTTON:
{
//extract macro name
@@ -6727,9 +6731,6 @@ void DomainMapper_Impl::CloseFieldCommand()
}
break;
case FIELD_REVNUM : break;
- case FIELD_SAVEDATE :
- SetNumberFormat( pContext->GetCommand(), xFieldProperties );
- break;
case FIELD_SECTION : break;
case FIELD_SECTIONPAGES : break;
case FIELD_SEQ :