LCOV - code coverage report
Current view: top level - desktop/source/deployment/registry/script - dp_lib_container.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 8 75.0 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 18 38.9 %

           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                 :            : 
      30                 :            : #include "com/sun/star/uno/XComponentContext.hpp"
      31                 :            : #include "com/sun/star/ucb/XCommandEnvironment.hpp"
      32                 :            : 
      33                 :            : #include "dp_script.hrc"
      34                 :            : #include "dp_resource.h"
      35                 :            : #include "dp_xml.h"
      36                 :            : #include "dp_lib_container.h"
      37                 :            : 
      38                 :            : #include "rtl/ustring.hxx"
      39                 :            : #include "ucbhelper/content.hxx"
      40                 :            : #include "xmlscript/xmllib_imexp.hxx"
      41                 :            : 
      42                 :            : 
      43                 :            : using namespace ::dp_misc;
      44                 :            : using namespace ::com::sun::star;
      45                 :            : using namespace ::com::sun::star::uno;
      46                 :            : using namespace ::com::sun::star::ucb;
      47                 :            : using ::rtl::OUString;
      48                 :            : 
      49                 :            : namespace dp_registry {
      50                 :            : namespace backend {
      51                 :            : namespace script {
      52                 :            : 
      53                 :            : namespace {
      54                 :            : struct StrCannotDetermineLibName : public StaticResourceString<
      55                 :            :     StrCannotDetermineLibName, RID_STR_CANNOT_DETERMINE_LIBNAME> {};
      56                 :            : }
      57                 :            : 
      58                 :            : //______________________________________________________________________________
      59                 :        248 : OUString LibraryContainer::get_libname(
      60                 :            :     OUString const & url,
      61                 :            :     Reference<XCommandEnvironment> const & xCmdEnv,
      62                 :            :     Reference<XComponentContext> const & xContext )
      63                 :            : {
      64         [ +  - ]:        248 :     ::xmlscript::LibDescriptor import;
      65         [ +  - ]:        248 :     ::ucbhelper::Content ucb_content( url, xCmdEnv );
      66 [ +  - ][ +  - ]:        248 :     xml_parse( ::xmlscript::importLibrary( import ), ucb_content, xContext );
      67                 :            : 
      68         [ -  + ]:        248 :     if (import.aName.isEmpty()) {
      69         [ #  # ]:          0 :         throw Exception( StrCannotDetermineLibName::get(),
      70         [ #  # ]:          0 :                          Reference<XInterface>() );
      71                 :            :     }
      72 [ +  - ][ +  - ]:        248 :     return import.aName;
      73                 :            : }
      74                 :            : 
      75                 :            : }
      76                 :            : }
      77                 :            : }
      78                 :            : 
      79                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10