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