LibreOffice Module svx (master) 1
gallerybinaryengine.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 <svx/unomodel.hxx>
21#include <svx/fmmodel.hxx>
22#include <galobj.hxx>
25#include <svx/gallery1.hxx>
27#include <osl/thread.hxx>
28#include "codec.hxx"
29#include "gallerydrawmodel.hxx"
30#include <vcl/cvtgrf.hxx>
32
33#include <sal/log.hxx>
34
35#include <com/sun/star/ucb/ContentCreationException.hpp>
36#include <com/sun/star/sdbc/XResultSet.hpp>
37#include <com/sun/star/ucb/XContentAccess.hpp>
41#include <tools/urlobj.hxx>
43#include <tools/datetime.hxx>
44#include <unotools/datetime.hxx>
47#include <unotools/tempfile.hxx>
48#include <ucbhelper/content.hxx>
49#include <tools/vcompat.hxx>
50
51using namespace ::com::sun::star;
52
54 const GalleryBinaryStorageLocations& rGalleryBinaryStorageLocations,
55 GalleryObjectCollection& rGalleryObjectCollection, bool bReadOnly)
56 : maGalleryStorageLocations(rGalleryBinaryStorageLocations)
57 , mrGalleryObjectCollection(rGalleryObjectCollection)
58 , mbReadOnly(bReadOnly)
59 , m_bDestDirRelative(false)
60{
62}
63
65
66void GalleryBinaryEngine::setDestDir(const OUString& rDestDir, bool bRelative)
67{
68 m_aDestDir = rDestDir;
69 m_bDestDirRelative = bRelative;
70}
71
73
75{
76 try
77 {
80 mbReadOnly ? StreamMode::READ : StreamMode::STD_READWRITE);
81 // #i50423# ReadOnly may not been set though the file can't be written (because of security reasons)
82 if ((m_aSvDrawStorageRef->GetError() != ERRCODE_NONE) && !mbReadOnly)
85 StreamMode::READ);
86 }
87 catch (const css::ucb::ContentCreationException&)
88 {
89 TOOLS_WARN_EXCEPTION("svx", "failed to open: " << GetSdvURL().GetMainURL(
91 << "due to");
92 }
93}
94
96{
98}
99
101{
102 INetURLObject aPathURL(GetThmURL());
103
104 aPathURL.removeSegment();
105 aPathURL.removeFinalSlash();
106
107 DBG_ASSERT(aPathURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
108
109 if (FileExists(aPathURL) || CreateDir(aPathURL))
110 {
111#ifdef UNX
112 std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream(
114 StreamMode::WRITE | StreamMode::COPY_ON_SYMLINK | StreamMode::TRUNC));
115#else
116 std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream(
118 StreamMode::WRITE | StreamMode::TRUNC));
119#endif
120
121 if (pOStm)
122 {
123 writeGalleryTheme(*pOStm, rTheme, pThm);
124 pOStm.reset();
125 return true;
126 }
127
128 return false;
129 }
130 return true;
131}
132
133void GalleryBinaryEngine::insertObject(const SgaObject& rObj, GalleryObject* pFoundEntry,
134 sal_uInt32 nInsertPos)
135{
136 if (pFoundEntry)
137 {
138 GalleryObject aNewEntry;
139
140 // update title of new object if necessary
141 if (rObj.GetTitle().isEmpty())
142 {
143 std::unique_ptr<SgaObject> pOldObj(implReadSgaObject(pFoundEntry));
144
145 if (pOldObj)
146 {
147 const_cast<SgaObject&>(rObj).SetTitle(pOldObj->GetTitle());
148 }
149 }
150 else if (rObj.GetTitle() == "__<empty>__")
151 const_cast<SgaObject&>(rObj).SetTitle("");
152
153 implWriteSgaObject(rObj, nInsertPos, &aNewEntry);
154 pFoundEntry->nOffset = aNewEntry.nOffset;
155 }
156 else
157 implWriteSgaObject(rObj, nInsertPos, nullptr);
158}
159
160void GalleryBinaryEngine::removeObject(const std::unique_ptr<GalleryObject>& pEntry)
161{
164
165 if (SgaObjKind::SvDraw == pEntry->eObjKind)
166 GetSvDrawStorage()->Remove(
167 pEntry->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE));
168}
169
170std::unique_ptr<SgaObject> GalleryBinaryEngine::implReadSgaObject(GalleryObject const* pEntry)
171{
172 std::unique_ptr<SgaObject> pSgaObj;
173
174 if (pEntry)
175 {
176 std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
177 GetSdgURL().GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ));
178
179 if (pIStm)
180 {
181 sal_uInt32 nInventor;
182
183 // Check to ensure that the file is a valid SGA file
184 pIStm->Seek(pEntry->nOffset);
185 pIStm->ReadUInt32(nInventor);
186
187 if (nInventor == COMPAT_FORMAT('S', 'G', 'A', '3'))
188 {
189 pIStm->Seek(pEntry->nOffset);
190
191 switch (pEntry->eObjKind)
192 {
194 pSgaObj.reset(new SgaObjectBmp());
195 break;
197 pSgaObj.reset(new SgaObjectAnim());
198 break;
199 case SgaObjKind::Inet:
200 pSgaObj.reset(new SgaObjectINet());
201 break;
203 pSgaObj.reset(new SgaObjectSvDraw());
204 break;
206 pSgaObj.reset(new SgaObjectSound());
207 break;
208
209 default:
210 break;
211 }
212
213 if (pSgaObj)
214 {
215 ReadSgaObject(*pIStm, *pSgaObj);
216 pSgaObj->ImplUpdateURL(pEntry->getURL());
217 }
218 }
219 }
220 }
221
222 return pSgaObj;
223}
224
225bool GalleryBinaryEngine::implWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos,
226 GalleryObject* pExistentEntry)
227{
228 std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream(
229 GetSdgURL().GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE));
230 bool bRet = false;
231
232 if (pOStm)
233 {
234 const sal_uInt32 nOffset = pOStm->Seek(STREAM_SEEK_TO_END);
235
236 rObj.WriteData(*pOStm, m_aDestDir);
237
238 if (!pOStm->GetError())
239 {
240 GalleryObject* pEntry;
241
242 if (!pExistentEntry)
243 {
244 pEntry = new GalleryObject;
246 {
248 mrGalleryObjectCollection.getObjectList().begin() + nPos, pEntry);
249 }
250 else
251 mrGalleryObjectCollection.getObjectList().emplace_back(pEntry);
252 }
253 else
254 pEntry = pExistentEntry;
255
256 pEntry->m_pGalleryObjectStorage = std::make_unique<GalleryObjectBinaryStorage>();
257 pEntry->m_pGalleryObjectStorage->setURL(rObj.GetURL());
258
259 pEntry->nOffset = nOffset;
260 pEntry->eObjKind = rObj.GetObjKind();
261 bRet = true;
262 }
263 }
264
265 return bRet;
266}
267
269{
271 bool bRet = false;
273
274 if (xSotStorage.is())
275 {
276 const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL));
278 xSotStorage->OpenSotStream(aStreamName, StreamMode::READ));
279
280 if (xInputStream.is() && !xInputStream->GetError())
281 {
282 xInputStream->SetBufferSize(STREAMBUF_SIZE);
283 bRet = GallerySvDrawImport(*xInputStream, rModel);
284 xInputStream->SetBufferSize(0);
285 }
286 }
287 return bRet;
288}
289
291 const INetURLObject& rUserURL)
292{
295 bool bRet = false;
296
297 if (xSotStorage.is())
298 {
299 const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL));
300 tools::SvRef<SotStorageStream> xOutputStream(
301 xSotStorage->OpenSotStream(aStreamName, StreamMode::WRITE | StreamMode::TRUNC));
302
303 if (xOutputStream.is() && !xOutputStream->GetError())
304 {
305 SvMemoryStream aMemoryStream(65535, 65535);
306 FmFormModel* pFormModel = const_cast<FmFormModel*>(&rModel);
307
308 pFormModel->BurnInStyleSheetAttributes();
309
310 {
311 uno::Reference<io::XOutputStream> xDocOut(
312 new utl::OOutputStreamWrapper(aMemoryStream));
313
314 if (xDocOut.is())
315 (void)SvxDrawingLayerExport(pFormModel, xDocOut);
316 }
317
318 aMemoryStream.Seek(0);
319
320 xOutputStream->SetBufferSize(16348);
321 GalleryCodec aCodec(*xOutputStream);
322 aCodec.Write(aMemoryStream);
323
324 xOutputStream->SetBufferSize(0);
325 xOutputStream->Commit();
326 bRet = !xOutputStream->GetError();
327 }
328 }
329 if (bRet)
330 {
331 SgaObjectSvDraw aObjSvDraw(rModel, aURL);
332 return aObjSvDraw;
333 }
334 return SgaObjectSvDraw();
335}
336
338 tools::SvRef<SotTempStream> const& rxModelStream)
339{
342 bool bRet = false;
343
344 if (xSotStorage.is())
345 {
346 const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL));
348 xSotStorage->OpenSotStream(aStreamName, StreamMode::READ));
349
350 if (xInputStream.is() && !xInputStream->GetError())
351 {
352 sal_uInt32 nVersion = 0;
353
354 xInputStream->SetBufferSize(16348);
355
356 if (GalleryCodec::IsCoded(*xInputStream, nVersion))
357 {
358 SvxGalleryDrawModel aModel;
359
360 if (aModel.GetModel())
361 {
362 if (GallerySvDrawImport(*xInputStream, *aModel.GetModel()))
363 {
365
366 {
367 uno::Reference<io::XOutputStream> xDocOut(
368 new utl::OOutputStreamWrapper(*rxModelStream));
369
370 SvxDrawingLayerExport(aModel.GetModel(), xDocOut);
371 }
372 }
373
374 bRet = (rxModelStream->GetError() == ERRCODE_NONE);
375 }
376 }
377
378 xInputStream->SetBufferSize(0);
379 }
380 }
381 return bRet;
382}
383
386 const INetURLObject& rUserURL)
387{
390
391 if (xSotStorage.is())
392 {
393 const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL));
394 tools::SvRef<SotStorageStream> xOutputStream(
395 xSotStorage->OpenSotStream(aStreamName, StreamMode::WRITE | StreamMode::TRUNC));
396
397 if (xOutputStream.is() && !xOutputStream->GetError())
398 {
399 GalleryCodec aCodec(*xOutputStream);
400
401 xOutputStream->SetBufferSize(16348);
402 aCodec.Write(*rxModelStream);
403
404 if (!xOutputStream->GetError())
405 {
406 xOutputStream->Seek(0);
407 SgaObjectSvDraw aObjSvDraw(*xOutputStream, aURL);
408 return aObjSvDraw;
409 }
410 }
411 }
412 return SgaObjectSvDraw();
413}
414
416 const INetURLObject& rUserURL,
417 ConvertDataFormat nFormat)
418{
419 INetURLObject aDir(rUserURL);
420 INetURLObject aInfoFileURL(rUserURL);
421 INetURLObject aNewURL;
422 sal_uInt32 nNextNumber = 1999;
423 char const* pExt = nullptr;
424 bool bExists;
425
426 aDir.Append(u"dragdrop");
427 CreateDir(aDir);
428
429 aInfoFileURL.Append(u"sdddndx1");
430
431 // read next possible number
432 if (FileExists(aInfoFileURL))
433 {
434 std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
435 aInfoFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ));
436
437 if (pIStm)
438 {
439 pIStm->ReadUInt32(nNextNumber);
440 }
441 }
442
444
445 do
446 {
447 // get URL
448 if (SgaObjKind::SvDraw == eObjKind)
449 {
450 OUString aFileName = "gallery/svdraw/dd" + OUString::number(++nNextNumber % 99999999);
451 aNewURL = INetURLObject(aFileName, INetProtocol::PrivSoffice);
452
453 bExists = false;
454
456 {
457 if (pObject->getURL() == aNewURL)
458 {
459 bExists = true;
460 break;
461 }
462 }
463 }
464 else
465 {
466 OUString aFileName = "dd" + OUString::number(++nNextNumber % 999999);
467
468 if (pExt)
469 aFileName += OUString(pExt, strlen(pExt), RTL_TEXTENCODING_ASCII_US);
470
471 aNewURL = aDir;
472 aNewURL.Append(aFileName);
473
474 bExists = FileExists(aNewURL);
475 }
476 } while (bExists);
477
478 // write updated number
479 std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream(
480 aInfoFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE));
481
482 if (pOStm)
483 {
484 pOStm->WriteUInt32(nNextNumber);
485 }
486
487 return aNewURL;
488}
489
491 const ConvertDataFormat& nExportFormat,
492 const INetURLObject& rUserURL)
493{
494 const INetURLObject aURL(implCreateUniqueURL(SgaObjKind::Bitmap, rUserURL, nExportFormat));
495 std::unique_ptr<SvStream> pOStm(
497 StreamMode::WRITE | StreamMode::TRUNC));
498 bool bRet = false;
499
500 if (pOStm)
501 {
502 pOStm->SetVersion(SOFFICE_FILEFORMAT_50);
503
504 if (ConvertDataFormat::SVM == nExportFormat)
505 {
506 GDIMetaFile aMtf(rGraphic.GetGDIMetaFile());
507
508 SvmWriter aWriter(*pOStm);
509 aWriter.Write(aMtf);
510 bRet = (pOStm->GetError() == ERRCODE_NONE);
511 }
512 else
513 {
514 if (aGfxLink.GetDataSize() && aGfxLink.GetData())
515 {
516 pOStm->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize());
517 bRet = (pOStm->GetError() == ERRCODE_NONE);
518 }
519 else
520 bRet = (GraphicConverter::Export(*pOStm, rGraphic, nExportFormat) == ERRCODE_NONE);
521 }
522
523 pOStm.reset();
524 }
525 if (bRet)
526 {
527 const SgaObjectBmp aObjBmp(aURL);
528 return aObjBmp;
529 }
530 return SgaObjectBmp();
531}
532
534{
535 if (GetSvDrawStorage().is())
536 {
537 const OUString aStmName(GetSvDrawStreamNameFromURL(pEntry->getURL()));
539 = GetSvDrawStorage()->OpenSotStream(aStmName, StreamMode::READ);
540
541 if (pIStm.is() && !pIStm->GetError())
542 {
543 pIStm->SetBufferSize(16384);
544
545 SgaObjectSvDraw aNewObj(*pIStm, pEntry->getURL());
546
547 pIStm->SetBufferSize(0);
548
549 return aNewObj;
550 }
551 }
552 return SgaObjectSvDraw();
553}
554
556{
558 INetURLObject aInURL(GetSdgURL());
559 INetURLObject aTmpURL(aTmp.GetURL());
560
561 DBG_ASSERT(aInURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
562 DBG_ASSERT(aTmpURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
563
564 std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
565 aInURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ));
566 std::unique_ptr<SvStream> pTmpStm(::utl::UcbStreamHelper::CreateStream(
568 StreamMode::WRITE | StreamMode::TRUNC));
569
570 if (pIStm && pTmpStm)
571 {
572 for (const auto& i : mrGalleryObjectCollection.getObjectList())
573 {
574 GalleryObject* pEntry = i.get();
575 std::unique_ptr<SgaObject> pObj;
576
577 switch (pEntry->eObjKind)
578 {
580 pObj.reset(new SgaObjectBmp());
581 break;
583 pObj.reset(new SgaObjectAnim());
584 break;
585 case SgaObjKind::Inet:
586 pObj.reset(new SgaObjectINet());
587 break;
589 pObj.reset(new SgaObjectSvDraw());
590 break;
592 pObj.reset(new SgaObjectSound());
593 break;
594
595 default:
596 break;
597 }
598
599 if (pObj)
600 {
601 pIStm->Seek(pEntry->nOffset);
602 ReadSgaObject(*pIStm, *pObj);
603 pEntry->nOffset = pTmpStm->Tell();
604 WriteSgaObject(*pTmpStm, *pObj);
605 }
606 }
607 }
608 else
609 {
610 OSL_FAIL("File(s) could not be opened");
611 }
612
613 pIStm.reset();
614 pTmpStm.reset();
615
616 CopyFile(aTmpURL, aInURL);
617 KillFile(aTmpURL);
618
619 ErrCode nStorErr = ERRCODE_NONE;
620
621 try
622 {
623 tools::SvRef<SotStorage> aTempStorageRef(
625 StreamMode::STD_READWRITE));
626 GetSvDrawStorage()->CopyTo(aTempStorageRef.get());
627 nStorErr = GetSvDrawStorage()->GetError();
628 }
629 catch (const css::ucb::ContentCreationException&)
630 {
631 TOOLS_WARN_EXCEPTION("svx", "failed to open: "
633 << "due to");
634 nStorErr = ERRCODE_IO_GENERAL;
635 }
636
637 if (nStorErr == ERRCODE_NONE)
638 {
640 CopyFile(aTmpURL, GetSdvURL());
642 }
643
644 KillFile(aTmpURL);
645}
646
648 std::vector<INetURLObject>& rURLVector)
649{
651 try
652 {
654 uno::Reference<ucb::XCommandEnvironment>(),
656 bool bFolder = false;
657
658 aCnt.getPropertyValue("IsFolder") >>= bFolder;
659
660 if (bFolder)
661 {
662 uno::Sequence<OUString> aProps{ "Url" };
663 uno::Reference<sdbc::XResultSet> xResultSet(
664 aCnt.createCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY));
665 uno::Reference<ucb::XContentAccess> xContentAccess(xResultSet, uno::UNO_QUERY);
666 if (xContentAccess.is())
667 {
668 while (xResultSet->next())
669 {
670 aURL.SetSmartURL(xContentAccess->queryContentIdentifierString());
671 rURLVector.push_back(aURL);
672 }
673 }
674 }
675 else
676 rURLVector.push_back(rFileOrDirURL);
677 }
678 catch (const ucb::ContentCreationException&)
679 {
680 }
681 catch (const uno::RuntimeException&)
682 {
683 }
684 catch (const uno::Exception&)
685 {
686 }
687}
688
690 const GalleryThemeEntry* pThm)
691{
692 const INetURLObject rRelURL1 = rTheme.GetParent()->GetRelativeURL();
693 const INetURLObject rRelURL2 = rTheme.GetParent()->GetUserURL();
694 const sal_uInt32 rId = rTheme.GetId();
696 bool bRel;
697
698 rOStm.WriteUInt16(0x0004);
700 RTL_TEXTENCODING_UTF8);
701 rOStm.WriteUInt32(nCount).WriteUInt16(osl_getThreadTextEncoding());
702
703 for (sal_uInt32 i = 0; i < nCount; i++)
704 {
706 OUString aPath;
707
708 if (SgaObjKind::SvDraw == pObj->eObjKind)
709 {
710 aPath = GetSvDrawStreamNameFromURL(pObj->getURL());
711 bRel = false;
712 }
713 else
714 {
716 aPath = aPath.copy(
717 0, std::min(rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(),
718 aPath.getLength()));
719 bRel = aPath == rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE);
720
721 if (bRel
723 > (rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength() + 1)))
724 {
726 aPath = aPath.copy(
727 std::min(rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(),
728 aPath.getLength()));
729 }
730 else
731 {
733 aPath = aPath.copy(
734 0,
735 std::min(rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(),
736 aPath.getLength()));
737 bRel = aPath == rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE);
738
739 if (bRel
741 > (rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength()
742 + 1)))
743 {
745 aPath = aPath.copy(std::min(
747 aPath.getLength()));
748 }
749 else
751 }
752 }
753
754 if (!m_aDestDir.isEmpty())
755 {
756 bool aFound = aPath.indexOf(m_aDestDir) != -1;
757 aPath = aPath.replaceFirst(m_aDestDir, "");
758 if (aFound)
759 bRel = m_bDestDirRelative;
760 else
761 SAL_WARN("svx", "failed to replace destdir of '" << m_aDestDir << "' in '" << aPath
762 << "'");
763 }
764
765 rOStm.WriteBool(bRel);
766 write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStm, aPath, RTL_TEXTENCODING_UTF8);
767 rOStm.WriteUInt32(pObj->nOffset).WriteUInt16(static_cast<sal_uInt16>(pObj->eObjKind));
768 }
769
770 // more recently, a 512-byte reserve buffer is written,
771 // to recognize them two sal_uInt32-Ids will be written.
772 rOStm.WriteUInt32(COMPAT_FORMAT('G', 'A', 'L', 'R'))
773 .WriteUInt32(COMPAT_FORMAT('E', 'S', 'R', 'V'));
774
775 const sal_uInt64 nReservePos = rOStm.Tell();
776 std::unique_ptr<VersionCompatWrite> pCompat(new VersionCompatWrite(rOStm, 2));
777
778 rOStm.WriteUInt32(rId).WriteBool(pThm->IsNameFromResource()); // From version 2 and up
779
780 pCompat.reset();
781
782 // Fill the rest of the buffer.
783 const tools::Long nRest
784 = std::max(tools::Long(512 - (rOStm.Tell() - nReservePos)), tools::Long(0));
785
786 if (nRest)
787 {
788 std::unique_ptr<char[]> pReserve(new char[nRest]);
789 memset(pReserve.get(), 0, nRest);
790 rOStm.WriteBytes(pReserve.get(), nRest);
791 }
792
793 return rOStm;
794}
795
797{
799 uno::Reference<ucb::XCommandEnvironment>(),
801 util::DateTime aDateTimeModified;
802 DateTime aDateTime(DateTime::EMPTY);
803
804 aCnt.getPropertyValue("DateModified") >>= aDateTimeModified;
805 ::utl::typeConvert(aDateTimeModified, aDateTime);
806
807 return aDateTime;
808}
809
810/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void removeObject(const std::unique_ptr< GalleryObject > &pEntry)
bool readModel(const GalleryObject *pObject, SdrModel &rModel)
bool readModelStream(const GalleryObject *pObject, tools::SvRef< SotTempStream > const &rxModelStream)
SvStream & writeGalleryTheme(SvStream &rOStm, const GalleryTheme &rTheme, const GalleryThemeEntry *pThm)
SgaObjectSvDraw insertModel(const FmFormModel &rModel, const INetURLObject &rUserURL)
static void insertFileOrDirURL(const INetURLObject &rFileOrDirURL, std::vector< INetURLObject > &rURLVector)
SgaObjectSvDraw updateSvDrawObject(const GalleryObject *pEntry)
SAL_DLLPRIVATE bool implWrite(const GalleryTheme &rTheme, const GalleryThemeEntry *pThm)
tools::SvRef< SotStorage > m_aSvDrawStorageRef
bool implWriteSgaObject(const SgaObject &rObj, sal_uInt32 nPos, GalleryObject *pExistentEntry)
void insertObject(const SgaObject &rObj, GalleryObject *pFoundEntry, sal_uInt32 nInsertPos)
GalleryBinaryEngine(const GalleryBinaryStorageLocations &rGalleryStorageLocations, GalleryObjectCollection &rGalleryObjectCollection, bool bReadOnly)
SAL_DLLPRIVATE ~GalleryBinaryEngine()
SAL_DLLPRIVATE const tools::SvRef< SotStorage > & GetSvDrawStorage() const
SgaObjectBmp insertGraphic(const Graphic &rGraphic, const GfxLink &aGfxLink, const ConvertDataFormat &nExportFormat, const INetURLObject &rUserURL)
const INetURLObject & GetThmURL() const
std::unique_ptr< SgaObject > implReadSgaObject(GalleryObject const *pEntry)
const INetURLObject & GetSdvURL() const
INetURLObject implCreateUniqueURL(SgaObjKind eObjKind, const INetURLObject &rUserURL, ConvertDataFormat nFormat=ConvertDataFormat::Unknown)
GalleryObjectCollection & mrGalleryObjectCollection
SAL_DLLPRIVATE void ImplCreateSvDrawStorage()
const INetURLObject & GetSdgURL() const
DateTime getModificationDate() const
void setDestDir(const OUString &rDestDir, bool bRelative)
SgaObjectSvDraw insertModelStream(const tools::SvRef< SotTempStream > &rxModelStream, const INetURLObject &rUserURL)
void Write(SvStream &rStmToWrite)
Definition: codec.cxx:56
static bool IsCoded(SvStream &rStm, sal_uInt32 &rVersion)
Definition: codec.cxx:32
const GalleryObject * getForPosition(sal_uInt32 nPos) const
std::vector< std::unique_ptr< GalleryObject > > & getObjectList()
const OUString & GetThemeName() const
Definition: gallery1.hxx:64
bool IsNameFromResource() const
Definition: gallery1.hxx:75
sal_uInt32 GetId() const
Definition: galtheme.cxx:773
SAL_DLLPRIVATE Gallery * GetParent() const
Definition: galtheme.hxx:117
SAL_DLLPRIVATE const INetURLObject & GetUserURL() const
Definition: gallery1.hxx:140
SAL_DLLPRIVATE const INetURLObject & GetRelativeURL() const
Definition: gallery1.hxx:141
static ErrCode Export(SvStream &rOStm, const Graphic &rGraphic, ConvertDataFormat nFormat)
const GDIMetaFile & GetGDIMetaFile() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeFinalSlash()
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
INetProtocol GetProtocol() const
bool Append(std::u16string_view rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
void BurnInStyleSheetAttributes()
Definition: svdmodel.cxx:777
sal_uInt64 Tell() const
std::size_t WriteBytes(const void *pData, std::size_t nSize)
SvStream & WriteBool(bool b)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & Write(const GDIMetaFile &rMetaFile)
FmFormModel * GetModel() const
static char const * GetExtensionForConvertDataFormat(ConvertDataFormat nFormat)
T * get() const
bool is() const
css::uno::Any getPropertyValue(const OUString &rPropertyName)
css::uno::Reference< css::sdbc::XResultSet > createCursor(const css::uno::Sequence< OUString > &rPropertyNames, ResultSetInclude eMode=INCLUDE_FOLDERS_AND_DOCUMENTS)
OUString const & GetURL() const
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)
#define TOOLS_WARN_EXCEPTION(area, stream)
URL aURL
virtual void SetTitle(const OUString &rNewTitle) override
float u
EmbeddedObjectRef * pObject
#define ERRCODE_IO_GENERAL
#define ERRCODE_NONE
sal_Int16 nVersion
#define SOFFICE_FILEFORMAT_50
bool bReadOnly
static bool FileExists(const INetURLObject &rURL, std::u16string_view rExt)
bool GallerySvDrawImport(SvStream &rIStm, SdrModel &rModel)
Definition: galmisc.cxx:76
bool CreateDir(const INetURLObject &rURL)
Definition: galmisc.cxx:229
INetURLObject ImplGetURL(const GalleryObject *pObject)
Definition: galmisc.cxx:553
OUString GetSvDrawStreamNameFromURL(const INetURLObject &rSvDrawObjURL)
Definition: galmisc.cxx:188
bool KillFile(const INetURLObject &rURL)
Definition: galmisc.cxx:287
bool CopyFile(const INetURLObject &rSrcURL, const INetURLObject &rDstURL)
Definition: galmisc.cxx:261
SgaObjKind
Definition: galmisc.hxx:57
#define STREAMBUF_SIZE
Definition: galmisc.hxx:68
SvStream & ReadSgaObject(SvStream &rIn, SgaObject &rObj)
Definition: galobj.cxx:247
SvStream & WriteSgaObject(SvStream &rOut, const SgaObject &rObj)
Definition: galobj.cxx:241
sal_uInt16 nPos
#define SAL_WARN(area, stream)
Reference< XComponentContext > getProcessComponentContext()
int i
long Long
ConvertDataFormat
#define STREAM_SEEK_TO_END
std::size_t write_uInt16_lenPrefixed_uInt8s_FromOUString(SvStream &rStrm, std::u16string_view rStr, rtl_TextEncoding eEnc)
const INetURLObject & getURL() const
std::unique_ptr< GalleryObjectStorage > m_pGalleryObjectStorage
sal_uInt32 COMPAT_FORMAT(char char1, char char2, char char3, char char4)
bool SvxDrawingLayerExport(SdrModel *pModel, const uno::Reference< io::XOutputStream > &xOut, const Reference< lang::XComponent > &xComponent)
Definition: xmlexport.cxx:40
const char * pExt
Definition: xtable.cxx:372