Kaydet (Commit) e554121f authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Make it compile for Android again (and iOS, I hope)

Change-Id: Ib0a4f4ea4858d52ed70e9a4d1b7904325f36c361
üst 15bbf66e
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
#include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase1.hxx"
#if !defined(ANDROID) && !defined(IOS)
// NSS header files for PDF signing support // NSS header files for PDF signing support
#include "nss.h" #include "nss.h"
#include "cert.h" #include "cert.h"
...@@ -89,6 +90,7 @@ ...@@ -89,6 +90,7 @@
#include "sechash.h" #include "sechash.h"
#include "cms.h" #include "cms.h"
#include "cmst.h" #include "cmst.h"
#endif
using namespace vcl; using namespace vcl;
...@@ -5916,12 +5918,14 @@ bool PDFWriterImpl::emitCatalog() ...@@ -5916,12 +5918,14 @@ bool PDFWriterImpl::emitCatalog()
else else
aInitPageRef.append( "0" ); aInitPageRef.append( "0" );
#if !defined(ANDROID) && !defined(IOS)
if (m_nSignatureObject != -1) // Document will be signed if (m_nSignatureObject != -1) // Document will be signed
{ {
aLine.append("/Perms<</DocMDP "); aLine.append("/Perms<</DocMDP ");
aLine.append(m_nSignatureObject); aLine.append(m_nSignatureObject);
aLine.append(" 0 R>>"); aLine.append(" 0 R>>");
} }
#endif
switch( m_aContext.PDFDocumentAction ) switch( m_aContext.PDFDocumentAction )
{ {
...@@ -6049,14 +6053,20 @@ bool PDFWriterImpl::emitCatalog() ...@@ -6049,14 +6053,20 @@ bool PDFWriterImpl::emitCatalog()
} }
aLine.append( "\n]" ); aLine.append( "\n]" );
#if !defined(ANDROID) && !defined(IOS)
if (m_nSignatureObject != -1) if (m_nSignatureObject != -1)
aLine.append( "/SigFlags 3"); aLine.append( "/SigFlags 3");
#endif
aLine.append( "/DR " ); aLine.append( "/DR " );
aLine.append( getResourceDictObj() ); aLine.append( getResourceDictObj() );
aLine.append( " 0 R" ); aLine.append( " 0 R" );
// /NeedAppearances must not be used if PDF is signed // /NeedAppearances must not be used if PDF is signed
if( m_bIsPDF_A1 || ( m_nSignatureObject != -1 ) ) if( m_bIsPDF_A1
#if !defined(ANDROID) && !defined(IOS)
|| ( m_nSignatureObject != -1 )
#endif
)
aLine.append( ">>\n" ); aLine.append( ">>\n" );
else else
aLine.append( "/NeedAppearances true>>\n" ); aLine.append( "/NeedAppearances true>>\n" );
...@@ -6083,6 +6093,8 @@ bool PDFWriterImpl::emitCatalog() ...@@ -6083,6 +6093,8 @@ bool PDFWriterImpl::emitCatalog()
return true; return true;
} }
#if !defined(ANDROID) && !defined(IOS)
bool PDFWriterImpl::emitSignature() bool PDFWriterImpl::emitSignature()
{ {
if( !updateObject( m_nSignatureObject ) ) if( !updateObject( m_nSignatureObject ) )
...@@ -6358,6 +6370,8 @@ bool PDFWriterImpl::finalizeSignature() ...@@ -6358,6 +6370,8 @@ bool PDFWriterImpl::finalizeSignature()
return true; return true;
} }
#endif
sal_Int32 PDFWriterImpl::emitInfoDict( ) sal_Int32 PDFWriterImpl::emitInfoDict( )
{ {
sal_Int32 nObject = createObject(); sal_Int32 nObject = createObject();
...@@ -7139,6 +7153,7 @@ bool PDFWriterImpl::emit() ...@@ -7139,6 +7153,7 @@ bool PDFWriterImpl::emit()
// needed for widget tab order // needed for widget tab order
sortWidgets(); sortWidgets();
#if !defined(ANDROID) && !defined(IOS)
if( m_aContext.SignPDF ) if( m_aContext.SignPDF )
{ {
// sign the document // sign the document
...@@ -7146,6 +7161,7 @@ bool PDFWriterImpl::emit() ...@@ -7146,6 +7161,7 @@ bool PDFWriterImpl::emit()
aSignature.Name = OUString("Signature1"); aSignature.Name = OUString("Signature1");
createControl( aSignature, 0 ); createControl( aSignature, 0 );
} }
#endif
// emit additional streams // emit additional streams
CHECK_RETURN( emitAdditionalStreams() ); CHECK_RETURN( emitAdditionalStreams() );
...@@ -7153,14 +7169,18 @@ bool PDFWriterImpl::emit() ...@@ -7153,14 +7169,18 @@ bool PDFWriterImpl::emit()
// emit catalog // emit catalog
CHECK_RETURN( emitCatalog() ); CHECK_RETURN( emitCatalog() );
#if !defined(ANDROID) && !defined(IOS)
if (m_nSignatureObject != -1) // if document is signed, emit sigdict if (m_nSignatureObject != -1) // if document is signed, emit sigdict
CHECK_RETURN( emitSignature() ); CHECK_RETURN( emitSignature() );
#endif
// emit trailer // emit trailer
CHECK_RETURN( emitTrailer() ); CHECK_RETURN( emitTrailer() );
#if !defined(ANDROID) && !defined(IOS)
if (m_nSignatureObject != -1) // finalize the signature if (m_nSignatureObject != -1) // finalize the signature
CHECK_RETURN( finalizeSignature() ); CHECK_RETURN( finalizeSignature() );
#endif
osl_closeFile( m_aFile ); osl_closeFile( m_aFile );
m_bOpen = false; m_bOpen = false;
...@@ -12058,6 +12078,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa ...@@ -12058,6 +12078,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa
createDefaultEditAppearance( rNewWidget, rEdit ); createDefaultEditAppearance( rNewWidget, rEdit );
} }
#if !defined(ANDROID) && !defined(IOS)
else if( rControl.getType() == PDFWriter::Signature) else if( rControl.getType() == PDFWriter::Signature)
{ {
const PDFWriter::SignatureWidget& rSig = static_cast<const PDFWriter::SignatureWidget&>(rControl); const PDFWriter::SignatureWidget& rSig = static_cast<const PDFWriter::SignatureWidget&>(rControl);
...@@ -12073,7 +12094,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa ...@@ -12073,7 +12094,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa
// let's add a fake appearance // let's add a fake appearance
rNewWidget.m_aAppearances[ "N" ][ "Standard" ] = new SvMemoryStream(); rNewWidget.m_aAppearances[ "N" ][ "Standard" ] = new SvMemoryStream();
} }
#endif
// if control is a hidden signature, do not convert coordinates since we // if control is a hidden signature, do not convert coordinates since we
// need /Rect [ 0 0 0 0 ] // need /Rect [ 0 0 0 0 ]
......
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