cid#1636690 Dereference after null check
[LibreOffice.git] / cui / source / options / personalization.hxx
blob786b22c7d7b37fb77e362b346f4e99d04df44b3f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #pragma once
12 #include <sfx2/tabdlg.hxx>
13 #include <vector>
15 #define MAX_DEFAULT_PERSONAS 6 // Maximum number of default personas
17 class SvxPersonalizationTabPage : public SfxTabPage
19 private:
20 std::unique_ptr<weld::RadioButton> m_xNoPersona; ///< Just the default look, without any bitmap
21 std::unique_ptr<weld::Widget> m_xPersonaImg;
22 std::unique_ptr<weld::RadioButton> m_xDefaultPersona; ///< Use the built-in bitmap
23 std::unique_ptr<weld::Container> m_xContentGrid;
24 std::unique_ptr<weld::ToggleButton> m_vDefaultPersonaImages
25 [MAX_DEFAULT_PERSONAS]; ///< Buttons to show the default persona images
26 OUString m_aPersonaSettings; ///< Header and footer images + color to be set in the settings.
28 std::vector<OUString> m_vDefaultPersonaSettings;
30 public:
31 SvxPersonalizationTabPage(weld::Container* pPage, weld::DialogController* pController,
32 const SfxItemSet& rSet);
33 virtual ~SvxPersonalizationTabPage() override;
35 static std::unique_ptr<SfxTabPage>
36 Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
38 virtual OUString GetAllStrings() override;
40 /// Apply the settings ([OK] button).
41 virtual bool FillItemSet(SfxItemSet* rSet) override;
43 /// Reset to default settings ([Revert] button).
44 virtual void Reset(const SfxItemSet* rSet) override;
47 * Loads the default personas from the shared personas directory
48 * which resides in the shared gallery.
49 * There needs to be a separate subdirectory for each default persona,
50 * which includes the preview, header, and footer images.
51 * And there needs to be a personas_list.txt file in the personas directory
52 * which keeps the index/info of the default personas, one persona per line.
53 * A line should look like this:
54 * persona_slug;Persona Name;subdir/preview.jpg;subdir/header.jpg;subdir/footer.jpg;#textcolor
55 * (It is recommended to keep the subdir name the same as the slug)
56 * Example line:
57 * abstract;Abstract;abstract/preview.jpg;abstract/Header2.jpg;abstract/Footer2.jpg;#ffffff
59 void LoadDefaultImages();
61 private:
62 /// Handle the default Persona selection
63 DECL_LINK(DefaultPersona, weld::Button&, void);
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */