summaryrefslogtreecommitdiff
path: root/svx/source/sidebar
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/source/sidebar
parent5bb43d06622a10c247ceeaeaceb236c5e3dcdcf0 (diff)
line spacing: Kill the "Last value" button. Close popup when used via buttons.
Change-Id: I48eabbe5e1f41f5ed015d2fa95ade5376576cac9
Diffstat (limited to 'svx/source/sidebar')
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx82
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx3
2 files changed, 25 insertions, 60 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;