2010-10-27 12:45:03 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-21 14:30:25 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2014-04-18 22:14:30 +02:00
|
|
|
#ifndef INCLUDED_PACKAGE_INC_ZIPPACKAGEFOLDER_HXX
|
|
|
|
#define INCLUDED_PACKAGE_INC_ZIPPACKAGEFOLDER_HXX
|
2001-04-19 13:28:02 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/container/XNameContainer.hpp>
|
|
|
|
#include <com/sun/star/container/XEnumerationAccess.hpp>
|
2006-10-13 10:42:41 +00:00
|
|
|
#include <com/sun/star/beans/StringPair.hpp>
|
2014-10-09 15:22:54 +02:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
2017-10-23 22:34:57 +02:00
|
|
|
#include "HashMaps.hxx"
|
|
|
|
#include "ZipPackageEntry.hxx"
|
2015-08-25 16:10:12 +09:00
|
|
|
#include <cppuhelper/implbase.hxx>
|
2011-02-05 21:44:51 -08:00
|
|
|
#include <vector>
|
2001-04-19 13:28:02 +00:00
|
|
|
|
|
|
|
class ZipOutputStream;
|
2001-09-14 13:52:45 +00:00
|
|
|
struct ZipEntry;
|
2001-08-08 17:20:28 +00:00
|
|
|
|
2015-08-25 16:10:12 +09:00
|
|
|
class ZipPackageFolder : public cppu::ImplInheritanceHelper
|
2001-11-15 19:01:49 +00:00
|
|
|
<
|
|
|
|
ZipPackageEntry,
|
2015-10-23 14:59:15 +02:00
|
|
|
css::container::XNameContainer,
|
|
|
|
css::container::XEnumerationAccess
|
2001-11-15 19:01:49 +00:00
|
|
|
>
|
2001-04-19 13:28:02 +00:00
|
|
|
{
|
2013-01-31 17:08:44 +02:00
|
|
|
private:
|
2001-09-14 13:52:45 +00:00
|
|
|
ContentHash maContents;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_sVersion;
|
2004-02-03 16:48:23 +00:00
|
|
|
|
2001-04-19 13:28:02 +00:00
|
|
|
public:
|
|
|
|
|
2014-10-13 09:54:28 +02:00
|
|
|
ZipPackageFolder( const css::uno::Reference < css::uno::XComponentContext >& xContext,
|
2014-10-09 15:22:54 +02:00
|
|
|
sal_Int32 nFormat,
|
2014-04-17 13:40:46 +02:00
|
|
|
bool bAllowRemoveOnInsert );
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~ZipPackageFolder() override;
|
2001-04-19 13:28:02 +00:00
|
|
|
|
2014-10-07 13:56:26 +02:00
|
|
|
const OUString& GetVersion() const { return m_sVersion; }
|
2013-04-07 12:06:47 +02:00
|
|
|
void SetVersion( const OUString& aVersion ) { m_sVersion = aVersion; }
|
2008-05-14 09:31:56 +00:00
|
|
|
|
2014-04-17 13:40:46 +02:00
|
|
|
bool LookForUnexpectedODF12Streams( const OUString& aPath );
|
2009-09-17 13:53:54 +00:00
|
|
|
|
2015-10-23 14:59:15 +02:00
|
|
|
void setChildStreamsTypeByExtension( const css::beans::StringPair& aPair );
|
2006-10-13 10:42:41 +00:00
|
|
|
|
2017-01-19 17:54:53 +01:00
|
|
|
/// @throws css::lang::IllegalArgumentException
|
|
|
|
/// @throws css::container::ElementExistException
|
|
|
|
/// @throws css::lang::WrappedTargetException
|
|
|
|
/// @throws css::uno::RuntimeException
|
2017-01-26 12:28:58 +01:00
|
|
|
void doInsertByName ( ZipPackageEntry *pEntry, bool bSetParent );
|
2006-10-13 10:42:41 +00:00
|
|
|
|
2017-01-07 19:40:36 -05:00
|
|
|
ZipContentInfo& doGetByName( const OUString& aName );
|
2006-10-13 10:42:41 +00:00
|
|
|
|
2019-09-06 00:50:24 +03:00
|
|
|
static css::uno::Sequence < sal_Int8 > getUnoTunnelId();
|
2004-08-12 10:54:38 +00:00
|
|
|
|
2010-04-14 12:33:05 +02:00
|
|
|
void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; }
|
2014-10-13 09:54:28 +02:00
|
|
|
void setRemoveOnInsertMode_Impl( bool bRemove ) { mbAllowRemoveOnInsert = bRemove; }
|
|
|
|
|
|
|
|
virtual bool saveChild( const OUString &rPath,
|
|
|
|
std::vector < css::uno::Sequence < css::beans::PropertyValue > > &rManList,
|
|
|
|
ZipOutputStream & rZipOut,
|
|
|
|
const css::uno::Sequence < sal_Int8 >& rEncryptionKey,
|
2018-01-11 23:47:24 +01:00
|
|
|
sal_Int32 nPBKDF2IterationCount,
|
2015-10-12 16:04:04 +02:00
|
|
|
const rtlRandomPool &rRandomPool ) override;
|
2004-08-12 10:54:38 +00:00
|
|
|
|
2001-04-19 13:28:02 +00:00
|
|
|
// Recursive functions
|
2017-01-19 17:54:53 +01:00
|
|
|
/// @throws css::uno::RuntimeException
|
2014-10-07 16:04:13 +02:00
|
|
|
void saveContents(
|
|
|
|
const OUString &rPath,
|
2015-10-23 14:59:15 +02:00
|
|
|
std::vector < css::uno::Sequence < css::beans::PropertyValue > > &rManList,
|
2014-10-07 16:04:13 +02:00
|
|
|
ZipOutputStream & rZipOut,
|
2015-10-23 14:59:15 +02:00
|
|
|
const css::uno::Sequence< sal_Int8 > &rEncryptionKey,
|
2018-01-11 23:47:24 +01:00
|
|
|
sal_Int32 nPBKDF2IterationCount,
|
2017-01-26 12:28:58 +01:00
|
|
|
const rtlRandomPool & rRandomPool) const;
|
2001-04-19 13:28:02 +00:00
|
|
|
|
|
|
|
// XNameContainer
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override;
|
|
|
|
virtual void SAL_CALL removeByName( const OUString& Name ) override;
|
2001-04-19 13:28:02 +00:00
|
|
|
|
|
|
|
// XEnumerationAccess
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override;
|
2001-04-19 13:28:02 +00:00
|
|
|
|
|
|
|
// XElementAccess
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Type SAL_CALL getElementType( ) override;
|
|
|
|
virtual sal_Bool SAL_CALL hasElements( ) override;
|
2001-04-19 13:28:02 +00:00
|
|
|
|
|
|
|
// XNameAccess
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
|
|
|
|
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
|
|
|
|
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
|
2001-04-19 13:28:02 +00:00
|
|
|
|
|
|
|
// XNameReplace
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
|
2001-04-19 13:28:02 +00:00
|
|
|
|
2001-04-27 13:56:07 +00:00
|
|
|
// XPropertySet
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
|
|
|
|
virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
|
2001-04-27 13:56:07 +00:00
|
|
|
|
2001-04-19 13:28:02 +00:00
|
|
|
// XUnoTunnel
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
|
2001-11-15 19:01:49 +00:00
|
|
|
|
|
|
|
// XServiceInfo
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual OUString SAL_CALL getImplementationName( ) override;
|
|
|
|
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
|
|
|
|
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
|
2001-04-19 13:28:02 +00:00
|
|
|
};
|
|
|
|
#endif
|
2010-10-27 12:45:03 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|