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 "pdfdialog.hxx"
22 #include "impdialog.hxx"
23 #include <vcl/svapp.hxx>
24 #include <vcl/dialog.hxx>
25 #include <svl/solar.hrc>
26 #include <com/sun/star/view/XRenderable.hpp>
28 using namespace ::rtl
;
29 using namespace ::vcl
;
30 using namespace ::com::sun::star
;
31 using namespace ::com::sun::star::uno
;
32 using namespace ::com::sun::star::lang
;
33 using namespace ::com::sun::star::beans
;
35 // -----------------------
36 // - PDFDialog functions -
37 // -----------------------
39 #define SERVICE_NAME "com.sun.star.document.PDFDialog"
41 // -----------------------------------------------------------------------------
43 OUString
PDFDialog_getImplementationName ()
44 throw (RuntimeException
)
46 return OUString ( "com.sun.star.comp.PDF.PDFDialog" );
49 // -----------------------------------------------------------------------------
51 Sequence
< sal_Int8
> SAL_CALL
PDFDialog_getImplementationId()
52 throw(RuntimeException
)
54 static ::cppu::OImplementationId aId
;
55 return aId
.getImplementationId();
58 // -----------------------------------------------------------------------------
60 Sequence
< OUString
> SAL_CALL
PDFDialog_getSupportedServiceNames()
61 throw (RuntimeException
)
63 Sequence
< OUString
> aRet(1);
64 OUString
* pArray
= aRet
.getArray();
65 pArray
[0] = SERVICE_NAME
;
69 // -----------------------------------------------------------------------------
71 Reference
< XInterface
> SAL_CALL
PDFDialog_createInstance( const Reference
< XMultiServiceFactory
> & rSMgr
)
74 return (cppu::OWeakObject
*) new PDFDialog( comphelper::getComponentContext(rSMgr
) );
77 // -----------------------------------------------------------------------------
85 PDFDialog::PDFDialog( const Reference
< XComponentContext
> &rxContext
)
86 : PDFDialog_Base( rxContext
)
90 // -----------------------------------------------------------------------------
92 PDFDialog::~PDFDialog()
96 // -----------------------------------------------------------------------------
98 Sequence
< sal_Int8
> SAL_CALL
PDFDialog::getImplementationId()
99 throw(RuntimeException
)
101 return PDFDialog_getImplementationId();
104 // -----------------------------------------------------------------------------
106 OUString SAL_CALL
PDFDialog::getImplementationName()
107 throw (RuntimeException
)
109 return PDFDialog_getImplementationName();
112 // -----------------------------------------------------------------------------
114 Sequence
< OUString
> SAL_CALL
PDFDialog::getSupportedServiceNames()
115 throw (RuntimeException
)
117 return PDFDialog_getSupportedServiceNames();
120 // -----------------------------------------------------------------------------
122 Dialog
* PDFDialog::createDialog( Window
* pParent
)
128 ImpPDFTabDialog
* pDlg
= new ImpPDFTabDialog( pParent
, maFilterData
, mxSrcDoc
, uno::Reference
<lang::XMultiServiceFactory
>(m_aContext
->getServiceManager(), uno::UNO_QUERY_THROW
) );
135 // -----------------------------------------------------------------------------
137 void PDFDialog::executedDialog( sal_Int16 nExecutionResult
)
139 if( nExecutionResult
&& m_pDialog
)
140 maFilterData
= static_cast< ImpPDFTabDialog
* >( m_pDialog
)->GetFilterData();
144 // -----------------------------------------------------------------------------
146 Reference
< XPropertySetInfo
> SAL_CALL
PDFDialog::getPropertySetInfo()
147 throw(RuntimeException
)
149 Reference
< XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
153 //-------------------------------------------------------------------------
154 ::cppu::IPropertyArrayHelper
& PDFDialog::getInfoHelper()
156 return *const_cast<PDFDialog
*>(this)->getArrayHelper();
159 //------------------------------------------------------------------------------
160 ::cppu::IPropertyArrayHelper
* PDFDialog::createArrayHelper() const
162 Sequence
< Property
> aProps
;
163 describeProperties(aProps
);
164 return new ::cppu::OPropertyArrayHelper( aProps
);
167 // -----------------------------------------------------------------------------
169 Sequence
< PropertyValue
> SAL_CALL
PDFDialog::getPropertyValues()
170 throw ( RuntimeException
)
174 for( i
= 0, nCount
= maMediaDescriptor
.getLength(); i
< nCount
; i
++ )
176 if ( maMediaDescriptor
[ i
].Name
== "FilterData" )
181 maMediaDescriptor
.realloc( ++nCount
);
183 maMediaDescriptor
[ i
].Name
= "FilterData";
184 maMediaDescriptor
[ i
].Value
<<= maFilterData
;
186 return maMediaDescriptor
;
189 // -----------------------------------------------------------------------------
191 void SAL_CALL
PDFDialog::setPropertyValues( const Sequence
< PropertyValue
>& rProps
)
192 throw ( UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
, RuntimeException
)
194 maMediaDescriptor
= rProps
;
196 for( sal_Int32 i
= 0, nCount
= maMediaDescriptor
.getLength(); i
< nCount
; i
++ )
198 if ( maMediaDescriptor
[ i
].Name
== "FilterData" )
200 maMediaDescriptor
[ i
].Value
>>= maFilterData
;
206 // -----------------------------------------------------------------------------
208 void SAL_CALL
PDFDialog::setSourceDocument( const Reference
< XComponent
>& xDoc
)
209 throw(IllegalArgumentException
, RuntimeException
)
214 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */