1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SOT_SOURCE_UNOOLESTORAGE_XOLESIMPLESTORAGE_HXX
21 #define INCLUDED_SOT_SOURCE_UNOOLESTORAGE_XOLESIMPLESTORAGE_HXX
23 #include <sal/config.h>
27 #include <comphelper/interfacecontainer4.hxx>
28 #include <com/sun/star/embed/XOLESimpleStorage.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <cppuhelper/implbase.hxx>
34 namespace com::sun::star::container
{ class XNameAccess
; }
35 namespace com::sun::star::io
{ class XInputStream
; }
36 namespace com::sun::star::io
{ class XStream
; }
37 namespace com::sun::star::lang
{ class XEventListener
; }
38 namespace com::sun::star::uno
{ class XComponentContext
; }
43 class OLESimpleStorage
: public cppu::WeakImplHelper
<css::embed::XOLESimpleStorage
, css::lang::XServiceInfo
>
49 css::uno::Reference
< css::io::XStream
> m_xStream
;
50 css::uno::Reference
< css::io::XStream
> m_xTempStream
;
51 std::unique_ptr
<SvStream
> m_pStream
;
52 std::unique_ptr
<BaseStorage
> m_pStorage
;
54 ::comphelper::OInterfaceContainerHelper4
<css::lang::XEventListener
> m_aListenersContainer
; // list of listeners
55 css::uno::Reference
<css::uno::XComponentContext
> m_xContext
;
57 bool m_bNoTemporaryCopy
;
59 void UpdateOriginal_Impl();
61 /// @throws css::uno::Exception
62 static void InsertInputStreamToStorage_Impl( BaseStorage
* pStorage
, const OUString
& aName
, const css::uno::Reference
< css::io::XInputStream
>& xInputStream
);
64 /// @throws css::uno::Exception
65 static void InsertNameAccessToStorage_Impl( BaseStorage
* pStorage
, const OUString
& aName
, const css::uno::Reference
< css::container::XNameAccess
>& xNameAccess
);
69 OLESimpleStorage(css::uno::Reference
<css::uno::XComponentContext
> xContext
,
70 css::uno::Sequence
<css::uno::Any
> const &arguments
);
72 virtual ~OLESimpleStorage() override
;
76 virtual void SAL_CALL
insertByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
78 virtual void SAL_CALL
removeByName( const OUString
& Name
) override
;
80 virtual void SAL_CALL
replaceByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
82 virtual css::uno::Any SAL_CALL
getByName( const OUString
& aName
) override
;
84 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
86 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) override
;
88 virtual css::uno::Type SAL_CALL
getElementType() override
;
90 virtual sal_Bool SAL_CALL
hasElements() override
;
94 virtual void SAL_CALL
dispose() final override
;
96 virtual void SAL_CALL
addEventListener(
97 const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
99 virtual void SAL_CALL
removeEventListener(
100 const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
104 virtual void SAL_CALL
commit() override
;
106 virtual void SAL_CALL
revert() override
;
110 virtual css::uno::Sequence
< ::sal_Int8
> SAL_CALL
getClassID() override
;
112 virtual OUString SAL_CALL
getClassName() override
;
114 virtual void SAL_CALL
setClassInfo( const css::uno::Sequence
< ::sal_Int8
>& aClassID
,
115 const OUString
& sClassName
) override
;
119 virtual OUString SAL_CALL
getImplementationName() override
;
121 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
123 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */