LibreOffice Module svx (master)  1
xmleohlp.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SVX_XMLEOHLP_HXX
21 #define INCLUDED_SVX_XMLEOHLP_HXX
22 
23 #include <cppuhelper/compbase.hxx>
24 #include <osl/mutex.hxx>
25 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
26 #include <com/sun/star/container/XNameAccess.hpp>
27 #include <com/sun/star/embed/XEmbeddedObject.hpp>
28 #include <com/sun/star/embed/XStorage.hpp>
29 #include <svx/svxdllapi.h>
30 #include <rtl/ref.hxx>
31 #include <tools/stream.hxx>
32 #include <map>
33 #include <memory>
34 #include <optional>
35 
37 {
38  Read, Write
39 };
40 
41 namespace comphelper { class IEmbeddedHelper; }
42 
43 class SvGlobalName;
45 
46 
48  public cppu::WeakComponentImplHelper< css::document::XEmbeddedObjectResolver, css::container::XNameAccess >
49 {
50  ::osl::Mutex maMutex;
51 
53 
54 
55  css::uno::Reference < css::embed::XStorage > mxRootStorage; // package
57  css::uno::Reference < css::embed::XStorage > mxContainerStorage; // container sub package for
58  css::uno::Reference < css::embed::XStorage > mxTempStorage; // package
59  // objects
61  std::optional<std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> >>
63 
64  SVX_DLLPRIVATE bool ImplGetStorageNames(
65  const OUString& rURLStr,
66  OUString& rContainerStorageName,
67  OUString& rObjectStorageName,
68  bool bInternalToExternal,
69  bool *pGraphicRepl=nullptr,
70  bool *pOasisFormat=nullptr ) const;
71 
72  SVX_DLLPRIVATE css::uno::Reference < css::embed::XStorage > const & ImplGetContainerStorage(
73  const OUString& rStorageName );
74 
75  SVX_DLLPRIVATE void ImplReadObject(
76  const OUString& rContainerStorageName,
77  OUString& rObjName,
78  const SvGlobalName *pClassId,
79  SvStream* pTemp );
80 
81  SVX_DLLPRIVATE OUString ImplInsertEmbeddedObjectURL(
82  const OUString& rURLStr );
83 
84  SVX_DLLPRIVATE css::uno::Reference< css::io::XInputStream > ImplGetReplacementImage(
85  const css::uno::Reference< css::embed::XEmbeddedObject >& xObj );
86 
88  virtual ~SvXMLEmbeddedObjectHelper() override;
89  void Init( const css::uno::Reference < css::embed::XStorage >&,
90  ::comphelper::IEmbeddedHelper& rDocPersist,
91  SvXMLEmbeddedObjectHelperMode eCreateMode );
92 
93  virtual void SAL_CALL disposing() override;
94 
95 public:
97  ::comphelper::IEmbeddedHelper& rDocPersist,
98  SvXMLEmbeddedObjectHelperMode eCreateMode );
99 
101  const css::uno::Reference < css::embed::XStorage >&,
102  ::comphelper::IEmbeddedHelper& rDocPersist,
103  SvXMLEmbeddedObjectHelperMode eCreateMode );
105  ::comphelper::IEmbeddedHelper& rDocPersist,
106  SvXMLEmbeddedObjectHelperMode eCreateMode );
107 
108  // XEmbeddedObjectResolver
109  virtual OUString SAL_CALL resolveEmbeddedObjectURL( const OUString& aURL ) override;
110 
111  // XNameAccess
112  virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
113  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
114  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
115 
116  // XNameAccess
117  virtual css::uno::Type SAL_CALL getElementType( ) override;
118  virtual sal_Bool SAL_CALL hasElements( ) override;
119 
120 
121  static void splitObjectURL(const OUString& aURLNoPar,
122  OUString& rContainerStorageName,
123  OUString& rObjectStorageName);
124 };
125 
126 #endif // INCLUDED_SVX_XMLEOHLP_HXX
127 
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::optional< std::map< OUString, rtl::Reference< OutputStorageWrapper_Impl > > > mxStreamMap
Definition: xmleohlp.hxx:62
void Init()
css::uno::Reference< css::embed::XStorage > mxContainerStorage
Definition: xmleohlp.hxx:57
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
SvXMLEmbeddedObjectHelperMode
Definition: xmleohlp.hxx:36
css::uno::Reference< css::embed::XStorage > mxTempStorage
Definition: xmleohlp.hxx:58
::comphelper::IEmbeddedHelper * mpDocPersist
Definition: xmleohlp.hxx:56
OUString maCurContainerStorageName
Definition: xmleohlp.hxx:52
unsigned char sal_Bool
SvXMLEmbeddedObjectHelperMode meCreateMode
Definition: xmleohlp.hxx:60
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
css::uno::Reference< css::embed::XStorage > mxRootStorage
Definition: xmleohlp.hxx:55