xref: /trunk/main/filter/source/flash/swffilter.cxx (revision 07a3d7f1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_filter.hxx"
26 #include <com/sun/star/frame/XDesktop.hpp>
27 #include <com/sun/star/frame/XStorable.hpp>
28 #include <com/sun/star/document/XFilter.hpp>
29 #include <com/sun/star/document/XExporter.hpp>
30 #include <com/sun/star/lang/XInitialization.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
33 #include <com/sun/star/drawing/XDrawView.hpp>
34 #include <com/sun/star/container/XIndexAccess.hpp>
35 #include <com/sun/star/frame/XModel.hpp>
36 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
37 #include <com/sun/star/io/XOutputStream.hpp>
38 
39 #include <com/sun/star/drawing/XDrawPage.hpp>
40 #include <com/sun/star/drawing/XShapes.hpp>
41 #include <com/sun/star/frame/XDesktop.hdl>
42 #include <com/sun/star/frame/XController.hdl>
43 #include <com/sun/star/view/XSelectionSupplier.hpp>
44 
45 #include <cppuhelper/implbase1.hxx>
46 #include <cppuhelper/implbase4.hxx>
47 #include <osl/file.hxx>
48 
49 #include "swfexporter.hxx"
50 
51 //#include <stdlib.h>
52 //#include <windows.h>
53 #include <string.h>
54 
55 using namespace ::com::sun::star::uno;
56 using namespace ::com::sun::star::frame;
57 using namespace ::com::sun::star::lang;
58 using namespace ::com::sun::star::drawing;
59 using namespace ::com::sun::star::presentation;
60 using namespace ::com::sun::star::task;
61 using namespace ::com::sun::star::view;
62 
63 using ::rtl::OUString;
64 using ::rtl::OString;
65 using ::com::sun::star::lang::XComponent;
66 using ::com::sun::star::beans::PropertyValue;
67 using ::com::sun::star::io::XOutputStream;
68 using ::com::sun::star::container::XIndexAccess;
69 using ::osl::FileBase;
70 using ::com::sun::star::frame::XModel;
71 
72 namespace swf {
73 
74 typedef ::cppu::WeakImplHelper1<com::sun::star::io::XOutputStream> OslOutputStreamWrapper_Base;
75     // needed for some compilers
76 class OslOutputStreamWrapper : public OslOutputStreamWrapper_Base
77 {
78 	osl::File	mrFile;
79 
80 public:
OslOutputStreamWrapper(const OUString & sFileName)81     OslOutputStreamWrapper(const OUString& sFileName) : mrFile(sFileName)
82 	{
83 		osl_removeFile(sFileName.pData);
84 		mrFile.open(OpenFlag_Create|OpenFlag_Write);
85 	}
86 
87     // stario::XOutputStream
88     virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
89     virtual void SAL_CALL flush(  ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
90     virtual void SAL_CALL closeOutput(  ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
91 };
92 
writeBytes(const::com::sun::star::uno::Sequence<sal_Int8> & aData)93 void SAL_CALL OslOutputStreamWrapper::writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
94 {
95     sal_uInt64 uBytesToWrite = aData.getLength();
96     sal_uInt64 uBytesWritten = 0;
97 
98     sal_Int8 const * pBuffer = aData.getConstArray();
99 
100     while( uBytesToWrite )
101     {
102         osl::File::RC eRC = mrFile.write( pBuffer, uBytesToWrite, uBytesWritten);
103 
104         switch( eRC )
105         {
106         case osl::File::E_INVAL:    // the format of the parameters was not valid
107         case osl::File::E_FBIG:        // File too large
108 
109         case osl::File::E_AGAIN:    // Operation would block
110         case osl::File::E_BADF:        // Bad file
111         case osl::File::E_FAULT:    // Bad address
112         case osl::File::E_INTR:        // function call was interrupted
113         case osl::File::E_IO:        // I/O error
114         case osl::File::E_NOLCK:    // No record locks available
115         case osl::File::E_NOLINK:    // Link has been severed
116         case osl::File::E_NOSPC:    // No space left on device
117         case osl::File::E_NXIO:        // No such device or address
118             throw com::sun::star::io::IOException();    // TODO: Better error handling
119 		default: break;
120         }
121 
122         uBytesToWrite -= uBytesWritten;
123         pBuffer += uBytesWritten;
124     }
125 }
126 
flush()127 void SAL_CALL OslOutputStreamWrapper::flush(  ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
128 {
129 }
130 
closeOutput()131 void SAL_CALL OslOutputStreamWrapper::closeOutput(  ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
132 {
133     osl::File::RC eRC = mrFile.close();
134 
135     switch( eRC )
136     {
137     case osl::File::E_INVAL:    // the format of the parameters was not valid
138 
139     case osl::File::E_BADF:        // Bad file
140     case osl::File::E_INTR:        // function call was interrupted
141     case osl::File::E_NOLINK:    // Link has been severed
142     case osl::File::E_NOSPC:    // No space left on device
143     case osl::File::E_IO:        // I/O error
144         throw com::sun::star::io::IOException();    // TODO: Better error handling
145 	default: break;
146     }
147 }
148 
149 // -----------------------------------------------------------------------------
150 
151 class FlashExportFilter : public cppu::WeakImplHelper4
152 <
153 	com::sun::star::document::XFilter,
154 	com::sun::star::document::XExporter,
155 	com::sun::star::lang::XInitialization,
156 	com::sun::star::lang::XServiceInfo
157 >
158 {
159 	Reference< XComponent > mxDoc;
160     Reference< XMultiServiceFactory > mxMSF;
161 	Reference< XStatusIndicator> mxStatusIndicator;
162 
163     // #56084# variables for selection export
164     Reference< XShapes > mxSelectedShapes;
165     Reference< XDrawPage > mxSelectedDrawPage;
166     bool mbExportSelection;
167 
168     osl::File* mpFile;
169 
170 public:
171 	FlashExportFilter( const Reference< XMultiServiceFactory > &rxMSF);
172 
173 	// XFilter
174     virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor ) throw(RuntimeException);
175 
176     sal_Bool ExportAsMultipleFiles( const Sequence< PropertyValue >& aDescriptor );
177     sal_Bool ExportAsSingleFile( const Sequence< PropertyValue >& aDescriptor );
178 
179     virtual void SAL_CALL cancel( ) throw (RuntimeException);
180 
181 	// XExporter
182     virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
183 
184 	// XInitialization
185     virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
186 
187 	// XServiceInfo
188     virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
189     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
190     virtual Sequence< OUString > SAL_CALL getSupportedServiceNames()  throw(RuntimeException);
191 };
192 
193 // -----------------------------------------------------------------------------
194 
FlashExportFilter(const Reference<XMultiServiceFactory> & rxMSF)195 FlashExportFilter::FlashExportFilter(const Reference< XMultiServiceFactory > &rxMSF)
196 :	mxDoc(),
197     mxMSF( rxMSF ),
198     mxStatusIndicator(),
199     mxSelectedShapes(),
200     mxSelectedDrawPage(),
201     mbExportSelection(false),
202     mpFile(0)
203 {
204 }
205 
206 
207 // -----------------------------------------------------------------------------
208 
exportBackground(FlashExporter & aFlashExporter,Reference<XDrawPage> xDrawPage,OUString sPath,sal_uInt32 nPage,const char * suffix)209 OUString exportBackground(FlashExporter &aFlashExporter, Reference< XDrawPage > xDrawPage, OUString sPath, sal_uInt32 nPage, const char* suffix)
210 {
211 	OUString filename = STR("slide") + VAL(nPage+1) + STR(suffix) + STR(".swf");
212 	OUString fullpath = sPath + STR("/") + filename;
213 
214 	// AS: If suffix is "o" then the last parameter is true (for exporting objects).
215 	Reference<XOutputStream> xOutputStreamWrap(*(new OslOutputStreamWrapper(fullpath)), UNO_QUERY);
216 	sal_uInt16 nCached = aFlashExporter.exportBackgrounds( xDrawPage, xOutputStreamWrap, sal::static_int_cast<sal_uInt16>( nPage ), *suffix == 'o' );
217 	aFlashExporter.Flush();
218 	xOutputStreamWrap.clear();
219 
220 	if (nCached != nPage)
221 	{
222 		osl_removeFile(fullpath.pData);
223 		if ( 0xffff == nCached )
224 			return STR("NULL");
225 		else
226 			return STR("slide") + VAL(nCached+1) + STR(suffix) + STR(".swf");
227 	}
228 
229 	return filename;
230 }
231 
232 template <typename TYPE>
findPropertyValue(const Sequence<PropertyValue> & aPropertySequence,const sal_Char * name,TYPE def)233 TYPE findPropertyValue(const Sequence< PropertyValue >& aPropertySequence, const sal_Char* name, TYPE def)
234 {
235 	TYPE temp = TYPE();
236 
237 	sal_Int32 nLength = aPropertySequence.getLength();
238 	const PropertyValue * pValue = aPropertySequence.getConstArray();
239 
240 	for ( sal_Int32 i = 0 ; i < nLength; i++)
241 	{
242 		if ( pValue[i].Name.equalsAsciiL ( name, strlen(name) ) )
243 		{
244 			pValue[i].Value >>= temp;
245 			return temp;
246 		}
247 	}
248 
249 	return def;
250 }
251 
filter(const::com::sun::star::uno::Sequence<::com::sun::star::beans::PropertyValue> & aDescriptor)252 sal_Bool SAL_CALL FlashExportFilter::filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
253 	throw (RuntimeException)
254 {
255 	mxStatusIndicator = findPropertyValue<Reference<XStatusIndicator> >(aDescriptor, "StatusIndicator", mxStatusIndicator);
256 
257 	Sequence< PropertyValue > aFilterData;
258 	aFilterData = findPropertyValue<Sequence< PropertyValue > >(aDescriptor, "FilterData", aFilterData);
259 
260     // #56084# check if selection shall be exported only; if yes, get the selected page and the selection itself
261     if(findPropertyValue<sal_Bool>(aDescriptor, "SelectionOnly", sal_False))
262     {
263         Reference< XDesktop > xDesktop(mxMSF->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY);
264 
265         if(xDesktop.is())
266         {
267             Reference< XFrame > xFrame(xDesktop->getCurrentFrame());
268 
269             if(xFrame.is())
270             {
271                 Reference< XController > xController(xFrame->getController());
272 
273                 if(xController.is())
274                 {
275                     Reference< XDrawView > xDrawView(xController, UNO_QUERY);
276 
277                     if(xDrawView.is())
278                     {
279                         mxSelectedDrawPage = xDrawView->getCurrentPage();
280                     }
281 
282                     if(mxSelectedDrawPage.is())
283                     {
284                         Reference< XSelectionSupplier > xSelection(xController, UNO_QUERY);
285 
286                         if(xSelection.is())
287                         {
288                             Any aSelection;
289 
290                             if(xSelection->getSelection() >>= aSelection)
291                             {
292                                 aSelection >>= mxSelectedShapes;
293                             }
294                         }
295                     }
296                 }
297             }
298         }
299     }
300 
301     if(mxSelectedDrawPage.is() && mxSelectedShapes.is() && mxSelectedShapes->getCount())
302     {
303         // #56084# to export selection we need the selected page and the selected shapes.
304         // There must be shapes selected, else fallback to regular export (export all)
305         mbExportSelection = true;
306     }
307 
308     // #56084# no multiple files (suppress) when selection since selection can only export a single page
309 	if (!mbExportSelection && findPropertyValue<sal_Bool>(aFilterData, "ExportMultipleFiles", false ))
310 	{
311 		ExportAsMultipleFiles(aDescriptor);
312 	}
313 	else
314 	{
315 		ExportAsSingleFile(aDescriptor);
316 	}
317 
318 	if( mxStatusIndicator.is() )
319 		mxStatusIndicator->end();
320 
321 	return sal_True;
322 }
323 
324 
325 // AS: When exporting as multiple files, each background, object layer, and slide gets its own
326 //  file.  Additionally, a file called BackgroundConfig.txt is generated, indicating which
327 //  background and objects (if any) go with each slide.  The files are named slideNb.swf,
328 //  slideNo.swf, and slideNp.swf, where N is the slide number, and b=background, o=objects, and
329 //  p=slide contents.  Note that under normal circumstances, there will be very few b and o files.
330 
331 // AS: HACK!  Right now, I create a directory as a sibling to the swf file selected in the Export
332 //  dialog.  This directory is called presentation.sxi-swf-files.  The name of the swf file selected
333 //  in the Export dialog has no impact on this.  All files created are placed in this directory.
ExportAsMultipleFiles(const Sequence<PropertyValue> & aDescriptor)334 sal_Bool FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue >& aDescriptor)
335 {
336 	Reference< XDrawPagesSupplier > xDrawPagesSupplier(mxDoc, UNO_QUERY);
337 	if(!xDrawPagesSupplier.is())
338 		return sal_False;
339 
340 	Reference< XIndexAccess > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY );
341 	if(!xDrawPages.is())
342 		return sal_False;
343 
344 	Reference< XDesktop > rDesktop( mxMSF->createInstance(OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY);
345 	if (!rDesktop.is())
346 		return sal_False;
347 
348 	Reference< XStorable > xStorable(rDesktop->getCurrentComponent(), UNO_QUERY);
349 	if (!xStorable.is())
350 		return sal_False;
351 
352 	Reference< XDrawPage > xDrawPage;
353 
354 	Reference< XFrame > rFrame = rDesktop->getCurrentFrame();
355 	Reference< XDrawView > rDrawView = Reference< XDrawView >( rFrame->getController(), UNO_QUERY );
356 
357 	Reference< XDrawPage > rCurrentPage = rDrawView->getCurrentPage();
358 
359 	Sequence< PropertyValue > aFilterData;
360 
361 	aFilterData = findPropertyValue<Sequence< PropertyValue > >(aDescriptor, "FilterData", aFilterData);
362 
363 	//AS: Do a bunch of path mangling to figure out where to put the files.
364 
365 	OUString sOriginalPath = findPropertyValue<OUString>(aDescriptor, "URL", OUString());
366 
367 	// AS: sPath is the parent directory, where everything else exists (like the sxi,
368 	//  the -swf-files folder, the -audio files, etc.
369 	int lastslash = sOriginalPath.lastIndexOf('/');
370 	OUString sPath( sOriginalPath.copy(0, lastslash) );
371 
372 	OUString sPresentation(xStorable->getLocation());
373 
374 	lastslash = sPresentation.lastIndexOf('/') + 1;
375 	int lastdot = sPresentation.lastIndexOf('.');
376 
377 	// AS: The name of the presentation, without 3 character extension.
378 	OUString sPresentationName = sPresentation.copy(lastslash, lastdot - lastslash);
379 
380 	OUString fullpath, swfdirpath, backgroundfilename, objectsfilename;
381 
382 	swfdirpath = sPath + STR("/") + sPresentationName + STR(".sxi-swf-files");
383 
384 	oslFileError err;
385 	err = osl_createDirectory( swfdirpath.pData );
386 
387 	fullpath = swfdirpath + STR("/backgroundconfig.txt");
388 
389 	oslFileHandle xBackgroundConfig( 0 );
390 
391 	// AS: Only export the background config if we're exporting all of the pages, otherwise we'll
392 	//  screw it up.
393 	sal_Bool bExportAll = findPropertyValue<sal_Bool>(aFilterData, "ExportAll", true);
394 	if (bExportAll)
395 	{
396 		osl_removeFile(fullpath.pData);
397 		osl_openFile( fullpath.pData, &xBackgroundConfig, osl_File_OpenFlag_Create | osl_File_OpenFlag_Write );
398 
399 		sal_uInt64 bytesWritten;
400 		err = osl_writeFile(xBackgroundConfig, "slides=", strlen("slides="), &bytesWritten);
401 	}
402 
403     FlashExporter aFlashExporter(
404         mxMSF,
405         mxSelectedShapes,
406         mxSelectedDrawPage,
407         findPropertyValue<sal_Int32>(aFilterData, "CompressMode", 75),
408         findPropertyValue<sal_Bool>(aFilterData, "ExportOLEAsJPEG", false));
409 
410 	const sal_Int32 nPageCount = xDrawPages->getCount();
411 	if ( mxStatusIndicator.is() )
412 		mxStatusIndicator->start(OUString( RTL_CONSTASCII_USTRINGPARAM( "Saving :" )), nPageCount);
413 
414 	for(sal_Int32 nPage = 0; nPage < nPageCount; nPage++)
415 	{
416 		if ( mxStatusIndicator.is() )
417 			mxStatusIndicator->setValue( nPage );
418 		xDrawPages->getByIndex(nPage) >>= xDrawPage;
419 
420 		// AS: If we're only exporting the current page, then skip the rest.
421 		if (!bExportAll && xDrawPage != rCurrentPage)
422 			continue;
423 
424 		// AS: Export the background, the background objects, and then the slide contents.
425 		if (bExportAll || findPropertyValue<sal_Bool>(aFilterData, "ExportBackgrounds", true))
426 		{
427 			backgroundfilename = exportBackground(aFlashExporter, xDrawPage, swfdirpath, nPage, "b");
428 		}
429 
430 		if (bExportAll || findPropertyValue<sal_Bool>(aFilterData, "ExportBackgroundObjects", true))
431 		{
432 			objectsfilename = exportBackground(aFlashExporter, xDrawPage, swfdirpath, nPage, "o");
433 		}
434 
435 		if (bExportAll || findPropertyValue<sal_Bool>(aFilterData, "ExportSlideContents", true))
436 		{
437 			fullpath = swfdirpath + STR("/slide") + VAL(nPage+1) + STR("p.swf");
438 
439 			Reference<XOutputStream> xOutputStreamWrap(*(new OslOutputStreamWrapper(fullpath)), UNO_QUERY);
440 			sal_Bool ret = aFlashExporter.exportSlides( xDrawPage, xOutputStreamWrap, sal::static_int_cast<sal_uInt16>( nPage ) );
441 			aFlashExporter.Flush();
442 			xOutputStreamWrap.clear();
443 
444 			if (!ret)
445 				osl_removeFile(fullpath.pData);
446 		}
447 
448 		// AS: Write out to the background config what backgrounds and objects this
449 		//  slide used.
450 		if (bExportAll)
451 		{
452 			OUString temp = backgroundfilename + STR("|") + objectsfilename;
453 			OString ASCIItemp(temp.getStr(), temp.getLength(), RTL_TEXTENCODING_ASCII_US);
454 
455 			sal_uInt64 bytesWritten;
456 			osl_writeFile(xBackgroundConfig, ASCIItemp.getStr(), ASCIItemp.getLength(), &bytesWritten);
457 
458 			if (nPage < nPageCount - 1)
459 				osl_writeFile(xBackgroundConfig, "|", 1, &bytesWritten);
460 		}
461 
462 #ifdef AUGUSTUS
463 		if (findPropertyValue<sal_Bool>(aFilterData, "ExportSound", true))
464 		{
465 			fullpath = swfdirpath + STR("/slide") + VAL(nPage+1) + STR("s.swf");
466 
467 			OUString wavpath = sPath + STR("/") + sPresentationName + STR(".ppt-audio/slide") + VAL(nPage+1) + STR(".wav");
468 			FileBase::getSystemPathFromFileURL(wavpath, wavpath);
469 			OString sASCIIPath(wavpath.getStr(), wavpath.getLength(), RTL_TEXTENCODING_ASCII_US);
470 
471 			Reference<XOutputStream> xOutputStreamWrap(*(new OslOutputStreamWrapper(fullpath)), UNO_QUERY);
472 			sal_Bool ret = aFlashExporter.exportSound(xOutputStreamWrap, sASCIIPath.getStr());
473 			aFlashExporter.Flush();
474 			xOutputStreamWrap.clear();
475 
476 			if (!ret)
477 				osl_removeFile(fullpath.pData);
478 		}
479 #endif // defined AUGUSTUS
480 	}
481 
482 	if (bExportAll)
483 		osl_closeFile(xBackgroundConfig);
484 
485 	return sal_True;
486 }
487 
ExportAsSingleFile(const Sequence<PropertyValue> & aDescriptor)488 sal_Bool FlashExportFilter::ExportAsSingleFile(const Sequence< PropertyValue >& aDescriptor)
489 {
490 	Reference < XOutputStream > xOutputStream = findPropertyValue<Reference<XOutputStream> >(aDescriptor, "OutputStream", 0);
491 	Sequence< PropertyValue > aFilterData;
492 
493 	if (!xOutputStream.is() )
494 	{
495 		OSL_ASSERT ( 0 );
496 		return sal_False;
497 	}
498 
499     FlashExporter aFlashExporter(
500         mxMSF,
501         mxSelectedShapes,
502         mxSelectedDrawPage,
503         findPropertyValue<sal_Int32>(aFilterData, "CompressMode", 75),
504         findPropertyValue<sal_Bool>(aFilterData, "ExportOLEAsJPEG", false));
505 
506 	return aFlashExporter.exportAll( mxDoc, xOutputStream, mxStatusIndicator );
507 }
508 
509 // -----------------------------------------------------------------------------
510 
cancel()511 void SAL_CALL FlashExportFilter::cancel(  )
512 	throw (RuntimeException)
513 {
514 }
515 
516 // -----------------------------------------------------------------------------
517 
518 // XExporter
setSourceDocument(const::com::sun::star::uno::Reference<::com::sun::star::lang::XComponent> & xDoc)519 void SAL_CALL FlashExportFilter::setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
520 	throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
521 {
522 	mxDoc = xDoc;
523 }
524 
525 // -----------------------------------------------------------------------------
526 
527 // XInitialization
initialize(const::com::sun::star::uno::Sequence<::com::sun::star::uno::Any> &)528 void SAL_CALL FlashExportFilter::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& /* aArguments */ )
529 	throw (Exception, RuntimeException)
530 {
531 }
532 
533 // -----------------------------------------------------------------------------
534 
FlashExportFilter_getImplementationName()535 OUString FlashExportFilter_getImplementationName ()
536 	throw (RuntimeException)
537 {
538 	return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Impress.FlashExportFilter" ) );
539 }
540 
541 // -----------------------------------------------------------------------------
542 
543 #define SERVICE_NAME "com.sun.star.document.ExportFilter"
544 
FlashExportFilter_supportsService(const OUString & ServiceName)545 sal_Bool SAL_CALL FlashExportFilter_supportsService( const OUString& ServiceName )
546 	throw (RuntimeException)
547 {
548     return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
549 }
550 
551 // -----------------------------------------------------------------------------
552 
FlashExportFilter_getSupportedServiceNames()553 Sequence< OUString > SAL_CALL FlashExportFilter_getSupportedServiceNames(  )
554 	throw (RuntimeException)
555 {
556 	Sequence < OUString > aRet(1);
557     OUString* pArray = aRet.getArray();
558     pArray[0] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
559     return aRet;
560 }
561 #undef SERVICE_NAME
562 
563 // -----------------------------------------------------------------------------
564 
FlashExportFilter_createInstance(const Reference<XMultiServiceFactory> & rSMgr)565 Reference< XInterface > SAL_CALL FlashExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
566 	throw( Exception )
567 {
568 	return (cppu::OWeakObject*) new FlashExportFilter( rSMgr );
569 }
570 
571 // -----------------------------------------------------------------------------
572 
573 // XServiceInfo
getImplementationName()574 OUString SAL_CALL FlashExportFilter::getImplementationName(  )
575 	throw (RuntimeException)
576 {
577 	return FlashExportFilter_getImplementationName();
578 }
579 
580 // -----------------------------------------------------------------------------
581 
supportsService(const OUString & rServiceName)582 sal_Bool SAL_CALL FlashExportFilter::supportsService( const OUString& rServiceName )
583 	throw (RuntimeException)
584 {
585     return FlashExportFilter_supportsService( rServiceName );
586 }
587 
588 // -----------------------------------------------------------------------------
589 
getSupportedServiceNames()590 ::com::sun::star::uno::Sequence< OUString > SAL_CALL FlashExportFilter::getSupportedServiceNames(  )
591 	throw (RuntimeException)
592 {
593     return FlashExportFilter_getSupportedServiceNames();
594 }
595 
596 // -----------------------------------------------------------------------------
597 
598 }
599