LCOV - code coverage report
Current view: top level - ucb/source/ucp/hierarchy - hierarchyprovider.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 6 0.0 %
Date: 2014-04-14 Functions: 0 5 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             : #ifndef _HIERARCHYPROVIDER_HXX
      21             : #define _HIERARCHYPROVIDER_HXX
      22             : 
      23             : #include <boost/unordered_map.hpp>
      24             : #include <ucbhelper/providerhelper.hxx>
      25             : #include <com/sun/star/lang/XInitialization.hpp>
      26             : 
      27             : namespace com { namespace sun { namespace star {
      28             :     namespace container {
      29             :         class XHierarchicalNameAccess;
      30             :     }
      31             :     namespace util {
      32             :         class XOfficeInstallationDirectories;
      33             :     }
      34             : } } }
      35             : 
      36             : namespace hierarchy_ucp {
      37             : 
      38             : 
      39             : 
      40             : #define HIERARCHY_CONTENT_PROVIDER_SERVICE_NAME \
      41             :                 "com.sun.star.ucb.HierarchyContentProvider"
      42             : #define HIERARCHY_CONTENT_PROVIDER_SERVICE_NAME_LENGTH  41
      43             : 
      44             : #define HIERARCHY_URL_SCHEME \
      45             :                 "vnd.sun.star.hier"
      46             : #define HIERARCHY_URL_SCHEME_LENGTH 17
      47             : 
      48             : #define HIERARCHY_FOLDER_CONTENT_TYPE \
      49             :                 "application/" HIERARCHY_URL_SCHEME "-folder"
      50             : #define HIERARCHY_LINK_CONTENT_TYPE \
      51             :                 "application/" HIERARCHY_URL_SCHEME "-link"
      52             : 
      53             : 
      54             : 
      55           0 : struct ConfigProviderMapEntry
      56             : {
      57             :     com::sun::star::uno::Reference<
      58             :         com::sun::star::lang::XMultiServiceFactory > xConfigProvider;
      59             :     com::sun::star::uno::Reference<
      60             :         com::sun::star::container::XHierarchicalNameAccess > xRootReadAccess;
      61             :     bool bTriedToGetRootReadAccess;  // #82494#
      62             : 
      63           0 :     ConfigProviderMapEntry() : bTriedToGetRootReadAccess( false ) {}
      64             : };
      65             : 
      66             : struct equalString
      67             : {
      68           0 :     bool operator()(
      69             :         const OUString& rKey1, const OUString& rKey2 ) const
      70             :     {
      71           0 :         return !!( rKey1 == rKey2 );
      72             :     }
      73             : };
      74             : 
      75             : struct hashString
      76             : {
      77           0 :     size_t operator()( const OUString & rName ) const
      78             :     {
      79           0 :         return rName.hashCode();
      80             :     }
      81             : };
      82             : 
      83             : typedef boost::unordered_map
      84             : <
      85             :     OUString,  // servcie specifier
      86             :     ConfigProviderMapEntry,
      87             :     hashString,
      88             :     equalString
      89             : >
      90             : ConfigProviderMap;
      91             : 
      92             : 
      93             : 
      94             : class HierarchyContentProvider : public ::ucbhelper::ContentProviderImplHelper,
      95             :                                  public com::sun::star::lang::XInitialization
      96             : {
      97             :     ConfigProviderMap   m_aConfigProviderMap;
      98             :     com::sun::star::uno::Reference<
      99             :         com::sun::star::util::XOfficeInstallationDirectories > m_xOfficeInstDirs;
     100             : 
     101             : public:
     102             :     HierarchyContentProvider(
     103             :                 const com::sun::star::uno::Reference<
     104             :                     com::sun::star::uno::XComponentContext >& rxContext );
     105             :     virtual ~HierarchyContentProvider();
     106             : 
     107             :     // XInterface
     108             :     virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
     109             :         throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     110             :     virtual void SAL_CALL acquire()
     111             :         throw() SAL_OVERRIDE;
     112             :     virtual void SAL_CALL release()
     113             :         throw() SAL_OVERRIDE;
     114             : 
     115             :     // XTypeProvider
     116             :     virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
     117             :         throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     118             :     virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
     119             :         throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     120             : 
     121             :     // XServiceInfo
     122             :     virtual OUString SAL_CALL getImplementationName()
     123             :         throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     124             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     125             :         throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     126             :     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     127             :         throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     128             : 
     129             :     static OUString getImplementationName_Static();
     130             :     static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
     131             : 
     132             :     static css::uno::Reference< css::lang::XSingleServiceFactory >
     133             :     createServiceFactory( const css::uno::Reference<
     134             :                           css::lang::XMultiServiceFactory >& rxServiceMgr );
     135             : 
     136             :     // XContentProvider
     137             :     virtual com::sun::star::uno::Reference<
     138             :                 com::sun::star::ucb::XContent > SAL_CALL
     139             :     queryContent( const com::sun::star::uno::Reference<
     140             :                     com::sun::star::ucb::XContentIdentifier >& Identifier )
     141             :         throw( com::sun::star::ucb::IllegalIdentifierException,
     142             :                com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     143             : 
     144             :     // XInitialization
     145             :     virtual void SAL_CALL
     146             :     initialize( const ::com::sun::star::uno::Sequence<
     147             :                         ::com::sun::star::uno::Any >& aArguments )
     148             :         throw( ::com::sun::star::uno::Exception,
     149             :                ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     150             : 
     151             :     // Non-Interface methods
     152             :     com::sun::star::uno::Reference<
     153             :         com::sun::star::lang::XMultiServiceFactory >
     154             :     getConfigProvider( const OUString & rServiceSpecifier );
     155             :     com::sun::star::uno::Reference<
     156             :         com::sun::star::container::XHierarchicalNameAccess >
     157             :     getRootConfigReadNameAccess( const OUString & rServiceSpecifier );
     158             : 
     159             :     // Note: may retrun an empty reference.
     160             :     com::sun::star::uno::Reference<
     161             :         com::sun::star::util::XOfficeInstallationDirectories >
     162             :     getOfficeInstallationDirectories();
     163             : };
     164             : 
     165             : } // namespace hierarchy_ucp
     166             : 
     167             : #endif /* !_HIERARCHYPROVIDER_HXX */
     168             : 
     169             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10