bump product version to 4.2.0.1
[LibreOffice.git] / include / svx / xmleohlp.hxx
blob1156b02535acdb0d7ee41ef3af06af1d9dee60f9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SVX_XMLEOHLP_HXX
21 #define INCLUDED_SVX_XMLEOHLP_HXX
23 #include <cppuhelper/compbase2.hxx>
24 #include <osl/mutex.hxx>
25 #include <sot/storage.hxx>
26 #include <map>
27 #include <com/sun/star/container/XNameContainer.hpp>
28 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
29 #include <com/sun/star/container/XNameAccess.hpp>
30 #include <com/sun/star/embed/XEmbeddedObject.hpp>
31 #include <svx/svxdllapi.h>
33 // -----------------------------
34 // - SvXMLEmbeddedObjectHelper -
35 // -----------------------------
37 enum SvXMLEmbeddedObjectHelperMode
39 EMBEDDEDOBJECTHELPER_MODE_READ = 0,
40 EMBEDDEDOBJECTHELPER_MODE_WRITE = 1
43 // -----------------------------
44 // - SvXMLEmbeddedObjectHelper -
45 // -----------------------------
47 namespace comphelper {
48 class IEmbeddedHelper;
50 class SvGlobalName;
51 struct OUStringLess;
52 class OutputStorageWrapper_Impl;
54 class SVX_DLLPUBLIC SvXMLEmbeddedObjectHelper : public ::cppu::WeakComponentImplHelper2<
55 ::com::sun::star::document::XEmbeddedObjectResolver,
56 ::com::sun::star::container::XNameAccess >
58 typedef ::std::map< OUString, OutputStorageWrapper_Impl*,
59 OUStringLess > SvXMLEmbeddedObjectHelper_Impl;
60 private:
62 ::osl::Mutex maMutex;
64 const OUString maReplacementGraphicsContainerStorageName;
65 const OUString maReplacementGraphicsContainerStorageName60;
66 OUString maCurContainerStorageName;
69 com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxRootStorage; // package
70 ::comphelper::IEmbeddedHelper* mpDocPersist;
71 com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxContainerStorage; // container sub package for
72 com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxTempStorage; // package
73 // objects
74 SvXMLEmbeddedObjectHelperMode meCreateMode;
75 SvXMLEmbeddedObjectHelper_Impl *mpStreamMap;
77 SVX_DLLPRIVATE sal_Bool ImplGetStorageNames(
78 const OUString& rURLStr,
79 OUString& rContainerStorageName,
80 OUString& rObjectStorageName,
81 sal_Bool bInternalToExternal,
82 sal_Bool *pGraphicRepl=0,
83 sal_Bool *pOasisFormat=0 ) const;
85 SVX_DLLPRIVATE com::sun::star::uno::Reference < com::sun::star::embed::XStorage > ImplGetContainerStorage(
86 const OUString& rStorageName );
88 SVX_DLLPRIVATE sal_Bool ImplReadObject(
89 const OUString& rContainerStorageName,
90 OUString& rObjName,
91 const SvGlobalName *pClassId,
92 SvStream* pTemp );
94 SVX_DLLPRIVATE OUString ImplInsertEmbeddedObjectURL(
95 const OUString& rURLStr );
97 SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > ImplGetReplacementImage(
98 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj );
100 protected:
102 SvXMLEmbeddedObjectHelper();
103 ~SvXMLEmbeddedObjectHelper();
104 void Init( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
105 ::comphelper::IEmbeddedHelper& rDocPersist,
106 SvXMLEmbeddedObjectHelperMode eCreateMode );
108 virtual void SAL_CALL disposing();
110 public:
111 SvXMLEmbeddedObjectHelper(
112 ::comphelper::IEmbeddedHelper& rDocPersist,
113 SvXMLEmbeddedObjectHelperMode eCreateMode );
115 static SvXMLEmbeddedObjectHelper* Create(
116 const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
117 ::comphelper::IEmbeddedHelper& rDocPersist,
118 SvXMLEmbeddedObjectHelperMode eCreateMode,
119 sal_Bool bDirect = sal_True );
120 static SvXMLEmbeddedObjectHelper* Create(
121 ::comphelper::IEmbeddedHelper& rDocPersist,
122 SvXMLEmbeddedObjectHelperMode eCreateMode );
123 static void Destroy( SvXMLEmbeddedObjectHelper* pSvXMLEmbeddedObjectHelper );
125 void Flush();
127 // XEmbeddedObjectResolver
128 virtual OUString SAL_CALL resolveEmbeddedObjectURL( const OUString& aURL ) throw(::com::sun::star::uno::RuntimeException);
130 // XNameAccess
131 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
132 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException);
133 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
135 // XNameAccess
136 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
137 virtual sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
140 static void splitObjectURL(OUString aURLNoPar,
141 OUString& rContainerStorageName,
142 OUString& rObjectStorageName);
145 #endif
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */