LCOV - code coverage report
Current view: top level - sw/source/ui/uno - swdet2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 18 88.9 %
Date: 2012-08-25 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 25 68 36.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <sfx2/docfac.hxx>
      30                 :            : #include <sfx2/docfilt.hxx>
      31                 :            : #include <sfx2/fcontnr.hxx>
      32                 :            : #include <sfx2/docfile.hxx>
      33                 :            : #include <sfx2/app.hxx>
      34                 :            : #include <svtools/sfxecode.hxx>
      35                 :            : #include <vcl/msgbox.hxx>
      36                 :            : #include <svtools/parhtml.hxx>
      37                 :            : #include <sot/clsids.hxx>
      38                 :            : #include <iodetect.hxx>
      39                 :            : 
      40                 :            : #include <swdetect.hxx>
      41                 :            : 
      42                 :            : #include <app.hrc>
      43                 :            : #include <web.hrc>
      44                 :            : #include <globdoc.hrc>
      45                 :            : 
      46                 :            : #include <unotools/moduleoptions.hxx>
      47                 :            : 
      48                 :            : #include <unomid.h>
      49                 :            : 
      50                 :        320 : bool IsDocShellRegistered()
      51                 :            : {
      52         [ +  - ]:        320 :     return SvtModuleOptions().IsWriter();
      53                 :            : }
      54                 :            : 
      55                 :            : //-------------------------------------------------------------------------
      56                 :            : 
      57                 :        320 : sal_uLong SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter )
      58                 :            : {
      59                 :        320 :     sal_uLong nRet = ERRCODE_NONE;
      60         [ +  + ]:        320 :     if( *ppFilter )
      61                 :            :     {
      62                 :            :         // verify the given filter
      63         [ +  - ]:        233 :         String aPrefFlt = (*ppFilter)->GetUserData();
      64                 :            : 
      65                 :            :         // detection for TextFilter needs an additional checking
      66         [ +  - ]:        233 :         sal_Bool bDetected = SwIoSystem::IsFileFilter( rMedium, aPrefFlt );
      67 [ +  - ][ +  - ]:        233 :         return bDetected ? nRet : ERRCODE_ABORT;
      68                 :            :     }
      69                 :            : 
      70                 :            :     // mba: without preselection there is no PrefFlt
      71         [ +  - ]:         87 :     String aPrefFlt;
      72 [ +  - ][ +  - ]:         87 :     const SfxFilter* pTmp = SwIoSystem::GetFileFilter( rMedium.GetPhysicalName(), aPrefFlt, &rMedium );
         [ +  - ][ +  - ]
      73         [ -  + ]:         87 :     if( !pTmp )
      74                 :          0 :         return ERRCODE_ABORT;
      75                 :            : 
      76                 :            :     else
      77                 :            :     {
      78                 :            :         //Bug 41417: JP 09.07.97: HTML documents should be loaded by WebWriter
      79 [ +  - ][ +  - ]:         87 :         SfxFilterContainer aFilterContainer( rtl::OUString("swriter/web") );
                 [ +  - ]
      80 [ #  # ][ +  - ]:        174 :         if( !pTmp->GetUserData().equals(sHTML) ||
         [ +  - ][ +  -  
             #  #  #  # ]
           [ -  +  #  # ]
      81                 :          0 :             pTmp->GetServiceName() == "com.sun.star.text.WebDocument" ||
      82                 :            :             0 == ( (*ppFilter) = SwIoSystem::GetFilterOfFormat( rtl::OUString(sHTML),
      83 [ #  # ][ #  # ]:         87 :                     &aFilterContainer ) ) )
         [ -  + ][ #  # ]
         [ -  + ][ -  + ]
           [ #  #  #  #  
                   #  # ]
      84         [ +  - ]:         87 :             *ppFilter = pTmp;
      85                 :            :     }
      86                 :            : 
      87         [ +  - ]:        320 :     return nRet;
      88                 :            : }
      89                 :            : 
      90                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10