1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_package.hxx"
26 #include <ZipPackageFolderEnumeration.hxx>
27 #include <ContentInfo.hxx>
28 
29 using namespace com::sun::star;
30 using rtl::OUString;
31 
ZipPackageFolderEnumeration(ContentHash & rInput)32 ZipPackageFolderEnumeration::ZipPackageFolderEnumeration ( ContentHash &rInput)
33 : rContents (rInput)
34 , aIterator (rContents.begin())
35 {
36 }
37 
~ZipPackageFolderEnumeration(void)38 ZipPackageFolderEnumeration::~ZipPackageFolderEnumeration( void )
39 {
40 }
41 
hasMoreElements()42 sal_Bool SAL_CALL ZipPackageFolderEnumeration::hasMoreElements(  )
43 		throw(uno::RuntimeException)
44 {
45 	return (aIterator != rContents.end() );
46 }
nextElement()47 uno::Any SAL_CALL ZipPackageFolderEnumeration::nextElement(  )
48 		throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
49 {
50 	uno::Any aAny;
51 	if (aIterator == rContents.end() )
52 		throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
53 	aAny <<= (*aIterator).second->xTunnel;
54 	aIterator++;
55 	return aAny;
56 }
57 
getImplementationName()58 OUString ZipPackageFolderEnumeration::getImplementationName()
59 	throw (uno::RuntimeException)
60 {
61 	return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZipPackageFolderEnumeration" ) );
62 }
63 
getSupportedServiceNames()64 uno::Sequence< OUString > ZipPackageFolderEnumeration::getSupportedServiceNames()
65 	throw (uno::RuntimeException)
66 {
67 	uno::Sequence< OUString > aNames(1);
68 	aNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.PackageFolderEnumeration" ) );
69 	return aNames;
70 }
supportsService(OUString const & rServiceName)71 sal_Bool SAL_CALL ZipPackageFolderEnumeration::supportsService( OUString const & rServiceName )
72 	throw (uno::RuntimeException)
73 {
74 	return rServiceName == getSupportedServiceNames()[0];
75 }
76