[Libreoffice-commits] core.git: svx/source svx/uiconfig
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Mon Apr 25 07:56:41 UTC 2016
svx/source/sidebar/text/TextCharacterSpacingControl.cxx | 110 ----------------
svx/source/sidebar/text/TextCharacterSpacingControl.hxx | 8 -
svx/uiconfig/ui/textcharacterspacingcontrol.ui | 73 +---------
3 files changed, 12 insertions(+), 179 deletions(-)
New commits:
commit b68a722ff5ed70ce4a7d2eaffd972cb3fd0922bc
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Fri Apr 22 16:00:25 2016 +0200
tdf#89953 Character spacing: Apply changes to sidebar widget also
* Step by 0.1 not 1
* Allow to enter negative values without selecting condensed/expanded
Change-Id: Ibe2898cf77f56e52a276166d2ee882fbd23452af
Reviewed-on: https://gerrit.libreoffice.org/24304
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index 5fb8948..a3ff10e 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -46,11 +46,6 @@ TextCharacterSpacingControl::TextCharacterSpacingControl(sal_uInt16 nId)
, mnLastCus(SPACING_NOCUSTOM)
{
get(maEditKerning, "kerning");
- get(maLBKerning, "kerninglb");
- get(maFTBy, "change_by_label");
- get(maFTSpacing, "spacing_label");
- maEditKerning->Disable();
- maFTBy->Disable();
get(maNormal, "normal");
get(maVeryTight, "very_tight");
@@ -59,8 +54,6 @@ TextCharacterSpacingControl::TextCharacterSpacingControl(sal_uInt16 nId)
get(maLoose, "loose");
get(maLastCustom, "last_custom");
- maLBKerning->SetSelectHdl(LINK(this, TextCharacterSpacingControl, KerningSelectHdl));
- maLBKerning->SetHelpId(HID_SPACING_CB_KERN);
maEditKerning->SetModifyHdl(LINK(this, TextCharacterSpacingControl, KerningModifyHdl));
maEditKerning->SetHelpId(HID_SPACING_MB_KERN);
@@ -90,9 +83,6 @@ void TextCharacterSpacingControl::dispose()
aWinOpt.SetUserData(aSeq);
}
- maFTBy.clear();
- maFTSpacing.clear();
- maLBKerning.clear();
maEditKerning.clear();
maNormal.clear();
@@ -135,61 +125,22 @@ void TextCharacterSpacingControl::Initialize()
if(eState >= SfxItemState::DEFAULT)
{
- maLBKerning->Enable();
- maFTSpacing->Enable();
-
SfxMapUnit eUnit = GetCoreMetric();
MapUnit eOrgUnit = (MapUnit)eUnit;
MapUnit ePntUnit(MAP_POINT);
long nBig = maEditKerning->Normalize(nKerning);
nKerning = LogicToLogic(nBig, eOrgUnit, ePntUnit);
-
- if(nKerning > 0)
- {
- maFTBy->Enable();
- maEditKerning->Enable();
- maEditKerning->SetMax(9999);
- maEditKerning->SetLast(9999);
- maEditKerning->SetValue(nKerning);
- maLBKerning->SelectEntryPos(SIDEBAR_SPACE_EXPAND);
- }
- else if(nKerning < 0)
- {
- maFTBy->Enable();
- maEditKerning->Enable();
- maEditKerning->SetValue(-nKerning);
- maLBKerning->SelectEntryPos(SIDEBAR_SPACE_CONDENSED);
- long nMax = GetSelFontSize()/6;
- maEditKerning->SetMax(maEditKerning->Normalize(nMax), FUNIT_POINT);
- maEditKerning->SetLast(maEditKerning->GetMax(maEditKerning->GetUnit()));
- }
- else
- {
- maLBKerning->SelectEntryPos(SIDEBAR_SPACE_NORMAL);
- maFTBy->Disable();
- maEditKerning->Disable();
- maEditKerning->SetValue(0);
- maEditKerning->SetMax(9999);
- maEditKerning->SetLast(9999);
- }
+ maEditKerning->SetValue(nKerning);
}
else if(SfxItemState::DISABLED == eState)
{
maEditKerning->SetText(OUString());
- maLBKerning->SetNoSelection();
- maLBKerning->Disable();
- maFTSpacing->Disable();
maEditKerning->Disable();
- maFTBy->Disable();
}
else
{
- maLBKerning->Enable();
- maFTSpacing->Enable();
- maLBKerning->SetNoSelection();
maEditKerning->SetText(OUString());
maEditKerning->Disable();
- maFTBy->Disable();
}
}
@@ -242,53 +193,10 @@ IMPL_LINK_TYPED(TextCharacterSpacingControl, PredefinedValuesHdl, Button*, pCont
}
}
-IMPL_LINK_NOARG_TYPED(TextCharacterSpacingControl, KerningSelectHdl, ListBox&, void)
-{
- if(maLBKerning->GetSelectEntryPos() > 0)
- {
- maFTBy->Enable();
- maEditKerning->Enable();
- }
- else
- {
- maEditKerning->SetValue(0);
- maFTBy->Disable();
- maEditKerning->Disable();
- }
-
- KerningModifyHdl(*maEditKerning);
-}
-
IMPL_LINK_NOARG_TYPED(TextCharacterSpacingControl, KerningModifyHdl, Edit&, void)
{
- const sal_Int32 nPos = maLBKerning->GetSelectEntryPos();
-
mnLastCus = SPACING_CLOSE_BY_CUS_EDIT;
- if(nPos == SIDEBAR_SPACE_EXPAND || nPos == SIDEBAR_SPACE_CONDENSED)
- {
- long nTmp = static_cast<long>(maEditKerning->GetValue());
- if(nPos == SIDEBAR_SPACE_CONDENSED)
- {
- long nMax = GetSelFontSize()/6;
- maEditKerning->SetMax(maEditKerning->Normalize(nMax), FUNIT_TWIP);
- maEditKerning->SetLast(maEditKerning->GetMax(maEditKerning->GetUnit()));
- if(nTmp > maEditKerning->GetMax())
- nTmp = maEditKerning->GetMax();
- mnCustomKern = -nTmp;
- }
- else
- {
- maEditKerning->SetMax(9999);
- maEditKerning->SetLast(9999);
- if(nTmp > maEditKerning->GetMax(FUNIT_TWIP))
- nTmp = maEditKerning->GetMax(FUNIT_TWIP);
- mnCustomKern = nTmp;
- }
- }
- else
- {
- mnCustomKern = 0;
- }
+ mnCustomKern = static_cast<long>(maEditKerning->GetValue());
ExecuteCharacterSpacing(mnCustomKern, false);
}
@@ -300,20 +208,6 @@ SfxMapUnit TextCharacterSpacingControl::GetCoreMetric() const
return rPool.GetMetric(nWhich);
}
-long TextCharacterSpacingControl::GetSelFontSize() const
-{
- const SfxPoolItem* pItem;
- SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_CHAR_FONTHEIGHT, pItem);
-
- const SvxFontHeightItem* pHeightItem = static_cast<const SvxFontHeightItem*>(pItem);
-
- long nH = 240;
- SfxMapUnit eUnit = GetCoreMetric();
- if(pHeightItem)
- nH = LogicToLogic(pHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP);
- return nH;
-}
-
} // end of namespace svx
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
index cd0cdd0..008cb67 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
@@ -32,10 +32,6 @@ namespace svx {
#define SIDEBAR_SPACING_GLOBAL_VALUE "PopupPanel_Spacing"
-#define SIDEBAR_SPACE_NORMAL 0
-#define SIDEBAR_SPACE_EXPAND 1
-#define SIDEBAR_SPACE_CONDENSED 2
-
class TextCharacterSpacingControl : public SfxPopupWindow
{
public:
@@ -47,9 +43,6 @@ public:
long GetLastCustomValue() { return mnCustomKern;}
private:
- VclPtr<FixedText> maFTSpacing;
- VclPtr<ListBox> maLBKerning;
- VclPtr<FixedText> maFTBy;
VclPtr<MetricField> maEditKerning;
VclPtr<PushButton> maNormal;
@@ -71,7 +64,6 @@ private:
DECL_LINK_TYPED(KerningModifyHdl, Edit&, void);
SfxMapUnit GetCoreMetric() const;
- long GetSelFontSize() const;
};
}
diff --git a/svx/uiconfig/ui/textcharacterspacingcontrol.ui b/svx/uiconfig/ui/textcharacterspacingcontrol.ui
index 7fd26786..ede4262 100644
--- a/svx/uiconfig/ui/textcharacterspacingcontrol.ui
+++ b/svx/uiconfig/ui/textcharacterspacingcontrol.ui
@@ -3,8 +3,9 @@
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAdjustment" id="adjustment1">
- <property name="upper">9999</property>
- <property name="step_increment">1</property>
+ <property name="lower">-2</property>
+ <property name="upper">10000</property>
+ <property name="step_increment">0.10000000000000001</property>
<property name="page_increment">1</property>
</object>
<object class="GtkImage" id="image_spacing_1">
@@ -148,69 +149,15 @@
<property name="margin_top">6</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkGrid" id="grid3">
+ <object class="GtkSpinButton" id="kerning:0pt">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="hexpand">True</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="spacing_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Character Spacing:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">kerninglb</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="kerninglb">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <items>
- <item translatable="yes">Default</item>
- <item translatable="yes">Expanded</item>
- <item translatable="yes">Condensed</item>
- </items>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="change_by_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Change _by:</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="kerning:0pt">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="invisible_char">●</property>
- <property name="width_chars">0</property>
- <property name="adjustment">adjustment1</property>
- <property name="digits">1</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
+ <property name="invisible_char">●</property>
+ <property name="width_chars">0</property>
+ <property name="text" translatable="yes">0,0</property>
+ <property name="adjustment">adjustment1</property>
+ <property name="digits">1</property>
</object>
</child>
</object>
More information about the Libreoffice-commits
mailing list