diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index cd52d753afcc..aac1f25d8e07 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -222,7 +222,9 @@ private: weld::TriStateEnabled aKeepParaState; weld::TriStateEnabled aOrphanState; weld::TriStateEnabled aWidowState; - weld::TriStateEnabled aKeepState; + weld::TriStateEnabled aAcrossColumnState; + weld::TriStateEnabled aAcrossPageState; + weld::TriStateEnabled aAcrossSpreadState; bool bPageBreak; bool bHtmlMode; @@ -270,7 +272,10 @@ private: std::unique_ptr m_xWidowRowLabel; // avoid hyphenation across - std::unique_ptr m_xKeepBox; + std::unique_ptr m_xAcrossText; + std::unique_ptr m_xAcrossColumnBox; + std::unique_ptr m_xAcrossPageBox; + std::unique_ptr m_xAcrossSpreadBox; void HyphenClickHdl(); void PageNumBoxClickHdl(); @@ -290,7 +295,9 @@ private: DECL_LINK(PageBreakTypeHdl_Impl, weld::ComboBox&, void); DECL_LINK(PageNumBoxClickHdl_Impl, weld::Toggleable&, void); DECL_LINK(KeepParaBoxClickHdl_Impl, weld::Toggleable&, void); - DECL_LINK(KeepHdl_Impl, weld::Toggleable&, void); + DECL_LINK(AcrossColumnHdl_Impl, weld::Toggleable&, void); + DECL_LINK(AcrossPageHdl_Impl, weld::Toggleable&, void); + DECL_LINK(AcrossSpreadHdl_Impl, weld::Toggleable&, void); virtual void PageCreated(const SfxAllItemSet& aSet) override; }; diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index d3234c0c9964..2ad7c4bdf80b 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -56,6 +56,7 @@ #include #include #include +#include const WhichRangesContainer SvxStdParagraphTabPage::pStdRanges( svl::Items< @@ -1619,7 +1620,9 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) m_xMaxHyphenEdit->get_value_changed_from_saved() || m_xMinWordLength->get_value_changed_from_saved() || m_aHyphenZone.get_value_changed_from_saved() || - m_xKeepBox->get_state_changed_from_saved() ) + m_xAcrossColumnBox->get_state_changed_from_saved() || + m_xAcrossPageBox->get_state_changed_from_saved() || + m_xAcrossSpreadBox->get_state_changed_from_saved() ) { SvxHyphenZoneItem aHyphen( static_cast(GetItemSet().Get( _nWhich )) ); @@ -1641,17 +1644,36 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) MapUnit eUnit = pPool->GetMetric( _nWhich ); aHyphen.GetTextHyphenZone() = static_cast(m_aHyphenZone.GetCoreValue(eUnit)); aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE ); - - const TriState eKeepState = m_xKeepBox->get_state(); aHyphen.SetNoLastWordHyphenation(m_xHyphenNoLastWordBox->get_state() != TRISTATE_TRUE); - if ( eKeepState == TRISTATE_TRUE ) + const TriState eAcrossColumnState = m_xAcrossColumnBox->get_state(); + const TriState eAcrossPageState = m_xAcrossPageBox->get_state(); + const TriState eAcrossSpreadState = m_xAcrossSpreadBox->get_state(); + aHyphen.SetKeep( eAcrossSpreadState != TRISTATE_TRUE ); + if ( eAcrossSpreadState == TRISTATE_TRUE ) { - // hyphenate across column and page -> 0 (AUTO) - aHyphen.GetKeep() = static_cast(0); + // hyphenate across column, page and spread -> ParaHyphenationKeep = false and + // set default value 3 (COLUMN) + aHyphen.GetKeepType() = + static_cast(css::text::ParagraphHyphenationKeepType::COLUMN); + } + else if ( eAcrossPageState == TRISTATE_TRUE ) + { + // hyphenate across column and page, but not spread -> 1 (SPREAD) + aHyphen.GetKeepType() = + static_cast(css::text::ParagraphHyphenationKeepType::SPREAD); + } + else if ( eAcrossColumnState == TRISTATE_TRUE ) + { + // hyphenate across column, but not page and spread -> 2 (PAGE) + aHyphen.GetKeepType() = + static_cast(css::text::ParagraphHyphenationKeepType::PAGE); } else - // don't hyphenate across column -> 3 (COLUMN) - aHyphen.GetKeep() = static_cast(3); + { + // don't hyphenate across column, page and spread -> 3 (COLUMN) + aHyphen.GetKeepType() = + static_cast(css::text::ParagraphHyphenationKeepType::COLUMN); + } if ( !pOld || *static_cast(pOld) != aHyphen || @@ -1872,9 +1894,12 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) m_xMinWordLength->set_value(rHyphen.GetMinWordLength()); m_aHyphenZone.SetFieldUnit(eFUnit); m_aHyphenZone.SetMetricValue(rHyphen.GetTextHyphenZone(), MapUnit::MapTwip); - // don't hyphenate column or paragraph -> disable checkbox - m_xKeepBox->set_state(rHyphen.GetKeep() < 3 ? TRISTATE_TRUE : TRISTATE_FALSE); - aKeepState.bTriStateEnabled = false; + m_xAcrossColumnBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() < 3 ? TRISTATE_TRUE : TRISTATE_FALSE); + m_xAcrossPageBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() < 2 ? TRISTATE_TRUE : TRISTATE_FALSE); + m_xAcrossSpreadBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() == 0 ? TRISTATE_TRUE : TRISTATE_FALSE); + aAcrossColumnState.bTriStateEnabled = false; + aAcrossPageState.bTriStateEnabled = false; + aAcrossSpreadState.bTriStateEnabled = false; } else { @@ -1897,7 +1922,10 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) m_xMinWordLength->set_sensitive(bEnable); m_xHyphenZoneLabel->set_sensitive(bEnable); m_aHyphenZone.set_sensitive(bEnable); - m_xKeepBox->set_sensitive(bEnable); + m_xAcrossText->set_sensitive(bEnable); + m_xAcrossColumnBox->set_sensitive(bEnable); + m_xAcrossPageBox->set_sensitive(bEnable); + m_xAcrossSpreadBox->set_sensitive(bEnable); switch (rSet->GetItemState(SID_ATTR_PARA_PAGENUM)) { @@ -2160,7 +2188,9 @@ void SvxExtParagraphTabPage::ChangesApplied() m_xMaxHyphenEdit->save_value(); m_xMinWordLength->save_value(); m_aHyphenZone.save_value(); - m_xKeepBox->save_state(); + m_xAcrossColumnBox->save_state(); + m_xAcrossPageBox->save_state(); + m_xAcrossSpreadBox->save_state(); m_xPageBreakBox->save_state(); m_xBreakPositionLB->save_value(); m_xBreakTypeLB->save_value(); @@ -2237,7 +2267,10 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia , m_xWidowRowNo(m_xBuilder->weld_spin_button("spinWidow")) , m_xWidowRowLabel(m_xBuilder->weld_label("labelWidow")) // Avoid hyphenation across - , m_xKeepBox(m_xBuilder->weld_check_button("checkKeep")) + , m_xAcrossText(m_xBuilder->weld_label("labelHyphenAcross")) + , m_xAcrossColumnBox(m_xBuilder->weld_check_button("checkAcrossColumn")) + , m_xAcrossPageBox(m_xBuilder->weld_check_button("checkAcrossPage")) + , m_xAcrossSpreadBox(m_xBuilder->weld_check_button("checkAcrossSpread")) { // this page needs ExchangeSupport SetExchangeSupport(); @@ -2252,7 +2285,9 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia m_xBreakPositionLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl)); m_xPageNumBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl)); m_xKeepParaBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl)); - m_xKeepBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepHdl_Impl)); + m_xAcrossColumnBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossColumnHdl_Impl)); + m_xAcrossPageBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossPageHdl_Impl)); + m_xAcrossSpreadBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossSpreadHdl_Impl)); if (SfxObjectShell* pSh = SfxObjectShell::Current()) { @@ -2295,6 +2330,10 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia m_aHyphenZone.set_sensitive(false); m_xPageNumBox->set_sensitive(false); m_xPagenumEdit->set_sensitive(false); + m_xAcrossText->set_sensitive(false); + m_xAcrossColumnBox->set_sensitive(false); + m_xAcrossPageBox->set_sensitive(false); + m_xAcrossSpreadBox->set_sensitive(false); // no column break in HTML m_xBreakTypeLB->remove(1); } @@ -2432,7 +2471,10 @@ void SvxExtParagraphTabPage::HyphenClickHdl() m_xMinWordLength->set_sensitive(bEnable); m_xHyphenZoneLabel->set_sensitive(bEnable); m_aHyphenZone.set_sensitive(bEnable); - m_xKeepBox->set_sensitive(bEnable); + m_xAcrossText->set_sensitive(bEnable); + m_xAcrossColumnBox->set_sensitive(bEnable); + m_xAcrossPageBox->set_sensitive(bEnable); + m_xAcrossSpreadBox->set_sensitive(bEnable); m_xHyphenBox->set_state(bEnable ? TRISTATE_TRUE : TRISTATE_FALSE); } @@ -2534,9 +2576,33 @@ void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet& aSet) DisablePageBreak(); } -IMPL_LINK(SvxExtParagraphTabPage, KeepHdl_Impl, weld::Toggleable&, rToggle, void) +IMPL_LINK(SvxExtParagraphTabPage, AcrossColumnHdl_Impl, weld::Toggleable&, rToggle, void) { - aKeepState.ButtonToggled(rToggle); + aAcrossColumnState.ButtonToggled(rToggle); + if (m_xAcrossColumnBox->get_state() != TRISTATE_TRUE ) + { + m_xAcrossPageBox->set_state( TRISTATE_FALSE ); + m_xAcrossSpreadBox->set_state( TRISTATE_FALSE ); + } +} + +IMPL_LINK(SvxExtParagraphTabPage, AcrossPageHdl_Impl, weld::Toggleable&, rToggle, void) +{ + aAcrossPageState.ButtonToggled(rToggle); + if (m_xAcrossPageBox->get_state() == TRISTATE_TRUE ) + m_xAcrossColumnBox->set_state( TRISTATE_TRUE ); + else + m_xAcrossSpreadBox->set_state( TRISTATE_FALSE ); +} + +IMPL_LINK(SvxExtParagraphTabPage, AcrossSpreadHdl_Impl, weld::Toggleable&, rToggle, void) +{ + aAcrossSpreadState.ButtonToggled(rToggle); + if (m_xAcrossSpreadBox->get_state() == TRISTATE_TRUE ) + { + m_xAcrossColumnBox->set_state( TRISTATE_TRUE ); + m_xAcrossPageBox->set_state( TRISTATE_TRUE ); + } } SvxAsianTabPage::SvxAsianTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) diff --git a/cui/uiconfig/ui/textflowpage.ui b/cui/uiconfig/ui/textflowpage.ui index 1bcee0488950..3504d7988840 100644 --- a/cui/uiconfig/ui/textflowpage.ui +++ b/cui/uiconfig/ui/textflowpage.ui @@ -348,18 +348,27 @@ - - Hyphenate _across column and page + + True - True - False - True - True - True - - - Deselect this check box, if you don't want to hyphenate across column and page. + False + 12 + 6 + 6 + 12 + + + True + False + Hyphenation across + True + labelHyphenAcross + 0 + + 0 + 0 + @@ -368,6 +377,82 @@ 2 + + + + True + False + 12 + 6 + 6 + 12 + + + Column + True + True + False + True + True + True + + + Deselect this check box, if you don't want to hyphenate across column, page and spread. + + + + + 0 + 0 + + + + + Page + True + True + False + True + True + True + + + Deselect this check box, if you don't want to hyphenate across page and spread. + + + + + 0 + 1 + + + + + Spread + True + True + False + True + True + True + + + Deselect this check box, if you don't want to hyphenate across spread. + + + + + 0 + 2 + + + + + 0 + 11 + 2 + + diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 4103fe2ea521..4b55fa49026e 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -560,7 +561,7 @@ bool SvxOrphansItem::GetPresentation SvxHyphenZoneItem::SvxHyphenZoneItem( const bool bHyph, const sal_uInt16 nId ) : SfxPoolItem( nId ), bHyphen(bHyph), - bPageEnd(true), + bKeep(false), bNoCapsHyphenation(false), bNoLastWordHyphenation(false), nMinLead(0), @@ -568,7 +569,7 @@ SvxHyphenZoneItem::SvxHyphenZoneItem( const bool bHyph, const sal_uInt16 nId ) : nMaxHyphens(255), nMinWordLength(0), nTextHyphenZone(0), - nKeep(0), // TODO change default value to COLUMN + nKeepType(css::text::ParagraphHyphenationKeepType::COLUMN), nCompoundMinLead(0) { } @@ -582,6 +583,9 @@ bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) con case MID_IS_HYPHEN: rVal <<= bHyphen; break; + case MID_HYPHEN_KEEP: + rVal <<= bKeep; + break; case MID_HYPHEN_MIN_LEAD: rVal <<= static_cast(nMinLead); break; @@ -603,8 +607,8 @@ bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) con case MID_HYPHEN_ZONE: rVal <<= static_cast(nTextHyphenZone); break; - case MID_HYPHEN_KEEP: - rVal <<= static_cast(nKeep); + case MID_HYPHEN_KEEP_TYPE: + rVal <<= static_cast(nKeepType); break; case MID_HYPHEN_COMPOUND_MIN_LEAD: rVal <<= static_cast(nCompoundMinLead); @@ -616,10 +620,10 @@ bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) con bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { nMemberId &= ~CONVERT_TWIPS; - sal_Int32 nNewVal = 0; // sal_Int32 needs for MID_HYPHEN_KEEP + sal_Int32 nNewVal = 0; // sal_Int32 needs for MID_HYPHEN_KEEP_TYPE if( nMemberId != MID_IS_HYPHEN && nMemberId != MID_HYPHEN_NO_CAPS && - nMemberId != MID_HYPHEN_NO_LAST_WORD ) + nMemberId != MID_HYPHEN_NO_LAST_WORD && nMemberId != MID_HYPHEN_KEEP ) { if(!(rVal >>= nNewVal)) return false; @@ -630,6 +634,9 @@ bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case MID_IS_HYPHEN: bHyphen = Any2Bool(rVal); break; + case MID_HYPHEN_KEEP: + bKeep = Any2Bool(rVal); + break; case MID_HYPHEN_MIN_LEAD: nMinLead = static_cast(nNewVal); break; @@ -651,8 +658,8 @@ bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case MID_HYPHEN_ZONE: nTextHyphenZone = nNewVal; break; - case MID_HYPHEN_KEEP: - nKeep = static_cast(nNewVal); + case MID_HYPHEN_KEEP_TYPE: + nKeepType = static_cast(nNewVal); break; case MID_HYPHEN_COMPOUND_MIN_LEAD: nCompoundMinLead = static_cast(nNewVal); @@ -670,14 +677,14 @@ bool SvxHyphenZoneItem::operator==( const SfxPoolItem& rAttr ) const return ( rItem.bHyphen == bHyphen && rItem.bNoCapsHyphenation == bNoCapsHyphenation && rItem.bNoLastWordHyphenation == bNoLastWordHyphenation - && rItem.bPageEnd == bPageEnd + && rItem.bKeep == bKeep && rItem.nMinLead == nMinLead && rItem.nMinTrail == nMinTrail && rItem.nCompoundMinLead == nCompoundMinLead && rItem.nMaxHyphens == nMaxHyphens && rItem.nMinWordLength == nMinWordLength && rItem.nTextHyphenZone == nTextHyphenZone - && rItem.nKeep == nKeep ); + && rItem.nKeepType == nKeepType ); } SvxHyphenZoneItem* SvxHyphenZoneItem::Clone( SfxItemPool * ) const @@ -699,14 +706,8 @@ bool SvxHyphenZoneItem::GetPresentation case SfxItemPresentation::Nameless: { TranslateId pId = RID_SVXITEMS_HYPHEN_FALSE; - if ( bHyphen ) pId = RID_SVXITEMS_HYPHEN_TRUE; - rText = EditResId(pId) + cpDelimTmp; - pId = RID_SVXITEMS_PAGE_END_FALSE; - - if ( bPageEnd ) - pId = RID_SVXITEMS_PAGE_END_TRUE; rText += EditResId(pId) + cpDelimTmp + OUString::number( nMinLead ) + cpDelimTmp + OUString::number( nMinTrail ) + cpDelimTmp + @@ -722,7 +723,11 @@ bool SvxHyphenZoneItem::GetPresentation if ( bNoLastWordHyphenation ) rText += cpDelimTmp + EditResId(RID_SVXITEMS_HYPHEN_LAST_WORD_TRUE); - rText += OUString::number( nKeep ); + if ( bKeep ) + rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_TRUE) + + cpDelimTmp + OUString::number( nKeepType ); + else + rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_FALSE); return true; } case SfxItemPresentation::Complete: @@ -731,11 +736,6 @@ bool SvxHyphenZoneItem::GetPresentation if ( bHyphen ) pId = RID_SVXITEMS_HYPHEN_TRUE; - rText = EditResId(pId) + cpDelimTmp; - pId = RID_SVXITEMS_PAGE_END_FALSE; - - if ( bPageEnd ) - pId = RID_SVXITEMS_PAGE_END_TRUE; rText += EditResId(pId) + cpDelimTmp + EditResId(RID_SVXITEMS_HYPHEN_MINLEAD).replaceAll("%1", OUString::number(nMinLead)) + @@ -761,24 +761,30 @@ bool SvxHyphenZoneItem::GetPresentation if ( bNoLastWordHyphenation ) rText += cpDelimTmp + EditResId(RID_SVXITEMS_HYPHEN_LAST_WORD_TRUE); - switch ( nKeep ) + if ( bKeep ) { - case 0: - rText += cpDelimTmp + EditResId(RID_SVXITEMS_HYPHEN_KEEP_AUTO); - break; - case 1: - rText += cpDelimTmp + EditResId(RID_SVXITEMS_HYPHEN_KEEP_SPREAD); - break; - case 2: - rText += cpDelimTmp + EditResId(RID_SVXITEMS_HYPHEN_KEEP_PAGE); - break; - case 3: - rText += cpDelimTmp + EditResId(RID_SVXITEMS_HYPHEN_KEEP_COLUMN); - break; - case 4: - rText += cpDelimTmp + EditResId(RID_SVXITEMS_HYPHEN_KEEP_ALWAYS); - break; + rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_TRUE) + cpDelimTmp; + switch ( nKeepType ) + { + case 0: + rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_AUTO); + break; + case 1: + rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_SPREAD); + break; + case 2: + rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_PAGE); + break; + case 3: + rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_COLUMN); + break; + case 4: + rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_ALWAYS); + break; + } } + else + rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_FALSE); return true; } diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 63ae0c119974..a5cfd41efae9 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -1094,7 +1094,7 @@ ATTR_SETEMPHASIS: SvxHyphenZoneItem aHypenZone( (nTokenValue & 1) != 0, aPardMap[SID_ATTR_PARA_HYPHENZONE]); - aHypenZone.SetPageEnd((nTokenValue & 2) != 0); + aHypenZone.SetKeep((nTokenValue & 2) != 0); if( aPardMap[SID_ATTR_PARA_HYPHENZONE] && RTF_HYPHLEAD == GetNextToken() && diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc index 0f1a198dffc8..270b02707758 100644 --- a/include/editeng/editrids.hrc +++ b/include/editeng/editrids.hrc @@ -199,8 +199,8 @@ #define RID_SVXITEMS_TRANSPARENT_FALSE NC_("RID_SVXITEMS_TRANSPARENT_FALSE", "Not Transparent") #define RID_SVXITEMS_HYPHEN_TRUE NC_("RID_SVXITEMS_HYPHEN_TRUE", "Hyphenation") #define RID_SVXITEMS_HYPHEN_FALSE NC_("RID_SVXITEMS_HYPHEN_FALSE", "No hyphenation") -#define RID_SVXITEMS_PAGE_END_TRUE NC_("RID_SVXITEMS_PAGE_END_TRUE", "Page End") -#define RID_SVXITEMS_PAGE_END_FALSE NC_("RID_SVXITEMS_PAGE_END_FALSE", "No Page End") +#define RID_SVXITEMS_HYPHEN_KEEP_TRUE NC_("RID_SVXITEMS_HYPHEN_KEEP_TRUE", "No hyphenation across") +#define RID_SVXITEMS_HYPHEN_KEEP_FALSE NC_("RID_SVXITEMS_HYPHEN_KEEP_FALSE", "Hyphenation across page") #define RID_SVXITEMS_SIZE_WIDTH NC_("RID_SVXITEMS_SIZE_WIDTH", "Width: ") #define RID_SVXITEMS_SIZE_HEIGHT NC_("RID_SVXITEMS_SIZE_HEIGHT", "Height: ") #define RID_SVXITEMS_LRSPACE_LEFT NC_("RID_SVXITEMS_LRSPACE_LEFT", "Indent left ") @@ -236,8 +236,8 @@ #define RID_SVXITEMS_HYPHEN_LAST_WORD_TRUE NC_("RID_SVXITEMS_HYPHEN_NO_CAPS_FALSE", "Not hyphenated last word") #define RID_SVXITEMS_HYPHEN_MINWORDLEN NC_("RID_SVXITEMS_HYPHEN_MINWORDLEN", "%1 characters in words") #define RID_SVXITEMS_HYPHEN_ZONE NC_("RID_SVXITEMS_HYPHEN_ZONE", "Hyphenation zone ") -#define RID_SVXITEMS_HYPHEN_KEEP_AUTO NC_("RID_SVXITEMS_HYPHEN_KEEP_AUTO", "Automatic hyphenation across page") -#define RID_SVXITEMS_HYPHEN_KEEP_SPREAD NC_("RID_SVXITEMS_HYPHEN_KEEP_SPREAD", "Avoid hyphenation between pages which are not visible to the reader at the same time") +#define RID_SVXITEMS_HYPHEN_KEEP_AUTO NC_("RID_SVXITEMS_HYPHEN_KEEP_AUTO", "Hyphenation across page") +#define RID_SVXITEMS_HYPHEN_KEEP_SPREAD NC_("RID_SVXITEMS_HYPHEN_KEEP_SPREAD", "Avoid hyphenation across page when the next page is not visible to the reader at the same time") #define RID_SVXITEMS_HYPHEN_KEEP_PAGE NC_("RID_SVXITEMS_HYPHEN_KEEP_PAGE", "Avoid hyphenation across page") #define RID_SVXITEMS_HYPHEN_KEEP_COLUMN NC_("RID_SVXITEMS_HYPHEN_KEEP_COLUMN", "Avoid hyphenation across column and page") #define RID_SVXITEMS_HYPHEN_KEEP_ALWAYS NC_("RID_SVXITEMS_HYPHEN_KEEP_ALWAYS", "Avoid hyphenation across last full paragraph line, column and page") diff --git a/include/editeng/hyphenzoneitem.hxx b/include/editeng/hyphenzoneitem.hxx index 0c7fe7fb6fed..d7aa7ea61862 100644 --- a/include/editeng/hyphenzoneitem.hxx +++ b/include/editeng/hyphenzoneitem.hxx @@ -33,7 +33,7 @@ class EDITENG_DLLPUBLIC SvxHyphenZoneItem final : public SfxPoolItem { bool bHyphen : 1; - bool bPageEnd : 1; + bool bKeep : 1; // avoid hyphenation across page etc., see ParagraphHyphenationKeep bool bNoCapsHyphenation : 1; bool bNoLastWordHyphenation : 1; sal_uInt8 nMinLead; @@ -41,7 +41,7 @@ class EDITENG_DLLPUBLIC SvxHyphenZoneItem final : public SfxPoolItem sal_uInt8 nMaxHyphens; // max. consecutive lines with hyphenation sal_uInt8 nMinWordLength; // hyphenate only words with at least nMinWordLength characters sal_uInt16 nTextHyphenZone; // don't force hyphenation at line end, allow this extra white space - sal_uInt8 nKeep; // avoid hyphenation across page etc., see ParagraphHyphenationKeep + sal_uInt8 nKeepType; // avoid hyphenation across page etc., see ParagraphHyphenationKeep sal_uInt8 nCompoundMinLead; // min. characters between compound word boundary and hyphenation public: @@ -65,8 +65,8 @@ public: void SetHyphen( const bool bNew ) { bHyphen = bNew; } bool IsHyphen() const { return bHyphen; } - void SetPageEnd( const bool bNew ) { bPageEnd = bNew; } - bool IsPageEnd() const { return bPageEnd; } + void SetKeep( const bool bNew ) { bKeep = bNew; } + bool IsKeep() const { return bKeep; } void SetNoCapsHyphenation( const bool bNew ) { bNoCapsHyphenation = bNew; } bool IsNoCapsHyphenation() const { return bNoCapsHyphenation; } @@ -91,8 +91,8 @@ public: sal_uInt16 &GetTextHyphenZone() { return nTextHyphenZone; } sal_uInt16 GetTextHyphenZone() const { return nTextHyphenZone; } - sal_uInt8 &GetKeep() { return nKeep; } - sal_uInt8 GetKeep() const { return nKeep; } + sal_uInt8 &GetKeepType() { return nKeepType; } + sal_uInt8 GetKeepType() const { return nKeepType; } }; #endif diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h index f913921a6ee8..57250a9872e8 100644 --- a/include/editeng/memberids.h +++ b/include/editeng/memberids.h @@ -52,7 +52,8 @@ #define MID_HYPHEN_MIN_WORD_LENGTH 6 #define MID_HYPHEN_ZONE 7 #define MID_HYPHEN_KEEP 8 -#define MID_HYPHEN_COMPOUND_MIN_LEAD 9 +#define MID_HYPHEN_KEEP_TYPE 9 +#define MID_HYPHEN_COMPOUND_MIN_LEAD 10 // SvxBoxInfoItem #define MID_HORIZONTAL 1 diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx index 4d6f1a060e50..86ecfd423644 100644 --- a/include/sfx2/msg.hxx +++ b/include/sfx2/msg.hxx @@ -135,6 +135,7 @@ SFX_DECL_TYPE(5); SFX_DECL_TYPE(6); SFX_DECL_TYPE(7); SFX_DECL_TYPE(8); +SFX_DECL_TYPE(9); // for SvxHyphenZoneItem SFX_DECL_TYPE(10); // for SfxDocInfoItem SFX_DECL_TYPE(11); diff --git a/include/unotools/linguprops.hxx b/include/unotools/linguprops.hxx index f6f0ffc1aa40..92767f657620 100644 --- a/include/unotools/linguprops.hxx +++ b/include/unotools/linguprops.hxx @@ -43,6 +43,7 @@ inline constexpr OUString UPN_HYPH_NO_CAPS = u"HyphNoCaps"_us inline constexpr OUString UPN_HYPH_NO_LAST_WORD = u"HyphNoLastWord"_ustr; inline constexpr OUString UPN_HYPH_ZONE = u"HyphZone"_ustr; inline constexpr OUString UPN_HYPH_KEEP = u"HyphKeep"_ustr; +inline constexpr OUString UPN_HYPH_KEEP_TYPE = u"HyphKeepType"_ustr; // UNO property names for Lingu // (those not covered by the SpellChecker and Hyphenator @@ -110,7 +111,8 @@ inline constexpr OUString UPN_IS_GRAMMAR_INTERACTIVE = u"IsInteractiveG #define UPH_HYPH_NO_LAST_WORD 32 #define UPH_HYPH_ZONE 33 #define UPH_HYPH_KEEP 34 -#define UPH_HYPH_COMPOUND_MIN_LEADING 35 +#define UPH_HYPH_KEEP_TYPE 35 +#define UPH_HYPH_COMPOUND_MIN_LEADING 36 #ifdef __GNUC__ #pragma GCC diagnostic pop diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index e5c34c8cafbc..f410ce69344a 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -1056,6 +1056,7 @@ namespace xmloff::token { XML_HYPERLINK_BEHAVIOUR, XML_HYPHENATE, XML_HYPHENATION_KEEP, + XML_HYPHENATION_KEEP_TYPE, XML_HYPHENATION_LADDER_COUNT, XML_HYPHENATION_PUSH_CHAR_COUNT, XML_HYPHENATION_REMAIN_CHAR_COUNT, @@ -1842,6 +1843,7 @@ namespace xmloff::token { XML_SPLIT_COLUMN, XML_SPLIT_POSITION, XML_SPLIT_ROW, + XML_SPREAD, XML_SPREADSHEET, XML_SPREADMETHOD, XML_SQL_STATEMENT, diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx index 313591c730d0..7c7cabb43df1 100644 --- a/include/xmloff/xmltypes.hxx +++ b/include/xmloff/xmltypes.hxx @@ -297,6 +297,7 @@ #define XML_SW_TYPE_RTLGUTTER (XML_TEXT_TYPES_START + 129) #define XML_TYPE_COMPLEX_COLOR (XML_TEXT_TYPES_START + 130) #define XML_TYPE_HYPHENATION_KEEP (XML_TEXT_TYPES_START + 131) +#define XML_TYPE_HYPHENATION_KEEP_TYPE (XML_TEXT_TYPES_START + 132) #endif // INCLUDED_XMLOFF_XMLTYPES_HXX diff --git a/offapi/com/sun/star/style/ParagraphProperties.idl b/offapi/com/sun/star/style/ParagraphProperties.idl index 88d60f326543..9cb2ff598562 100644 --- a/offapi/com/sun/star/style/ParagraphProperties.idl +++ b/offapi/com/sun/star/style/ParagraphProperties.idl @@ -429,13 +429,24 @@ published service ParagraphProperties */ [optional, property, readonly] long SortedTextId; - /** Specifies how last word on a page or on other regions is hyphenated. + /** This value is `TRUE` if both parts of a hyphenated word shall lie + within a single spread, page, or column. The default type is column. + + @see ParaHyphenationKeepType + + @since LibreOffice 24.8 + */ + [optional, property] boolean ParaHyphenationKeep; + + /** Specifies how last line on a page or on other regions is hyphenated. + + @see ParaHyphenationKeep @see com::sun::star::text::ParagraphHyphenationKeepType @since LibreOffice 24.8 */ - [optional, property] long ParaHyphenationKeep; + [optional, property] long ParaHyphenationKeepType; /** specifies the minimum number of characters of the compound word part to remain before the hyphen character (when hyphenation is applied). diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng index 7101ce8cfc4c..e2ade3172e22 100644 --- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng +++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng @@ -3065,6 +3065,22 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. + + + + + + + auto + spread + page + column + always + + + + + diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index eab67d49a3c3..0f3da887b64c 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -275,7 +275,8 @@ struct SvxHyphenZone INT16 MaxHyphens MID_HYPHEN_MAX_HYPHENS; INT16 MinWordLength MID_HYPHEN_MIN_WORD_LENGTH; INT16 HyphenZone MID_HYPHEN_ZONE; - INT16 HyphenKeep MID_HYPHEN_KEEP; + BOOL HyphenKeep MID_HYPHEN_KEEP; + INT16 HyphenKeepType MID_HYPHEN_KEEP_TYPE; INT16 MinLead MID_HYPHEN_COMPOUND_MIN_LEAD; }; item SvxHyphenZone SvxHyphenZoneItem; diff --git a/sw/inc/inspectorproperties.hrc b/sw/inc/inspectorproperties.hrc index 2b8379bbf0ae..88f535847970 100644 --- a/sw/inc/inspectorproperties.hrc +++ b/sw/inc/inspectorproperties.hrc @@ -211,6 +211,7 @@ #define RID_PARA_HYPHENATION_MIN_WORD_LENGTH NC_("RID_ATTRIBUTE_NAMES_MAP", "Para Hyphenation Min Word Length") #define RID_PARA_HYPHENATION_ZONE NC_("RID_ATTRIBUTE_NAMES_MAP", "Para Hyphenation Zone") #define RID_PARA_HYPHENATION_KEEP NC_("RID_ATTRIBUTE_NAMES_MAP", "Para Hyphenation Keep") +#define RID_PARA_HYPHENATION_KEEP_TYPE NC_("RID_ATTRIBUTE_NAMES_MAP", "Para Hyphenation Keep Type") #define RID_PARA_INTEROP_GRAB_BAG NC_("RID_ATTRIBUTE_NAMES_MAP", "Para Interop Grab Bag") #define RID_PARA_IS_AUTO_FIRST_LINE_INDENT NC_("RID_ATTRIBUTE_NAMES_MAP", "Para is Auto First Line Indent") #define RID_PARA_IS_CHARACTER_DISTANCE NC_("RID_ATTRIBUTE_NAMES_MAP", "Para is Character Distance") diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 2f2df94b563e..836294a98a3f 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -79,6 +79,7 @@ inline constexpr OUString UNO_NAME_PARA_HYPHENATION_NO_CAPS = u"ParaHyphenationN inline constexpr OUString UNO_NAME_PARA_HYPHENATION_NO_LAST_WORD = u"ParaHyphenationNoLastWord"_ustr; inline constexpr OUString UNO_NAME_PARA_HYPHENATION_KEEP = u"ParaHyphenationKeep"_ustr; +inline constexpr OUString UNO_NAME_PARA_HYPHENATION_KEEP_TYPE = u"ParaHyphenationKeepType"_ustr; inline constexpr OUString UNO_NAME_LEFT_MARGIN = u"LeftMargin"_ustr; inline constexpr OUString UNO_NAME_RIGHT_MARGIN = u"RightMargin"_ustr; inline constexpr OUString UNO_NAME_GUTTER_MARGIN = u"GutterMargin"_ustr; diff --git a/sw/qa/extras/odfexport/data/tdf132599_column.fodt b/sw/qa/extras/odfexport/data/tdf132599_column.fodt new file mode 100644 index 000000000000..5283ba3b1827 --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf132599_column.fodt @@ -0,0 +1,198 @@ + + + + + + 0 + 0 + 197337 + 95031 + true + false + + + false + false + true + + false + 0 + false + true + true + true + false + 0 + true + false + false + true + false + true + true + true + true + true + false + true + true + false + false + false + false + true + true + true + true + true + false + false + false + true + true + high-resolution + true + 1510949 + false + true + false + + + true + + true + false + true + true + true + false + false + 0 + true + false + false + true + true + true + true + true + false + false + true + false + true + true + true + false + + true + false + false + 0 + false + true + + false + false + true + true + true + false + true + 1 + false + false + false + true + false + false + false + true + false + true + false + true + false + + false + 1901519 + true + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, except that it has an atmosphere. Earth is. The Earth is no different to any other celestial body + + + + diff --git a/sw/qa/extras/odfexport/data/tdf132599_page_in_last_column.fodt b/sw/qa/extras/odfexport/data/tdf132599_page_in_last_column.fodt new file mode 100644 index 000000000000..ce5a96347aeb --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf132599_page_in_last_column.fodt @@ -0,0 +1,196 @@ + + + + 2022-05-24T07:51:40hu-HU2024-04-10T16:18:21.40751767712PT30M48SLibreOfficeDev/24.8.0.0.alpha0$Linux_X86_64 LibreOffice_project/098f366895d2b224ddcd791d10a2e61fbc5fae9416.00000x01010085BF02F4C75C8B46B51578A787841FFC + + + 0 + 0 + 197337 + 95031 + true + false + + + false + false + true + + false + 0 + false + true + true + true + false + 0 + true + false + false + true + false + true + true + true + true + true + false + true + true + false + false + false + false + true + true + true + true + true + false + false + false + true + true + high-resolution + true + 1510949 + false + true + false + + + true + + true + false + true + true + true + false + false + 0 + true + false + false + true + true + true + true + true + false + false + true + false + true + true + true + false + + true + false + false + 0 + false + true + + false + false + true + true + true + false + true + 1 + false + false + false + true + false + false + false + true + false + true + false + true + false + + false + 1874118 + true + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The Earth is no different to any other celestial body out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, except that it has an atmosphere. Earth is. + + + + diff --git a/sw/qa/extras/odfexport/data/tdf132599_page_in_not_last_column.fodt b/sw/qa/extras/odfexport/data/tdf132599_page_in_not_last_column.fodt new file mode 100644 index 000000000000..facd8c18219c --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf132599_page_in_not_last_column.fodt @@ -0,0 +1,198 @@ + + + + + + 0 + 0 + 197337 + 95031 + true + false + + + false + false + true + + false + 0 + false + true + true + true + false + 0 + true + false + false + true + false + true + true + true + true + true + false + true + true + false + false + false + false + true + true + true + true + true + false + false + false + true + true + high-resolution + true + 1510949 + false + true + false + + + true + + true + false + true + true + true + false + false + 0 + true + false + false + true + true + true + true + true + false + false + true + false + true + true + true + false + + true + false + false + 0 + false + true + + false + false + true + true + true + false + true + 1 + false + false + false + true + false + false + false + true + false + true + false + true + false + + false + 1901519 + true + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, except that it has an atmosphere. Earth is. The Earth is no different to any other celestial body + + + + diff --git a/sw/qa/extras/odfexport/data/tdf132599_spread-left-page.fodt b/sw/qa/extras/odfexport/data/tdf132599_spread-left-page.fodt new file mode 100644 index 000000000000..456af9b3800c --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf132599_spread-left-page.fodt @@ -0,0 +1,252 @@ + + + + 2024-04-10T14:00:54.132053888PT2M25S4LibreOfficeDev/24.8.0.0.alpha0$Linux_X86_64 LibreOffice_project/098f366895d2b224ddcd791d10a2e61fbc5fae94 + + + 0 + 0 + 189443 + 91230 + true + false + + + view2 + 75907 + 31365 + 0 + 0 + 189442 + 91228 + 0 + 2 + true + 25 + false + false + false + false + false + false + + + + + false + false + true + + false + 0 + false + true + true + false + false + 0 + true + false + false + false + false + false + true + false + false + true + false + true + true + false + false + false + false + false + false + true + true + false + false + false + false + false + false + high-resolution + false + 1932522 + false + true + false + + + true + + false + false + false + true + true + true + false + 0 + true + false + false + true + true + true + false + true + false + false + false + false + false + true + true + false + + true + false + false + 0 + false + true + + false + false + true + true + false + false + true + 1 + false + false + false + false + false + false + false + false + false + false + false + true + false + + true + 2021498 + true + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hyphenate last word of the page + The Earth is no different to any other celestial body out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, except that it has an atmosphere. The Earth is no different to any other celestial body out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, except that it has an atmosphere. The Earth is no different to any other celestial body out… + + + diff --git a/sw/qa/extras/odfexport/data/tdf132599_spread.fodt b/sw/qa/extras/odfexport/data/tdf132599_spread.fodt new file mode 100644 index 000000000000..b22730707f28 --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf132599_spread.fodt @@ -0,0 +1,241 @@ + + + + 2024-04-10T14:00:36.781594440PT2M8S3LibreOfficeDev/24.8.0.0.alpha0$Linux_X86_64 LibreOffice_project/098f366895d2b224ddcd791d10a2e61fbc5fae94 + + + 0 + 0 + 189443 + 91230 + true + false + + + view2 + 109668 + 17052 + 0 + 0 + 189442 + 91228 + 0 + 2 + true + 25 + false + false + false + false + false + false + + + + + false + false + true + + false + 0 + false + true + true + false + false + 0 + true + false + false + false + false + false + true + false + false + true + false + true + true + false + false + false + false + false + false + true + true + false + false + false + false + false + false + high-resolution + false + 1932522 + false + true + false + + + true + + false + false + false + true + true + true + false + 0 + true + false + false + true + true + true + false + true + false + false + false + false + false + true + true + false + + true + false + false + 0 + false + true + + false + false + true + true + false + false + true + 1 + false + false + false + false + false + false + false + false + false + false + false + true + false + + true + 2021498 + true + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hyphenate last word of the page + The Earth is no different to any other celestial body out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, except that it has an atmosphere. The Earth is no different to any other celestial body out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, except that it has an atmosphere. The Earth is no different to any other celestial body out… + + + diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 446b2c8ad395..5fe33dd96cd5 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -128,7 +128,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf106733) "hyphenate"_ostr, "false"); } - CPPUNIT_TEST_FIXTURE(Test, testTdf132599_page) { uno::Reference xHyphenator = LinguMgr::GetHyphenator(); @@ -153,6 +152,70 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132599_auto) CPPUNIT_ASSERT_EQUAL(2, getPages()); } +CPPUNIT_TEST_FIXTURE(Test, testTdf132599_spread) +{ + uno::Reference xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString()))) + return; + + // fo:hyphenation-keep="page" loext:hyphenation-keep-type="spread" + loadAndReload("tdf132599_page.fodt"); + // shift last line of right page, resulting 3 pages + CPPUNIT_ASSERT_EQUAL(3, getPages()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf132599_spread_left_page) +{ + uno::Reference xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString()))) + return; + + // fo:hyphenation-keep="page" loext:hyphenation-keep-type="spread" + loadAndReload("tdf132599_spread-left-page.fodt"); + // do not shift last line of left page + // This was 4 (shifted last line of left page, when it's hyphenated) + CPPUNIT_ASSERT_EQUAL(3, getPages()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf132599_column) +{ + uno::Reference xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString()))) + return; + + // last line of the left column is shifted, according to + // fo:hyphenation-keep="page" loext:hyphenation-keep-type="column" + loadAndReload("tdf132599_column.fodt"); + // shift last line of the first column, resulting 3 pages + CPPUNIT_ASSERT_EQUAL(3, getPages()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf132599_page_in_not_last_column) +{ + uno::Reference xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString()))) + return; + + // last line of the not last column is not shifted, according to + // fo:hyphenation-keep="page" loext:hyphenation-keep-type="page" + loadAndReload("tdf132599_page_in_not_last_column.fodt"); + // do not shift last line of the first column, resulting 2 pages + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf132599_page_in_last_column) +{ + uno::Reference xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString()))) + return; + + // last line of the last column is shifted, according to + // fo:hyphenation-keep="page" loext:hyphenation-keep-type="page" + loadAndReload("tdf132599_page_in_last_column.fodt"); + // shift last line of the first page, resulting 3 pages + CPPUNIT_ASSERT_EQUAL(3, getPages()); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf158885_compound_remain) { loadAndReload("tdf158885_compound-remain.fodt"); diff --git a/sw/qa/uitest/styleInspector/styleInspector.py b/sw/qa/uitest/styleInspector/styleInspector.py index 9862bdbc0218..e4fe8e0259c7 100644 --- a/sw/qa/uitest/styleInspector/styleInspector.py +++ b/sw/qa/uitest/styleInspector/styleInspector.py @@ -26,7 +26,7 @@ class styleNavigator(UITestCase): # The cursor is on text without formatting and default style self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) - self.assertEqual(142, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(143, len(xListBox.getChild('0').getChild('0').getChildren())) self.assertEqual(0, len(xListBox.getChild('1').getChildren())) self.assertEqual(0, len(xListBox.getChild('2').getChildren())) self.assertEqual(0, len(xListBox.getChild('3').getChildren())) @@ -36,7 +36,7 @@ class styleNavigator(UITestCase): # The cursor is on text with direct formatting self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) - self.assertEqual(142, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(143, len(xListBox.getChild('0').getChild('0').getChildren())) self.assertEqual(0, len(xListBox.getChild('1').getChildren())) self.assertEqual(0, len(xListBox.getChild('2').getChildren())) @@ -54,7 +54,7 @@ class styleNavigator(UITestCase): # The cursor is on text with paragraph direct formatting self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) - self.assertEqual(142, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(143, len(xListBox.getChild('0').getChild('0').getChildren())) xParDirFormatting = xListBox.getChild('1') self.assertEqual(7, len(xParDirFormatting.getChildren())) @@ -75,7 +75,7 @@ class styleNavigator(UITestCase): xParStyle = xListBox.getChild('0') self.assertEqual(3, len(xParStyle.getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xParStyle.getChild('0'))['Text']) - self.assertEqual(142, len(xParStyle.getChild('0').getChildren())) + self.assertEqual(143, len(xParStyle.getChild('0').getChildren())) self.assertEqual("Heading\t", get_state_as_dict(xParStyle.getChild('1'))['Text']) self.assertEqual(28, len(xParStyle.getChild('1').getChildren())) @@ -109,7 +109,7 @@ class styleNavigator(UITestCase): xParStyle = xListBox.getChild('0') self.assertEqual(3, len(xParStyle.getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xParStyle.getChild('0'))['Text']) - self.assertEqual(142, len(xParStyle.getChild('0').getChildren())) + self.assertEqual(143, len(xParStyle.getChild('0').getChildren())) self.assertEqual("Body Text\t", get_state_as_dict(xParStyle.getChild('1'))['Text']) self.assertEqual(6, len(xParStyle.getChild('1').getChildren())) @@ -144,7 +144,7 @@ class styleNavigator(UITestCase): # The cursor is on text without metadata self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) - self.assertEqual(142, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(143, len(xListBox.getChild('0').getChild('0').getChildren())) self.assertEqual(0, len(xListBox.getChild('1').getChildren())) self.assertEqual(0, len(xListBox.getChild('2').getChildren())) self.assertEqual(0, len(xListBox.getChild('3').getChildren())) @@ -154,7 +154,7 @@ class styleNavigator(UITestCase): # The cursor is on text with paragraph metadata showed under direct paragraph formatting self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) - self.assertEqual(142, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(143, len(xListBox.getChild('0').getChild('0').getChildren())) xParDirFormatting = xListBox.getChild('1') self.assertEqual(1, len(xParDirFormatting.getChildren())) @@ -207,7 +207,7 @@ class styleNavigator(UITestCase): # The cursor is on text without metadata self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) - self.assertEqual(142, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(143, len(xListBox.getChild('0').getChild('0').getChildren())) self.assertEqual(0, len(xListBox.getChild('1').getChildren())) self.assertEqual(0, len(xListBox.getChild('2').getChildren())) self.assertEqual(0, len(xListBox.getChild('3').getChildren())) @@ -217,7 +217,7 @@ class styleNavigator(UITestCase): # The cursor is on text with paragraph metadata showed under direct paragraph formatting self.assertEqual(1, len(xListBox.getChild('1').getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('1').getChild('0'))['Text']) - self.assertEqual(142, len(xListBox.getChild('1').getChild('0').getChildren())) + self.assertEqual(143, len(xListBox.getChild('1').getChild('0').getChildren())) # Outer bookmark xBookmarkFormatting = xListBox.getChild('0') @@ -264,7 +264,7 @@ class styleNavigator(UITestCase): # The cursor is on text without metadata self.assertEqual(1, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) - self.assertEqual(142, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(143, len(xListBox.getChild('0').getChild('0').getChildren())) self.assertEqual(0, len(xListBox.getChild('1').getChildren())) self.assertEqual(0, len(xListBox.getChild('2').getChildren())) diff --git a/sw/qa/uitest/styleInspector/tdf137513.py b/sw/qa/uitest/styleInspector/tdf137513.py index ea4b3213c920..936cb9400740 100644 --- a/sw/qa/uitest/styleInspector/tdf137513.py +++ b/sw/qa/uitest/styleInspector/tdf137513.py @@ -35,7 +35,7 @@ class tdf137513(UITestCase): self.assertEqual(2, len(xListBox.getChild('0').getChildren())) self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) self.assertEqual("Table Contents\t", get_state_as_dict(xListBox.getChild('0').getChild('1'))['Text']) - self.assertEqual(142, len(xListBox.getChild('0').getChild('0').getChildren())) + self.assertEqual(143, len(xListBox.getChild('0').getChild('0').getChildren())) xTableContent = xListBox.getChild('0').getChild('1') self.assertEqual(5, len(xTableContent.getChildren())) diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index d7bc363ee87f..18ad3d1144e0 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1462,14 +1462,14 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor, static void lcl_InitHyphValues( PropertyValues &rVals, sal_Int16 nMinLeading, sal_Int16 nMinTrailing, bool bNoCapsHyphenation, bool bNoLastWordHyphenation, - sal_Int16 nMinWordLength, sal_Int16 nTextHyphZone, sal_Int16 nKeep, + sal_Int16 nMinWordLength, sal_Int16 nTextHyphZone, bool bKeep, sal_Int16 nKeepType, sal_Int16 nCompoundMinLeading ) { sal_Int32 nLen = rVals.getLength(); if (0 == nLen) // yet to be initialized? { - rVals.realloc( 8 ); + rVals.realloc( 9 ); PropertyValue *pVal = rVals.getArray(); pVal[0].Name = UPN_HYPH_MIN_LEADING; @@ -1496,15 +1496,19 @@ static void lcl_InitHyphValues( PropertyValues &rVals, pVal[5].Handle = UPH_HYPH_ZONE; pVal[5].Value <<= nTextHyphZone; - pVal[6].Name = UPN_HYPH_KEEP; - pVal[6].Handle = UPH_HYPH_KEEP; - pVal[6].Value <<= nKeep; + pVal[6].Name = UPN_HYPH_KEEP_TYPE; + pVal[6].Handle = UPH_HYPH_KEEP_TYPE; + pVal[6].Value <<= nKeepType; pVal[7].Name = UPN_HYPH_COMPOUND_MIN_LEADING; pVal[7].Handle = UPH_HYPH_COMPOUND_MIN_LEADING; pVal[7].Value <<= nCompoundMinLeading; + + pVal[8].Name = UPN_HYPH_KEEP; + pVal[8].Handle = UPH_HYPH_KEEP; + pVal[8].Value <<= bKeep; } - else if (8 == nLen) // already initialized once? + else if (9 == nLen) // already initialized once? { PropertyValue *pVal = rVals.getArray(); pVal[0].Value <<= nMinLeading; @@ -1513,8 +1517,9 @@ static void lcl_InitHyphValues( PropertyValues &rVals, pVal[3].Value <<= bNoLastWordHyphenation; pVal[4].Value <<= nMinWordLength; pVal[5].Value <<= nTextHyphZone; - pVal[6].Value <<= nKeep; + pVal[6].Value <<= nKeepType; pVal[7].Value <<= nCompoundMinLeading; + pVal[8].Value <<= bKeep; } else { OSL_FAIL( "unexpected size of sequence" ); @@ -1523,7 +1528,7 @@ static void lcl_InitHyphValues( PropertyValues &rVals, const PropertyValues & SwTextFormatInfo::GetHyphValues() const { - OSL_ENSURE( 8 == m_aHyphVals.getLength(), + OSL_ENSURE( 9 == m_aHyphVals.getLength(), "hyphenation values not yet initialized" ); return m_aHyphVals; } @@ -1545,11 +1550,12 @@ bool SwTextFormatInfo::InitHyph( const bool bAutoHyphen ) const bool bNoCapsHyphenation = rAttr.IsNoCapsHyphenation(); const bool bNoLastWordHyphenation = rAttr.IsNoLastWordHyphenation(); const sal_Int16 nTextHyphZone = rAttr.GetTextHyphenZone(); - const sal_Int16 nKeep = rAttr.GetKeep(); + const bool bKeep = rAttr.IsKeep(); + const sal_Int16 nKeepType = rAttr.GetKeepType(); const sal_Int16 nCompoundMinimalLeading = std::max(rAttr.GetCompoundMinLead(), sal_uInt8(2)); lcl_InitHyphValues( m_aHyphVals, nMinimalLeading, nMinimalTrailing, bNoCapsHyphenation, bNoLastWordHyphenation, - nMinimalWordLength, nTextHyphZone, nKeep, nCompoundMinimalLeading ); + nMinimalWordLength, nTextHyphZone, bKeep, nKeepType, nCompoundMinimalLeading ); } return bAuto; } diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx index e2457cb1ed6c..acb3fe32cd31 100644 --- a/sw/source/core/text/widorp.cxx +++ b/sw/source/core/text/widorp.cxx @@ -41,6 +41,8 @@ #include #include +#include + #undef WIDOWTWIPS namespace @@ -458,7 +460,8 @@ bool WidowsAndOrphans::FindWidows( SwTextFrame *pFrame, SwTextMargin &rLine ) const SwTwips nChg = aRectFnSet.YDiff( nTmpY, nDocPrtTop + nOldHeight ); - // hyphenation-keep: truncate a hyphenated line at the end of the page (but not more) + // hyphenation-keep: truncate a hyphenated line at the end of + // the column, page or spread (but not more) int nExtraWidLines = 0; if( rLine.GetLineNr() >= m_nWidLines && pMaster->HasPara() && ( rLine.GetLineNr() == m_nWidLines || !rLine.GetCurr()->IsEndHyph() ) ) @@ -466,7 +469,32 @@ bool WidowsAndOrphans::FindWidows( SwTextFrame *pFrame, SwTextMargin &rLine ) SwParaPortion *pMasterPara = pMaster->GetPara(); const SwAttrSet& rSet = pFrame->GetTextNodeForParaProps()->GetSwAttrSet(); const SvxHyphenZoneItem &rAttr = rSet.GetHyphenZone(); - if ( pMasterPara && pMasterPara->GetNext() && rAttr.IsHyphen() && rAttr.GetKeep() ) + + bool bKeep = rAttr.IsHyphen() && rAttr.IsKeep() && rAttr.GetKeepType(); + + // if PAGE or SPREAD, allow hyphenation at bottom of the non-last columns + if( bKeep && pFrame->IsInSct() && ( + rAttr.GetKeepType() == css::text::ParagraphHyphenationKeepType::SPREAD || + rAttr.GetKeepType() == css::text::ParagraphHyphenationKeepType::PAGE ) ) + { + const SwSectionFrame* const pSct = pFrame->FindSctFrame(); + // multi-column section + if ( pSct->Lower()->IsColumnFrame() && pSct->Lower()->GetNext() + // and not in the last column + && !pFrame->FindColFrame()->GetNext() ) + { + bKeep = false; + } + } + + // if SPREAD, allow hyphenation at bottom of left pages + if ( bKeep && rAttr.GetKeepType() == css::text::ParagraphHyphenationKeepType::SPREAD && + pFrame->FindPageFrame()->OnRightPage() ) + { + bKeep = false; + } + + if ( bKeep && pMasterPara && pMasterPara->GetNext() ) { SwLineLayout * pNext = pMasterPara->GetNext(); SwLineLayout * pCurr = pNext; diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx index 4a8d48b49e7a..01cae68a6de9 100644 --- a/sw/source/core/unocore/unomapproperties.hxx +++ b/sw/source/core/unocore/unomapproperties.hxx @@ -121,7 +121,8 @@ { UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MAX_HYPHENS }, \ { UNO_NAME_PARA_HYPHENATION_MIN_WORD_LENGTH, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_WORD_LENGTH }, \ { UNO_NAME_PARA_HYPHENATION_ZONE, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_ZONE}, \ - { UNO_NAME_PARA_HYPHENATION_KEEP, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_KEEP }, \ + { UNO_NAME_PARA_HYPHENATION_KEEP, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_KEEP }, \ + { UNO_NAME_PARA_HYPHENATION_KEEP_TYPE, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_KEEP_TYPE }, \ { UNO_NAME_CHAR_AUTO_KERNING, RES_CHRATR_AUTOKERN, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { UNO_NAME_CHAR_BACK_COLOR, RES_CHRATR_BACKGROUND, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_BACK_COLOR }, \ { UNO_NAME_CHAR_BACKGROUND_COMPLEX_COLOR, RES_CHRATR_BACKGROUND, cppu::UnoType::get(), PROPERTY_NONE, MID_BACKGROUND_COMPLEX_COLOR },\ @@ -484,7 +485,8 @@ { UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MAX_HYPHENS},\ { UNO_NAME_PARA_HYPHENATION_MIN_WORD_LENGTH, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_WORD_LENGTH},\ { UNO_NAME_PARA_HYPHENATION_ZONE, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_ZONE},\ - { UNO_NAME_PARA_HYPHENATION_KEEP, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_KEEP},\ + { UNO_NAME_PARA_HYPHENATION_KEEP, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_KEEP},\ + { UNO_NAME_PARA_HYPHENATION_KEEP_TYPE, RES_PARATR_HYPHENZONE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_KEEP_TYPE},\ { UNO_NAME_NUMBERING_STYLE_NAME, RES_PARATR_NUMRULE, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0},\ { UNO_NAME_NUMBERING_LEVEL, RES_PARATR_LIST_LEVEL, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0},\ { UNO_NAME_PARA_USER_DEFINED_ATTRIBUTES, RES_UNKNOWNATR_CONTAINER, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 },\ diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx index 20c88d99ad12..ad8ff4b0df37 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx @@ -281,6 +281,7 @@ static OUString PropertyNametoRID(const OUString& rName) { "ParaHyphenationMinWordLength", RID_PARA_HYPHENATION_MIN_WORD_LENGTH }, { "ParaHyphenationZone", RID_PARA_HYPHENATION_ZONE }, { "ParaHyphenationKeep", RID_PARA_HYPHENATION_KEEP }, + { "ParaHyphenationKeepType", RID_PARA_HYPHENATION_KEEP_TYPE }, { "ParaInteropGrabBag", RID_PARA_INTEROP_GRAB_BAG }, { "ParaIsAutoFirstLineIndent", RID_PARA_IS_AUTO_FIRST_LINE_INDENT }, { "ParaIsCharacterDistance", RID_PARA_IS_CHARACTER_DISTANCE }, diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 316298adfb43..5aefa9d3b68b 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -103,6 +103,7 @@ namespace { PROP_PARA_HYPHENATION_NO_CAPS, u"ParaHyphenationNoCaps"}, { PROP_PARA_HYPHENATION_ZONE, u"ParaHyphenationZone"}, { PROP_PARA_HYPHENATION_KEEP, u"ParaHyphenationKeep"}, + { PROP_PARA_HYPHENATION_KEEP_TYPE, u"ParaHyphenationKeepType"}, { PROP_PARA_LINE_NUMBER_COUNT, u"ParaLineNumberCount"}, { PROP_PARA_IS_HANGING_PUNCTUATION, u"ParaIsHangingPunctuation"}, { PROP_PARA_LINE_SPACING, u"ParaLineSpacing"}, diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 8c0b07a70928..724648683335 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -249,6 +249,7 @@ enum PropertyIds ,PROP_PARA_HYPHENATION_NO_CAPS ,PROP_PARA_HYPHENATION_ZONE ,PROP_PARA_HYPHENATION_KEEP + ,PROP_PARA_HYPHENATION_KEEP_TYPE ,PROP_PARA_KEEP_TOGETHER ,PROP_PARA_LAST_LINE_ADJUST ,PROP_PARA_LEFT_MARGIN diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 35683ca531f4..a665a01c7209 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -708,7 +708,8 @@ void SettingsTable::ApplyProperties(uno::Reference const& x if ( !aAllow.second && ( !aUse.first || aUse.second ) ) { uno::Reference xPropertySet(xDefault, uno::UNO_QUERY); - xPropertySet->setPropertyValue("ParaHyphenationKeep", uno::Any(text::ParagraphHyphenationKeepType::COLUMN)); + xPropertySet->setPropertyValue("ParaHyphenationKeep", uno::Any(true)); + xPropertySet->setPropertyValue("ParaHyphenationKeepType", uno::Any(text::ParagraphHyphenationKeepType::COLUMN)); } } diff --git a/xmloff/inc/xmlprop.hxx b/xmloff/inc/xmlprop.hxx index 9b9226ffc716..72ffd69323f4 100644 --- a/xmloff/inc/xmlprop.hxx +++ b/xmloff/inc/xmlprop.hxx @@ -498,6 +498,7 @@ inline constexpr OUString PROP_ParaHyphenationNoCaps = u"ParaHyphenationNoCaps"_ inline constexpr OUString PROP_ParaHyphenationNoLastWord = u"ParaHyphenationNoLastWord"_ustr; inline constexpr OUString PROP_ParaHyphenationZone = u"ParaHyphenationZone"_ustr; inline constexpr OUString PROP_ParaHyphenationKeep = u"ParaHyphenationKeep"_ustr; +inline constexpr OUString PROP_ParaHyphenationKeepType = u"ParaHyphenationKeepType"_ustr; inline constexpr OUString PROP_ParaIsAutoFirstLineIndent = u"ParaIsAutoFirstLineIndent"_ustr; inline constexpr OUString PROP_ParaIsCharacterDistance = u"ParaIsCharacterDistance"_ustr; inline constexpr OUString PROP_ParaIsConnectBorder = u"ParaIsConnectBorder"_ustr; diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index dab286974ed4..39ba7cc1b499 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -1069,6 +1069,7 @@ namespace xmloff::token { TOKEN( "hyperlink-behaviour", XML_HYPERLINK_BEHAVIOUR ), TOKEN( "hyphenate", XML_HYPHENATE ), TOKEN( "hyphenation-keep", XML_HYPHENATION_KEEP ), + TOKEN( "hyphenation-keep-type", XML_HYPHENATION_KEEP_TYPE ), TOKEN( "hyphenation-ladder-count", XML_HYPHENATION_LADDER_COUNT ), TOKEN( "hyphenation-push-char-count", XML_HYPHENATION_PUSH_CHAR_COUNT ), TOKEN( "hyphenation-remain-char-count", XML_HYPHENATION_REMAIN_CHAR_COUNT ), @@ -1855,6 +1856,7 @@ namespace xmloff::token { TOKEN( "split-column", XML_SPLIT_COLUMN ), TOKEN( "split-position", XML_SPLIT_POSITION ), TOKEN( "split-row", XML_SPLIT_ROW ), + TOKEN( "spread", XML_SPREAD ), TOKEN( "spreadsheet", XML_SPREADSHEET ), TOKEN( "spreadMethod", XML_SPREADMETHOD ), TOKEN( "sql-statement", XML_SQL_STATEMENT ), diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx index f140d2341475..e4d552f5a5ba 100644 --- a/xmloff/source/text/txtprhdl.cxx +++ b/xmloff/source/text/txtprhdl.cxx @@ -231,11 +231,12 @@ SvXMLEnumMapEntry const pXML_ParaVerticalAlign_Enum[] = { XML_TOKEN_INVALID, 0 } }; -SvXMLEnumMapEntry const pXML_ParaHyphenationKeep_Enum[] = +SvXMLEnumMapEntry const pXML_ParaHyphenationKeepType_Enum[] = { { XML_AUTO, ParagraphHyphenationKeepType::AUTO }, - // keep page and column for interoperability - { XML_PAGE, ParagraphHyphenationKeepType::COLUMN }, + { XML_COLUMN, ParagraphHyphenationKeepType::COLUMN }, + { XML_PAGE, ParagraphHyphenationKeepType::PAGE }, + { XML_SPREAD, ParagraphHyphenationKeepType::SPREAD }, { XML_TOKEN_INVALID, 0 } }; @@ -1424,9 +1425,11 @@ static const XMLPropertyHandler *GetPropertyHandler pHdl = new XMLComplexColorHandler; break; case XML_TYPE_HYPHENATION_KEEP: - pHdl = new XMLConstantsPropertyHandler( pXML_ParaHyphenationKeep_Enum, XML_TOKEN_INVALID ); + pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_PAGE, ::xmloff::token::XML_AUTO ); + break; + case XML_TYPE_HYPHENATION_KEEP_TYPE: + pHdl = new XMLConstantsPropertyHandler( pXML_ParaHyphenationKeepType_Enum, XML_TOKEN_INVALID ); break; - default: { OSL_ENSURE(false, "XMLPropertyHandler missing (!)"); diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index f0762610e61f..f5ff3aa4de6e 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -346,6 +346,7 @@ XMLPropertyMapEntry constexpr aXMLParaPropMap[] = MAP_EXT( PROP_ParaHyphenationZone, XML_NAMESPACE_LO_EXT, XML_HYPHENATION_ZONE, XML_TYPE_NUMBER16_NONE|XML_TYPE_PROP_TEXT, 0 ), MAP_EXT( PROP_ParaHyphenationCompoundMinLeadingChars, XML_NAMESPACE_LO_EXT, XML_HYPHENATION_COMPOUND_REMAIN_CHAR_COUNT, XML_TYPE_NUMBER16_NO_ZERO|XML_TYPE_PROP_TEXT, 0 ), MP_E( PROP_ParaHyphenationKeep, XML_NAMESPACE_FO, XML_HYPHENATION_KEEP, XML_TYPE_HYPHENATION_KEEP, 0 ), + MAP_EXT( PROP_ParaHyphenationKeepType, XML_NAMESPACE_LO_EXT, XML_HYPHENATION_KEEP_TYPE, XML_TYPE_HYPHENATION_KEEP_TYPE|XML_TYPE_PROP_TEXT, 0 ), // RES_PARATR_DROP MP_E( PROP_DropCapWholeWord, XML_NAMESPACE_STYLE, XML_LENGTH, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BOOL, CTF_DROPCAPWHOLEWORD ), MP_E( PROP_DropCapCharStyleName, XML_NAMESPACE_STYLE, XML_STYLE_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_DROPCAPCHARSTYLE ), diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index ad716a02d13f..29aa2c055658 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -969,6 +969,7 @@ hyperlink hyperlink-behaviour hyphenate hyphenation-keep +hyphenation-keep-type hyphenation-ladder-count hyphenation-push-char-count hyphenation-remain-char-count @@ -1755,6 +1756,7 @@ split split-column split-position split-row +spread spreadsheet spreadMethod sql-statement