diff options
-rw-r--r-- | include/docmodel/theme/ColorSet.hxx | 2 | ||||
-rw-r--r-- | include/svx/ColorSets.hxx | 3 | ||||
-rw-r--r-- | include/svx/dialog/ThemeColorEditDialog.hxx | 47 | ||||
-rw-r--r-- | include/svx/dialog/ThemeDialog.hxx | 23 | ||||
-rw-r--r-- | svx/Library_svx.mk | 1 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 1 | ||||
-rw-r--r-- | svx/source/dialog/ThemeColorEditDialog.cxx | 89 | ||||
-rw-r--r-- | svx/source/dialog/ThemeColorValueSet.cxx | 4 | ||||
-rw-r--r-- | svx/source/dialog/ThemeDialog.cxx | 76 | ||||
-rw-r--r-- | svx/source/styles/ColorSets.cxx | 51 | ||||
-rw-r--r-- | svx/uiconfig/ui/themecoloreditdialog.ui | 601 | ||||
-rw-r--r-- | svx/uiconfig/ui/themedialog.ui | 43 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 14 |
13 files changed, 920 insertions, 35 deletions
diff --git a/include/docmodel/theme/ColorSet.hxx b/include/docmodel/theme/ColorSet.hxx index 6e7fa94eafee..d803fbc3e668 100644 --- a/include/docmodel/theme/ColorSet.hxx +++ b/include/docmodel/theme/ColorSet.hxx @@ -29,6 +29,8 @@ class DOCMODEL_DLLPUBLIC ColorSet public: ColorSet(OUString const& rName); + void setName(OUString const& rName) { maName = rName; } + void add(model::ThemeColorType Type, Color aColorData); const OUString& getName() const { return maName; } diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index cb096dab0e87..f95859044b28 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -27,6 +27,7 @@ private: ColorSets(); void init(); public: + enum class IdenticalNameAction { Overwrite, AutoRename }; static ColorSets& get(); const std::vector<model::ColorSet>& getColorSetVector() const @@ -41,7 +42,7 @@ public: model::ColorSet const* getColorSet(std::u16string_view rName) const; - void insert(model::ColorSet const& rColorSet); + void insert(model::ColorSet const& rColorSet, IdenticalNameAction eAction = IdenticalNameAction::Overwrite); }; } // end of namespace svx diff --git a/include/svx/dialog/ThemeColorEditDialog.hxx b/include/svx/dialog/ThemeColorEditDialog.hxx new file mode 100644 index 000000000000..6111607fe033 --- /dev/null +++ b/include/svx/dialog/ThemeColorEditDialog.hxx @@ -0,0 +1,47 @@ +/* -*- 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/. + */ + +#pragma once + +#include <svx/svxdllapi.h> +#include <vcl/weld.hxx> +#include <docmodel/theme/ColorSet.hxx> + +class ColorListBox; + +namespace svx +{ +class SVX_DLLPUBLIC ThemeColorEditDialog final : public weld::GenericDialogController +{ +private: + model::ColorSet maColorSet; + + std::unique_ptr<weld::Entry> mxThemeColorsNameEntry; + std::unique_ptr<ColorListBox> mxDark1; + std::unique_ptr<ColorListBox> mxLight1; + std::unique_ptr<ColorListBox> mxDark2; + std::unique_ptr<ColorListBox> mxLight2; + std::unique_ptr<ColorListBox> mxAccent1; + std::unique_ptr<ColorListBox> mxAccent2; + std::unique_ptr<ColorListBox> mxAccent3; + std::unique_ptr<ColorListBox> mxAccent4; + std::unique_ptr<ColorListBox> mxAccent5; + std::unique_ptr<ColorListBox> mxAccent6; + std::unique_ptr<ColorListBox> mxHyperlink; + std::unique_ptr<ColorListBox> mxFollowHyperlink; + +public: + ThemeColorEditDialog(weld::Window* pParent, model::ColorSet& rColorSet); + virtual ~ThemeColorEditDialog() override; + model::ColorSet getColorSet(); +}; + +} // end svx namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/dialog/ThemeDialog.hxx b/include/svx/dialog/ThemeDialog.hxx index aa068f9528c1..d715894f027a 100644 --- a/include/svx/dialog/ThemeDialog.hxx +++ b/include/svx/dialog/ThemeDialog.hxx @@ -14,32 +14,45 @@ #include <svx/svdpage.hxx> #include <svx/theme/IThemeColorChanger.hxx> #include <svx/dialog/ThemeColorValueSet.hxx> +#include <functional> namespace model { class Theme; } +class ColorListBox; + namespace svx { class SVX_DLLPUBLIC ThemeDialog final : public weld::GenericDialogController { private: + weld::Window* mpWindow; model::Theme* mpTheme; std::vector<model::ColorSet> maColorSets; - std::shared_ptr<IThemeColorChanger> mpChanger; - std::unique_ptr<svx::ThemeColorValueSet> mxValueSetThemeColors; std::unique_ptr<weld::CustomWeld> mxValueSetThemeColorsWindow; + std::unique_ptr<weld::Button> mxAdd; + + std::optional<std::reference_wrapper<model::ColorSet>> moCurrentColorSet; + + void runThemeColorEditDialog(); + void initColorSets(); public: - ThemeDialog(weld::Window* pParent, model::Theme* pTheme, - std::shared_ptr<IThemeColorChanger> const& pChanger); + ThemeDialog(weld::Window* pParent, model::Theme* pTheme); virtual ~ThemeDialog() override; DECL_LINK(DoubleClickValueSetHdl, ValueSet*, void); - void DoubleClickHdl(); + DECL_LINK(SelectItem, ValueSet*, void); + DECL_LINK(ButtonClicked, weld::Button&, void); + + std::optional<std::reference_wrapper<model::ColorSet>> const& getCurrentColorSet() + { + return moCurrentColorSet; + } }; } // end svx namespace diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 7a8cd93577e6..2240211e2c23 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -176,6 +176,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/dialog/swframeposstrings \ svx/source/dialog/ThemeColorValueSet \ svx/source/dialog/ThemeDialog \ + svx/source/dialog/ThemeColorEditDialog \ svx/source/dialog/txencbox \ svx/source/dialog/txenctab \ svx/source/dialog/weldeditview \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index 23d866c7c3ac..a5fbbe9a6e95 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -142,6 +142,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/textcontrolparadialog \ svx/uiconfig/ui/textunderlinecontrol \ svx/uiconfig/ui/themedialog \ + svx/uiconfig/ui/themecoloreditdialog \ svx/uiconfig/ui/toolbarpopover \ svx/uiconfig/ui/xmlsecstatmenu \ svx/uiconfig/ui/xformspage \ diff --git a/svx/source/dialog/ThemeColorEditDialog.cxx b/svx/source/dialog/ThemeColorEditDialog.cxx new file mode 100644 index 000000000000..4b5e60a8b2a2 --- /dev/null +++ b/svx/source/dialog/ThemeColorEditDialog.cxx @@ -0,0 +1,89 @@ +/* -*- 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/. + */ + +#include <svx/dialog/ThemeColorEditDialog.hxx> +#include <vcl/svapp.hxx> +#include <svx/colorbox.hxx> + +namespace svx +{ +ThemeColorEditDialog::ThemeColorEditDialog(weld::Window* pParent, model::ColorSet& rColorSet) + : GenericDialogController(pParent, "svx/ui/themecoloreditdialog.ui", "ThemeColorEditDialog") + , maColorSet(rColorSet) + , mxThemeColorsNameEntry(m_xBuilder->weld_entry("entryThemeColorsName")) + , mxDark1(new ColorListBox(m_xBuilder->weld_menu_button("buttonDark1"), + [pParent] { return pParent; })) + , mxLight1(new ColorListBox(m_xBuilder->weld_menu_button("buttonLight1"), + [pParent] { return pParent; })) + , mxDark2(new ColorListBox(m_xBuilder->weld_menu_button("buttonDark2"), + [pParent] { return pParent; })) + , mxLight2(new ColorListBox(m_xBuilder->weld_menu_button("buttonLight2"), + [pParent] { return pParent; })) + , mxAccent1(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent1"), + [pParent] { return pParent; })) + , mxAccent2(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent2"), + [pParent] { return pParent; })) + , mxAccent3(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent3"), + [pParent] { return pParent; })) + , mxAccent4(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent4"), + [pParent] { return pParent; })) + , mxAccent5(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent5"), + [pParent] { return pParent; })) + , mxAccent6(new ColorListBox(m_xBuilder->weld_menu_button("buttonAccent6"), + [pParent] { return pParent; })) + , mxHyperlink(new ColorListBox(m_xBuilder->weld_menu_button("buttonHyperlink"), + [pParent] { return pParent; })) + , mxFollowHyperlink(new ColorListBox(m_xBuilder->weld_menu_button("buttonFollowHyperlink"), + [pParent] { return pParent; })) +{ + mxThemeColorsNameEntry->set_text(rColorSet.getName()); + mxDark1->SelectEntry(rColorSet.getColor(model::ThemeColorType::Dark1)); + mxLight1->SelectEntry(rColorSet.getColor(model::ThemeColorType::Light1)); + mxDark2->SelectEntry(rColorSet.getColor(model::ThemeColorType::Dark2)); + mxLight2->SelectEntry(rColorSet.getColor(model::ThemeColorType::Light2)); + mxAccent1->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent1)); + mxAccent2->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent2)); + mxAccent3->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent3)); + mxAccent4->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent4)); + mxAccent5->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent5)); + mxAccent6->SelectEntry(rColorSet.getColor(model::ThemeColorType::Accent6)); + mxHyperlink->SelectEntry(rColorSet.getColor(model::ThemeColorType::Hyperlink)); + mxFollowHyperlink->SelectEntry(rColorSet.getColor(model::ThemeColorType::FollowedHyperlink)); +} + +ThemeColorEditDialog::~ThemeColorEditDialog() = default; + +model::ColorSet ThemeColorEditDialog::getColorSet() +{ + OUString aName = mxThemeColorsNameEntry->get_text(); + + model::ColorSet aColorSet(aName); + + if (!aName.isEmpty()) + { + aColorSet.add(model::ThemeColorType::Dark1, mxDark1->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Light1, mxLight1->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Dark2, mxDark2->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Light2, mxLight2->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Accent1, mxAccent1->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Accent2, mxAccent2->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Accent3, mxAccent3->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Accent4, mxAccent4->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Accent5, mxAccent5->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Accent6, mxAccent6->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::Hyperlink, mxHyperlink->GetSelectEntryColor()); + aColorSet.add(model::ThemeColorType::FollowedHyperlink, + mxFollowHyperlink->GetSelectEntryColor()); + } + return aColorSet; +} + +} // end svx namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/ThemeColorValueSet.cxx b/svx/source/dialog/ThemeColorValueSet.cxx index bc0356b2b711..aa0abe0bad66 100644 --- a/svx/source/dialog/ThemeColorValueSet.cxx +++ b/svx/source/dialog/ThemeColorValueSet.cxx @@ -13,8 +13,8 @@ namespace svx { -constexpr tools::Long BORDER = 3; -constexpr tools::Long SIZE = 14; +constexpr tools::Long BORDER = 4; +constexpr tools::Long SIZE = 16; constexpr tools::Long LABEL_HEIGHT = 16; constexpr tools::Long LABEL_TEXT_HEIGHT = 14; constexpr tools::Long constElementNumber = 8; diff --git a/svx/source/dialog/ThemeDialog.cxx b/svx/source/dialog/ThemeDialog.cxx index 9da0e48bf13b..c440292b723d 100644 --- a/svx/source/dialog/ThemeDialog.cxx +++ b/svx/source/dialog/ThemeDialog.cxx @@ -8,30 +8,49 @@ */ #include <svx/dialog/ThemeDialog.hxx> +#include <svx/dialog/ThemeColorEditDialog.hxx> #include <docmodel/theme/ThemeColor.hxx> #include <docmodel/theme/ColorSet.hxx> #include <docmodel/theme/Theme.hxx> #include <svx/ColorSets.hxx> #include <vcl/svapp.hxx> +#include <svx/colorbox.hxx> namespace svx { -ThemeDialog::ThemeDialog(weld::Window* pParent, model::Theme* pTheme, - std::shared_ptr<IThemeColorChanger> const& pChanger) +ThemeDialog::ThemeDialog(weld::Window* pParent, model::Theme* pTheme) : GenericDialogController(pParent, "svx/ui/themedialog.ui", "ThemeDialog") + , mpWindow(pParent) , mpTheme(pTheme) - , mpChanger(pChanger) , mxValueSetThemeColors(new svx::ThemeColorValueSet) , mxValueSetThemeColorsWindow( new weld::CustomWeld(*m_xBuilder, "valueset_theme_colors", *mxValueSetThemeColors)) + , mxAdd(m_xBuilder->weld_button("button_add")) { - mxValueSetThemeColors->SetColCount(2); - mxValueSetThemeColors->SetLineCount(6); + mxValueSetThemeColors->SetColCount(3); + mxValueSetThemeColors->SetLineCount(4); mxValueSetThemeColors->SetColor(Application::GetSettings().GetStyleSettings().GetFaceColor()); mxValueSetThemeColors->SetDoubleClickHdl(LINK(this, ThemeDialog, DoubleClickValueSetHdl)); + mxValueSetThemeColors->SetSelectHdl(LINK(this, ThemeDialog, SelectItem)); + mxAdd->connect_clicked(LINK(this, ThemeDialog, ButtonClicked)); + + initColorSets(); + + if (!maColorSets.empty()) + { + mxValueSetThemeColors->SelectItem(1); // ItemId 1, position 0 + moCurrentColorSet = std::ref(maColorSets[0]); + } +} + +ThemeDialog::~ThemeDialog() = default; + +void ThemeDialog::initColorSets() +{ if (mpTheme) maColorSets.push_back(*mpTheme->GetColorSet()); + auto const& rColorSetVector = ColorSets::get().getColorSetVector(); maColorSets.insert(maColorSets.end(), rColorSetVector.begin(), rColorSetVector.end()); @@ -41,16 +60,15 @@ ThemeDialog::ThemeDialog(weld::Window* pParent, model::Theme* pTheme, } mxValueSetThemeColors->SetOptimalSize(); - - if (!rColorSetVector.empty()) - mxValueSetThemeColors->SelectItem(1); // ItemId 1, position 0 } -ThemeDialog::~ThemeDialog() = default; - -IMPL_LINK_NOARG(ThemeDialog, DoubleClickValueSetHdl, ValueSet*, void) { DoubleClickHdl(); } +IMPL_LINK_NOARG(ThemeDialog, DoubleClickValueSetHdl, ValueSet*, void) +{ + SelectItem(nullptr); + m_xDialog->response(RET_OK); +} -void ThemeDialog::DoubleClickHdl() +IMPL_LINK_NOARG(ThemeDialog, SelectItem, ValueSet*, void) { sal_uInt32 nItemId = mxValueSetThemeColors->GetSelectedItemId(); if (!nItemId) @@ -58,10 +76,38 @@ void ThemeDialog::DoubleClickHdl() sal_uInt32 nIndex = nItemId - 1; - if (nIndex < maColorSets.size()) + if (nIndex >= maColorSets.size()) + return; + + moCurrentColorSet = std::ref(maColorSets[nIndex]); +} + +void ThemeDialog::runThemeColorEditDialog() +{ + auto pDialog = std::make_shared<svx::ThemeColorEditDialog>(mpWindow, *moCurrentColorSet); + weld::DialogController::runAsync(pDialog, [this, pDialog](sal_uInt32 nResult) { + if (nResult != RET_OK) + return; + auto aColorSet = pDialog->getColorSet(); + if (!aColorSet.getName().isEmpty()) + { + ColorSets::get().insert(aColorSet, ColorSets::IdenticalNameAction::AutoRename); + maColorSets.clear(); + mxValueSetThemeColors->Clear(); + + initColorSets(); + + mxValueSetThemeColors->SelectItem(maColorSets.size() - 1); + moCurrentColorSet = std::ref(maColorSets[maColorSets.size() - 1]); + } + }); +} + +IMPL_LINK(ThemeDialog, ButtonClicked, weld::Button&, rButton, void) +{ + if (moCurrentColorSet && mxAdd.get() == &rButton) { - model::ColorSet const& rColorSet = maColorSets[nIndex]; - mpChanger->apply(rColorSet); + runThemeColorEditDialog(); } } diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx index 438a9a36b01c..cfdeb83df442 100644 --- a/svx/source/styles/ColorSets.cxx +++ b/svx/source/styles/ColorSets.cxx @@ -11,6 +11,7 @@ #include <svx/ColorSets.hxx> #include <utility> +#include <unordered_set> #include <docmodel/theme/ColorSet.hxx> using namespace com::sun::star; @@ -157,20 +158,56 @@ model::ColorSet const* ColorSets::getColorSet(std::u16string_view rName) const } return nullptr; } +namespace +{ -void ColorSets::insert(model::ColorSet const& rNewColorSet) +OUString findUniqueName(std::unordered_set<OUString> const& rNames, OUString const& rNewName) { - for (model::ColorSet& rColorSet : maColorSets) + auto iterator = rNames.find(rNewName); + if (iterator == rNames.cend()) + return rNewName; + + int i = 1; + OUString aName; + do { - if (rColorSet.getName() == rNewColorSet.getName()) + aName = rNewName + "_" + OUString::number(i); + i++; + iterator = rNames.find(aName); + } while (iterator != rNames.cend()); + + return aName; +} + +} // end anonymous namespace + +void ColorSets::insert(model::ColorSet const& rNewColorSet, IdenticalNameAction eAction) +{ + if (eAction == IdenticalNameAction::Overwrite) + { + for (model::ColorSet& rColorSet : maColorSets) { - rColorSet = rNewColorSet; - return; + if (rColorSet.getName() == rNewColorSet.getName()) + { + rColorSet = rNewColorSet; + return; + } } + // color set not found, so insert it + maColorSets.push_back(rNewColorSet); } + else if (eAction == IdenticalNameAction::AutoRename) + { + std::unordered_set<OUString> aNames; + for (model::ColorSet& rColorSet : maColorSets) + aNames.insert(rColorSet.getName()); - // color set not found, so insert it - maColorSets.push_back(rNewColorSet); + OUString aName = findUniqueName(aNames, rNewColorSet.getName()); + + model::ColorSet aNewColorSet = rNewColorSet; + aNewColorSet.setName(aName); + maColorSets.push_back(aNewColorSet); + } } } // end of namespace svx diff --git a/svx/uiconfig/ui/themecoloreditdialog.ui b/svx/uiconfig/ui/themecoloreditdialog.ui new file mode 100644 index 000000000000..51e0be981ab6 --- /dev/null +++ b/svx/uiconfig/ui/themecoloreditdialog.ui @@ -0,0 +1,601 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.40.0 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkDialog" id="ThemeColorEditDialog"> + <property name="width-request">400</property> + <property name="height-request">300</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border-width">6</property> + <property name="title" translatable="yes" context="themedialog|Title">Theme Color Edit</property> + <property name="type-hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialogBox1"> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialogButtons"> + <property name="can-focus">False</property> + <property name="layout-style">end</property> + <child> + <object class="GtkButton" id="help"> + <property name="label" translatable="yes" context="stock">_Help</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="ok"> + <property name="label" translatable="yes" context="stock">_OK</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label" translatable="yes" context="stock">_Cancel</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack-type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <!-- n-columns=2 n-rows=1 --> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <child> + <object class="GtkEntry" id="entryThemeColorsName"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="hexpand">True</property> + <property name="truncate-multiline">True</property> + <accessibility> + <relation type="labelled-by" target="labelThemeColorsName"/> + </accessibility> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelThemeColorsName"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelThemeColorsName">Name:</property> + <accessibility> + <relation type="label-for" target="entryThemeColorsName"/> + </accessibility> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label-xalign">0.019999999552965164</property> + <property name="shadow-type">in</property> + <child> + <!-- n-columns=4 n-rows=6 --> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> + <property name="margin-top">12</property> + <property name="margin-bottom">12</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> + <child> + <object class="GtkMenuButton" id="buttonDark1"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelDark1"/> + </accessibility> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonLight1"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelLight1"/> + </accessibility> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonDark2"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelDark2"/> + </accessibility> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelDark1"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelDark">Dark 1:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonDark1"/> + </accessibility> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelLight1"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelLight1">Light1:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonLight1"/> + </accessibility> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelDark2"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelDark2">Dark 2:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonDark2"/> + </accessibility> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelLight2"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelLight2">Light2:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonLight2"/> + </accessibility> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">3</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonLight2"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelLight2"/> + </accessibility> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelAccent1"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelAccent1">Accent 1:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonAccent1"/> + </accessibility> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelAccent2"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelAccent2">Accent 2:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonAccent2"/> + </accessibility> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonAccent1"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelAccent1"/> + </accessibility> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonAccent2"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelAccent2"/> + </accessibility> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelAccent3"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelAccent3">Accent 3:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonAccent3"/> + </accessibility> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelAccent4"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelAccent4">Accent 4:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonAccent4"/> + </accessibility> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelAccent5"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelAccent5">Accent 5:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonAccent5"/> + </accessibility> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">4</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelAccent6"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelAccent6">Accent 6:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonAccent6"/> + </accessibility> + </object> + <packing> + <property name="left-attach">2</property> + <property name="top-attach">5</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonAccent3"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelAccent3"/> + </accessibility> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">2</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonAccent4"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelAccent4"/> + </accessibility> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">3</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonAccent5"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelAccent5"/> + </accessibility> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">4</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonAccent6"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelAccent6"/> + </accessibility> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelHyperlink"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelHyperlink">Hyperlink:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonHyperlink"/> + </accessibility> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">4</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="labelFollowHyperlink"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" context="themecoloreditdialog|labelFollowHyperlink">Follow Hyperlink:</property> + <property name="xalign">0</property> + <accessibility> + <relation type="label-for" target="buttonFollowHyperlink"/> + </accessibility> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">5</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonHyperlink"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelHyperlink"/> + </accessibility> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">4</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="buttonFollowHyperlink"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <child> + <placeholder/> + </child> + <accessibility> + <relation type="labelled-by" target="labelFollowHyperlink"/> + </accessibility> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">5</property> + </packing> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="frameLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="themecoloreditdialog|frameLabel">Colors</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-11">help</action-widget> + <action-widget response="-5">ok</action-widget> + <action-widget response="-6">cancel</action-widget> + </action-widgets> + </object> +</interface> diff --git a/svx/uiconfig/ui/themedialog.ui b/svx/uiconfig/ui/themedialog.ui index 78d226d15ad3..80bbcc5fca67 100644 --- a/svx/uiconfig/ui/themedialog.ui +++ b/svx/uiconfig/ui/themedialog.ui @@ -75,16 +75,22 @@ </packing> </child> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=1 n-rows=2 --> <object class="GtkGrid"> <property name="visible">True</property> <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <child> <object class="GtkScrolledWindow" id="scroll_window"> <property name="visible">True</property> <property name="can-focus">True</property> - <property name="hexpand">False</property> - <property name="vexpand">False</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> + <property name="margin-top">12</property> + <property name="margin-bottom">12</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="hscrollbar-policy">never</property> <property name="vscrollbar-policy">never</property> <property name="shadow-type">in</property> @@ -109,6 +115,37 @@ <property name="top-attach">0</property> </packing> </child> + <child> + <object class="GtkButtonBox" id="buttonbox1"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="spacing">6</property> + <property name="layout-style">start</property> + <child> + <object class="GtkButton" id="button_add"> + <property name="label" translatable="yes" context="stock">_Add</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="button_add-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="hatchpage|extended_tip|add">Adds a custom hatching pattern to the current list. Specify the properties of your hatching pattern, and then click this button.</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index df4dac954495..4add92e90068 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -3048,8 +3048,18 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) if (pTheme) { std::shared_ptr<svx::IThemeColorChanger> pChanger(new sw::ThemeColorChanger(pDocumentShell)); - auto pDialog = std::make_shared<svx::ThemeDialog>(pMDI, pTheme.get(), pChanger); - weld::DialogController::runAsync(pDialog, [](int) {}); + auto pDialog = std::make_shared<svx::ThemeDialog>(pMDI, pTheme.get()); + weld::DialogController::runAsync(pDialog, [pDialog, pChanger](sal_uInt32 nResult) { + if (RET_OK != nResult) + return; + + auto oColorSet = pDialog->getCurrentColorSet(); + if (oColorSet) + { + auto& rColorSet = (*oColorSet).get(); + pChanger->apply(rColorSet); + } + }); } } } |