Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include "pdfinteract.hxx"
22 : #include "impdialog.hxx"
23 :
24 : #include "com/sun/star/task/XInteractionRequest.hpp"
25 : #include "com/sun/star/task/PDFExportException.hpp"
26 : #include <cppuhelper/supportsservice.hxx>
27 :
28 : // - PDFInteractionHandler -
29 0 : PDFInteractionHandler::PDFInteractionHandler()
30 : {
31 0 : }
32 :
33 0 : PDFInteractionHandler::~PDFInteractionHandler()
34 : {
35 0 : }
36 :
37 0 : void SAL_CALL PDFInteractionHandler::handle( const Reference< task::XInteractionRequest >& i_xRequest )
38 : throw (RuntimeException, std::exception)
39 : {
40 0 : handleInteractionRequest( i_xRequest );
41 0 : }
42 :
43 0 : sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Reference< task::XInteractionRequest >& i_xRequest )
44 : throw (RuntimeException, std::exception)
45 : {
46 0 : bool bHandled = false;
47 :
48 0 : Any aRequest( i_xRequest->getRequest() );
49 0 : task::PDFExportException aExc;
50 0 : if( aRequest >>= aExc )
51 : {
52 0 : std::set< vcl::PDFWriter::ErrorCode > aCodes;
53 0 : sal_Int32 nCodes = aExc.ErrorCodes.getLength();
54 0 : for( sal_Int32 i = 0; i < nCodes; i++ )
55 0 : aCodes.insert( (vcl::PDFWriter::ErrorCode)aExc.ErrorCodes.getConstArray()[i] );
56 0 : ScopedVclPtrInstance< ImplErrorDialog > aDlg( aCodes );
57 0 : aDlg->Execute();
58 0 : bHandled = true;
59 : }
60 0 : return bHandled;
61 : }
62 :
63 0 : OUString PDFInteractionHandler_getImplementationName ()
64 : throw (RuntimeException)
65 : {
66 0 : return OUString ( "com.sun.star.comp.PDF.PDFExportInteractionHandler" );
67 : }
68 :
69 0 : Sequence< OUString > SAL_CALL PDFInteractionHandler_getSupportedServiceNames( ) throw (RuntimeException)
70 : {
71 0 : Sequence < OUString > aRet(1);
72 0 : OUString* pArray = aRet.getArray();
73 0 : pArray[0] = "com.sun.star.filter.pdfexport.PDFExportInteractionHandler";
74 0 : return aRet;
75 : }
76 :
77 0 : Reference< XInterface > SAL_CALL PDFInteractionHandler_createInstance( const Reference< XMultiServiceFactory > & ) throw( Exception )
78 : {
79 0 : return static_cast<cppu::OWeakObject*>(new PDFInteractionHandler);
80 : }
81 :
82 0 : OUString SAL_CALL PDFInteractionHandler::getImplementationName()
83 : throw (RuntimeException, std::exception)
84 : {
85 0 : return PDFInteractionHandler_getImplementationName();
86 : }
87 :
88 0 : sal_Bool SAL_CALL PDFInteractionHandler::supportsService( const OUString& rServiceName )
89 : throw (RuntimeException, std::exception)
90 : {
91 0 : return cppu::supportsService( this, rServiceName );
92 : }
93 :
94 0 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL PDFInteractionHandler::getSupportedServiceNames( ) throw (RuntimeException, std::exception)
95 : {
96 0 : return PDFInteractionHandler_getSupportedServiceNames();
97 3 : }
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|