Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / dialog / ThemeColorEditDialog.cxx
blob4b5e60a8b2a2edc1b66c506a5573bc47c53f27bd
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 #include <svx/dialog/ThemeColorEditDialog.hxx>
11 #include <vcl/svapp.hxx>
12 #include <svx/colorbox.hxx>
14 namespace svx
16 ThemeColorEditDialog::ThemeColorEditDialog(weld::Window* pParent, model::ColorSet& rColorSet)
17 : GenericDialogController(pParent, "svx/ui/themecoloreditdialog.ui", "ThemeColorEditDialog")
18 , maColorSet(rColorSet)
19 , mxThemeColorsNameEntry(m_xBuilder->weld_entry("entryThemeColorsName"))
20 , mxDark1(new ColorListBox(m_xBuilder->weld_menu_button("buttonDark1"),
21 [pParent] { return pParent; }))
22 , mxLight1(new ColorListBox(m_xBuilder->weld_menu_button("buttonLight1"),
23 [pParent] { return pParent; }))
24 , mxDark2(new ColorListBox(m_xBuilder->weld_menu_button("buttonDark2"),
25 [pParent] { return pParent; }))
26 , mxLight2(new ColorListBox(m_xBuilder->weld_menu_button("buttonLight2"),
27 [pParent] { return pParent; }))
28 , mxAccent1(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent1"),
29 [pParent] { return pParent; }))
30 , mxAccent2(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent2"),
31 [pParent] { return pParent; }))
32 , mxAccent3(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent3"),
33 [pParent] { return pParent; }))
34 , mxAccent4(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent4"),
35 [pParent] { return pParent; }))
36 , mxAccent5(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent5"),
37 [pParent] { return pParent; }))
38 , mxAccent6(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent6"),
39 [pParent] { return pParent; }))
40 , mxHyperlink(new ColorListBox(m_xBuilder->weld_menu_button("buttonHyperlink"),
41 [pParent] { return pParent; }))
42 , mxFollowHyperlink(new ColorListBox(m_xBuilder->weld_menu_button("buttonFollowHyperlink"),
43 [pParent] { return pParent; }))
45 mxThemeColorsNameEntry->set_text(rColorSet.getName());
46 mxDark1->SelectEntry(rColorSet.getColor(model::ThemeColorType::Dark1));
47 mxLight1->SelectEntry(rColorSet.getColor(model::ThemeColorType::Light1));
48 mxDark2->SelectEntry(rColorSet.getColor(model::ThemeColorType::Dark2));
49 mxLight2->SelectEntry(rColorSet.getColor(model::ThemeColorType::Light2));
50 mxAccent1->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent1));
51 mxAccent2->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent2));
52 mxAccent3->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent3));
53 mxAccent4->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent4));
54 mxAccent5->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent5));
55 mxAccent6->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent6));
56 mxHyperlink->SelectEntry(rColorSet.getColor(model::ThemeColorType::Hyperlink));
57 mxFollowHyperlink->SelectEntry(rColorSet.getColor(model::ThemeColorType::FollowedHyperlink));
60 ThemeColorEditDialog::~ThemeColorEditDialog() = default;
62 model::ColorSet ThemeColorEditDialog::getColorSet()
64 OUString aName = mxThemeColorsNameEntry->get_text();
66 model::ColorSet aColorSet(aName);
68 if (!aName.isEmpty())
70 aColorSet.add(model::ThemeColorType::Dark1, mxDark1->GetSelectEntryColor());
71 aColorSet.add(model::ThemeColorType::Light1, mxLight1->GetSelectEntryColor());
72 aColorSet.add(model::ThemeColorType::Dark2, mxDark2->GetSelectEntryColor());
73 aColorSet.add(model::ThemeColorType::Light2, mxLight2->GetSelectEntryColor());
74 aColorSet.add(model::ThemeColorType::Accent1, mxAccent1->GetSelectEntryColor());
75 aColorSet.add(model::ThemeColorType::Accent2, mxAccent2->GetSelectEntryColor());
76 aColorSet.add(model::ThemeColorType::Accent3, mxAccent3->GetSelectEntryColor());
77 aColorSet.add(model::ThemeColorType::Accent4, mxAccent4->GetSelectEntryColor());
78 aColorSet.add(model::ThemeColorType::Accent5, mxAccent5->GetSelectEntryColor());
79 aColorSet.add(model::ThemeColorType::Accent6, mxAccent6->GetSelectEntryColor());
80 aColorSet.add(model::ThemeColorType::Hyperlink, mxHyperlink->GetSelectEntryColor());
81 aColorSet.add(model::ThemeColorType::FollowedHyperlink,
82 mxFollowHyperlink->GetSelectEntryColor());
84 return aColorSet;
87 } // end svx namespace
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */