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