summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/pdfwriter_impl.cxx
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-05-18 18:10:09 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-05-18 23:08:21 +0200
commite39ea45caa3712ae2ff077203ef8aef0e16fe41a (patch)
tree400f253175a6cfc72fad3d890ce494b15b6bc4be /vcl/source/gdi/pdfwriter_impl.cxx
parent955fd1c534c061b3b6992dfe034b62b46ee2e844 (diff)
tdf#105972: pdf form: export date fields as date type
using AFDate_FormatEx which allows to set a custom format Change-Id: I38839965423794a0278b783c39c612c361a90eea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134543 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'vcl/source/gdi/pdfwriter_impl.cxx')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 7d5264af56ad..54f5a0416561 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -4435,6 +4435,19 @@ bool PDFWriterImpl::emitWidgetAnnotations()
aLine.append("/S/JavaScript>>\n");
aLine.append(">>\n");
}
+ else if ( rWidget.m_nFormat == PDFWriter::Date )
+ {
+ aLine.append("/AA<<\n");
+ aLine.append("/F<</JS(AFDate_FormatEx\\(\"");
+ aLine.append(OUStringToOString(rWidget.m_aDateFormat, RTL_TEXTENCODING_ASCII_US));
+ aLine.append("\"\\);)");
+ aLine.append("/S/JavaScript>>\n");
+ aLine.append("/K<</JS(AFDate_KeystrokeEx\\(\"");
+ aLine.append(OUStringToOString(rWidget.m_aDateFormat, RTL_TEXTENCODING_ASCII_US));
+ aLine.append("\"\\);)");
+ aLine.append("/S/JavaScript>>\n");
+ aLine.append(">>\n");
+ }
}
if( rWidget.m_eType == PDFWriter::PushButton )
{
@@ -11029,6 +11042,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa
rNewWidget.m_nDecimalAccuracy = rEdit.DecimalAccuracy;
rNewWidget.m_bPrependCurrencySymbol = rEdit.PrependCurrencySymbol;
rNewWidget.m_aTimeFormat = rEdit.TimeFormat;
+ rNewWidget.m_aDateFormat = rEdit.DateFormat;
rNewWidget.m_aValue = rEdit.Text;
createDefaultEditAppearance( rNewWidget, rEdit );