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