summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-11-04 10:04:46 +0100
committerJan Holesovsky <kendy@collabora.com>2014-11-04 20:26:20 +0100
commit4000f93c9464be91c6a19231c93f3ac52df873e9 (patch)
tree269cf4179fdd72db99b473e87f0f7ba2900dfca9 /svx
parent5bb43d06622a10c247ceeaeaceb236c5e3dcdcf0 (diff)
line spacing: Kill the "Last value" button. Close popup when used via buttons.
Change-Id: I48eabbe5e1f41f5ed015d2fa95ade5376576cac9
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx82
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx3
-rw-r--r--svx/uiconfig/ui/paralinespacingcontrol.ui114
3 files changed, 70 insertions, 129 deletions
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
index 55fab668e480..8e3d924984dd 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
@@ -36,6 +36,7 @@
#define LINESPACE_2 200
#define LINESPACE_115 115
+// values of the mpLineDist listbox
#define LLINESPACE_1 0
#define LLINESPACE_15 1
#define LLINESPACE_2 2
@@ -44,6 +45,9 @@
#define LLINESPACE_DURCH 5
#define LLINESPACE_FIX 6
+// special case; should not conflict with the mpLinDist values
+#define LLINESPACE_115 7
+
#define DO_NOT_CUSTOM false
#define USE_CUSTOM true
@@ -67,7 +71,6 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId)
mpSpacing115Button = get<PushButton>("spacing_115");
mpSpacing15Button = get<PushButton>("spacing_15");
mpSpacing2Button = get<PushButton>("spacing_2");
- mpSpacingLastButton = get<PushButton>("spacing_last");
mpLineDist = get<ListBox>("line_dist");
mpLineDistAtPercentBox = get<MetricField>("percent_box");
@@ -90,7 +93,6 @@ void ParaLineSpacingControl::initial()
mpSpacing115Button->SetClickHdl(aLink);
mpSpacing15Button->SetClickHdl(aLink);
mpSpacing2Button->SetClickHdl(aLink);
- mpSpacingLastButton->SetClickHdl(aLink);
aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl );
mpLineDist->SetSelectHdl(aLink);
@@ -622,79 +624,43 @@ IMPL_LINK(ParaLineSpacingControl, PredefinedValuesHandler, void *, pControl)
{
if (pControl == mpSpacing1Button)
{
- ExecuteLineSpacing(false, LLINESPACE_1);
+ ExecuteLineSpacing(LLINESPACE_1);
}
else if (pControl == mpSpacing115Button)
{
- ExecuteLineSpacing(false, LLINESPACE_PROP);
+ ExecuteLineSpacing(LLINESPACE_115);
}
else if (pControl == mpSpacing15Button)
{
- ExecuteLineSpacing(false, LLINESPACE_15);
+ ExecuteLineSpacing(LLINESPACE_15);
}
else if (pControl == mpSpacing2Button)
{
- ExecuteLineSpacing( false, 2 );
- }
- else
- {
- if(!(mbLineSPDisable))
- {
- mpLineDist->SelectEntryPos( maPos ) ;
- mpLineDist->SaveValue();
-
- SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
- switch(maPos)
- {
- case LLINESPACE_1:
- case LLINESPACE_15:
- case LLINESPACE_2:
- SetLineSpace(aSpacing, maPos);
- break;
-
- case LLINESPACE_PROP:
- SetLineSpace(aSpacing, maPos, mpLineDistAtPercentBox->Denormalize((long)maValue));
- break;
-
- case LLINESPACE_MIN:
- case LLINESPACE_DURCH:
- case LLINESPACE_FIX:
- SetLineSpace(aSpacing, maPos, (long)maValue);
- break;
- }
-
- SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute(
- SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L);
-
- ExecuteLineSpacing(USE_CUSTOM, 0);
- }
+ ExecuteLineSpacing(LLINESPACE_2);
}
return 0;
}
-void ParaLineSpacingControl::ExecuteLineSpacing( bool aIsCustom, sal_uInt16 aEntry )
+void ParaLineSpacingControl::ExecuteLineSpacing(sal_uInt16 nEntry)
{
- if( !aIsCustom )
- {
- mpLineDist->SelectEntryPos( aEntry ) ;
- mpLineDist->SaveValue();
- SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
- sal_uInt16 nPos = aEntry;
- if( aEntry == LLINESPACE_PROP )
- SetLineSpace( aSpacing, nPos, mpLineDistAtPercentBox->Denormalize( (long)115 ) );
- else
- SetLineSpace( aSpacing, nPos );
-
- SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute(
+ mpLineDist->SelectEntryPos(nEntry) ;
+ mpLineDist->SaveValue();
+ SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
+
+ // special-case the 1.15 line spacing
+ if (nEntry == LLINESPACE_115)
+ SetLineSpace(aSpacing, LLINESPACE_PROP, mpLineDistAtPercentBox->Denormalize(115L));
+ else
+ SetLineSpace(aSpacing, nEntry);
+
+ SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute(
SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L);
- }
- if( !aIsCustom )
- {
- mbUseLineSPCustom = DO_NOT_CUSTOM;
- }
-// maLineSpacing.SetNoSelection();
+ mbUseLineSPCustom = DO_NOT_CUSTOM;
+
+ // close when the user used the buttons
+ EndPopupMode();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
index 492cfb8afe3f..0cea335f8f0d 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
@@ -46,7 +46,7 @@ public:
void SetLineSpace( SvxLineSpacingItem& rLineSpace,
int eSpace, long lValue = 0 );
- void ExecuteLineSpacing( bool aIsCustom, sal_uInt16 aEntry );
+ void ExecuteLineSpacing(sal_uInt16 aEntry);
void PopupModeEndCallback();
private:
@@ -61,7 +61,6 @@ private:
PushButton* mpSpacing115Button;
PushButton* mpSpacing15Button;
PushButton* mpSpacing2Button;
- PushButton* mpSpacingLastButton;
ListBox* mpLineDist;
diff --git a/svx/uiconfig/ui/paralinespacingcontrol.ui b/svx/uiconfig/ui/paralinespacingcontrol.ui
index c7ad5b7fa8ab..1dfb0cb02f08 100644
--- a/svx/uiconfig/ui/paralinespacingcontrol.ui
+++ b/svx/uiconfig/ui/paralinespacingcontrol.ui
@@ -1,55 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
- <object class="GtkAdjustment" id="adjustment1">
- <property name="lower">50</property>
- <property name="upper">200</property>
- <property name="value">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment2">
- <property name="upper">9999</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkImage" id="image_spacing_1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="pixbuf">svx/res/symphony/lpspacing-1.png</property>
- </object>
- <object class="GtkImage" id="image_spacing_115">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_right">6</property>
- <property name="xalign">0</property>
- <property name="pixbuf">svx/res/symphony/lpspacing-1_15.png</property>
- <property name="icon-size">1</property>
- </object>
- <object class="GtkImage" id="image_spacing_15">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_right">6</property>
- <property name="xalign">0</property>
- <property name="pixbuf">svx/res/symphony/lpspacing-1_5.png</property>
- <property name="icon-size">1</property>
- </object>
- <object class="GtkImage" id="image_spacing_2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_right">6</property>
- <property name="xalign">0</property>
- <property name="pixbuf">svx/res/symphony/lpspacing-2.png</property>
- <property name="icon-size">1</property>
- </object>
- <object class="GtkImage" id="image_spacing_last">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_right">6</property>
- <property name="xalign">0</property>
- <property name="pixbuf">svx/res/symphony/last_custom_common.png</property>
- <property name="icon-size">1</property>
- </object>
<object class="GtkWindow" id="ParaLineSpacingControl">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -66,9 +17,9 @@
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin_right">6</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="row_spacing">6</property>
<child>
<object class="GtkButton" id="spacing_1">
<property name="label">Spacing: 1</property>
@@ -142,24 +93,6 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="spacing_last">
- <property name="label">Last Custom Value</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="image">image_spacing_last</property>
- <property name="relief">none</property>
- <property name="xalign">0</property>
- <property name="always_show_image">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -242,6 +175,7 @@
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
@@ -257,6 +191,7 @@
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
@@ -291,7 +226,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -299,4 +234,45 @@
</object>
</child>
</object>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="lower">50</property>
+ <property name="upper">200</property>
+ <property name="value">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">9999</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkImage" id="image_spacing_1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="pixbuf">svx/res/symphony/lpspacing-1.png</property>
+ </object>
+ <object class="GtkImage" id="image_spacing_115">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_right">6</property>
+ <property name="xalign">0</property>
+ <property name="pixbuf">svx/res/symphony/lpspacing-1_15.png</property>
+ <property name="icon-size">1</property>
+ </object>
+ <object class="GtkImage" id="image_spacing_15">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_right">6</property>
+ <property name="xalign">0</property>
+ <property name="pixbuf">svx/res/symphony/lpspacing-1_5.png</property>
+ <property name="icon-size">1</property>
+ </object>
+ <object class="GtkImage" id="image_spacing_2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_right">6</property>
+ <property name="xalign">0</property>
+ <property name="pixbuf">svx/res/symphony/lpspacing-2.png</property>
+ <property name="icon-size">1</property>
+ </object>
</interface>