summaryrefslogtreecommitdiff
path: root/package/source/zippackage
diff options
context:
space:
mode:
authorMartin Gallwey <mtg@openoffice.org>2000-11-16 10:54:40 +0000
committerMartin Gallwey <mtg@openoffice.org>2000-11-16 10:54:40 +0000
commitf39fff0b3d65e430b6ad40c2d4a871a2f32a4ba5 (patch)
tree31d99eb3fbb340c617a9025a44dbf493b3fec0ba /package/source/zippackage
parentbb79b528eec001fc70af73e55a77b27f96910862 (diff)
Initial revision. This version is at best 50% functional, and contains
many gaping holes, bugs and half-implemented services, and is only meant as a "preview" for Kai :)
Diffstat (limited to 'package/source/zippackage')
-rw-r--r--package/source/zippackage/ZipPackage.cxx217
-rw-r--r--package/source/zippackage/ZipPackageEntry.cxx65
-rw-r--r--package/source/zippackage/ZipPackageFolder.cxx234
-rw-r--r--package/source/zippackage/ZipPackageFolderEnumeration.cxx31
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx165
-rw-r--r--package/source/zippackage/makefile.mk153
6 files changed, 865 insertions, 0 deletions
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
new file mode 100644
index 000000000000..c34cb9aa3145
--- /dev/null
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -0,0 +1,217 @@
+
+#ifndef _ZIP_PACKAGE_HXX
+#include "ZipPackage.hxx"
+#endif
+
+using namespace com::sun::star::package::ZipConstants;
+using namespace com::sun::star;
+using namespace rtl;
+
+ZipPackage::ZipPackage (uno::Reference < io::XInputStream > xInput, uno::Reference < io::XOutputStream > xOutput)
+: xStream(xInput)
+, aZipFile(xInput)
+, aZipOut(xOutput, 65535)
+, aRootFolder(aZipOut)//*this)
+{
+ uno::Reference< container::XEnumeration > xEnum = aZipFile.entries();
+ uno::Reference< container::XNameContainer > xCurrent = uno::Reference < container::XNameContainer > (&aRootFolder);
+ ZipPackageStream *pPkgStream;
+ ZipPackageFolder *pPkgFolder;//, *pCurrentFolder =&aRootFolder;
+ package::ZipEntry aEntry;
+ aZipOut.setMethod(DEFLATED);
+ aZipOut.setLevel(5);
+
+ //for (sal_uInt16 i=0;i<aZipFile.nTotal;i++)
+ while (xEnum->hasMoreElements())
+ {
+ xCurrent = uno::Reference < container::XNameContainer > (&aRootFolder);
+ sal_Int32 nOldIndex =0,nIndex = 0;
+ uno::Any aAny = xEnum->nextElement();
+ aAny >>= aEntry;
+ OUString &rName = aEntry.sName;
+
+ if (rName.lastIndexOf('/') == rName.getLength()-1)
+ {
+ while ((nIndex = rName.indexOf('/', nOldIndex)) != -1)
+ {
+ OUString sTemp = rName.copy (nOldIndex, nIndex - nOldIndex);
+ if (nIndex == nOldIndex) //sTemp.getLength() == 1)
+ break;
+ if (!xCurrent->hasByName(sTemp))
+ {
+ pPkgFolder = new ZipPackageFolder(aZipOut);//*this);
+ pPkgFolder->setName(sTemp);
+ pPkgFolder->setParent( uno::Reference < uno::XInterface >(xCurrent, uno::UNO_QUERY));
+ aAny <<= uno::Reference < container::XNamed > (pPkgFolder);
+ xCurrent->insertByName(sTemp, aAny);
+ xCurrent = uno::Reference < container::XNameContainer > (pPkgFolder);
+ }
+ else
+ {
+ aAny = xCurrent->getByName(sTemp);
+ uno::Reference < container::XNamed > xRef;
+ aAny >>= xRef;
+ xCurrent = uno::Reference < container::XNameContainer > (xRef, uno::UNO_QUERY);
+ }
+
+ nOldIndex = nIndex+1;
+ }
+ }
+ else
+ {
+ while ((nIndex = rName.indexOf('/', nOldIndex)) != -1)
+ {
+ OUString sTemp = rName.copy (nOldIndex, nIndex - nOldIndex);
+ if (nIndex == nOldIndex) //sTemp.getLength() == 1)
+ break;
+ if (xCurrent->hasByName(sTemp))
+ {
+ uno::Reference < container::XNamed > xChildRef;
+ aAny = xCurrent->getByName(sTemp);
+ aAny >>= xChildRef;
+ xCurrent = uno::Reference < container::XNameContainer > (xChildRef, uno::UNO_QUERY);
+ }
+ nOldIndex = nIndex+1;
+ }
+ OUString sStreamName = rName.copy( nOldIndex, rName.getLength() - nOldIndex);
+ pPkgStream = new ZipPackageStream( aZipFile );
+ pPkgStream->bPackageMember = sal_True;
+ pPkgStream->setParent( uno::Reference < uno::XInterface > (xCurrent, uno::UNO_QUERY));
+ pPkgStream->setName( sStreamName );
+ pPkgStream->setZipEntry( aEntry );
+ aAny <<= uno::Reference < container::XNamed > (pPkgStream);
+ xCurrent->insertByName(sStreamName, aAny);
+ }
+ }
+}
+
+ZipPackage::~ZipPackage( void )
+{
+}
+
+// XInitialization
+void SAL_CALL ZipPackage::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw(uno::Exception, uno::RuntimeException)
+{
+}
+// XHierarchicalNameAccess
+uno::Any SAL_CALL ZipPackage::getByHierarchicalName( const ::rtl::OUString& aName )
+ throw(container::NoSuchElementException, uno::RuntimeException)
+{
+ sal_Int32 nOldIndex =0,nIndex = 0;
+ uno::Any aAny;
+ uno::Reference < container::XNameContainer > xCurrent = uno::Reference < container::XNameContainer > (&aRootFolder);
+ if (aName.lastIndexOf('/') == aName.getLength()-1)
+ {
+ while ((nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ {
+ OUString sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ if (nIndex == nOldIndex) //sTemp.getLength() == 1)
+ break;
+ if (xCurrent->hasByName(sTemp))
+ {
+ uno::Reference < container::XNamed > xRef;
+ aAny = xCurrent->getByName(sTemp);
+ aAny >>= xRef;
+ xCurrent = uno::Reference < container::XNameContainer > (xRef, uno::UNO_QUERY);
+ }
+ nOldIndex = nIndex+1;
+ }
+ OUString sStreamName = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
+ aAny <<= xCurrent->getByName(sStreamName);
+ }
+ else
+ {
+ while ((nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ {
+ OUString sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ if (nIndex == nOldIndex) //sTemp.getLength() == 1)
+ break;
+ if (xCurrent->hasByName(sTemp))
+ {
+ uno::Reference < container::XNamed > xChildRef;
+ aAny = xCurrent->getByName(sTemp);
+ aAny >>= xChildRef;
+ xCurrent = uno::Reference < container::XNameContainer > (xChildRef, uno::UNO_QUERY);
+ }
+ nOldIndex = nIndex+1;
+ }
+ OUString sStreamName = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
+
+ aAny <<= xCurrent->getByName(sStreamName);
+ }
+ return aAny;
+}
+sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const ::rtl::OUString& aName )
+ throw(uno::RuntimeException)
+{
+ sal_Int32 nOldIndex =0,nIndex = 0;
+ uno::Any aAny;
+ uno::Reference < container::XNameContainer > xCurrent = uno::Reference < container::XNameContainer > (&aRootFolder);
+ if (aName.lastIndexOf('/') == aName.getLength()-1)
+ {
+ while ((nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ {
+ OUString sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ if (nIndex == nOldIndex) //sTemp.getLength() == 1)
+ break;
+ if (xCurrent->hasByName(sTemp))
+ {
+ uno::Reference < container::XNamed > xRef;
+ aAny = xCurrent->getByName(sTemp);
+ aAny >>= xRef;
+ xCurrent = uno::Reference < container::XNameContainer > (xRef, uno::UNO_QUERY);
+ }
+ nOldIndex = nIndex+1;
+ }
+ OUString sStreamName = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
+ return xCurrent->hasByName(sStreamName);
+ }
+ else
+ {
+ while ((nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ {
+ OUString sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ if (nIndex == nOldIndex) //sTemp.getLength() == 1)
+ break;
+ if (xCurrent->hasByName(sTemp))
+ {
+ uno::Reference < container::XNamed > xChildRef;
+ aAny = xCurrent->getByName(sTemp);
+ aAny >>= xChildRef;
+ xCurrent = uno::Reference < container::XNameContainer > (xChildRef, uno::UNO_QUERY);
+ }
+ nOldIndex = nIndex+1;
+ }
+ OUString sStreamName = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
+ return xCurrent->hasByName(sStreamName);
+ }
+}
+// XSingleServiceFactory
+uno::Reference< uno::XInterface > SAL_CALL ZipPackage::createInstance( )
+ throw(uno::Exception, uno::RuntimeException)
+{
+ return uno::Reference < uno::XInterface > (*this);
+}
+uno::Reference< uno::XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( const uno::Sequence< uno::Any >& aArguments )
+ throw(uno::Exception, uno::RuntimeException)
+{
+ return uno::Reference < uno::XInterface > (*this);
+}
+// XChangesBatch
+void SAL_CALL ZipPackage::commitChanges( )
+ throw(lang::WrappedTargetException, uno::RuntimeException)
+{
+ aRootFolder.saveContents(OUString::createFromAscii(""));
+ aZipOut.finish();
+}
+sal_Bool SAL_CALL ZipPackage::hasPendingChanges( )
+ throw(uno::RuntimeException)
+{
+ return sal_False;
+}
+uno::Sequence< util::ElementChange > SAL_CALL ZipPackage::getPendingChanges( )
+ throw(uno::RuntimeException)
+{
+ return uno::Sequence < util::ElementChange > ( NULL, 0 );
+}
diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx
new file mode 100644
index 000000000000..66df06e76944
--- /dev/null
+++ b/package/source/zippackage/ZipPackageEntry.cxx
@@ -0,0 +1,65 @@
+
+#ifndef _ZIP_PACKAGE_ENTRY_HXX
+#include "ZipPackageEntry.hxx"
+#endif
+
+using namespace com::sun::star;
+ZipPackageEntry::ZipPackageEntry (void)
+{
+}
+
+ZipPackageEntry::~ZipPackageEntry( void )
+{
+}
+
+uno::Any SAL_CALL ZipPackageEntry::queryInterface( const uno::Type& rType )
+ throw(uno::RuntimeException)
+{
+ // Ask for my own supported interfaces ...
+ uno::Any aReturn ( ::cppu::queryInterface ( rType ,
+ static_cast< container::XNamed* > ( this ) ,
+ static_cast< container::XChild* > ( this ) ) );
+
+ // If searched interface supported by this class ...
+ if ( aReturn.hasValue () == sal_True )
+ {
+ // ... return this information.
+ return aReturn ;
+ }
+ else
+ {
+ // Else; ... ask baseclass for interfaces!
+ return OWeakObject::queryInterface ( rType ) ;
+ }
+}
+void SAL_CALL ZipPackageEntry::acquire( )
+ throw()
+{
+ OWeakObject::acquire();
+}
+void SAL_CALL ZipPackageEntry::release( )
+ throw()
+{
+ OWeakObject::release();
+}
+ // XChild
+::rtl::OUString SAL_CALL ZipPackageEntry::getName( )
+ throw(uno::RuntimeException)
+{
+ return aEntry.sName;
+}
+void SAL_CALL ZipPackageEntry::setName( const ::rtl::OUString& aName )
+ throw(uno::RuntimeException)
+{
+ aEntry.sName = aName;
+}
+uno::Reference< uno::XInterface > SAL_CALL ZipPackageEntry::getParent( )
+ throw(uno::RuntimeException)
+{
+ return xParent;
+}
+void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< uno::XInterface >& Parent )
+ throw(lang::NoSupportException, uno::RuntimeException)
+{
+ xParent = Parent;
+}
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
new file mode 100644
index 000000000000..f7a3f82ae5c7
--- /dev/null
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -0,0 +1,234 @@
+
+#ifndef _ZIP_PACKAGE_FOLDER_HXX
+#include "ZipPackageFolder.hxx"
+#endif
+
+using namespace com::sun::star;
+using namespace rtl;
+
+ZipPackageFolder::ZipPackageFolder (ZipOutputStream &rStream)//ZipPackage &rInPackage)
+: rZipOut(rStream)
+{
+ aEntry.nVersion = -1;
+ aEntry.nFlag = 0;
+ aEntry.nFlag |= 1 << 10;
+ aEntry.nMethod = -1;
+ aEntry.nTime = -1;
+ aEntry.nCrc = -1;
+ aEntry.nCompressedSize = -1;
+ aEntry.nSize = -1;
+ aEntry.nOffset = -1;
+}
+
+ZipPackageFolder::~ZipPackageFolder( void )
+{
+
+}
+uno::Any SAL_CALL ZipPackageFolder::queryInterface( const uno::Type& rType )
+ throw(uno::RuntimeException)
+{
+ // Ask for my own supported interfaces ...
+ uno::Any aReturn ( ::cppu::queryInterface ( rType ,
+ static_cast< container::XNamed* > ( this ) ,
+ static_cast< container::XChild* > ( this ) ,
+ static_cast< container::XNameContainer* > ( this ) ,
+ static_cast< container::XEnumerationAccess* > ( this ) ,
+ static_cast< beans::XPropertySet* > ( this ) ) ) ;
+
+ // If searched interface supported by this class ...
+ if ( aReturn.hasValue () == sal_True )
+ {
+ // ... return this information.
+ return aReturn ;
+ }
+ else
+ {
+ // Else; ... ask baseclass for interfaces!
+ return ZipPackageEntry::queryInterface ( rType ) ;
+ }
+}
+void SAL_CALL ZipPackageFolder::acquire( )
+ throw()
+{
+ ZipPackageEntry::acquire();
+}
+void SAL_CALL ZipPackageFolder::release( )
+ throw()
+{
+ ZipPackageEntry::release();
+}
+ // XNameContainer
+void SAL_CALL ZipPackageFolder::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if (hasByName(aName))
+ throw container::ElementExistException();
+ else
+ {
+ uno::Reference < beans::XPropertySet > xRef;
+ aElement >>= xRef;
+ aContents[aName] = xRef;
+ }
+}
+void SAL_CALL ZipPackageFolder::removeByName( const ::rtl::OUString& Name )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ aContents.erase(Name);
+}
+ // XEnumerationAccess
+uno::Reference< container::XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
+ throw(uno::RuntimeException)
+{
+ return uno::Reference < container::XEnumeration> (new ZipPackageFolderEnumeration(aContents));
+}
+ // XElementAccess
+uno::Type SAL_CALL ZipPackageFolder::getElementType( )
+ throw(uno::RuntimeException)
+{
+ return ::getCppuType ((const uno::Reference< container::XNamed > *) 0);
+}
+sal_Bool SAL_CALL ZipPackageFolder::hasElements( )
+ throw(uno::RuntimeException)
+{
+ return aContents.size() > 0;
+}
+ // XNameAccess
+uno::Any SAL_CALL ZipPackageFolder::getByName( const ::rtl::OUString& aName )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Any aAny;
+ PropertyHash::const_iterator aCI = aContents.find(aName);
+ if (aCI == aContents.end())
+ throw container::NoSuchElementException();
+// rtl::OUString sTemp = aCI->first;
+// uno::Reference < container::XNamed > xRef (aCI->second);
+ aAny <<= (*aCI).second;
+ return aAny;
+}
+uno::Sequence< ::rtl::OUString > SAL_CALL ZipPackageFolder::getElementNames( )
+ throw(uno::RuntimeException)
+{
+ sal_uInt32 i=0, nSize = aContents.size();
+ OUString *pNames = new OUString[nSize];
+ for (PropertyHash::const_iterator aIterator = aContents.begin() ; aIterator != aContents.end(); i++,aIterator++)
+ pNames[i] = (*aIterator).first;
+ return uno::Sequence < OUString > (pNames, nSize);
+}
+sal_Bool SAL_CALL ZipPackageFolder::hasByName( const ::rtl::OUString& aName )
+ throw(uno::RuntimeException)
+{
+ return aContents.find(aName) != aContents.end();
+}
+ // XNameReplace
+void SAL_CALL ZipPackageFolder::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ removeByName(aName);
+ insertByName(aName, aElement);
+}
+ //XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageFolder::getPropertySetInfo( )
+ throw(uno::RuntimeException)
+{
+ return uno::Reference < beans::XPropertySetInfo > (NULL);
+}
+void SAL_CALL ZipPackageFolder::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if (aPropertyName == L"MediaType")
+ aValue >>= sMediaType;
+ else if (aPropertyName == L"ZipEntry")
+ aValue >>= aEntry;
+ else if (aPropertyName == L"Path")
+ aValue >>= sPath;
+ else
+ throw beans::UnknownPropertyException();
+}
+uno::Any SAL_CALL ZipPackageFolder::getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if (PropertyName == L"MediaType")
+ {
+ uno::Any aAny;
+ aAny <<= sMediaType;
+ return aAny;
+ }
+ else if (PropertyName == L"ZipEntry")
+ {
+ uno::Any aAny;
+ aAny <<= aEntry;
+ return aAny;
+ }
+ else if (PropertyName == L"Path")
+ {
+ uno::Any aAny;
+ aAny <<= sPath;
+ return aAny;
+ }
+ else
+ throw beans::UnknownPropertyException();
+}
+void SAL_CALL ZipPackageFolder::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+void SAL_CALL ZipPackageFolder::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+void SAL_CALL ZipPackageFolder::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+void SAL_CALL ZipPackageFolder::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+void ZipPackageFolder::saveContents(rtl::OUString &rPath)
+{
+ sPath = sPath + getName();
+ PropertyHash::const_iterator aCI = aContents.begin();
+ uno::Reference < beans::XPropertySet > xProp;
+ package::ZipEntry aEntry;
+ uno::Any aAny;
+
+ for (;aCI!=aContents.end();aCI++)
+ {
+ //xProp = uno::Reference < beans::XPropertySet> (aCI->second, uno::UNO_QUERY);
+ aAny = aCI->second->getPropertyValue(L"ZipEntry");
+ aAny >>= aEntry;
+ aEntry.nCrc = -1;
+ aEntry.nSize = -1;
+ aEntry.nCompressedSize = -1;
+
+ rZipOut.putNextEntry(aEntry);
+ if (aEntry.nFlag & 1 << 10)
+ {
+ aEntry.sName = aEntry.sName + L"/";
+ rZipOut.closeEntry();
+ }
+ else
+ {
+ sal_Int64 nLength;
+ uno::Sequence < sal_Int8 > aSeq (65535);
+ uno::Reference < io::XActiveDataSink > xSink = uno::Reference < io::XActiveDataSink > (aCI->second, uno::UNO_QUERY);
+ uno::Reference < io::XInputStream > xStream = xSink->getInputStream();
+
+ while (1)
+ {
+ nLength = xStream->readBytes(aSeq, 65535);
+ if (nLength < 65535)
+ aSeq.realloc(nLength);
+ rZipOut.write(aSeq, 0, nLength);
+ if (nLength < 65535) // EOF
+ break;
+ }
+ rZipOut.closeEntry();
+ }
+ }
+}
+sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return (sal_Int64)0;
+}
diff --git a/package/source/zippackage/ZipPackageFolderEnumeration.cxx b/package/source/zippackage/ZipPackageFolderEnumeration.cxx
new file mode 100644
index 000000000000..1e1d077994d3
--- /dev/null
+++ b/package/source/zippackage/ZipPackageFolderEnumeration.cxx
@@ -0,0 +1,31 @@
+
+#ifndef _ZIP_PACKAGE_FOLDER_ENUMERATION_HXX
+#include "ZipPackageFolderEnumeration.hxx"
+#endif
+
+using namespace com::sun::star;
+
+ZipPackageFolderEnumeration::ZipPackageFolderEnumeration ( PropertyHash &rInput)
+//std::hash_map < rtl::OUString, com::sun::star::uno::Reference < com::sun::star::container::XNamed >, hashFunc, eqFunc > &rContents);
+: rContents (rInput)
+, aIterator (rInput.begin())
+{
+}
+
+ZipPackageFolderEnumeration::~ZipPackageFolderEnumeration( void )
+{
+}
+
+sal_Bool SAL_CALL ZipPackageFolderEnumeration::hasMoreElements( )
+ throw(uno::RuntimeException)
+{
+ return (aIterator != rContents.end() );
+}
+uno::Any SAL_CALL ZipPackageFolderEnumeration::nextElement( )
+ throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Any aAny;
+ aIterator++;
+ aAny <<= (*aIterator).second;
+ return aAny;
+}
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
new file mode 100644
index 000000000000..b2475c4e0314
--- /dev/null
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -0,0 +1,165 @@
+
+#ifndef _ZIP_PACKAGE_STREAM_HXX
+#include "ZipPackageStream.hxx"
+#endif
+
+using namespace com::sun::star;
+
+ZipPackageStream::ZipPackageStream (ZipFile &rInFile)
+: rZipFile(rInFile)
+, bPackageMember( sal_False )
+{
+ aEntry.nVersion = -1;
+ aEntry.nFlag = 0;
+ aEntry.nMethod = -1;
+ aEntry.nTime = -1;
+ aEntry.nCrc = -1;
+ aEntry.nCompressedSize = -1;
+ aEntry.nSize = -1;
+ aEntry.nOffset = -1;
+}
+
+ZipPackageStream::~ZipPackageStream( void )
+{
+}
+
+void ZipPackageStream::setZipEntry( const package::ZipEntry &rInEntry)
+{
+ aEntry.nVersion = rInEntry.nVersion;
+ aEntry.nFlag = rInEntry.nFlag;
+ aEntry.nMethod = rInEntry.nMethod;
+ aEntry.nTime = rInEntry.nTime;
+ aEntry.nCrc = rInEntry.nCrc;
+ aEntry.nCompressedSize = rInEntry.nCompressedSize;
+ aEntry.nSize = rInEntry.nSize;
+ aEntry.nOffset = rInEntry.nOffset;
+ aEntry.sName = rInEntry.sName;
+ aEntry.extra = rInEntry.extra;
+ aEntry.sComment = rInEntry.sComment;
+}
+ //XInterface
+uno::Any SAL_CALL ZipPackageStream::queryInterface( const uno::Type& rType )
+ throw(uno::RuntimeException)
+{
+ // Ask for my own supported interfaces ...
+ uno::Any aReturn ( ::cppu::queryInterface ( rType ,
+ static_cast< container::XNamed* > ( this ) ,
+ static_cast< container::XChild* > ( this ) ,
+ static_cast< io::XActiveDataSink* > ( this ) ,
+ static_cast< beans::XPropertySet* > ( this ) ) );
+
+ // If searched interface supported by this class ...
+ if ( aReturn.hasValue () == sal_True )
+ {
+ // ... return this information.
+ return aReturn ;
+ }
+ else
+ {
+ // Else; ... ask baseclass for interfaces!
+ return ZipPackageEntry::queryInterface ( rType ) ;
+ }
+}
+void SAL_CALL ZipPackageStream::acquire( )
+ throw()
+{
+ ZipPackageEntry::acquire();
+}
+void SAL_CALL ZipPackageStream::release( )
+ throw()
+{
+ ZipPackageEntry::release();
+}
+ // XChild
+uno::Reference< uno::XInterface > SAL_CALL ZipPackageStream::getParent( )
+ throw(uno::RuntimeException)
+{
+ return xParentFolder;
+}
+void SAL_CALL ZipPackageStream::setParent( const uno::Reference< uno::XInterface >& Parent )
+ throw(lang::NoSupportException, uno::RuntimeException)
+{
+ xParentFolder = Parent;
+}
+ // XNamed
+::rtl::OUString SAL_CALL ZipPackageStream::getName( )
+ throw(uno::RuntimeException)
+{
+ return aEntry.sName;
+}
+void SAL_CALL ZipPackageStream::setName( const ::rtl::OUString& aName )
+ throw(uno::RuntimeException)
+{
+ aEntry.sName = aName;
+
+}
+ // XActiveDataSink
+void SAL_CALL ZipPackageStream::setInputStream( const uno::Reference< io::XInputStream >& aStream )
+ throw(uno::RuntimeException)
+{
+ xStream = aStream;
+ bPackageMember = sal_False;
+}
+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream( )
+ throw(uno::RuntimeException)
+{
+ if (bPackageMember)
+ return rZipFile.getInputStream(aEntry);
+ else
+ return xStream;
+}
+ //XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageStream::getPropertySetInfo( )
+ throw(uno::RuntimeException)
+{
+ return uno::Reference < beans::XPropertySetInfo > ();
+}
+void SAL_CALL ZipPackageStream::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if (aPropertyName == L"MediaType")
+ aValue >>= sMediaType;
+ else if (aPropertyName == L"ZipEntry")
+ aValue >>= aEntry;
+ else
+ throw beans::UnknownPropertyException();
+}
+uno::Any SAL_CALL ZipPackageStream::getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if (PropertyName == L"MediaType")
+ {
+ uno::Any aAny;
+ aAny <<= sMediaType;
+ return aAny;
+ }
+ else if (PropertyName == L"ZipEntry")
+ {
+ uno::Any aAny;
+ aAny <<= aEntry;
+ return aAny;
+ }
+ else
+ throw beans::UnknownPropertyException();
+}
+void SAL_CALL ZipPackageStream::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+void SAL_CALL ZipPackageStream::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+void SAL_CALL ZipPackageStream::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+void SAL_CALL ZipPackageStream::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+sal_Int64 SAL_CALL ZipPackageStream::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return (sal_Int64)0;
+}
diff --git a/package/source/zippackage/makefile.mk b/package/source/zippackage/makefile.mk
new file mode 100644
index 000000000000..5f0b4d0e04ee
--- /dev/null
+++ b/package/source/zippackage/makefile.mk
@@ -0,0 +1,153 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Author: mtg $ $Date: 2000-11-16 11:54:40 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=package
+TARGET=sandbox
+AUTOSEG=true
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+APP1TARGET=sandbox
+APP1OBJS= \
+ $(SLO)$/Adler32.obj \
+ $(SLO)$/CRC32.obj \
+ $(SLO)$/ByteChucker.obj \
+ $(SLO)$/ByteGrabber.obj \
+ $(SLO)$/Inflater.obj \
+ $(SLO)$/Deflater.obj \
+ $(SLO)$/ZipEnumeration.obj \
+ $(SLO)$/ZipFile.obj \
+ $(SLO)$/ZipOutputStream.obj \
+ $(SLO)$/EntryInputStream.obj \
+ $(SLO)$/ZipPackage.obj \
+ $(SLO)$/ZipPackageEntry.obj \
+ $(SLO)$/ZipPackageFolder.obj \
+ $(SLO)$/ZipPackageFolderEnumeration.obj \
+ $(SLO)$/ZipPackageStream.obj \
+ $(SLO)$/sandbox.obj
+
+APP1STDLIBS= \
+ $(TOOLSLIB) \
+ $(VOSLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(RTLLIB) \
+ $(SVTOOLLIB) \
+ $(SALLIB) \
+ $(SALMAINLIB) \
+ $(ONELIB) \
+ $(SVLLIB) \
+ $(ZLIB3RDLIB) \
+ $(UNOTOOLSLIB) \
+ $(SVAPP) \
+ svmem.lib \
+ itools.lib \
+ so2.lib \
+ sot.lib \
+ msvcirt.lib \
+ libci.lib \
+ advapi32.lib \
+ shell32.lib \
+ ivcl.lib \
+ uuid.lib \
+ kernel32.lib \
+ ole32.lib \
+ oleaut32.lib \
+ msvcrt.lib \
+
+
+# --- UNO stuff ---------------------------------------------------
+
+CPPUMAKERFLAGS=
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+
+UNOTYPES=\
+ com.sun.star.package.* \
+ com.sun.star.io.XSeekable \
+ com.sun.star.io.XOutputStream \
+ com.sun.star.io.XActiveDataSink \
+ com.sun.star.lang.XInitialization \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.lang.XUnoTunnel \
+ com.sun.star.util.XChangesBatch \
+ com.sun.star.container.XHierarchicalNameAccess \
+ com.sun.star.container.XEnumeration \
+ com.sun.star.container.XNamed \
+ com.sun.star.container.XNameContainer \
+ com.sun.star.container.XEnumerationAccess
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk