LibreOffice Module svx (master)  1
gallerybinaryengine.hxx
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 #pragma once
21 
22 #include <svx/galmisc.hxx>
23 #include <svx/svxdllapi.h>
24 #include <svx/fmmodel.hxx>
27 #include <tools/urlobj.hxx>
28 #include <sot/storage.hxx>
29 #include <vcl/salctype.hxx>
30 
31 #include <tools/datetime.hxx>
32 
33 #include <memory>
34 
38 class SgaObjectSvDraw;
39 class SgaObjectBmp;
40 class SgaObject;
41 class SotStorage;
42 struct GalleryObject;
43 class FmFormModel;
44 class GalleryTheme;
45 class GalleryThemeEntry;
46 
48 {
49 private:
53  bool mbReadOnly;
54  OUString m_aDestDir;
56 
57  const INetURLObject& GetSdgURL() const { return maGalleryStorageLocations.GetSdgURL(); }
58  const INetURLObject& GetSdvURL() const { return maGalleryStorageLocations.GetSdvURL(); }
59  const INetURLObject& GetStrURL() const { return maGalleryStorageLocations.GetStrURL(); }
60  const INetURLObject& GetThmURL() const { return maGalleryStorageLocations.GetThmURL(); }
61 
62 public:
63  GalleryBinaryEngine(const GalleryBinaryStorageLocations& rGalleryStorageLocations,
64  GalleryObjectCollection& rGalleryObjectCollection, bool bReadOnly);
65  SAL_DLLPRIVATE ~GalleryBinaryEngine();
66 
67  void clearSotStorage();
68 
69  void setDestDir(const OUString& rDestDir, bool bRelative);
70 
71  SAL_DLLPRIVATE void ImplCreateSvDrawStorage();
72  SAL_DLLPRIVATE const tools::SvRef<SotStorage>& GetSvDrawStorage() const;
73 
74  const INetURLObject& getThemeURL() const { return maGalleryStorageLocations.getThemeURL(); }
75 
76  SAL_DLLPRIVATE bool implWrite(const GalleryTheme& rTheme, const GalleryThemeEntry* pThm);
77 
78  void insertObject(const SgaObject& rObj, GalleryObject* pFoundEntry, sal_uInt32 nInsertPos);
79  void removeObject(const std::unique_ptr<GalleryObject>& pEntry);
80 
81  std::unique_ptr<SgaObject> implReadSgaObject(GalleryObject const* pEntry);
82  bool implWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos, GalleryObject* pExistentEntry);
83 
84  bool readModel(const GalleryObject* pObject, SdrModel& rModel);
85  SgaObjectSvDraw insertModel(const FmFormModel& rModel, const INetURLObject& rUserURL);
86 
87  bool readModelStream(const GalleryObject* pObject,
88  tools::SvRef<SotTempStream> const& rxModelStream);
89  SgaObjectSvDraw insertModelStream(const tools::SvRef<SotTempStream>& rxModelStream,
90  const INetURLObject& rUserURL);
91 
92  INetURLObject implCreateUniqueURL(SgaObjKind eObjKind, const INetURLObject& rUserURL,
93  ConvertDataFormat nFormat = ConvertDataFormat::Unknown);
94 
95  SgaObjectBmp insertGraphic(const Graphic& rGraphic, const GfxLink& aGfxLink,
96  const ConvertDataFormat& nExportFormat,
97  const INetURLObject& rUserURL);
98 
99  SgaObjectSvDraw updateSvDrawObject(const GalleryObject* pEntry);
100 
101  void updateTheme();
102  static void insertFileOrDirURL(const INetURLObject& rFileOrDirURL,
103  std::vector<INetURLObject>& rURLVector);
104 
105  SvStream& writeGalleryTheme(SvStream& rOStm, const GalleryTheme& rTheme,
106  const GalleryThemeEntry* pThm);
107 
108  DateTime getModificationDate() const;
109 };
110 
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool bReadOnly
const INetURLObject & getThemeURL() const
tools::SvRef< SotStorage > m_aSvDrawStorageRef
const INetURLObject & GetStrURL() const
const INetURLObject & GetSdvURL() const
const INetURLObject & GetStrURL() const
SgaObjKind
Definition: galmisc.hxx:55
const INetURLObject & GetThmURL() const
ConvertDataFormat
const INetURLObject & GetSdgURL() const
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
const INetURLObject & GetSdgURL() const
const INetURLObject & getThemeURL() const
const INetURLObject & GetThmURL() const
const GalleryBinaryStorageLocations & maGalleryStorageLocations
const INetURLObject & GetSdvURL() const
GalleryObjectCollection & mrGalleryObjectCollection