Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "pdfinteract.hxx"
31 : : #include "impdialog.hxx"
32 : :
33 : : #include "com/sun/star/task/XInteractionRequest.hpp"
34 : : #include "com/sun/star/task/PDFExportException.hpp"
35 : :
36 : : // -------------
37 : : // - PDFInteractionHandler -
38 : : // -------------
39 : :
40 : 0 : PDFInteractionHandler::PDFInteractionHandler( const Reference< XMultiServiceFactory > &rxMSF ) :
41 : 0 : mxMSF( rxMSF )
42 : : {
43 : 0 : }
44 : :
45 : : // -----------------------------------------------------------------------------
46 : :
47 : 0 : PDFInteractionHandler::~PDFInteractionHandler()
48 : : {
49 : 0 : }
50 : :
51 : :
52 : 0 : void SAL_CALL PDFInteractionHandler::handle( const Reference< task::XInteractionRequest >& i_xRequest )
53 : : throw (RuntimeException)
54 : : {
55 : 0 : handleInteractionRequest( i_xRequest );
56 : 0 : }
57 : :
58 : 0 : sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Reference< task::XInteractionRequest >& i_xRequest )
59 : : throw (RuntimeException)
60 : : {
61 : 0 : sal_Bool bHandled = sal_False;
62 : :
63 : 0 : Any aRequest( i_xRequest->getRequest() );
64 : 0 : task::PDFExportException aExc;
65 : 0 : if( aRequest >>= aExc )
66 : : {
67 : 0 : std::set< vcl::PDFWriter::ErrorCode > aCodes;
68 : 0 : sal_Int32 nCodes = aExc.ErrorCodes.getLength();
69 : 0 : for( sal_Int32 i = 0; i < nCodes; i++ )
70 : 0 : aCodes.insert( (vcl::PDFWriter::ErrorCode)aExc.ErrorCodes.getConstArray()[i] );
71 : 0 : ImplErrorDialog aDlg( aCodes );
72 : 0 : aDlg.Execute();
73 : 0 : bHandled = sal_True;
74 : : }
75 : 0 : return bHandled;
76 : : }
77 : :
78 : : // -----------------------------------------------------------------------------
79 : :
80 : 0 : OUString PDFInteractionHandler_getImplementationName ()
81 : : throw (RuntimeException)
82 : : {
83 : 0 : return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.PDF.PDFExportInteractionHandler" ) );
84 : : }
85 : :
86 : : // -----------------------------------------------------------------------------
87 : :
88 : : #define SERVICE_NAME "com.sun.star.filter.pdfexport.PDFExportInteractionHandler"
89 : :
90 : 0 : sal_Bool SAL_CALL PDFInteractionHandler_supportsService( const OUString& ServiceName )
91 : : throw (RuntimeException)
92 : : {
93 : 0 : return ServiceName == SERVICE_NAME;
94 : : }
95 : :
96 : : // -----------------------------------------------------------------------------
97 : :
98 : 0 : Sequence< OUString > SAL_CALL PDFInteractionHandler_getSupportedServiceNames( ) throw (RuntimeException)
99 : : {
100 : 0 : Sequence < OUString > aRet(1);
101 : 0 : OUString* pArray = aRet.getArray();
102 : 0 : pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
103 : 0 : return aRet;
104 : : }
105 : :
106 : : #undef SERVICE_NAME
107 : :
108 : : // -----------------------------------------------------------------------------
109 : :
110 : 0 : Reference< XInterface > SAL_CALL PDFInteractionHandler_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception )
111 : : {
112 : 0 : return (cppu::OWeakObject*) new PDFInteractionHandler( rSMgr );
113 : : }
114 : :
115 : : // -----------------------------------------------------------------------------
116 : :
117 : 0 : OUString SAL_CALL PDFInteractionHandler::getImplementationName()
118 : : throw (RuntimeException)
119 : : {
120 : 0 : return PDFInteractionHandler_getImplementationName();
121 : : }
122 : :
123 : : // -----------------------------------------------------------------------------
124 : :
125 : 0 : sal_Bool SAL_CALL PDFInteractionHandler::supportsService( const OUString& rServiceName )
126 : : throw (RuntimeException)
127 : : {
128 : 0 : return PDFInteractionHandler_supportsService( rServiceName );
129 : : }
130 : :
131 : : // -----------------------------------------------------------------------------
132 : :
133 : 0 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL PDFInteractionHandler::getSupportedServiceNames( ) throw (RuntimeException)
134 : : {
135 : 0 : return PDFInteractionHandler_getSupportedServiceNames();
136 : : }
137 : :
138 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|