/src/libreoffice/svx/inc/galleryfilestorage.hxx
Line | Count | Source (jump to first uncovered line) |
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> |
25 | | #include "gallerystoragelocations.hxx" |
26 | | #include <tools/urlobj.hxx> |
27 | | #include <sot/storage.hxx> |
28 | | #include <vcl/salctype.hxx> |
29 | | |
30 | | #include <tools/datetime.hxx> |
31 | | |
32 | | #include <memory> |
33 | | |
34 | | class GalleryObjectCollection; |
35 | | class SgaObjectSvDraw; |
36 | | class SgaObjectBmp; |
37 | | class SgaObject; |
38 | | class SotStorage; |
39 | | struct GalleryObject; |
40 | | class FmFormModel; |
41 | | class GalleryTheme; |
42 | | class GalleryThemeEntry; |
43 | | |
44 | | class GalleryFileStorage final |
45 | | { |
46 | | private: |
47 | | rtl::Reference<SotStorage> m_aSvDrawStorageRef; |
48 | | const GalleryStorageLocations& maGalleryStorageLocations; |
49 | | GalleryObjectCollection& mrGalleryObjectCollection; |
50 | | bool mbReadOnly; |
51 | | OUString m_aDestDir; |
52 | | bool m_bDestDirRelative; |
53 | | |
54 | 0 | const INetURLObject& GetSdgURL() const { return maGalleryStorageLocations.GetSdgURL(); } |
55 | 0 | const INetURLObject& GetSdvURL() const { return maGalleryStorageLocations.GetSdvURL(); } |
56 | 0 | const INetURLObject& GetThmURL() const { return maGalleryStorageLocations.GetThmURL(); } |
57 | | |
58 | | public: |
59 | | GalleryFileStorage(const GalleryStorageLocations& rGalleryStorageLocations, |
60 | | GalleryObjectCollection& rGalleryObjectCollection, bool bReadOnly); |
61 | | ~GalleryFileStorage(); |
62 | | |
63 | | void clearSotStorage(); |
64 | | |
65 | | void setDestDir(const OUString& rDestDir, bool bRelative); |
66 | | |
67 | | void ImplCreateSvDrawStorage(); |
68 | | const rtl::Reference<SotStorage>& GetSvDrawStorage() const; |
69 | | |
70 | 0 | const INetURLObject& getThemeURL() const { return maGalleryStorageLocations.getThemeURL(); } |
71 | | |
72 | | bool implWrite(const GalleryTheme& rTheme, const GalleryThemeEntry* pThm); |
73 | | |
74 | | void insertObject(const SgaObject& rObj, GalleryObject* pFoundEntry, sal_uInt32 nInsertPos); |
75 | | void removeObject(const std::unique_ptr<GalleryObject>& pEntry); |
76 | | |
77 | | UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) |
78 | | std::unique_ptr<SgaObject> implReadSgaObject(GalleryObject const* pEntry); |
79 | | bool implWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos, GalleryObject* pExistentEntry); |
80 | | |
81 | | bool readModel(const GalleryObject* pObject, SdrModel& rModel); |
82 | | SgaObjectSvDraw insertModel(const FmFormModel& rModel, const INetURLObject& rUserURL); |
83 | | |
84 | | bool readModelStream(const GalleryObject* pObject, SvStream& rModelStream); |
85 | | SgaObjectSvDraw insertModelStream(SvStream& rModelStream, const INetURLObject& rUserURL); |
86 | | |
87 | | INetURLObject implCreateUniqueURL(SgaObjKind eObjKind, const INetURLObject& rUserURL, |
88 | | ConvertDataFormat nFormat = ConvertDataFormat::Unknown); |
89 | | |
90 | | SgaObjectBmp insertGraphic(const Graphic& rGraphic, const GfxLink& aGfxLink, |
91 | | const ConvertDataFormat& nExportFormat, |
92 | | const INetURLObject& rUserURL); |
93 | | |
94 | | SgaObjectSvDraw updateSvDrawObject(const GalleryObject* pEntry); |
95 | | |
96 | | void updateTheme(); |
97 | | static void insertFileOrDirURL(const INetURLObject& rFileOrDirURL, |
98 | | std::vector<INetURLObject>& rURLVector); |
99 | | |
100 | | SvStream& writeGalleryTheme(SvStream& rOStm, const GalleryTheme& rTheme, |
101 | | const GalleryThemeEntry* pThm); |
102 | | |
103 | | DateTime getModificationDate() const; |
104 | | }; |
105 | | |
106 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |