1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <svx/galmisc.hxx>
23 #include <svx/svxdllapi.h>
24 #include <svx/fmmodel.hxx>
25 #include "gallerystoragelocations.hxx"
26 #include "galleryfilestorage.hxx"
27 #include <tools/urlobj.hxx>
28 #include <sot/storage.hxx>
29 #include <vcl/salctype.hxx>
31 #include <tools/datetime.hxx>
35 class GalleryObjectCollection
;
36 class SgaObjectSvDraw
;
43 class GalleryThemeEntry
;
45 class SVXCORE_DLLPUBLIC GalleryFileStorage final
48 tools::SvRef
<SotStorage
> m_aSvDrawStorageRef
;
49 const GalleryStorageLocations
& maGalleryStorageLocations
;
50 GalleryObjectCollection
& mrGalleryObjectCollection
;
53 bool m_bDestDirRelative
;
55 const INetURLObject
& GetSdgURL() const { return maGalleryStorageLocations
.GetSdgURL(); }
56 const INetURLObject
& GetSdvURL() const { return maGalleryStorageLocations
.GetSdvURL(); }
57 const INetURLObject
& GetStrURL() const { return maGalleryStorageLocations
.GetStrURL(); }
58 const INetURLObject
& GetThmURL() const { return maGalleryStorageLocations
.GetThmURL(); }
61 GalleryFileStorage(const GalleryStorageLocations
& rGalleryStorageLocations
,
62 GalleryObjectCollection
& rGalleryObjectCollection
, bool bReadOnly
);
63 SAL_DLLPRIVATE
~GalleryFileStorage();
65 void clearSotStorage();
67 void setDestDir(const OUString
& rDestDir
, bool bRelative
);
69 SAL_DLLPRIVATE
void ImplCreateSvDrawStorage();
70 SAL_DLLPRIVATE
const tools::SvRef
<SotStorage
>& GetSvDrawStorage() const;
72 const INetURLObject
& getThemeURL() const { return maGalleryStorageLocations
.getThemeURL(); }
74 SAL_DLLPRIVATE
bool implWrite(const GalleryTheme
& rTheme
, const GalleryThemeEntry
* pThm
);
76 void insertObject(const SgaObject
& rObj
, GalleryObject
* pFoundEntry
, sal_uInt32 nInsertPos
);
77 void removeObject(const std::unique_ptr
<GalleryObject
>& pEntry
);
79 std::unique_ptr
<SgaObject
> implReadSgaObject(GalleryObject
const* pEntry
);
80 bool implWriteSgaObject(const SgaObject
& rObj
, sal_uInt32 nPos
, GalleryObject
* pExistentEntry
);
82 bool readModel(const GalleryObject
* pObject
, SdrModel
& rModel
);
83 SgaObjectSvDraw
insertModel(const FmFormModel
& rModel
, const INetURLObject
& rUserURL
);
85 bool readModelStream(const GalleryObject
* pObject
,
86 tools::SvRef
<SotTempStream
> const& rxModelStream
);
87 SgaObjectSvDraw
insertModelStream(const tools::SvRef
<SotTempStream
>& rxModelStream
,
88 const INetURLObject
& rUserURL
);
90 INetURLObject
implCreateUniqueURL(SgaObjKind eObjKind
, const INetURLObject
& rUserURL
,
91 ConvertDataFormat nFormat
= ConvertDataFormat::Unknown
);
93 SgaObjectBmp
insertGraphic(const Graphic
& rGraphic
, const GfxLink
& aGfxLink
,
94 const ConvertDataFormat
& nExportFormat
,
95 const INetURLObject
& rUserURL
);
97 SgaObjectSvDraw
updateSvDrawObject(const GalleryObject
* pEntry
);
100 static void insertFileOrDirURL(const INetURLObject
& rFileOrDirURL
,
101 std::vector
<INetURLObject
>& rURLVector
);
103 SvStream
& writeGalleryTheme(SvStream
& rOStm
, const GalleryTheme
& rTheme
,
104 const GalleryThemeEntry
* pThm
);
106 DateTime
getModificationDate() const;
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */