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 _TREEVIEW_TVREAD_HXX_
21 #define _TREEVIEW_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"
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;
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
73 friend class TVChildTarget
;
80 virtual com::sun::star::uno::Any SAL_CALL
82 const com::sun::star::uno::Type
& aType
)
83 throw( com::sun::star::uno::RuntimeException
);
103 virtual com::sun::star::uno::Type SAL_CALL
105 throw( com::sun::star::uno::RuntimeException
)
107 return getCppuVoidType();
111 virtual sal_Bool SAL_CALL
hasElements()
112 throw( com::sun::star::uno::RuntimeException
)
119 virtual void SAL_CALL
121 const com::sun::star::uno::Reference
< com::sun::star::util::XChangesListener
>& aListener
)
122 throw( com::sun::star::uno::RuntimeException
)
128 virtual void SAL_CALL
129 removeChangesListener(
130 const com::sun::star::uno::Reference
< com::sun::star::util::XChangesListener
>& aListener
)
131 throw( com::sun::star::uno::RuntimeException
)
140 virtual void SAL_CALL
dispose( )
141 throw( com::sun::star::uno::RuntimeException
)
145 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
)
152 virtual void SAL_CALL
154 const com::sun::star::uno::Reference
< com::sun::star::lang::XEventListener
>& aListener
)
155 throw( com::sun::star::uno::RuntimeException
)
161 // Abstract functions
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;
170 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
172 throw( com::sun::star::uno::RuntimeException
) = 0;
174 virtual sal_Bool SAL_CALL
175 hasByName( const OUString
& aName
)
176 throw( com::sun::star::uno::RuntimeException
) = 0;
179 // XHierarchicalNameAccess
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;
186 virtual sal_Bool SAL_CALL
187 hasByHierarchicalName( const OUString
& aName
)
188 throw( com::sun::star::uno::RuntimeException
) = 0;
190 }; // end class TVBase
199 friend class TVChildTarget
;
202 TVRead( const ConfigData
& configData
,TVDom
* tvDom
= 0 );
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
);
214 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
216 throw( com::sun::star::uno::RuntimeException
);
218 virtual sal_Bool SAL_CALL
219 hasByName( const OUString
& aName
)
220 throw( com::sun::star::uno::RuntimeException
);
223 // XHierarchicalNameAccess
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
);
230 virtual sal_Bool SAL_CALL
231 hasByHierarchicalName( const OUString
& aName
)
232 throw( com::sun::star::uno::RuntimeException
);
239 rtl::Reference
< TVChildTarget
> Children
;
241 }; // end class TVRead
253 TVChildTarget( const ConfigData
& configData
,TVDom
* tvDom
);
255 TVChildTarget( const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& xMSF
);
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
);
265 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
267 throw( com::sun::star::uno::RuntimeException
);
269 virtual sal_Bool SAL_CALL
270 hasByName( const OUString
& aName
)
271 throw( com::sun::star::uno::RuntimeException
);
274 // XHierarchicalNameAccess
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
);
281 virtual sal_Bool SAL_CALL
282 hasByHierarchicalName( const OUString
& aName
)
283 throw( com::sun::star::uno::RuntimeException
);
287 std::vector
< rtl::Reference
< TVRead
> > Elements
;
290 const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& xMSF
);
292 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
294 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
) const;
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;
301 getKey( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XHierarchicalNameAccess
>& xHierAccess
,
302 const char* key
) const;
306 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XHierarchicalNameAccess
>& xHierAccess
,
307 const char* key
) const;
310 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xMSgr
,
311 OUString
& instpath
) const;
313 bool SearchAndInsert(TVDom
* p
, TVDom
* tvDom
);
315 void Check(TVDom
* tvDom
);
317 }; // end class TVChildTarget
328 class ExtensionIteratorBase
331 ExtensionIteratorBase( const OUString
& aLanguage
);
335 com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
> implGetHelpPackageFromPackage
336 ( const com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
> xPackage
,
337 com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
>& o_xParentPackageBundle
);
340 com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
> implGetNextUserHelpPackage
341 ( com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
>& o_xParentPackageBundle
);
342 com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
> implGetNextSharedHelpPackage
343 ( com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
>& o_xParentPackageBundle
);
344 com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
> implGetNextBundledHelpPackage
345 ( com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
>& o_xParentPackageBundle
);
347 void implGetLanguageVectorFromPackage( ::std::vector
< OUString
> &rv
,
348 com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
> xPackage
);
351 com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
> m_xContext
;
352 com::sun::star::uno::Reference
< com::sun::star::ucb::XSimpleFileAccess3
> m_xSFA
;
354 IteratorState m_eState
;
355 OUString m_aLanguage
;
357 com::sun::star::uno::Sequence
< com::sun::star::uno::Reference
358 < com::sun::star::deployment::XPackage
> > m_aUserPackagesSeq
;
359 bool m_bUserPackagesLoaded
;
361 com::sun::star::uno::Sequence
< com::sun::star::uno::Reference
362 < com::sun::star::deployment::XPackage
> > m_aSharedPackagesSeq
;
363 bool m_bSharedPackagesLoaded
;
365 com::sun::star::uno::Sequence
< com::sun::star::uno::Reference
366 < com::sun::star::deployment::XPackage
> > m_aBundledPackagesSeq
;
367 bool m_bBundledPackagesLoaded
;
370 int m_iSharedPackage
;
371 int m_iBundledPackage
;
373 }; // end class ExtensionIteratorBase
376 //===================================================================
377 class TreeFileIterator
: public ExtensionIteratorBase
380 TreeFileIterator( const OUString
& aLanguage
)
381 : ExtensionIteratorBase( aLanguage
)
384 OUString
nextTreeFile( sal_Int32
& rnFileSize
);
387 OUString
expandURL( const OUString
& aURL
);
388 OUString
implGetTreeFileFromPackage( sal_Int32
& rnFileSize
,
389 com::sun::star::uno::Reference
< com::sun::star::deployment::XPackage
> xPackage
);
391 }; // end class TreeFileIterator
399 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */