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 "swfdialog.hxx"
31 : : #include "impswfdialog.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 : : #include <com/sun/star/frame/XController.hpp>
37 : : #include <com/sun/star/view/XSelectionSupplier.hpp>
38 : :
39 : : using namespace ::rtl;
40 : : using namespace ::vcl;
41 : : using namespace ::com::sun::star;
42 : : using namespace ::com::sun::star::uno;
43 : : using namespace ::com::sun::star::lang;
44 : : using namespace ::com::sun::star::beans;
45 : : using namespace ::com::sun::star::frame;
46 : : using namespace ::com::sun::star::view;
47 : : using namespace ::com::sun::star::document;
48 : :
49 : : // -----------------------
50 : : // - PDFDialog functions -
51 : : // -----------------------
52 : :
53 : : #define SERVICE_NAME "com.sun.star.Impress.FlashExportDialog"
54 : :
55 : : // -----------------------------------------------------------------------------
56 : :
57 : 0 : OUString SWFDialog_getImplementationName ()
58 : : throw (RuntimeException)
59 : : {
60 : 0 : return OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
61 : : }
62 : :
63 : : // -----------------------------------------------------------------------------
64 : :
65 : 0 : Sequence< sal_Int8 > SAL_CALL SWFDialog_getImplementationId()
66 : : throw(RuntimeException)
67 : : {
68 : 0 : static ::cppu::OImplementationId aId;
69 : 0 : return aId.getImplementationId();
70 : : }
71 : :
72 : : // -----------------------------------------------------------------------------
73 : :
74 : 0 : Sequence< OUString > SAL_CALL SWFDialog_getSupportedServiceNames()
75 : : throw (RuntimeException)
76 : : {
77 : 0 : Sequence < OUString > aRet(1);
78 : 0 : OUString* pArray = aRet.getArray();
79 : 0 : pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
80 : 0 : return aRet;
81 : : }
82 : :
83 : : // -----------------------------------------------------------------------------
84 : :
85 : 0 : Reference< XInterface > SAL_CALL SWFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
86 : : throw( Exception )
87 : : {
88 : 0 : return (cppu::OWeakObject*) new SWFDialog( rSMgr );
89 : : }
90 : :
91 : : // -----------------------------------------------------------------------------
92 : :
93 : : #undef SERVICE_NAME
94 : :
95 : : // -------------
96 : : // - SWFDialog -
97 : : // -------------
98 : :
99 : 0 : SWFDialog::SWFDialog( const Reference< XMultiServiceFactory > &rxMSF ) :
100 : 0 : OGenericUnoDialog( rxMSF )
101 : : {
102 : 0 : mpResMgr = ResMgr::CreateResMgr( "flash", Application::GetSettings().GetUILocale() );
103 : 0 : }
104 : :
105 : : // -----------------------------------------------------------------------------
106 : :
107 : 0 : SWFDialog::~SWFDialog()
108 : : {
109 : 0 : delete mpResMgr;
110 : 0 : }
111 : :
112 : : // -----------------------------------------------------------------------------
113 : :
114 : 0 : Any SAL_CALL SWFDialog::queryInterface( const Type& rType )
115 : : throw (RuntimeException)
116 : : {
117 : 0 : Any aReturn = OGenericUnoDialog::queryInterface( rType );
118 : :
119 : 0 : if( !aReturn.hasValue() )
120 : : aReturn = ::cppu::queryInterface( rType,
121 : : static_cast< XPropertyAccess* >( this ),
122 : 0 : static_cast< XExporter* >( this ) );
123 : :
124 : 0 : return aReturn;
125 : : }
126 : :
127 : : // -----------------------------------------------------------------------------
128 : :
129 : 0 : void SAL_CALL SWFDialog::acquire()
130 : : throw ()
131 : : {
132 : 0 : OWeakObject::acquire();
133 : 0 : }
134 : :
135 : : // -----------------------------------------------------------------------------
136 : :
137 : 0 : void SAL_CALL SWFDialog::release()
138 : : throw ()
139 : : {
140 : 0 : OWeakObject::release();
141 : 0 : }
142 : :
143 : : // -----------------------------------------------------------------------------
144 : :
145 : 0 : Sequence< sal_Int8 > SAL_CALL SWFDialog::getImplementationId()
146 : : throw(RuntimeException)
147 : : {
148 : 0 : return SWFDialog_getImplementationId();
149 : : }
150 : :
151 : : // -----------------------------------------------------------------------------
152 : :
153 : 0 : OUString SAL_CALL SWFDialog::getImplementationName()
154 : : throw (RuntimeException)
155 : : {
156 : 0 : return SWFDialog_getImplementationName();
157 : : }
158 : :
159 : : // -----------------------------------------------------------------------------
160 : :
161 : 0 : Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames()
162 : : throw (RuntimeException)
163 : : {
164 : 0 : return SWFDialog_getSupportedServiceNames();
165 : : }
166 : :
167 : : // -----------------------------------------------------------------------------
168 : :
169 : 0 : Dialog* SWFDialog::createDialog( Window* pParent )
170 : : {
171 : 0 : Dialog* pRet = NULL;
172 : :
173 : 0 : if( mpResMgr && mxSrcDoc.is() )
174 : : {
175 : : /* TODO: From the controler we may get information what page is visible and what shapes
176 : : are selected, if we optionaly want to limit output to that
177 : : Any aSelection;
178 : :
179 : : try
180 : : {
181 : : Reference< XController > xController( Reference< XModel >( mxSrcDoc, UNO_QUERY )->getCurrentController() );
182 : :
183 : : if( xController.is() )
184 : : {
185 : : Reference< XSelectionSupplier > xView( xController, UNO_QUERY );
186 : :
187 : : if( xView.is() )
188 : : xView->getSelection() >>= aSelection;
189 : : }
190 : : }
191 : : catch( RuntimeException )
192 : : {
193 : : }
194 : : */
195 : 0 : ImpSWFDialog* pDlg = new ImpSWFDialog( pParent, *mpResMgr, maFilterData );
196 : 0 : pRet = pDlg;
197 : : }
198 : :
199 : 0 : return pRet;
200 : : }
201 : :
202 : : // -----------------------------------------------------------------------------
203 : :
204 : 0 : void SWFDialog::executedDialog( sal_Int16 nExecutionResult )
205 : : {
206 : 0 : if( nExecutionResult && m_pDialog )
207 : 0 : maFilterData = static_cast< ImpSWFDialog* >( m_pDialog )->GetFilterData();
208 : :
209 : 0 : destroyDialog();
210 : 0 : }
211 : :
212 : : // -----------------------------------------------------------------------------
213 : :
214 : 0 : Reference< XPropertySetInfo > SAL_CALL SWFDialog::getPropertySetInfo()
215 : : throw(RuntimeException)
216 : : {
217 : 0 : Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
218 : 0 : return xInfo;
219 : : }
220 : :
221 : : //-------------------------------------------------------------------------
222 : 0 : ::cppu::IPropertyArrayHelper& SWFDialog::getInfoHelper()
223 : : {
224 : 0 : return *const_cast<SWFDialog*>(this)->getArrayHelper();
225 : : }
226 : :
227 : : //------------------------------------------------------------------------------
228 : 0 : ::cppu::IPropertyArrayHelper* SWFDialog::createArrayHelper() const
229 : : {
230 : 0 : Sequence< Property > aProps;
231 : 0 : describeProperties(aProps);
232 : 0 : return new ::cppu::OPropertyArrayHelper( aProps );
233 : : }
234 : :
235 : : // -----------------------------------------------------------------------------
236 : :
237 : 0 : Sequence< PropertyValue > SAL_CALL SWFDialog::getPropertyValues()
238 : : throw ( RuntimeException )
239 : : {
240 : : sal_Int32 i, nCount;
241 : :
242 : 0 : for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
243 : : {
244 : 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
245 : 0 : break;
246 : : }
247 : :
248 : 0 : if( i == nCount )
249 : 0 : maMediaDescriptor.realloc( ++nCount );
250 : :
251 : 0 : maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) );
252 : 0 : maMediaDescriptor[ i ].Value <<= maFilterData;
253 : :
254 : 0 : return maMediaDescriptor;
255 : : }
256 : :
257 : : // -----------------------------------------------------------------------------
258 : :
259 : 0 : void SAL_CALL SWFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
260 : : throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
261 : : {
262 : 0 : maMediaDescriptor = rProps;
263 : :
264 : 0 : for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
265 : : {
266 : 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
267 : : {
268 : 0 : maMediaDescriptor[ i ].Value >>= maFilterData;
269 : 0 : break;
270 : : }
271 : : }
272 : 0 : }
273 : :
274 : : // -----------------------------------------------------------------------------
275 : :
276 : 0 : void SAL_CALL SWFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
277 : : throw(IllegalArgumentException, RuntimeException)
278 : : {
279 : 0 : mxSrcDoc = xDoc;
280 : 0 : }
281 : :
282 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|