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