Kaydet (Commit) 4000f93c authored tarafından Jan Holesovsky's avatar Jan Holesovsky

line spacing: Kill the "Last value" button. Close popup when used via buttons.

Change-Id: I48eabbe5e1f41f5ed015d2fa95ade5376576cac9
üst 5bb43d06
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#define LINESPACE_2 200 #define LINESPACE_2 200
#define LINESPACE_115 115 #define LINESPACE_115 115
// values of the mpLineDist listbox
#define LLINESPACE_1 0 #define LLINESPACE_1 0
#define LLINESPACE_15 1 #define LLINESPACE_15 1
#define LLINESPACE_2 2 #define LLINESPACE_2 2
...@@ -44,6 +45,9 @@ ...@@ -44,6 +45,9 @@
#define LLINESPACE_DURCH 5 #define LLINESPACE_DURCH 5
#define LLINESPACE_FIX 6 #define LLINESPACE_FIX 6
// special case; should not conflict with the mpLinDist values
#define LLINESPACE_115 7
#define DO_NOT_CUSTOM false #define DO_NOT_CUSTOM false
#define USE_CUSTOM true #define USE_CUSTOM true
...@@ -67,7 +71,6 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) ...@@ -67,7 +71,6 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId)
mpSpacing115Button = get<PushButton>("spacing_115"); mpSpacing115Button = get<PushButton>("spacing_115");
mpSpacing15Button = get<PushButton>("spacing_15"); mpSpacing15Button = get<PushButton>("spacing_15");
mpSpacing2Button = get<PushButton>("spacing_2"); mpSpacing2Button = get<PushButton>("spacing_2");
mpSpacingLastButton = get<PushButton>("spacing_last");
mpLineDist = get<ListBox>("line_dist"); mpLineDist = get<ListBox>("line_dist");
mpLineDistAtPercentBox = get<MetricField>("percent_box"); mpLineDistAtPercentBox = get<MetricField>("percent_box");
...@@ -90,7 +93,6 @@ void ParaLineSpacingControl::initial() ...@@ -90,7 +93,6 @@ void ParaLineSpacingControl::initial()
mpSpacing115Button->SetClickHdl(aLink); mpSpacing115Button->SetClickHdl(aLink);
mpSpacing15Button->SetClickHdl(aLink); mpSpacing15Button->SetClickHdl(aLink);
mpSpacing2Button->SetClickHdl(aLink); mpSpacing2Button->SetClickHdl(aLink);
mpSpacingLastButton->SetClickHdl(aLink);
aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl ); aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl );
mpLineDist->SetSelectHdl(aLink); mpLineDist->SetSelectHdl(aLink);
...@@ -622,79 +624,43 @@ IMPL_LINK(ParaLineSpacingControl, PredefinedValuesHandler, void *, pControl) ...@@ -622,79 +624,43 @@ IMPL_LINK(ParaLineSpacingControl, PredefinedValuesHandler, void *, pControl)
{ {
if (pControl == mpSpacing1Button) if (pControl == mpSpacing1Button)
{ {
ExecuteLineSpacing(false, LLINESPACE_1); ExecuteLineSpacing(LLINESPACE_1);
} }
else if (pControl == mpSpacing115Button) else if (pControl == mpSpacing115Button)
{ {
ExecuteLineSpacing(false, LLINESPACE_PROP); ExecuteLineSpacing(LLINESPACE_115);
} }
else if (pControl == mpSpacing15Button) else if (pControl == mpSpacing15Button)
{ {
ExecuteLineSpacing(false, LLINESPACE_15); ExecuteLineSpacing(LLINESPACE_15);
} }
else if (pControl == mpSpacing2Button) else if (pControl == mpSpacing2Button)
{ {
ExecuteLineSpacing( false, 2 ); ExecuteLineSpacing(LLINESPACE_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);
}
} }
return 0; return 0;
} }
void ParaLineSpacingControl::ExecuteLineSpacing( bool aIsCustom, sal_uInt16 aEntry ) void ParaLineSpacingControl::ExecuteLineSpacing(sal_uInt16 nEntry)
{ {
if( !aIsCustom ) mpLineDist->SelectEntryPos(nEntry) ;
{ mpLineDist->SaveValue();
mpLineDist->SelectEntryPos( aEntry ) ; SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
mpLineDist->SaveValue();
SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); // special-case the 1.15 line spacing
sal_uInt16 nPos = aEntry; if (nEntry == LLINESPACE_115)
if( aEntry == LLINESPACE_PROP ) SetLineSpace(aSpacing, LLINESPACE_PROP, mpLineDistAtPercentBox->Denormalize(115L));
SetLineSpace( aSpacing, nPos, mpLineDistAtPercentBox->Denormalize( (long)115 ) ); else
else SetLineSpace(aSpacing, nEntry);
SetLineSpace( aSpacing, nPos );
SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute(
SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute(
SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L);
}
if( !aIsCustom ) mbUseLineSPCustom = DO_NOT_CUSTOM;
{
mbUseLineSPCustom = DO_NOT_CUSTOM; // close when the user used the buttons
} EndPopupMode();
// maLineSpacing.SetNoSelection();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
void SetLineSpace( SvxLineSpacingItem& rLineSpace, void SetLineSpace( SvxLineSpacingItem& rLineSpace,
int eSpace, long lValue = 0 ); int eSpace, long lValue = 0 );
void ExecuteLineSpacing( bool aIsCustom, sal_uInt16 aEntry ); void ExecuteLineSpacing(sal_uInt16 aEntry);
void PopupModeEndCallback(); void PopupModeEndCallback();
private: private:
...@@ -61,7 +61,6 @@ private: ...@@ -61,7 +61,6 @@ private:
PushButton* mpSpacing115Button; PushButton* mpSpacing115Button;
PushButton* mpSpacing15Button; PushButton* mpSpacing15Button;
PushButton* mpSpacing2Button; PushButton* mpSpacing2Button;
PushButton* mpSpacingLastButton;
ListBox* mpLineDist; ListBox* mpLineDist;
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<!-- interface-requires gtk+ 3.10 --> <!-- 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"> <object class="GtkWindow" id="ParaLineSpacingControl">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
...@@ -66,9 +17,9 @@ ...@@ -66,9 +17,9 @@
<object class="GtkGrid" id="grid2"> <object class="GtkGrid" id="grid2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_right">6</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="row_spacing">6</property>
<child> <child>
<object class="GtkButton" id="spacing_1"> <object class="GtkButton" id="spacing_1">
<property name="label">Spacing: 1</property> <property name="label">Spacing: 1</property>
...@@ -141,24 +92,6 @@ ...@@ -141,24 +92,6 @@
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
</child> </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> <child>
<object class="GtkFrame" id="frame1"> <object class="GtkFrame" id="frame1">
<property name="visible">True</property> <property name="visible">True</property>
...@@ -242,6 +175,7 @@ ...@@ -242,6 +175,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="invisible_char"></property> <property name="invisible_char"></property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment1</property> <property name="adjustment">adjustment1</property>
</object> </object>
<packing> <packing>
...@@ -257,6 +191,7 @@ ...@@ -257,6 +191,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="invisible_char"></property> <property name="invisible_char"></property>
<property name="invisible_char_set">True</property>
<property name="adjustment">adjustment2</property> <property name="adjustment">adjustment2</property>
</object> </object>
<packing> <packing>
...@@ -291,7 +226,7 @@ ...@@ -291,7 +226,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <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="width">1</property>
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
...@@ -299,4 +234,45 @@ ...@@ -299,4 +234,45 @@
</object> </object>
</child> </child>
</object> </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> </interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment