tdf#144175: Remove strings from l10n in html export

+ convert datetime to ISO format

Result:
        <!-- Doc.Information -->
        <!-- Printed: by Firstname Lastname on 2026-10-01T21:31:34,817333179 -->

For the change of lcl_AddStamp, I used GPT 5.6 Luna.

Change-Id: Ia73e9c00f17653aa5ab491c4bbc1d3d933105836
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211696
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
This commit is contained in:
Julien Nabet
2026-10-02 10:21:17 +02:00
parent 4f3909125e
commit 2bcd6f7063
2 changed files with 11 additions and 33 deletions
-4
View File
@@ -373,10 +373,6 @@
#define STR_LINKERRORFILE NC_("STR_LINKERRORFILE", "File:")
#define STR_LINKERRORTAB NC_("STR_LINKERRORTAB", "Sheet:")
#define STR_OVERVIEW NC_("STR_OVERVIEW", "Overview")
#define STR_DOC_INFO NC_("STR_DOC_INFO", "Doc.Information")
#define STR_DOC_PRINTED NC_("STR_DOC_PRINTED", "Printed")
#define STR_BY NC_("STR_BY", "by")
#define STR_ON NC_("STR_ON", "on")
#define STR_TRUST_DOCUMENT_WARNING NC_("STR_TRUST_DOCUMENT_WARNING", "Are you sure you trust this document?")
#define STR_WEBSERVICE_WITH_LINKS_WARNING NC_("STR_WEBSERVICE_WITH_LINKS_WARNING", "Links to remote locations can be constructed that transmit local data to the remote server.")
#define STR_REIMPORT_AFTER_LOAD NC_("STR_REIMPORT_AFTER_LOAD", "This file contains queries. The results of these queries were not saved.\nDo you want these queries to be repeated?")
+11 -29
View File
@@ -47,6 +47,7 @@
#include <svtools/htmlout.hxx>
#include <svtools/parhtml.hxx>
#include <tools/stream.hxx>
#include <unotools/datetime.hxx>
#include <vcl/outdev.hxx>
#include <stdio.h>
#include <osl/diagnose.h>
@@ -134,8 +135,6 @@ const char ScHTMLExport::sIndentSource[nIndentMax+1] =
#define OUT_SP_CSTR_ASS( s ) rStrm.WriteChar(' ').WriteOString( s ).WriteChar( '=' )
#define GLOBSTR(id) ScResId( id )
void ScFormatFilterPluginImpl::ScExportHTML( SvStream& rStrm, const OUString& rBaseURL, ScDocument* pDoc,
const ScRange& rRange, const rtl_TextEncoding /*eNach*/, bool bAll,
const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions )
@@ -163,33 +162,17 @@ static OString lcl_getColGroupString(sal_Int32 nSpan, sal_Int32 nWidth)
return aByteStr.makeStringAndClear();
}
static void lcl_AddStamp( OUString& rStr, std::u16string_view rName,
const css::util::DateTime& rDateTime,
const LocaleDataWrapper& rLoc )
static void lcl_AddStamp(OUString& rStr, std::u16string_view rName,
const css::util::DateTime& rDateTime)
{
Date aD(rDateTime.Day, rDateTime.Month, rDateTime.Year);
tools::Time aT(rDateTime.Hours, rDateTime.Minutes, rDateTime.Seconds,
rDateTime.NanoSeconds);
DateTime aDateTime(aD,aT);
OUString aStrDate = rLoc.getDate( aDateTime );
OUString aStrTime = rLoc.getTime( aDateTime );
rStr += GLOBSTR( STR_BY ) + " ";
rStr += u"by "_ustr;
if (!rName.empty())
rStr += rName;
else
rStr += "???";
rStr += " " + GLOBSTR( STR_ON ) + " ";
if (!aStrDate.isEmpty())
rStr += aStrDate;
else
rStr += "???";
rStr += ", ";
if (!aStrTime.isEmpty())
rStr += aStrTime;
else
rStr += "???";
rStr += u"???"_ustr;
rStr += u" on "_ustr;
rStr += utl::toISO8601(rDateTime);
}
static OString lcl_makeHTMLColorTriplet(const Color& rColor)
@@ -336,10 +319,9 @@ void ScHTMLExport::WriteHeader()
if (!xDocProps->getPrintedBy().isEmpty())
{
OUT_COMMENT( GLOBSTR( STR_DOC_INFO ) );
OUString aStrOut = GLOBSTR( STR_DOC_PRINTED ) + ": ";
lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(),
xDocProps->getPrintDate(), ScGlobal::getLocaleData() );
OUT_COMMENT( u"Doc.Information" );
OUString aStrOut = u"Printed: "_ustr;
lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(), xDocProps->getPrintDate() );
OUT_COMMENT( aStrOut );
}