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 "codec.hxx"
26 #include "gallerydrawmodel.hxx"
27 #include <vcl/cvtgrf.hxx>
28 #include <sot/formats.hxx>
29 
30 #include <sal/log.hxx>
31 
32 #include <com/sun/star/ucb/ContentCreationException.hpp>
33 #include <com/sun/star/sdbc/XResultSet.hpp>
34 #include <com/sun/star/ucb/XContentAccess.hpp>
35 #include <comphelper/fileformat.h>
38 #include <tools/urlobj.hxx>
39 #include <tools/diagnose_ex.h>
41 #include <unotools/streamwrap.hxx>
42 #include <unotools/tempfile.hxx>
43 #include <ucbhelper/content.hxx>
44 #include <tools/vcompat.hxx>
45 
46 using namespace ::com::sun::star;
47 
49  GalleryObjectCollection& rGalleryObjectCollection,
50  bool bReadOnly)
51  : maGalleryStorageLocations(rGalleryStorageLocations)
52  , mrGalleryObjectCollection(rGalleryObjectCollection)
53  , mbReadOnly(bReadOnly)
54 {
56 }
57 
59 
61 
63 {
64  try
65  {
68  mbReadOnly ? StreamMode::READ : StreamMode::STD_READWRITE);
69  // #i50423# ReadOnly may not been set though the file can't be written (because of security reasons)
73  StreamMode::READ);
74  }
75  catch (const css::ucb::ContentCreationException&)
76  {
77  TOOLS_WARN_EXCEPTION("svx", "failed to open: " << GetSdvURL().GetMainURL(
79  << "due to");
80  }
81 }
82 
84 {
85  return m_aSvDrawStorageRef;
86 }
87 
89 {
90  INetURLObject aPathURL(GetThmURL());
91 
92  aPathURL.removeSegment();
93  aPathURL.removeFinalSlash();
94 
95  DBG_ASSERT(aPathURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
96 
97  if (FileExists(aPathURL) || CreateDir(aPathURL))
98  {
99 #ifdef UNX
100  std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream(
102  StreamMode::WRITE | StreamMode::COPY_ON_SYMLINK | StreamMode::TRUNC));
103 #else
104  std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream(
106  StreamMode::WRITE | StreamMode::TRUNC));
107 #endif
108 
109  if (pOStm)
110  {
111  WriteGalleryTheme(*pOStm, rTheme);
112  pOStm.reset();
113  return true;
114  }
115 
116  return false;
117  }
118  return true;
119 }
120 
121 void GalleryBinaryEngine::insertObject(const SgaObject& rObj, GalleryObject* pFoundEntry,
122  OUString& rDestDir, sal_uInt32& rInsertPos)
123 {
124  if (pFoundEntry)
125  {
126  GalleryObject aNewEntry;
127 
128  // update title of new object if necessary
129  if (rObj.GetTitle().isEmpty())
130  {
131  std::unique_ptr<SgaObject> pOldObj(implReadSgaObject(pFoundEntry));
132 
133  if (pOldObj)
134  {
135  const_cast<SgaObject&>(rObj).SetTitle(pOldObj->GetTitle());
136  }
137  }
138  else if (rObj.GetTitle() == "__<empty>__")
139  const_cast<SgaObject&>(rObj).SetTitle("");
140 
141  implWriteSgaObject(rObj, rInsertPos, &aNewEntry, rDestDir);
142  pFoundEntry->nOffset = aNewEntry.nOffset;
143  }
144  else
145  implWriteSgaObject(rObj, rInsertPos, nullptr, rDestDir);
146 }
147 
148 std::unique_ptr<SgaObject> GalleryBinaryEngine::implReadSgaObject(GalleryObject const* pEntry)
149 {
150  std::unique_ptr<SgaObject> pSgaObj;
151 
152  if (pEntry)
153  {
154  std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
155  GetSdgURL().GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ));
156 
157  if (pIStm)
158  {
159  sal_uInt32 nInventor;
160 
161  // Check to ensure that the file is a valid SGA file
162  pIStm->Seek(pEntry->nOffset);
163  pIStm->ReadUInt32(nInventor);
164 
165  if (nInventor == COMPAT_FORMAT('S', 'G', 'A', '3'))
166  {
167  pIStm->Seek(pEntry->nOffset);
168 
169  switch (pEntry->eObjKind)
170  {
171  case SgaObjKind::Bitmap:
172  pSgaObj.reset(new SgaObjectBmp());
173  break;
175  pSgaObj.reset(new SgaObjectAnim());
176  break;
177  case SgaObjKind::Inet:
178  pSgaObj.reset(new SgaObjectINet());
179  break;
180  case SgaObjKind::SvDraw:
181  pSgaObj.reset(new SgaObjectSvDraw());
182  break;
183  case SgaObjKind::Sound:
184  pSgaObj.reset(new SgaObjectSound());
185  break;
186 
187  default:
188  break;
189  }
190 
191  if (pSgaObj)
192  {
193  ReadSgaObject(*pIStm, *pSgaObj);
194  pSgaObj->ImplUpdateURL(pEntry->aURL);
195  }
196  }
197  }
198  }
199 
200  return pSgaObj;
201 }
202 
203 bool GalleryBinaryEngine::implWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos,
204  GalleryObject* pExistentEntry, OUString& aDestDir)
205 {
206  std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream(
207  GetSdgURL().GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE));
208  bool bRet = false;
209 
210  if (pOStm)
211  {
212  const sal_uInt32 nOffset = pOStm->Seek(STREAM_SEEK_TO_END);
213 
214  rObj.WriteData(*pOStm, aDestDir);
215 
216  if (!pOStm->GetError())
217  {
218  GalleryObject* pEntry;
219 
220  if (!pExistentEntry)
221  {
222  pEntry = new GalleryObject;
223  if (nPos < mrGalleryObjectCollection.size())
224  {
226  mrGalleryObjectCollection.getObjectList().begin() + nPos, pEntry);
227  }
228  else
229  mrGalleryObjectCollection.getObjectList().emplace_back(pEntry);
230  }
231  else
232  pEntry = pExistentEntry;
233 
234  pEntry->aURL = rObj.GetURL();
235  pEntry->nOffset = nOffset;
236  pEntry->eObjKind = rObj.GetObjKind();
237  bRet = true;
238  }
239  }
240 
241  return bRet;
242 }
243 
245 {
247  bool bRet = false;
248  const INetURLObject aURL(ImplGetURL(pObject));
249 
250  if (xSotStorage.is())
251  {
252  const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL));
253  tools::SvRef<SotStorageStream> xInputStream(
254  xSotStorage->OpenSotStream(aStreamName, StreamMode::READ));
255 
256  if (xInputStream.is() && !xInputStream->GetError())
257  {
258  xInputStream->SetBufferSize(STREAMBUF_SIZE);
259  bRet = GallerySvDrawImport(*xInputStream, rModel);
260  xInputStream->SetBufferSize(0);
261  }
262  }
263  return bRet;
264 }
266  const INetURLObject& rUserURL)
267 {
270  bool bRet = false;
271 
272  if (xSotStorage.is())
273  {
274  const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL));
275  tools::SvRef<SotStorageStream> xOutputStream(
276  xSotStorage->OpenSotStream(aStreamName, StreamMode::WRITE | StreamMode::TRUNC));
277 
278  if (xOutputStream.is() && !xOutputStream->GetError())
279  {
280  SvMemoryStream aMemoryStream(65535, 65535);
281  FmFormModel* pFormModel = const_cast<FmFormModel*>(&rModel);
282 
283  pFormModel->BurnInStyleSheetAttributes();
284 
285  {
286  uno::Reference<io::XOutputStream> xDocOut(
287  new utl::OOutputStreamWrapper(aMemoryStream));
288 
289  if (xDocOut.is())
290  (void)SvxDrawingLayerExport(pFormModel, xDocOut);
291  }
292 
293  aMemoryStream.Seek(0);
294 
295  xOutputStream->SetBufferSize(16348);
296  GalleryCodec aCodec(*xOutputStream);
297  aCodec.Write(aMemoryStream);
298 
299  xOutputStream->SetBufferSize(0);
300  xOutputStream->Commit();
301  bRet = !xOutputStream->GetError();
302  }
303  }
304  if (bRet)
305  {
306  SgaObjectSvDraw aObjSvDraw(rModel, aURL);
307  return aObjSvDraw;
308  }
309  return SgaObjectSvDraw();
310 }
311 
313  tools::SvRef<SotStorageStream> const& rxModelStream)
314 {
315  const INetURLObject aURL(ImplGetURL(pObject));
317  bool bRet = false;
318 
319  if (xSotStorage.is())
320  {
321  const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL));
322  tools::SvRef<SotStorageStream> xInputStream(
323  xSotStorage->OpenSotStream(aStreamName, StreamMode::READ));
324 
325  if (xInputStream.is() && !xInputStream->GetError())
326  {
327  sal_uInt32 nVersion = 0;
328 
329  xInputStream->SetBufferSize(16348);
330 
331  if (GalleryCodec::IsCoded(*xInputStream, nVersion))
332  {
333  SvxGalleryDrawModel aModel;
334 
335  if (aModel.GetModel())
336  {
337  if (GallerySvDrawImport(*xInputStream, *aModel.GetModel()))
338  {
340 
341  {
342  uno::Reference<io::XOutputStream> xDocOut(
343  new utl::OOutputStreamWrapper(*rxModelStream));
344 
345  if (SvxDrawingLayerExport(aModel.GetModel(), xDocOut))
346  rxModelStream->Commit();
347  }
348  }
349 
350  bRet = (rxModelStream->GetError() == ERRCODE_NONE);
351  }
352  }
353 
354  xInputStream->SetBufferSize(0);
355  }
356  }
357  return bRet;
358 }
359 
362  const INetURLObject& rUserURL)
363 {
366 
367  if (xSotStorage.is())
368  {
369  const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL));
370  tools::SvRef<SotStorageStream> xOutputStream(
371  xSotStorage->OpenSotStream(aStreamName, StreamMode::WRITE | StreamMode::TRUNC));
372 
373  if (xOutputStream.is() && !xOutputStream->GetError())
374  {
375  GalleryCodec aCodec(*xOutputStream);
376 
377  xOutputStream->SetBufferSize(16348);
378  aCodec.Write(*rxModelStream);
379 
380  if (!xOutputStream->GetError())
381  {
382  xOutputStream->Seek(0);
383  SgaObjectSvDraw aObjSvDraw(*xOutputStream, aURL);
384  return aObjSvDraw;
385  }
386  }
387  }
388  return SgaObjectSvDraw();
389 }
390 
392  const INetURLObject& rUserURL,
393  ConvertDataFormat nFormat)
394 {
395  INetURLObject aDir(rUserURL);
396  INetURLObject aInfoFileURL(rUserURL);
397  INetURLObject aNewURL;
398  sal_uInt32 nNextNumber = 1999;
399  char const* pExt = nullptr;
400  bool bExists;
401 
402  aDir.Append("dragdrop");
403  CreateDir(aDir);
404 
405  aInfoFileURL.Append("sdddndx1");
406 
407  // read next possible number
408  if (FileExists(aInfoFileURL))
409  {
410  std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
411  aInfoFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ));
412 
413  if (pIStm)
414  {
415  pIStm->ReadUInt32(nNextNumber);
416  }
417  }
418 
420 
421  do
422  {
423  // get URL
424  if (SgaObjKind::SvDraw == eObjKind)
425  {
426  OUString aFileName = "gallery/svdraw/dd" + OUString::number(++nNextNumber % 99999999);
427  aNewURL = INetURLObject(aFileName, INetProtocol::PrivSoffice);
428 
429  bExists = false;
430 
431  for (auto const& p : mrGalleryObjectCollection.getObjectList())
432  if (p->aURL == aNewURL)
433  {
434  bExists = true;
435  break;
436  }
437  }
438  else
439  {
440  OUString aFileName = "dd" + OUString::number(++nNextNumber % 999999);
441 
442  if (pExt)
443  aFileName += OUString(pExt, strlen(pExt), RTL_TEXTENCODING_ASCII_US);
444 
445  aNewURL = aDir;
446  aNewURL.Append(aFileName);
447 
448  bExists = FileExists(aNewURL);
449  }
450  } while (bExists);
451 
452  // write updated number
453  std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream(
454  aInfoFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE));
455 
456  if (pOStm)
457  {
458  pOStm->WriteUInt32(nNextNumber);
459  }
460 
461  return aNewURL;
462 }
463 
465  ConvertDataFormat& nExportFormat,
466  const INetURLObject& rUserURL)
467 {
468  const INetURLObject aURL(implCreateUniqueURL(SgaObjKind::Bitmap, rUserURL, nExportFormat));
469  std::unique_ptr<SvStream> pOStm(
471  StreamMode::WRITE | StreamMode::TRUNC));
472  bool bRet = false;
473 
474  if (pOStm)
475  {
476  pOStm->SetVersion(SOFFICE_FILEFORMAT_50);
477 
478  if (ConvertDataFormat::SVM == nExportFormat)
479  {
480  GDIMetaFile aMtf(rGraphic.GetGDIMetaFile());
481 
482  aMtf.Write(*pOStm);
483  bRet = (pOStm->GetError() == ERRCODE_NONE);
484  }
485  else
486  {
487  if (aGfxLink.GetDataSize() && aGfxLink.GetData())
488  {
489  pOStm->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize());
490  bRet = (pOStm->GetError() == ERRCODE_NONE);
491  }
492  else
493  bRet = (GraphicConverter::Export(*pOStm, rGraphic, nExportFormat) == ERRCODE_NONE);
494  }
495 
496  pOStm.reset();
497  }
498  if (bRet)
499  {
500  const SgaObjectBmp aObjBmp(aURL);
501  return aObjBmp;
502  }
503  return SgaObjectBmp();
504 }
505 
507 {
508  if (GetSvDrawStorage().is())
509  {
510  const OUString aStmName(GetSvDrawStreamNameFromURL(pEntry->aURL));
512  = GetSvDrawStorage()->OpenSotStream(aStmName, StreamMode::READ);
513 
514  if (pIStm.is() && !pIStm->GetError())
515  {
516  pIStm->SetBufferSize(16384);
517 
518  SgaObjectSvDraw aNewObj(*pIStm, pEntry->aURL);
519 
520  pIStm->SetBufferSize(0);
521 
522  return aNewObj;
523  }
524  }
525  return SgaObjectSvDraw();
526 }
527 
529 {
530  ::utl::TempFile aTmp;
531  INetURLObject aInURL(GetSdgURL());
532  INetURLObject aTmpURL(aTmp.GetURL());
533 
534  DBG_ASSERT(aInURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
535  DBG_ASSERT(aTmpURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
536 
537  std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
538  aInURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ));
539  std::unique_ptr<SvStream> pTmpStm(::utl::UcbStreamHelper::CreateStream(
540  aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE),
541  StreamMode::WRITE | StreamMode::TRUNC));
542 
543  if (pIStm && pTmpStm)
544  {
545  for (const auto& i : mrGalleryObjectCollection.getObjectList())
546  {
547  GalleryObject* pEntry = i.get();
548  std::unique_ptr<SgaObject> pObj;
549 
550  switch (pEntry->eObjKind)
551  {
552  case SgaObjKind::Bitmap:
553  pObj.reset(new SgaObjectBmp());
554  break;
556  pObj.reset(new SgaObjectAnim());
557  break;
558  case SgaObjKind::Inet:
559  pObj.reset(new SgaObjectINet());
560  break;
561  case SgaObjKind::SvDraw:
562  pObj.reset(new SgaObjectSvDraw());
563  break;
564  case SgaObjKind::Sound:
565  pObj.reset(new SgaObjectSound());
566  break;
567 
568  default:
569  break;
570  }
571 
572  if (pObj)
573  {
574  pIStm->Seek(pEntry->nOffset);
575  ReadSgaObject(*pIStm, *pObj);
576  pEntry->nOffset = pTmpStm->Tell();
577  WriteSgaObject(*pTmpStm, *pObj);
578  }
579  }
580  }
581  else
582  {
583  OSL_FAIL("File(s) could not be opened");
584  }
585 
586  pIStm.reset();
587  pTmpStm.reset();
588 
589  CopyFile(aTmpURL, aInURL);
590  KillFile(aTmpURL);
591 
592  ErrCode nStorErr = ERRCODE_NONE;
593 
594  try
595  {
596  tools::SvRef<SotStorage> aTempStorageRef(
597  new SotStorage(false, aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE),
598  StreamMode::STD_READWRITE));
599  GetSvDrawStorage()->CopyTo(aTempStorageRef.get());
600  nStorErr = GetSvDrawStorage()->GetError();
601  }
602  catch (const css::ucb::ContentCreationException&)
603  {
604  TOOLS_WARN_EXCEPTION("svx", "failed to open: "
605  << aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE)
606  << "due to");
607  nStorErr = ERRCODE_IO_GENERAL;
608  }
609 
610  if (nStorErr == ERRCODE_NONE)
611  {
612  clearSotStorage();
613  CopyFile(aTmpURL, GetSdvURL());
615  }
616 
617  KillFile(aTmpURL);
618 }
619 
621  std::vector<INetURLObject>& rURLVector)
622 {
624  try
625  {
627  uno::Reference<ucb::XCommandEnvironment>(),
629  bool bFolder = false;
630 
631  aCnt.getPropertyValue("IsFolder") >>= bFolder;
632 
633  if (bFolder)
634  {
635  uno::Sequence<OUString> aProps{ "Url" };
636  uno::Reference<sdbc::XResultSet> xResultSet(
637  aCnt.createCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY));
638  uno::Reference<ucb::XContentAccess> xContentAccess(xResultSet, uno::UNO_QUERY);
639  if (xContentAccess.is())
640  {
641  while (xResultSet->next())
642  {
643  aURL.SetSmartURL(xContentAccess->queryContentIdentifierString());
644  rURLVector.push_back(aURL);
645  }
646  }
647  }
648  else
649  rURLVector.push_back(rFileOrDirURL);
650  }
651  catch (const ucb::ContentCreationException&)
652  {
653  }
654  catch (const uno::RuntimeException&)
655  {
656  }
657  catch (const uno::Exception&)
658  {
659  }
660 }
661 
663 {
664  return rTheme.WriteData(rOut);
665 }
666 
667 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool readModelStream(const GalleryObject *pObject, tools::SvRef< SotStorageStream > const &rxModelStream)
bool is() const
URL aURL
SvStream & ReadSgaObject(SvStream &rIn, SgaObject &rObj)
Definition: galobj.cxx:238
std::vector< std::unique_ptr< GalleryObject > > & getObjectList()
SgaObjectSvDraw insertModel(const FmFormModel &rModel, const INetURLObject &rUserURL)
SAL_DLLPRIVATE SvStream & WriteData(SvStream &rOut) const
Definition: galtheme.cxx:653
bool SvxDrawingLayerExport(SdrModel *pModel, const uno::Reference< io::XOutputStream > &xOut, const Reference< lang::XComponent > &xComponent)
Definition: xmlexport.cxx:42
ErrCode GetError() const
css::uno::Any getPropertyValue(const OUString &rPropertyName)
#define STREAM_SEEK_TO_END
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & WriteSgaObject(SvStream &rOut, const SgaObject &rObj)
Definition: galobj.cxx:232
FmFormModel * GetModel() const
SgaObjectSvDraw insertModelStream(const tools::SvRef< SotStorageStream > &rxModelStream, const INetURLObject &rUserURL)
bool bReadOnly
void BurnInStyleSheetAttributes()
Definition: svdmodel.cxx:824
bool CreateDir(const INetURLObject &rURL)
Definition: galmisc.cxx:227
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
SgaObjKind eObjKind
Definition: galtheme.hxx:43
INetURLObject ImplGetURL(const GalleryObject *pObject)
Definition: galmisc.cxx:554
INetURLObject aURL
Definition: galtheme.hxx:41
bool CopyTo(SotStorage *pDestStg)
const GDIMetaFile & GetGDIMetaFile() const
tools::SvRef< SotStorage > m_aSvDrawStorageRef
void insertObject(const SgaObject &rObj, GalleryObject *pFoundEntry, OUString &rDestDir, sal_uInt32 &rInsertPos)
const INetURLObject & GetSdvURL() const
SgaObjKind
Definition: galmisc.hxx:55
T * get() const
const INetURLObject & GetThmURL() const
#define SOFFICE_FILEFORMAT_50
#define TOOLS_WARN_EXCEPTION(area, stream)
#define ERRCODE_IO_GENERAL
#define DBG_ASSERT(sCon, aError)
int i
SotStorageStream * OpenSotStream(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE)
bool Append(OUString const &rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
OUString const & GetURL() const
static void insertFileOrDirURL(const INetURLObject &rFileOrDirURL, std::vector< INetURLObject > &rURLVector)
sal_uInt32 COMPAT_FORMAT(char char1, char char2, char char3, char char4)
sal_uInt32 nOffset
Definition: galtheme.hxx:42
ConvertDataFormat
std::size_t WriteBytes(const void *pData, std::size_t nSize)
bool removeFinalSlash()
sal_Int16 nVersion
bool KillFile(const INetURLObject &rURL)
Definition: galmisc.cxx:288
bool GallerySvDrawImport(SvStream &rIStm, SdrModel &rModel)
Definition: galmisc.cxx:76
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool CopyFile(const INetURLObject &rSrcURL, const INetURLObject &rDstURL)
Definition: galmisc.cxx:262
static ErrCode Export(SvStream &rOStm, const Graphic &rGraphic, ConvertDataFormat nFormat)
static bool FileExists(const INetURLObject &rURL, const OUString &rExt)
GalleryBinaryEngine(const GalleryStorageLocations &rGalleryStorageLocations, GalleryObjectCollection &rGalleryObjectCollection, bool bReadOnly)
#define ERRCODE_NONE
bool readModel(const GalleryObject *pObject, SdrModel &rModel)
SgaObjectBmp insertGraphic(const Graphic &rGraphic, const GfxLink &aGfxLink, ConvertDataFormat &nExportFormat, const INetURLObject &rUserURL)
bool implWriteSgaObject(const SgaObject &rObj, sal_uInt32 nPos, GalleryObject *pExistentEntry, OUString &aDestDir)
SvStream & WriteGalleryTheme(SvStream &rOut, const GalleryTheme &rTheme)
INetProtocol GetProtocol() const
SAL_DLLPRIVATE void ImplCreateSvDrawStorage()
const INetURLObject & GetSdgURL() const
void Write(SvStream &rStmToWrite)
Definition: codec.cxx:60
void * p
Reference< XComponentContext > getProcessComponentContext()
SAL_DLLPRIVATE bool implWrite(const GalleryTheme &rTheme)
static bool IsCoded(SvStream &rStm, sal_uInt32 &rVersion)
Definition: codec.cxx:36
OUString GetSvDrawStreamNameFromURL(const INetURLObject &rSvDrawObjURL)
Definition: galmisc.cxx:186
static char const * GetExtensionForConvertDataFormat(ConvertDataFormat nFormat)
const char * pExt
Definition: xtable.cxx:371
std::unique_ptr< SgaObject > implReadSgaObject(GalleryObject const *pEntry)
#define STREAMBUF_SIZE
Definition: galmisc.hxx:67
INCLUDE_DOCUMENTS_ONLY
INetURLObject implCreateUniqueURL(SgaObjKind eObjKind, const INetURLObject &rUserURL, ConvertDataFormat nFormat=ConvertDataFormat::Unknown)
SgaObjectSvDraw updateSvDrawObject(GalleryObject *pEntry)
SAL_DLLPRIVATE const tools::SvRef< SotStorage > & GetSvDrawStorage() const
SvStream & Write(SvStream &rOStm)
SAL_DLLPRIVATE ~GalleryBinaryEngine()
bool SetSmartURL(OUString const &rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
GalleryObjectCollection & mrGalleryObjectCollection
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)