17b6bd0c4SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 37b6bd0c4SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 47b6bd0c4SAndrew Rist * or more contributor license agreements. See the NOTICE file 57b6bd0c4SAndrew Rist * distributed with this work for additional information 67b6bd0c4SAndrew Rist * regarding copyright ownership. The ASF licenses this file 77b6bd0c4SAndrew Rist * to you under the Apache License, Version 2.0 (the 87b6bd0c4SAndrew Rist * "License"); you may not use this file except in compliance 97b6bd0c4SAndrew Rist * with the License. You may obtain a copy of the License at 107b6bd0c4SAndrew Rist * 117b6bd0c4SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 127b6bd0c4SAndrew Rist * 137b6bd0c4SAndrew Rist * Unless required by applicable law or agreed to in writing, 147b6bd0c4SAndrew Rist * software distributed under the License is distributed on an 157b6bd0c4SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 167b6bd0c4SAndrew Rist * KIND, either express or implied. See the License for the 177b6bd0c4SAndrew Rist * specific language governing permissions and limitations 187b6bd0c4SAndrew Rist * under the License. 197b6bd0c4SAndrew Rist * 207b6bd0c4SAndrew Rist *************************************************************/ 217b6bd0c4SAndrew Rist 227b6bd0c4SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _DATABASES_HXX_ 25cdf0e10cSrcweir #define _DATABASES_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifndef INCLUDED_STL_SET 28cdf0e10cSrcweir #include <set> 29cdf0e10cSrcweir #define INCLUDED_STL_SET 30cdf0e10cSrcweir #endif 31cdf0e10cSrcweir #ifndef INCLUDED_STL_VECTOR 32cdf0e10cSrcweir #include <vector> 33cdf0e10cSrcweir #define INCLUDED_STL_VECTOR 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir #include <hash_map> 36cdf0e10cSrcweir #include <hash_set> 37cdf0e10cSrcweir #include <osl/mutex.hxx> 38cdf0e10cSrcweir #include <rtl/ustring.hxx> 39cdf0e10cSrcweir #include <rtl/string.hxx> 40cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 41cdf0e10cSrcweir #include <com/sun/star/ucb/XContent.hpp> 42cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp> 43cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 44cdf0e10cSrcweir #include <com/sun/star/lang/XMultiComponentFactory.hpp> 45cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 46cdf0e10cSrcweir #include <com/sun/star/i18n/XCollator.hpp> 47cdf0e10cSrcweir #include <com/sun/star/deployment/XPackage.hpp> 48cdf0e10cSrcweir #include "com/sun/star/ucb/XSimpleFileAccess.hpp" 49cdf0e10cSrcweir 50cdf0e10cSrcweir // Forward declaration 51cdf0e10cSrcweir 52cdf0e10cSrcweir 53*70e197d9SHerbert Dürr namespace helpdatafileproxy { 54cdf0e10cSrcweir 55*70e197d9SHerbert Dürr class Hdf; 56cdf0e10cSrcweir 57cdf0e10cSrcweir } 58cdf0e10cSrcweir 59cdf0e10cSrcweir 60cdf0e10cSrcweir namespace chelp { 61cdf0e10cSrcweir 62cdf0e10cSrcweir 63cdf0e10cSrcweir class Databases; 64cdf0e10cSrcweir class URLParameter; 65cdf0e10cSrcweir 66cdf0e10cSrcweir class StaticModuleInformation 67cdf0e10cSrcweir { 68cdf0e10cSrcweir private: 69cdf0e10cSrcweir 70cdf0e10cSrcweir rtl::OUString m_aStartId; 71cdf0e10cSrcweir rtl::OUString m_aProgramSwitch; 72cdf0e10cSrcweir rtl::OUString m_aTitle; 73cdf0e10cSrcweir rtl::OUString m_aHeading; 74cdf0e10cSrcweir rtl::OUString m_aFulltext; 75cdf0e10cSrcweir int m_nOrder; 76cdf0e10cSrcweir 77cdf0e10cSrcweir 78cdf0e10cSrcweir public: 79cdf0e10cSrcweir StaticModuleInformation(rtl::OUString aTitle,rtl::OUString aStartId,rtl::OUString aProgramSwitch,rtl::OUString aHeading,rtl::OUString aFulltext,rtl::OUString aOrder)80cdf0e10cSrcweir StaticModuleInformation( rtl::OUString aTitle, 81cdf0e10cSrcweir rtl::OUString aStartId, 82cdf0e10cSrcweir rtl::OUString aProgramSwitch, 83cdf0e10cSrcweir rtl::OUString aHeading, 84cdf0e10cSrcweir rtl::OUString aFulltext, 85cdf0e10cSrcweir rtl::OUString aOrder ) 86cdf0e10cSrcweir : m_aStartId( aStartId ), 87cdf0e10cSrcweir m_aProgramSwitch( aProgramSwitch ), 88cdf0e10cSrcweir m_aTitle( aTitle ), 89cdf0e10cSrcweir m_aHeading( aHeading ), 90cdf0e10cSrcweir m_aFulltext( aFulltext ), 91cdf0e10cSrcweir m_nOrder( aOrder.toInt32() ) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir } 94cdf0e10cSrcweir ~StaticModuleInformation()95cdf0e10cSrcweir ~StaticModuleInformation() { } 96cdf0e10cSrcweir get_title()97cdf0e10cSrcweir rtl::OUString get_title() { return m_aTitle; } get_id()98cdf0e10cSrcweir rtl::OUString get_id() { return m_aStartId; } get_program()99cdf0e10cSrcweir rtl::OUString get_program() { return m_aProgramSwitch; } get_heading()100cdf0e10cSrcweir rtl::OUString get_heading() { return m_aHeading; } get_fulltext()101cdf0e10cSrcweir rtl::OUString get_fulltext() { return m_aFulltext; } get_order()102cdf0e10cSrcweir int get_order() { return m_nOrder; } 103cdf0e10cSrcweir }; // end class StaticModuleInformation 104cdf0e10cSrcweir 105cdf0e10cSrcweir 106cdf0e10cSrcweir 107cdf0e10cSrcweir class KeywordInfo 108cdf0e10cSrcweir { 109cdf0e10cSrcweir public: 110cdf0e10cSrcweir 111cdf0e10cSrcweir class KeywordElement 112cdf0e10cSrcweir { 113cdf0e10cSrcweir friend struct KeywordElementComparator; 114cdf0e10cSrcweir friend class KeywordInfo; 115cdf0e10cSrcweir 116cdf0e10cSrcweir public: 117cdf0e10cSrcweir 118cdf0e10cSrcweir KeywordElement( Databases* pDatabases, 119*70e197d9SHerbert Dürr helpdatafileproxy::Hdf* pHdf, 120cdf0e10cSrcweir rtl::OUString& key, 121cdf0e10cSrcweir rtl::OUString& ids ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir private: 124cdf0e10cSrcweir 125cdf0e10cSrcweir rtl::OUString key; 126cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > listId; 127cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > listAnchor; 128cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > listTitle; 129cdf0e10cSrcweir 130*70e197d9SHerbert Dürr void init( Databases *pDatabases,helpdatafileproxy::Hdf* pHdf,const rtl::OUString& ids ); 131cdf0e10cSrcweir }; 132cdf0e10cSrcweir 133cdf0e10cSrcweir 134cdf0e10cSrcweir KeywordInfo( const std::vector< KeywordElement >& aVector ); 135cdf0e10cSrcweir ~KeywordInfo()136cdf0e10cSrcweir ~KeywordInfo() { }; 137cdf0e10cSrcweir 138cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString >& getKeywordList()139cdf0e10cSrcweir getKeywordList() { return listKey; } 140cdf0e10cSrcweir 141cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< rtl::OUString > >& getIdList()142cdf0e10cSrcweir getIdList() { return listId; } 143cdf0e10cSrcweir 144cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< rtl::OUString > >& getAnchorList()145cdf0e10cSrcweir getAnchorList() { return listAnchor; } 146cdf0e10cSrcweir 147cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< rtl::OUString > >& getTitleList()148cdf0e10cSrcweir getTitleList() { return listTitle; } 149cdf0e10cSrcweir 150cdf0e10cSrcweir private: 151cdf0e10cSrcweir 152cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > listKey; 153cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< rtl::OUString > > listId,listAnchor,listTitle; 154cdf0e10cSrcweir }; // end class KeywordInfo 155cdf0e10cSrcweir 156cdf0e10cSrcweir 157cdf0e10cSrcweir 158cdf0e10cSrcweir class Databases 159cdf0e10cSrcweir { 160cdf0e10cSrcweir public: 161cdf0e10cSrcweir 162cdf0e10cSrcweir struct eq 163cdf0e10cSrcweir { operator ()chelp::Databases::eq164cdf0e10cSrcweir bool operator()( const rtl::OUString& rKey1, const rtl::OUString& rKey2 ) const 165cdf0e10cSrcweir { 166cdf0e10cSrcweir return rKey1.compareTo( rKey2 ) == 0; 167cdf0e10cSrcweir } 168cdf0e10cSrcweir }; 169cdf0e10cSrcweir 170cdf0e10cSrcweir struct ha 171cdf0e10cSrcweir { operator ()chelp::Databases::ha172cdf0e10cSrcweir size_t operator()( const rtl::OUString& rName ) const 173cdf0e10cSrcweir { 174cdf0e10cSrcweir return rName.hashCode(); 175cdf0e10cSrcweir } 176cdf0e10cSrcweir }; 177cdf0e10cSrcweir 178cdf0e10cSrcweir 179cdf0e10cSrcweir /** 180cdf0e10cSrcweir * Input is the installdirectory in system dependent notation 181cdf0e10cSrcweir */ 182cdf0e10cSrcweir 183cdf0e10cSrcweir Databases( sal_Bool showBasic, 184cdf0e10cSrcweir const rtl::OUString& instPath, 185cdf0e10cSrcweir const com::sun::star::uno::Sequence< rtl::OUString >& imagesZipPaths, 186cdf0e10cSrcweir const rtl::OUString& productName, 187cdf0e10cSrcweir const rtl::OUString& productVersion, 188cdf0e10cSrcweir const rtl::OUString& styleSheet, 189cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext ); 190cdf0e10cSrcweir 191cdf0e10cSrcweir ~Databases(); 192cdf0e10cSrcweir 193cdf0e10cSrcweir rtl::OString getImagesZipFileURL(); 194cdf0e10cSrcweir 195cdf0e10cSrcweir rtl::OUString getInstallPathAsSystemPath(); 196cdf0e10cSrcweir 197cdf0e10cSrcweir rtl::OUString getInstallPathAsURL(); 198cdf0e10cSrcweir 199cdf0e10cSrcweir const std::vector< rtl::OUString >& getModuleList( const rtl::OUString& Language ); 200cdf0e10cSrcweir 201cdf0e10cSrcweir StaticModuleInformation* getStaticInformationForModule( const rtl::OUString& Module, 202cdf0e10cSrcweir const rtl::OUString& Language ); 203cdf0e10cSrcweir 204cdf0e10cSrcweir bool checkModuleMatchForExtension( const rtl::OUString& Database, const rtl::OUString& doclist ); 205cdf0e10cSrcweir KeywordInfo* getKeyword( const rtl::OUString& Module, 206cdf0e10cSrcweir const rtl::OUString& Language ); 207cdf0e10cSrcweir 208*70e197d9SHerbert Dürr helpdatafileproxy::Hdf* getHelpDataFile( const rtl::OUString& Module, 209cdf0e10cSrcweir const rtl::OUString& Language, bool helpText = false, 210cdf0e10cSrcweir const rtl::OUString* pExtensionPath = NULL ); 211cdf0e10cSrcweir 212cdf0e10cSrcweir 213cdf0e10cSrcweir /** 214cdf0e10cSrcweir * The following method returns the Collator for the given language-country combination 215cdf0e10cSrcweir */ 216cdf0e10cSrcweir 217cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::i18n::XCollator > 218cdf0e10cSrcweir getCollator( const rtl::OUString& Language, 219cdf0e10cSrcweir const rtl::OUString& System ); // System not used by current implementation 220cdf0e10cSrcweir // // of XCollator 221cdf0e10cSrcweir 222cdf0e10cSrcweir /** 223cdf0e10cSrcweir * Returns a copy of the popupfile 224cdf0e10cSrcweir */ 225cdf0e10cSrcweir 226cdf0e10cSrcweir void popupDocument( URLParameter* urlPar,char **buffer,int *byteCount ); 227cdf0e10cSrcweir 228cdf0e10cSrcweir 229cdf0e10cSrcweir /** 230cdf0e10cSrcweir * Returns the cascading stlye sheet used to format the HTML-output. 231cdf0e10cSrcweir * First try is language directory, second try is main installation directory. 232cdf0e10cSrcweir */ 233cdf0e10cSrcweir 234cdf0e10cSrcweir void cascadingStylesheet( const rtl::OUString& Language, 235cdf0e10cSrcweir char** buffer, 236cdf0e10cSrcweir int* byteCount ); 237cdf0e10cSrcweir 238cdf0e10cSrcweir 239cdf0e10cSrcweir /** 240cdf0e10cSrcweir * Changes the the stylesheet for further reads. 241cdf0e10cSrcweir */ 242cdf0e10cSrcweir 243cdf0e10cSrcweir void changeCSS(const rtl::OUString& newStyleSheet); 244cdf0e10cSrcweir 245cdf0e10cSrcweir 246cdf0e10cSrcweir /** 247cdf0e10cSrcweir * Returns the active help text for the given module, language and id. 248cdf0e10cSrcweir */ 249cdf0e10cSrcweir 250cdf0e10cSrcweir void setActiveText( const rtl::OUString& Module, 251cdf0e10cSrcweir const rtl::OUString& Language, 252cdf0e10cSrcweir const rtl::OUString& Id, 253cdf0e10cSrcweir char** buffer, 254cdf0e10cSrcweir int* byteCount ); 255cdf0e10cSrcweir 256cdf0e10cSrcweir /** 257cdf0e10cSrcweir * Has the purpose of forcing the the jarfile to stay open 258cdf0e10cSrcweir */ 259cdf0e10cSrcweir 260cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > 261cdf0e10cSrcweir jarFile( const rtl::OUString& jar, 262cdf0e10cSrcweir const rtl::OUString& Language ); 263cdf0e10cSrcweir 264cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > 265cdf0e10cSrcweir findJarFileForPath( const rtl::OUString& jar, const rtl::OUString& Language, 266cdf0e10cSrcweir const rtl::OUString& path, rtl::OUString* o_pExtensionPath = NULL, 267cdf0e10cSrcweir rtl::OUString* o_pExtensionRegistryPath = NULL ); 268cdf0e10cSrcweir 269cdf0e10cSrcweir /** 270cdf0e10cSrcweir * Maps a given language-locale combination to language. 271cdf0e10cSrcweir */ 272cdf0e10cSrcweir 273cdf0e10cSrcweir rtl::OUString processLang( const rtl::OUString& Language ); 274cdf0e10cSrcweir 275cdf0e10cSrcweir 276cdf0e10cSrcweir /** 277cdf0e10cSrcweir * Maps a given language-locale combination to locale. 278cdf0e10cSrcweir * The returned string maybe empty 279cdf0e10cSrcweir */ 280cdf0e10cSrcweir 281cdf0e10cSrcweir rtl::OUString country( const rtl::OUString& Language ); 282cdf0e10cSrcweir 283cdf0e10cSrcweir 284cdf0e10cSrcweir void replaceName( rtl::OUString& oustring ) const; 285cdf0e10cSrcweir getProductName() const286cdf0e10cSrcweir rtl::OUString getProductName() const { return m_vReplacement[0]; } getProductVersion() const287cdf0e10cSrcweir rtl::OUString getProductVersion() const { return m_vReplacement[1]; } 288cdf0e10cSrcweir 289cdf0e10cSrcweir rtl::OUString expandURL( const rtl::OUString& aURL ); 290cdf0e10cSrcweir 291cdf0e10cSrcweir static rtl::OUString expandURL( const rtl::OUString& aURL, 292cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext ); 293cdf0e10cSrcweir 294cdf0e10cSrcweir private: 295cdf0e10cSrcweir 296cdf0e10cSrcweir osl::Mutex m_aMutex; 297cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; 298cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::lang::XMultiComponentFactory > m_xSMgr; 299cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess > m_xSFA; 300cdf0e10cSrcweir 301cdf0e10cSrcweir sal_Bool m_bShowBasic; 302cdf0e10cSrcweir int m_nErrorDocLength; 303cdf0e10cSrcweir char* m_pErrorDoc; 304cdf0e10cSrcweir 305cdf0e10cSrcweir int m_nCustomCSSDocLength; 306cdf0e10cSrcweir char* m_pCustomCSSDoc; 307cdf0e10cSrcweir rtl::OUString m_aCSS; 308cdf0e10cSrcweir 309cdf0e10cSrcweir #define PRODUCTNAME 0 310cdf0e10cSrcweir #define PRODUCTVERSION 1 311cdf0e10cSrcweir #define VENDORNAME 2 312cdf0e10cSrcweir #define VENDORVERSION 3 313cdf0e10cSrcweir #define VENDORSHORT 4 314cdf0e10cSrcweir #define NEWPRODUCTNAME 5 315cdf0e10cSrcweir #define NEWPRODUCTVERSION 6 316cdf0e10cSrcweir 317cdf0e10cSrcweir int m_vAdd[7]; 318cdf0e10cSrcweir rtl::OUString m_vReplacement[7]; 319cdf0e10cSrcweir rtl::OUString newProdName,newProdVersion, 320cdf0e10cSrcweir prodName,prodVersion,vendName,vendVersion,vendShort; 321cdf0e10cSrcweir 322cdf0e10cSrcweir rtl::OUString m_aInstallDirectory; // Installation directory 323cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > m_aImagesZipPaths; 324cdf0e10cSrcweir rtl::OString m_aImagesZipFileURL; 325cdf0e10cSrcweir sal_Int16 m_nSymbolsStyle; 326cdf0e10cSrcweir rtl::OUString m_aInstallDirectoryWithoutEncoding; // a work around for a Sablot bug. 327cdf0e10cSrcweir rtl::OUString m_aInstallDirectoryAsSystemPath; // Installation directory 328cdf0e10cSrcweir 329cdf0e10cSrcweir std::vector< rtl::OUString > m_avModules; 330cdf0e10cSrcweir 331*70e197d9SHerbert Dürr typedef std::hash_map< rtl::OUString,helpdatafileproxy::Hdf*,ha,eq > DatabasesTable; 332cdf0e10cSrcweir DatabasesTable m_aDatabases; // Language and module dependent databases 333cdf0e10cSrcweir 334cdf0e10cSrcweir typedef std::hash_map< rtl::OUString,rtl::OUString,ha,eq > LangSetTable; 335cdf0e10cSrcweir LangSetTable m_aLangSet; // Mapping to of lang-country to lang 336cdf0e10cSrcweir 337cdf0e10cSrcweir typedef std::hash_map< rtl::OUString,StaticModuleInformation*,ha,eq > ModInfoTable; 338cdf0e10cSrcweir ModInfoTable m_aModInfo; // Module information 339cdf0e10cSrcweir 340cdf0e10cSrcweir typedef std::hash_map< rtl::OUString,KeywordInfo*,ha,eq > KeywordInfoTable; 341cdf0e10cSrcweir KeywordInfoTable m_aKeywordInfo; // Module information 342cdf0e10cSrcweir 343cdf0e10cSrcweir typedef 344cdf0e10cSrcweir std::hash_map< 345cdf0e10cSrcweir rtl::OUString, 346cdf0e10cSrcweir ::com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess >, 347cdf0e10cSrcweir ha, 348cdf0e10cSrcweir eq > ZipFileTable; 349cdf0e10cSrcweir ZipFileTable m_aZipFileTable; // No closing of an once opened jarfile 350cdf0e10cSrcweir 351cdf0e10cSrcweir typedef 352cdf0e10cSrcweir std::hash_map< 353cdf0e10cSrcweir rtl::OUString, 354cdf0e10cSrcweir ::com::sun::star::uno::Reference< com::sun::star::i18n::XCollator >, 355cdf0e10cSrcweir ha, 356cdf0e10cSrcweir eq > CollatorTable; 357cdf0e10cSrcweir CollatorTable m_aCollatorTable; 358cdf0e10cSrcweir 359cdf0e10cSrcweir 360cdf0e10cSrcweir struct ostring_eq 361cdf0e10cSrcweir { operator ()chelp::Databases::ostring_eq362cdf0e10cSrcweir bool operator()( const rtl::OString& rKey1, const rtl::OString& rKey2 ) const 363cdf0e10cSrcweir { 364cdf0e10cSrcweir return rKey1.compareTo( rKey2 ) == 0; 365cdf0e10cSrcweir } 366cdf0e10cSrcweir }; 367cdf0e10cSrcweir 368cdf0e10cSrcweir struct ostring_ha 369cdf0e10cSrcweir { operator ()chelp::Databases::ostring_ha370cdf0e10cSrcweir size_t operator()( const rtl::OString& rName ) const 371cdf0e10cSrcweir { 372cdf0e10cSrcweir return rName.hashCode(); 373cdf0e10cSrcweir } 374cdf0e10cSrcweir }; 375cdf0e10cSrcweir 376cdf0e10cSrcweir typedef 377cdf0e10cSrcweir std::hash_set< 378cdf0e10cSrcweir rtl::OString, 379cdf0e10cSrcweir ostring_ha, 380cdf0e10cSrcweir ostring_eq > EmptyActiveTextSet; 381cdf0e10cSrcweir EmptyActiveTextSet m_aEmptyActiveTextSet; 382cdf0e10cSrcweir 383cdf0e10cSrcweir 384cdf0e10cSrcweir // methods 385cdf0e10cSrcweir 386cdf0e10cSrcweir void setInstallPath( const rtl::OUString& aInstallDirectory ); 387cdf0e10cSrcweir 388cdf0e10cSrcweir }; // end class Databases 389cdf0e10cSrcweir 390cdf0e10cSrcweir 391cdf0e10cSrcweir //=================================================================== 392cdf0e10cSrcweir enum IteratorState 393cdf0e10cSrcweir { 394cdf0e10cSrcweir INITIAL_MODULE, 395cdf0e10cSrcweir //SHARED_MODULE, // Later, avoids redundancies in help compiling 396cdf0e10cSrcweir USER_EXTENSIONS, 397cdf0e10cSrcweir SHARED_EXTENSIONS, 398cdf0e10cSrcweir BUNDLED_EXTENSIONS, 399cdf0e10cSrcweir END_REACHED 400cdf0e10cSrcweir }; 401cdf0e10cSrcweir 402cdf0e10cSrcweir // Hashtable to cache extension help status 403cdf0e10cSrcweir typedef std::hash_map 404cdf0e10cSrcweir < 405cdf0e10cSrcweir ::rtl::OUString, 406cdf0e10cSrcweir bool, 407cdf0e10cSrcweir Databases::ha, 408cdf0e10cSrcweir Databases::eq 409cdf0e10cSrcweir > 410cdf0e10cSrcweir ExtensionHelpExistanceMap; 411cdf0e10cSrcweir 412cdf0e10cSrcweir 413cdf0e10cSrcweir class ExtensionIteratorBase 414cdf0e10cSrcweir { 415cdf0e10cSrcweir static ExtensionHelpExistanceMap aHelpExistanceMap; 416cdf0e10cSrcweir 417cdf0e10cSrcweir public: 418cdf0e10cSrcweir ExtensionIteratorBase( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext, 419cdf0e10cSrcweir Databases& rDatabases, const rtl::OUString& aInitialModule, const rtl::OUString& aLanguage ); 420cdf0e10cSrcweir ExtensionIteratorBase( Databases& rDatabases, const rtl::OUString& aInitialModule, 421cdf0e10cSrcweir const rtl::OUString& aLanguage ); 422cdf0e10cSrcweir void init( void ); 423cdf0e10cSrcweir 424cdf0e10cSrcweir private: 425cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetHelpPackageFromPackage 426cdf0e10cSrcweir ( const com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage, 427cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); 428cdf0e10cSrcweir 429cdf0e10cSrcweir protected: 430cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextUserHelpPackage 431cdf0e10cSrcweir ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); 432cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextSharedHelpPackage 433cdf0e10cSrcweir ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); 434cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextBundledHelpPackage 435cdf0e10cSrcweir ( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); 436cdf0e10cSrcweir rtl::OUString implGetFileFromPackage( const rtl::OUString& rFileExtension, 437cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage ); 438cdf0e10cSrcweir void implGetLanguageVectorFromPackage( ::std::vector< ::rtl::OUString > &rv, 439cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage ); 440cdf0e10cSrcweir 441cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; 442cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess > m_xSFA; 443cdf0e10cSrcweir Databases& m_rDatabases; 444cdf0e10cSrcweir 445cdf0e10cSrcweir IteratorState m_eState; 446cdf0e10cSrcweir rtl::OUString m_aExtensionPath; 447cdf0e10cSrcweir 448cdf0e10cSrcweir rtl::OUString m_aInitialModule; 449cdf0e10cSrcweir rtl::OUString m_aLanguage; 450cdf0e10cSrcweir 451cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Reference 452cdf0e10cSrcweir < com::sun::star::deployment::XPackage > > m_aUserPackagesSeq; 453cdf0e10cSrcweir bool m_bUserPackagesLoaded; 454cdf0e10cSrcweir 455cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Reference 456cdf0e10cSrcweir < com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq; 457cdf0e10cSrcweir bool m_bSharedPackagesLoaded; 458cdf0e10cSrcweir 459cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::uno::Reference 460cdf0e10cSrcweir < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq; 461cdf0e10cSrcweir bool m_bBundledPackagesLoaded; 462cdf0e10cSrcweir 463cdf0e10cSrcweir int m_iUserPackage; 464cdf0e10cSrcweir int m_iSharedPackage; 465cdf0e10cSrcweir int m_iBundledPackage; 466cdf0e10cSrcweir 467cdf0e10cSrcweir }; // end class ExtensionIteratorBase 468cdf0e10cSrcweir 469cdf0e10cSrcweir 470cdf0e10cSrcweir //=================================================================== 471cdf0e10cSrcweir class DataBaseIterator : public ExtensionIteratorBase 472cdf0e10cSrcweir { 473cdf0e10cSrcweir public: DataBaseIterator(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> xContext,Databases & rDatabases,const rtl::OUString & aInitialModule,const rtl::OUString & aLanguage,bool bHelpText)474cdf0e10cSrcweir DataBaseIterator( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext, 475cdf0e10cSrcweir Databases& rDatabases, const rtl::OUString& aInitialModule, const rtl::OUString& aLanguage, bool bHelpText ) 476cdf0e10cSrcweir : ExtensionIteratorBase( xContext, rDatabases, aInitialModule, aLanguage ) 477cdf0e10cSrcweir , m_bHelpText( bHelpText ) 478cdf0e10cSrcweir {} DataBaseIterator(Databases & rDatabases,const rtl::OUString & aInitialModule,const rtl::OUString & aLanguage,bool bHelpText)479cdf0e10cSrcweir DataBaseIterator( Databases& rDatabases, const rtl::OUString& aInitialModule, 480cdf0e10cSrcweir const rtl::OUString& aLanguage, bool bHelpText ) 481cdf0e10cSrcweir : ExtensionIteratorBase( rDatabases, aInitialModule, aLanguage ) 482cdf0e10cSrcweir , m_bHelpText( bHelpText ) 483cdf0e10cSrcweir {} 484cdf0e10cSrcweir 485*70e197d9SHerbert Dürr helpdatafileproxy::Hdf* nextHdf( rtl::OUString* o_pExtensionPath = NULL, rtl::OUString* o_pExtensionRegistryPath = NULL ); 486cdf0e10cSrcweir 487cdf0e10cSrcweir 488cdf0e10cSrcweir private: 489*70e197d9SHerbert Dürr helpdatafileproxy::Hdf* implGetHdfFromPackage( 490cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage, 491cdf0e10cSrcweir rtl::OUString* o_pExtensionPath, rtl::OUString* o_pExtensionRegistryPath ); 492cdf0e10cSrcweir 493cdf0e10cSrcweir bool m_bHelpText; 494cdf0e10cSrcweir 495cdf0e10cSrcweir }; // end class DataBaseIterator 496cdf0e10cSrcweir 497cdf0e10cSrcweir //=================================================================== 498cdf0e10cSrcweir class KeyDataBaseFileIterator : public ExtensionIteratorBase 499cdf0e10cSrcweir { 500cdf0e10cSrcweir public: KeyDataBaseFileIterator(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> xContext,Databases & rDatabases,const rtl::OUString & aInitialModule,const rtl::OUString & aLanguage)501cdf0e10cSrcweir KeyDataBaseFileIterator( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext, 502cdf0e10cSrcweir Databases& rDatabases, const rtl::OUString& aInitialModule, const rtl::OUString& aLanguage ) 503cdf0e10cSrcweir : ExtensionIteratorBase( xContext, rDatabases, aInitialModule, aLanguage ) 504cdf0e10cSrcweir {} 505cdf0e10cSrcweir //Returns a file URL 506cdf0e10cSrcweir rtl::OUString nextDbFile( bool& o_rbExtension ); 507cdf0e10cSrcweir 508cdf0e10cSrcweir private: 509cdf0e10cSrcweir rtl::OUString implGetDbFileFromPackage( 510cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage ); 511cdf0e10cSrcweir 512cdf0e10cSrcweir }; // end class KeyDataBaseFileIterator 513cdf0e10cSrcweir 514cdf0e10cSrcweir //=================================================================== 515cdf0e10cSrcweir class JarFileIterator : public ExtensionIteratorBase 516cdf0e10cSrcweir { 517cdf0e10cSrcweir public: JarFileIterator(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> xContext,Databases & rDatabases,const rtl::OUString & aInitialModule,const rtl::OUString & aLanguage)518cdf0e10cSrcweir JarFileIterator( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext, 519cdf0e10cSrcweir Databases& rDatabases, const rtl::OUString& aInitialModule, const rtl::OUString& aLanguage ) 520cdf0e10cSrcweir : ExtensionIteratorBase( xContext, rDatabases, aInitialModule, aLanguage ) 521cdf0e10cSrcweir {} 522cdf0e10cSrcweir 523cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > 524cdf0e10cSrcweir nextJarFile( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle, 525cdf0e10cSrcweir rtl::OUString* o_pExtensionPath = NULL, rtl::OUString* o_pExtensionRegistryPath = NULL ); 526cdf0e10cSrcweir 527cdf0e10cSrcweir private: 528cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > 529cdf0e10cSrcweir implGetJarFromPackage(com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage, 530cdf0e10cSrcweir rtl::OUString* o_pExtensionPath = NULL, rtl::OUString* o_pExtensionRegistryPath = NULL ); 531cdf0e10cSrcweir 532cdf0e10cSrcweir }; // end class JarFileIterator 533cdf0e10cSrcweir 534cdf0e10cSrcweir //=================================================================== 535cdf0e10cSrcweir class IndexFolderIterator : public ExtensionIteratorBase 536cdf0e10cSrcweir { 537cdf0e10cSrcweir public: IndexFolderIterator(Databases & rDatabases,const rtl::OUString & aInitialModule,const rtl::OUString & aLanguage)538cdf0e10cSrcweir IndexFolderIterator( Databases& rDatabases, const rtl::OUString& aInitialModule, const rtl::OUString& aLanguage ) 539cdf0e10cSrcweir : ExtensionIteratorBase( rDatabases, aInitialModule, aLanguage ) 540cdf0e10cSrcweir {} 541cdf0e10cSrcweir 542cdf0e10cSrcweir rtl::OUString nextIndexFolder( bool& o_rbExtension, bool& o_rbTemporary ); 543cdf0e10cSrcweir void deleteTempIndexFolder( const rtl::OUString& aIndexFolder ); 544cdf0e10cSrcweir 545cdf0e10cSrcweir private: 546cdf0e10cSrcweir rtl::OUString implGetIndexFolderFromPackage( bool& o_rbTemporary, 547cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage ); 548cdf0e10cSrcweir 549cdf0e10cSrcweir }; // end class KeyDataBaseFileIterator 550cdf0e10cSrcweir 551cdf0e10cSrcweir //=================================================================== 552cdf0e10cSrcweir 553cdf0e10cSrcweir } // end namespace chelp 554cdf0e10cSrcweir 555cdf0e10cSrcweir 556cdf0e10cSrcweir #endif 557