1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
28 // - PDFInteractionHandler -
31 PDFInteractionHandler::PDFInteractionHandler( const Reference
< XMultiServiceFactory
> &rxMSF
) :
36 // -----------------------------------------------------------------------------
38 PDFInteractionHandler::~PDFInteractionHandler()
43 void SAL_CALL
PDFInteractionHandler::handle( const Reference
< task::XInteractionRequest
>& i_xRequest
)
44 throw (RuntimeException
)
46 handleInteractionRequest( i_xRequest
);
49 sal_Bool SAL_CALL
PDFInteractionHandler::handleInteractionRequest( const Reference
< task::XInteractionRequest
>& i_xRequest
)
50 throw (RuntimeException
)
52 sal_Bool bHandled
= sal_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( (vcl::PDFWriter::ErrorCode
)aExc
.ErrorCodes
.getConstArray()[i
] );
62 ImplErrorDialog
aDlg( aCodes
);
69 // -----------------------------------------------------------------------------
71 OUString
PDFInteractionHandler_getImplementationName ()
72 throw (RuntimeException
)
74 return OUString ( "com.sun.star.comp.PDF.PDFExportInteractionHandler" );
77 // -----------------------------------------------------------------------------
79 #define SERVICE_NAME "com.sun.star.filter.pdfexport.PDFExportInteractionHandler"
81 sal_Bool SAL_CALL
PDFInteractionHandler_supportsService( const OUString
& ServiceName
)
82 throw (RuntimeException
)
84 return ServiceName
== SERVICE_NAME
;
87 // -----------------------------------------------------------------------------
89 Sequence
< OUString
> SAL_CALL
PDFInteractionHandler_getSupportedServiceNames( ) throw (RuntimeException
)
91 Sequence
< OUString
> aRet(1);
92 OUString
* pArray
= aRet
.getArray();
93 pArray
[0] = SERVICE_NAME
;
99 // -----------------------------------------------------------------------------
101 Reference
< XInterface
> SAL_CALL
PDFInteractionHandler_createInstance( const Reference
< XMultiServiceFactory
> & rSMgr
) throw( Exception
)
103 return (cppu::OWeakObject
*) new PDFInteractionHandler( rSMgr
);
106 // -----------------------------------------------------------------------------
108 OUString SAL_CALL
PDFInteractionHandler::getImplementationName()
109 throw (RuntimeException
)
111 return PDFInteractionHandler_getImplementationName();
114 // -----------------------------------------------------------------------------
116 sal_Bool SAL_CALL
PDFInteractionHandler::supportsService( const OUString
& rServiceName
)
117 throw (RuntimeException
)
119 return PDFInteractionHandler_supportsService( rServiceName
);
122 // -----------------------------------------------------------------------------
124 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
PDFInteractionHandler::getSupportedServiceNames( ) throw (RuntimeException
)
126 return PDFInteractionHandler_getSupportedServiceNames();
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */