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