1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_XMLHELP_SOURCE_CXXHELP_INC_TVREAD_HXX
21 #define INCLUDED_XMLHELP_SOURCE_CXXHELP_INC_TVREAD_HXX
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>
46 PRODUCTNAME
, PRODUCTVERSION
, VENDORNAME
, VENDORVERSION
,
50 OUString m_vReplacement
[5];
51 OUString prodName
,prodVersion
,vendName
,vendVersion
,vendShort
;
53 std::vector
< sal_uInt64
> vFileLen
;
54 std::vector
< OUString
> vFileURL
;
55 OUString locale
,system
;
58 void SAL_CALL
replaceName( OUString
& oustring
) const;
64 class TVBase
: public cppu::WeakImplHelper4
<
65 css::container::XNameAccess
,
66 css::container::XHierarchicalNameAccess
,
67 css::util::XChangesNotifier
,
68 css::lang::XComponent
>
70 friend class TVChildTarget
;
78 virtual com::sun::star::uno::Type SAL_CALL
80 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
82 return cppu::UnoType
<void>::get();
85 virtual sal_Bool SAL_CALL
hasElements()
86 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
95 const com::sun::star::uno::Reference
< com::sun::star::util::XChangesListener
>& aListener
)
96 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
102 virtual void SAL_CALL
103 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
113 virtual void SAL_CALL
dispose( )
114 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
118 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
125 virtual void SAL_CALL
127 const com::sun::star::uno::Reference
< com::sun::star::lang::XEventListener
>& aListener
)
128 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
133 // Abstract functions
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;
142 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
144 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
= 0;
146 virtual sal_Bool SAL_CALL
147 hasByName( const OUString
& aName
)
148 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
= 0;
150 // XHierarchicalNameAccess
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;
157 virtual sal_Bool SAL_CALL
158 hasByHierarchicalName( const OUString
& aName
)
159 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
= 0;
161 }; // end class TVBase
166 friend class TVChildTarget
;
169 TVRead( const ConfigData
& configData
,TVDom
* tvDom
= 0 );
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
;
181 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
183 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
185 virtual sal_Bool SAL_CALL
186 hasByName( const OUString
& aName
)
187 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
189 // XHierarchicalNameAccess
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
;
196 virtual sal_Bool SAL_CALL
197 hasByHierarchicalName( const OUString
& aName
)
198 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
204 rtl::Reference
< TVChildTarget
> Children
;
206 }; // end class TVRead
213 TVChildTarget( const ConfigData
& configData
,TVDom
* tvDom
);
215 TVChildTarget( const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& xContext
);
217 virtual ~TVChildTarget();
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
;
225 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
227 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
229 virtual sal_Bool SAL_CALL
230 hasByName( const OUString
& aName
)
231 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
233 // XHierarchicalNameAccess
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
;
240 virtual sal_Bool SAL_CALL
241 hasByHierarchicalName( const OUString
& aName
)
242 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
245 std::vector
< rtl::Reference
< TVRead
> > Elements
;
247 static ConfigData
init(
248 const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& xContext
);
250 static ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
252 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
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
,
259 getKey( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XHierarchicalNameAccess
>& xHierAccess
,
264 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XHierarchicalNameAccess
>& xHierAccess
,
267 static void subst( OUString
& instpath
);
269 bool SearchAndInsert(TVDom
* p
, TVDom
* tvDom
);
271 void Check(TVDom
* tvDom
);
273 }; // end class TVChildTarget
283 class ExtensionIteratorBase
286 ExtensionIteratorBase( const OUString
& aLanguage
);
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
);
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
);
302 void implGetLanguageVectorFromPackage( ::std::vector
< OUString
> &rv
,
303 com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
> xPackage
);
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
;
309 IteratorState m_eState
;
310 OUString m_aLanguage
;
312 com::sun::star::uno::Sequence
< com::sun::star::uno::Reference
313 < com::sun::star::deployment::XPackage
> > m_aUserPackagesSeq
;
314 bool m_bUserPackagesLoaded
;
316 com::sun::star::uno::Sequence
< com::sun::star::uno::Reference
317 < com::sun::star::deployment::XPackage
> > m_aSharedPackagesSeq
;
318 bool m_bSharedPackagesLoaded
;
320 com::sun::star::uno::Sequence
< com::sun::star::uno::Reference
321 < com::sun::star::deployment::XPackage
> > m_aBundledPackagesSeq
;
322 bool m_bBundledPackagesLoaded
;
325 int m_iSharedPackage
;
326 int m_iBundledPackage
;
328 }; // end class ExtensionIteratorBase
330 class TreeFileIterator
: public ExtensionIteratorBase
333 TreeFileIterator( const OUString
& aLanguage
)
334 : ExtensionIteratorBase( aLanguage
)
337 OUString
nextTreeFile( sal_Int32
& rnFileSize
);
340 OUString
expandURL( const OUString
& aURL
);
341 OUString
implGetTreeFileFromPackage( sal_Int32
& rnFileSize
,
342 com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
> xPackage
);
344 }; // end class TreeFileIterator
350 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */