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 __XOLESIMPLESTORAGE_HXX_
21 #define __XOLESIMPLESTORAGE_HXX_
23 #include <com/sun/star/embed/XOLESimpleStorage.hpp>
24 #include <com/sun/star/container/XNameContainer.hpp>
25 #include <com/sun/star/lang/XComponent.hpp>
26 #include <com/sun/star/lang/XInitialization.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/embed/XTransactedObject.hpp>
29 #include <com/sun/star/embed/XClassifiedObject.hpp>
32 #include <com/sun/star/io/XOutputStream.hpp>
33 #include <cppuhelper/implbase3.hxx>
34 #include <cppuhelper/interfacecontainer.h>
36 #include <osl/mutex.hxx>
38 #include <sot/stg.hxx>
41 class OLESimpleStorage
: public ::cppu::WeakImplHelper3
42 < ::com::sun::star::embed::XOLESimpleStorage
43 , ::com::sun::star::lang::XInitialization
44 , ::com::sun::star::lang::XServiceInfo
>
46 ::osl::Mutex m_aMutex
;
50 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xStream
;
51 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xTempStream
;
53 BaseStorage
* m_pStorage
;
55 ::cppu::OInterfaceContainerHelper
* m_pListenersContainer
; // list of listeners
56 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xFactory
;
58 sal_Bool m_bNoTemporaryCopy
;
60 void UpdateOriginal_Impl();
62 static void InsertInputStreamToStorage_Impl( BaseStorage
* pStorage
, OUString aName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInputStream
)
63 throw ( ::com::sun::star::uno::Exception
);
65 static void InsertNameAccessToStorage_Impl( BaseStorage
* pStorage
, OUString aName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& xNameAccess
)
66 throw ( ::com::sun::star::uno::Exception
);
70 OLESimpleStorage( ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xFactory
);
72 virtual ~OLESimpleStorage();
74 static ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
impl_staticGetSupportedServiceNames();
75 static OUString SAL_CALL
impl_staticGetImplementationName();
76 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
77 impl_staticCreateSelfInstance(
78 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xServiceManager
);
81 //____________________________________________________________________________________________________
83 //____________________________________________________________________________________________________
85 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
86 throw ( ::com::sun::star::uno::Exception
,
87 ::com::sun::star::uno::RuntimeException
);
89 //____________________________________________________________________________________________________
91 //____________________________________________________________________________________________________
93 virtual void SAL_CALL
insertByName( const OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
)
94 throw ( ::com::sun::star::lang::IllegalArgumentException
,
95 ::com::sun::star::container::ElementExistException
,
96 ::com::sun::star::lang::WrappedTargetException
,
97 ::com::sun::star::uno::RuntimeException
);
99 virtual void SAL_CALL
removeByName( const OUString
& Name
)
100 throw ( ::com::sun::star::container::NoSuchElementException
,
101 ::com::sun::star::lang::WrappedTargetException
,
102 ::com::sun::star::uno::RuntimeException
);
104 virtual void SAL_CALL
replaceByName( const OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
)
105 throw ( ::com::sun::star::lang::IllegalArgumentException
,
106 ::com::sun::star::container::NoSuchElementException
,
107 ::com::sun::star::lang::WrappedTargetException
,
108 ::com::sun::star::uno::RuntimeException
);
110 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
111 throw ( ::com::sun::star::container::NoSuchElementException
,
112 ::com::sun::star::lang::WrappedTargetException
,
113 ::com::sun::star::uno::RuntimeException
);
115 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
116 throw ( ::com::sun::star::uno::RuntimeException
);
118 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
119 throw ( ::com::sun::star::uno::RuntimeException
);
121 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
122 throw ( ::com::sun::star::uno::RuntimeException
);
124 virtual sal_Bool SAL_CALL
hasElements()
125 throw ( ::com::sun::star::uno::RuntimeException
);
127 //____________________________________________________________________________________________________
129 //____________________________________________________________________________________________________
131 virtual void SAL_CALL
dispose()
132 throw ( ::com::sun::star::uno::RuntimeException
);
134 virtual void SAL_CALL
addEventListener(
135 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
136 throw ( ::com::sun::star::uno::RuntimeException
);
138 virtual void SAL_CALL
removeEventListener(
139 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
140 throw ( ::com::sun::star::uno::RuntimeException
);
142 //____________________________________________________________________________________________________
144 //____________________________________________________________________________________________________
146 virtual void SAL_CALL
commit()
147 throw ( ::com::sun::star::io::IOException
,
148 ::com::sun::star::lang::WrappedTargetException
,
149 ::com::sun::star::uno::RuntimeException
);
151 virtual void SAL_CALL
revert()
152 throw ( ::com::sun::star::io::IOException
,
153 ::com::sun::star::lang::WrappedTargetException
,
154 ::com::sun::star::uno::RuntimeException
);
156 //____________________________________________________________________________________________________
158 //____________________________________________________________________________________________________
160 virtual ::com::sun::star::uno::Sequence
< ::sal_Int8
> SAL_CALL
getClassID()
161 throw ( ::com::sun::star::uno::RuntimeException
);
163 virtual OUString SAL_CALL
getClassName()
164 throw ( ::com::sun::star::uno::RuntimeException
);
166 virtual void SAL_CALL
setClassInfo( const ::com::sun::star::uno::Sequence
< ::sal_Int8
>& aClassID
,
167 const OUString
& sClassName
)
168 throw ( ::com::sun::star::lang::NoSupportException
,
169 ::com::sun::star::uno::RuntimeException
);
171 //____________________________________________________________________________________________________
173 //____________________________________________________________________________________________________
175 virtual OUString SAL_CALL
getImplementationName()
176 throw ( ::com::sun::star::uno::RuntimeException
);
178 virtual ::sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
179 throw ( ::com::sun::star::uno::RuntimeException
);
181 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
182 throw ( ::com::sun::star::uno::RuntimeException
);
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */