related tdf#162786: Add cacert.pem
[LibreOffice.git] / filter / source / pdf / pdfinteract.cxx
blobbd08fd0b292bcdcaa620a002b5bd01e76ca05f5e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "pdfinteract.hxx"
22 #include "impdialog.hxx"
24 #include <com/sun/star/task/XInteractionRequest.hpp>
25 #include <com/sun/star/task/PDFExportException.hpp>
26 #include <comphelper/namedvaluecollection.hxx>
27 #include <cppuhelper/supportsservice.hxx>
28 #include <vcl/svapp.hxx>
30 PDFInteractionHandler::PDFInteractionHandler()
34 PDFInteractionHandler::~PDFInteractionHandler()
38 void SAL_CALL PDFInteractionHandler::handle( const Reference< task::XInteractionRequest >& i_xRequest )
40 handleInteractionRequest( i_xRequest );
43 void SAL_CALL PDFInteractionHandler::initialize(const css::uno::Sequence<css::uno::Any>& rArguments)
45 comphelper::NamedValueCollection aProperties(rArguments);
46 if (aProperties.has(u"Parent"_ustr))
47 aProperties.get(u"Parent"_ustr) >>= m_xParent;
50 sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Reference< task::XInteractionRequest >& i_xRequest )
52 bool bHandled = false;
54 Any aRequest( i_xRequest->getRequest() );
55 task::PDFExportException aExc;
56 if( aRequest >>= aExc )
58 std::set< vcl::PDFWriter::ErrorCode > aCodes;
59 sal_Int32 nCodes = aExc.ErrorCodes.getLength();
60 for( sal_Int32 i = 0; i < nCodes; i++ )
61 aCodes.insert( static_cast<vcl::PDFWriter::ErrorCode>(aExc.ErrorCodes.getConstArray()[i]) );
63 ImplErrorDialog aDlg(Application::GetFrameWeld(m_xParent), aCodes);
64 aDlg.run();
65 bHandled = true;
67 return bHandled;
72 OUString SAL_CALL PDFInteractionHandler::getImplementationName()
74 return u"com.sun.star.comp.PDF.PDFExportInteractionHandler"_ustr;
78 sal_Bool SAL_CALL PDFInteractionHandler::supportsService( const OUString& rServiceName )
80 return cppu::supportsService( this, rServiceName );
84 css::uno::Sequence< OUString > SAL_CALL PDFInteractionHandler::getSupportedServiceNames( )
86 return { u"com.sun.star.filter.pdfexport.PDFExportInteractionHandler"_ustr };
89 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
90 filter_PDFExportInteractionHandler_get_implementation(
91 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
93 return cppu::acquire(new PDFInteractionHandler());
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */