icon-themes/breeze/links.txt | 4 icon-themes/breeze_dark/links.txt | 4 icon-themes/colibre/links.txt | 4 icon-themes/colibre_dark/links.txt | 4 icon-themes/elementary/links.txt | 4 icon-themes/sifr/links.txt | 4 icon-themes/sifr_dark/links.txt | 4 icon-themes/sukapura/links.txt | 4 icon-themes/sukapura_dark/links.txt | 4 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 5 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx | 232 ++++++ svx/source/sidebar/paragraph/ParaPropertyPanel.hxx | 41 + svx/source/sidebar/text/TextPropertyPanel.cxx | 6 svx/source/sidebar/text/TextPropertyPanel.hxx | 2 svx/uiconfig/ui/sidebarparagraph.ui | 374 +++++++++- svx/uiconfig/ui/sidebartextpanel.ui | 34 sw/sdi/_textsh.sdi | 4 sw/source/uibase/shells/txtattr.cxx | 13 18 files changed, 742 insertions(+), 5 deletions(-)
New commits: commit 98f7f540463c533da17d4e8595c091d9e98a6c83 Author: László Németh <nem...@numbertext.org> AuthorDate: Thu Aug 15 01:28:27 2024 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Aug 16 12:35:41 2024 +0200 tdf#162491 tdf#125032 add hyphenation settings to sidebar Add .uno:NoBreak to the Character sidebar panel to disable automatic hyphenation for selected words. The icon is enabled only on hyphenated words and words with disabled hyphenation. Add .uno:Hyphenate icon to the Character sidebar panel, with tooltip "Insert Soft Hyphen...", which opens the dialog for (semi-)automatic insertion of soft hyphens. Add paragraph-level hyphenation settings to the Paragraph sidebar panel. Only the toggle button icon "Hyphenation" is visible to enable hyphenation, if the paragraph is not hyphenated. If it's enabled, show all paragraph-level settings. These new sidebar controls allow adjusting paragraph layout and hyphenation quickly, like DTP software do. Note: to add icon to .uno:NoBreak, modify "Properties" of officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu. Note: it's possible, that high resolution icon sizes will need extra dispatcher calls (the draft is attached to the issue in the bug tracker). Change-Id: I292527589ed3a38e4400cfd97ea54cbc7ff56a44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171883 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> 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 @@ <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Hyphenation...</value> </prop> + <prop oor:name="TooltipLabel" oor:type="xs:string"> + <value xml:lang="en-US">Insert Soft Hyphen...</value> + </prop> <prop oor:name="Properties" oor:type="xs:int"> <value>9</value> </prop> @@ -3055,7 +3058,7 @@ <value xml:lang="en-US">No Break</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> - <value>8</value> + <value>9</value> </prop> </node> <node oor:name=".uno:VScroll" oor:op="replace"> 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<weld::MetricSpinButton&,void> 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<weld::Toggleable&,void> 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<sal_uInt8>(mxAtLineEnd->get_value(FieldUnit::NONE)); + rHyphen.GetMinTrail() = static_cast<sal_uInt8>(mxAtLineBegin->get_value(FieldUnit::NONE)); + rHyphen.GetMinWordLength() = static_cast<sal_uInt8>(mxWordLength->get_value(FieldUnit::NONE)); + rHyphen.GetMaxHyphens() = static_cast<sal_uInt8>(mxConsecutive->get_value(FieldUnit::NONE)); + rHyphen.GetCompoundMinLead() = static_cast<sal_uInt8>(mxCompound->get_value(FieldUnit::NONE)); + rHyphen.GetTextHyphenZone() = static_cast<sal_uInt16>(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<const SvxHyphenZoneItem*>(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 <editeng/hyphenzoneitem.hxx> #include <sfx2/sidebar/ControllerItem.hxx> #include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <sfx2/sidebar/PanelLayout.hxx> @@ -91,6 +92,8 @@ private: std::unique_ptr<ToolbarUnoDispatcher> mxLineSpacingDispatch; std::unique_ptr<weld::Toolbar> mxTBxIndent; std::unique_ptr<ToolbarUnoDispatcher> mxIndentDispatch; + std::unique_ptr<weld::Toolbar> mxTBxHyphenation; + std::unique_ptr<ToolbarUnoDispatcher> mxHyphenationDispatch; //Paragraph spacing std::optional<SvxRelativeField> mxTopDist; @@ -99,19 +102,50 @@ private: std::optional<SvxRelativeField> mxRightIndent; std::optional<SvxRelativeField> mxFLineIndent; + // Hyphenation + std::unique_ptr<weld::Label> mxHyphenationLabel; + std::unique_ptr<weld::Label> mxAtLineEndLabel; + std::unique_ptr<weld::Label> mxAtLineBeginLabel; + std::unique_ptr<weld::Label> mxConsecutiveLabel; + std::unique_ptr<weld::Label> mxCompoundLabel; + std::unique_ptr<weld::Label> mxWordLengthLabel; + std::unique_ptr<weld::Label> mxZoneLabel; + std::optional<SvxRelativeField> mxAtLineEnd; + std::optional<SvxRelativeField> mxAtLineBegin; + std::optional<SvxRelativeField> mxConsecutive; + std::optional<SvxRelativeField> mxCompound; + std::optional<SvxRelativeField> mxWordLength; + std::optional<SvxRelativeField> mxZone; + bool mbUpdatingHyphenateButtons; + std::unique_ptr<weld::ToggleButton> mxHyphenateCapsBtn; + std::unique_ptr<weld::ToggleButton> mxHyphenateLastWordBtn; + std::unique_ptr<weld::ToggleButton> mxHyphenateLastFullLineBtn; + std::unique_ptr<weld::ToggleButton> mxHyphenateColumnBtn; + std::unique_ptr<weld::ToggleButton> mxHyphenatePageBtn; + std::unique_ptr<weld::ToggleButton> mxHyphenateSpreadBtn; + std::unique_ptr<weld::ToggleButton> 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<ToolbarUnoDispatcher> mxResetBarDispatch; std::unique_ptr<weld::Toolbar> mxDefaultBar; std::unique_ptr<ToolbarUnoDispatcher> mxDefaultBarDispatch; + std::unique_ptr<weld::Toolbar> mxHyphenationBar; + std::unique_ptr<ToolbarUnoDispatcher> mxHyphenationBarDispatch; std::unique_ptr<weld::Toolbar> mxPositionBar; std::unique_ptr<ToolbarUnoDispatcher> mxPositionBarDispatch; std::unique_ptr<weld::Toolbar> 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 @@ <property name="step-increment">1</property> <property name="page-increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment6"> + <property name="lower">1</property> + <property name="upper">9</property> + <property name="value">2</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment7"> + <property name="lower">2</property> + <property name="upper">9</property> + <property name="value">2</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment8"> + <property name="upper">99</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment9"> + <property name="lower">2</property> + <property name="upper">9</property> + <property name="value">2</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment10"> + <property name="lower">4</property> + <property name="upper">99</property> + <property name="value">4</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment11"> + <property name="upper">55.88</property> + <property name="step-increment">1</property> + <property name="page-increment">10</property> + </object> <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid" id="ParaPropertyPanel"> <property name="visible">True</property> @@ -38,7 +76,7 @@ <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="border-width">6</property> - <property name="row-spacing">3</property> + <property name="row-spacing">1</property> <property name="column-spacing">6</property> <property name="column-homogeneous">True</property> <child> @@ -613,6 +651,340 @@ <property name="width">2</property> </packing> </child> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">3</property> + <child> + <object class="GtkBox" id="box5"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="orientation">horizontal</property> + <property name="spacing">3</property> + <child> + <object class="GtkToolbar" id="hyphenation"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes" context="sidebarparagraph|hyphenation|tooltip_text">Hyphenation</property> + <property name="toolbar-style">icons</property> + <property name="show-arrow">False</property> + <property name="icon_size">2</property> + <child> + <object class="GtkToggleToolButton" id="HyphenateCaps"> + <property name="visible">True</property> + <property name="margin-start">1</property> + <property name="margin-end">1</property> + <property name="use-underline">True</property> + <property name="icon-name">cmd/sc_changecasetoupper.png</property> + <property name="label" translatable="yes" context="sidebarparagraph|hyphenation|caps">Hyphenate CAPS</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="HyphenateLastWord"> + <property name="visible">True</property> + <property name="use-underline">True</property> + <property name="margin-start">1</property> + <property name="margin-end">1</property> + <property name="icon-name">cmd/sc_textbodyparastyle.png</property> + <property name="label" translatable="yes" context="sidebarparagraph|hyphenation|lastword">Hyphenate Last Paragraph Word</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="HyphenateLastFullLine"> + <property name="visible">True</property> + <property name="use-underline">True</property> + <property name="margin-start">1</property> + <property name="margin-end">1</property> + <property name="icon-name">cmd/sc_insertfooter.png</property> + <property name="label" translatable="yes" context="sidebarparagraph|hyphenation|lastfullline">Hyphenate Last Full Paragraph Line</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="HyphenateColumn"> + <property name="visible">True</property> + <property name="use-underline">True</property> + <property name="margin-start">1</property> + <property name="margin-end">1</property> + <property name="icon-name">cmd/sc_formatcolumns.png</property> + <property name="label" translatable="yes" context="sidebarparagraph|hyphenation|column">Hyphenate Across Column</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="HyphenatePage"> + <property name="visible">False</property> + <property name="use-underline">True</property> + <property name="margin-start">1</property> + <property name="margin-end">1</property> + <property name="icon-name">cmd/sc_showtwopages.png</property> + <property name="label" translatable="yes" context="sidebarparagraph|hyphenation|page">Hyphenate Across Page</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="HyphenateSpread"> + <property name="visible">False</property> + <property name="use-underline">True</property> + <property name="margin-start">1</property> + <property name="margin-end">1</property> + <property name="icon-name">cmd/sc_showmultiplepages.png</property> + <property name="label" translatable="yes" context="sidebarparagraph|hyphenation|spread">Hyphenate Across Spread</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="Hyphenate"> + <property name="visible">True</property> + <property name="use-underline">True</property> + <property name="margin-start">1</property> + <property name="margin-end">1</property> + <property name="icon-name">cmd/sc_hyphenation.png</property> + <property name="label" translatable="yes" context="sidebarparagraph|hyphenation|hyphenation">Hyphenation</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="hyphenationlabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes" context="sidebarparagraph|hyphenationlabel">_Hyphenation:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">hyphenation</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">3</property> + </packing> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">4</property> + <property name="width">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="lineend_label"> + <property name="visible">False</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes" context="sidebarparagraph|lineend_label">At line end:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">lineend</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="linebegin_label"> + <property name="visible">False</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes" context="sidebarparagraph|linebegin_label">At line begin:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">linebegin</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="compound_label"> + <property name="visible">False</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes" context="sidebarparagraph|linebegin_label">Compound constituent:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">compound</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="consecutive_label"> + <property name="visible">False</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes" context="sidebarparagraph|lineend_label">Consecutive lines:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">consecutive</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="wordlength_label"> + <property name="visible">False</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes" context="sidebarparagraph|linebegin_label">Word length:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">wordlength</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">9</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="zone_label"> + <property name="visible">False</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes" context="sidebarparagraph|lineend_label">Hyphenation zone:</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">zone</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">9</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="lineend"> + <property name="visible">False</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes" context="sidebarparagraph|lineend|tooltip_text">Characters at Line End</property> + <property name="hexpand">True</property> + <property name="text">0</property> + <property name="truncate-multiline">True</property> + <property name="adjustment">adjustment6</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">6</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="linebegin"> + <property name="visible">False</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes" context="sidebarparagraph|linebegin|tooltip_text">Characters at Line Begin</property> + <property name="hexpand">True</property> + <property name="text">0</property> + <property name="truncate-multiline">True</property> + <property name="adjustment">adjustment7</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">6</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="compound"> + <property name="visible">False</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes" context="sidebarparagraph|lineend|tooltip_text">Compound Constituent Characters at Line End</property> + <property name="hexpand">True</property> + <property name="text">0</property> + <property name="truncate-multiline">True</property> + <property name="adjustment">adjustment9</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">8</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="consecutive"> + <property name="visible">False</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes" context="sidebarparagraph|linebegin|tooltip_text">Maximum Consecutive Hyphenated Lines</property> + <property name="hexpand">True</property> + <property name="text">0</property> + <property name="truncate-multiline">True</property> + <property name="adjustment">adjustment8</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">8</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="wordlength"> + <property name="visible">False</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes" context="sidebarparagraph|lineend|tooltip_text">Minimum Word Length</property> + <property name="hexpand">True</property> + <property name="text">0</property> + <property name="truncate-multiline">True</property> + <property name="adjustment">adjustment10</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">10</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="zone"> + <property name="visible">False</property> + <property name="can-focus">True</property> + <property name="tooltip-text" translatable="yes" context="sidebarparagraph|linebegin|tooltip_text">Line Break Between Words</property> + <property name="activates-default">True</property> + <property name="truncate-multiline">True</property> + <property name="adjustment">adjustment11</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">10</property> + </packing> + </child> <child> <object class="GtkToolbar" id="numberbullet"> <property name="visible">True</property> 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 @@ <property name="homogeneous">False</property> </packing> </child> + <child> + <object class="GtkToolButton" id=".uno:NoBreak"> + <property name="visible">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> @@ -252,6 +262,30 @@ <property name="can-focus">False</property> <property name="halign">end</property> <property name="spacing">6</property> + <child> + <object class="GtkToolbar" id="hyphenation"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="toolbar-style">icons</property> + <property name="show-arrow">False</property> + <property name="icon_size">2</property> + <child> + <object class="GtkToolButton" id=".uno:Hyphenate"> + <property name="visible">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> <object class="GtkToolbar" id="position"> <property name="visible">True</property> 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 <RES_PARATR_LINESPACING, RES_PARATR_ADJUST, + RES_PARATR_HYPHENZONE, RES_PARATR_HYPHENZONE, RES_FRAMEDIR, RES_FRAMEDIR> aSet( GetPool() ); sal_uInt16 nSlot = rReq.GetSlot(); @@ -441,6 +442,18 @@ SET_LINESPACE: } } break; + case SID_ATTR_PARA_HYPHENZONE: + { + SfxItemSetFixed<RES_PARATR_HYPHENZONE, RES_PARATR_HYPHENZONE> 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");