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 <comphelper/compbase.hxx>
24 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
25 #include <com/sun/star/container/XNameAccess.hpp>
26 #include <com/sun/star/embed/XEmbeddedObject.hpp>
27 #include <com/sun/star/embed/XStorage.hpp>
28 #include <svx/svxdllapi.h>
29 #include <rtl/ref.hxx>
30 #include <tools/stream.hxx>
31 #include <map>
32 #include <optional>
33 
35 {
36  Read, Write
37 };
38 
39 namespace comphelper { class IEmbeddedHelper; }
40 
41 class SvGlobalName;
43 
44 
46  public comphelper::WeakComponentImplHelper< css::document::XEmbeddedObjectResolver, css::container::XNameAccess >
47 {
49 
50 
51  css::uno::Reference < css::embed::XStorage > mxRootStorage; // package
53  css::uno::Reference < css::embed::XStorage > mxContainerStorage; // container sub package for
54  css::uno::Reference < css::embed::XStorage > mxTempStorage; // package
55  // objects
57  std::optional<std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> >>
59 
60  SVX_DLLPRIVATE bool ImplGetStorageNames(
61  const OUString& rURLStr,
62  OUString& rContainerStorageName,
63  OUString& rObjectStorageName,
64  bool bInternalToExternal,
65  bool *pGraphicRepl=nullptr,
66  bool *pOasisFormat=nullptr ) const;
67 
68  SVX_DLLPRIVATE css::uno::Reference < css::embed::XStorage > const & ImplGetContainerStorage(
69  const OUString& rStorageName );
70 
71  SVX_DLLPRIVATE void ImplReadObject(
72  const OUString& rContainerStorageName,
73  OUString& rObjName,
74  const SvGlobalName *pClassId,
75  SvStream* pTemp );
76 
77  SVX_DLLPRIVATE OUString ImplInsertEmbeddedObjectURL(
78  const OUString& rURLStr );
79 
80  SVX_DLLPRIVATE css::uno::Reference< css::io::XInputStream > ImplGetReplacementImage(
81  const css::uno::Reference< css::embed::XEmbeddedObject >& xObj );
82 
84  virtual ~SvXMLEmbeddedObjectHelper() override;
85  void Init( const css::uno::Reference < css::embed::XStorage >&,
86  ::comphelper::IEmbeddedHelper& rDocPersist,
87  SvXMLEmbeddedObjectHelperMode eCreateMode );
88 
89  virtual void disposing(std::unique_lock<std::mutex>&) override;
90 
91 public:
93  ::comphelper::IEmbeddedHelper& rDocPersist,
94  SvXMLEmbeddedObjectHelperMode eCreateMode );
95 
97  const css::uno::Reference < css::embed::XStorage >&,
98  ::comphelper::IEmbeddedHelper& rDocPersist,
99  SvXMLEmbeddedObjectHelperMode eCreateMode );
101  ::comphelper::IEmbeddedHelper& rDocPersist,
102  SvXMLEmbeddedObjectHelperMode eCreateMode );
103 
104  // XEmbeddedObjectResolver
105  virtual OUString SAL_CALL resolveEmbeddedObjectURL( const OUString& aURL ) override;
106 
107  // XNameAccess
108  virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
109  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
110  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
111 
112  // XNameAccess
113  virtual css::uno::Type SAL_CALL getElementType( ) override;
114  virtual sal_Bool SAL_CALL hasElements( ) override;
115 
116 
117  static void splitObjectURL(const OUString& aURLNoPar,
118  OUString& rContainerStorageName,
119  OUString& rObjectStorageName);
120 };
121 
122 #endif // INCLUDED_SVX_XMLEOHLP_HXX
123 
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::optional< std::map< OUString, rtl::Reference< OutputStorageWrapper_Impl > > > mxStreamMap
Definition: xmleohlp.hxx:58
void Init()
css::uno::Reference< css::embed::XStorage > mxContainerStorage
Definition: xmleohlp.hxx:53
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
SvXMLEmbeddedObjectHelperMode
Definition: xmleohlp.hxx:34
css::uno::Reference< css::embed::XStorage > mxTempStorage
Definition: xmleohlp.hxx:54
::comphelper::IEmbeddedHelper * mpDocPersist
Definition: xmleohlp.hxx:52
OUString maCurContainerStorageName
Definition: xmleohlp.hxx:48
virtual void disposing(std::unique_lock< std::mutex > &)
unsigned char sal_Bool
SvXMLEmbeddedObjectHelperMode meCreateMode
Definition: xmleohlp.hxx:56
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
css::uno::Reference< css::embed::XStorage > mxRootStorage
Definition: xmleohlp.hxx:51