summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-02-16 18:07:47 +0200
committerAndras Timar <andras.timar@collabora.com>2015-03-05 17:17:42 +0100
commita631ee21f2478c976bce23898d84a6529296087f (patch)
tree1f49febf01119218b32943dd3e4afcf6b6f2f433
parenta56459cae72f17ebeba408a451451880639bcabf (diff)
tdf#88428: Add GUI to select one of user-configured Time Stamp Authorities
Work in progress. The selection not used for anything yet. (cherry picked from commit b8b9d51b8cf1cafe1a94e1baf957f3f282abb32f) Conflicts: filter/source/pdf/impdialog.cxx include/sal/log-areas.dox Change-Id: Ia86fa0f59dcfee8e9d332a028a3fad37f4019fe0
-rw-r--r--cui/source/options/tsaurls.cxx4
-rw-r--r--cui/source/options/tsaurls.hxx2
-rw-r--r--filter/Library_pdffilter.mk4
-rw-r--r--filter/source/pdf/impdialog.cxx28
-rw-r--r--filter/source/pdf/impdialog.hxx2
-rw-r--r--filter/uiconfig/ui/pdfsignpage.ui28
-rw-r--r--include/sal/log-areas.dox1
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx6
8 files changed, 70 insertions, 5 deletions
diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx
index 9db380135ed7..cf50fbca3db3 100644
--- a/cui/source/options/tsaurls.cxx
+++ b/cui/source/options/tsaurls.cxx
@@ -17,7 +17,7 @@
using namespace ::com::sun::star;
-TSAURLsDialog::TSAURLsDialog(vcl::Window* pParent)
+TSAURLsDialog::TSAURLsDialog(Window* pParent)
: ModalDialog(pParent, "TSAURLDialog", "cui/ui/tsaurldialog.ui")
{
get(m_pAddBtn, "add");
@@ -50,7 +50,7 @@ TSAURLsDialog::TSAURLsDialog(vcl::Window* pParent)
IMPL_LINK_NOARG(TSAURLsDialog, OKHdl_Impl)
{
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+ boost::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
css::uno::Sequence<OUString> aNewValue(m_aURLs.size());
size_t n(0);
diff --git a/cui/source/options/tsaurls.hxx b/cui/source/options/tsaurls.hxx
index aba749181ac5..cc9f2de1bd24 100644
--- a/cui/source/options/tsaurls.hxx
+++ b/cui/source/options/tsaurls.hxx
@@ -30,7 +30,7 @@ private:
void AddTSAURL(const OUString &rURL);
public:
- TSAURLsDialog(vcl::Window* pParent);
+ TSAURLsDialog(Window* pParent);
virtual ~TSAURLsDialog();
};
diff --git a/filter/Library_pdffilter.mk b/filter/Library_pdffilter.mk
index b3a62d76f352..6de7d341367e 100644
--- a/filter/Library_pdffilter.mk
+++ b/filter/Library_pdffilter.mk
@@ -30,6 +30,10 @@ $(eval $(call gb_Library_set_include,pdffilter,\
$$(INCLUDE) \
))
+$(eval $(call gb_Library_use_custom_headers,pdffilter,\
+ officecfg/registry \
+))
+
$(eval $(call gb_Library_use_libraries,pdffilter,\
svt \
sfx \
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 63e446f36fa0..005dd2fceccb 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -21,6 +21,7 @@
#include "impdialog.hxx"
#include "impdialog.hrc"
+#include <officecfg/Office/Common.hxx>
#include "vcl/svapp.hxx"
#include "vcl/msgbox.hxx"
#include <vcl/settings.hxx>
@@ -1541,10 +1542,12 @@ ImpPDFTabSigningPage::ImpPDFTabSigningPage(Window* pParent, const SfxItemSet& rC
get(mpEdSignLocation, "location");
get(mpEdSignContactInfo, "contact");
get(mpEdSignReason, "reason");
+ get(mpLBSignTSA, "tsa");
mpPbSignCertSelect->Enable( true );
mpPbSignCertSelect->SetClickHdl( LINK( this, ImpPDFTabSigningPage, ClickmaPbSignCertSelect ) );
mpPbSignCertClear->SetClickHdl( LINK( this, ImpPDFTabSigningPage, ClickmaPbSignCertClear ) );
+ mpLBSignTSA->SetSelectHdl( LINK( this, ImpPDFTabSigningPage, SelectLBSignTSA ) );
}
@@ -1569,6 +1572,24 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect )
mpEdSignPassword->Enable( true );
mpEdSignContactInfo->Enable( true );
mpEdSignReason->Enable( true );
+
+ try
+ {
+ css::uno::Sequence<OUString> aTSAURLs(officecfg::Office::Common::Security::Scripting::TSAURLs::get());
+
+ for (auto i = aTSAURLs.begin(); i != aTSAURLs.end(); ++i)
+ {
+ mpLBSignTSA->InsertEntry( *i );
+ }
+ }
+ catch (const uno::Exception &e)
+ {
+ SAL_INFO("filter.pdf", "TSAURLsDialog::TSAURLsDialog(): caught exception" << e.Message);
+ }
+
+ // If more than only the "None" entry is there, enable the ListBox
+ if (mpLBSignTSA->GetEntryCount() > 1)
+ mpLBSignTSA->Enable();
}
return 0;
@@ -1583,11 +1604,17 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertClear )
mpEdSignPassword->Enable( false );
mpEdSignContactInfo->Enable( false );
mpEdSignReason->Enable( false );
+ mpLBSignTSA->Enable( false );
return 0;
}
+IMPL_LINK_NOARG( ImpPDFTabSigningPage, SelectLBSignTSA )
+{
+ return 0;
+}
+
SfxTabPage* ImpPDFTabSigningPage::Create( Window* pParent,
const SfxItemSet& rAttrSet)
{
@@ -1616,6 +1643,7 @@ void ImpPDFTabSigningPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent
mpEdSignPassword->Enable( false );
mpEdSignContactInfo->Enable( false );
mpEdSignReason->Enable( false );
+ mpLBSignTSA->Enable( false );
mpPbSignCertClear->Enable( false );
if (paParent->mbSignPDF)
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index c6238ea3de02..50bba414023d 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -420,10 +420,12 @@ class ImpPDFTabSigningPage : public SfxTabPage
Edit* mpEdSignLocation;
Edit* mpEdSignContactInfo;
Edit* mpEdSignReason;
+ ListBox* mpLBSignTSA;
com::sun::star::uno::Reference< com::sun::star::security::XCertificate > maSignCertificate;
DECL_LINK( ClickmaPbSignCertSelect, void* );
DECL_LINK( ClickmaPbSignCertClear, void* );
+ DECL_LINK( SelectLBSignTSA, void* );
public:
ImpPDFTabSigningPage( Window* pParent,
diff --git a/filter/uiconfig/ui/pdfsignpage.ui b/filter/uiconfig/ui/pdfsignpage.ui
index ff9395fc766d..73c61aebe58e 100644
--- a/filter/uiconfig/ui/pdfsignpage.ui
+++ b/filter/uiconfig/ui/pdfsignpage.ui
@@ -173,6 +173,20 @@
</packing>
</child>
<child>
+ <object class="GtkComboBoxText" id="tsa">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_entry">False</property>
+ <items>
+ <item translatable="yes">None</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -236,6 +250,20 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Time Stamp Authority:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">reason</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index c12740c8e08a..6d7e8e701ada 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -172,6 +172,7 @@ certain functionality.
@li @c filter.ms - escher import/export
@li @c filter.odfflatxml
@li @c filter.os2met
+@li @c filter.pdf
@li @c filter.tiff
@li @c filter.xslt - xslt import/export
@li @c oox.cscode - see oox/source/drawingml/customshapes/README
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index e7a18b78ee42..7fa5b14ab815 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6943,7 +6943,8 @@ bool PDFWriterImpl::finalizeSignature()
src.reqPolicy.data = NULL;
src.reqPolicy.len = 0;
- unsigned int nNonce = comphelper::rng::uniform_uint_distribution(0, SAL_MAX_UINT32);
+ srand( unsigned( time( NULL ) ));
+ unsigned int nNonce = rand();
src.nonce.type = siUnsignedInteger;
src.nonce.data = reinterpret_cast<unsigned char*>(&nNonce);
src.nonce.len = sizeof(nNonce);
@@ -7414,7 +7415,8 @@ bool PDFWriterImpl::finalizeSignature()
CMSG_SIGNER_INFO *pDecodedSignerInfo = (CMSG_SIGNER_INFO *) pDecodedSignerInfoBuf.get();
CRYPT_TIMESTAMP_PARA aTsPara;
- unsigned int nNonce = comphelper::rng::uniform_uint_distribution(0, SAL_MAX_UINT32);
+ srand( unsigned( time( NULL ) ));
+ unsigned int nNonce = rand();
aTsPara.pszTSAPolicyId = NULL;
aTsPara.fRequestCerts = TRUE;