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: xmleohlp.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 ************************************************************************/
34 #ifndef _CPPUHELPER_COMPBASE2_HXX_
35 #include <cppuhelper/compbase2.hxx>
38 #include <bf_so3/svstor.hxx>
42 #ifndef _COM_SUN_STAR_DOCUMENT_XEMBEDDEDOBJECTRESOLVER_HPP_
43 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
49 // -----------------------------
50 // - SvXMLEmbeddedObjectHelper -
51 // -----------------------------
53 enum SvXMLEmbeddedObjectHelperMode
55 EMBEDDEDOBJECTHELPER_MODE_READ
= 0,
56 EMBEDDEDOBJECTHELPER_MODE_WRITE
= 1
59 // -----------------------------
60 // - SvXMLEmbeddedObjectHelper -
61 // -----------------------------
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
;
76 const ::rtl::OUString maDefaultContainerStorageName
;
77 ::rtl::OUString maCurContainerStorageName
;
79 SvStorage
* mpRootStorage
; // package
80 SvPersist
* mpDocPersist
;
81 SvStorageRef mxContainerStorage
; // container sub package for
84 SvXMLEmbeddedObjectHelperMode meCreateMode
;
85 SvXMLEmbeddedObjectHelper_Impl
*mpStreamMap
;
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
);
113 SvXMLEmbeddedObjectHelper();
114 ~SvXMLEmbeddedObjectHelper();
115 void Init( SvStorage
*pRootStorage
,
116 SvPersist
& rDocPersist
,
117 SvXMLEmbeddedObjectHelperMode eCreateMode
);
119 virtual void SAL_CALL
disposing();
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
);
138 // XEmbeddedObjectResolver
139 virtual ::rtl::OUString SAL_CALL
resolveEmbeddedObjectURL( const ::rtl::OUString
& aURL
) throw(::com::sun::star::uno::RuntimeException
);
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
);
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