1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: HStorageMap.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CONNECTIVI_HSQLDB_HSTORAGEMAP_HXX
31 #define CONNECTIVI_HSQLDB_HSTORAGEMAP_HXX
33 #include <com/sun/star/embed/XStorage.hpp>
34 #include <com/sun/star/embed/XTransactionListener.hpp>
35 #include <com/sun/star/io/XStream.hpp>
36 #include <com/sun/star/io/XOutputStream.hpp>
37 #include <com/sun/star/io/XInputStream.hpp>
38 #include <com/sun/star/io/XSeekable.hpp>
39 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
40 #include <boost/shared_ptr.hpp>
42 #include <comphelper/stl_types.hxx>
44 //........................................................................
45 namespace connectivity
47 //........................................................................
52 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xStream
;
53 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XSeekable
> m_xSeek
;
54 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
> m_xOutputStream
;
55 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> m_xInputStream
;
57 StreamHelper(const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& _xStream
);
60 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> getInputStream();
61 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
> getOutputStream();
62 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XSeekable
> getSeek();
66 DECLARE_STL_USTRINGACCESS_MAP(::boost::shared_ptr
<StreamHelper
>,TStreamMap
);
67 typedef ::std::pair
< ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>, ::rtl::OUString
> TStorageURLPair
;
68 typedef ::std::pair
< TStorageURLPair
, TStreamMap
> TStoragePair
;
69 DECLARE_STL_USTRINGACCESS_MAP(TStoragePair
,TStorages
);
70 /** contains all storages so far accessed.
72 class StorageContainer
75 static ::rtl::OUString
registerStorage(const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& _xStorage
,const ::rtl::OUString
& _sURL
);
76 static TStorages::mapped_type
getRegisteredStorage(const ::rtl::OUString
& _sKey
);
77 static ::rtl::OUString
getRegisteredKey(const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& _xStorage
);
78 static void revokeStorage(const ::rtl::OUString
& _sKey
,const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XTransactionListener
>& _xListener
);
80 static TStreamMap::mapped_type
registerStream(JNIEnv
* env
,jstring name
, jstring key
,sal_Int32 _nMode
);
81 static void revokeStream(JNIEnv
* env
,jstring name
, jstring key
);
82 static TStreamMap::mapped_type
getRegisteredStream( JNIEnv
* env
, jstring name
, jstring key
);
84 static ::rtl::OUString
jstring2ustring(JNIEnv
* env
, jstring jstr
);
85 static ::rtl::OUString
removeURLPrefix(const ::rtl::OUString
& _sURL
,const ::rtl::OUString
& _sFileURL
);
86 static ::rtl::OUString
removeOldURLPrefix(const ::rtl::OUString
& _sURL
);
87 static void throwJavaException(const ::com::sun::star::uno::Exception
& _aException
,JNIEnv
* env
);
89 //........................................................................
91 //........................................................................
92 //........................................................................
93 } // namespace connectivity
95 //........................................................................
96 #endif // CONNECTIVI_HSQLDB_HSTORAGEMAP_HXX