diff --git a/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt index 03d969ae0e0d..e317c127e92a 100644 --- a/icon-themes/breeze/links.txt +++ b/icon-themes/breeze/links.txt @@ -1736,6 +1736,10 @@ cmd/32/hyphenation.png cmd/32/hyphenate.png cmd/lc_hyphenation.png cmd/lc_hyphenate.png cmd/sc_hyphenation.png cmd/sc_hyphenate.png +cmd/32/nobreak.png cmd/32/cancel.png +cmd/lc_nobreak.png cmd/lc_cancel.png +cmd/sc_nobreak.png cmd/sc_cancel.png + # Currency cmd/32/numberformatcurrency.png cmd/32/currencyfield.png cmd/32/numberformatcurrencysimple.png cmd/32/currencyfield.png diff --git a/icon-themes/breeze_dark/links.txt b/icon-themes/breeze_dark/links.txt index 748bc16ab2d2..d1b89e079757 100644 --- a/icon-themes/breeze_dark/links.txt +++ b/icon-themes/breeze_dark/links.txt @@ -1736,6 +1736,10 @@ cmd/32/hyphenation.png cmd/32/hyphenate.png cmd/lc_hyphenation.png cmd/lc_hyphenate.png cmd/sc_hyphenation.png cmd/sc_hyphenate.png +cmd/32/nobreak.png cmd/32/cancel.png +cmd/lc_nobreak.png cmd/lc_cancel.png +cmd/sc_nobreak.png cmd/sc_cancel.png + # Currency cmd/32/numberformatcurrency.png cmd/32/currencyfield.png cmd/32/numberformatcurrencysimple.png cmd/32/currencyfield.png diff --git a/icon-themes/colibre/links.txt b/icon-themes/colibre/links.txt index f7fa0cc05107..69cbb9555f8b 100644 --- a/icon-themes/colibre/links.txt +++ b/icon-themes/colibre/links.txt @@ -1537,6 +1537,10 @@ cmd/32/hyphenation.png cmd/32/hyphenate.png cmd/lc_hyphenation.png cmd/lc_hyphenate.png cmd/sc_hyphenation.png cmd/sc_hyphenate.png +cmd/32/nobreak.png cmd/32/cancel.png +cmd/lc_nobreak.png cmd/lc_cancel.png +cmd/sc_nobreak.png cmd/sc_cancel.png + # Currency cmd/32/numberformatcurrencysimple.png cmd/32/numberformatcurrency.png cmd/lc_numberformatcurrencysimple.png cmd/lc_numberformatcurrency.png diff --git a/icon-themes/colibre_dark/links.txt b/icon-themes/colibre_dark/links.txt index ede4f262cddb..ae2531694054 100644 --- a/icon-themes/colibre_dark/links.txt +++ b/icon-themes/colibre_dark/links.txt @@ -1536,6 +1536,10 @@ cmd/32/hyphenation.png cmd/32/hyphenate.png cmd/lc_hyphenation.png cmd/lc_hyphenate.png cmd/sc_hyphenation.png cmd/sc_hyphenate.png +cmd/32/nobreak.png cmd/32/cancel.png +cmd/lc_nobreak.png cmd/lc_cancel.png +cmd/sc_nobreak.png cmd/sc_cancel.png + # Currency cmd/32/numberformatcurrencysimple.png cmd/32/numberformatcurrency.png cmd/lc_numberformatcurrencysimple.png cmd/lc_numberformatcurrency.png diff --git a/icon-themes/elementary/links.txt b/icon-themes/elementary/links.txt index cc35e834f5e9..393f100f1a36 100644 --- a/icon-themes/elementary/links.txt +++ b/icon-themes/elementary/links.txt @@ -1552,6 +1552,10 @@ cmd/32/hyphenation.png cmd/32/hyphenate.png cmd/lc_hyphenation.png cmd/lc_hyphenate.png cmd/sc_hyphenation.png cmd/sc_hyphenate.png +cmd/32/nobreak.png cmd/32/cancel.png +cmd/lc_nobreak.png cmd/lc_cancel.png +cmd/sc_nobreak.png cmd/sc_cancel.png + # Currency cmd/32/insertcurrencyfield.png cmd/32/currencyfield.png cmd/32/numberformatcurrency.png cmd/32/currencyfield.png diff --git a/icon-themes/sifr/links.txt b/icon-themes/sifr/links.txt index ae5e9021ca37..f78e9ed531bb 100644 --- a/icon-themes/sifr/links.txt +++ b/icon-themes/sifr/links.txt @@ -1632,6 +1632,10 @@ cmd/lc_hyphenation.png cmd/lc_hyphenate.png cmd/sc_hyphenation.png cmd/sc_hyphenate.png +cmd/32/nobreak.png cmd/32/cancel.png +cmd/lc_nobreak.png cmd/lc_cancel.png +cmd/sc_nobreak.png cmd/sc_cancel.png + # Currency cmd/32/numberformatcurrency.png cmd/32/currencyfield.png cmd/32/numberformatcurrencysimple.png cmd/32/currencyfield.png diff --git a/icon-themes/sifr_dark/links.txt b/icon-themes/sifr_dark/links.txt index 5733722da4cb..d2d938e1a5c2 100644 --- a/icon-themes/sifr_dark/links.txt +++ b/icon-themes/sifr_dark/links.txt @@ -1631,6 +1631,10 @@ cmd/lc_hyphenation.png cmd/lc_hyphenate.png cmd/sc_hyphenation.png cmd/sc_hyphenate.png +cmd/32/nobreak.png cmd/32/cancel.png +cmd/lc_nobreak.png cmd/lc_cancel.png +cmd/sc_nobreak.png cmd/sc_cancel.png + # Currency cmd/32/numberformatcurrency.png cmd/32/currencyfield.png cmd/32/numberformatcurrencysimple.png cmd/32/currencyfield.png diff --git a/icon-themes/sukapura/links.txt b/icon-themes/sukapura/links.txt index 5bcf699978bd..945eaf721b5c 100644 --- a/icon-themes/sukapura/links.txt +++ b/icon-themes/sukapura/links.txt @@ -1581,6 +1581,10 @@ cmd/32/hyphenation.png cmd/32/hyphenate.png cmd/lc_hyphenation.png cmd/lc_hyphenate.png cmd/sc_hyphenation.png cmd/sc_hyphenate.png +cmd/32/nobreak.png cmd/32/cancel.png +cmd/lc_nobreak.png cmd/lc_cancel.png +cmd/sc_nobreak.png cmd/sc_cancel.png + # Currency cmd/32/numberformatcurrency.png cmd/32/currencyfield.png cmd/32/numberformatcurrencysimple.png cmd/32/currencyfield.png diff --git a/icon-themes/sukapura_dark/links.txt b/icon-themes/sukapura_dark/links.txt index 9552ccb3dbf5..4f0cb444b4fe 100644 --- a/icon-themes/sukapura_dark/links.txt +++ b/icon-themes/sukapura_dark/links.txt @@ -1580,6 +1580,10 @@ cmd/32/hyphenation.png cmd/32/hyphenate.png cmd/lc_hyphenation.png cmd/lc_hyphenate.png cmd/sc_hyphenation.png cmd/sc_hyphenate.png +cmd/32/nobreak.png cmd/32/cancel.png +cmd/lc_nobreak.png cmd/lc_cancel.png +cmd/sc_nobreak.png cmd/sc_cancel.png + # Currency cmd/32/numberformatcurrency.png cmd/32/currencyfield.png cmd/32/numberformatcurrencysimple.png cmd/32/currencyfield.png diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index 9ae5f1021926..2919ae37eb18 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -3046,6 +3046,9 @@ ~Hyphenation... + + Insert Soft Hyphen... + 9 @@ -3055,7 +3058,7 @@ No Break - 8 + 9 diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index c6f6b90d5bec..1b92f136fd29 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -78,6 +78,8 @@ void ParaPropertyPanel::HandleContextChange ( mxTBxVertAlign->show(); mxTBxBackColor->hide(); mxTBxNumBullet->hide(); + set_hyphenation_base_visible(false); + set_hyphenation_other_visible(false); ReSize(); break; @@ -89,6 +91,8 @@ void ParaPropertyPanel::HandleContextChange ( mxTBxVertAlign->show(); mxTBxBackColor->hide(); mxTBxNumBullet->hide(); + set_hyphenation_base_visible(false); + set_hyphenation_other_visible(false); ReSize(); break; @@ -97,6 +101,8 @@ void ParaPropertyPanel::HandleContextChange ( mxTBxVertAlign->hide(); mxTBxBackColor->show(); mxTBxNumBullet->show(); + set_hyphenation_base_visible(true); + set_hyphenation_other_visible(mxTBxHyphenation->get_item_active("Hyphenate")); ReSize(); break; @@ -104,6 +110,14 @@ void ParaPropertyPanel::HandleContextChange ( mxTBxVertAlign->show(); mxTBxBackColor->show(); mxTBxNumBullet->show(); + set_hyphenation_base_visible(true); + // close the optional controls (when the controls were hidden later, + // remained a big empty space before the Table panel) + // TODO: if the hyphenation is enabled in the table, and the hyphenation + // has exactly the same settings, as outside of the table, the controls + // remain hidden. Workaround: disable and enable hyphenation again. + // Enable it automatically by mouse hovering hyphenation sidebar toolbar? + set_hyphenation_other_visible(false); ReSize(); break; @@ -111,6 +125,7 @@ void ParaPropertyPanel::HandleContextChange ( mxTBxVertAlign->hide(); mxTBxBackColor->hide(); mxTBxNumBullet->hide(); + set_hyphenation_base_visible(true); ReSize(); break; @@ -120,6 +135,8 @@ void ParaPropertyPanel::HandleContextChange ( case CombinedEnumContext(Application::Calc, Context::Sparkline): case CombinedEnumContext(Application::DrawImpress, Context::Text): case CombinedEnumContext(Application::DrawImpress, Context::OutlineText): + set_hyphenation_base_visible(false); + set_hyphenation_other_visible(false); break; default: @@ -152,6 +169,65 @@ void ParaPropertyPanel::InitToolBoxSpacing() m_eULSpaceUnit = maULSpaceControl.GetCoreMetric(); } +void ParaPropertyPanel::set_hyphenation_base_visible( bool bVisible ) +{ + // hide all hyphenation control for non-Writer applications + // TODO: add automatic hyphenation for these, too + mxHyphenationLabel->set_visible(bVisible); + mxTBxHyphenation->set_item_visible("Hyphenate", bVisible); +} + +void ParaPropertyPanel::set_hyphenation_other_visible( bool bVisible ) +{ + mxTBxHyphenation->set_item_visible("HyphenateCaps", bVisible); + mxTBxHyphenation->set_item_visible("HyphenateLastWord", bVisible); + mxTBxHyphenation->set_item_visible("HyphenateLastFullLine", bVisible); + mxTBxHyphenation->set_item_visible("HyphenateColumn", bVisible); + mxTBxHyphenation->set_item_visible("HyphenatePage", bVisible); + mxTBxHyphenation->set_item_visible("HyphenateSpread", bVisible); + mxAtLineEndLabel->set_visible(bVisible); + mxAtLineBeginLabel->set_visible(bVisible); + mxConsecutiveLabel->set_visible(bVisible); + mxCompoundLabel->set_visible(bVisible); + mxWordLengthLabel->set_visible(bVisible); + mxZoneLabel->set_visible(bVisible); + mxAtLineEnd->get_widget().set_visible(bVisible); + mxAtLineBegin->get_widget().set_visible(bVisible); + mxConsecutive->get_widget().set_visible(bVisible); + mxCompound->get_widget().set_visible(bVisible); + mxWordLength->get_widget().set_visible(bVisible); + mxZone->get_widget().set_visible(bVisible); +} + +void ParaPropertyPanel::InitToolBoxHyphenation() +{ + // hide most of the controls of hyphenation + set_hyphenation_other_visible(false); + Link aLink = LINK( this, ParaPropertyPanel, HyphenationHdl_Impl ); + mxAtLineEnd->connect_value_changed(aLink); + mxAtLineBegin->connect_value_changed(aLink); + mxConsecutive->connect_value_changed(aLink); + mxCompound->connect_value_changed(aLink); + mxWordLength->connect_value_changed(aLink); + mxZone->connect_value_changed(aLink); + m_eHyphenZoneUnit = m_aZoneControl.GetCoreMetric(); + Link aLinkToggled = LINK( this, ParaPropertyPanel, HyphenationToggleButtonHdl_Impl ); + if ( mxHyphenateCapsBtn ) + mxHyphenateCapsBtn->connect_toggled(aLinkToggled); + if ( mxHyphenateLastWordBtn ) + mxHyphenateLastWordBtn->connect_toggled(aLinkToggled); + if ( mxHyphenateLastFullLineBtn ) + mxHyphenateLastFullLineBtn->connect_toggled(aLinkToggled); + if ( mxHyphenateColumnBtn ) + mxHyphenateColumnBtn->connect_toggled(aLinkToggled); + if ( mxHyphenatePageBtn ) + mxHyphenatePageBtn->connect_toggled(aLinkToggled); + if ( mxHyphenateSpreadBtn ) + mxHyphenateSpreadBtn->connect_toggled(aLinkToggled); + if ( mxHyphenateBtn ) + mxHyphenateBtn->connect_toggled(aLinkToggled); +} + void ParaPropertyPanel::initial() { limitMetricWidths(); @@ -159,6 +235,7 @@ void ParaPropertyPanel::initial() //toolbox InitToolBoxIndent(); InitToolBoxSpacing(); + InitToolBoxHyphenation(); } // for Paragraph Indent @@ -185,6 +262,85 @@ IMPL_LINK_NOARG( ParaPropertyPanel, ULSpaceHdl_Impl, weld::MetricSpinButton&, vo SID_ATTR_PARA_ULSPACE, SfxCallMode::RECORD, { &aMargin }); } +void ParaPropertyPanel::fill_hyphenzone(SvxHyphenZoneItem & rHyphen) +{ + rHyphen.SetHyphen(mxTBxHyphenation->get_item_active("Hyphenate")); + rHyphen.GetMinLead() = static_cast(mxAtLineEnd->get_value(FieldUnit::NONE)); + rHyphen.GetMinTrail() = static_cast(mxAtLineBegin->get_value(FieldUnit::NONE)); + rHyphen.GetMinWordLength() = static_cast(mxWordLength->get_value(FieldUnit::NONE)); + rHyphen.GetMaxHyphens() = static_cast(mxConsecutive->get_value(FieldUnit::NONE)); + rHyphen.GetCompoundMinLead() = static_cast(mxCompound->get_value(FieldUnit::NONE)); + rHyphen.GetTextHyphenZone() = static_cast(mxZone->GetCoreValue(m_eHyphenZoneUnit)); + rHyphen.SetNoCapsHyphenation(!mxTBxHyphenation->get_item_active("HyphenateCaps")); + rHyphen.SetNoLastWordHyphenation(!mxTBxHyphenation->get_item_active("HyphenateLastWord")); + rHyphen.SetKeep(!mxTBxHyphenation->get_item_active("HyphenateSpread")); + rHyphen.GetKeepType() = !rHyphen.IsKeep() + ? 3 + : mxTBxHyphenation->get_item_active("HyphenatePage") + ? 1 + : mxTBxHyphenation->get_item_active("HyphenateColumn") + ? 2 + : mxTBxHyphenation->get_item_active("HyphenateLastFullLine") + ? 3 + : 4; +} + +// for hyphenation +IMPL_LINK_NOARG( ParaPropertyPanel, HyphenationHdl_Impl, weld::MetricSpinButton&, void) +{ + SvxHyphenZoneItem aHyphen( false, 69 /*RES_PARATR_HYPHENZONE*/); + fill_hyphenzone(aHyphen); + GetBindings()->GetDispatcher()->ExecuteList( + SID_ATTR_PARA_HYPHENZONE, SfxCallMode::RECORD, { &aHyphen }); +} + +// for hyphenation toggle buttons +IMPL_LINK( ParaPropertyPanel, HyphenationToggleButtonHdl_Impl, weld::Toggleable&, rBtn, void) +{ + if ( mbUpdatingHyphenateButtons ) + return; + + // skip connect_toggled() events triggered by set_item_active(), which resulted stuck buttons + mbUpdatingHyphenateButtons = true; + + SvxHyphenZoneItem aHyphen( false, 69 /*RES_PARATR_HYPHENZONE*/); + sal_Int16 nButton = 0; + bool bEnabled = false; + // get the correct getKeepType(), if clicked on one of the Hyphenate Across icons + if( &rBtn == mxHyphenateSpreadBtn.get() ) + { + nButton = 4; + bEnabled = mxTBxHyphenation->get_item_active("HyphenateSpread"); + } + else if( &rBtn == mxHyphenatePageBtn.get() ) + { + nButton = 3; + bEnabled = mxTBxHyphenation->get_item_active("HyphenatePage"); + } + else if( &rBtn == mxHyphenateColumnBtn.get() ) + { + nButton = 2; + bEnabled = mxTBxHyphenation->get_item_active("HyphenateColumn"); + } + else if( &rBtn == mxHyphenateLastFullLineBtn.get() ) + { + nButton = 1; + bEnabled = mxTBxHyphenation->get_item_active("HyphenateLastFullLine"); + } + if (nButton > 0) + { + mxTBxHyphenation->set_item_active("HyphenateSpread", nButton == 4 && bEnabled); + mxTBxHyphenation->set_item_active("HyphenatePage", nButton > 3 || (nButton == 3 && bEnabled)); + mxTBxHyphenation->set_item_active("HyphenateColumn", nButton > 2 || (nButton == 2 && bEnabled)); + mxTBxHyphenation->set_item_active("HyphenateLastFullLine", nButton > 1 || bEnabled); + } + fill_hyphenzone(aHyphen); + GetBindings()->GetDispatcher()->ExecuteList( + SID_ATTR_PARA_HYPHENZONE, SfxCallMode::RECORD, { &aHyphen }); + + mbUpdatingHyphenateButtons = false; +} + // for Paragraph State change void ParaPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, @@ -217,6 +373,10 @@ void ParaPropertyPanel::NotifyItemUpdate( case SID_ATTR_PARA_ULSPACE: StateChangedULImpl( eState, pState ); break; + + case SID_ATTR_PARA_HYPHENZONE: + StateChangedHyphenationImpl( eState, pState ); + break; } } @@ -357,6 +517,36 @@ void ParaPropertyPanel::StateChangedULImpl( SfxItemState eState, const SfxPoolIt limitMetricWidths(); } +void ParaPropertyPanel::StateChangedHyphenationImpl( SfxItemState eState, const SfxPoolItem* pState ) +{ + mxZone->set_max( mxZone->normalize( MAX_DURCH ), MapToFieldUnit(m_eHyphenZoneUnit) ); + + if( pState && eState >= SfxItemState::DEFAULT ) + { + const SvxHyphenZoneItem* pOldItem = static_cast(pState); + maZone = pOldItem->GetTextHyphenZone(); + maZone = OutputDevice::LogicToLogic(maZone, m_eHyphenZoneUnit, MapUnit::MapTwip); + sal_Int64 nVal = o3tl::convert(maZone, o3tl::Length::twip, o3tl::Length::cm); + nVal = mxZone->normalize( nVal ); + mxZone->set_value( nVal, FieldUnit::CM ); + mxAtLineEnd->set_value(pOldItem->GetMinLead(), FieldUnit::CHAR); + mxAtLineBegin->set_value(pOldItem->GetMinTrail(), FieldUnit::CHAR); + auto nMaxHyphens = pOldItem->GetMaxHyphens(); + mxConsecutive->set_value(nMaxHyphens, FieldUnit::NONE); + mxCompound->set_value(pOldItem->GetCompoundMinLead(), FieldUnit::CHAR); + mxWordLength->set_value(pOldItem->GetMinWordLength(), FieldUnit::CHAR); + bool bHyph = pOldItem->IsHyphen(); + mxTBxHyphenation->set_item_active("Hyphenate", bHyph); + mxTBxHyphenation->set_item_active("HyphenateCaps", !pOldItem->IsNoCapsHyphenation()); + mxTBxHyphenation->set_item_active("HyphenateLastWord", !pOldItem->IsNoLastWordHyphenation()); + mxTBxHyphenation->set_item_active("HyphenateLastFullLine", !pOldItem->IsKeep() || pOldItem->GetKeepType() < 4); + mxTBxHyphenation->set_item_active("HyphenateColumn", !pOldItem->IsKeep() || pOldItem->GetKeepType() < 3); + mxTBxHyphenation->set_item_active("HyphenatePage", !pOldItem->IsKeep() || pOldItem->GetKeepType() < 2); + mxTBxHyphenation->set_item_active("HyphenateSpread", !pOldItem->IsKeep() || pOldItem->GetKeepType() < 1); + set_hyphenation_other_visible( bHyph ); + } +} + FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) { FieldUnit eUnit = FieldUnit::NONE; @@ -409,22 +599,54 @@ ParaPropertyPanel::ParaPropertyPanel(weld::Widget* pParent, mxLineSpacingDispatch(new ToolbarUnoDispatcher(*mxTBxLineSpacing, *m_xBuilder, rxFrame)), mxTBxIndent(m_xBuilder->weld_toolbar(u"indent"_ustr)), mxIndentDispatch(new ToolbarUnoDispatcher(*mxTBxIndent, *m_xBuilder, rxFrame)), + //Hyphenation + mxTBxHyphenation(m_xBuilder->weld_toolbar(u"hyphenation"_ustr)), + mxHyphenationDispatch(new ToolbarUnoDispatcher(*mxTBxHyphenation, *m_xBuilder, rxFrame)), //Paragraph spacing mxTopDist(m_xBuilder->weld_metric_spin_button(u"aboveparaspacing"_ustr, FieldUnit::CM)), mxBottomDist(m_xBuilder->weld_metric_spin_button(u"belowparaspacing"_ustr, FieldUnit::CM)), mxLeftIndent(m_xBuilder->weld_metric_spin_button(u"beforetextindent"_ustr, FieldUnit::CM)), mxRightIndent(m_xBuilder->weld_metric_spin_button(u"aftertextindent"_ustr, FieldUnit::CM)), mxFLineIndent(m_xBuilder->weld_metric_spin_button(u"firstlineindent"_ustr, FieldUnit::CM)), + mxHyphenationLabel(m_xBuilder->weld_label(u"hyphenationlabel"_ustr)), + mxAtLineEndLabel(m_xBuilder->weld_label(u"lineend_label"_ustr)), + mxAtLineBeginLabel(m_xBuilder->weld_label(u"linebegin_label"_ustr)), + mxConsecutiveLabel(m_xBuilder->weld_label(u"consecutive_label"_ustr)), + mxCompoundLabel(m_xBuilder->weld_label(u"compound_label"_ustr)), + mxWordLengthLabel(m_xBuilder->weld_label(u"wordlength_label"_ustr)), + mxZoneLabel(m_xBuilder->weld_label(u"zone_label"_ustr)), + mxAtLineEnd(m_xBuilder->weld_metric_spin_button(u"lineend"_ustr, FieldUnit::CHAR)), + mxAtLineBegin(m_xBuilder->weld_metric_spin_button(u"linebegin"_ustr, FieldUnit::CHAR)), + mxConsecutive(m_xBuilder->weld_metric_spin_button(u"consecutive"_ustr, FieldUnit::NONE)), + mxCompound(m_xBuilder->weld_metric_spin_button(u"compound"_ustr, FieldUnit::CHAR)), + mxWordLength(m_xBuilder->weld_metric_spin_button(u"wordlength"_ustr, FieldUnit::CHAR)), + mxZone(m_xBuilder->weld_metric_spin_button(u"zone"_ustr, FieldUnit::CM)), + mbUpdatingHyphenateButtons(false), + mxHyphenateCapsBtn(m_xBuilder->weld_toggle_button(u"HyphenateCaps"_ustr)), + mxHyphenateLastWordBtn(m_xBuilder->weld_toggle_button(u"HyphenateLastWord"_ustr)), + mxHyphenateLastFullLineBtn(m_xBuilder->weld_toggle_button(u"HyphenateLastFullLine"_ustr)), + mxHyphenateColumnBtn(m_xBuilder->weld_toggle_button(u"HyphenateColumn"_ustr)), + mxHyphenatePageBtn(m_xBuilder->weld_toggle_button(u"HyphenatePage"_ustr)), + mxHyphenateSpreadBtn(m_xBuilder->weld_toggle_button(u"HyphenateSpread"_ustr)), + mxHyphenateBtn(m_xBuilder->weld_toggle_button(u"Hyphenate"_ustr)), maTxtLeft (0), maUpper (0), maLower (0), + maZone (0), m_eMetricUnit(FieldUnit::NONE), m_last_eMetricUnit(FieldUnit::NONE), m_eLRSpaceUnit(), m_eULSpaceUnit(), + m_eHyphenZoneUnit(), maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this), maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this), m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this), + m_aAtLineEndControl (SID_ATTR_PARA_HYPHENZONE, *pBindings,*this), + m_aAtLineBeginControl (SID_ATTR_PARA_HYPHENZONE, *pBindings,*this), + m_aConsecutiveControl (SID_ATTR_PARA_HYPHENZONE, *pBindings,*this), + m_aCompoundControl (SID_ATTR_PARA_HYPHENZONE, *pBindings,*this), + m_aWordLengthControl (SID_ATTR_PARA_HYPHENZONE, *pBindings,*this), + m_aZoneControl (SID_ATTR_PARA_HYPHENZONE, *pBindings,*this), mpBindings(pBindings), mxSidebar(std::move(xSidebar)) { @@ -434,7 +656,6 @@ ParaPropertyPanel::ParaPropertyPanel(weld::Widget* pParent, // subsequent panels, e.g. the TableEditPanel panel can have up to 5 // entries in each of its column and remain in alignment with this panel padWidthForSidebar(*mxTBxIndent, rxFrame); - initial(); m_aMetricCtl.RequestUpdate(); } @@ -474,6 +695,9 @@ ParaPropertyPanel::~ParaPropertyPanel() mxIndentDispatch.reset(); mxTBxIndent.reset(); + mxHyphenationDispatch.reset(); + mxTBxHyphenation.reset(); + mxTopDist.reset(); mxBottomDist.reset(); mxLeftIndent.reset(); @@ -483,6 +707,12 @@ ParaPropertyPanel::~ParaPropertyPanel() maLRSpaceControl.dispose(); maULSpaceControl.dispose(); m_aMetricCtl.dispose(); + m_aAtLineEndControl.dispose(); + m_aAtLineBeginControl.dispose(); + m_aConsecutiveControl.dispose(); + m_aCompoundControl.dispose(); + m_aWordLengthControl.dispose(); + m_aZoneControl.dispose(); } } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx index 04bbf9065375..1dad57b4bb29 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -18,6 +18,7 @@ */ #pragma once +#include #include #include #include @@ -91,6 +92,8 @@ private: std::unique_ptr mxLineSpacingDispatch; std::unique_ptr mxTBxIndent; std::unique_ptr mxIndentDispatch; + std::unique_ptr mxTBxHyphenation; + std::unique_ptr mxHyphenationDispatch; //Paragraph spacing std::optional mxTopDist; @@ -99,19 +102,50 @@ private: std::optional mxRightIndent; std::optional mxFLineIndent; + // Hyphenation + std::unique_ptr mxHyphenationLabel; + std::unique_ptr mxAtLineEndLabel; + std::unique_ptr mxAtLineBeginLabel; + std::unique_ptr mxConsecutiveLabel; + std::unique_ptr mxCompoundLabel; + std::unique_ptr mxWordLengthLabel; + std::unique_ptr mxZoneLabel; + std::optional mxAtLineEnd; + std::optional mxAtLineBegin; + std::optional mxConsecutive; + std::optional mxCompound; + std::optional mxWordLength; + std::optional mxZone; + bool mbUpdatingHyphenateButtons; + std::unique_ptr mxHyphenateCapsBtn; + std::unique_ptr mxHyphenateLastWordBtn; + std::unique_ptr mxHyphenateLastFullLineBtn; + std::unique_ptr mxHyphenateColumnBtn; + std::unique_ptr mxHyphenatePageBtn; + std::unique_ptr mxHyphenateSpreadBtn; + std::unique_ptr mxHyphenateBtn; + // Data Member tools::Long maTxtLeft; tools::Long maUpper; tools::Long maLower; + tools::Long maZone; FieldUnit m_eMetricUnit; FieldUnit m_last_eMetricUnit; MapUnit m_eLRSpaceUnit; MapUnit m_eULSpaceUnit; + MapUnit m_eHyphenZoneUnit; // Control Items ::sfx2::sidebar::ControllerItem maLRSpaceControl; ::sfx2::sidebar::ControllerItem maULSpaceControl; ::sfx2::sidebar::ControllerItem m_aMetricCtl; + ::sfx2::sidebar::ControllerItem m_aAtLineEndControl; + ::sfx2::sidebar::ControllerItem m_aAtLineBeginControl; + ::sfx2::sidebar::ControllerItem m_aConsecutiveControl; + ::sfx2::sidebar::ControllerItem m_aCompoundControl; + ::sfx2::sidebar::ControllerItem m_aWordLengthControl; + ::sfx2::sidebar::ControllerItem m_aZoneControl; vcl::EnumContext maContext; SfxBindings* mpBindings; @@ -119,14 +153,21 @@ private: DECL_LINK(ModifyIndentHdl_Impl, weld::MetricSpinButton&, void); DECL_LINK(ULSpaceHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(HyphenationHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(HyphenationToggleButtonHdl_Impl, weld::Toggleable&, void); void StateChangedIndentImpl( SfxItemState eState, const SfxPoolItem* pState ); void StateChangedULImpl( SfxItemState eState, const SfxPoolItem* pState ); + void StateChangedHyphenationImpl( SfxItemState eState, const SfxPoolItem* pState ); void initial(); + void set_hyphenation_base_visible(bool bVisible); + void set_hyphenation_other_visible(bool bVisible); + void fill_hyphenzone(SvxHyphenZoneItem& rHyphen); void ReSize(); void InitToolBoxIndent(); void InitToolBoxSpacing(); + void InitToolBoxHyphenation(); void limitMetricWidths(); }; diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx index db5d565e3aca..664772dbca0b 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -57,6 +57,8 @@ TextPropertyPanel::TextPropertyPanel(weld::Widget* pParent, const css::uno::Refe , mxResetBarDispatch(new ToolbarUnoDispatcher(*mxResetBar, *m_xBuilder, rxFrame)) , mxDefaultBar(m_xBuilder->weld_toolbar(u"defaultattr"_ustr)) , mxDefaultBarDispatch(new ToolbarUnoDispatcher(*mxDefaultBar, *m_xBuilder, rxFrame)) + , mxHyphenationBar(m_xBuilder->weld_toolbar(u"hyphenation"_ustr)) + , mxHyphenationBarDispatch(new ToolbarUnoDispatcher(*mxHyphenationBar, *m_xBuilder, rxFrame)) , mxPositionBar(m_xBuilder->weld_toolbar(u"position"_ustr)) , mxPositionBarDispatch(new ToolbarUnoDispatcher(*mxPositionBar, *m_xBuilder, rxFrame)) , mxSpacingBar(m_xBuilder->weld_toolbar(u"spacingbar"_ustr)) @@ -74,6 +76,7 @@ TextPropertyPanel::~TextPropertyPanel() { mxResetBarDispatch.reset(); mxDefaultBarDispatch.reset(); + mxHyphenationBarDispatch.reset(); mxPositionBarDispatch.reset(); mxSpacingBarDispatch.reset(); mxToolBoxFontColorDispatch.reset(); @@ -85,6 +88,7 @@ TextPropertyPanel::~TextPropertyPanel() mxResetBar.reset(); mxDefaultBar.reset(); + mxHyphenationBar.reset(); mxPositionBar.reset(); mxSpacingBar.reset(); mxToolBoxFontColor.reset(); @@ -142,6 +146,8 @@ void TextPropertyPanel::HandleContextChange ( mxToolBoxBackgroundColor->set_visible(bWriterText || bDrawText); mxResetBar->set_visible(bWriterText || bCalcText); mxDefaultBar->set_visible(bDrawText); + mxHyphenationBar->set_visible(bWriterText); + mxSpacingBar->set_item_visible(".uno:NoBreak", bWriterText); } } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx index c383ef1bd891..9178b32a530d 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.hxx +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -61,6 +61,8 @@ private: std::unique_ptr mxResetBarDispatch; std::unique_ptr mxDefaultBar; std::unique_ptr mxDefaultBarDispatch; + std::unique_ptr mxHyphenationBar; + std::unique_ptr mxHyphenationBarDispatch; std::unique_ptr mxPositionBar; std::unique_ptr mxPositionBarDispatch; std::unique_ptr mxSpacingBar; diff --git a/svx/uiconfig/ui/sidebarparagraph.ui b/svx/uiconfig/ui/sidebarparagraph.ui index 8691368ae974..b6f022f47b63 100644 --- a/svx/uiconfig/ui/sidebarparagraph.ui +++ b/svx/uiconfig/ui/sidebarparagraph.ui @@ -27,6 +27,44 @@ 1 10 + + 1 + 9 + 2 + 1 + 10 + + + 2 + 9 + 2 + 1 + 10 + + + 99 + 1 + 10 + + + 2 + 9 + 2 + 1 + 10 + + + 4 + 99 + 4 + 1 + 10 + + + 55.88 + 1 + 10 + True @@ -38,7 +76,7 @@ False True 6 - 3 + 1 6 True @@ -613,6 +651,340 @@ 2 + + + True + False + vertical + 3 + + + True + False + horizontal + 3 + + + True + True + Hyphenation + icons + False + 2 + + + True + 1 + 1 + True + cmd/sc_changecasetoupper.png + Hyphenate CAPS + + + False + False + + + + + True + True + 1 + 1 + cmd/sc_textbodyparastyle.png + Hyphenate Last Paragraph Word + + + False + False + + + + + True + True + 1 + 1 + cmd/sc_insertfooter.png + Hyphenate Last Full Paragraph Line + + + False + False + + + + + True + True + 1 + 1 + cmd/sc_formatcolumns.png + Hyphenate Across Column + + + False + False + + + + + False + True + 1 + 1 + cmd/sc_showtwopages.png + Hyphenate Across Page + + + False + False + + + + + False + True + 1 + 1 + cmd/sc_showmultiplepages.png + Hyphenate Across Spread + + + False + False + + + + + True + True + 1 + 1 + cmd/sc_hyphenation.png + Hyphenation + + + False + False + 0 + + + + + False + True + 0 + + + + + True + False + True + _Hyphenation: + True + hyphenation + 0 + + + False + True + 0 + + + + + 0 + 3 + + + + + 0 + 4 + 2 + + + + + False + False + True + At line end: + True + lineend + 0 + + + 0 + 5 + + + + + False + False + True + At line begin: + True + linebegin + 0 + + + 1 + 5 + + + + + False + False + True + Compound constituent: + True + compound + 0 + + + 1 + 7 + + + + + False + False + True + Consecutive lines: + True + consecutive + 0 + + + 0 + 7 + + + + + False + False + True + Word length: + True + wordlength + 0 + + + 0 + 9 + + + + + False + False + True + Hyphenation zone: + True + zone + 0 + + + 1 + 9 + + + + + False + True + Characters at Line End + True + 0 + True + adjustment6 + + + 0 + 6 + + + + + False + True + Characters at Line Begin + True + 0 + True + adjustment7 + + + 1 + 6 + + + + + False + True + Compound Constituent Characters at Line End + True + 0 + True + adjustment9 + + + 1 + 8 + + + + + False + True + Maximum Consecutive Hyphenated Lines + True + 0 + True + adjustment8 + + + 0 + 8 + + + + + False + True + Minimum Word Length + True + 0 + True + adjustment10 + + + 0 + 10 + + + + + False + True + Line Break Between Words + True + True + adjustment11 + + + 1 + 10 + + True diff --git a/svx/uiconfig/ui/sidebartextpanel.ui b/svx/uiconfig/ui/sidebartextpanel.ui index b53b9e2e36c8..5669bfb41fec 100644 --- a/svx/uiconfig/ui/sidebartextpanel.ui +++ b/svx/uiconfig/ui/sidebartextpanel.ui @@ -233,6 +233,16 @@ False + + + True + True + + + False + False + + False @@ -252,6 +262,30 @@ False end 6 + + + True + True + icons + False + 2 + + + True + True + + + False + False + + + + + False + True + 0 + + True diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index 4d982bf76d8f..9f5e604ec297 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -1412,8 +1412,8 @@ interface BaseText ] SID_ATTR_PARA_HYPHENZONE // status(final|play) [ - ExecMethod = ExecTextCtrl; - StateMethod = GetTextCtrlState; + ExecMethod = ExecParaAttr ; + StateMethod = GetAttrState ; DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] FN_NO_BREAK // status(final|play) diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index 119f4618a120..d1749af5f859 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -326,6 +326,7 @@ void SwTextShell::ExecParaAttr(SfxRequest &rReq) // Get both attributes immediately isn't more expensive!! SfxItemSetFixed aSet( GetPool() ); sal_uInt16 nSlot = rReq.GetSlot(); @@ -441,6 +442,18 @@ SET_LINESPACE: } } break; + case SID_ATTR_PARA_HYPHENZONE: + { + SfxItemSetFixed aHyphSet( GetPool() ); + GetShell().GetCurAttr(aHyphSet); + SfxItemState eState = aHyphSet.GetItemState(RES_PARATR_HYPHENZONE, false); + if ( eState >= SfxItemState::DEFAULT ) + { + SvxHyphenZoneItem aHyphen( pArgs->Get( RES_PARATR_HYPHENZONE ) ); + aSet.Put( aHyphen ); + } + } + break; default: OSL_FAIL("wrong dispatcher");