[Libreoffice-commits] core.git: 2 commits - filter/source include/vcl vcl/inc vcl/source

2023-09-04 Thread Sarper Akdemir (via logerrit)
 filter/source/pdf/pdfexport.cxx   |4 
 include/vcl/pdfwriter.hxx |1 +
 vcl/inc/pdf/pdfwriter_impl.hxx|1 +
 vcl/source/gdi/pdfwriter_impl.cxx |   12 ++--
 vcl/source/pdf/XmpMetadata.cxx|8 
 5 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 7803c5749365c6dca6583708c14d6229c9659572
Author: Sarper Akdemir 
AuthorDate: Thu Aug 10 08:49:24 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Mon Sep 4 20:53:27 2023 +0200

tdf#138792: PDF export: export metadata xmp:ModifyDate, xmp:MetadataDate

Export metadata xmp:ModifyDate & xmp:MetadataDate - populate
both with the same information as CreateDate.

Change-Id: I391a72cbe4e7d1ebba5c04c402a68534bbeb4743
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156328
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/vcl/source/pdf/XmpMetadata.cxx b/vcl/source/pdf/XmpMetadata.cxx
index d4c58c23348b..7b0df42dbb92 100644
--- a/vcl/source/pdf/XmpMetadata.cxx
+++ b/vcl/source/pdf/XmpMetadata.cxx
@@ -155,8 +155,16 @@ void XmpMetadata::write()
 aXmlWriter.startElement("xmp:CreateDate");
 aXmlWriter.content(m_sCreateDate);
 aXmlWriter.endElement();
+
+aXmlWriter.startElement("xmp:ModifyDate");
+aXmlWriter.content(m_sCreateDate);
+aXmlWriter.endElement();
+
+aXmlWriter.startElement("xmp:MetadataDate");
+aXmlWriter.content(m_sCreateDate);
 aXmlWriter.endElement();
 
+aXmlWriter.endElement();
 aXmlWriter.endElement();
 aXmlWriter.endElement();
 aXmlWriter.endDocument();
commit 07ac61f2c67020ad2941462ea7081f06495bcb92
Author: Sarper Akdemir 
AuthorDate: Mon Aug 28 11:16:34 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Mon Sep 4 20:53:17 2023 +0200

tdf#138792: PDF export: fix date of xmp:CreateDate

for pdf export xmp:CreateDate should be the modification
date instead of the creation date.

Change-Id: I2a86f30cb528cb2bd5e0f9e7c9a8a8b8d2993f50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156327
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 8199132b66b4..9b6523448dfb 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -477,6 +477,10 @@ bool PDFExport::Export( const OUString& rFile, const 
Sequence< PropertyValue >&
 aContext.DocumentInfo.Author = xDocumentProps->getAuthor();
 aContext.DocumentInfo.Subject = 
xDocumentProps->getSubject();
 aContext.DocumentInfo.Keywords = 
::comphelper::string::convertCommaSeparated(xDocumentProps->getKeywords());
+aContext.DocumentInfo.ModificationDate
+= xDocumentProps->getEditingCycles() < 1
+  ? xDocumentProps->getCreationDate()
+  : xDocumentProps->getModificationDate();
 }
 }
 
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 796c1f03cd9b..2b62b26b6ef4 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -559,6 +559,7 @@ The following structure describes the permissions used in 
PDF security
 OUString  Author; // document author
 OUString  Subject;// subject
 OUString  Keywords;   // keywords
+css::util::DateTime ModificationDate;
 OUString  Creator;// application that created the 
original document
 OUString  Producer;   // OpenOffice
 };
diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index 75f613060c04..b9eaf4686b95 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -1115,6 +1115,7 @@ i12626
 static void computeDocumentIdentifier( std::vector< sal_uInt8 >& 
o_rIdentifier,
const vcl::PDFWriter::PDFDocInfo& 
i_rDocInfo,
const OString& i_rCString1,
+   const css::util::DateTime& 
rCreationMetaDate,
OString& o_rCString2
   );
 static sal_Int32 computeAccessPermissions( const 
vcl::PDFWriter::PDFEncryptionProperties& i_rProperties,
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 55ed6d514b9d..def3d4ee3ba5 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1375,7 +1375,7 @@ void PDFWriterImpl::setupDocInfo()
 {
 std::vector< sal_uInt8 > aId;
 m_aCreationDateString = PDFWriter::GetDateTime();
-computeDocumentIdentifier( aId, m_aContext.DocumentInfo, 
m_aCreationDateString, m_aCreationMetaDateString );
+computeDocumentIdentifier( 

[Libreoffice-commits] core.git: 2 commits - filter/source include/vcl officecfg/registry sw/source vcl/qa vcl/source

2023-03-08 Thread Michael Stahl (via logerrit)
 filter/source/pdf/pdfexport.cxx|3 
 include/vcl/pdfwriter.hxx  |   10 +
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |5 
 sw/source/core/text/EnhancedPDFExportHelper.cxx|   12 ++
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |   22 +++
 vcl/source/gdi/pdfwriter_impl.cxx  |   72 +++--
 6 files changed, 114 insertions(+), 10 deletions(-)

New commits:
commit 7a907965cc6246ab644be92811e35d9f73a90e86
Author: Michael Stahl 
AuthorDate: Tue Mar 7 10:40:23 2023 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 8 10:38:11 2023 +

vcl,sw: PDF/UA export: tag headers and footers as required

ISO 14289-1:2014 has one requirement for specific tagging of artifacts:

  7.8 Page headers and footers
  Running headers and footers shall be identified as Pagination
  artifacts and shall be classified as either Header or Footer
  subtypes as per ISO 32000-1:2008, 14.8.2.2.2, Table 330.

It was not immediately obvious how to implement this but the functions
used for tunnelling structure element attributes through MetaFile can
be used for this purpose as well with a few tweaks.

Change-Id: I19a3192b1b56b82ed11972c4bbe8d20ab13567be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148387
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 8e3c139e8943..1e21fae1c5bd 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -135,6 +135,9 @@ public:
 
 enum StructAttribute
 {
+// Artifacts
+Type, Subtype,
+
 Placement, WritingMode, SpaceBefore, SpaceAfter, StartIndent, 
EndIndent,
 TextIndent, TextAlign, Width, Height, BlockAlign, InlineAlign,
 LineHeight, BaselineShift, TextDecorationType, ListNumbering,
@@ -158,6 +161,9 @@ public:
 {
 Invalid,
 NONE,
+// Artifacts
+Pagination, Layout, Page, Background,
+Header, Footer, Watermark,
 // Placement
 Block, Inline, Before, After, Start, End,
 // WritingMode
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 1dde77106624..e9f8d310d3fe 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -602,6 +602,18 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 }
 break;
 
+case vcl::PDFWriter::NonStructElement:
+if (pFrame->IsHeaderFrame() || pFrame->IsFooterFrame())
+{
+// ISO 14289-1:2014, Clause: 7.8
+
mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Type, 
vcl::PDFWriter::Pagination);
+
mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Subtype,
+pFrame->IsHeaderFrame()
+   ? vcl::PDFWriter::Header
+   : vcl::PDFWriter::Footer);
+}
+break;
+
 default :
 break;
 }
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 4cf31e708220..30d9b5513c97 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -3050,7 +3050,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf139736)
 
 // Enable PDF/UA
 uno::Sequence aFilterData(
-comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) 
} }));
+comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) 
},
+   { "SelectPdfVersion", 
uno::Any(sal_Int32(17)) } }));
 aMediaDescriptor["FilterData"] <<= aFilterData;
 saveAsPDF(u"tdf139736-1.odt");
 
@@ -3081,6 +3082,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf139736)
 {
 Default,
 Artifact,
+ArtifactProps1,
+ArtifactProps2,
 Tagged
 } state
 = Default;
@@ -3107,6 +3110,23 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf139736)
 state = Artifact;
 ++nArtifacts;
 }
+else if (o3tl::starts_with(line, "/Artifact <<"))
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE("unexpected nesting", Default, 
state);
+// check header/footer properties
+CPPUNIT_ASSERT_EQUAL(std::string_view("/Type/Pagination"), 
line.substr(12));
+state = ArtifactProps1;
+++nArtifacts;
+}
+else if (state == ArtifactProps1)
+{
+CPPUNIT_ASSERT_EQUAL(std::string_view("/Subtype/Header"), 
line);
+state = ArtifactProps2;
+}
+else if

[Libreoffice-commits] core.git: 2 commits - filter/source include/vcl

2018-02-13 Thread Noel Grandin
 filter/source/graphicfilter/ieps/ieps.cxx |   22 +++---
 filter/source/graphicfilter/itga/itga.cxx |2 +-
 include/vcl/BitmapTools.hxx   |4 +++-
 3 files changed, 11 insertions(+), 17 deletions(-)

New commits:
commit f9e611478f7b5d07a6d623ee04ed3a5ea6b1156e
Author: Noel Grandin 
Date:   Mon Feb 12 15:16:02 2018 +0200

use RawBitmap in ipsGraphicImport

part of making Bitmap an internal detail of vcl

Change-Id: Idbc44c29292e7136e6bb09b8472a396e15e5bc68
Reviewed-on: https://gerrit.libreoffice.org/49663
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/filter/source/graphicfilter/ieps/ieps.cxx 
b/filter/source/graphicfilter/ieps/ieps.cxx
index 2808975ff5e1..a2d94c45faac 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -29,7 +29,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -656,16 +656,13 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
 {
 rStream.Seek( nBufStartPos + ( pDest - pBuf.get() ) );
 
-Bitmap aBitmap( Size( nWidth, nHeight ), 1 );
-BitmapWriteAccess* pAcc = aBitmap.AcquireWriteAccess();
-if ( pAcc )
+vcl::bitmap::RawBitmap aBitmap( Size( nWidth, nHeight 
) );
 {
 bool bIsValid = true;
 sal_uInt8 nDat = 0;
 char nByte;
 for (long y = 0; bIsValid && y < nHeight; ++y)
 {
-Scanline pScanline = pAcc->GetScanline( y );
 int nBitsLeft = 0;
 for (long x = 0; x < nWidth; ++x)
 {
@@ -715,10 +712,10 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
 if (!bIsValid)
 break;
 if ( nBitDepth == 1 )
-pAcc->SetPixelOnData( pScanline, x, 
BitmapColor(static_cast(nDat >> nBitsLeft) & 1) );
+aBitmap.SetPixel( y, x, 
Color(static_cast(nDat >> nBitsLeft) & 1) );
 else
 {
-pAcc->SetPixelOnData( pScanline, x, 
BitmapColor(nDat ? 1 : 0) );  // nBitDepth == 8
+aBitmap.SetPixel( y, x, nDat ? 
COL_WHITE : COL_BLACK );  // nBitDepth == 8
 nBitsLeft = 0;
 }
 }
@@ -727,15 +724,11 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
 {
 ScopedVclPtrInstance pVDev;
 GDIMetaFile aMtf;
-SizeaSize;
+SizeaSize( nWidth, nHeight );
 pVDev->EnableOutput( false );
 aMtf.Record( pVDev );
-aSize = aBitmap.GetPrefSize();
-if( !aSize.Width() || !aSize.Height() )
-aSize = 
Application::GetDefaultDevice()->PixelToLogic(aBitmap.GetSizePixel(), 
MapMode(MapUnit::Map100thMM));
-else
-aSize = OutputDevice::LogicToLogic(aSize, 
aBitmap.GetPrefMapMode(), MapMode(MapUnit::Map100thMM));
-pVDev->DrawBitmap( Point(), aSize, aBitmap );
+aSize = OutputDevice::LogicToLogic(aSize, 
MapMode(), MapMode(MapUnit::Map100thMM));
+pVDev->DrawBitmapEx( Point(), aSize, 
vcl::bitmap::CreateFromData(std::move(aBitmap)) );
 aMtf.Stop();
 aMtf.WindStart();
 
aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
@@ -743,7 +736,6 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
 aGraphic = aMtf;
 bHasPreview = bRetValue = true;
 }
-Bitmap::ReleaseAccess( pAcc );
 }
 }
 }
commit 83330a608d0e0be9735d00ae5d60ba262bd235c3
Author: Noel Grandin 
Date:   Mon Feb 12 14:07:24 2018 +0200

use Color, not BitmapColor in RawBitmap

because we don't want palette images

Change-Id: If087e51503714bf8474ae320381f80196092ceb