1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pdfdialog.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_filter.hxx"
34 #include "pdfdialog.hxx"
35 #include "impdialog.hxx"
36 #include <vcl/svapp.hxx>
37 #include <vcl/dialog.hxx>
38 #include <svtools/solar.hrc>
39 #include <com/sun/star/view/XRenderable.hpp>
41 using namespace ::rtl
;
42 using namespace ::vcl
;
43 using namespace ::com::sun::star
;
44 using namespace ::com::sun::star::uno
;
45 using namespace ::com::sun::star::lang
;
46 using namespace ::com::sun::star::beans
;
48 //uncomment this to use the Tabbed PDF dialog (under development !)
50 // -----------------------
51 // - PDFDialog functions -
52 // -----------------------
54 #define SERVICE_NAME "com.sun.star.document.PDFDialog"
56 // -----------------------------------------------------------------------------
58 OUString
PDFDialog_getImplementationName ()
59 throw (RuntimeException
)
61 return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.PDF.PDFDialog" ) );
64 // -----------------------------------------------------------------------------
66 Sequence
< sal_Int8
> SAL_CALL
PDFDialog_getImplementationId()
67 throw(RuntimeException
)
69 static ::cppu::OImplementationId aId
;
70 return aId
.getImplementationId();
73 // -----------------------------------------------------------------------------
75 Sequence
< OUString
> SAL_CALL
PDFDialog_getSupportedServiceNames()
76 throw (RuntimeException
)
78 Sequence
< OUString
> aRet(1);
79 OUString
* pArray
= aRet
.getArray();
80 pArray
[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME
) );
84 // -----------------------------------------------------------------------------
86 Reference
< XInterface
> SAL_CALL
PDFDialog_createInstance( const Reference
< XMultiServiceFactory
> & rSMgr
)
89 return (cppu::OWeakObject
*) new PDFDialog( rSMgr
);
92 // -----------------------------------------------------------------------------
100 PDFDialog::PDFDialog( const Reference
< XMultiServiceFactory
> &rxMSF
)
101 : PDFDialog_Base( rxMSF
)
103 ByteString
aResMgrName( "pdffilter" );
105 mpResMgr
= ResMgr::CreateResMgr( aResMgrName
.GetBuffer(), Application::GetSettings().GetUILocale() );
108 // -----------------------------------------------------------------------------
110 PDFDialog::~PDFDialog()
115 // -----------------------------------------------------------------------------
117 Sequence
< sal_Int8
> SAL_CALL
PDFDialog::getImplementationId()
118 throw(RuntimeException
)
120 return PDFDialog_getImplementationId();
123 // -----------------------------------------------------------------------------
125 OUString SAL_CALL
PDFDialog::getImplementationName()
126 throw (RuntimeException
)
128 return PDFDialog_getImplementationName();
131 // -----------------------------------------------------------------------------
133 Sequence
< OUString
> SAL_CALL
PDFDialog::getSupportedServiceNames()
134 throw (RuntimeException
)
136 return PDFDialog_getSupportedServiceNames();
139 // -----------------------------------------------------------------------------
141 Dialog
* PDFDialog::createDialog( Window
* pParent
)
145 if( mpResMgr
&& mxSrcDoc
.is() )
147 ImpPDFTabDialog
* pDlg
= new ImpPDFTabDialog( pParent
, *mpResMgr
, maFilterData
, mxSrcDoc
, m_aContext
.getLegacyServiceFactory() );
154 // -----------------------------------------------------------------------------
156 void PDFDialog::executedDialog( sal_Int16 nExecutionResult
)
158 if( nExecutionResult
&& m_pDialog
)
159 maFilterData
= static_cast< ImpPDFTabDialog
* >( m_pDialog
)->GetFilterData();
163 // -----------------------------------------------------------------------------
165 Reference
< XPropertySetInfo
> SAL_CALL
PDFDialog::getPropertySetInfo()
166 throw(RuntimeException
)
168 Reference
< XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
172 //-------------------------------------------------------------------------
173 ::cppu::IPropertyArrayHelper
& PDFDialog::getInfoHelper()
175 return *const_cast<PDFDialog
*>(this)->getArrayHelper();
178 //------------------------------------------------------------------------------
179 ::cppu::IPropertyArrayHelper
* PDFDialog::createArrayHelper() const
181 Sequence
< Property
> aProps
;
182 describeProperties(aProps
);
183 return new ::cppu::OPropertyArrayHelper( aProps
);
186 // -----------------------------------------------------------------------------
188 Sequence
< PropertyValue
> SAL_CALL
PDFDialog::getPropertyValues()
189 throw ( RuntimeException
)
193 for( i
= 0, nCount
= maMediaDescriptor
.getLength(); i
< nCount
; i
++ )
195 if( maMediaDescriptor
[ i
].Name
.equalsAscii( "FilterData" ) )
200 maMediaDescriptor
.realloc( ++nCount
);
202 maMediaDescriptor
[ i
].Name
= String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) );
203 maMediaDescriptor
[ i
].Value
<<= maFilterData
;
205 return maMediaDescriptor
;
208 // -----------------------------------------------------------------------------
210 void SAL_CALL
PDFDialog::setPropertyValues( const Sequence
< PropertyValue
>& rProps
)
211 throw ( UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
, RuntimeException
)
213 maMediaDescriptor
= rProps
;
215 for( sal_Int32 i
= 0, nCount
= maMediaDescriptor
.getLength(); i
< nCount
; i
++ )
217 if( maMediaDescriptor
[ i
].Name
.equalsAscii( "FilterData" ) )
219 maMediaDescriptor
[ i
].Value
>>= maFilterData
;
225 // -----------------------------------------------------------------------------
227 void SAL_CALL
PDFDialog::setSourceDocument( const Reference
< XComponent
>& xDoc
)
228 throw(IllegalArgumentException
, RuntimeException
)