LCOV - code coverage report
Current view: top level - sw/source/ui/uno - swdetect.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 126 223 56.5 %
Date: 2014-04-11 Functions: 8 11 72.7 %
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 "swdetect.hxx"
      21             : 
      22             : #include <framework/interaction.hxx>
      23             : #include <com/sun/star/frame/XFrame.hpp>
      24             : #include <com/sun/star/frame/XModel.hpp>
      25             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      26             : #include <comphelper/processfactory.hxx>
      27             : #include <cppuhelper/supportsservice.hxx>
      28             : #include <com/sun/star/container/XNameAccess.hpp>
      29             : #include <com/sun/star/io/XInputStream.hpp>
      30             : #include <com/sun/star/task/XInteractionHandler.hpp>
      31             : #include <com/sun/star/ucb/CommandAbortedException.hpp>
      32             : #include <com/sun/star/ucb/InteractiveAppException.hpp>
      33             : #include <com/sun/star/ucb/XContent.hpp>
      34             : #include <com/sun/star/packages/zip/ZipIOException.hpp>
      35             : #include <toolkit/helper/vclunohelper.hxx>
      36             : #include <ucbhelper/simpleinteractionrequest.hxx>
      37             : #include <rtl/ustring.h>
      38             : #include <svl/itemset.hxx>
      39             : #include <vcl/window.hxx>
      40             : #include <svl/eitem.hxx>
      41             : #include <svl/stritem.hxx>
      42             : #include <tools/urlobj.hxx>
      43             : #include <osl/mutex.hxx>
      44             : #include <svtools/sfxecode.hxx>
      45             : #include <svtools/ehdl.hxx>
      46             : #include <sot/storinfo.hxx>
      47             : #include <vcl/svapp.hxx>
      48             : #include <sfx2/app.hxx>
      49             : #include <sfx2/sfxsids.hrc>
      50             : #include <sfx2/request.hxx>
      51             : #include <sfx2/docfile.hxx>
      52             : #include <sfx2/docfilt.hxx>
      53             : #include <sfx2/fcontnr.hxx>
      54             : #include <sfx2/brokenpackageint.hxx>
      55             : #include <vcl/FilterConfigItem.hxx>
      56             : #include <unotools/moduleoptions.hxx>
      57             : #include <comphelper/ihwrapnofilter.hxx>
      58             : #include <iodetect.hxx>
      59             : 
      60             : using namespace ::com::sun::star;
      61             : using namespace ::com::sun::star::uno;
      62             : using namespace ::com::sun::star::io;
      63             : using namespace ::com::sun::star::frame;
      64             : using namespace ::com::sun::star::task;
      65             : using namespace ::com::sun::star::beans;
      66             : using namespace ::com::sun::star::lang;
      67             : using namespace ::com::sun::star::ucb;
      68             : 
      69        1283 : SwFilterDetect::SwFilterDetect( const Reference < XMultiServiceFactory >& /*xFactory*/ )
      70             : {
      71        1283 : }
      72             : 
      73        2566 : SwFilterDetect::~SwFilterDetect()
      74             : {
      75        2566 : }
      76             : 
      77        1283 : OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor ) throw( RuntimeException, std::exception )
      78             : {
      79        1283 :     Reference< XInputStream > xStream;
      80        2566 :     Reference< XContent > xContent;
      81        2566 :     Reference< XInteractionHandler > xInteraction;
      82        2566 :     OUString aURL;
      83        2566 :     OUString sTemp;
      84        2566 :     OUString aTypeName;            // a name describing the type (from MediaDescriptor, usually from flat detection)
      85        2566 :     OUString aPreselectedFilterName;      // a name describing the filter to use (from MediaDescriptor, usually from UI action)
      86             : 
      87        2566 :     OUString aDocumentTitle; // interesting only if set in this method
      88             : 
      89             :     // opening as template is done when a parameter tells to do so and a template filter can be detected
      90             :     // (otherwise no valid filter would be found) or if the detected filter is a template filter and
      91             :     // there is no parameter that forbids to open as template
      92        1283 :     sal_Bool bOpenAsTemplate = sal_False;
      93        1283 :     sal_Bool bWasReadOnly = sal_False, bReadOnly = sal_False;
      94             : 
      95        1283 :     sal_Bool bRepairPackage = sal_False;
      96        1283 :     sal_Bool bRepairAllowed = sal_False;
      97        1283 :     bool bDeepDetection = false;
      98             : 
      99             :     // now some parameters that can already be in the array, but may be overwritten or new inserted here
     100             :     // remember their indices in the case new values must be added to the array
     101        1283 :     sal_Int32 nPropertyCount = lDescriptor.getLength();
     102        1283 :     sal_Int32 nIndexOfInputStream = -1;
     103        1283 :     sal_Int32 nIndexOfContent = -1;
     104        1283 :     sal_Int32 nIndexOfReadOnlyFlag = -1;
     105        1283 :     sal_Int32 nIndexOfTemplateFlag = -1;
     106        1283 :     sal_Int32 nIndexOfDocumentTitle = -1;
     107        1283 :     sal_Int32 nIndexOfInteractionHandler = -1;
     108             : 
     109       11438 :     for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
     110             :     {
     111             :         // extract properties
     112       10155 :         if ( lDescriptor[nProperty].Name == "URL" )
     113             :         {
     114        1283 :             lDescriptor[nProperty].Value >>= sTemp;
     115        1283 :             aURL = sTemp;
     116             :         }
     117        8872 :         else if( aURL.isEmpty() && lDescriptor[nProperty].Name == "FileName" )
     118             :         {
     119           0 :             lDescriptor[nProperty].Value >>= sTemp;
     120           0 :             aURL = sTemp;
     121             :         }
     122        8872 :         else if ( lDescriptor[nProperty].Name == "TypeName" )
     123             :         {
     124        1283 :             lDescriptor[nProperty].Value >>= sTemp;
     125        1283 :             aTypeName = sTemp;
     126             :         }
     127        7589 :         else if ( lDescriptor[nProperty].Name == "FilterName" )
     128             :         {
     129           0 :             lDescriptor[nProperty].Value >>= sTemp;
     130           0 :             aPreselectedFilterName = sTemp;
     131             :         }
     132        7589 :         else if ( lDescriptor[nProperty].Name == "InputStream" )
     133        1283 :             nIndexOfInputStream = nProperty;
     134        6306 :         else if ( lDescriptor[nProperty].Name == "ReadOnly" )
     135           1 :             nIndexOfReadOnlyFlag = nProperty;
     136        6305 :         else if ( lDescriptor[nProperty].Name == "UCBContent" )
     137        1262 :             nIndexOfContent = nProperty;
     138        5043 :         else if ( lDescriptor[nProperty].Name == "AsTemplate" )
     139             :         {
     140           1 :             lDescriptor[nProperty].Value >>= bOpenAsTemplate;
     141           1 :             nIndexOfTemplateFlag = nProperty;
     142             :         }
     143        5042 :         else if ( lDescriptor[nProperty].Name == "InteractionHandler" )
     144             :         {
     145        1267 :             lDescriptor[nProperty].Value >>= xInteraction;
     146        1267 :             nIndexOfInteractionHandler = nProperty;
     147             :         }
     148        3775 :         else if ( lDescriptor[nProperty].Name == "RepairPackage" )
     149           0 :             lDescriptor[nProperty].Value >>= bRepairPackage;
     150        3775 :         else if ( lDescriptor[nProperty].Name == "DocumentTitle" )
     151           0 :             nIndexOfDocumentTitle = nProperty;
     152        3775 :         else if (lDescriptor[nProperty].Name == "DeepDetection")
     153           0 :             bDeepDetection = lDescriptor[nProperty].Value.get<sal_Bool>();
     154             :     }
     155             : 
     156        2566 :     SolarMutexGuard aGuard;
     157             : 
     158        1283 :     SfxApplication* pApp = SFX_APP();
     159        1283 :     SfxAllItemSet *pSet = new SfxAllItemSet( pApp->GetPool() );
     160        1283 :     TransformParameters( SID_OPENDOC, lDescriptor, *pSet );
     161        1283 :     SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_DOC_READONLY, false );
     162             : 
     163        1283 :     bWasReadOnly = pItem && pItem->GetValue();
     164             : 
     165        1283 :     const SfxFilter* pFilter = 0;
     166        2566 :     OUString aPrefix = "private:factory/";
     167        1283 :     if( aURL.startsWith( aPrefix ) )
     168             :     {
     169           0 :         if( SvtModuleOptions().IsWriter() )
     170             :         {
     171           0 :             OUString aPattern = aPrefix + "swriter";
     172           0 :             if ( aURL.startsWith( aPattern ) )
     173           0 :                 return aTypeName;
     174             :         }
     175             :     }
     176             :     else
     177             :     {
     178             :         try
     179             :         {
     180             :             // ctor of SfxMedium uses owner transition of ItemSet
     181        1283 :             SfxMedium aMedium( aURL, bWasReadOnly ? STREAM_STD_READ : STREAM_STD_READWRITE, NULL, pSet );
     182        1283 :             aMedium.UseInteractionHandler( true );
     183        1283 :             if ( aMedium.GetErrorCode() == ERRCODE_NONE )
     184             :             {
     185             :                 // remember input stream and content and put them into the descriptor later
     186             :                 // should be done here since later the medium can switch to a version
     187        1283 :                 xStream = aMedium.GetInputStream();
     188        1283 :                 xContent = aMedium.GetContent();
     189        1283 :                 bReadOnly = aMedium.IsReadOnly();
     190             : 
     191        1283 :                 sal_Bool bIsStorage = aMedium.IsStorage();
     192        1283 :                 if ( bIsStorage )
     193             :                 {
     194         118 :                     Reference< embed::XStorage > xStorage = aMedium.GetStorage( false );
     195         118 :                     if ( aMedium.GetLastStorageCreationState() != ERRCODE_NONE )
     196             :                     {
     197             :                         // error during storage creation means _here_ that the medium
     198             :                         // is broken, but we can not handle it in medium since impossibility
     199             :                         // to create a storage does not _always_ means that the medium is broken
     200           0 :                         aMedium.SetError( aMedium.GetLastStorageCreationState(), OUString( OSL_LOG_PREFIX  ) );
     201           0 :                         if ( xInteraction.is() )
     202             :                         {
     203           0 :                             OUString empty;
     204             :                             try
     205             :                             {
     206             :                                 InteractiveAppException xException( empty,
     207             :                                                                 Reference< XInterface >(),
     208             :                                                                 InteractionClassification_ERROR,
     209           0 :                                                                 aMedium.GetError() );
     210             : 
     211             :                                 Reference< XInteractionRequest > xRequest(
     212             :                                     new ucbhelper::SimpleInteractionRequest( makeAny( xException ),
     213           0 :                                                                           ucbhelper::CONTINUATION_APPROVE ) );
     214           0 :                                 xInteraction->handle( xRequest );
     215             :                             }
     216           0 :                             catch (const Exception&)
     217             :                             {
     218           0 :                             }
     219             :                         }
     220             :                     }
     221             :                     else
     222             :                     {
     223             :                         OSL_ENSURE( xStorage.is(), "At this point storage must exist!" );
     224             : 
     225             :                         try
     226             :                         {
     227         118 :                             const SfxFilter* pPreFilter = !aPreselectedFilterName.isEmpty() ?
     228         236 :                                     SfxFilterMatcher().GetFilter4FilterName( aPreselectedFilterName ) : !aTypeName.isEmpty() ?
     229         354 :                                     SfxFilterMatcher(OUString("swriter")).GetFilter4EA( aTypeName ) : 0;
     230         118 :                             if (!pPreFilter)
     231           0 :                                 pPreFilter = SfxFilterMatcher(OUString("sweb")).GetFilter4EA( aTypeName );
     232         118 :                             OUString aFilterName;
     233         118 :                             if ( pPreFilter )
     234             :                             {
     235         118 :                                 aFilterName = pPreFilter->GetName();
     236         118 :                                 aTypeName = pPreFilter->GetTypeName();
     237             :                             }
     238             : 
     239         118 :                             aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pPreFilter && pPreFilter->IsOwnTemplateFormat(), &aFilterName );
     240             :                         }
     241           0 :                         catch (const WrappedTargetException& aWrap)
     242             :                         {
     243           0 :                             if (!bDeepDetection)
     244             :                                 // Bail out early unless it's a deep detection.
     245           0 :                                 return OUString();
     246             : 
     247           0 :                             packages::zip::ZipIOException aZipException;
     248             : 
     249             :                             // repairing is done only if this type is requested from outside
     250             :                             // we don't do any type detection on broken packages (f.e. because it might be impossible), so any requested
     251             :                             // type will be accepted if the user allows to repair the file
     252           0 :                             if ( ( aWrap.TargetException >>= aZipException ) && ( !aTypeName.isEmpty() || !aPreselectedFilterName.isEmpty() ) )
     253             :                             {
     254           0 :                                 if ( xInteraction.is() )
     255             :                                 {
     256             :                                     // the package is a broken one
     257           0 :                                        aDocumentTitle = aMedium.GetURLObject().getName(
     258             :                                                                 INetURLObject::LAST_SEGMENT,
     259             :                                                                 true,
     260           0 :                                                                 INetURLObject::DECODE_WITH_CHARSET );
     261             : 
     262           0 :                                     if ( !bRepairPackage )
     263             :                                     {
     264             :                                         // ask the user whether he wants to try to repair
     265           0 :                                         RequestPackageReparation aRequest( aDocumentTitle );
     266           0 :                                         xInteraction->handle( aRequest.GetRequest() );
     267           0 :                                         bRepairAllowed = aRequest.isApproved();
     268             :                                     }
     269             : 
     270           0 :                                     if ( !bRepairAllowed )
     271             :                                     {
     272             :                                         // repair either not allowed or not successful
     273             :                                         // repair either not allowed or not successful
     274           0 :                                         NotifyBrokenPackage aNotifyRequest( aDocumentTitle );
     275           0 :                                         xInteraction->handle( aNotifyRequest.GetRequest() );
     276             : 
     277           0 :                                         Reference< ::comphelper::OIHWrapNoFilterDialog > xHandler = new ::comphelper::OIHWrapNoFilterDialog( xInteraction );
     278           0 :                                         if ( nIndexOfInteractionHandler != -1 )
     279           0 :                                             lDescriptor[nIndexOfInteractionHandler].Value <<= Reference< XInteractionHandler >( static_cast< XInteractionHandler* >( xHandler.get() ) );
     280             : 
     281           0 :                                         aMedium.SetError( ERRCODE_ABORT, OUString( OSL_LOG_PREFIX  ) );
     282             :                                     }
     283             :                                 }
     284             :                                 else
     285             :                                     // no interaction, error handling as usual
     286           0 :                                     aMedium.SetError( ERRCODE_IO_BROKENPACKAGE, OUString( OSL_LOG_PREFIX  ) );
     287             : 
     288           0 :                                 if ( !bRepairAllowed )
     289             :                                 {
     290           0 :                                     aTypeName = "";
     291           0 :                                     aPreselectedFilterName = "";
     292             :                                 }
     293           0 :                             }
     294           0 :                         }
     295         118 :                     }
     296             :                 }
     297             :                 else
     298             :                 {
     299        1165 :                     aMedium.GetInStream();
     300        1165 :                     if ( aMedium.GetErrorCode() == ERRCODE_NONE )
     301             :                     {
     302        1165 :                         if ( !aPreselectedFilterName.isEmpty() )
     303           0 :                             pFilter = SfxFilter::GetFilterByName( aPreselectedFilterName );
     304             :                         else
     305        1165 :                             pFilter = SfxFilterMatcher().GetFilter4EA( aTypeName );
     306             : 
     307        1432 :                         bool bTestWriter = !pFilter || pFilter->GetServiceName() == "com.sun.star.text.TextDocument" ||
     308        1432 :                             pFilter->GetServiceName() == "com.sun.star.text.WebDocument";
     309        1165 :                         bool bTestGlobal = !pFilter || pFilter->GetServiceName() == "com.sun.star.text.GlobalDocument";
     310             : 
     311        1165 :                         const SfxFilter* pOrigFilter = NULL;
     312        1165 :                         if ( !bTestWriter && !bTestGlobal && pFilter )
     313             :                         {
     314             :                             // cross filter; now this should be a type detection only, not a filter detection
     315             :                             // we can simulate it by preserving the preselected filter if the type matches
     316             :                             // example: HTML filter for Calc
     317           0 :                             pOrigFilter = pFilter;
     318           0 :                             pFilter = SfxFilterMatcher().GetFilter4EA( pFilter->GetTypeName() );
     319           0 :                             bTestWriter = true;
     320             :                         }
     321             : 
     322        1165 :                         sal_uLong nErr = ERRCODE_NONE;
     323        1165 :                         if ( pFilter || bTestWriter )
     324        1165 :                             nErr = DetectFilter( aMedium, &pFilter );
     325        1165 :                         if ( nErr != ERRCODE_NONE )
     326         858 :                             pFilter = NULL;
     327         307 :                         else if ( pOrigFilter && pFilter && pFilter->GetTypeName() == pOrigFilter->GetTypeName() )
     328             :                             // cross filter, see above
     329           0 :                             pFilter = pOrigFilter;
     330             :                     }
     331             : 
     332        1165 :                     if ( pFilter )
     333         307 :                         aTypeName = pFilter->GetTypeName();
     334             :                     else
     335         858 :                         aTypeName = "";
     336             :                 }
     337        1283 :             }
     338             :         }
     339           0 :         catch (const RuntimeException&)
     340             :         {
     341           0 :             throw;
     342             :         }
     343           0 :         catch (const Exception&)
     344             :         {
     345           0 :             aTypeName = "";
     346           0 :             aPreselectedFilterName = "";
     347             :         }
     348             :     }
     349             : 
     350        1283 :     if ( nIndexOfInputStream == -1 && xStream.is() )
     351             :     {
     352             :         // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opened twice
     353           0 :         lDescriptor.realloc( nPropertyCount + 1 );
     354           0 :         lDescriptor[nPropertyCount].Name = "InputStream";
     355           0 :         lDescriptor[nPropertyCount].Value <<= xStream;
     356           0 :         nPropertyCount++;
     357             :     }
     358             : 
     359        1283 :     if ( nIndexOfContent == -1 && xContent.is() )
     360             :     {
     361             :         // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opened twice
     362           5 :         lDescriptor.realloc( nPropertyCount + 1 );
     363           5 :         lDescriptor[nPropertyCount].Name = "UCBContent";
     364           5 :         lDescriptor[nPropertyCount].Value <<= xContent;
     365           5 :         nPropertyCount++;
     366             :     }
     367             : 
     368        1283 :     if ( bReadOnly != bWasReadOnly )
     369             :     {
     370           0 :         if ( nIndexOfReadOnlyFlag == -1 )
     371             :         {
     372           0 :             lDescriptor.realloc( nPropertyCount + 1 );
     373           0 :             lDescriptor[nPropertyCount].Name = "ReadOnly";
     374           0 :             lDescriptor[nPropertyCount].Value <<= bReadOnly;
     375           0 :             nPropertyCount++;
     376             :         }
     377             :         else
     378           0 :             lDescriptor[nIndexOfReadOnlyFlag].Value <<= bReadOnly;
     379             :     }
     380             : 
     381        1283 :     if ( !bRepairPackage && bRepairAllowed )
     382             :     {
     383           0 :         lDescriptor.realloc( nPropertyCount + 1 );
     384           0 :         lDescriptor[nPropertyCount].Name = "RepairPackage";
     385           0 :         lDescriptor[nPropertyCount].Value <<= bRepairAllowed;
     386           0 :         nPropertyCount++;
     387           0 :         bOpenAsTemplate = sal_True;
     388             :         // TODO/LATER: set progress bar that should be used
     389             :     }
     390             : 
     391        1283 :     if ( bOpenAsTemplate )
     392             :     {
     393           1 :         if ( nIndexOfTemplateFlag == -1 )
     394             :         {
     395           0 :             lDescriptor.realloc( nPropertyCount + 1 );
     396           0 :             lDescriptor[nPropertyCount].Name = "AsTemplate";
     397           0 :             lDescriptor[nPropertyCount].Value <<= bOpenAsTemplate;
     398           0 :             nPropertyCount++;
     399             :         }
     400             :         else
     401           1 :             lDescriptor[nIndexOfTemplateFlag].Value <<= bOpenAsTemplate;
     402             :     }
     403             : 
     404        1283 :     if ( !aDocumentTitle.isEmpty() )
     405             :     {
     406             :         // the title was set here
     407           0 :         if ( nIndexOfDocumentTitle == -1 )
     408             :         {
     409           0 :             lDescriptor.realloc( nPropertyCount + 1 );
     410           0 :             lDescriptor[nPropertyCount].Name = "DocumentTitle";
     411           0 :             lDescriptor[nPropertyCount].Value <<= aDocumentTitle;
     412           0 :             nPropertyCount++;
     413             :         }
     414             :         else
     415           0 :             lDescriptor[nIndexOfDocumentTitle].Value <<= aDocumentTitle;
     416             :     }
     417             : 
     418        2566 :     return aTypeName;
     419             : }
     420             : 
     421        1165 : sal_uLong SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter )
     422             : {
     423        1165 :     sal_uLong nRet = ERRCODE_NONE;
     424        1165 :     if( *ppFilter )
     425             :     {
     426             :         // verify the given filter
     427        1165 :         OUString aPrefFlt = (*ppFilter)->GetUserData();
     428             : 
     429             :         // detection for TextFilter needs an additional checking
     430        1165 :         sal_Bool bDetected = SwIoSystem::IsFileFilter(rMedium, aPrefFlt);
     431        1165 :         return bDetected ? nRet : ERRCODE_ABORT;
     432             :     }
     433             : 
     434             :     // mba: without preselection there is no PrefFlt
     435           0 :     OUString aPrefFlt;
     436           0 :     const SfxFilter* pTmp = SwIoSystem::GetFileFilter( rMedium.GetPhysicalName(), aPrefFlt, &rMedium );
     437           0 :     if( !pTmp )
     438           0 :         return ERRCODE_ABORT;
     439             : 
     440             :     else
     441             :     {
     442             :         //Bug 41417: JP 09.07.97: HTML documents should be loaded by WebWriter
     443           0 :         SfxFilterContainer aFilterContainer( OUString("swriter/web") );
     444           0 :         if( !pTmp->GetUserData().equals(sHTML) ||
     445           0 :             pTmp->GetServiceName() == "com.sun.star.text.WebDocument" ||
     446           0 :             0 == ( (*ppFilter) = SwIoSystem::GetFilterOfFormat( OUString(sHTML),
     447           0 :                     &aFilterContainer ) ) )
     448           0 :             *ppFilter = pTmp;
     449             :     }
     450             : 
     451           0 :     return nRet;
     452             : }
     453             : 
     454             : /* XServiceInfo */
     455           0 : OUString SAL_CALL SwFilterDetect::getImplementationName() throw( RuntimeException, std::exception )
     456             : {
     457           0 :     return impl_getStaticImplementationName();
     458             : }
     459             :                                                                                                                                 \
     460             : /* XServiceInfo */
     461           0 : sal_Bool SAL_CALL SwFilterDetect::supportsService( const OUString& sServiceName ) throw( RuntimeException, std::exception )
     462             : {
     463           0 :     return cppu::supportsService(this, sServiceName);
     464             : }
     465             : 
     466             : /* XServiceInfo */
     467           0 : Sequence< OUString > SAL_CALL SwFilterDetect::getSupportedServiceNames() throw( RuntimeException, std::exception )
     468             : {
     469           0 :     return impl_getStaticSupportedServiceNames();
     470             : }
     471             : 
     472             : /* Helper for XServiceInfo */
     473          22 : Sequence< OUString > SwFilterDetect::impl_getStaticSupportedServiceNames()
     474             : {
     475          22 :     Sequence< OUString > seqServiceNames( 3 );
     476          22 :     seqServiceNames.getArray() [0] = "com.sun.star.frame.ExtendedTypeDetection";
     477          22 :     seqServiceNames.getArray() [1] = "com.sun.star.text.FormatDetector";
     478          22 :     seqServiceNames.getArray() [2] = "com.sun.star.text.W4WFormatDetector";
     479          22 :     return seqServiceNames ;
     480             : }
     481             : 
     482             : /* Helper for XServiceInfo */
     483          44 : OUString SwFilterDetect::impl_getStaticImplementationName()
     484             : {
     485          44 :     return OUString("com.sun.star.comp.writer.FormatDetector" );
     486             : }
     487             : 
     488             : /* Helper for registry */
     489        1283 : Reference< XInterface > SAL_CALL SwFilterDetect::impl_createInstance( const Reference< XMultiServiceFactory >& xServiceManager ) throw( Exception )
     490             : {
     491        1283 :     return Reference< XInterface >( *new SwFilterDetect( xServiceManager ) );
     492             : }
     493             : 
     494             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10