[Libreoffice-commits] .: Branch 'feature/pdf-signing' - vcl/inc vcl/source
Gökcen Eraslan
gokcen at kemper.freedesktop.org
Sat Jun 23 11:09:46 PDT 2012
vcl/inc/vcl/pdfwriter.hxx | 8 +++++++-
vcl/source/gdi/pdfwriter_impl.cxx | 27 +++++++++++++++++++--------
2 files changed, 26 insertions(+), 9 deletions(-)
New commits:
commit 1d546e142274f9f1f1bbc60f095b4b7c7493e469
Author: Gökçen Eraslan <gokcen.eraslan at gmail.com>
Date: Sat Jun 23 20:30:47 2012 +0300
Use /Rect [0, 0, 0, 0] if signature is not visible.
Change-Id: I271b882d95d6e0bc7b5831add67046e7f476c7dd
diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx
index 99f99d6..8ffab09 100644
--- a/vcl/inc/vcl/pdfwriter.hxx
+++ b/vcl/inc/vcl/pdfwriter.hxx
@@ -452,12 +452,18 @@ public:
struct SignatureWidget: public AnyWidget
{
+ // Use Sig prefix for members to avoid conflict with
+ // the Location member of the AnyWidget which spcifies the coordinates
+ // of the signature
+
rtl::OUString SigLocation;
rtl::OUString SigReason;
rtl::OUString SigContactInfo;
+ bool SigHidden;
SignatureWidget()
- : AnyWidget( vcl::PDFWriter::Signature )
+ : AnyWidget( vcl::PDFWriter::Signature ),
+ SigHidden( true )
{}
virtual AnyWidget* Clone() const
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 5e271ec..f12f973 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -527,7 +527,6 @@ void doTestCode()
// sign the document
PDFWriter::SignatureWidget aSignature;
aSignature.Name = OUString("Signature1");
- aSignature.Location = Rectangle( Point( 0, 0 ), Size( 0, 0 ) );
aWriter.CreateControl( aSignature, 0);
aWriter.Emit();
@@ -11699,13 +11698,14 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa
if( nPageNr < 0 || nPageNr >= (sal_Int32)m_aPages.size() )
return -1;
+ bool sigHidden;
sal_Int32 nNewWidget = m_aWidgets.size();
m_aWidgets.push_back( PDFWidget() );
m_aWidgets.back().m_nObject = createObject();
- m_aWidgets.back().m_aRect = rControl.Location;
- m_aWidgets.back().m_nPage = nPageNr;
- m_aWidgets.back().m_eType = rControl.getType();
+ m_aWidgets.back().m_aRect = rControl.Location;
+ m_aWidgets.back().m_nPage = nPageNr;
+ m_aWidgets.back().m_eType = rControl.getType();
sal_Int32 nRadioGroupWidget = -1;
// for unknown reasons the radio buttons of a radio group must not have a
@@ -11865,7 +11865,12 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa
}
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);
+ sigHidden = rSig.SigHidden;
+
+ if ( sigHidden )
+ rNewWidget.m_aRect = Rectangle(0, 0, 0, 0);
+
m_nSignatureObject = createObject();
rNewWidget.m_aValue = OUString::valueOf( m_nSignatureObject );
rNewWidget.m_aValue += OUString(" 0 R");
@@ -11874,9 +11879,15 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa
rNewWidget.m_aAppearances[ "N" ][ "Standard" ] = new SvMemoryStream();
}
- // convert to default user space now, since the mapmode may change
- // note: create default appearances before m_aRect gets transformed
- m_aPages[ nPageNr ].convertRect( rNewWidget.m_aRect );
+
+ // if control is a hidden signature, do not convert coordinates since we
+ // need /Rect [ 0 0 0 0 ]
+ if ( ! ( ( rControl.getType() == PDFWriter::Signature ) && ( sigHidden ) ) )
+ {
+ // convert to default user space now, since the mapmode may change
+ // note: create default appearances before m_aRect gets transformed
+ m_aPages[ nPageNr ].convertRect( rNewWidget.m_aRect );
+ }
// insert widget to page's annotation list
m_aPages[ nPageNr ].m_aAnnotations.push_back( rNewWidget.m_nObject );
More information about the Libreoffice-commits
mailing list