summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingControl.cxx110
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingControl.hxx8
-rw-r--r--svx/uiconfig/ui/textcharacterspacingcontrol.ui73
3 files changed, 12 insertions, 179 deletions
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index 5fb89486e95a..a3ff10e634f7 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 cd0cdd04a2a7..008cb6723032 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 7fd26786e490..ede4262d1d3e 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>