LibreOffice Module package (master) 1
zipfileaccess.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_PACKAGE_INC_ZIPFILEACCESS_HXX
21#define INCLUDED_PACKAGE_INC_ZIPFILEACCESS_HXX
22
23#include <com/sun/star/packages/zip/XZipFileAccess2.hpp>
24#include <com/sun/star/lang/XInitialization.hpp>
25#include <com/sun/star/lang/XComponent.hpp>
26#include <com/sun/star/lang/XServiceInfo.hpp>
27
31
32#include "ZipFile.hxx"
33
34#include <memory>
35#include <optional>
36
37class OZipFileAccess final : public ::cppu::WeakImplHelper<
38 css::packages::zip::XZipFileAccess2,
39 css::lang::XInitialization,
40 css::lang::XComponent,
41 css::lang::XServiceInfo >
42{
44 css::uno::Reference< css::uno::XComponentContext > m_xContext;
45 css::uno::Reference< css::io::XInputStream > m_xContentStream;
46 std::optional<ZipFile> m_pZipFile;
47 std::unique_ptr<::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener>> m_pListenersContainer;
50
51public:
52 OZipFileAccess( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
53
54 virtual ~OZipFileAccess() override;
55
56 static css::uno::Sequence< OUString > GetPatternsFromString_Impl( const OUString& aString );
57
58 static bool StringGoodForPattern_Impl( std::u16string_view,
59 const css::uno::Sequence< OUString >& aPattern );
60
61 // XInitialization
62 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
63
64 // XNameAccess
65 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
66 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
67 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
68 virtual css::uno::Type SAL_CALL getElementType( ) override;
69 virtual sal_Bool SAL_CALL hasElements( ) override;
70
71 // XZipFileAccess
72 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getStreamByPattern( const OUString& aPattern ) override;
73
74 // XComponent
75 virtual void SAL_CALL dispose( ) override;
76 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
77 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
78
79 // XServiceInfo
80 virtual OUString SAL_CALL getImplementationName() override;
81 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
82 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
83
84};
85
86#endif
87
88/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getStreamByPattern(const OUString &aPattern) override
OZipFileAccess(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual ~OZipFileAccess() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Type SAL_CALL getElementType() override
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual OUString SAL_CALL getImplementationName() override
static bool StringGoodForPattern_Impl(std::u16string_view, const css::uno::Sequence< OUString > &aPattern)
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
std::unique_ptr<::comphelper::OInterfaceContainerHelper3< css::lang::XEventListener > > m_pListenersContainer
static css::uno::Sequence< OUString > GetPatternsFromString_Impl(const OUString &aString)
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
std::optional< ZipFile > m_pZipFile
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Reference< css::io::XInputStream > m_xContentStream
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasElements() override
rtl::Reference< comphelper::RefCountedMutex > m_aMutexHolder
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual void SAL_CALL dispose() override
unsigned char sal_Bool