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