summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-04-22 15:22:03 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-04-22 14:47:54 +0000
commit9a745d54a5c7470180f41494283983a3b8b84a51 (patch)
treeb5ce765cfdd1ba1faa93480aa8f3cd54c6d4e838 /cui
parent3ae1e174014fc708833f3b43682573de1650af56 (diff)
tdf#89953 Character spacing: Allow to enter negative values
without selecting from a condensed/expanded listbox first. Change-Id: I1111e6f1d7cdc6c0bc79d542f49c58f1022ad739 Reviewed-on: https://gerrit.libreoffice.org/24301 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/chardlg.hxx4
-rw-r--r--cui/source/tabpages/chardlg.cxx103
-rw-r--r--cui/uiconfig/ui/positionpage.ui66
3 files changed, 12 insertions, 161 deletions
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index ed2fc5933021..bfa100cf5753 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -276,8 +276,6 @@ private:
VclPtr<MetricField> m_pScaleWidthMF;
- VclPtr<ListBox> m_pKerningLB;
- VclPtr<FixedText> m_pKerningFT;
VclPtr<MetricField> m_pKerningMF;
VclPtr<CheckBox> m_pPairKerningBtn;
@@ -310,11 +308,9 @@ public:
virtual ~SvxCharPositionPage();
virtual void dispose() override;
- using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage;
virtual sfxpg DeactivatePage( SfxItemSet* pSet = nullptr ) override;
- virtual void ActivatePage( const SfxItemSet& rSet ) override;
public:
static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index d0d76c1be32a..4f1cd066434c 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -80,10 +80,6 @@ using namespace ::com::sun::star;
#define CLEARTITEM rSet.InvalidateItem(nWhich)
-#define LW_NORMAL 0
-#define LW_EXPANDED 1
-#define LW_CONDENSED 2
-
// static ----------------------------------------------------------------
const sal_uInt16 SvxCharNamePage::pNameRanges[] =
@@ -2636,8 +2632,6 @@ SvxCharPositionPage::SvxCharPositionPage( vcl::Window* pParent, const SfxItemSet
get(m_p270degRB, "270deg");
get(m_pFitToLineCB, "fittoline");
get(m_pScaleWidthMF, "scalewidthsb");
- get(m_pKerningLB, "kerninglb");
- get(m_pKerningFT, "kerningft");
get(m_pKerningMF, "kerningsb");
get(m_pPairKerningBtn, "pairkerning");
@@ -2669,8 +2663,6 @@ void SvxCharPositionPage::dispose()
m_p270degRB.clear();
m_pFitToLineCB.clear();
m_pScaleWidthMF.clear();
- m_pKerningLB.clear();
- m_pKerningFT.clear();
m_pKerningMF.clear();
m_pPairKerningBtn.clear();
SvxCharBasePage::dispose();
@@ -2688,8 +2680,6 @@ void SvxCharPositionPage::Initialize()
m_pNormalPosBtn->Check();
PositionHdl_Impl( m_pNormalPosBtn );
- m_pKerningLB->SelectEntryPos( 0 );
- KerningSelectHdl_Impl( *m_pKerningLB );
Link<Button*,void> aLink2 = LINK( this, SvxCharPositionPage, PositionHdl_Impl );
m_pHighPosBtn->SetClickHdl( aLink2 );
@@ -2711,7 +2701,6 @@ void SvxCharPositionPage::Initialize()
m_pHighLowRB->SetClickHdl( LINK( this, SvxCharPositionPage, AutoPositionHdl_Impl ) );
m_pFitToLineCB->SetClickHdl( LINK( this, SvxCharPositionPage, FitToLineHdl_Impl ) );
- m_pKerningLB->SetSelectHdl( LINK( this, SvxCharPositionPage, KerningSelectHdl_Impl ) );
m_pKerningMF->SetModifyHdl( LINK( this, SvxCharPositionPage, KerningModifyHdl_Impl ) );
m_pScaleWidthMF->SetModifyHdl( LINK( this, SvxCharPositionPage, ScaleWidthModifyHdl_Impl ) );
}
@@ -2830,48 +2819,12 @@ IMPL_LINK_TYPED( SvxCharPositionPage, FitToLineHdl_Impl, Button*, pBox, void )
}
-IMPL_LINK_NOARG_TYPED(SvxCharPositionPage, KerningSelectHdl_Impl, ListBox&, void)
-{
- if ( m_pKerningLB->GetSelectEntryPos() > LW_NORMAL )
- {
- m_pKerningFT->Enable();
- m_pKerningMF->Enable();
-
- if ( m_pKerningLB->GetSelectEntryPos() == LW_CONDENSED )
- {
- // Condensed -> max value == 1/6 of the current font height
- SvxFont& rFont = GetPreviewFont();
- long nMax = rFont.GetFontSize().Height() / 6;
- m_pKerningMF->SetMax( m_pKerningMF->Normalize( nMax ), FUNIT_TWIP );
- m_pKerningMF->SetLast( m_pKerningMF->GetMax( m_pKerningMF->GetUnit() ) );
- }
- else
- {
- m_pKerningMF->SetMax( 9999 );
- m_pKerningMF->SetLast( 9999 );
- }
- }
- else
- {
- m_pKerningMF->SetValue( 0 );
- m_pKerningFT->Disable();
- m_pKerningMF->Disable();
- }
-
- KerningModifyHdl_Impl( *m_pKerningMF );
-}
-
-
IMPL_LINK_NOARG_TYPED(SvxCharPositionPage, KerningModifyHdl_Impl, Edit&, void)
{
long nVal = static_cast<long>(m_pKerningMF->GetValue());
nVal = LogicToLogic( nVal, MAP_POINT, MAP_TWIP );
long nKern = (short)m_pKerningMF->Denormalize( nVal );
- // Condensed? -> then negative
- if ( m_pKerningLB->GetSelectEntryPos() == LW_CONDENSED )
- nKern *= -1;
-
SvxFont& rFont = GetPreviewFont();
SvxFont& rCJKFont = GetPreviewCJKFont();
SvxFont& rCTLFont = GetPreviewCTLFont();
@@ -2912,25 +2865,6 @@ IMPL_LINK_NOARG_TYPED(SvxCharPositionPage, ScaleWidthModifyHdl_Impl, Edit&, void
m_pPreviewWin->SetFontWidthScale( sal_uInt16( m_pScaleWidthMF->GetValue() ) );
}
-void SvxCharPositionPage::ActivatePage( const SfxItemSet& rSet )
-{
- //update the preview
- SvxCharBasePage::ActivatePage( rSet );
-
- //the only thing that has to be checked is the max. allowed value for the
- //condense edit field
- if ( m_pKerningLB->GetSelectEntryPos() == LW_CONDENSED )
- {
- // Condensed -> max value == 1/6 of the current font height
- SvxFont& rFont = GetPreviewFont();
- long nMax = rFont.GetFontSize().Height() / 6;
- long nKern = (short)m_pKerningMF->Denormalize( LogicToLogic( static_cast<long>(m_pKerningMF->GetValue()), MAP_POINT, MAP_TWIP ) );
- m_pKerningMF->SetMax( m_pKerningMF->Normalize( nKern > nMax ? nKern : nMax ), FUNIT_TWIP );
- m_pKerningMF->SetLast( m_pKerningMF->GetMax( m_pKerningMF->GetUnit() ) );
- }
-}
-
-
SfxTabPage::sfxpg SvxCharPositionPage::DeactivatePage( SfxItemSet* _pSet )
{
if ( _pSet )
@@ -3077,22 +3011,6 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
rCJKFont.SetFixKerning( (short)nKern );
rCTLFont.SetFixKerning( (short)nKern );
- if ( nKerning > 0 )
- {
- m_pKerningLB->SelectEntryPos( LW_EXPANDED );
- }
- else if ( nKerning < 0 )
- {
- m_pKerningLB->SelectEntryPos( LW_CONDENSED );
- nKerning = -nKerning;
- }
- else
- {
- nKerning = 0;
- m_pKerningLB->SelectEntryPos( LW_NORMAL );
- }
- //enable/disable and set min/max of the Edit
- KerningSelectHdl_Impl(*m_pKerningLB);
//the attribute value must be displayed also if it's above the maximum allowed value
long nVal = static_cast<long>(m_pKerningMF->GetMax());
if(nVal < nKerning)
@@ -3195,7 +3113,6 @@ void SvxCharPositionPage::ChangesApplied()
m_p270degRB->SaveValue();
m_pFitToLineCB->SaveValue();
m_pScaleWidthMF->SaveValue();
- m_pKerningLB->SaveValue();
m_pKerningMF->SaveValue();
m_pPairKerningBtn->SaveValue();
}
@@ -3254,19 +3171,12 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
// Kerning
nWhich = GetWhich( SID_ATTR_CHAR_KERNING );
pOld = GetOldItem( *rSet, SID_ATTR_CHAR_KERNING );
- sal_Int32 nPos = m_pKerningLB->GetSelectEntryPos();
short nKerning = 0;
SfxMapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
- if ( nPos == LW_EXPANDED || nPos == LW_CONDENSED )
- {
- long nTmp = static_cast<long>(m_pKerningMF->GetValue());
- long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
- nKerning = (short)m_pKerningMF->Denormalize( nVal );
-
- if ( nPos == LW_CONDENSED )
- nKerning *= - 1;
- }
+ long nTmp = static_cast<long>(m_pKerningMF->GetValue());
+ long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
+ nKerning = (short)m_pKerningMF->Denormalize( nVal );
if ( pOld )
{
@@ -3275,12 +3185,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
bChanged = false;
}
- if ( !bChanged &&
- ( m_pKerningLB->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ||
- ( m_pKerningMF->GetSavedValue().isEmpty() && m_pKerningMF->IsEnabled() ) ) )
- bChanged = true;
-
- if ( bChanged && nPos != LISTBOX_ENTRY_NOTFOUND )
+ if ( bChanged )
{
rSet->Put( SvxKerningItem( nKerning, nWhich ) );
bModified = true;
diff --git a/cui/uiconfig/ui/positionpage.ui b/cui/uiconfig/ui/positionpage.ui
index 22776edb2c96..86ab691dc896 100644
--- a/cui/uiconfig/ui/positionpage.ui
+++ b/cui/uiconfig/ui/positionpage.ui
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.18.3 -->
<interface>
- <!-- interface-requires LibreOffice 1.0 -->
<requires lib="gtk+" version="3.0"/>
+ <requires lib="LibreOffice" version="1.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">100</property>
@@ -18,27 +18,11 @@
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
- <property name="upper">999.89999999999998</property>
+ <property name="lower">-2</property>
+ <property name="upper">1000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
- <object class="GtkListStore" id="liststore1">
- <columns>
- <!-- column-name gchararray1 -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Default</col>
- </row>
- <row>
- <col id="0" translatable="yes">Expanded</col>
- </row>
- <row>
- <col id="0" translatable="yes">Condensed</col>
- </row>
- </data>
- </object>
<object class="GtkBox" id="PositionPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -134,16 +118,14 @@
<object class="GtkLabel" id="raiselower">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">Raise/lower by</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">raiselowersb:0%</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -156,8 +138,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -170,8 +150,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -186,24 +164,20 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="relativefontsize">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes">Relative font size</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">fontsizesb:0%</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -436,30 +410,6 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
- <object class="GtkComboBox" id="kerninglb">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">liststore1</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="kerningft">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">by</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
<object class="GtkSpinButton" id="kerningsb:0pt">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -470,7 +420,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -485,7 +435,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">1</property>
</packing>
</child>
</object>