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 "pdfdialog.hxx"
31 : : #include "impdialog.hxx"
32 : : #include <vcl/svapp.hxx>
33 : : #include <vcl/dialog.hxx>
34 : : #include <svl/solar.hrc>
35 : : #include <com/sun/star/view/XRenderable.hpp>
36 : :
37 : : using namespace ::rtl;
38 : : using namespace ::vcl;
39 : : using namespace ::com::sun::star;
40 : : using namespace ::com::sun::star::uno;
41 : : using namespace ::com::sun::star::lang;
42 : : using namespace ::com::sun::star::beans;
43 : :
44 : : // -----------------------
45 : : // - PDFDialog functions -
46 : : // -----------------------
47 : :
48 : : #define SERVICE_NAME "com.sun.star.document.PDFDialog"
49 : :
50 : : // -----------------------------------------------------------------------------
51 : :
52 : 0 : OUString PDFDialog_getImplementationName ()
53 : : throw (RuntimeException)
54 : : {
55 : 0 : return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.PDF.PDFDialog" ) );
56 : : }
57 : :
58 : : // -----------------------------------------------------------------------------
59 : :
60 : 0 : Sequence< sal_Int8 > SAL_CALL PDFDialog_getImplementationId()
61 : : throw(RuntimeException)
62 : : {
63 : 0 : static ::cppu::OImplementationId aId;
64 : 0 : return aId.getImplementationId();
65 : : }
66 : :
67 : : // -----------------------------------------------------------------------------
68 : :
69 : 0 : Sequence< OUString > SAL_CALL PDFDialog_getSupportedServiceNames()
70 : : throw (RuntimeException)
71 : : {
72 : 0 : Sequence < OUString > aRet(1);
73 : 0 : OUString* pArray = aRet.getArray();
74 : 0 : pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
75 : 0 : return aRet;
76 : : }
77 : :
78 : : // -----------------------------------------------------------------------------
79 : :
80 : 0 : Reference< XInterface > SAL_CALL PDFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
81 : : throw( Exception )
82 : : {
83 : 0 : return (cppu::OWeakObject*) new PDFDialog( rSMgr );
84 : : }
85 : :
86 : : // -----------------------------------------------------------------------------
87 : :
88 : : #undef SERVICE_NAME
89 : :
90 : : // -------------
91 : : // - PDFDialog -
92 : : // -------------
93 : :
94 : 0 : PDFDialog::PDFDialog( const Reference< XMultiServiceFactory > &rxMSF )
95 : 0 : : PDFDialog_Base( rxMSF )
96 : : {
97 : 0 : }
98 : :
99 : : // -----------------------------------------------------------------------------
100 : :
101 : 0 : PDFDialog::~PDFDialog()
102 : : {
103 : 0 : }
104 : :
105 : : // -----------------------------------------------------------------------------
106 : :
107 : 0 : Sequence< sal_Int8 > SAL_CALL PDFDialog::getImplementationId()
108 : : throw(RuntimeException)
109 : : {
110 : 0 : return PDFDialog_getImplementationId();
111 : : }
112 : :
113 : : // -----------------------------------------------------------------------------
114 : :
115 : 0 : OUString SAL_CALL PDFDialog::getImplementationName()
116 : : throw (RuntimeException)
117 : : {
118 : 0 : return PDFDialog_getImplementationName();
119 : : }
120 : :
121 : : // -----------------------------------------------------------------------------
122 : :
123 : 0 : Sequence< OUString > SAL_CALL PDFDialog::getSupportedServiceNames()
124 : : throw (RuntimeException)
125 : : {
126 : 0 : return PDFDialog_getSupportedServiceNames();
127 : : }
128 : :
129 : : // -----------------------------------------------------------------------------
130 : :
131 : 0 : Dialog* PDFDialog::createDialog( Window* pParent )
132 : : {
133 : 0 : Dialog* pRet = NULL;
134 : :
135 : 0 : if( mxSrcDoc.is() )
136 : : {
137 : 0 : ImpPDFTabDialog* pDlg = new ImpPDFTabDialog( pParent, maFilterData, mxSrcDoc, m_aContext.getLegacyServiceFactory() );
138 : 0 : pRet = pDlg;
139 : : }
140 : :
141 : 0 : return pRet;
142 : : }
143 : :
144 : : // -----------------------------------------------------------------------------
145 : :
146 : 0 : void PDFDialog::executedDialog( sal_Int16 nExecutionResult )
147 : : {
148 : 0 : if( nExecutionResult && m_pDialog )
149 : 0 : maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog )->GetFilterData();
150 : 0 : destroyDialog();
151 : 0 : }
152 : :
153 : : // -----------------------------------------------------------------------------
154 : :
155 : 0 : Reference< XPropertySetInfo > SAL_CALL PDFDialog::getPropertySetInfo()
156 : : throw(RuntimeException)
157 : : {
158 : 0 : Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
159 : 0 : return xInfo;
160 : : }
161 : :
162 : : //-------------------------------------------------------------------------
163 : 0 : ::cppu::IPropertyArrayHelper& PDFDialog::getInfoHelper()
164 : : {
165 : 0 : return *const_cast<PDFDialog*>(this)->getArrayHelper();
166 : : }
167 : :
168 : : //------------------------------------------------------------------------------
169 : 0 : ::cppu::IPropertyArrayHelper* PDFDialog::createArrayHelper() const
170 : : {
171 : 0 : Sequence< Property > aProps;
172 : 0 : describeProperties(aProps);
173 : 0 : return new ::cppu::OPropertyArrayHelper( aProps );
174 : : }
175 : :
176 : : // -----------------------------------------------------------------------------
177 : :
178 : 0 : Sequence< PropertyValue > SAL_CALL PDFDialog::getPropertyValues()
179 : : throw ( RuntimeException )
180 : : {
181 : : sal_Int32 i, nCount;
182 : :
183 : 0 : for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
184 : : {
185 : 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
186 : 0 : break;
187 : : }
188 : :
189 : 0 : if( i == nCount )
190 : 0 : maMediaDescriptor.realloc( ++nCount );
191 : :
192 : 0 : maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) );
193 : 0 : maMediaDescriptor[ i ].Value <<= maFilterData;
194 : :
195 : 0 : return maMediaDescriptor;
196 : : }
197 : :
198 : : // -----------------------------------------------------------------------------
199 : :
200 : 0 : void SAL_CALL PDFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
201 : : throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
202 : : {
203 : 0 : maMediaDescriptor = rProps;
204 : :
205 : 0 : for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
206 : : {
207 : 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
208 : : {
209 : 0 : maMediaDescriptor[ i ].Value >>= maFilterData;
210 : 0 : break;
211 : : }
212 : : }
213 : 0 : }
214 : :
215 : : // -----------------------------------------------------------------------------
216 : :
217 : 0 : void SAL_CALL PDFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
218 : : throw(IllegalArgumentException, RuntimeException)
219 : : {
220 : 0 : mxSrcDoc = xDoc;
221 : 0 : }
222 : :
223 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|