cui/source/inc/paragrph.hxx | 3 + cui/source/tabpages/paragrph.cxx | 12 ++++- editeng/source/items/paraitem.cxx | 89 ++++++++++++++++++++++++++++++++------ include/editeng/editrids.hrc | 8 +++ 4 files changed, 98 insertions(+), 14 deletions(-)
New commits: commit 5f5bfddf5fe8bbcd77dbb040d0bf77d595c90f30 Author: Jim Raykowski <rayk...@gmail..com> AuthorDate: Sat Jul 20 13:17:06 2019 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Sat Jul 27 05:11:37 2019 +0200 tdf#94395 Show paragraph style line spacing in organizer contains This patch provides functionality to SvxLineSpacingItem::GetPresentation and also fixes tdf#126466 Change-Id: I9e0cb042c83c568051061de3467d402ef88cfdf4 Reviewed-on: https://gerrit.libreoffice.org/76069 Tested-by: Jenkins Reviewed-by: Jim Raykowski <rayk...@gmail.com> diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index bccaefeb6cac..35a9bea4b30c 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -90,10 +90,13 @@ private: void UpdateExample_Impl(); void ELRLoseFocus(); + DECL_LINK(LineDistPopupHdl_Impl, weld::ComboBox&, void); DECL_LINK(LineDistHdl_Impl, weld::ComboBox&, void); DECL_LINK(ModifyHdl_Impl, weld::MetricSpinButton&, void); DECL_LINK(AutoHdl_Impl, weld::ToggleButton&, void); + bool m_bLineDistToggled = false; + protected: virtual void ActivatePage( const SfxItemSet& rSet ) override; virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index fb00c542c08c..0560ab0c0e2d 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -226,7 +226,8 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) int nPos = m_xLineDist->get_active(); if ( nPos != -1 && - ( m_xLineDist->get_value_changed_from_saved() || + ( m_bLineDistToggled || + m_xLineDist->get_value_changed_from_saved() || m_xLineDistAtPercentBox->get_value_changed_from_saved() || m_xLineDistAtMetricBox->get_value_changed_from_saved() ) ) { @@ -264,7 +265,8 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) eState = GetItemSet().GetItemState( nWhich ); pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_LINESPACE ); - if ( !pOld || !( *static_cast<const SvxLineSpacingItem*>(pOld) == aSpacing ) || + if ( m_bLineDistToggled || + !pOld || !( *static_cast<const SvxLineSpacingItem*>(pOld) == aSpacing ) || SfxItemState::DONTCARE == eState ) { rOutSet->Put( aSpacing ); @@ -789,6 +791,11 @@ void SvxStdParagraphTabPage::SetLineSpacing_Impl LineDistHdl_Impl( *m_xLineDist ); } +IMPL_LINK_NOARG(SvxStdParagraphTabPage, LineDistPopupHdl_Impl, weld::ComboBox&, void) +{ + m_bLineDistToggled = true; +} + IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void) { switch (rBox.get_active()) @@ -863,6 +870,7 @@ IMPL_LINK_NOARG(SvxStdParagraphTabPage, ModifyHdl_Impl, weld::MetricSpinButton&, void SvxStdParagraphTabPage::Init_Impl() { + m_xLineDist->connect_popup_toggled(LINK(this, SvxStdParagraphTabPage, LineDistPopupHdl_Impl)); m_xLineDist->connect_changed(LINK(this, SvxStdParagraphTabPage, LineDistHdl_Impl)); Link<weld::MetricSpinButton&,void> aLink2 = LINK(this, SvxStdParagraphTabPage, ELRLoseFocusHdl); diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 4cf9750f15ca..283ae8fab51b 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -48,6 +48,7 @@ #include <sal/log.hxx> #include <editeng/memberids.h> #include <editeng/editids.hrc> +#include <editeng/editrids.hrc> #include <editeng/itemtype.hxx> #include <editeng/eerdll.hxx> #include <editeng/paperinf.hxx> @@ -226,23 +227,87 @@ SfxPoolItem* SvxLineSpacingItem::Clone( SfxItemPool * ) const return new SvxLineSpacingItem( *this ); } - bool SvxLineSpacingItem::GetPresentation ( - SfxItemPresentation /*ePres*/, - MapUnit /*eCoreUnit*/, - MapUnit /*ePresUnit*/, - OUString& rText, const IntlWrapper& + SfxItemPresentation ePres, + MapUnit eCoreUnit, + MapUnit ePresUnit, + OUString& rText, const IntlWrapper& rIntl ) const { -#ifdef DBG_UTIL - rText = "SvxLineSpacingItem"; -#else - rText.clear(); -#endif - return false; -} + switch ( ePres ) + { + case SfxItemPresentation::Nameless: + case SfxItemPresentation::Complete: + { + switch( GetLineSpaceRule() ) + { + case SvxLineSpaceRule::Auto: + { + SvxInterLineSpaceRule eInter = GetInterLineSpaceRule(); + switch( eInter ) + { + // Default single line spacing + case SvxInterLineSpaceRule::Off: + rText = EditResId(RID_SVXITEMS_LINESPACING_SINGLE); + break; + + // Default single line spacing + case SvxInterLineSpaceRule::Prop: + if ( 100 == GetPropLineSpace() ) + { + rText = EditResId(RID_SVXITEMS_LINESPACING_SINGLE); + break; + } + // 1.15 line spacing + if ( 115 == GetPropLineSpace() ) + { + rText = EditResId(RID_SVXITEMS_LINESPACING_115); + break; + } + // 1.5 line spacing + if ( 150 == GetPropLineSpace() ) + { + rText = EditResId(RID_SVXITEMS_LINESPACING_15); + break; + } + // double line spacing + if ( 200 == GetPropLineSpace() ) + { + rText = EditResId(RID_SVXITEMS_LINESPACING_DOUBLE); + break; + } + // the set per cent value + rText = EditResId(RID_SVXITEMS_LINESPACING_PROPORTIONAL) + " " + OUString::number(GetPropLineSpace()) + "%"; + break; + + case SvxInterLineSpaceRule::Fix: + rText = EditResId(RID_SVXITEMS_LINESPACING_LEADING) + + " " + GetMetricText(GetInterLineSpace(), eCoreUnit, ePresUnit, &rIntl) + + " " + EditResId(GetMetricId(ePresUnit)); + break; + default: ;//prevent warning + } + } + break; + case SvxLineSpaceRule::Fix: + rText = EditResId(RID_SVXITEMS_LINESPACING_FIXED) + + " " + GetMetricText(GetLineHeight(), eCoreUnit, ePresUnit, &rIntl) + + " " + EditResId(GetMetricId(ePresUnit)); + break; + + case SvxLineSpaceRule::Min: + rText = EditResId(RID_SVXITEMS_LINESPACING_MIN) + + " " + GetMetricText(GetLineHeight(), eCoreUnit, ePresUnit, &rIntl) + + " " + EditResId(GetMetricId(ePresUnit)); + break; + default: ;//prevent warning + } + } + } + return true; +} sal_uInt16 SvxLineSpacingItem::GetValueCount() const { diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc index 5a75b4ff8c85..983fb2b05c2d 100644 --- a/include/editeng/editrids.hrc +++ b/include/editeng/editrids.hrc @@ -215,6 +215,14 @@ #define RID_SVXITEMS_BORDER_DISTANCE NC_("RID_SVXITEMS_BORDER_DISTANCE", "Spacing ") #define RID_SVXITEMS_ULSPACE_UPPER NC_("RID_SVXITEMS_ULSPACE_UPPER", "From top ") #define RID_SVXITEMS_ULSPACE_LOWER NC_("RID_SVXITEMS_ULSPACE_LOWER", "From bottom ") +#define RID_SVXITEMS_LINESPACING_SINGLE NC_("RID_SVXITEMS_LINESPACING_SINGLE", "Single") +#define RID_SVXITEMS_LINESPACING_115 NC_("RID_SVXITEMS_LINESPACING_115", "1.15 Lines") +#define RID_SVXITEMS_LINESPACING_15 NC_("RID_SVXITEMS_LINESPACING_15", "1.5 Lines") +#define RID_SVXITEMS_LINESPACING_DOUBLE NC_("RID_SVXITEMS_LINESPACING_DOUBLE", "Double") +#define RID_SVXITEMS_LINESPACING_PROPORTIONAL NC_("RID_SVXITEMS_LINESPACING_PROPORTIONAL", "Proportional") +#define RID_SVXITEMS_LINESPACING_MIN NC_("RID_SVXITEMS_LINESPACING_MIN", "At least") +#define RID_SVXITEMS_LINESPACING_LEADING NC_("RID_SVXITEMS_LINESPACING_LEADING", "Leading") +#define RID_SVXITEMS_LINESPACING_FIXED NC_("RID_SVXITEMS_LINESPACING_FIXED", "Fixed") // To translators: %1 == will be replaced by the number of lines #define RID_SVXITEMS_LINES NC_("RID_SVXITEMS_LINES", "%1 Lines") #define RID_SVXITEMS_WIDOWS_COMPLETE NC_("RID_SVXITEMS_WIDOWS_COMPLETE", "Widow control") _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits