Kaydet (Commit) 5c5017ea authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Michael Stahl

tdf#65439: Export to PDF/A-1a gives transparency warning

There was a use of transparency because Watermark was always defined
Now we test if text of Watermark is empty or not
Remark: it seems we don't cope not-text Watermark in pdf export
(additional cleaning+renaming)

Change-Id: I9d9c759a80c0a61e4f0a94c0fa295f2950caa3bc
Reviewed-on: https://gerrit.libreoffice.org/20990Tested-by: 's avatarJenkins <ci@libreoffice.org>
Tested-by: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 0ba75220
......@@ -116,7 +116,6 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc,
mbAllowDuplicateFieldNames ( false ),
mnProgressValue ( 0 ),
mbRemoveTransparencies ( false ),
mbWatermark ( false ),
mbHideViewerToolbar ( false ),
mbHideViewerMenubar ( false ),
......@@ -504,10 +503,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
else if ( rFilterData[ nData ].Name == "IsAddStream" )
rFilterData[ nData ].Value >>= mbAddStream;
else if ( rFilterData[ nData ].Name == "Watermark" )
{
maWatermark = rFilterData[ nData ].Value;
mbWatermark = true;
}
rFilterData[ nData ].Value >>= msWatermark;
//now all the security related properties...
else if ( rFilterData[ nData ].Name == "EncryptFile" )
rFilterData[ nData ].Value >>= mbEncrypt;
......@@ -1046,7 +1042,7 @@ bool PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData&
rPDFExtOutDevData.ResetSyncData();
if( mbWatermark )
if (!msWatermark.isEmpty())
ImplWriteWatermark( rWriter, aSizePDF );
return bRet;
......@@ -1056,7 +1052,6 @@ bool PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData&
void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize )
{
OUString aText( "Watermark" );
vcl::Font aFont( OUString( "Helvetica" ), Size( 0, 3*rPageSize.Height()/4 ) );
aFont.SetItalic( ITALIC_NONE );
aFont.SetWidthType( WIDTH_NORMAL );
......@@ -1069,18 +1064,13 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
aFont.SetOrientation( 2700 );
}
if( ! ( maWatermark >>= aText ) )
{
// more complicated watermark ?
}
// adjust font height for text to fit
OutputDevice* pDev = rWriter.GetReferenceDevice();
pDev->Push();
pDev->SetFont( aFont );
pDev->SetMapMode( MapMode( MAP_POINT ) );
int w = 0;
while( ( w = pDev->GetTextWidth( aText ) ) > nTextWidth )
while( ( w = pDev->GetTextWidth( msWatermark ) ) > nTextWidth )
{
if (w == 0)
break;
......@@ -1122,7 +1112,7 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
}
rWriter.SetClipRegion();
rWriter.BeginTransparencyGroup();
rWriter.DrawText( aTextPoint, aText );
rWriter.DrawText( aTextPoint, msWatermark );
rWriter.EndTransparencyGroup( aTextRect, 50 );
rWriter.Pop();
}
......
......@@ -66,8 +66,7 @@ private:
sal_Int32 mnProgressValue;
bool mbRemoveTransparencies;
bool mbWatermark;
uno::Any maWatermark;
OUString msWatermark;
//these variable are here only to have a location in filter/pdf to set the default
//to be used by the macro (when the FilterData are set by the macro itself)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment