LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/xmlhelp/source/treeview - tvread.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 22 0.0 %
Date: 2013-07-09 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 _TREEVIEW_TVREAD_HXX_
      21             : #define _TREEVIEW_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             : 
      39             : namespace treeview {
      40             : 
      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             : 
      62             :     class TVDom;
      63             :     class TVChildTarget;
      64             : 
      65           0 :     class TVBase
      66             :         : public cppu::OWeakObject,
      67             :           public com::sun::star::lang::XTypeProvider,
      68             :           public com::sun::star::container::XNameAccess,
      69             :           public com::sun::star::container::XHierarchicalNameAccess,
      70             :           public com::sun::star::util::XChangesNotifier,
      71             :           public com::sun::star::lang::XComponent
      72             :     {
      73             :         friend class TVChildTarget;
      74             : 
      75             :     public:
      76             : 
      77           0 :         virtual ~TVBase() { }
      78             : 
      79             :         // XInterface
      80             :         virtual com::sun::star::uno::Any SAL_CALL
      81             :         queryInterface(
      82             :             const com::sun::star::uno::Type& aType )
      83             :             throw( com::sun::star::uno::RuntimeException);
      84             : 
      85             :         virtual void SAL_CALL
      86             :         acquire(
      87             :             void )
      88             :             throw();
      89             : 
      90             :         virtual void SAL_CALL
      91             :         release(
      92             :             void )
      93             :             throw();
      94             : 
      95             : 
      96             :         // XTypeProvider
      97             : 
      98             :         XTYPEPROVIDER_DECL()
      99             : 
     100             : 
     101             :         // XNameAccess
     102             : 
     103             :         virtual com::sun::star::uno::Type SAL_CALL
     104           0 :         getElementType(  )
     105             :             throw( com::sun::star::uno::RuntimeException )
     106             :         {
     107           0 :             return getCppuVoidType();
     108             :         }
     109             : 
     110             : 
     111           0 :         virtual sal_Bool SAL_CALL hasElements()
     112             :             throw( com::sun::star::uno::RuntimeException )
     113             :         {
     114           0 :             return true;
     115             :         }
     116             : 
     117             :         // XChangesNotifier
     118             : 
     119             :         virtual void SAL_CALL
     120           0 :         addChangesListener(
     121             :             const com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >& aListener )
     122             :             throw( com::sun::star::uno::RuntimeException )
     123             :         {
     124             :             // read only
     125             :             (void)aListener;
     126           0 :         }
     127             : 
     128             :         virtual void SAL_CALL
     129           0 :         removeChangesListener(
     130             :             const com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >& aListener )
     131             :             throw( com::sun::star::uno::RuntimeException )
     132             :         {
     133             :             // read only
     134             :             (void)aListener;
     135           0 :         }
     136             : 
     137             : 
     138             :         // XComponent
     139             : 
     140           0 :         virtual void SAL_CALL dispose( )
     141             :             throw( com::sun::star::uno::RuntimeException )
     142             :         {
     143           0 :         }
     144             : 
     145           0 :         virtual void SAL_CALL addEventListener(
     146             :             const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener )
     147             :             throw( com::sun::star::uno::RuntimeException )
     148             :         {
     149             :             (void)xListener;
     150           0 :         }
     151             : 
     152             :         virtual void SAL_CALL
     153           0 :         removeEventListener(
     154             :             const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener )
     155             :             throw( com::sun::star::uno::RuntimeException )
     156             :         {
     157             :             (void)aListener;
     158           0 :         }
     159             : 
     160             : 
     161             :         // Abstract functions
     162             :         // XNameAccess
     163             : 
     164             :         virtual com::sun::star::uno::Any SAL_CALL
     165             :         getByName( const OUString& aName )
     166             :             throw( com::sun::star::container::NoSuchElementException,
     167             :                    com::sun::star::lang::WrappedTargetException,
     168             :                    com::sun::star::uno::RuntimeException) = 0;
     169             : 
     170             :         virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
     171             :         getElementNames( )
     172             :             throw( com::sun::star::uno::RuntimeException ) = 0;
     173             : 
     174             :         virtual sal_Bool SAL_CALL
     175             :         hasByName( const OUString& aName )
     176             :             throw( com::sun::star::uno::RuntimeException ) = 0;
     177             : 
     178             : 
     179             :         // XHierarchicalNameAccess
     180             : 
     181             :         virtual com::sun::star::uno::Any SAL_CALL
     182             :         getByHierarchicalName( const OUString& aName )
     183             :             throw( com::sun::star::container::NoSuchElementException,
     184             :                    com::sun::star::uno::RuntimeException ) = 0;
     185             : 
     186             :         virtual sal_Bool SAL_CALL
     187             :         hasByHierarchicalName( const OUString& aName )
     188             :             throw( com::sun::star::uno::RuntimeException ) = 0;
     189             : 
     190             :     }; // end class TVBase
     191             : 
     192             : 
     193             : 
     194             : 
     195             : 
     196             :     class TVRead
     197             :         : public TVBase
     198             :     {
     199             :         friend class TVChildTarget;
     200             : 
     201             :     public:
     202             :         TVRead( const ConfigData& configData,TVDom* tvDom = 0 );
     203             : 
     204             :         ~TVRead();
     205             : 
     206             :         // XNameAccess
     207             : 
     208             :         virtual com::sun::star::uno::Any SAL_CALL
     209             :         getByName( const OUString& aName )
     210             :             throw( com::sun::star::container::NoSuchElementException,
     211             :                    com::sun::star::lang::WrappedTargetException,
     212             :                    com::sun::star::uno::RuntimeException);
     213             : 
     214             :         virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
     215             :         getElementNames( )
     216             :             throw( com::sun::star::uno::RuntimeException );
     217             : 
     218             :         virtual sal_Bool SAL_CALL
     219             :         hasByName( const OUString& aName )
     220             :             throw( com::sun::star::uno::RuntimeException );
     221             : 
     222             : 
     223             :         // XHierarchicalNameAccess
     224             : 
     225             :         virtual com::sun::star::uno::Any SAL_CALL
     226             :         getByHierarchicalName( const OUString& aName )
     227             :             throw( com::sun::star::container::NoSuchElementException,
     228             :                    com::sun::star::uno::RuntimeException );
     229             : 
     230             :         virtual sal_Bool SAL_CALL
     231             :         hasByHierarchicalName( const OUString& aName )
     232             :             throw( com::sun::star::uno::RuntimeException );
     233             : 
     234             : 
     235             :     private:
     236             : 
     237             :         OUString                    Title;
     238             :         OUString                    TargetURL;
     239             :         rtl::Reference< TVChildTarget >  Children;
     240             : 
     241             :     };  // end class TVRead
     242             : 
     243             : 
     244             : 
     245             : 
     246             : 
     247             : 
     248             :     class TVChildTarget
     249             :         : public TVBase
     250             :     {
     251             :     public:
     252             : 
     253             :         TVChildTarget( const ConfigData& configData,TVDom* tvDom );
     254             : 
     255             :         TVChildTarget( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext );
     256             : 
     257             :         ~TVChildTarget();
     258             : 
     259             :         virtual com::sun::star::uno::Any SAL_CALL
     260             :         getByName( const OUString& aName )
     261             :             throw( com::sun::star::container::NoSuchElementException,
     262             :                    com::sun::star::lang::WrappedTargetException,
     263             :                    com::sun::star::uno::RuntimeException);
     264             : 
     265             :         virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
     266             :         getElementNames( )
     267             :             throw( com::sun::star::uno::RuntimeException );
     268             : 
     269             :         virtual sal_Bool SAL_CALL
     270             :         hasByName( const OUString& aName )
     271             :             throw( com::sun::star::uno::RuntimeException );
     272             : 
     273             : 
     274             :         // XHierarchicalNameAccess
     275             : 
     276             :         virtual com::sun::star::uno::Any SAL_CALL
     277             :         getByHierarchicalName( const OUString& aName )
     278             :             throw( com::sun::star::container::NoSuchElementException,
     279             :                    com::sun::star::uno::RuntimeException );
     280             : 
     281             :         virtual sal_Bool SAL_CALL
     282             :         hasByHierarchicalName( const OUString& aName )
     283             :             throw( com::sun::star::uno::RuntimeException );
     284             : 
     285             : 
     286             :     private:
     287             :         std::vector< rtl::Reference< TVRead > >   Elements;
     288             : 
     289             :         ConfigData init(
     290             :             const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext );
     291             : 
     292             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
     293             :         getConfiguration(
     294             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) const;
     295             : 
     296             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >
     297             :         getHierAccess( const ::com::sun::star::uno::Reference<  ::com::sun::star::lang::XMultiServiceFactory >& rxProvider,
     298             :                        const char* file ) const;
     299             : 
     300             :       OUString
     301             :       getKey( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
     302             :                 const char* key ) const;
     303             : 
     304             :       sal_Bool
     305             :       getBooleanKey(
     306             :                     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess,
     307             :                     const char* key) const;
     308             : 
     309             :       void subst( OUString& instpath ) const;
     310             : 
     311             :     bool SearchAndInsert(TVDom* p, TVDom* tvDom);
     312             : 
     313             :     void Check(TVDom* tvDom);
     314             : 
     315             :     };  // end class TVChildTarget
     316             : 
     317             : 
     318             :     enum IteratorState
     319             :     {
     320             :         USER_EXTENSIONS,
     321             :         SHARED_EXTENSIONS,
     322             :         BUNDLED_EXTENSIONS,
     323             :         END_REACHED
     324             :     };
     325             : 
     326           0 :     class ExtensionIteratorBase
     327             :     {
     328             :     public:
     329             :         ExtensionIteratorBase( const OUString& aLanguage );
     330             :         void init( void );
     331             : 
     332             :     private:
     333             :         com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetHelpPackageFromPackage
     334             :             ( const com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage,
     335             :               com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
     336             : 
     337             :     protected:
     338             :         com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextUserHelpPackage
     339             :             ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
     340             :         com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextSharedHelpPackage
     341             :             ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
     342             :         com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextBundledHelpPackage
     343             :             ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle );
     344             : 
     345             :         void implGetLanguageVectorFromPackage( ::std::vector< OUString > &rv,
     346             :             com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage );
     347             : 
     348             :         osl::Mutex                                                                  m_aMutex;
     349             :         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >    m_xContext;
     350             :         com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess3 >   m_xSFA;
     351             : 
     352             :         IteratorState                                                               m_eState;
     353             :         OUString                                                               m_aLanguage;
     354             : 
     355             :         com::sun::star::uno::Sequence< com::sun::star::uno::Reference
     356             :             < com::sun::star::deployment::XPackage > >                              m_aUserPackagesSeq;
     357             :         bool                                                                        m_bUserPackagesLoaded;
     358             : 
     359             :         com::sun::star::uno::Sequence< com::sun::star::uno::Reference
     360             :             < com::sun::star::deployment::XPackage > >                              m_aSharedPackagesSeq;
     361             :         bool                                                                        m_bSharedPackagesLoaded;
     362             : 
     363             :         com::sun::star::uno::Sequence< com::sun::star::uno::Reference
     364             :             < com::sun::star::deployment::XPackage > >                              m_aBundledPackagesSeq;
     365             :         bool                                                                        m_bBundledPackagesLoaded;
     366             : 
     367             :         int                                                                         m_iUserPackage;
     368             :         int                                                                         m_iSharedPackage;
     369             :         int                                                                         m_iBundledPackage;
     370             : 
     371             :     }; // end class ExtensionIteratorBase
     372             : 
     373             : 
     374             :     //===================================================================
     375           0 :     class TreeFileIterator : public ExtensionIteratorBase
     376             :     {
     377             :     public:
     378           0 :         TreeFileIterator( const OUString& aLanguage )
     379           0 :             : ExtensionIteratorBase( aLanguage )
     380           0 :         {}
     381             : 
     382             :         OUString nextTreeFile( sal_Int32& rnFileSize );
     383             : 
     384             :     private:
     385             :         OUString expandURL( const OUString& aURL );
     386             :         OUString implGetTreeFileFromPackage( sal_Int32& rnFileSize,
     387             :             com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage );
     388             : 
     389             :     }; // end class TreeFileIterator
     390             : 
     391             : 
     392             : }
     393             : 
     394             : 
     395             : #endif
     396             : 
     397             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10