LCOV - code coverage report
Current view: top level - xmlhelp/source/cxxhelp/inc - tvread.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 22 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 14 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 INCLUDED_XMLHELP_SOURCE_CXXHELP_INC_TVREAD_HXX
      21             : #define INCLUDED_XMLHELP_SOURCE_CXXHELP_INC_TVREAD_HXX
      22             : 
      23             : #include <vector>
      24             : #include <rtl/ref.hxx>
      25             : #include <rtl/ustring.hxx>
      26             : #include <ucbhelper/macros.hxx>
      27             : #include <com/sun/star/uno/Type.hxx>
      28             : #include <cppuhelper/weak.hxx>
      29             : #include <com/sun/star/uno/XInterface.hpp>
      30             : #include <com/sun/star/lang/XTypeProvider.hpp>
      31             : #include <com/sun/star/container/XNameAccess.hpp>
      32             : #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
      33             : #include <com/sun/star/util/XChangesNotifier.hpp>
      34             : #include <com/sun/star/lang/XComponent.hpp>
      35             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      36             : #include <com/sun/star/deployment/XPackage.hpp>
      37             : #include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
      38             : #include <cppuhelper/implbase4.hxx>
      39             : 
      40             : namespace treeview {
      41             : 
      42           0 :     class ConfigData
      43             :     {
      44             :     public:
      45             :         enum {
      46             :             PRODUCTNAME, PRODUCTVERSION, VENDORNAME, VENDORVERSION,
      47             :             VENDORSHORT };
      48             :         ConfigData();
      49             :         int                    m_vAdd[5];
      50             :         OUString          m_vReplacement[5];
      51             :         OUString          prodName,prodVersion,vendName,vendVersion,vendShort;
      52             : 
      53             :         std::vector< sal_uInt64 >       vFileLen;
      54             :         std::vector< OUString >    vFileURL;
      55             :         OUString locale,system;
      56             :         OUString appendix;
      57             : 
      58             :         void SAL_CALL replaceName( OUString& oustring ) const;
      59             :     };
      60             : 
      61             :     class TVDom;
      62             :     class TVChildTarget;
      63             : 
      64           0 :     class TVBase : public cppu::WeakImplHelper4 <
      65             :         css::container::XNameAccess,
      66             :         css::container::XHierarchicalNameAccess,
      67             :         css::util::XChangesNotifier,
      68             :         css::lang::XComponent >
      69             :     {
      70             :         friend class TVChildTarget;
      71             : 
      72             :     public:
      73             : 
      74           0 :         virtual ~TVBase() { }
      75             : 
      76             :         // XNameAccess
      77             : 
      78             :         virtual com::sun::star::uno::Type SAL_CALL
      79           0 :         getElementType(  )
      80             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
      81             :         {
      82           0 :             return cppu::UnoType<void>::get();
      83             :         }
      84             : 
      85           0 :         virtual sal_Bool SAL_CALL hasElements()
      86             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
      87             :         {
      88           0 :             return true;
      89             :         }
      90             : 
      91             :         // XChangesNotifier
      92             : 
      93             :         virtual void SAL_CALL
      94           0 :         addChangesListener(
      95             :             const com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >& aListener )
      96             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
      97             :         {
      98             :             // read only
      99             :             (void)aListener;
     100           0 :         }
     101             : 
     102             :         virtual void SAL_CALL
     103           0 :         removeChangesListener(
     104             :             const com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >& aListener )
     105             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
     106             :         {
     107             :             // read only
     108             :             (void)aListener;
     109           0 :         }
     110             : 
     111             :         // XComponent
     112             : 
     113           0 :         virtual void SAL_CALL dispose( )
     114             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
     115             :         {
     116           0 :         }
     117             : 
     118           0 :         virtual void SAL_CALL addEventListener(
     119             :             const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener )
     120             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
     121             :         {
     122             :             (void)xListener;
     123           0 :         }
     124             : 
     125             :         virtual void SAL_CALL
     126           0 :         removeEventListener(
     127             :             const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener )
     128             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
     129             :         {
     130             :             (void)aListener;
     131           0 :         }
     132             : 
     133             :         // Abstract functions
     134             :         // XNameAccess
     135             : 
     136             :         virtual com::sun::star::uno::Any SAL_CALL
     137             :         getByName( const OUString& aName )
     138             :             throw( com::sun::star::container::NoSuchElementException,
     139             :                    com::sun::star::lang::WrappedTargetException,
     140             :                    com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE = 0;
     141             : 
     142             :         virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
     143             :         getElementNames( )
     144             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE = 0;
     145             : 
     146             :         virtual sal_Bool SAL_CALL
     147             :         hasByName( const OUString& aName )
     148             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE = 0;
     149             : 
     150             :         // XHierarchicalNameAccess
     151             : 
     152             :         virtual com::sun::star::uno::Any SAL_CALL
     153             :         getByHierarchicalName( const OUString& aName )
     154             :             throw( com::sun::star::container::NoSuchElementException,
     155             :                    com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE = 0;
     156             : 
     157             :         virtual sal_Bool SAL_CALL
     158             :         hasByHierarchicalName( const OUString& aName )
     159             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE = 0;
     160             : 
     161             :     }; // end class TVBase
     162             : 
     163             :     class TVRead
     164             :         : public TVBase
     165             :     {
     166             :         friend class TVChildTarget;
     167             : 
     168             :     public:
     169             :         TVRead( const ConfigData& configData,TVDom* tvDom = 0 );
     170             : 
     171             :         virtual ~TVRead();
     172             : 
     173             :         // XNameAccess
     174             : 
     175             :         virtual com::sun::star::uno::Any SAL_CALL
     176             :         getByName( const OUString& aName )
     177             :             throw( com::sun::star::container::NoSuchElementException,
     178             :                    com::sun::star::lang::WrappedTargetException,
     179             :                    com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             : 
     181             :         virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
     182             :         getElementNames( )
     183             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     184             : 
     185             :         virtual sal_Bool SAL_CALL
     186             :         hasByName( const OUString& aName )
     187             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     188             : 
     189             :         // XHierarchicalNameAccess
     190             : 
     191             :         virtual com::sun::star::uno::Any SAL_CALL
     192             :         getByHierarchicalName( const OUString& aName )
     193             :             throw( com::sun::star::container::NoSuchElementException,
     194             :                    com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     195             : 
     196             :         virtual sal_Bool SAL_CALL
     197             :         hasByHierarchicalName( const OUString& aName )
     198             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     199             : 
     200             :     private:
     201             : 
     202             :         OUString                    Title;
     203             :         OUString                    TargetURL;
     204             :         rtl::Reference< TVChildTarget >  Children;
     205             : 
     206             :     };  // end class TVRead
     207             : 
     208             :     class TVChildTarget
     209             :         : public TVBase
     210             :     {
     211             :     public:
     212             : 
     213             :         TVChildTarget( const ConfigData& configData,TVDom* tvDom );
     214             : 
     215             :         TVChildTarget( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext );
     216             : 
     217             :         virtual ~TVChildTarget();
     218             : 
     219             :         virtual com::sun::star::uno::Any SAL_CALL
     220             :         getByName( const OUString& aName )
     221             :             throw( com::sun::star::container::NoSuchElementException,
     222             :                    com::sun::star::lang::WrappedTargetException,
     223             :                    com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     224             : 
     225             :         virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
     226             :         getElementNames( )
     227             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     228             : 
     229             :         virtual sal_Bool SAL_CALL
     230             :         hasByName( const OUString& aName )
     231             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     232             : 
     233             :         // XHierarchicalNameAccess
     234             : 
     235             :         virtual com::sun::star::uno::Any SAL_CALL
     236             :         getByHierarchicalName( const OUString& aName )
     237             :             throw( com::sun::star::container::NoSuchElementException,
     238             :                    com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     239             : 
     240             :         virtual sal_Bool SAL_CALL
     241             :         hasByHierarchicalName( const OUString& aName )
     242             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     243             : 
     244             :     private:
     245             :         std::vector< rtl::Reference< TVRead > >   Elements;
     246             : 
     247             :         static ConfigData init(
     248             :             const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext );
     249             : 
     250             :         static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
     251             :         getConfiguration(
     252             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
     253             : 
     254             :         static ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >
     255             :         getHierAccess( const ::com::sun::star::uno::Reference<  ::com::sun::star::lang::XMultiServiceFactory >& rxProvider,
     256             :                        const char* file );
     257             : 
     258             :         static OUString
     259             :         getKey( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
     260             :                 const char* key );
     261             : 
     262             :         static bool
     263             :         getBooleanKey(
     264             :                     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
     265             :                     const char* key);
     266             : 
     267             :         static void subst( OUString& instpath );
     268             : 
     269             :         bool SearchAndInsert(TVDom* p, TVDom* tvDom);
     270             : 
     271             :         void Check(TVDom* tvDom);
     272             : 
     273             :     };  // end class TVChildTarget
     274             : 
     275             :     enum IteratorState
     276             :     {
     277             :         USER_EXTENSIONS,
     278             :         SHARED_EXTENSIONS,
     279             :         BUNDLED_EXTENSIONS,
     280             :         END_REACHED
     281             :     };
     282             : 
     283           0 :     class ExtensionIteratorBase
     284             :     {
     285             :     public:
     286             :         ExtensionIteratorBase( const OUString& aLanguage );
     287             :         void init();
     288             : 
     289             :     private:
     290             :         static com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetHelpPackageFromPackage
     291             :             ( const com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage,
     292             :               com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
     293             : 
     294             :     protected:
     295             :         com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextUserHelpPackage
     296             :             ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
     297             :         com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextSharedHelpPackage
     298             :             ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
     299             :         com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextBundledHelpPackage
     300             :             ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
     301             : 
     302             :         void implGetLanguageVectorFromPackage( ::std::vector< OUString > &rv,
     303             :             com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage );
     304             : 
     305             :         osl::Mutex                                                                  m_aMutex;
     306             :         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >    m_xContext;
     307             :         com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess3 >   m_xSFA;
     308             : 
     309             :         IteratorState                                                               m_eState;
     310             :         OUString                                                               m_aLanguage;
     311             : 
     312             :         com::sun::star::uno::Sequence< com::sun::star::uno::Reference
     313             :             < com::sun::star::deployment::XPackage > >                              m_aUserPackagesSeq;
     314             :         bool                                                                        m_bUserPackagesLoaded;
     315             : 
     316             :         com::sun::star::uno::Sequence< com::sun::star::uno::Reference
     317             :             < com::sun::star::deployment::XPackage > >                              m_aSharedPackagesSeq;
     318             :         bool                                                                        m_bSharedPackagesLoaded;
     319             : 
     320             :         com::sun::star::uno::Sequence< com::sun::star::uno::Reference
     321             :             < com::sun::star::deployment::XPackage > >                              m_aBundledPackagesSeq;
     322             :         bool                                                                        m_bBundledPackagesLoaded;
     323             : 
     324             :         int                                                                         m_iUserPackage;
     325             :         int                                                                         m_iSharedPackage;
     326             :         int                                                                         m_iBundledPackage;
     327             : 
     328             :     }; // end class ExtensionIteratorBase
     329             : 
     330           0 :     class TreeFileIterator : public ExtensionIteratorBase
     331             :     {
     332             :     public:
     333           0 :         TreeFileIterator( const OUString& aLanguage )
     334           0 :             : ExtensionIteratorBase( aLanguage )
     335           0 :         {}
     336             : 
     337             :         OUString nextTreeFile( sal_Int32& rnFileSize );
     338             : 
     339             :     private:
     340             :         OUString expandURL( const OUString& aURL );
     341             :         OUString implGetTreeFileFromPackage( sal_Int32& rnFileSize,
     342             :             com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage );
     343             : 
     344             :     }; // end class TreeFileIterator
     345             : 
     346             : }
     347             : 
     348             : #endif
     349             : 
     350             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11