LibreOffice Module svx (master)  1
xmleohlp.cxx
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 
21 #include <com/sun/star/io/XStream.hpp>
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include <com/sun/star/embed/XTransactedObject.hpp>
24 #include <com/sun/star/embed/ElementModes.hpp>
25 #include <com/sun/star/embed/XEmbeddedObject.hpp>
26 #include <com/sun/star/embed/XEmbedPersist.hpp>
27 #include <com/sun/star/embed/EmbedStates.hpp>
28 #include <com/sun/star/embed/Aspects.hpp>
29 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
30 #include <sot/storage.hxx>
31 #include <tools/debug.hxx>
32 #include <sal/log.hxx>
33 #include <unotools/streamwrap.hxx>
34 #include <unotools/tempfile.hxx>
35 
36 #include <svtools/embedhlp.hxx>
40 
41 #include <comphelper/fileformat.h>
42 #include <cppuhelper/exc_hlp.hxx>
43 #include <cppuhelper/implbase.hxx>
44 #include <svx/xmleohlp.hxx>
45 #include <map>
46 #include <memory>
47 #include <string_view>
48 
49 using namespace ::osl;
50 using namespace ::cppu;
51 using namespace ::utl;
52 using namespace ::com::sun::star;
53 using namespace ::com::sun::star::document;
54 using namespace ::com::sun::star::uno;
55 using namespace ::com::sun::star::container;
56 using namespace ::com::sun::star::io;
57 using namespace ::com::sun::star::lang;
58 
59 #define XML_CONTAINERSTORAGE_NAME_60 "Pictures"
60 #define XML_CONTAINERSTORAGE_NAME "ObjectReplacements"
61 #define XML_EMBEDDEDOBJECT_URL_BASE "vnd.sun.star.EmbeddedObject:"
62 #define XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE "vnd.sun.star.GraphicObject:"
63 
64 
65 class OutputStorageWrapper_Impl : public ::cppu::WeakImplHelper<XOutputStream>
66 {
67  ::osl::Mutex maMutex;
68  Reference < XOutputStream > xOut;
69  TempFile aTempFile;
70  bool bStreamClosed : 1;
72 
73 public:
75 
76 // css::io::XOutputStream
77  virtual void SAL_CALL writeBytes(const Sequence< sal_Int8 >& aData) override;
78  virtual void SAL_CALL flush() override;
79  virtual void SAL_CALL closeOutput() override;
80 
82 };
83 
85  : bStreamClosed( false )
86  , pStream(nullptr)
87 {
88  aTempFile.EnableKillingFile();
89  pStream = aTempFile.GetStream( StreamMode::READWRITE );
90  xOut = new OOutputStreamWrapper( *pStream );
91 }
92 
94 {
95  if( bStreamClosed )
96  return pStream;
97  return nullptr;
98 }
99 
101  const Sequence< sal_Int8 >& aData)
102 {
103  MutexGuard aGuard( maMutex );
104  xOut->writeBytes( aData );
105 }
106 
108 {
109  MutexGuard aGuard( maMutex );
110  xOut->flush();
111 }
112 
114 {
115  MutexGuard aGuard( maMutex );
116  xOut->closeOutput();
117  bStreamClosed = true;
118 }
119 
122 
124  WeakComponentImplHelper< XEmbeddedObjectResolver, XNameAccess >( maMutex ),
125  mpDocPersist( nullptr ),
126  meCreateMode( SvXMLEmbeddedObjectHelperMode::Read )
127 {
128 }
129 
131  WeakComponentImplHelper< XEmbeddedObjectResolver, XNameAccess >( maMutex ),
132  mpDocPersist( nullptr ),
133  meCreateMode( SvXMLEmbeddedObjectHelperMode::Read )
134 {
135  Init( nullptr, rDocPersist, eCreateMode );
136 }
137 
139 {
140 }
141 
143 {
144  if( mxTempStorage.is() )
145  {
146  mxTempStorage->dispose();
147  }
148 }
149 
150 void SvXMLEmbeddedObjectHelper::splitObjectURL(const OUString& _aURLNoPar,
151  OUString& rContainerStorageName,
152  OUString& rObjectStorageName)
153 {
154  DBG_ASSERT(_aURLNoPar.isEmpty() || '#' != _aURLNoPar[0], "invalid object URL" );
155  OUString aURLNoPar = _aURLNoPar;
156 
157  sal_Int32 _nPos = aURLNoPar.lastIndexOf( '/' );
158  if( -1 == _nPos )
159  {
160  rContainerStorageName.clear();
161  rObjectStorageName = aURLNoPar;
162  }
163  else
164  {
165  //eliminate 'superfluous' slashes at start and end
166  //#i103076# load objects with all allowed xlink:href syntaxes
167  {
168  //eliminate './' at start
169  sal_Int32 nStart = 0;
170  sal_Int32 nCount = aURLNoPar.getLength();
171  if( aURLNoPar.startsWith( "./" ) )
172  {
173  nStart = 2;
174  nCount -= 2;
175  }
176 
177  //eliminate '/' at end
178  sal_Int32 nEnd = aURLNoPar.lastIndexOf( '/' );
179  if( nEnd == aURLNoPar.getLength()-1 && nEnd != (nStart-1) )
180  nCount--;
181 
182  aURLNoPar = aURLNoPar.copy( nStart, nCount );
183  }
184 
185  _nPos = aURLNoPar.lastIndexOf( '/' );
186  if( _nPos >= 0 )
187  rContainerStorageName = aURLNoPar.copy( 0, _nPos );
188  rObjectStorageName = aURLNoPar.copy( _nPos+1 );
189  }
190 }
191 
193  const OUString& rURLStr,
194  OUString& rContainerStorageName,
195  OUString& rObjectStorageName,
196  bool bInternalToExternal,
197  bool *pGraphicRepl,
198  bool *pOasisFormat ) const
199 {
200  // internal URL: vnd.sun.star.EmbeddedObject:<object-name>
201  // or: vnd.sun.star.EmbeddedObject:<path>/<object-name>
202  // internal replacement images:
203  // vnd.sun.star.EmbeddedObjectGraphic:<object-name>
204  // or: vnd.sun.star.EmbeddedObjectGraphic:<path>/<object-name>
205  // external URL: ./<path>/<object-name>
206  // or: <path>/<object-name>
207  // or: <object-name>
208  // currently, path may only consist of a single directory name
209  // it is also possible to have additional arguments at the end of URL: <main URL>[?<name>=<value>[,<name>=<value>]*]
210 
211  if( pGraphicRepl )
212  *pGraphicRepl = false;
213 
214  if( pOasisFormat )
215  *pOasisFormat = true; // the default value
216 
217  if( rURLStr.isEmpty() )
218  return false;
219 
220  // get rid of arguments
221  sal_Int32 nPos = rURLStr.indexOf( '?' );
222  OUString aURLNoPar;
223  if ( nPos == -1 )
224  aURLNoPar = rURLStr;
225  else
226  {
227  aURLNoPar = rURLStr.copy( 0, nPos );
228 
229  // check the arguments
230  nPos++;
231  while( nPos >= 0 && nPos < rURLStr.getLength() )
232  {
233  OUString aToken = rURLStr.getToken( 0, ',', nPos );
234  if ( aToken.equalsIgnoreAsciiCase( "oasis=false" ) )
235  {
236  if ( pOasisFormat )
237  *pOasisFormat = false;
238  break;
239  }
240  else
241  {
242  SAL_WARN( "svx", "invalid arguments was found in URL!" );
243  }
244  }
245  }
246 
247  if( bInternalToExternal )
248  {
249  nPos = aURLNoPar.indexOf( ':' );
250  if( -1 == nPos )
251  return false;
252  bool bObjUrl = aURLNoPar.startsWith( XML_EMBEDDEDOBJECT_URL_BASE );
253  bool bGrUrl = !bObjUrl &&
254  aURLNoPar.startsWith( XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE );
255  if( !(bObjUrl || bGrUrl) )
256  return false;
257 
258  sal_Int32 nPathStart = nPos + 1;
259  nPos = aURLNoPar.lastIndexOf( '/' );
260  if( -1 == nPos )
261  {
262  rContainerStorageName.clear();
263  rObjectStorageName = aURLNoPar.copy( nPathStart );
264  }
265  else if( nPos > nPathStart )
266  {
267  rContainerStorageName = aURLNoPar.copy( nPathStart, nPos-nPathStart);
268  rObjectStorageName = aURLNoPar.copy( nPos+1 );
269  }
270  else
271  return false;
272 
273  if( bGrUrl )
274  {
275  bool bOASIS = mxRootStorage.is() &&
277  rContainerStorageName = bOASIS
280 
281  if( pGraphicRepl )
282  *pGraphicRepl = true;
283  }
284 
285 
286  }
287  else
288  {
289  splitObjectURL(aURLNoPar, rContainerStorageName, rObjectStorageName);
290  }
291 
292  if( -1 != rContainerStorageName.indexOf( '/' ) )
293  {
294  OSL_FAIL( "SvXMLEmbeddedObjectHelper: invalid path name" );
295  return false;
296  }
297 
298  return true;
299 }
300 
301 uno::Reference < embed::XStorage > const & SvXMLEmbeddedObjectHelper::ImplGetContainerStorage(
302  const OUString& rStorageName )
303 {
304  DBG_ASSERT( -1 == rStorageName.indexOf( '/' ) &&
305  -1 == rStorageName.indexOf( '\\' ),
306  "nested embedded storages aren't supported" );
307  if( !mxContainerStorage.is() ||
308  ( rStorageName != maCurContainerStorageName ) )
309  {
310  if( mxContainerStorage.is() &&
311  !maCurContainerStorageName.isEmpty() &&
313  {
314  uno::Reference < embed::XTransactedObject > xTrans( mxContainerStorage, uno::UNO_QUERY );
315  if ( xTrans.is() )
316  xTrans->commit();
317  }
318 
319  if( !rStorageName.isEmpty() && mxRootStorage.is() )
320  {
322  ? ::embed::ElementModes::READWRITE
323  : ::embed::ElementModes::READ;
324  mxContainerStorage = mxRootStorage->openStorageElement( rStorageName,
325  nMode );
326  }
327  else
328  {
330  }
331  maCurContainerStorageName = rStorageName;
332  }
333 
334  return mxContainerStorage;
335 }
336 
338  const OUString& rContainerStorageName,
339  OUString& rObjName,
340  const SvGlobalName *, // pClassId, see "TODO/LATER" below
341  SvStream* pTemp )
342 {
343  uno::Reference < embed::XStorage > xDocStor( mpDocPersist->getStorage() );
344  uno::Reference < embed::XStorage > xCntnrStor( ImplGetContainerStorage( rContainerStorageName ) );
345 
346  if( !xCntnrStor.is() && !pTemp )
347  return;
348 
349  OUString aSrcObjName( rObjName );
351 
352  // Is the object name unique?
353  // if the object is already instantiated by GetEmbeddedObject
354  // that means that the duplication is being loaded
355  bool bDuplicate = rContainer.HasInstantiatedEmbeddedObject( rObjName );
356  DBG_ASSERT( !bDuplicate, "An object in the document is referenced twice!" );
357 
358  if( xDocStor != xCntnrStor || pTemp || bDuplicate )
359  {
360  // TODO/LATER: make this altogether a method in the EmbeddedObjectContainer
361 
362  // create a unique name for the duplicate object
363  if( bDuplicate )
364  rObjName = rContainer.CreateUniqueObjectName();
365 
366  if( pTemp )
367  {
368  try
369  {
370  pTemp->Seek( 0 );
371  uno::Reference < io::XStream > xStm = xDocStor->openStreamElement( rObjName,
372  embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
373  std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream( xStm ));
374  pTemp->ReadStream( *pStream );
375  pStream.reset();
376 
377  // TODO/LATER: what to do when other types of objects are based on substream persistence?
378  // This is an ole object
379  uno::Reference< beans::XPropertySet > xProps( xStm, uno::UNO_QUERY_THROW );
380  xProps->setPropertyValue(
381  "MediaType",
382  uno::makeAny( OUString( "application/vnd.sun.star.oleobject" ) ) );
383 
384  xStm->getOutputStream()->closeOutput();
385  }
386  catch ( uno::Exception& )
387  {
388  return;
389  }
390  }
391  else
392  {
393  try
394  {
395  xCntnrStor->copyElementTo( aSrcObjName, xDocStor, rObjName );
396  }
397  catch ( uno::Exception& )
398  {
399  return;
400  }
401  }
402  }
403 
404  // make object known to the container
405  // TODO/LATER: could be done a little bit more efficient!
406  OUString aName( rObjName );
407 
408  // TODO/LATER: The provided pClassId is ignored for now.
409  // The stream contains OLE storage internally and this storage already has a class id specifying the
410  // server that was used to create the object. pClassId could be used to specify the server that should
411  // be used for the next opening, but this information seems to be out of the file format responsibility
412  // area.
413  OUString const baseURL(mpDocPersist->getDocumentBaseURL());
414  rContainer.GetEmbeddedObject(aName, &baseURL);
415 }
416 
418  const OUString& rURLStr )
419 {
420  OUString sRetURL;
421 
422  OUString aContainerStorageName, aObjectStorageName;
423  if( !ImplGetStorageNames( rURLStr, aContainerStorageName,
424  aObjectStorageName,
426  return sRetURL;
427 
429  {
430  OutputStorageWrapper_Impl *pOut = nullptr;
431  std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> >::iterator aIter;
432 
433  if( mpStreamMap )
434  {
435  aIter = mpStreamMap->find( rURLStr );
436  if( aIter != mpStreamMap->end() && aIter->second.is() )
437  pOut = aIter->second.get();
438  }
439 
440  SvGlobalName aClassId, *pClassId = nullptr;
441  sal_Int32 nPos = aObjectStorageName.lastIndexOf( '!' );
442  if( -1 != nPos && aClassId.MakeId( aObjectStorageName.copy( nPos+1 ) ) )
443  {
444  aObjectStorageName = aObjectStorageName.copy( 0, nPos );
445  pClassId = &aClassId;
446  }
447 
448  ImplReadObject( aContainerStorageName, aObjectStorageName, pClassId, pOut ? pOut->GetStream() : nullptr );
449  sRetURL = XML_EMBEDDEDOBJECT_URL_BASE + aObjectStorageName;
450 
451  if( pOut )
452  {
453  mpStreamMap->erase( aIter );
454  }
455  }
456  else
457  {
458  // Objects are written using ::comphelper::IEmbeddedHelper::SaveAs
459  sRetURL = "./";
460  if( !aContainerStorageName.isEmpty() )
461  {
462  sRetURL += aContainerStorageName + "/";
463  }
464  sRetURL += aObjectStorageName;
465  }
466 
467  return sRetURL;
468 }
469 
470 uno::Reference< io::XInputStream > SvXMLEmbeddedObjectHelper::ImplGetReplacementImage(
471  const uno::Reference< embed::XEmbeddedObject >& xObj )
472 {
473  uno::Reference< io::XInputStream > xStream;
474 
475  if( xObj.is() )
476  {
477  try
478  {
479  bool bSwitchBackToLoaded = false;
480  sal_Int32 nCurState = xObj->getCurrentState();
481  if ( nCurState == embed::EmbedStates::LOADED || nCurState == embed::EmbedStates::RUNNING )
482  {
483  // means that the object is not active
484  // copy replacement image from old to new container
485  OUString aMediaType;
486  xStream = mpDocPersist->getEmbeddedObjectContainer().GetGraphicStream( xObj, &aMediaType );
487  }
488 
489  if ( !xStream.is() )
490  {
491  // the image must be regenerated
492  // TODO/LATER: another aspect could be used
493  if ( nCurState == embed::EmbedStates::LOADED )
494  bSwitchBackToLoaded = true;
495 
496  OUString aMediaType;
498  embed::Aspects::MSOLE_CONTENT,
499  xObj,
500  &aMediaType );
501  }
502 
503  if ( bSwitchBackToLoaded )
504  // switch back to loaded state; that way we have a minimum cache confusion
505  xObj->changeState( embed::EmbedStates::LOADED );
506  }
507  catch( uno::Exception& )
508  {}
509  }
510 
511  return xStream;
512 }
513 
515  const uno::Reference < embed::XStorage >& rRootStorage,
516  ::comphelper::IEmbeddedHelper& rPersist,
517  SvXMLEmbeddedObjectHelperMode eCreateMode )
518 {
519  mxRootStorage = rRootStorage;
520  mpDocPersist = &rPersist;
521  meCreateMode = eCreateMode;
522 }
523 
525  const uno::Reference < embed::XStorage >& rRootStorage,
526  ::comphelper::IEmbeddedHelper& rDocPersist,
527  SvXMLEmbeddedObjectHelperMode eCreateMode )
528 {
530 
531  pThis->Init( rRootStorage, rDocPersist, eCreateMode );
532 
533  return pThis;
534 }
535 
537  ::comphelper::IEmbeddedHelper& rDocPersist,
538  SvXMLEmbeddedObjectHelperMode eCreateMode )
539 {
541 
542  pThis->Init( nullptr, rDocPersist, eCreateMode );
543 
544  return pThis;
545 }
546 
547 OUString SAL_CALL SvXMLEmbeddedObjectHelper::resolveEmbeddedObjectURL(const OUString& rURL)
548 {
549  MutexGuard aGuard( maMutex );
550 
551  OUString sRet;
552  try
553  {
554  sRet = ImplInsertEmbeddedObjectURL(rURL);
555  }
556  catch (const RuntimeException&)
557  {
558  throw;
559  }
560  catch (const Exception&)
561  {
562  css::uno::Any anyEx = cppu::getCaughtException();
563  throw WrappedTargetRuntimeException(
564  "SvXMLEmbeddedObjectHelper::resolveEmbeddedObjectURL non-RuntimeException",
565  static_cast<uno::XWeak*>(this), anyEx);
566  }
567  return sRet;
568 }
569 
570 // XNameAccess: alien objects!
572  const OUString& rURLStr )
573 {
574  MutexGuard aGuard( maMutex );
575  Any aRet;
577  {
578  Reference < XOutputStream > xStrm;
579  if( mpStreamMap )
580  {
581  auto aIter = mpStreamMap->find( rURLStr );
582  if( aIter != mpStreamMap->end() && aIter->second.is() )
583  xStrm = aIter->second.get();
584  }
585  if( !xStrm.is() )
586  {
588  if( !mpStreamMap )
589  mpStreamMap.reset( new std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> > );
590  (*mpStreamMap)[rURLStr] = xOut;
591  xStrm = xOut.get();
592  }
593 
594  aRet <<= xStrm;
595  }
596  else
597  {
598  bool bGraphicRepl = false;
599  bool bOasisFormat = true;
601  OUString aContainerStorageName, aObjectStorageName;
602  if( ImplGetStorageNames( rURLStr, aContainerStorageName,
603  aObjectStorageName,
604  true,
605  &bGraphicRepl,
606  &bOasisFormat ) )
607  {
608  try
609  {
612 
613  Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( aObjectStorageName );
614  DBG_ASSERT( xObj.is(), "Didn't get object" );
615 
616  if( xObj.is() )
617  {
618  if( bGraphicRepl )
619  {
620  xStrm = ImplGetReplacementImage( xObj );
621  }
622  else
623  {
624  Reference < embed::XEmbedPersist > xPersist( xObj, UNO_QUERY );
625  if( xPersist.is() )
626  {
627  if( !mxTempStorage.is() )
628  mxTempStorage =
630  Sequence < beans::PropertyValue > aDummy( 0 ), aEmbDescr( 1 );
631  aEmbDescr[0].Name = "StoreVisualReplacement";
632  aEmbDescr[0].Value <<= !bOasisFormat;
633  if ( !bOasisFormat )
634  {
635  uno::Reference< io::XInputStream > xGrInStream = ImplGetReplacementImage( xObj );
636  if ( xGrInStream.is() )
637  {
638  aEmbDescr.realloc( 2 );
639  aEmbDescr[1].Name = "VisualReplacement";
640  aEmbDescr[1].Value <<= xGrInStream;
641  }
642  }
643 
644  xPersist->storeToEntry( mxTempStorage, aObjectStorageName,
645  aDummy, aEmbDescr );
646  Reference < io::XStream > xStream =
647  mxTempStorage->openStreamElement(
648  aObjectStorageName,
649  embed::ElementModes::READ);
650  if( xStream.is() )
651  xStrm = xStream->getInputStream();
652  }
653  }
654  }
655  }
656  catch ( uno::Exception& )
657  {
658  }
659  }
660 
661  aRet <<= xStrm;
662  }
663 
664  return aRet;
665 }
666 
668 {
669  return Sequence< OUString >(0);
670 }
671 
672 sal_Bool SAL_CALL SvXMLEmbeddedObjectHelper::hasByName( const OUString& rURLStr )
673 {
674  MutexGuard aGuard( maMutex );
676  {
677  return true;
678  }
679  else
680  {
681  OUString aContainerStorageName, aObjectStorageName;
682  if( !ImplGetStorageNames( rURLStr, aContainerStorageName,
683  aObjectStorageName,
684  true ) )
685  return false;
686 
688  return !aObjectStorageName.isEmpty() &&
689  rContainer.HasEmbeddedObject( aObjectStorageName );
690  }
691 }
692 
693 // XNameAccess
695 {
696  MutexGuard aGuard( maMutex );
699  else
701 }
702 
704 {
705  MutexGuard aGuard( maMutex );
707  {
708  return true;
709  }
710  else
711  {
713  return rContainer.HasEmbeddedObjects();
714  }
715 }
716 
717 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Type
const std::u16string_view gaReplacementGraphicsContainerStorageName(u""XML_CONTAINERSTORAGE_NAME)
SvStream & ReadStream(SvStream &rStream)
SVX_DLLPRIVATE css::uno::Reference< css::embed::XStorage > const & ImplGetContainerStorage(const OUString &rStorageName)
Definition: xmleohlp.cxx:301
#define XML_EMBEDDEDOBJECT_URL_BASE
Definition: xmleohlp.cxx:61
css::uno::Reference< css::embed::XStorage > mxContainerStorage
Definition: xmleohlp.hxx:56
static void splitObjectURL(const OUString &aURLNoPar, OUString &rContainerStorageName, OUString &rObjectStorageName)
Definition: xmleohlp.cxx:150
sal_Int32 GetVersion() const
virtual OUString getDocumentBaseURL() const =0
SvXMLEmbeddedObjectHelperMode
Definition: xmleohlp.hxx:35
sal_uInt64 Seek(sal_uInt64 nPos)
virtual void SAL_CALL disposing() override
Definition: xmleohlp.cxx:142
bool HasEmbeddedObject(const OUString &)
css::uno::Reference< css::embed::XStorage > mxTempStorage
Definition: xmleohlp.hxx:57
css::uno::Reference< css::io::XInputStream > GetGraphicStream(const css::uno::Reference< css::embed::XEmbeddedObject > &, OUString *pMediaType=nullptr)
virtual OUString SAL_CALL resolveEmbeddedObjectURL(const OUString &aURL) override
Definition: xmleohlp.cxx:547
Reference< XInputStream > xStream
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
::comphelper::IEmbeddedHelper * mpDocPersist
Definition: xmleohlp.hxx:55
Any SAL_CALL getCaughtException()
int nCount
virtual EmbeddedObjectContainer & getEmbeddedObjectContainer() const =0
oslFileHandle & pOut
std::unique_ptr< std::map< OUString, rtl::Reference< OutputStorageWrapper_Impl > > > mpStreamMap
Definition: xmleohlp.hxx:61
void Init(const css::uno::Reference< css::embed::XStorage > &,::comphelper::IEmbeddedHelper &rDocPersist, SvXMLEmbeddedObjectHelperMode eCreateMode)
Definition: xmleohlp.cxx:514
virtual void SAL_CALL flush() override
Definition: xmleohlp.cxx:107
OUString maCurContainerStorageName
Definition: xmleohlp.hxx:51
::osl::Mutex maMutex
virtual css::uno::Reference< css::embed::XStorage > getStorage() const =0
#define SOFFICE_FILEFORMAT_60
static css::uno::Reference< css::embed::XStorage > GetTemporaryStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
static css::uno::Reference< css::io::XInputStream > GetGraphicReplacementStream(sal_Int64 nViewAspect, const css::uno::Reference< css::embed::XEmbeddedObject > &, OUString *pMediaType)
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: xmleohlp.cxx:571
#define DBG_ASSERT(sCon, aError)
virtual css::uno::Type SAL_CALL getElementType() override
Definition: xmleohlp.cxx:694
static rtl::Reference< SvXMLEmbeddedObjectHelper > Create(const css::uno::Reference< css::embed::XStorage > &,::comphelper::IEmbeddedHelper &rDocPersist, SvXMLEmbeddedObjectHelperMode eCreateMode)
#define XML_CONTAINERSTORAGE_NAME_60
Definition: xmleohlp.cxx:59
unsigned char sal_Bool
const std::u16string_view gaReplacementGraphicsContainerStorageName60(u""XML_CONTAINERSTORAGE_NAME_60)
SVX_DLLPRIVATE css::uno::Reference< css::io::XInputStream > ImplGetReplacementImage(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj)
Definition: xmleohlp.cxx:470
SvStream * GetStream()
Definition: xmleohlp.cxx:93
css::uno::Type const & get()
bool HasInstantiatedEmbeddedObject(const OUString &)
SVX_DLLPRIVATE bool ImplGetStorageNames(const OUString &rURLStr, OUString &rContainerStorageName, OUString &rObjectStorageName, bool bInternalToExternal, bool *pGraphicRepl=nullptr, bool *pOasisFormat=nullptr) const
Definition: xmleohlp.cxx:192
Reference< XOutputStream > xOut
Definition: xmleohlp.cxx:68
css::uno::Reference< css::embed::XEmbeddedObject > GetEmbeddedObject(const OUString &, OUString const *pBaseURL=nullptr)
SvXMLEmbeddedObjectHelperMode meCreateMode
Definition: xmleohlp.hxx:59
#define XML_CONTAINERSTORAGE_NAME
Definition: xmleohlp.cxx:60
virtual sal_Bool SAL_CALL hasElements() override
Definition: xmleohlp.cxx:703
OUString aName
virtual ~SvXMLEmbeddedObjectHelper() override
Definition: xmleohlp.cxx:138
SVX_DLLPRIVATE OUString ImplInsertEmbeddedObjectURL(const OUString &rURLStr)
Definition: xmleohlp.cxx:417
sal_Int32 _nPos
virtual void SAL_CALL closeOutput() override
Definition: xmleohlp.cxx:113
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: xmleohlp.cxx:672
#define SAL_WARN(area, stream)
virtual void SAL_CALL writeBytes(const Sequence< sal_Int8 > &aData) override
Definition: xmleohlp.cxx:100
SVX_DLLPRIVATE void ImplReadObject(const OUString &rContainerStorageName, OUString &rObjName, const SvGlobalName *pClassId, SvStream *pTemp)
Definition: xmleohlp.cxx:337
#define XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE
Definition: xmleohlp.cxx:62
bool MakeId(const OUString &rId)
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: xmleohlp.cxx:667
css::uno::Reference< css::embed::XStorage > mxRootStorage
Definition: xmleohlp.hxx:54
sal_uInt16 nPos