Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_svx / xmleohlp.hxx
blobac3f8b73821341f5f185c0de0884a7126b532191
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmleohlp.hxx,v $
10 * $Revision: 1.8 $
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 ************************************************************************/
31 #ifndef _XMLEOHLP_HXX
32 #define _XMLEOHLP_HXX
34 #ifndef _CPPUHELPER_COMPBASE2_HXX_
35 #include <cppuhelper/compbase2.hxx>
36 #endif
37 #ifndef _SVSTOR_HXX
38 #include <bf_so3/svstor.hxx>
39 #endif
40 #include <map>
42 #ifndef _COM_SUN_STAR_DOCUMENT_XEMBEDDEDOBJECTRESOLVER_HPP_
43 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
44 #endif
45 class SvGlobalName;
46 namespace binfilter {
47 class SvPersist;
49 // -----------------------------
50 // - SvXMLEmbeddedObjectHelper -
51 // -----------------------------
53 enum SvXMLEmbeddedObjectHelperMode
55 EMBEDDEDOBJECTHELPER_MODE_READ = 0,
56 EMBEDDEDOBJECTHELPER_MODE_WRITE = 1
59 // -----------------------------
60 // - SvXMLEmbeddedObjectHelper -
61 // -----------------------------
63 struct OUStringLess;
64 class OutputStorageWrapper_Impl;
66 class SvXMLEmbeddedObjectHelper : public ::cppu::WeakComponentImplHelper2<
67 ::com::sun::star::document::XEmbeddedObjectResolver,
68 ::com::sun::star::container::XNameAccess >
70 typedef ::std::map< ::rtl::OUString, OutputStorageWrapper_Impl*,
71 OUStringLess > SvXMLEmbeddedObjectHelper_Impl;
72 private:
74 ::osl::Mutex maMutex;
76 const ::rtl::OUString maDefaultContainerStorageName;
77 ::rtl::OUString maCurContainerStorageName;
79 SvStorage* mpRootStorage; // package
80 SvPersist* mpDocPersist;
81 SvStorageRef mxContainerStorage; // container sub package for
82 // objects
84 SvXMLEmbeddedObjectHelperMode meCreateMode;
85 SvXMLEmbeddedObjectHelper_Impl *mpStreamMap;
86 void* mpDummy2;
88 sal_Bool ImplGetStorageNames(
89 const ::rtl::OUString& rURLStr,
90 ::rtl::OUString& rContainerStorageName,
91 ::rtl::OUString& rObjectStorageName,
92 sal_Bool bInternalToExternal ) const;
94 SvStorageRef ImplGetContainerStorage(
95 const ::rtl::OUString& rStorageName );
96 SvStorageRef ImplGetObjectStorage(
97 const ::rtl::OUString& rContainerStorageName,
98 const ::rtl::OUString& rObjectStorageName,
99 sal_Bool bUCBStorage );
100 String ImplGetUniqueName( SvStorage* pStg,
101 const sal_Char* p ) const;
102 sal_Bool ImplReadObject(
103 const ::rtl::OUString& rContainerStorageName,
104 ::rtl::OUString& rObjName,
105 const SvGlobalName *pClassId,
106 SvStorage *pTempStor );
108 ::rtl::OUString ImplInsertEmbeddedObjectURL(
109 const ::rtl::OUString& rURLStr );
111 protected:
113 SvXMLEmbeddedObjectHelper();
114 ~SvXMLEmbeddedObjectHelper();
115 void Init( SvStorage *pRootStorage,
116 SvPersist& rDocPersist,
117 SvXMLEmbeddedObjectHelperMode eCreateMode );
119 virtual void SAL_CALL disposing();
121 public:
122 SvXMLEmbeddedObjectHelper(
123 SvPersist& rDocPersist,
124 SvXMLEmbeddedObjectHelperMode eCreateMode );
126 static SvXMLEmbeddedObjectHelper* Create(
127 SvStorage& rRootStorage,
128 SvPersist& rDocPersist,
129 SvXMLEmbeddedObjectHelperMode eCreateMode,
130 sal_Bool bDirect = sal_True );
131 static SvXMLEmbeddedObjectHelper* Create(
132 SvPersist& rDocPersist,
133 SvXMLEmbeddedObjectHelperMode eCreateMode );
134 static void Destroy( SvXMLEmbeddedObjectHelper* pSvXMLEmbeddedObjectHelper );
136 void Flush();
138 // XEmbeddedObjectResolver
139 virtual ::rtl::OUString SAL_CALL resolveEmbeddedObjectURL( const ::rtl::OUString& aURL ) throw(::com::sun::star::uno::RuntimeException);
141 // XNameAccess
142 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
143 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException);
144 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
146 // XNameAccess
147 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
148 virtual sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
151 }//end of namespace binfilter
152 #endif