LCOV - code coverage report
Current view: top level - filter/source/flash - swffilter.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 182 0.0 %
Date: 2014-04-11 Functions: 0 28 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10