cui/source/inc/align.hxx | 12 +++++++++- cui/source/tabpages/align.cxx | 48 ++++++++++++++++++++++++++++++++++-------- svx/source/items/pageitem.cxx | 31 +++++++++++++++++++++++---- 3 files changed, 77 insertions(+), 14 deletions(-)
New commits: commit e79befa6898aef6616adca9e89398242abe9dc5a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri May 17 17:09:16 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat May 18 22:39:43 2019 +0200 Resolves: tdf#124467 enable wrap text to return to TRISTATE_INDET Change-Id: Ie956560885fd9bb9e7367018a2f6e37a26c3c6af Reviewed-on: https://gerrit.libreoffice.org/72494 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx index 374a57c7e25a..063d5b1f59f5 100644 --- a/cui/source/inc/align.hxx +++ b/cui/source/inc/align.hxx @@ -71,9 +71,19 @@ private: bool HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const; DECL_LINK(UpdateEnableHdl, weld::ComboBox&, void); - DECL_LINK(UpdateEnableClickHdl, weld::ToggleButton&, void); + DECL_LINK(StackedClickHdl, weld::ToggleButton&, void); + DECL_LINK(AsianModeClickHdl, weld::ToggleButton&, void); + DECL_LINK(WrapClickHdl, weld::ToggleButton&, void); + DECL_LINK(HyphenClickHdl, weld::ToggleButton&, void); + DECL_LINK(ShrinkClickHdl, weld::ToggleButton&, void); private: + weld::TriStateEnabled m_aStackedState; + weld::TriStateEnabled m_aAsianModeState; + weld::TriStateEnabled m_aWrapState; + weld::TriStateEnabled m_aHyphenState; + weld::TriStateEnabled m_aShrinkState; + SvxDialControl m_aCtrlDial; SvtValueSet m_aVsRefEdge; diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index e9cf3930b3fb..900a91f7acd8 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -143,8 +143,12 @@ AlignmentTabPage::AlignmentTabPage(TabPageParent pParent, const SfxItemSet& rCor InitVsRefEgde(); m_xLbHorAlign->connect_changed(LINK(this, AlignmentTabPage, UpdateEnableHdl)); - m_xBtnWrap->connect_toggled(LINK(this, AlignmentTabPage, UpdateEnableClickHdl)); - m_xCbStacked->connect_toggled(LINK(this, AlignmentTabPage, UpdateEnableClickHdl)); + + m_xCbStacked->connect_toggled(LINK(this, AlignmentTabPage, StackedClickHdl)); + m_xCbAsianMode->connect_toggled(LINK(this, AlignmentTabPage, AsianModeClickHdl)); + m_xBtnWrap->connect_toggled(LINK(this, AlignmentTabPage, WrapClickHdl)); + m_xBtnHyphen->connect_toggled(LINK(this, AlignmentTabPage, HyphenClickHdl)); + m_xBtnShrink->connect_toggled(LINK(this, AlignmentTabPage, ShrinkClickHdl)); // Asian vertical mode m_xCbAsianMode->set_visible(SvtCJKOptions().IsVerticalTextEnabled()); @@ -322,26 +326,30 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) namespace { - void ResetBool(sal_uInt16 nWhich, const SfxItemSet* pSet, weld::CheckButton& rBtn) + void ResetBool(sal_uInt16 nWhich, const SfxItemSet* pSet, weld::CheckButton& rBtn, weld::TriStateEnabled& rTriState) { SfxItemState eState = pSet->GetItemState(nWhich); switch (eState) { case SfxItemState::UNKNOWN: rBtn.hide(); + rTriState.bTriStateEnabled = false; break; case SfxItemState::DISABLED: case SfxItemState::READONLY: rBtn.set_sensitive(false); + rTriState.bTriStateEnabled = false; break; case SfxItemState::DONTCARE: rBtn.set_state(TRISTATE_INDET); + rTriState.bTriStateEnabled = true; break; case SfxItemState::DEFAULT: case SfxItemState::SET: { const SfxBoolItem& rItem = static_cast<const SfxBoolItem&>(pSet->Get(nWhich)); rBtn.set_state(static_cast<TriState>(rItem.GetValue())); + rTriState.bTriStateEnabled = false; break; } } @@ -353,11 +361,11 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) { SfxTabPage::Reset(pCoreAttrs); - ResetBool(GetWhich(SID_ATTR_ALIGN_STACKED), pCoreAttrs, *m_xCbStacked); - ResetBool(GetWhich(SID_ATTR_ALIGN_ASIANVERTICAL), pCoreAttrs, *m_xCbAsianMode); - ResetBool(GetWhich(SID_ATTR_ALIGN_LINEBREAK), pCoreAttrs, *m_xBtnWrap); - ResetBool(GetWhich(SID_ATTR_ALIGN_HYPHENATION), pCoreAttrs, *m_xBtnHyphen); - ResetBool(GetWhich(SID_ATTR_ALIGN_SHRINKTOFIT), pCoreAttrs, *m_xBtnShrink); + ResetBool(GetWhich(SID_ATTR_ALIGN_STACKED), pCoreAttrs, *m_xCbStacked, m_aStackedState); + ResetBool(GetWhich(SID_ATTR_ALIGN_ASIANVERTICAL), pCoreAttrs, *m_xCbAsianMode, m_aAsianModeState); + ResetBool(GetWhich(SID_ATTR_ALIGN_LINEBREAK), pCoreAttrs, *m_xBtnWrap, m_aWrapState); + ResetBool(GetWhich(SID_ATTR_ALIGN_HYPHENATION), pCoreAttrs, *m_xBtnHyphen, m_aHyphenState); + ResetBool(GetWhich(SID_ATTR_ALIGN_SHRINKTOFIT), pCoreAttrs, *m_xBtnShrink, m_aShrinkState); sal_uInt16 nWhich = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY); SfxItemState eState = pCoreAttrs->GetItemState(nWhich); @@ -676,8 +684,30 @@ bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 n return eMethodOld != eMethodNew; } -IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableClickHdl, weld::ToggleButton&, void) +IMPL_LINK(AlignmentTabPage, StackedClickHdl, weld::ToggleButton&, rToggle, void) +{ + m_aStackedState.ButtonToggled(rToggle); + UpdateEnableControls(); +} + +IMPL_LINK(AlignmentTabPage, AsianModeClickHdl, weld::ToggleButton&, rToggle, void) +{ + m_aAsianModeState.ButtonToggled(rToggle); +} + +IMPL_LINK(AlignmentTabPage, WrapClickHdl, weld::ToggleButton&, rToggle, void) +{ + m_aWrapState.ButtonToggled(rToggle); +} + +IMPL_LINK(AlignmentTabPage, HyphenClickHdl, weld::ToggleButton&, rToggle, void) +{ + m_aHyphenState.ButtonToggled(rToggle); +} + +IMPL_LINK(AlignmentTabPage, ShrinkClickHdl, weld::ToggleButton&, rToggle, void) { + m_aShrinkState.ButtonToggled(rToggle); UpdateEnableControls(); } commit c6b5169541aa50fcf53a55372d5c2b82e20e9111 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri May 17 15:44:02 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat May 18 22:39:17 2019 +0200 Resolves: tdf#125104 crash on getting text desc of numbering this seems to have been wrong for a very long time, but we used to get away with it back in the .src era with presumably amusingly random strings from other parts of the ui shown in the summary of changes are of the organizer page of the dialog Change-Id: If223182170ba8519d7899f8044f01c2a12f4e391 Reviewed-on: https://gerrit.libreoffice.org/72490 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index d7b1b619b57f..8e714ca0abaa 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -22,10 +22,15 @@ #include <utility> #include <osl/diagnose.h> +#include <comphelper/processfactory.hxx> #include <tools/stream.hxx> +#include <tools/resary.hxx> #include <svx/pageitem.hxx> +#include <svx/strarray.hxx> #include <editeng/itemtype.hxx> #include <svx/unomid.hxx> +#include <com/sun/star/text/DefaultNumberingProvider.hpp> +#include <com/sun/star/text/XNumberingTypeInfo.hpp> #include <com/sun/star/style/NumberingType.hpp> #include <com/sun/star/style/PageStyleLayout.hpp> #include <com/sun/star/style/BreakType.hpp> @@ -95,6 +100,26 @@ static const char* RID_SVXITEMS_PAGE_NUMS[] = RID_SVXITEMS_PAGE_NUM_NONE }; +namespace +{ + OUString GetNumberingDescription(SvxNumType eNumType) + { + // classic ones, keep displaying the old name + if (eNumType <= css::style::NumberingType::NUMBER_NONE) + return SvxResId(RID_SVXITEMS_PAGE_NUMS[eNumType]); + // new ones, reuse the text used in the numbering dropdown list + sal_uInt32 n = SvxNumberingTypeTable::FindIndex(eNumType); + if (n != RESARRAY_INDEX_NOTFOUND) + return SvxNumberingTypeTable::GetString(n); + css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext(); + css::uno::Reference<css::text::XDefaultNumberingProvider> xDefNum = css::text::DefaultNumberingProvider::create(xContext); + css::uno::Reference<css::text::XNumberingTypeInfo> xInfo(xDefNum, css::uno::UNO_QUERY); + if (!xInfo.is()) + return OUString(); + return xInfo->getNumberingIdentifier(eNumType); + } +} + bool SvxPageItem::GetPresentation ( SfxItemPresentation ePres, @@ -114,8 +139,7 @@ bool SvxPageItem::GetPresentation { rText = aDescName + cpDelimTmp; } - assert(eNumType <= css::style::NumberingType::NUMBER_NONE && "enum overflow"); - rText += SvxResId(RID_SVXITEMS_PAGE_NUMS[eNumType]) + cpDelimTmp; + rText += GetNumberingDescription(eNumType) + cpDelimTmp; if ( bLandscape ) rText += SvxResId(RID_SVXITEMS_PAGE_LAND_TRUE); else @@ -134,8 +158,7 @@ bool SvxPageItem::GetPresentation { rText += aDescName + cpDelimTmp; } - assert(eNumType <= css::style::NumberingType::NUMBER_NONE && "enum overflow"); - rText += SvxResId(RID_SVXITEMS_PAGE_NUMS[eNumType]) + cpDelimTmp; + rText += GetNumberingDescription(eNumType) + cpDelimTmp; if ( bLandscape ) rText += SvxResId(RID_SVXITEMS_PAGE_LAND_TRUE); else _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits