summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-12-15 08:41:01 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-12-15 09:33:04 +0100
commitc634f836945379ae17a3714938210bba7995dd25 (patch)
tree1744b38e18d6a3ea6171fe062594a8504f31cf65 /cui
parent453c5b6214654b440fe1d3e926cddfb695e17f10 (diff)
sd theme: add UI to set/get the name of a color set
The two names make sense because the theme can have not only color sets but also font names, etc -- but for now we just care about the theme name and a named color set. Change-Id: Ieafca36da005a9c74964e39216bee3c33f6427cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126850 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'cui')
-rw-r--r--cui/qa/uitest/tabpages/themepage.py13
-rw-r--r--cui/source/inc/themepage.hxx1
-rw-r--r--cui/source/tabpages/themepage.cxx10
-rw-r--r--cui/uiconfig/ui/themetabpage.ui60
4 files changed, 83 insertions, 1 deletions
diff --git a/cui/qa/uitest/tabpages/themepage.py b/cui/qa/uitest/tabpages/themepage.py
index eb97205d19ab..25726c63feda 100644
--- a/cui/qa/uitest/tabpages/themepage.py
+++ b/cui/qa/uitest/tabpages/themepage.py
@@ -23,7 +23,8 @@ class Test(UITestCase):
drawPage = component.getDrawPages().getByIndex(0)
master = drawPage.MasterPage
theme = mkPropertyValues({
- "Name": "nameA"
+ "Name": "nameA",
+ "ColorSchemeName": "colorSetA"
})
master.Theme = theme
@@ -34,7 +35,13 @@ class Test(UITestCase):
# Select RID_SVXPAGE_THEME.
select_pos(xTabs, "3")
themeName = xDialog.getChild("themeName")
+ themeName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ themeName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
themeName.executeAction("TYPE", mkPropertyValues({"TEXT": "nameB"}))
+ colorSetName = xDialog.getChild("colorSetName")
+ colorSetName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ colorSetName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ colorSetName.executeAction("TYPE", mkPropertyValues({"TEXT": "colorSetB"}))
# Then make sure the doc model is updated accordingly:
# Without the accompanying fix in place, this test would have failed with:
@@ -42,6 +49,10 @@ class Test(UITestCase):
# i.e. the UI didn't update the theme name.
theme = convert_property_values_to_dict(master.Theme)
self.assertEqual(theme["Name"], "nameB")
+ # Without the accompanying fix in place, this test would have failed with:
+ # AssertionError: 'colorSetA' != 'colorSetB'
+ # i.e. the UI didn't update the color scheme name.
+ self.assertEqual(theme["ColorSchemeName"], "colorSetB")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/cui/source/inc/themepage.hxx b/cui/source/inc/themepage.hxx
index 6596cd227244..613650c075b6 100644
--- a/cui/source/inc/themepage.hxx
+++ b/cui/source/inc/themepage.hxx
@@ -21,6 +21,7 @@ class SvxThemePage : public SfxTabPage
static const WhichRangesContainer m_pRanges;
std::unique_ptr<weld::Entry> m_xThemeName;
+ std::unique_ptr<weld::Entry> m_xColorSetName;
public:
SvxThemePage(weld::Container* pPage, weld::DialogController* pController,
diff --git a/cui/source/tabpages/themepage.cxx b/cui/source/tabpages/themepage.cxx
index 4c2cd18716b9..99abeed799fb 100644
--- a/cui/source/tabpages/themepage.cxx
+++ b/cui/source/tabpages/themepage.cxx
@@ -27,6 +27,7 @@ SvxThemePage::SvxThemePage(weld::Container* pPage, weld::DialogController* pCont
const SfxItemSet& rInAttrs)
: SfxTabPage(pPage, pController, "cui/ui/themetabpage.ui", "ThemePage", &rInAttrs)
, m_xThemeName(m_xBuilder->weld_entry("themeName"))
+ , m_xColorSetName(m_xBuilder->weld_entry("colorSetName"))
{
}
@@ -57,6 +58,14 @@ void SvxThemePage::Reset(const SfxItemSet* pAttrs)
it->second >>= aName;
m_xThemeName->set_text(aName);
}
+
+ it = aMap.find("ColorSchemeName");
+ if (it != aMap.end())
+ {
+ OUString aName;
+ it->second >>= aName;
+ m_xColorSetName->set_text(aName);
+ }
}
bool SvxThemePage::FillItemSet(SfxItemSet* pAttrs)
@@ -76,6 +85,7 @@ bool SvxThemePage::FillItemSet(SfxItemSet* pAttrs)
}
aMap["Name"] <<= m_xThemeName->get_text();
+ aMap["ColorSchemeName"] <<= m_xColorSetName->get_text();
beans::PropertyValues aTheme = aMap.getAsConstPropertyValueList();
aGrabBagItem.GetGrabBag()["Theme"] <<= aTheme;
diff --git a/cui/uiconfig/ui/themetabpage.ui b/cui/uiconfig/ui/themetabpage.ui
index c94c6093958b..81c1affbe85f 100644
--- a/cui/uiconfig/ui/themetabpage.ui
+++ b/cui/uiconfig/ui/themetabpage.ui
@@ -68,5 +68,65 @@
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame" id="frmColors">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkGrid" id="gdColors">
+ <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="row_spacing">3</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="lbColorSetName">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="themetabpage|lbColorSetName">Name:</property>
+ <accessibility>
+ <relation type="label-for" target="colorSetName"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="colorSetName">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <accessibility>
+ <relation type="labelled-by" target="lbColorSetName"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="colorSet">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="themetabpage|colorSet">Color set</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
</interface>