LibreOffice Module svx (master) 1
ThemeColorEditDialog.cxx
Go to the documentation of this file.
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
11#include <vcl/svapp.hxx>
12#include <svx/colorbox.hxx>
13
14namespace svx
15{
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; }))
44{
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));
58}
59
61
63{
64 OUString aName = mxThemeColorsNameEntry->get_text();
65
66 model::ColorSet aColorSet(aName);
67
68 if (!aName.isEmpty())
69 {
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());
82 mxFollowHyperlink->GetSelectEntryColor());
83 }
84 return aColorSet;
85}
86
87} // end svx namespace
88
89/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void add(model::ThemeColorType Type, Color aColorData)
std::unique_ptr< ColorListBox > mxHyperlink
std::unique_ptr< weld::Entry > mxThemeColorsNameEntry
std::unique_ptr< ColorListBox > mxFollowHyperlink
std::unique_ptr< ColorListBox > mxLight2
std::unique_ptr< ColorListBox > mxDark1
std::unique_ptr< ColorListBox > mxAccent1
std::unique_ptr< ColorListBox > mxAccent6
std::unique_ptr< ColorListBox > mxDark2
virtual ~ThemeColorEditDialog() override
std::unique_ptr< ColorListBox > mxAccent3
std::unique_ptr< ColorListBox > mxAccent5
ThemeColorEditDialog(weld::Window *pParent, model::ColorSet &rColorSet)
std::unique_ptr< ColorListBox > mxAccent4
std::unique_ptr< ColorListBox > mxAccent2
std::unique_ptr< ColorListBox > mxLight1
OUString aName