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 :
27 : // -------------
28 : // - PDFInteractionHandler -
29 : // -------------
30 :
31 0 : PDFInteractionHandler::PDFInteractionHandler()
32 : {
33 0 : }
34 :
35 : // -----------------------------------------------------------------------------
36 :
37 0 : PDFInteractionHandler::~PDFInteractionHandler()
38 : {
39 0 : }
40 :
41 :
42 0 : void SAL_CALL PDFInteractionHandler::handle( const Reference< task::XInteractionRequest >& i_xRequest )
43 : throw (RuntimeException)
44 : {
45 0 : handleInteractionRequest( i_xRequest );
46 0 : }
47 :
48 0 : sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Reference< task::XInteractionRequest >& i_xRequest )
49 : throw (RuntimeException)
50 : {
51 0 : sal_Bool bHandled = sal_False;
52 :
53 0 : Any aRequest( i_xRequest->getRequest() );
54 0 : task::PDFExportException aExc;
55 0 : if( aRequest >>= aExc )
56 : {
57 0 : std::set< vcl::PDFWriter::ErrorCode > aCodes;
58 0 : sal_Int32 nCodes = aExc.ErrorCodes.getLength();
59 0 : for( sal_Int32 i = 0; i < nCodes; i++ )
60 0 : aCodes.insert( (vcl::PDFWriter::ErrorCode)aExc.ErrorCodes.getConstArray()[i] );
61 0 : ImplErrorDialog aDlg( aCodes );
62 0 : aDlg.Execute();
63 0 : bHandled = sal_True;
64 : }
65 0 : return bHandled;
66 : }
67 :
68 : // -----------------------------------------------------------------------------
69 :
70 0 : OUString PDFInteractionHandler_getImplementationName ()
71 : throw (RuntimeException)
72 : {
73 0 : return OUString ( "com.sun.star.comp.PDF.PDFExportInteractionHandler" );
74 : }
75 :
76 : // -----------------------------------------------------------------------------
77 :
78 : #define SERVICE_NAME "com.sun.star.filter.pdfexport.PDFExportInteractionHandler"
79 :
80 0 : sal_Bool SAL_CALL PDFInteractionHandler_supportsService( const OUString& ServiceName )
81 : throw (RuntimeException)
82 : {
83 0 : return ServiceName == SERVICE_NAME;
84 : }
85 :
86 : // -----------------------------------------------------------------------------
87 :
88 0 : Sequence< OUString > SAL_CALL PDFInteractionHandler_getSupportedServiceNames( ) throw (RuntimeException)
89 : {
90 0 : Sequence < OUString > aRet(1);
91 0 : OUString* pArray = aRet.getArray();
92 0 : pArray[0] = SERVICE_NAME;
93 0 : return aRet;
94 : }
95 :
96 : #undef SERVICE_NAME
97 :
98 : // -----------------------------------------------------------------------------
99 :
100 0 : Reference< XInterface > SAL_CALL PDFInteractionHandler_createInstance( const Reference< XMultiServiceFactory > & ) throw( Exception )
101 : {
102 0 : return (cppu::OWeakObject*) new PDFInteractionHandler;
103 : }
104 :
105 : // -----------------------------------------------------------------------------
106 :
107 0 : OUString SAL_CALL PDFInteractionHandler::getImplementationName()
108 : throw (RuntimeException)
109 : {
110 0 : return PDFInteractionHandler_getImplementationName();
111 : }
112 :
113 : // -----------------------------------------------------------------------------
114 :
115 0 : sal_Bool SAL_CALL PDFInteractionHandler::supportsService( const OUString& rServiceName )
116 : throw (RuntimeException)
117 : {
118 0 : return PDFInteractionHandler_supportsService( rServiceName );
119 : }
120 :
121 : // -----------------------------------------------------------------------------
122 :
123 0 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL PDFInteractionHandler::getSupportedServiceNames( ) throw (RuntimeException)
124 : {
125 0 : return PDFInteractionHandler_getSupportedServiceNames();
126 0 : }
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|