LCOV - code coverage report
Current view: top level - xmlhelp/source/cxxhelp/provider - provider.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 11 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 _PROVIDER_HXX
      21             : #define _PROVIDER_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <osl/mutex.hxx>
      25             : #include <ucbhelper/providerhelper.hxx>
      26             : #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
      27             : #include <com/sun/star/container/XContainerListener.hpp>
      28             : #include <com/sun/star/container/XContainer.hpp>
      29             : #include <com/sun/star/lang/XComponent.hpp>
      30             : 
      31             : namespace chelp {
      32             : 
      33             : // UNO service name for the provider. This name will be used by the UCB to
      34             : // create instances of the provider.
      35             : 
      36             : #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME1   "com.sun.star.help.XMLHelp"
      37             : #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH1 25
      38             : 
      39             : #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME2  "com.sun.star.ucb.HelpContentProvider"
      40             : #define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH2 36
      41             : 
      42             : // URL scheme. This is the scheme the provider will be able to create
      43             : // contents for. The UCB will select the provider ( i.e. in order to create
      44             : // contents ) according to this scheme.
      45             : 
      46             : #define MYUCP_URL_SCHEME        "vnd.sun.star.help"
      47             : #define MYUCP_URL_SCHEME_LENGTH 18
      48             : #define MYUCP_CONTENT_TYPE      "application/vnd.sun.star.xmlhelp"    // UCB Content Type.
      49             : 
      50             :     class Databases;
      51             : 
      52             :     class ContentProvider :
      53             :         public ::ucbhelper::ContentProviderImplHelper,
      54             :         public ::com::sun::star::container::XContainerListener,
      55             :         public ::com::sun::star::lang::XComponent
      56             :     {
      57             :     public:
      58             :         ContentProvider(
      59             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
      60             : 
      61             :         virtual ~ContentProvider();
      62             : 
      63             :         // XInterface
      64             :         virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
      65             :             throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      66             :         virtual void SAL_CALL acquire()
      67             :             throw() SAL_OVERRIDE;
      68             :         virtual void SAL_CALL release()
      69             :             throw() SAL_OVERRIDE;
      70             : 
      71             :         // XTypeProvider
      72             :         virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
      73             :             throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      74             :         virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
      75             :             throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      76             : 
      77             :         // XServiceInfo
      78             :         virtual OUString SAL_CALL getImplementationName()
      79             :             throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      80             :         virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
      81             :             throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      82             :         virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
      83             :             throw( css::uno::RuntimeException,
      84             :                    std::exception ) SAL_OVERRIDE;
      85             : 
      86             :         static OUString getImplementationName_Static();
      87             : 
      88             :         static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
      89             : 
      90             :         static css::uno::Reference< css::lang::XSingleServiceFactory > createServiceFactory(
      91             :                 const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr );
      92             : 
      93             :         // XContentProvider
      94             :         virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(
      95             :                 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier )
      96             :             throw( css::ucb::IllegalIdentifierException,
      97             :                    css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      98             : 
      99             :         // Additional interfaces
     100             : 
     101             :         // XComponent
     102             : 
     103             :         virtual void SAL_CALL
     104             :         dispose(  )
     105             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     106             : 
     107             :         virtual void SAL_CALL
     108           0 :         addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
     109             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     110             :         {
     111             :             (void)xListener;
     112           0 :         }
     113             : 
     114             :         virtual void SAL_CALL
     115           0 :         removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
     116             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     117             :         {
     118             :             (void)aListener;
     119           0 :         }
     120             : 
     121             :         // XConainerListener ( deriver from XEventListener )
     122             : 
     123             :         virtual void SAL_CALL
     124           0 :         disposing( const ::com::sun::star::lang::EventObject& Source )
     125             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     126             :         {
     127             :             (void)Source;
     128           0 :             m_xContainer = com::sun::star::uno::Reference<com::sun::star::container::XContainer>(0);
     129           0 :         }
     130             : 
     131             :         virtual void SAL_CALL
     132           0 :         elementInserted( const ::com::sun::star::container::ContainerEvent& Event )
     133             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     134             :         {
     135             :             (void)Event;
     136           0 :         }
     137             : 
     138             :         virtual void SAL_CALL
     139           0 :         elementRemoved( const ::com::sun::star::container::ContainerEvent& Event )
     140             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
     141             :         {
     142             :             (void)Event;
     143           0 :         }
     144             : 
     145             :         virtual void SAL_CALL
     146             :         elementReplaced( const ::com::sun::star::container::ContainerEvent& Event )
     147             :             throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     148             : 
     149             :         // Non-interface methods.
     150             : 
     151             :     private:
     152             : 
     153             :         osl::Mutex     m_aMutex;
     154             :         bool           isInitialized;
     155             :         OUString  m_aScheme;
     156             :         Databases*     m_pDatabases;
     157             :         com::sun::star::uno::Reference<com::sun::star::container::XContainer> m_xContainer;
     158             : 
     159             :         // private methods
     160             : 
     161             :         void init();
     162             : 
     163             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
     164             :         getConfiguration() const;
     165             : 
     166             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >
     167             :         getHierAccess( const ::com::sun::star::uno::Reference<  ::com::sun::star::lang::XMultiServiceFactory >& sProvider,
     168             :                        const char* file ) const;
     169             : 
     170             :         OUString
     171             :         getKey( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
     172             :                 const char* key ) const;
     173             : 
     174             :       sal_Bool
     175             :       getBooleanKey(
     176             :                     const ::com::sun::star::uno::Reference<
     177             :                     ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
     178             :                     const char* key) const;
     179             : 
     180             :       void subst( OUString& instpath ) const;
     181             :     };
     182             : 
     183             : }
     184             : 
     185             : #endif
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10