1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_filter.hxx"
31 #include "pdfinteract.hxx"
32 #include "impdialog.hxx"
34 #include "com/sun/star/task/XInteractionRequest.hpp"
35 #include "com/sun/star/task/PDFExportException.hpp"
38 // - PDFInteractionHandler -
41 PDFInteractionHandler::PDFInteractionHandler( const Reference
< XMultiServiceFactory
> &rxMSF
) :
46 // -----------------------------------------------------------------------------
48 PDFInteractionHandler::~PDFInteractionHandler()
53 void SAL_CALL
PDFInteractionHandler::handle( const Reference
< task::XInteractionRequest
>& i_xRequest
)
54 throw (RuntimeException
)
56 handleInteractionRequest( i_xRequest
);
59 sal_Bool SAL_CALL
PDFInteractionHandler::handleInteractionRequest( const Reference
< task::XInteractionRequest
>& i_xRequest
)
60 throw (RuntimeException
)
62 sal_Bool bHandled
= sal_False
;
64 Any
aRequest( i_xRequest
->getRequest() );
65 task::PDFExportException aExc
;
66 if( aRequest
>>= aExc
)
68 std::set
< vcl::PDFWriter::ErrorCode
> aCodes
;
69 sal_Int32 nCodes
= aExc
.ErrorCodes
.getLength();
70 for( sal_Int32 i
= 0; i
< nCodes
; i
++ )
71 aCodes
.insert( (vcl::PDFWriter::ErrorCode
)aExc
.ErrorCodes
.getConstArray()[i
] );
72 ImplErrorDialog
aDlg( aCodes
);
79 // -----------------------------------------------------------------------------
81 OUString
PDFInteractionHandler_getImplementationName ()
82 throw (RuntimeException
)
84 return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.PDF.PDFExportInteractionHandler" ) );
87 // -----------------------------------------------------------------------------
89 #define SERVICE_NAME "com.sun.star.filter.pdfexport.PDFExportInteractionHandler"
91 sal_Bool SAL_CALL
PDFInteractionHandler_supportsService( const OUString
& ServiceName
)
92 throw (RuntimeException
)
94 return ServiceName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME
) );
97 // -----------------------------------------------------------------------------
99 Sequence
< OUString
> SAL_CALL
PDFInteractionHandler_getSupportedServiceNames( ) throw (RuntimeException
)
101 Sequence
< OUString
> aRet(1);
102 OUString
* pArray
= aRet
.getArray();
103 pArray
[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME
) );
109 // -----------------------------------------------------------------------------
111 Reference
< XInterface
> SAL_CALL
PDFInteractionHandler_createInstance( const Reference
< XMultiServiceFactory
> & rSMgr
) throw( Exception
)
113 return (cppu::OWeakObject
*) new PDFInteractionHandler( rSMgr
);
116 // -----------------------------------------------------------------------------
118 OUString SAL_CALL
PDFInteractionHandler::getImplementationName()
119 throw (RuntimeException
)
121 return PDFInteractionHandler_getImplementationName();
124 // -----------------------------------------------------------------------------
126 sal_Bool SAL_CALL
PDFInteractionHandler::supportsService( const OUString
& rServiceName
)
127 throw (RuntimeException
)
129 return PDFInteractionHandler_supportsService( rServiceName
);
132 // -----------------------------------------------------------------------------
134 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
PDFInteractionHandler::getSupportedServiceNames( ) throw (RuntimeException
)
136 return PDFInteractionHandler_getSupportedServiceNames();