summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/qa/uitest/dialogs/chardlg.py49
-rw-r--r--cui/source/inc/chardlg.hxx3
-rw-r--r--cui/source/tabpages/chardlg.cxx40
-rw-r--r--cui/uiconfig/ui/effectspage.ui57
-rw-r--r--include/svx/flagsdef.hxx1
-rw-r--r--sd/source/ui/dlg/dlgchar.cxx2
6 files changed, 150 insertions, 2 deletions
diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py
new file mode 100644
index 000000000000..59cf10d18c29
--- /dev/null
+++ b/cui/qa/uitest/dialogs/chardlg.py
@@ -0,0 +1,49 @@
+#
+# 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/.
+#
+
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.framework import UITestCase
+from uitest.uihelper.common import select_pos
+
+# Test for cui/source/tabpages/chardlg.cxx.
+class Test(UITestCase):
+
+ def testSvxCharEffectsPage(self):
+ # Start Impress.
+ self.ui_test.create_doc_in_start_center("impress")
+ template = self.xUITest.getTopFocusWindow()
+ self.ui_test.close_dialog_through_button(template.getChild("cancel"))
+ doc = self.xUITest.getTopFocusWindow()
+ editWin = doc.getChild("impress_win")
+ # Select the title shape.
+ editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
+ editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ # Now use Format -> Character.
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ # Select RID_SVXPAGE_CHAR_EFFECTS.
+ select_pos(xTabs, "1")
+ xFontTransparency = xDialog.getChild("fonttransparencymtr")
+ for _ in range(5):
+ xFontTransparency.executeAction("UP", tuple())
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+
+ # Verify the result.
+ component = self.ui_test.get_component()
+ drawPage = component.getDrawPages().getByIndex(0)
+ shape = drawPage.getByIndex(0)
+
+ # Without the accompanying fix in place, this test would have failed with:
+ # AssertionError: 100 != 5
+ # i.e. the dialog did not set transparency to 5%, instead it left the character color at
+ # COL_AUTO.
+ self.assertEqual(shape.CharTransparence, 5)
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index 1b99b60cc5ff..d7d98e89c39e 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -179,6 +179,8 @@ private:
Color m_aOrigFontColor;
VclPtr<FixedText> m_pFontColorFT;
VclPtr<SvxColorListBox> m_pFontColorLB;
+ VclPtr<FixedText> m_pFontTransparencyFT;
+ VclPtr<MetricField> m_pFontTransparencyMtr;
VclPtr<FixedText> m_pEffectsFT;
VclPtr<ListBox> m_pEffectsLB;
@@ -229,6 +231,7 @@ private:
DECL_LINK(TristClickHdl_Impl, Button*, void);
DECL_LINK(UpdatePreview_Impl, ListBox&, void);
DECL_LINK(ColorBoxSelectHdl_Impl, SvxColorListBox&, void);
+ DECL_LINK(ModifyFontTransparencyHdl_Impl, Edit&, void);
public:
virtual ~SvxCharEffectsPage() override;
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 667e09955298..22fa9004269d 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1340,6 +1340,8 @@ SvxCharEffectsPage::SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet&
{
get(m_pFontColorFT, "fontcolorft");
get(m_pFontColorLB, "fontcolorlb");
+ get(m_pFontTransparencyFT, "fonttransparencyft");
+ get(m_pFontTransparencyMtr, "fonttransparencymtr");
m_pFontColorLB->SetSlotId(SID_ATTR_CHAR_COLOR);
get(m_pEffectsFT, "effectsft");
get(m_pEffectsLB, "effectslb");
@@ -1393,6 +1395,8 @@ void SvxCharEffectsPage::dispose()
{
m_pFontColorFT.clear();
m_pFontColorLB.clear();
+ m_pFontTransparencyFT.clear();
+ m_pFontTransparencyMtr.clear();
m_pEffectsFT.clear();
m_pEffectsLB.clear();
m_pReliefFT.clear();
@@ -1438,6 +1442,8 @@ void SvxCharEffectsPage::Initialize()
}
m_pFontColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl));
+ m_pFontTransparencyMtr->SetModifyHdl(
+ LINK(this, SvxCharEffectsPage, ModifyFontTransparencyHdl_Impl));
// handler
Link<ListBox&,void> aLink = LINK( this, SvxCharEffectsPage, SelectListBoxHdl_Impl );
@@ -1609,7 +1615,19 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet )
m_pPreviewWin->Invalidate();
- m_pFontColorLB->SelectEntry(aColor);
+ Color aRGBColor = aColor;
+ if (aRGBColor.GetTransparency())
+ {
+ aRGBColor.SetTransparency(0);
+ }
+ m_pFontColorLB->SelectEntry(aRGBColor);
+
+ if (m_pFontTransparencyMtr->IsVisible() && aColor != COL_AUTO)
+ {
+ double fTransparency = aColor.GetTransparency() * 100.0 / 255;
+ m_pFontTransparencyMtr->SetValue(basegfx::fround(fTransparency),
+ FUNIT_PERCENT);
+ }
m_aOrigFontColor = aColor;
m_bOrigFontColor = true;
@@ -1630,6 +1648,14 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet )
if (bChanged)
{
aSelectedColor = m_pFontColorLB->GetSelectEntryColor();
+
+ if (m_pFontTransparencyMtr->IsValueChangedFromSaved())
+ {
+ double fTransparency
+ = m_pFontTransparencyMtr->GetValue() * 255.0 / 100;
+ aSelectedColor.SetTransparency(static_cast<sal_uInt8>(basegfx::fround(fTransparency)));
+ }
+
if (m_bOrigFontColor)
bChanged = aSelectedColor != m_aOrigFontColor;
if (m_bEnableNoneFontColor && bChanged && aSelectedColor == COL_NONE_COLOR)
@@ -1711,6 +1737,11 @@ IMPL_LINK(SvxCharEffectsPage, ColorBoxSelectHdl_Impl, SvxColorListBox&, rBox, vo
UpdatePreview_Impl();
}
+IMPL_LINK_NOARG(SvxCharEffectsPage, ModifyFontTransparencyHdl_Impl, Edit&, void)
+{
+ m_bNewFontColor = true;
+}
+
DeactivateRC SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet )
{
if ( _pSet )
@@ -2142,6 +2173,7 @@ void SvxCharEffectsPage::ChangesApplied()
m_pShadowBtn->SaveValue();
m_pBlinkingBtn->SaveValue();
m_pHiddenBtn->SaveValue();
+ m_pFontTransparencyMtr->SaveValue();
}
bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
@@ -2504,6 +2536,12 @@ void SvxCharEffectsPage::PageCreated(const SfxAllItemSet& aSet)
if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
// the writer uses SID_ATTR_BRUSH as font background
m_bPreviewBackgroundToCharacter = true;
+ if ((nFlags & SVX_ENABLE_CHAR_TRANSPARENCY) != SVX_ENABLE_CHAR_TRANSPARENCY)
+ {
+ // Only show these in case client code explicitly wants this.
+ m_pFontTransparencyFT->Hide();
+ m_pFontTransparencyMtr->Hide();
+ }
}
}
diff --git a/cui/uiconfig/ui/effectspage.ui b/cui/uiconfig/ui/effectspage.ui
index bf80526b73e2..4824e4b5d2bc 100644
--- a/cui/uiconfig/ui/effectspage.ui
+++ b/cui/uiconfig/ui/effectspage.ui
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="LibreOffice" version="1.0"/>
+ <object class="GtkAdjustment" id="adjustmentPercent">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name gchararray1 -->
@@ -574,6 +579,56 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="fonttransparencyft">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Transparency:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">fonttransparencymtr</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="fonttransparencymtr:0%">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="invisible_char">•</property>
+ <property name="adjustment">adjustmentPercent</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">12</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<placeholder/>
</child>
<child>
diff --git a/include/svx/flagsdef.hxx b/include/svx/flagsdef.hxx
index 30b1ff401203..5c3f6947f3f2 100644
--- a/include/svx/flagsdef.hxx
+++ b/include/svx/flagsdef.hxx
@@ -67,6 +67,7 @@ namespace o3tl
#define SVX_RELATIVE_MODE 0x02
// flags for SvxCharEffectsPage
#define SVX_ENABLE_FLASH 0x04
+#define SVX_ENABLE_CHAR_TRANSPARENCY 0x08
// Default values for Number Format Category List and Preview
diff --git a/sd/source/ui/dlg/dlgchar.cxx b/sd/source/ui/dlg/dlgchar.cxx
index cb37af495eac..1d1ac701876a 100644
--- a/sd/source/ui/dlg/dlgchar.cxx
+++ b/sd/source/ui/dlg/dlgchar.cxx
@@ -61,6 +61,8 @@ void SdCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
}
else if (nId == mnCharEffects)
{
+ // Opt in for character transparency.
+ aSet.Put(SfxUInt32Item(SID_FLAG_TYPE, SVX_ENABLE_CHAR_TRANSPARENCY));
rPage.PageCreated(aSet);
}
else if (nId == mnCharBackground)