LibreOffice Module svx (master) 1
xmlgrhlp.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#include <sal/config.h>
21#include <sal/log.hxx>
22
23#include <com/sun/star/embed/XTransactedObject.hpp>
24#include <com/sun/star/embed/ElementModes.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/io/NotConnectedException.hpp>
27#include <com/sun/star/lang/XServiceInfo.hpp>
28#include <com/sun/star/lang/XInitialization.hpp>
29#include <com/sun/star/lang/XMultiServiceFactory.hpp>
30#include <com/sun/star/util/XCancellable.hpp>
31#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp>
37
38#include <rtl/ref.hxx>
41#include <unotools/tempfile.hxx>
42#include <unotools/saveopt.hxx>
44#include <vcl/gfxlink.hxx>
45#include <vcl/metaact.hxx>
46#include <tools/zcodec.hxx>
48
49#include <vcl/GraphicObject.hxx>
50#include <vcl/graphicfilter.hxx>
51#include <svx/xmlgrhlp.hxx>
52#include <svx/xmleohlp.hxx>
53
54#include <algorithm>
55#include <memory>
56#include <string_view>
57#include <utility>
58
59using namespace com::sun::star;
60using namespace com::sun::star::uno;
61using namespace com::sun::star::io;
62
63namespace com::sun::star::uno { class XComponentContext; }
64
65constexpr OUStringLiteral XML_GRAPHICSTORAGE_NAME = u"Pictures";
66constexpr OUStringLiteral XML_GRAPHICOBJECT_URL_BASE = u"vnd.sun.star.GraphicObject:";
67
68namespace {
69
70const MetaCommentAction* ImplCheckForEPS( GDIMetaFile const & rMtf )
71{
72 const MetaCommentAction* pComment = nullptr;
73
74 if ( rMtf.GetActionSize() >= 2
75 && rMtf.GetAction(0)->GetType() == MetaActionType::EPS
76 && rMtf.GetAction(1)->GetType() == MetaActionType::COMMENT
77 && ( static_cast<const MetaCommentAction*>(rMtf.GetAction( 1 ))->GetComment() == "EPSReplacementGraphic" ) )
78 pComment = static_cast<const MetaCommentAction*>(rMtf.GetAction( 1 ));
79
80 return pComment;
81}
82
83class GraphicInputStream : public cppu::WeakImplHelper<XInputStream>
84{
85private:
86 virtual sal_Int32 SAL_CALL readBytes(Sequence<sal_Int8> & aData, sal_Int32 nBytesToRead) override;
87 virtual sal_Int32 SAL_CALL readSomeBytes(Sequence<sal_Int8> & aData, sal_Int32 nMaxBytesToRead) override;
88 virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override;
89 virtual sal_Int32 SAL_CALL available() override;
90 virtual void SAL_CALL closeInput() override;
91
92private:
93 utl::TempFileFast maTempFile;
94 Reference<XInputStream> mxStreamWrapper;
95
96public:
97
98 explicit GraphicInputStream(GraphicObject const & raGraphicObject, const OUString & rMimeType);
99 GraphicInputStream(const GraphicInputStream&) = delete;
100
101 GraphicInputStream& operator=(const GraphicInputStream&) = delete;
102
103 bool exists() const
104 {
105 return mxStreamWrapper.is();
106 }
107};
108
109
110GraphicInputStream::GraphicInputStream(GraphicObject const & aGraphicObject, const OUString & rMimeType)
111{
112 if (aGraphicObject.GetType() == GraphicType::NONE)
113 return;
114
115 SvStream* pStream = maTempFile.GetStream(StreamMode::READWRITE);
116
117 if (!pStream)
118 return;
119
120 const Graphic& aGraphic(aGraphicObject.GetGraphic());
121 const GfxLink aGfxLink(aGraphic.GetGfxLink());
122 bool bRet = false;
123
124 if (aGfxLink.GetDataSize() && aGfxLink.GetData())
125 {
126 if (rMimeType.isEmpty())
127 {
128 pStream->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize());
129 bRet = (pStream->GetError() == ERRCODE_NONE);
130 }
131 else
132 {
134 bRet = (rFilter.ExportGraphic(aGraphic, u"", *pStream, rFilter.GetExportFormatNumberForMediaType(rMimeType)) == ERRCODE_NONE);
135 }
136 }
137 else
138 {
139 if (aGraphic.GetType() == GraphicType::Bitmap)
140 {
142 OUString aFormat = rMimeType;
143
144 if (aGraphic.IsAnimated())
145 aFormat = "image/gif";
146 else if (aFormat.isEmpty())
147 aFormat = "image/png";
148
149 bRet = (rFilter.ExportGraphic(aGraphic, u"", *pStream, rFilter.GetExportFormatNumberForMediaType(aFormat)) == ERRCODE_NONE);
150 }
151 else if (rMimeType.isEmpty() && aGraphic.GetType() == GraphicType::GdiMetafile)
152 {
154 pStream->SetCompressMode(SvStreamCompressFlags::ZBITMAP);
155 SvmWriter aWriter(*pStream);
156 aWriter.Write(aGraphic.GetGDIMetaFile());
157 bRet = (pStream->GetError() == ERRCODE_NONE);
158 }
159 else if (!rMimeType.isEmpty())
160 {
162 bRet = ( rFilter.ExportGraphic( aGraphic, u"", *pStream, rFilter.GetExportFormatNumberForMediaType( rMimeType ) ) == ERRCODE_NONE );
163 }
164 }
165
166 if (bRet)
167 {
168 pStream->Seek( 0 );
169 mxStreamWrapper = new ::utl::OInputStreamWrapper(*pStream);
170 }
171}
172
173sal_Int32 SAL_CALL GraphicInputStream::readBytes(Sequence<sal_Int8> & rData, sal_Int32 nBytesToRead)
174{
175 if (!mxStreamWrapper.is())
176 throw NotConnectedException();
177
178 return mxStreamWrapper->readBytes(rData, nBytesToRead);
179}
180
181sal_Int32 SAL_CALL GraphicInputStream::readSomeBytes(Sequence<sal_Int8>& rData, sal_Int32 nMaxBytesToRead )
182{
183 if (!mxStreamWrapper.is())
184 throw NotConnectedException() ;
185
186 return mxStreamWrapper->readSomeBytes(rData, nMaxBytesToRead);
187}
188
189void SAL_CALL GraphicInputStream::skipBytes(sal_Int32 nBytesToSkip)
190{
191 if (!mxStreamWrapper.is())
192 throw NotConnectedException();
193
194 mxStreamWrapper->skipBytes(nBytesToSkip);
195}
196
197sal_Int32 SAL_CALL GraphicInputStream::available()
198{
199 if (!mxStreamWrapper.is())
200 throw NotConnectedException();
201
202 return mxStreamWrapper->available();
203}
204
205void SAL_CALL GraphicInputStream::closeInput()
206{
207 if (!mxStreamWrapper.is())
208 throw NotConnectedException();
209
210 mxStreamWrapper->closeInput();
211}
212
213class SvXMLGraphicOutputStream:
214 public cppu::WeakImplHelper<XOutputStream>
215{
216private:
217
218 // XOutputStream
219 virtual void SAL_CALL writeBytes( const Sequence< sal_Int8 >& rData ) override;
220 virtual void SAL_CALL flush() override;
221 virtual void SAL_CALL closeOutput() override;
222
223private:
224
225 std::optional<::utl::TempFileFast> moTmp;
226 SvStream* mpOStm;
227 Reference< XOutputStream > mxStmWrapper;
228 std::optional<GraphicObject> moGrfObj;
229 bool mbClosed;
230
231public:
232
233 SvXMLGraphicOutputStream();
234 virtual ~SvXMLGraphicOutputStream() override;
235 SvXMLGraphicOutputStream(const SvXMLGraphicOutputStream&) = delete;
236 SvXMLGraphicOutputStream& operator=(const SvXMLGraphicOutputStream&) = delete;
237
238 bool Exists() const { return mxStmWrapper.is(); }
239 const GraphicObject& GetGraphicObject();
240 Graphic GetGraphic();
241};
242
243SvXMLGraphicOutputStream::SvXMLGraphicOutputStream()
244 : moTmp(std::in_place)
245 , moGrfObj(std::in_place)
246 , mbClosed(false)
247{
248 mpOStm = moTmp->GetStream( StreamMode::READWRITE );
249
250 if( mpOStm )
251 mxStmWrapper = new ::utl::OOutputStreamWrapper( *mpOStm );
252}
253
254SvXMLGraphicOutputStream::~SvXMLGraphicOutputStream()
255{
256 moTmp.reset();
257}
258
259void SAL_CALL SvXMLGraphicOutputStream::writeBytes( const Sequence< sal_Int8 >& rData )
260{
261 if( !mxStmWrapper.is() )
262 throw NotConnectedException() ;
263
264 mxStmWrapper->writeBytes( rData );
265}
266
267void SAL_CALL SvXMLGraphicOutputStream::flush()
268{
269 if( !mxStmWrapper.is() )
270 throw NotConnectedException() ;
271
272 mxStmWrapper->flush();
273}
274
275void SAL_CALL SvXMLGraphicOutputStream::closeOutput()
276{
277 if( !mxStmWrapper.is() )
278 throw NotConnectedException() ;
279
280 mxStmWrapper->closeOutput();
281 mxStmWrapper.clear();
282
283 mbClosed = true;
284}
285
286Graphic SvXMLGraphicOutputStream::GetGraphic()
287{
288 Graphic aGraphic;
289
290 if (mbClosed && moGrfObj->GetType() == GraphicType::NONE && mpOStm)
291 {
292 mpOStm->Seek( 0 );
293 sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW;
294 sal_uInt16 nDeterminedFormat = GRFILTER_FORMAT_DONTKNOW;
295 GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, u"", *mpOStm ,nFormat,&nDeterminedFormat);
296
297 if (nDeterminedFormat == GRFILTER_FORMAT_DONTKNOW)
298 {
299 //Read the first two byte to check whether it is a gzipped stream, is so it may be in wmz or emz format
300 //unzip them and try again
301
302 sal_uInt8 sFirstBytes[ 2 ];
303
304 sal_uInt64 nStreamLen = mpOStm->TellEnd();
305 mpOStm->Seek( 0 );
306
307 if ( nStreamLen == 0 )
308 {
309 SvLockBytes* pLockBytes = mpOStm->GetLockBytes();
310 if ( pLockBytes )
311 pLockBytes->SetSynchronMode();
312
313 nStreamLen = mpOStm->TellEnd();
314 mpOStm->Seek( 0 );
315 }
316 if( nStreamLen >= 2 )
317 {
318 //read two byte
319 mpOStm->ReadBytes(sFirstBytes, 2);
320
321 if( sFirstBytes[0] == 0x1f && sFirstBytes[1] == 0x8b )
322 {
323 SvMemoryStream aDest;
324 ZCodec aZCodec( 0x8000, 0x8000 );
325 aZCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true);
326 mpOStm->Seek( 0 );
327 aZCodec.Decompress( *mpOStm, aDest );
328
329 if (aZCodec.EndCompression())
330 {
331 sal_uInt64 nStreamLen_ = aDest.TellEnd();
332 if (nStreamLen_ > 0)
333 {
334 aDest.Seek(0);
335 GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, u"", aDest ,nFormat,&nDeterminedFormat );
336 }
337 }
338 }
339 }
340 }
341 }
342
343 if (aGraphic.GetType() != GraphicType::NONE)
344 {
345 mpOStm = nullptr;
346 moTmp.reset();
347 }
348 return aGraphic;
349}
350
351const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
352{
353 Graphic aGraphic(GetGraphic());
354 if (aGraphic.GetType() != GraphicType::NONE)
355 {
356 moGrfObj.emplace(std::move(aGraphic));
357 }
358 return *moGrfObj;
359}
360
361}
362
364{
365 Init( nullptr, eCreateMode );
366}
367
369 : meCreateMode(SvXMLGraphicHelperMode::Read)
370{
371}
372
374{
375}
376
377bool SvXMLGraphicHelper::ImplGetStreamNames( const OUString& rURLStr,
378 OUString& rPictureStorageName,
379 OUString& rPictureStreamName )
380{
381 if (rURLStr.isEmpty())
382 return false;
383
384 const OUString aURLStr {rURLStr.copy(rURLStr.lastIndexOf(':')+1)};
385
386 if( !aURLStr.isEmpty() && aURLStr.indexOf('/')<0 ) // just one token?
387 {
388 rPictureStorageName = OUString();
389 rPictureStreamName = aURLStr;
390 }
391 else
392 SvXMLEmbeddedObjectHelper::splitObjectURL(aURLStr, rPictureStorageName, rPictureStreamName);
393
394 SAL_WARN_IF(rPictureStreamName.isEmpty(), "svx", "SvXMLGraphicHelper::ImplInsertGraphicURL: invalid scheme: " << rURLStr);
395
396 return !rPictureStreamName.isEmpty();
397}
398
399uno::Reference < embed::XStorage > SvXMLGraphicHelper::ImplGetGraphicStorage( const OUString& rStorageName )
400{
401 uno::Reference < embed::XStorage > xRetStorage;
402 if( mxRootStorage.is() )
403 {
404 try
405 {
406 maCurStorageName = rStorageName;
407 xRetStorage = mxRootStorage->openStorageElement(
410 ? embed::ElementModes::READWRITE
411 : embed::ElementModes::READ );
412 }
413 catch ( uno::Exception& )
414 {
415 }
416 //#i43196# try again to open the storage element - this time readonly
417 if(!xRetStorage.is())
418 {
419 try
420 {
421 maCurStorageName = rStorageName;
422 xRetStorage = mxRootStorage->openStorageElement( maCurStorageName, embed::ElementModes::READ );
423 }
424 catch ( uno::Exception& )
425 {
426 }
427 }
428 }
429
430 return xRetStorage;
431}
432
434 const OUString& rPictureStreamName )
435{
437 if (!rPictureStorageName.isEmpty())
438 aRet.xStorage = ImplGetGraphicStorage(rPictureStorageName);
439 else
440 aRet.xStorage = mxRootStorage;
441
442 sal_Int32 nMode = embed::ElementModes::READ;
444 {
445 nMode = embed::ElementModes::READWRITE;
446 }
447
448 if (aRet.xStorage.is())
449 {
450 aRet.xStream = aRet.xStorage->openStreamElement( rPictureStreamName, nMode );
451 }
452 else if (rPictureStorageName.indexOf('/') != -1)
453 {
454 uno::Reference<embed::XHierarchicalStorageAccess> xHierRootStorage(mxRootStorage,
455 uno::UNO_QUERY);
456 if (xHierRootStorage.is())
457 {
458 try
459 {
460 aRet.xStream = xHierRootStorage->openStreamElementByHierarchicalName(
461 rPictureStorageName + "/" + rPictureStreamName, nMode);
462 aRet.xStorage = mxRootStorage;
463 }
464 catch (const uno::Exception&)
465 {
467 "SvXMLGraphicHelper::ImplGetGraphicStream: failed to open "
468 << rPictureStreamName);
469 }
470 }
471 }
472
474 {
475 uno::Reference<beans::XPropertySet> xProps(aRet.xStream, uno::UNO_QUERY);
476 xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any(true));
477 }
478
479 return aRet;
480}
481
482OUString SvXMLGraphicHelper::ImplGetGraphicMimeType( std::u16string_view rFileName )
483{
484 if( ( rFileName.size() >= 4 ) && ( rFileName[ rFileName.size() - 4 ] == '.' ) )
485 {
486 const OString aExt(OUStringToOString(rFileName.substr(rFileName.size() - 3),
487 RTL_TEXTENCODING_ASCII_US));
489 }
490
491 return OUString();
492}
493
494Graphic SvXMLGraphicHelper::ImplReadGraphic( const OUString& rPictureStorageName,
495 const OUString& rPictureStreamName )
496{
497 Graphic aReturnGraphic;
498 SvxGraphicHelperStream_Impl aStream( ImplGetGraphicStream( rPictureStorageName, rPictureStreamName ) );
499 if (aStream.xStream.is())
500 {
502 std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(aStream.xStream));
503 Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(*pStream);
504 if (!aGraphic.IsNone())
505 aReturnGraphic = aGraphic;
506 else
507 rGraphicFilter.ImportGraphic(aReturnGraphic, u"", *pStream);
508 }
509
510 return aReturnGraphic;
511}
512
513void SvXMLGraphicHelper::Init( const uno::Reference < embed::XStorage >& rXMLStorage,
514 SvXMLGraphicHelperMode eCreateMode,
515 const OUString& rGraphicMimeType )
516{
517 mxRootStorage = rXMLStorage;
518 meCreateMode = eCreateMode;
519 maOutputMimeType = rGraphicMimeType;
520}
521
522rtl::Reference<SvXMLGraphicHelper> SvXMLGraphicHelper::Create( const uno::Reference < embed::XStorage >& rXMLStorage,
523 SvXMLGraphicHelperMode eCreateMode )
524{
526 pThis->Init( rXMLStorage, eCreateMode, OUString() );
527
528 return pThis;
529}
530
532 const OUString& rGraphicMimeType )
533{
535
536 pThis->Init( nullptr, eCreateMode, rGraphicMimeType );
537
538 return pThis;
539}
540
541namespace
542{
543
544void splitUserDataFromURL(OUString const & rWholeURL, OUString & rJustURL, OUString & rUserData)
545{
546 sal_Int32 nUser = rWholeURL.indexOf('?');
547 if (nUser >= 0)
548 {
549 rJustURL = rWholeURL.copy(0, nUser);
550 nUser++;
551 rUserData = rWholeURL.copy(nUser);
552 }
553 else
554 {
555 rJustURL = rWholeURL;
556 }
557}
558
559} // end anonymous namespace
560
561// XGraphicObjectResolver
562OUString SAL_CALL SvXMLGraphicHelper::resolveGraphicObjectURL( const OUString& /*rURL*/ )
563{
564 throw uno::RuntimeException("XGraphicObjectResolver has been removed in LibreOffice 6.1");
565}
566
567// XGraphicStorageHandler
568uno::Reference<graphic::XGraphic> SAL_CALL SvXMLGraphicHelper::loadGraphic(OUString const & rURL)
569{
570 std::unique_lock aGuard(m_aMutex);
571
572 uno::Reference<graphic::XGraphic> xGraphic;
573
574 OUString aURLOnly;
575 OUString aUserData;
576 splitUserDataFromURL(rURL, aURLOnly, aUserData);
577
578 auto aIterator = maGraphicObjects.find(aURLOnly);
579 if (aIterator != maGraphicObjects.end())
580 {
581 return aIterator->second;
582 }
583
584 OUString aPictureStorageName, aPictureStreamName;
585
586 if (ImplGetStreamNames(aURLOnly, aPictureStorageName, aPictureStreamName))
587 {
588 const GraphicObject aGraphicObject(ImplReadGraphic(aPictureStorageName, aPictureStreamName));
589
590 if (aGraphicObject.GetType() != GraphicType::NONE)
591 {
592 xGraphic = aGraphicObject.GetGraphic().GetXGraphic();
593 maGraphicObjects[aURLOnly] = xGraphic;
594 }
595 }
596
597 return xGraphic;
598}
599
600uno::Reference<graphic::XGraphic> SAL_CALL SvXMLGraphicHelper::loadGraphicFromOutputStream(uno::Reference<io::XOutputStream> const & rxOutputStream)
601{
602 std::unique_lock aGuard(m_aMutex);
603
604 uno::Reference<graphic::XGraphic> xGraphic;
605
606 if ((SvXMLGraphicHelperMode::Read == meCreateMode) && rxOutputStream.is())
607 {
608
609 SvXMLGraphicOutputStream* pGraphicOutputStream = static_cast<SvXMLGraphicOutputStream*>(rxOutputStream.get());
610 if (pGraphicOutputStream)
611 {
612 xGraphic = pGraphicOutputStream->GetGraphic().GetXGraphic();
613 }
614 }
615 return xGraphic;
616}
617
618OUString SAL_CALL SvXMLGraphicHelper::saveGraphicByName(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
619 OUString & rOutSavedMimeType, OUString const & rRequestName)
620{
621 return implSaveGraphic(rxGraphic, rOutSavedMimeType, rRequestName);
622}
623
624OUString SAL_CALL SvXMLGraphicHelper::saveGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic)
625{
626 OUString aOutMimeType;
627 return implSaveGraphic(rxGraphic, aOutMimeType, std::u16string_view());
628}
629
630OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
631 OUString & rOutSavedMimeType, std::u16string_view rRequestName)
632{
633 Graphic aGraphic(rxGraphic);
634
635 auto aIterator = maExportGraphics.find(aGraphic);
636 if (aIterator != maExportGraphics.end())
637 {
638 auto const & aURLAndMimePair = aIterator->second;
639 rOutSavedMimeType = aURLAndMimePair.second;
640 return aURLAndMimePair.first;
641 }
642
643 GraphicObject aGraphicObject(aGraphic);
644
645 if (aGraphicObject.GetType() != GraphicType::NONE)
646 {
647 const GfxLink aGfxLink(aGraphic.GetGfxLink());
648 OUString aExtension;
649 bool bUseGfxLink = true;
650
651 if (aGfxLink.GetDataSize())
652 {
653 switch (aGfxLink.GetType())
654 {
655 case GfxLinkType::EpsBuffer: aExtension = ".eps"; break;
656 case GfxLinkType::NativeGif: aExtension = ".gif"; break;
657 // #i15508# added BMP type for better exports (checked, works)
658 case GfxLinkType::NativeBmp: aExtension = ".bmp"; break;
659 case GfxLinkType::NativeJpg: aExtension = ".jpg"; break;
660 case GfxLinkType::NativePng: aExtension = ".png"; break;
661 case GfxLinkType::NativeTif: aExtension = ".tif"; break;
662 case GfxLinkType::NativeWmf:
663 if (aGfxLink.IsEMF())
664 aExtension = ".emf";
665 else
666 aExtension = ".wmf";
667 break;
668 case GfxLinkType::NativeMet: aExtension = ".met"; break;
669 case GfxLinkType::NativePct: aExtension = ".pct"; break;
670 case GfxLinkType::NativeSvg:
671 {
672 // backward-compat kludge: since no released OOo
673 // version to date can handle svg properly, wrap it up
674 // into an svm. slight catch22 here, since strict ODF
675 // conformance _recommends_ svg - then again, most old
676 // ODF consumers are believed to be OOo
677 auto nSaneVersion = GetODFSaneDefaultVersion();
678 if ( nSaneVersion < SvtSaveOptions::ODFSVER_012
680 {
681 bUseGfxLink = false;
682 aExtension = ".svm";
683 }
684 else
685 {
686 aExtension = ".svg";
687 }
688 break;
689 }
690 case GfxLinkType::NativePdf: aExtension = ".pdf"; break;
691 case GfxLinkType::NativeWebp: aExtension = ".webp"; break;
692
693 default:
694 aExtension = ".grf";
695 break;
696 }
697 }
698 else
699 {
700 if (aGraphicObject.GetType() == GraphicType::Bitmap)
701 {
702 if (aGraphicObject.IsAnimated())
703 aExtension = ".gif";
704 else
705 aExtension = ".png";
706 }
707 else if (aGraphicObject.GetType() == GraphicType::GdiMetafile)
708 {
709 // SJ: first check if this metafile is just an eps file, then we will store the eps instead of svm
710 GDIMetaFile& rMetafile(const_cast<GDIMetaFile&>(aGraphic.GetGDIMetaFile()));
711
712 if (ImplCheckForEPS(rMetafile))
713 aExtension = ".eps";
714 else
715 aExtension = ".svm";
716 }
717 }
718
719 OUString rPictureStreamName;
720 if (!rRequestName.empty())
721 {
722 rPictureStreamName = rRequestName + aExtension;
723 }
724 else
725 {
726 OUString sId = OStringToOUString(aGraphicObject.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
727 rPictureStreamName = sId + aExtension;
728 }
729
731
732 if (aStream.xStream.is())
733 {
734 const OUString aMimeType(ImplGetGraphicMimeType(rPictureStreamName));
735 uno::Reference<beans::XPropertySet> xProps(aStream.xStream, uno::UNO_QUERY);
736
737 // set stream properties (MediaType/Compression)
738 if (!aMimeType.isEmpty())
739 {
740 xProps->setPropertyValue("MediaType", uno::Any(aMimeType));
741 }
742
743 // picture formats that actually _do_ benefit from zip
744 // storage compression
745 // .svm pics gets compressed via ZBITMAP old-style stream
746 // option below
747 static const char* aCompressiblePics[] =
748 {
749 "image/svg+xml",
750 "image/x-emf",
751 "image/x-wmf",
752 "image/tiff",
753 "image/x-eps",
754 "image/bmp",
755 "image/x-pict"
756 };
757
758 bool bSuccess = false;
759
760 bool bCompressed = aMimeType.isEmpty();
761 if( !bCompressed )
762 {
763 for(const char* p : aCompressiblePics)
764 {
765 if( aMimeType.equalsIgnoreAsciiCaseAscii(p) )
766 {
767 bCompressed = true;
768 break;
769 }
770 }
771 }
772
773 xProps->setPropertyValue("Compressed", Any(bCompressed));
774
775 std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(aStream.xStream));
776 if (bUseGfxLink && aGfxLink.GetDataSize() && aGfxLink.GetData())
777 {
778 pStream->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize());
779 rOutSavedMimeType = aMimeType;
780 bSuccess = (pStream->GetError() == ERRCODE_NONE);
781 }
782 else
783 {
784 if (aGraphic.GetType() == GraphicType::Bitmap)
785 {
787 OUString aFormat;
788
789 if (aGraphic.IsAnimated())
790 {
791 aFormat = "gif";
792 }
793 else
794 {
795 aFormat = "png";
796 }
797 rOutSavedMimeType = comphelper::GraphicMimeTypeHelper::GetMimeTypeForExtension(aFormat.toUtf8());
798
799 bSuccess = (rFilter.ExportGraphic(aGraphic, u"", *pStream, rFilter.GetExportFormatNumberForShortName(aFormat)) == ERRCODE_NONE);
800 }
801 else if (aGraphic.GetType() == GraphicType::GdiMetafile)
802 {
803 pStream->SetVersion(SOFFICE_FILEFORMAT_8);
804 pStream->SetCompressMode(SvStreamCompressFlags::ZBITMAP);
806
807 // SJ: first check if this metafile is just an eps file, then we will store the eps instead of svm
808 GDIMetaFile& rMtf(const_cast<GDIMetaFile&>(aGraphic.GetGDIMetaFile()));
809 const MetaCommentAction* pComment = ImplCheckForEPS(rMtf);
810 if (pComment)
811 {
812 sal_uInt32 nSize = pComment->GetDataSize();
813 const sal_uInt8* pData = pComment->GetData();
814 if (nSize && pData)
815 pStream->WriteBytes(pData, nSize);
816
817 const MetaEPSAction* pAct = static_cast<const MetaEPSAction*>(rMtf.FirstAction());
818 const GfxLink& rLink = pAct->GetLink();
819
820 pStream->WriteBytes(rLink.GetData(), rLink.GetDataSize());
821 }
822 else
823 {
824 SvmWriter aWriter(*pStream);
825 aWriter.Write(rMtf);
826 }
827
828 bSuccess = (pStream->GetError() == ERRCODE_NONE);
829 }
830 }
831
832 if (!bSuccess)
833 return OUString();
834
835 uno::Reference<embed::XTransactedObject> xStorage(aStream.xStorage, uno::UNO_QUERY);
836 pStream.reset();
837 aStream.xStream->getOutputStream()->closeOutput();
838 if (xStorage.is())
839 xStorage->commit();
840
841 OUString aStoragePath = "Pictures/" + rPictureStreamName;
842
843 // put into cache
844 maExportGraphics[aGraphic] = std::make_pair(aStoragePath, rOutSavedMimeType);
845
846 return aStoragePath;
847 }
848 }
849
850 return OUString();
851}
852
853uno::Reference<io::XInputStream> SAL_CALL SvXMLGraphicHelper::createInputStream(uno::Reference<graphic::XGraphic> const & rxGraphic)
854{
855 Reference<XInputStream> xInputStream;
856
857 GraphicObject aGraphicObject((Graphic(rxGraphic)));
858
860 {
862 rtl::Reference<GraphicInputStream> pInputStream(new GraphicInputStream(aGraphicObject, sMimeType));
863
864 // We release the pointer from unique_ptr and assign it to the input stream return type.
865 // In case the stream doesn't exists, unique_ptr will delete the pointer when we go out of scope.
866 if (pInputStream->exists())
867 xInputStream = pInputStream.get();
868 }
869
870 return xInputStream;
871}
872
873// XBinaryStreamResolver
875{
877 return xRet;
878}
879
881{
883
885 {
886 rtl::Reference<SvXMLGraphicOutputStream> pOutputStream(new SvXMLGraphicOutputStream);
887
888 if( pOutputStream->Exists() )
889 {
890 xRet = pOutputStream.get();
891 maGrfStms.push_back( xRet );
892 }
893 }
894
895 return xRet;
896}
897
899{
900 OUString aRet;
901
902 if( ( SvXMLGraphicHelperMode::Read == meCreateMode ) && rxBinaryStream.is() )
903 {
904 if( ::std::find( maGrfStms.begin(), maGrfStms.end(), rxBinaryStream ) != maGrfStms.end() )
905 {
906 SvXMLGraphicOutputStream* pOStm = static_cast< SvXMLGraphicOutputStream* >( rxBinaryStream.get() );
907
908 if( pOStm )
909 {
910 const GraphicObject& rGrfObj = pOStm->GetGraphicObject();
911 const OUString aId(OStringToOUString(
912 rGrfObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US));
913
914 if( !aId.isEmpty() )
915 {
916 aRet = XML_GRAPHICOBJECT_URL_BASE + aId;
917 }
918 }
919 }
920 }
921
922 return aRet;
923}
924
925// for instantiation via service manager
926namespace {
927
928namespace impl
929{
930typedef comphelper::WeakComponentImplHelper<lang::XInitialization,
931 document::XGraphicObjectResolver,
932 document::XGraphicStorageHandler,
933 document::XBinaryStreamResolver,
934 lang::XServiceInfo>
935 SvXMLGraphicImportExportHelper_Base;
936
937} // namespace impl
938
939class SvXMLGraphicImportExportHelper :
940 public impl::SvXMLGraphicImportExportHelper_Base
941{
942public:
943 explicit SvXMLGraphicImportExportHelper( SvXMLGraphicHelperMode eMode );
944
945protected:
946 // is called from WeakComponentImplHelper when XComponent::dispose() was
947 // called from outside
948 virtual void disposing(std::unique_lock<std::mutex>&) override;
949
950 // ____ XInitialization ____
951 // one argument is allowed, which is the XStorage
952 virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override;
953
954 // ____ XGraphicObjectResolver ____
955 virtual OUString SAL_CALL resolveGraphicObjectURL( const OUString& aURL ) override;
956
957 // ____ XGraphicStorageHandler ____
958 virtual css::uno::Reference<css::graphic::XGraphic> SAL_CALL
959 loadGraphic(const OUString& aURL) override;
960
961 virtual css::uno::Reference<css::graphic::XGraphic> SAL_CALL
962 loadGraphicFromOutputStream(css::uno::Reference<css::io::XOutputStream> const & rxOutputStream) override;
963
964 virtual OUString SAL_CALL
965 saveGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic) override;
966
967 virtual OUString SAL_CALL
968 saveGraphicByName(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic, OUString & rOutSavedMimeType, OUString const & rRequestName) override;
969
970 virtual css::uno::Reference<css::io::XInputStream> SAL_CALL
971 createInputStream(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic) override;
972
973 // ____ XBinaryStreamResolver ____
974 virtual Reference< io::XInputStream > SAL_CALL getInputStream( const OUString& aURL ) override;
975 virtual Reference< io::XOutputStream > SAL_CALL createOutputStream() override;
976 virtual OUString SAL_CALL resolveOutputStream( const Reference< io::XOutputStream >& aBinaryStream ) override;
977
978 // ____ XServiceInfo ____
979 virtual OUString SAL_CALL getImplementationName() override;
980 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
981 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
982
983private:
984 SvXMLGraphicHelperMode m_eGraphicHelperMode;
985 rtl::Reference<SvXMLGraphicHelper> m_xXMLGraphicHelper;
986};
987
988SvXMLGraphicImportExportHelper::SvXMLGraphicImportExportHelper( SvXMLGraphicHelperMode eMode ) :
989 m_eGraphicHelperMode( eMode )
990{}
991
992void SvXMLGraphicImportExportHelper::disposing(std::unique_lock<std::mutex>&)
993{
994 if (m_xXMLGraphicHelper)
995 {
996 m_xXMLGraphicHelper->dispose();
997 m_xXMLGraphicHelper.clear();
998 }
999}
1000
1001// ____ XInitialization ____
1002void SAL_CALL SvXMLGraphicImportExportHelper::initialize(
1003 const Sequence< Any >& aArguments )
1004{
1006 if( aArguments.hasElements() )
1007 aArguments[0] >>= xStorage;
1008
1009 m_xXMLGraphicHelper = SvXMLGraphicHelper::Create( xStorage, m_eGraphicHelperMode );
1010}
1011
1012// ____ XGraphicObjectResolver ____
1013OUString SAL_CALL SvXMLGraphicImportExportHelper::resolveGraphicObjectURL( const OUString& aURL )
1014{
1015 return m_xXMLGraphicHelper->resolveGraphicObjectURL( aURL );
1016}
1017
1018// ____ XGraphicStorageHandler ____
1019uno::Reference<graphic::XGraphic> SAL_CALL SvXMLGraphicImportExportHelper::loadGraphic(OUString const & rURL)
1020{
1021 return m_xXMLGraphicHelper->loadGraphic(rURL);
1022}
1023
1024uno::Reference<graphic::XGraphic> SAL_CALL SvXMLGraphicImportExportHelper::loadGraphicFromOutputStream(uno::Reference<io::XOutputStream> const & rxOutputStream)
1025{
1026 return m_xXMLGraphicHelper->loadGraphicFromOutputStream(rxOutputStream);
1027}
1028
1029OUString SAL_CALL SvXMLGraphicImportExportHelper::saveGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic)
1030{
1031 return m_xXMLGraphicHelper->saveGraphic(rxGraphic);
1032}
1033
1034OUString SAL_CALL SvXMLGraphicImportExportHelper::saveGraphicByName(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
1035 OUString & rOutSavedMimeType, OUString const & rRequestName)
1036{
1037 return m_xXMLGraphicHelper->saveGraphicByName(rxGraphic, rOutSavedMimeType, rRequestName);
1038}
1039
1040uno::Reference<io::XInputStream> SAL_CALL SvXMLGraphicImportExportHelper::createInputStream(uno::Reference<graphic::XGraphic> const & rxGraphic)
1041{
1042 return m_xXMLGraphicHelper->createInputStream(rxGraphic);
1043}
1044
1045// ____ XBinaryStreamResolver ____
1046Reference< io::XInputStream > SAL_CALL SvXMLGraphicImportExportHelper::getInputStream( const OUString& aURL )
1047{
1048 return m_xXMLGraphicHelper->getInputStream( aURL );
1049}
1050Reference< io::XOutputStream > SAL_CALL SvXMLGraphicImportExportHelper::createOutputStream()
1051{
1052 return m_xXMLGraphicHelper->createOutputStream();
1053}
1054OUString SAL_CALL SvXMLGraphicImportExportHelper::resolveOutputStream( const Reference< io::XOutputStream >& aBinaryStream )
1055{
1056 return m_xXMLGraphicHelper->resolveOutputStream( aBinaryStream );
1057}
1058
1059// ____ XServiceInfo ____
1060OUString SAL_CALL SvXMLGraphicImportExportHelper::getImplementationName()
1061{
1062 if( m_eGraphicHelperMode == SvXMLGraphicHelperMode::Read )
1063 return "com.sun.star.comp.Svx.GraphicImportHelper";
1064 return "com.sun.star.comp.Svx.GraphicExportHelper";
1065}
1066
1067sal_Bool SAL_CALL SvXMLGraphicImportExportHelper::supportsService( const OUString& ServiceName )
1068{
1069 return cppu::supportsService(this, ServiceName);
1070}
1071
1072Sequence< OUString > SAL_CALL SvXMLGraphicImportExportHelper::getSupportedServiceNames()
1073{
1074 return { "com.sun.star.document.GraphicObjectResolver",
1075 "com.sun.star.document.GraphicStorageHandler",
1076 "com.sun.star.document.BinaryStreamResolver" };
1077}
1078
1079}
1080
1092extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
1094 css::uno::XComponentContext *,
1095 css::uno::Sequence<css::uno::Any> const &)
1096{
1097 return cppu::acquire(new SvXMLGraphicImportExportHelper(SvXMLGraphicHelperMode::Read));
1098}
1099
1112extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
1114 css::uno::XComponentContext *,
1115 css::uno::Sequence<css::uno::Any> const &)
1116{
1117 return cppu::acquire(new SvXMLGraphicImportExportHelper(SvXMLGraphicHelperMode::Write));
1118}
1119
1120namespace svx {
1121
1122 void DropUnusedNamedItems(css::uno::Reference<css::uno::XInterface> const& xModel)
1123 {
1124 uno::Reference<lang::XMultiServiceFactory> const xModelFactory(xModel, uno::UNO_QUERY);
1125 assert(xModelFactory.is());
1126 try
1127 {
1128 uno::Reference<util::XCancellable> const xGradient(
1129 xModelFactory->createInstance("com.sun.star.drawing.GradientTable"),
1130 uno::UNO_QUERY );
1131 if (xGradient.is())
1132 {
1133 xGradient->cancel();
1134 }
1135
1136 uno::Reference<util::XCancellable> const xHatch(
1137 xModelFactory->createInstance("com.sun.star.drawing.HatchTable"),
1138 uno::UNO_QUERY );
1139 if (xHatch.is())
1140 {
1141 xHatch->cancel();
1142 }
1143
1144 uno::Reference<util::XCancellable> const xBitmap(
1145 xModelFactory->createInstance("com.sun.star.drawing.BitmapTable"),
1146 uno::UNO_QUERY );
1147 if (xBitmap.is())
1148 {
1149 xBitmap->cancel();
1150 }
1151
1152 uno::Reference<util::XCancellable> const xTransGradient(
1153 xModelFactory->createInstance("com.sun.star.drawing.TransparencyGradientTable"),
1154 uno::UNO_QUERY );
1155 if (xTransGradient.is())
1156 {
1157 xTransGradient->cancel();
1158 }
1159
1160 uno::Reference<util::XCancellable> const xMarker(
1161 xModelFactory->createInstance("com.sun.star.drawing.MarkerTable"),
1162 uno::UNO_QUERY );
1163 if (xMarker.is())
1164 {
1165 xMarker->cancel();
1166 }
1167
1168 uno::Reference<util::XCancellable> const xDashes(
1169 xModelFactory->createInstance("com.sun.star.drawing.DashTable"),
1170 uno::UNO_QUERY );
1171 if (xDashes.is())
1172 {
1173 xDashes->cancel();
1174 }
1175 }
1176 catch (const Exception&)
1177 {
1178 TOOLS_WARN_EXCEPTION("svx", "dropUnusedNamedItems(): exception during clearing of unused named items");
1179 }
1180 }
1181
1182} // namespace svx
1183
1184/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
size_t GetActionSize() const
MetaAction * GetAction(size_t nAction) const
MetaAction * FirstAction()
sal_uInt16 GetExportFormatNumberForShortName(std::u16string_view rShortName)
Graphic ImportUnloadedGraphic(SvStream &rIStream, sal_uInt64 sizeLimit=0, const Size *pSizeHint=nullptr)
static GraphicFilter & GetGraphicFilter()
sal_uInt16 GetExportFormatNumberForMediaType(std::u16string_view rShortName)
ErrCode ExportGraphic(const Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
ErrCode ImportGraphic(Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat=GRFILTER_FORMAT_DONTKNOW, sal_uInt16 *pDeterminedFormat=nullptr, GraphicFilterImportFlags nImportFlags=GraphicFilterImportFlags::NONE)
const Graphic & GetGraphic() const
GraphicType GetType() const
bool IsAnimated() const
OString GetUniqueID() const
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
const GDIMetaFile & GetGDIMetaFile() const
GraphicType GetType() const
GfxLink GetGfxLink() const
bool IsAnimated() const
bool IsNone() const
MetaActionType GetType() const
const sal_uInt8 * GetData() const
const OString & GetComment() const
sal_uInt32 GetDataSize() const
const GfxLink & GetLink() const
void SetSynchronMode(bool bTheSync=true)
virtual sal_uInt64 TellEnd() override
void SetCompressMode(SvStreamCompressFlags nNewMode)
std::size_t WriteBytes(const void *pData, std::size_t nSize)
void SetVersion(sal_Int32 n)
sal_uInt64 Seek(sal_uInt64 nPos)
ErrCode GetError() const
static void splitObjectURL(const OUString &aURLNoPar, OUString &rContainerStorageName, OUString &rObjectStorageName)
Definition: xmleohlp.cxx:147
virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL loadGraphicFromOutputStream(css::uno::Reference< css::io::XOutputStream > const &rxOutputStream) override
Definition: xmlgrhlp.cxx:600
static SVX_DLLPRIVATE OUString ImplGetGraphicMimeType(std::u16string_view rFileName)
Definition: xmlgrhlp.cxx:482
virtual OUString SAL_CALL saveGraphicByName(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutSavedMimeType, OUString const &rRequestName) override
Definition: xmlgrhlp.cxx:618
std::unordered_map< OUString, css::uno::Reference< css::graphic::XGraphic > > maGraphicObjects
Definition: xmlgrhlp.hxx:59
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL createInputStream(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic) override
Definition: xmlgrhlp.cxx:853
SvXMLGraphicHelperMode meCreateMode
Definition: xmlgrhlp.hxx:62
static SVX_DLLPRIVATE bool ImplGetStreamNames(const OUString &rURLStr, OUString &rPictureStorageName, OUString &rPictureStreamName)
Definition: xmlgrhlp.cxx:377
virtual OUString SAL_CALL resolveOutputStream(const css::uno::Reference< css::io::XOutputStream > &rxBinaryStream) override
Definition: xmlgrhlp.cxx:898
SVX_DLLPRIVATE OUString implSaveGraphic(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType, std::u16string_view rRequestName)
Definition: xmlgrhlp.cxx:630
OUString maCurStorageName
Definition: xmlgrhlp.hxx:55
OUString maOutputMimeType
Definition: xmlgrhlp.hxx:63
void Init(const css::uno::Reference< css::embed::XStorage > &xXMLStorage, SvXMLGraphicHelperMode eCreateMode, const OUString &rGraphicMimeType=OUString())
Definition: xmlgrhlp.cxx:513
std::vector< css::uno::Reference< css::io::XOutputStream > > maGrfStms
Definition: xmlgrhlp.hxx:57
virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL createOutputStream() override
Definition: xmlgrhlp.cxx:880
SVX_DLLPRIVATE Graphic ImplReadGraphic(const OUString &rPictureStorageName, const OUString &rPictureStreamName)
Definition: xmlgrhlp.cxx:494
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream(const OUString &rURL) override
Definition: xmlgrhlp.cxx:874
SVX_DLLPRIVATE SvxGraphicHelperStream_Impl ImplGetGraphicStream(const OUString &rPictureStorageName, const OUString &rPictureStreamName)
Definition: xmlgrhlp.cxx:433
SVX_DLLPRIVATE css::uno::Reference< css::embed::XStorage > ImplGetGraphicStorage(const OUString &rPictureStorageName)
Definition: xmlgrhlp.cxx:399
static rtl::Reference< SvXMLGraphicHelper > Create(const css::uno::Reference< css::embed::XStorage > &rXMLStorage, SvXMLGraphicHelperMode eCreateMode)
std::unordered_map< Graphic, std::pair< OUString, OUString > > maExportGraphics
Definition: xmlgrhlp.hxx:60
virtual OUString SAL_CALL resolveGraphicObjectURL(const OUString &aURL) override
Definition: xmlgrhlp.cxx:562
css::uno::Reference< css::embed::XStorage > mxRootStorage
Definition: xmlgrhlp.hxx:54
virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL loadGraphic(OUString const &aURL) override
Definition: xmlgrhlp.cxx:568
virtual OUString SAL_CALL saveGraphic(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic) override
Definition: xmlgrhlp.cxx:624
virtual ~SvXMLGraphicHelper() override
Definition: xmlgrhlp.cxx:373
SvStream & Write(const GDIMetaFile &rMetaFile)
tools::Long Decompress(SvStream &rIStm, SvStream &rOStm)
tools::Long EndCompression()
void BeginCompression(int nCompressLevel=ZCODEC_DEFAULT_COMPRESSION, bool gzLib=false)
static OUString GetMimeTypeForExtension(std::string_view rExt)
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
#define TOOLS_WARN_EXCEPTION(area, stream)
float u
#define ERRCODE_NONE
#define SOFFICE_FILEFORMAT_8
#define GRFILTER_FORMAT_DONTKNOW
Sequence< PropertyValue > aArguments
Mode eMode
void * p
#define SAL_WARN_IF(condition, area, stream)
std::unique_ptr< sal_Int32[]> pData
constexpr OUStringLiteral aData
@ Exception
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
void DropUnusedNamedItems(css::uno::Reference< css::uno::XInterface > const &xModel)
Definition: xmlgrhlp.cxx:1122
UNOTOOLS_DLLPUBLIC bool Exists(OUString const &url)
Reference< io::XInputStream > createInputStream(std::vector< sal_Int8 > &&rInData)
Reference< io::XOutputStream > createOutputStream(std::vector< sal_Int8 > *pOutData)
UNOTOOLS_DLLPUBLIC SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion()
const sal_Unicode *const aMimeType[]
css::uno::Reference< css::embed::XStorage > xStorage
Definition: xmlgrhlp.hxx:44
css::uno::Reference< css::io::XStream > xStream
Definition: xmlgrhlp.hxx:45
Reference< XModel > xModel
unsigned char sal_uInt8
unsigned char sal_Bool
OUString sId
constexpr OUStringLiteral XML_GRAPHICSTORAGE_NAME
Definition: xmlgrhlp.cxx:65
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Svx_GraphicImportHelper_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Create this with createInstanceWithArguments.
Definition: xmlgrhlp.cxx:1093
constexpr OUStringLiteral XML_GRAPHICOBJECT_URL_BASE
Definition: xmlgrhlp.cxx:66
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Svx_GraphicExportHelper_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Create this with createInstanceWithArguments.
Definition: xmlgrhlp.cxx:1113
SvXMLGraphicHelperMode
Definition: xmlgrhlp.hxx:38
#define ZCODEC_DEFAULT_COMPRESSION