LCOV - code coverage report
Current view: top level - libreoffice/reportdesign/source/filter/xml - dbloader2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 33 0.0 %
Date: 2012-12-27 Functions: 0 7 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             : #include "dbloader2.hxx"
      20             : #include <tools/urlobj.hxx>
      21             : #include <comphelper/sequence.hxx>
      22             : // -------------------------------------------------------------------------
      23             : namespace rptxml
      24             : {
      25             : 
      26             : using namespace ::ucbhelper;
      27             : using namespace ::com::sun::star::task;
      28             : using namespace ::com::sun::star::uno;
      29             : using namespace ::com::sun::star::ucb;
      30             : using namespace ::com::sun::star::io;
      31             : using namespace ::com::sun::star::util;
      32             : using namespace ::com::sun::star::frame;
      33             : using namespace ::com::sun::star::beans;
      34             : using namespace ::com::sun::star::container;
      35             : using namespace ::com::sun::star::lang;
      36             : using namespace ::com::sun::star::document;
      37             : using namespace ::com::sun::star::registry;
      38             : using namespace ::com::sun::star::embed;
      39             : using namespace ::com::sun::star::ui::dialogs;
      40             : using ::com::sun::star::awt::XWindow;
      41             : 
      42             : // -------------------------------------------------------------------------
      43           0 : ORptTypeDetection::ORptTypeDetection(Reference< XComponentContext > const & xContext)
      44           0 : : m_xContext(xContext)
      45             : {
      46           0 : }
      47             : // -------------------------------------------------------------------------
      48           0 : ::rtl::OUString SAL_CALL ORptTypeDetection::detect( Sequence< ::com::sun::star::beans::PropertyValue >& Descriptor ) throw (RuntimeException)
      49             : {
      50             : 
      51           0 :     ::comphelper::SequenceAsHashMap aTemp(Descriptor);
      52           0 :     ::rtl::OUString sTemp = aTemp.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")),::rtl::OUString());
      53             : 
      54           0 :     if ( !sTemp.isEmpty() )
      55             :     {
      56           0 :         INetURLObject aURL(sTemp);
      57           0 :         if ( aURL.GetExtension().equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("orp")) )
      58           0 :             return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StarBaseReport"));
      59             :         else
      60             :         {
      61             :             try
      62             :             {
      63           0 :                 Reference<XPropertySet> xProp(::comphelper::OStorageHelper::GetStorageFromURL(sTemp,ElementModes::READ, m_xContext),UNO_QUERY);
      64           0 :                 if ( xProp.is() )
      65             :                 {
      66           0 :                     ::rtl::OUString sMediaType;
      67           0 :                     xProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")) ) >>= sMediaType;
      68           0 :                     if ( sMediaType == MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII )
      69           0 :                         return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StarBaseReport"));
      70           0 :                     ::comphelper::disposeComponent(xProp);
      71           0 :                 }
      72             :             }
      73           0 :             catch(Exception&)
      74             :             {
      75             :             }
      76           0 :         }
      77             :     }
      78           0 :     return ::rtl::OUString();
      79             : }
      80             : // -------------------------------------------------------------------------
      81             : Reference< XInterface > SAL_CALL
      82           0 :         ORptTypeDetection::create(Reference< XComponentContext > const & xContext)
      83             : {
      84           0 :     return *(new ORptTypeDetection(xContext));
      85             : }
      86             : // -------------------------------------------------------------------------
      87             : // XServiceInfo
      88           0 : ::rtl::OUString SAL_CALL ORptTypeDetection::getImplementationName() throw(  )
      89             : {
      90           0 :     return getImplementationName_Static();
      91             : }
      92             : // -------------------------------------------------------------------------
      93             : 
      94             : // XServiceInfo
      95           0 : sal_Bool SAL_CALL ORptTypeDetection::supportsService(const ::rtl::OUString& ServiceName) throw(  )
      96             : {
      97           0 :     return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static());
      98             : }
      99             : // -------------------------------------------------------------------------
     100             : // XServiceInfo
     101           0 : Sequence< ::rtl::OUString > SAL_CALL ORptTypeDetection::getSupportedServiceNames(void) throw(  )
     102             : {
     103           0 :     return getSupportedServiceNames_Static();
     104             : }
     105             : // -------------------------------------------------------------------------
     106             : // ORegistryServiceManager_Static
     107           0 : Sequence< ::rtl::OUString > ORptTypeDetection::getSupportedServiceNames_Static(void) throw( RuntimeException )
     108             : {
     109           0 :     Sequence< ::rtl::OUString > aSNS( 1 );
     110           0 :     aSNS.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExtendedTypeDetection"));
     111           0 :     return aSNS;
     112             : }
     113             : // -----------------------------------------------------------------------------
     114             : // -----------------------------------------------------------------------------
     115             : }//rptxml
     116             : // -----------------------------------------------------------------------------
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10