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 .
19 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX
20 #define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX
22 #include <sal/config.h>
26 #include <com/sun/star/embed/XStorage.hpp>
27 #include <com/sun/star/embed/XTransactionListener.hpp>
28 #include <com/sun/star/io/XStream.hpp>
29 #include <com/sun/star/io/XOutputStream.hpp>
30 #include <com/sun/star/io/XInputStream.hpp>
31 #include <com/sun/star/io/XSeekable.hpp>
32 #include <boost/shared_ptr.hpp>
35 namespace connectivity
42 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xStream
;
43 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XSeekable
> m_xSeek
;
44 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
> m_xOutputStream
;
45 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> m_xInputStream
;
47 StreamHelper(const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& _xStream
);
50 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> getInputStream();
51 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
> getOutputStream();
52 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XSeekable
> getSeek();
56 typedef std::map
< OUString
, ::boost::shared_ptr
<StreamHelper
> > TStreamMap
;
57 typedef ::std::pair
< ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>, OUString
> TStorageURLPair
;
58 typedef ::std::pair
< TStorageURLPair
, TStreamMap
> TStoragePair
;
59 typedef std::map
<OUString
, TStoragePair
> TStorages
;
60 /** contains all storages so far accessed.
62 class StorageContainer
65 static OUString
registerStorage(const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& _xStorage
,const OUString
& _sURL
);
66 static TStorages::mapped_type
getRegisteredStorage(const OUString
& _sKey
);
67 static OUString
getRegisteredKey(const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& _xStorage
);
68 static void revokeStorage(const OUString
& _sKey
,const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XTransactionListener
>& _xListener
);
70 static TStreamMap::mapped_type
registerStream(JNIEnv
* env
,jstring name
, jstring key
,sal_Int32 _nMode
);
71 static void revokeStream(JNIEnv
* env
,jstring name
, jstring key
);
72 static TStreamMap::mapped_type
getRegisteredStream( JNIEnv
* env
, jstring name
, jstring key
);
74 static OUString
jstring2ustring(JNIEnv
* env
, jstring jstr
);
75 static OUString
removeURLPrefix(const OUString
& _sURL
,const OUString
& _sFileURL
);
76 static OUString
removeOldURLPrefix(const OUString
& _sURL
);
77 static void throwJavaException(const ::com::sun::star::uno::Exception
& _aException
,JNIEnv
* env
);
83 } // namespace connectivity
86 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */