bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / svx / xmleohlp.hxx
blob0e9a7174d083877f8adb23eeb94334a57cd6c61d
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/compbase.hxx>
24 #include <osl/mutex.hxx>
25 #include <com/sun/star/container/XNameContainer.hpp>
26 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
27 #include <com/sun/star/container/XNameAccess.hpp>
28 #include <com/sun/star/embed/XEmbeddedObject.hpp>
29 #include <svx/svxdllapi.h>
30 #include <rtl/ref.hxx>
31 #include <map>
32 #include <memory>
34 enum class SvXMLEmbeddedObjectHelperMode
36 Read, Write
39 namespace comphelper { class IEmbeddedHelper; }
41 class SvGlobalName;
42 class OutputStorageWrapper_Impl;
45 class SVX_DLLPUBLIC SvXMLEmbeddedObjectHelper final :
46 public cppu::WeakComponentImplHelper< css::document::XEmbeddedObjectResolver, css::container::XNameAccess >
48 ::osl::Mutex maMutex;
50 OUString maCurContainerStorageName;
53 css::uno::Reference < css::embed::XStorage > mxRootStorage; // package
54 ::comphelper::IEmbeddedHelper* mpDocPersist;
55 css::uno::Reference < css::embed::XStorage > mxContainerStorage; // container sub package for
56 css::uno::Reference < css::embed::XStorage > mxTempStorage; // package
57 // objects
58 SvXMLEmbeddedObjectHelperMode meCreateMode;
59 std::unique_ptr<std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> >>
60 mpStreamMap;
62 SVX_DLLPRIVATE bool ImplGetStorageNames(
63 const OUString& rURLStr,
64 OUString& rContainerStorageName,
65 OUString& rObjectStorageName,
66 bool bInternalToExternal,
67 bool *pGraphicRepl=nullptr,
68 bool *pOasisFormat=nullptr ) const;
70 SVX_DLLPRIVATE css::uno::Reference < css::embed::XStorage > const & ImplGetContainerStorage(
71 const OUString& rStorageName );
73 SVX_DLLPRIVATE void ImplReadObject(
74 const OUString& rContainerStorageName,
75 OUString& rObjName,
76 const SvGlobalName *pClassId,
77 SvStream* pTemp );
79 SVX_DLLPRIVATE OUString ImplInsertEmbeddedObjectURL(
80 const OUString& rURLStr );
82 SVX_DLLPRIVATE css::uno::Reference< css::io::XInputStream > ImplGetReplacementImage(
83 const css::uno::Reference< css::embed::XEmbeddedObject >& xObj );
85 SvXMLEmbeddedObjectHelper();
86 virtual ~SvXMLEmbeddedObjectHelper() override;
87 void Init( const css::uno::Reference < css::embed::XStorage >&,
88 ::comphelper::IEmbeddedHelper& rDocPersist,
89 SvXMLEmbeddedObjectHelperMode eCreateMode );
91 virtual void SAL_CALL disposing() override;
93 public:
94 SvXMLEmbeddedObjectHelper(
95 ::comphelper::IEmbeddedHelper& rDocPersist,
96 SvXMLEmbeddedObjectHelperMode eCreateMode );
98 static rtl::Reference<SvXMLEmbeddedObjectHelper> Create(
99 const css::uno::Reference < css::embed::XStorage >&,
100 ::comphelper::IEmbeddedHelper& rDocPersist,
101 SvXMLEmbeddedObjectHelperMode eCreateMode );
102 static rtl::Reference<SvXMLEmbeddedObjectHelper> Create(
103 ::comphelper::IEmbeddedHelper& rDocPersist,
104 SvXMLEmbeddedObjectHelperMode eCreateMode );
106 // XEmbeddedObjectResolver
107 virtual OUString SAL_CALL resolveEmbeddedObjectURL( const OUString& aURL ) override;
109 // XNameAccess
110 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
111 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
112 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
114 // XNameAccess
115 virtual css::uno::Type SAL_CALL getElementType( ) override;
116 virtual sal_Bool SAL_CALL hasElements( ) override;
119 static void splitObjectURL(const OUString& aURLNoPar,
120 OUString& rContainerStorageName,
121 OUString& rObjectStorageName);
124 #endif // INCLUDED_SVX_XMLEOHLP_HXX
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */