summaryrefslogtreecommitdiff
path: root/include/svx/gallerybinaryengine.hxx
blob: 20be0b6cdfe0805c6fde0c6d08c3a50c65a29ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#pragma once

#include <tools/urlobj.hxx>
#include <svx/svxdllapi.h>
#include <svx/galtheme.hxx>
#include <sot/storage.hxx>

class SotStorage;
struct GalleryObject;

class SVXCORE_DLLPUBLIC GalleryBinaryEngine
{
private:
    INetURLObject aThmURL;
    INetURLObject aSdgURL;
    INetURLObject aSdvURL;
    INetURLObject aStrURL;
    tools::SvRef<SotStorage> aSvDrawStorageRef;

    static INetURLObject ImplGetURLIgnoreCase(const INetURLObject& rURL);

public:
    void galleryThemeInit(bool bReadOnly);
    void galleryThemeDestroy();

    static void CreateUniqueURL(const INetURLObject& rBaseURL, INetURLObject& aURL);

    OUString ReadStrFromIni(const OUString& aKeyName);

    void SetThmExtension(INetURLObject aURL);
    void SetSdgExtension(INetURLObject aURL);
    void SetSdvExtension(INetURLObject aURL);
    void SetStrExtension(INetURLObject aURL);

    const INetURLObject& GetThmURL() const { return aThmURL; }
    const INetURLObject& GetSdgURL() const { return aSdgURL; }
    const INetURLObject& GetSdvURL() const { return aSdvURL; }
    const INetURLObject& GetStrURL() const { return aStrURL; }

    SAL_DLLPRIVATE void ImplCreateSvDrawStorage(bool bReadOnly);
    SAL_DLLPRIVATE const tools::SvRef<SotStorage>& GetSvDrawStorage() const;

    std::unique_ptr<SgaObject> implReadSgaObject(GalleryObject const* pEntry);
    bool implWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos, GalleryObject* pExistentEntry,
                            OUString& aDestDir,
                            ::std::vector<std::unique_ptr<GalleryObject>>& aObjectList);
    SAL_DLLPRIVATE bool implWrite(const GalleryTheme& rTheme);
    SAL_DLLPRIVATE static INetURLObject
    implCreateUniqueURL(SgaObjKind eObjKind, const INetURLObject& rUserURL,
                        ::std::vector<std::unique_ptr<GalleryObject>>& rObjectList,
                        ConvertDataFormat nFormat = ConvertDataFormat::Unknown);
};

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */