summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/pdfwriter.hxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx12
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx78
3 files changed, 55 insertions, 37 deletions
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 12f4a8e1e805..f635a924507b 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -32,6 +32,7 @@
#include <vcl/graph.hxx>
#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/DateTime.hpp>
#include <memory>
#include <vector>
@@ -64,6 +65,7 @@ struct PDFNote
{
OUString Title; // optional title for the popup containing the note
OUString Contents; // contents of the note
+ css::util::DateTime maModificationDate;
};
class VCL_DLLPUBLIC PDFOutputStream
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index fba4d8f68e6f..c72ef5725b89 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1556,24 +1556,18 @@ static void ImplPDFExportComments( const uno::Reference< drawing::XDrawPage >& x
uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW );
uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
- LanguageType eLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
while( xAnnotationEnumeration->hasMoreElements() )
{
uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
- util::DateTime aDateTime( xAnnotation->getDateTime() );
-
- Date aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
- ::tools::Time aTime( ::tools::Time::EMPTY );
- OUString aStr = SvxDateTimeField::GetFormatted( aDate, aTime,
- SvxDateFormat::B, SvxTimeFormat::AppDefault,
- *(SD_MOD()->GetNumberFormatter()), eLanguage );
vcl::PDFNote aNote;
- aNote.Title = xAnnotation->getAuthor() + ", " + aStr;
+ aNote.Title = xAnnotation->getAuthor();
aNote.Contents = xText->getString();
+ aNote.maModificationDate = xAnnotation->getDateTime();
+
rPDFExtOutDevData.CreateNote( ::tools::Rectangle( Point( static_cast< long >( aRealPoint2D.X * 100 ),
static_cast< long >( aRealPoint2D.Y * 100 ) ), Size( 1000, 1000 ) ), aNote );
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index c7e56544f58a..c7c6b5cccfbc 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -561,6 +561,49 @@ void PDFWriterImpl::appendNonStrokingColor( const Color& rColor, OStringBuffer&
}
}
+namespace
+{
+
+void appendPdfTimeDate(OStringBuffer & rBuffer,
+ sal_Int16 year, sal_uInt16 month, sal_uInt16 day, sal_uInt16 hours, sal_uInt16 minutes, sal_uInt16 seconds, sal_uInt32 tzDelta)
+{
+ rBuffer.append("D:");
+ rBuffer.append(char('0' + ((year / 1000) % 10)));
+ rBuffer.append(char('0' + ((year / 100) % 10)));
+ rBuffer.append(char('0' + ((year / 10) % 10)));
+ rBuffer.append(char('0' + (year % 10)));
+ rBuffer.append(char('0' + ((month / 10) % 10)));
+ rBuffer.append(char('0' + (month % 10)));
+ rBuffer.append(char('0' + ((day / 10) % 10)));
+ rBuffer.append(char('0' + (day % 10)));
+ rBuffer.append(char('0' + ((hours / 10) % 10)));
+ rBuffer.append(char('0' + (hours % 10)));
+ rBuffer.append(char('0' + ((minutes / 10) % 10)));
+ rBuffer.append(char('0' + (minutes % 10)));
+ rBuffer.append(char('0' + ((seconds / 10) % 10)));
+ rBuffer.append(char('0' + (seconds % 10)));
+
+ if (tzDelta == 0)
+ {
+ rBuffer.append("Z");
+ }
+ else
+ {
+ if (tzDelta > 0 )
+ rBuffer.append("+");
+ else
+ rBuffer.append("-");
+
+ rBuffer.append(char('0' + ((tzDelta / 36000) % 10)));
+ rBuffer.append(char('0' + ((tzDelta / 3600) % 10)));
+ rBuffer.append("'");
+ rBuffer.append(char('0' + ((tzDelta / 600) % 6)));
+ rBuffer.append(char('0' + ((tzDelta / 60) % 10)));
+ }
+}
+
+} // end namespace
+
PDFPage::PDFPage( PDFWriterImpl* pWriter, double nPageWidth, double nPageHeight, PDFWriter::Orientation eOrientation )
:
m_pWriter( pWriter ),
@@ -1314,46 +1357,20 @@ OString PDFWriter::GetDateTime()
osl_getSystemTime(&aGMT);
osl_getLocalTimeFromSystemTime(&aGMT, &aTVal);
osl_getDateTimeFromTimeValue(&aTVal, &aDT);
- aRet.append("D:");
- aRet.append(static_cast<char>('0' + ((aDT.Year / 1000) % 10)));
- aRet.append(static_cast<char>('0' + ((aDT.Year / 100) % 10)));
- aRet.append(static_cast<char>('0' + ((aDT.Year / 10) % 10)));
- aRet.append(static_cast<char>('0' + (aDT.Year % 10)));
- aRet.append(static_cast<char>('0' + ((aDT.Month / 10) % 10)));
- aRet.append(static_cast<char>('0' + (aDT.Month % 10)));
- aRet.append(static_cast<char>('0' + ((aDT.Day / 10) % 10)));
- aRet.append(static_cast<char>('0' + (aDT.Day % 10)));
- aRet.append(static_cast<char>('0' + ((aDT.Hours / 10) % 10)));
- aRet.append(static_cast<char>('0' + (aDT.Hours % 10)));
- aRet.append(static_cast<char>('0' + ((aDT.Minutes / 10) % 10)));
- aRet.append(static_cast<char>('0' + (aDT.Minutes % 10)));
- aRet.append(static_cast<char>('0' + ((aDT.Seconds / 10) % 10)));
- aRet.append(static_cast<char>('0' + (aDT.Seconds % 10)));
sal_uInt32 nDelta = 0;
if (aGMT.Seconds > aTVal.Seconds)
{
- aRet.append("-");
nDelta = aGMT.Seconds-aTVal.Seconds;
}
else if (aGMT.Seconds < aTVal.Seconds)
{
- aRet.append("+");
nDelta = aTVal.Seconds-aGMT.Seconds;
}
- else
- aRet.append("Z");
- if (nDelta)
- {
- aRet.append(static_cast<char>('0' + ((nDelta / 36000) % 10)));
- aRet.append(static_cast<char>('0' + ((nDelta / 3600) % 10)));
- aRet.append("'");
- aRet.append(static_cast<char>('0' + ((nDelta / 600) % 6)));
- aRet.append(static_cast<char>('0' + ((nDelta / 60) % 10)));
- }
- aRet.append( "'" );
+ appendPdfTimeDate(aRet, aDT.Year, aDT.Month, aDT.Day, aDT.Hours, aDT.Minutes, aDT.Seconds, nDelta);
+ aRet.append("'");
return aRet.makeStringAndClear();
}
@@ -3464,6 +3481,11 @@ void PDFWriterImpl::emitTextAnnotationLine(OStringBuffer & aLine, PDFNoteEntry c
aLine.append("/Popup ");
appendObjectReference(rNote.m_aPopUpAnnotation.m_nObject, aLine);
+ auto & rDateTime = rNote.m_aContents.maModificationDate;
+
+ aLine.append("/M ");
+ appendPdfTimeDate(aLine, rDateTime.Year, rDateTime.Month, rDateTime.Day, rDateTime.Hours, rDateTime.Minutes, rDateTime.Seconds, 0);
+
// contents of the note (type text string)
aLine.append("/Contents ");
appendUnicodeTextStringEncrypt(rNote.m_aContents.Contents, rNote.m_nObject, aLine);