summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/qa/uitest/dialogs/chardlg.py11
-rw-r--r--cui/source/tabpages/chardlg.cxx2
-rw-r--r--editeng/source/items/textitem.cxx4
-rw-r--r--include/editeng/colritem.hxx4
-rw-r--r--include/svx/Palette.hxx2
-rw-r--r--include/svx/PaletteManager.hxx3
-rw-r--r--include/svx/strings.hrc5
-rw-r--r--svx/source/tbxctrls/PaletteManager.cxx52
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx4
9 files changed, 82 insertions, 5 deletions
diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py
index c49c08dbc687..631766922a0d 100644
--- a/cui/qa/uitest/dialogs/chardlg.py
+++ b/cui/qa/uitest/dialogs/chardlg.py
@@ -94,7 +94,8 @@ class Test(UITestCase):
paletteSelector = floatWindow.getChild("palette_listbox")
select_by_text(paletteSelector, "Theme colors")
colorSet = floatWindow.getChild("colorset")
- colorSet.executeAction("CHOOSE", mkPropertyValues({"POS": "4"}))
+ # 4 would be accent1, +12 is the first from the effect variants.
+ colorSet.executeAction("CHOOSE", mkPropertyValues({"POS": "16"}))
# Then make sure the doc model has the correct color theme index:
drawPage = component.getDrawPages().getByIndex(0)
@@ -109,6 +110,14 @@ class Test(UITestCase):
# i.e. no theme index was set, instead of accent1 (index into the above color scheme).
self.assertEqual(portion.CharColorTheme, 4)
+ # Then make sure that '80% lighter' is lum-mod=2000 and lum-off=8000:
+ # Without the accompanying fix in place, this test would have failed with:
+ # AssertionError: 10000 != 2000
+ # i.e. the effects where not applied, luminancen modulation was the default instead of a
+ # custom value.
+ self.assertEqual(portion.CharColorLumMod, 2000)
+ self.assertEqual(portion.CharColorLumOff, 8000)
+
def testSvxCharEffectsPageWriter(self):
# Start Writer.
with self.ui_test.create_doc_in_start_center("writer") as component:
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index b9337008d1d9..550213c99eff 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1601,6 +1601,8 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet )
{
// The color was picked from the theme palette, remember its index.
aItem.SetThemeIndex(aSelectedColor.m_nThemeIndex);
+ aItem.SetLumMod(aSelectedColor.m_nLumMod);
+ aItem.SetLumOff(aSelectedColor.m_nLumOff);
}
rSet.Put(aItem);
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index f3338f300567..2c787d34b171 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1523,6 +1523,10 @@ void SvxColorItem::dumpAsXml(xmlTextWriterPtr pWriter) const
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(ss.str().c_str()));
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("theme-index"),
BAD_CAST(OString::number(maThemeIndex).getStr()));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-mod"),
+ BAD_CAST(OString::number(mnLumMod).getStr()));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-off"),
+ BAD_CAST(OString::number(mnLumOff).getStr()));
OUString aStr;
IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
index 99ebed218748..21e389115b11 100644
--- a/include/editeng/colritem.hxx
+++ b/include/editeng/colritem.hxx
@@ -83,8 +83,12 @@ public:
maTintShade = nTintOrShade;
}
+ void SetLumMod(sal_Int16 nLumMod) { mnLumMod = nLumMod; }
+
sal_Int16 GetLumMod() const { return mnLumMod; }
+ void SetLumOff(sal_Int16 nLumOff) { mnLumOff = nLumOff; }
+
sal_Int16 GetLumOff() const { return mnLumOff; }
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx
index fc9b7cb7ad33..c23a09f9cbc8 100644
--- a/include/svx/Palette.hxx
+++ b/include/svx/Palette.hxx
@@ -39,6 +39,8 @@ struct SVXCORE_DLLPUBLIC NamedThemedColor
Color m_aColor;
OUString m_aName;
sal_Int16 m_nThemeIndex = -1;
+ sal_Int16 m_nLumMod = 10000;
+ sal_Int16 m_nLumOff = 0;
static NamedThemedColor FromNamedColor(const NamedColor& rNamedColor);
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index cfe19e29994e..d67623555157 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -76,6 +76,9 @@ public:
bool IsThemePaletteSelected() const;
+ static void GetThemeIndexLumModOff(sal_uInt16 nItemId, sal_Int16& rThemeIndex,
+ sal_Int16& rLumMod, sal_Int16& rLumOff);
+
static void DispatchColorCommand(const OUString& aCommand, const svx::NamedThemedColor& rColor);
};
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index 49c170b0a4bb..c172cbfa0a3c 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -1132,6 +1132,11 @@
#define RID_SVXSTR_THEME_COLOR10 NC_("RID_SVXSTR_THEME_COLOR10", "Accent 6")
#define RID_SVXSTR_THEME_COLOR11 NC_("RID_SVXSTR_THEME_COLOR11", "Hyperlink")
#define RID_SVXSTR_THEME_COLOR12 NC_("RID_SVXSTR_THEME_COLOR12", "Followed Hyperlink")
+#define RID_SVXSTR_THEME_EFFECT1 NC_("RID_SVXSTR_THEME_EFFECT1", "%1, 80% Lighter")
+#define RID_SVXSTR_THEME_EFFECT2 NC_("RID_SVXSTR_THEME_EFFECT2", "%1, 60% Lighter")
+#define RID_SVXSTR_THEME_EFFECT3 NC_("RID_SVXSTR_THEME_EFFECT3", "%1, 40% Lighter")
+#define RID_SVXSTR_THEME_EFFECT4 NC_("RID_SVXSTR_THEME_EFFECT4", "%1, 25% Darker")
+#define RID_SVXSTR_THEME_EFFECT5 NC_("RID_SVXSTR_THEME_EFFECT5", "%1, 50% Darker")
#define RID_SVX_EXTRUSION_BAR NC_("RID_SVX_EXTRUSION_BAR", "Extrusion")
#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF", "Apply Extrusion On/Off")
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 4ed6d3059187..c9ca2a3f70ab 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -43,6 +43,17 @@
#include <palettes.hxx>
+namespace
+{
+// Luminance modulation for the 6 effect presets.
+// 10000 is the default.
+sal_Int16 g_aLumMods[] = { 10000, 2000, 4000, 6000, 7500, 5000 };
+
+// Luminance offset for the 6 effect presets.
+// 0 is the default.
+sal_Int16 g_aLumOffs[] = { 0, 8000, 6000, 4000, 0, 0 };
+}
+
PaletteManager::PaletteManager() :
mnMaxRecentColors(Application::GetSettings().GetStyleSettings().GetColorValueSetColumnCount()),
mnNumOfPalettes(3),
@@ -131,6 +142,17 @@ bool PaletteManager::IsThemePaletteSelected() const
return mnCurrentPalette == mnNumOfPalettes - 2;
}
+void PaletteManager::GetThemeIndexLumModOff(sal_uInt16 nItemId, sal_Int16& rThemeIndex,
+ sal_Int16& rLumMod, sal_Int16& rLumOff)
+{
+ // Each column is the same color with different effects.
+ rThemeIndex = nItemId % 12;
+
+ // Each row is the same effect with different colors.
+ rLumMod = g_aLumMods[nItemId / 12];
+ rLumOff = g_aLumOffs[nItemId / 12];
+}
+
void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
{
if( mnCurrentPalette == 0)
@@ -156,7 +178,13 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
rColorSet.Clear();
if (aColors.size() >= 12)
{
- std::vector<OUString> aNames = {
+ std::vector<OUString> aEffectNames = {
+ SvxResId(RID_SVXSTR_THEME_EFFECT1), SvxResId(RID_SVXSTR_THEME_EFFECT2),
+ SvxResId(RID_SVXSTR_THEME_EFFECT3), SvxResId(RID_SVXSTR_THEME_EFFECT4),
+ SvxResId(RID_SVXSTR_THEME_EFFECT5),
+ };
+
+ std::vector<OUString> aColorNames = {
SvxResId(RID_SVXSTR_THEME_COLOR1), SvxResId(RID_SVXSTR_THEME_COLOR2),
SvxResId(RID_SVXSTR_THEME_COLOR3), SvxResId(RID_SVXSTR_THEME_COLOR4),
SvxResId(RID_SVXSTR_THEME_COLOR5), SvxResId(RID_SVXSTR_THEME_COLOR6),
@@ -164,9 +192,27 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
SvxResId(RID_SVXSTR_THEME_COLOR9), SvxResId(RID_SVXSTR_THEME_COLOR10),
SvxResId(RID_SVXSTR_THEME_COLOR11), SvxResId(RID_SVXSTR_THEME_COLOR12),
};
- for (int i = 0; i < 12; ++i)
+
+ sal_uInt16 nItemId = 0;
+ // Each row is one effect type (no effect + each type).
+ for (size_t nEffect = 0; nEffect < aEffectNames.size() + 1; ++nEffect)
{
- rColorSet.InsertItem(i, aColors[i], aNames[i]);
+ // Each column is one color type.
+ for (size_t nColor = 0; nColor < aColorNames.size(); ++nColor)
+ {
+ Color aColor = aColors[nColor];
+ aColor.ApplyLumModOff(g_aLumMods[nEffect], g_aLumOffs[nEffect]);
+ OUString aColorName;
+ if (nEffect == 0)
+ {
+ aColorName = aColorNames[nColor];
+ }
+ else
+ {
+ aColorName = aEffectNames[nEffect - 1].replaceAll("%1", aColorNames[nColor]);
+ }
+ rColorSet.InsertItem(nItemId++, aColor, aColorName);
+ }
}
}
}
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 9fe859e96a48..5a09dfef037e 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1972,7 +1972,9 @@ IMPL_LINK(ColorWindow, SelectHdl, ValueSet*, pColorSet, void)
auto aNamedThemedColor = svx::NamedThemedColor::FromNamedColor(aNamedColor);
if (mxPaletteManager->IsThemePaletteSelected())
{
- aNamedThemedColor.m_nThemeIndex = pColorSet->GetSelectedItemId();
+ PaletteManager::GetThemeIndexLumModOff(
+ pColorSet->GetSelectedItemId(), aNamedThemedColor.m_nThemeIndex,
+ aNamedThemedColor.m_nLumMod, aNamedThemedColor.m_nLumOff);
}
aColorSelectFunction(sCommand, aNamedThemedColor);
}