diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-11-02 10:26:23 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-11-03 11:25:16 +0000 |
commit | b3a229ad0d35b2364cc485a0dd1a5b5510fb40c3 (patch) | |
tree | 0d64f42c5321df77d0bbd6369af9a3176dc4d4da /include | |
parent | 11a1b70da2f8d788f18cd0c4b8a4c5d0386aa72e (diff) |
Add helper for creating zip files
Change-Id: I8b49b74622bf4d671d640e4cd06dc2da348ee222
Reviewed-on: https://gerrit.libreoffice.org/30478
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/unotools/ZipPackageHelper.hxx | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/include/unotools/ZipPackageHelper.hxx b/include/unotools/ZipPackageHelper.hxx new file mode 100644 index 000000000000..77c8b9178a8a --- /dev/null +++ b/include/unotools/ZipPackageHelper.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ +#ifndef INCLUDED_UNOTOOLS_ZIPPACKAGEHELPER_HXX +#define INCLUDED_UNOTOOLS_ZIPPACKAGEHELPER_HXX + +#include <unotools/unotoolsdllapi.h> + +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/io/XInputStream.hpp> + +namespace utl { + +class UNOTOOLS_DLLPUBLIC ZipPackageHelper +{ +public: + ZipPackageHelper( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const OUString& sPackageURL); + + void savePackage(); + + void addFile( css::uno::Reference< css::uno::XInterface >& xRootFolder, + const OUString& rSourceFile ) + throw( css::uno::Exception, std::exception ); + + css::uno::Reference< css::uno::XInterface > addFolder( css::uno::Reference< css::uno::XInterface >& xRootFolder, + const OUString& rName ) + throw( css::uno::Exception, std::exception ); + + void addFolderWithContent( css::uno::Reference< css::uno::XInterface >& xRootFolder, + const OUString& rDirURL ); + + css::uno::Reference< css::uno::XInterface >& getRootFolder(); + +private: + css::uno::Reference< css::uno::XComponentContext > mxContext; + css::uno::Reference< css::container::XHierarchicalNameAccess > mxHNameAccess; + css::uno::Reference< css::lang::XSingleServiceFactory > mxFactory; + css::uno::Reference< css::uno::XInterface > mxRootFolder; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |