diff options
31 files changed, 268 insertions, 125 deletions
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index 51fe77596c41..b068fe643808 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -226,6 +226,7 @@ private: // hyphenation std::unique_ptr<weld::CheckButton> m_xHyphenBox; + std::unique_ptr<weld::CheckButton> m_xHyphenNoCapsBox; std::unique_ptr<weld::Label> m_xBeforeText; std::unique_ptr<weld::SpinButton> m_xExtHyphenBeforeBox; std::unique_ptr<weld::Label> m_xAfterText; diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 7990744f1cc3..dba1ea03caa8 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -1369,6 +1369,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) const SfxPoolItem* pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_HYPHENZONE ); if ( m_xHyphenBox->get_state_changed_from_saved() || + m_xHyphenNoCapsBox->get_state_changed_from_saved() || m_xExtHyphenBeforeBox->get_value_changed_from_saved() || m_xExtHyphenAfterBox->get_value_changed_from_saved() || m_xMaxHyphenEdit->get_value_changed_from_saved() ) @@ -1376,6 +1377,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) SvxHyphenZoneItem aHyphen( static_cast<const SvxHyphenZoneItem&>(GetItemSet().Get( _nWhich )) ); aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE ); + aHyphen.SetNoCapsHyphenation(m_xHyphenNoCapsBox->get_state() == TRISTATE_TRUE); if ( eHyphenState == TRISTATE_TRUE ) { @@ -1586,6 +1588,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) bIsHyphen = rHyphen.IsHyphen(); m_xHyphenBox->set_state(bIsHyphen ? TRISTATE_TRUE : TRISTATE_FALSE); + m_xHyphenNoCapsBox->set_state(rHyphen.IsNoCapsHyphenation() ? TRISTATE_TRUE : TRISTATE_FALSE); m_xExtHyphenBeforeBox->set_value(rHyphen.GetMinLead()); m_xExtHyphenAfterBox->set_value(rHyphen.GetMinTrail()); @@ -1594,8 +1597,10 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) else { m_xHyphenBox->set_state(TRISTATE_INDET); + m_xHyphenNoCapsBox->set_state(TRISTATE_INDET); } bool bEnable = bItemAvailable && bIsHyphen; + m_xHyphenNoCapsBox->set_sensitive(bEnable); m_xExtHyphenBeforeBox->set_sensitive(bEnable); m_xExtHyphenAfterBox->set_sensitive(bEnable); m_xBeforeText->set_sensitive(bEnable); @@ -1861,6 +1866,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) void SvxExtParagraphTabPage::ChangesApplied() { m_xHyphenBox->save_state(); + m_xHyphenNoCapsBox->save_state(); m_xExtHyphenBeforeBox->set_value(m_xExtHyphenBeforeBox->get_value()); m_xExtHyphenAfterBox->set_value(m_xExtHyphenAfterBox->get_value()); m_xMaxHyphenEdit->set_value(m_xMaxHyphenEdit->get_value()); @@ -1906,6 +1912,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia , nStdPos(0) // Hyphenation , m_xHyphenBox(m_xBuilder->weld_check_button("checkAuto")) + , m_xHyphenNoCapsBox(m_xBuilder->weld_check_button("checkNoCaps")) , m_xBeforeText(m_xBuilder->weld_label("labelLineBegin")) , m_xExtHyphenBeforeBox(m_xBuilder->weld_spin_button("spinLineEnd")) , m_xAfterText(m_xBuilder->weld_label("labelLineEnd")) @@ -1970,6 +1977,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia { bHtmlMode = true; m_xHyphenBox->set_sensitive(false); + m_xHyphenNoCapsBox->set_sensitive(false); m_xBeforeText->set_sensitive(false); m_xExtHyphenBeforeBox->set_sensitive(false); m_xAfterText->set_sensitive(false); @@ -2102,6 +2110,7 @@ void SvxExtParagraphTabPage::OrphanHdl() void SvxExtParagraphTabPage::HyphenClickHdl() { bool bEnable = m_xHyphenBox->get_state() == TRISTATE_TRUE; + m_xHyphenNoCapsBox->set_sensitive(bEnable); m_xBeforeText->set_sensitive(bEnable); m_xExtHyphenBeforeBox->set_sensitive(bEnable); m_xAfterText->set_sensitive(bEnable); diff --git a/cui/uiconfig/ui/textflowpage.ui b/cui/uiconfig/ui/textflowpage.ui index d9f2c1c0caa6..4fe15fa396c5 100644 --- a/cui/uiconfig/ui/textflowpage.ui +++ b/cui/uiconfig/ui/textflowpage.ui @@ -102,7 +102,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="top_attach">4</property> </packing> </child> <child> @@ -116,7 +116,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="top_attach">3</property> </packing> </child> <child> @@ -131,7 +131,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="top_attach">2</property> </packing> </child> <child> @@ -145,7 +145,7 @@ </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="top_attach">2</property> </packing> </child> <child> @@ -159,7 +159,7 @@ </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="top_attach">3</property> </packing> </child> <child> @@ -173,9 +173,29 @@ </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="top_attach">4</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkNoCaps"> + <property name="label" translatable="yes" context="textflowpage|checkNoCaps">Don't hyphenate words in _CAPS</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="has_tooltip">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> </packing> </child> + <child> + <placeholder/> + </child> </object> </child> </object> diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index ad71436ab89f..6fb8c3cfe181 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -164,6 +164,7 @@ const SfxItemInfo aItemInfos[EDITITEMCOUNT] = { { SID_ATTR_PARA_SCRIPTSPACE, true }, // EE_PARA_ASIANCJKSPACING { SID_ATTR_NUMBERING_RULE, true }, // EE_PARA_NUMBULL { 0, true }, // EE_PARA_HYPHENATE + { 0, true }, // EE_PARA_HYPHENATE_NO_CAPS { 0, true }, // EE_PARA_BULLETSTATE { 0, true }, // EE_PARA_OUTLLRSPACE { SID_ATTR_PARA_OUTLLEVEL, true }, // EE_PARA_OUTLLEVEL diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 48bc52ed6485..fa28d7f5692e 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -97,59 +97,60 @@ DefItems::DefItems() rDefItems[4] = new SvxScriptSpaceItem( true, EE_PARA_ASIANCJKSPACING ); rDefItems[5] = new SvxNumBulletItem( aDefaultNumRule, EE_PARA_NUMBULLET ); rDefItems[6] = new SfxBoolItem( EE_PARA_HYPHENATE, false ); - rDefItems[7] = new SfxBoolItem( EE_PARA_BULLETSTATE, true ); - rDefItems[8] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE ); - rDefItems[9] = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 ); - rDefItems[10] = new SvxBulletItem( EE_PARA_BULLET ); - rDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE ); - rDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE ); - rDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL ); - rDefItems[14] = new SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ); - rDefItems[15] = new SvxTabStopItem( 0, 0, SvxTabAdjust::Left, EE_PARA_TABS ); - rDefItems[16] = new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, EE_PARA_JUST_METHOD ); - rDefItems[17] = new SvxVerJustifyItem( SvxCellVerJustify::Standard, EE_PARA_VER_JUST ); + rDefItems[7] = new SfxBoolItem( EE_PARA_HYPHENATE_NO_CAPS, false ); + rDefItems[8] = new SfxBoolItem( EE_PARA_BULLETSTATE, true ); + rDefItems[9] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE ); + rDefItems[10] = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 ); + rDefItems[11] = new SvxBulletItem( EE_PARA_BULLET ); + rDefItems[12] = new SvxLRSpaceItem( EE_PARA_LRSPACE ); + rDefItems[13] = new SvxULSpaceItem( EE_PARA_ULSPACE ); + rDefItems[14] = new SvxLineSpacingItem( 0, EE_PARA_SBL ); + rDefItems[15] = new SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ); + rDefItems[16] = new SvxTabStopItem( 0, 0, SvxTabAdjust::Left, EE_PARA_TABS ); + rDefItems[17] = new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, EE_PARA_JUST_METHOD ); + rDefItems[18] = new SvxVerJustifyItem( SvxCellVerJustify::Standard, EE_PARA_VER_JUST ); // Character attributes: - rDefItems[18] = new SvxColorItem( COL_AUTO, EE_CHAR_COLOR ); - rDefItems[19] = new SvxFontItem( EE_CHAR_FONTINFO ); - rDefItems[20] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ); - rDefItems[21] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH ); - rDefItems[22] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ); - rDefItems[23] = new SvxUnderlineItem( LINESTYLE_NONE, EE_CHAR_UNDERLINE ); - rDefItems[24] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ); - rDefItems[25] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ); - rDefItems[26] = new SvxContourItem( false, EE_CHAR_OUTLINE ); - rDefItems[27] = new SvxShadowedItem( false, EE_CHAR_SHADOW ); - rDefItems[28] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT ); - rDefItems[29] = new SvxAutoKernItem( false, EE_CHAR_PAIRKERNING ); - rDefItems[30] = new SvxKerningItem( 0, EE_CHAR_KERNING ); - rDefItems[31] = new SvxWordLineModeItem( false, EE_CHAR_WLM ); - rDefItems[32] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE ); - rDefItems[33] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK ); - rDefItems[34] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL ); - rDefItems[35] = new SvxFontItem( EE_CHAR_FONTINFO_CJK ); - rDefItems[36] = new SvxFontItem( EE_CHAR_FONTINFO_CTL ); - rDefItems[37] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK ); - rDefItems[38] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL ); - rDefItems[39] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ); - rDefItems[40] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ); - rDefItems[41] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ); - rDefItems[42] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ); - rDefItems[43] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ); - rDefItems[44] = new SvxCharReliefItem( FontRelief::NONE, EE_CHAR_RELIEF ); - rDefItems[45] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY ); - rDefItems[46] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); - rDefItems[47] = new SvxOverlineItem( LINESTYLE_NONE, EE_CHAR_OVERLINE ); - rDefItems[48] = new SvxCaseMapItem( SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ); - rDefItems[49] = new SfxGrabBagItem( EE_CHAR_GRABBAG ); - rDefItems[50] = new SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ); + rDefItems[19] = new SvxColorItem( COL_AUTO, EE_CHAR_COLOR ); + rDefItems[20] = new SvxFontItem( EE_CHAR_FONTINFO ); + rDefItems[21] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ); + rDefItems[22] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH ); + rDefItems[23] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ); + rDefItems[24] = new SvxUnderlineItem( LINESTYLE_NONE, EE_CHAR_UNDERLINE ); + rDefItems[25] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ); + rDefItems[26] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ); + rDefItems[27] = new SvxContourItem( false, EE_CHAR_OUTLINE ); + rDefItems[28] = new SvxShadowedItem( false, EE_CHAR_SHADOW ); + rDefItems[29] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT ); + rDefItems[30] = new SvxAutoKernItem( false, EE_CHAR_PAIRKERNING ); + rDefItems[31] = new SvxKerningItem( 0, EE_CHAR_KERNING ); + rDefItems[32] = new SvxWordLineModeItem( false, EE_CHAR_WLM ); + rDefItems[33] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE ); + rDefItems[34] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK ); + rDefItems[35] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL ); + rDefItems[36] = new SvxFontItem( EE_CHAR_FONTINFO_CJK ); + rDefItems[37] = new SvxFontItem( EE_CHAR_FONTINFO_CTL ); + rDefItems[38] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK ); + rDefItems[39] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL ); + rDefItems[40] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ); + rDefItems[41] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ); + rDefItems[42] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ); + rDefItems[43] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ); + rDefItems[44] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ); + rDefItems[45] = new SvxCharReliefItem( FontRelief::NONE, EE_CHAR_RELIEF ); + rDefItems[46] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY ); + rDefItems[47] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); + rDefItems[48] = new SvxOverlineItem( LINESTYLE_NONE, EE_CHAR_OVERLINE ); + rDefItems[49] = new SvxCaseMapItem( SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ); + rDefItems[50] = new SfxGrabBagItem( EE_CHAR_GRABBAG ); + rDefItems[51] = new SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ); // Features - rDefItems[51] = new SfxVoidItem( EE_FEATURE_TAB ); - rDefItems[52] = new SfxVoidItem( EE_FEATURE_LINEBR ); - rDefItems[53] = new SvxColorItem( COL_RED, EE_FEATURE_NOTCONV ); - rDefItems[54] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ); + rDefItems[52] = new SfxVoidItem( EE_FEATURE_TAB ); + rDefItems[53] = new SfxVoidItem( EE_FEATURE_LINEBR ); + rDefItems[54] = new SvxColorItem( COL_RED, EE_FEATURE_NOTCONV ); + rDefItems[55] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ); - assert(EDITITEMCOUNT == 55 && "ITEMCOUNT changed, adjust DefItems!"); + assert(EDITITEMCOUNT == 56 && "ITEMCOUNT changed, adjust DefItems!"); // Init DefFonts: GetDefaultFonts( *static_cast<SvxFontItem*>(rDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START]), diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 983f210dec3a..ec2839c355b5 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -563,6 +563,7 @@ SvxHyphenZoneItem::SvxHyphenZoneItem( const bool bHyph, const sal_uInt16 nId ) : SfxPoolItem( nId ), bHyphen(bHyph), bPageEnd(true), + bNoCapsHyphenation(false), nMinLead(0), nMinTrail(0), nMaxHyphens(255) @@ -587,6 +588,9 @@ bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) con case MID_HYPHEN_MAX_HYPHENS: rVal <<= static_cast<sal_Int16>(nMaxHyphens); break; + case MID_HYPHEN_NO_CAPS: + rVal <<= bNoCapsHyphenation; + break; } return true; } @@ -596,7 +600,7 @@ bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) nMemberId &= ~CONVERT_TWIPS; sal_Int16 nNewVal = 0; - if( nMemberId != MID_IS_HYPHEN ) + if( nMemberId != MID_IS_HYPHEN && nMemberId != MID_HYPHEN_NO_CAPS ) if(!(rVal >>= nNewVal)) return false; @@ -614,6 +618,9 @@ bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case MID_HYPHEN_MAX_HYPHENS: nMaxHyphens = static_cast<sal_uInt8>(nNewVal); break; + case MID_HYPHEN_NO_CAPS: + bNoCapsHyphenation = Any2Bool(rVal); + break; } return true; } @@ -625,6 +632,7 @@ bool SvxHyphenZoneItem::operator==( const SfxPoolItem& rAttr ) const const SvxHyphenZoneItem& rItem = static_cast<const SvxHyphenZoneItem&>(rAttr); return ( rItem.bHyphen == bHyphen + && rItem.bNoCapsHyphenation == bNoCapsHyphenation && rItem.bPageEnd == bPageEnd && rItem.nMinLead == nMinLead && rItem.nMinTrail == nMinTrail diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx index be1e249f87bc..9c746ee55b05 100644 --- a/include/editeng/eeitem.hxx +++ b/include/editeng/eeitem.hxx @@ -76,65 +76,66 @@ class SvxNumBulletItem; #define EE_PARA_ASIANCJKSPACING TypedWhichId<SvxScriptSpaceItem>(EE_ITEMS_START+4) #define EE_PARA_NUMBULLET TypedWhichId<SvxNumBulletItem>(EE_ITEMS_START+5) #define EE_PARA_HYPHENATE TypedWhichId<SfxBoolItem>(EE_ITEMS_START+6) -#define EE_PARA_BULLETSTATE TypedWhichId<SfxBoolItem>(EE_ITEMS_START+7) -#define EE_PARA_OUTLLRSPACE TypedWhichId<SvxLRSpaceItem>(EE_ITEMS_START+8) -#define EE_PARA_OUTLLEVEL TypedWhichId<SfxInt16Item>(EE_ITEMS_START+9) -#define EE_PARA_BULLET TypedWhichId<SvxBulletItem>(EE_ITEMS_START+10) -#define EE_PARA_LRSPACE TypedWhichId<SvxLRSpaceItem>(EE_ITEMS_START+11) -#define EE_PARA_ULSPACE TypedWhichId<SvxULSpaceItem>(EE_ITEMS_START+12) -#define EE_PARA_SBL TypedWhichId<SvxLineSpacingItem>(EE_ITEMS_START+13) -#define EE_PARA_JUST TypedWhichId<SvxAdjustItem>(EE_ITEMS_START+14) -#define EE_PARA_TABS TypedWhichId<SvxTabStopItem>(EE_ITEMS_START+15) -#define EE_PARA_JUST_METHOD TypedWhichId<SvxJustifyMethodItem>(EE_ITEMS_START+16) -#define EE_PARA_VER_JUST TypedWhichId<SvxVerJustifyItem>(EE_ITEMS_START+17) -#define EE_PARA_END (EE_ITEMS_START+17) +#define EE_PARA_HYPHENATE_NO_CAPS TypedWhichId<SfxBoolItem>(EE_ITEMS_START+7) +#define EE_PARA_BULLETSTATE TypedWhichId<SfxBoolItem>(EE_ITEMS_START+8) +#define EE_PARA_OUTLLRSPACE TypedWhichId<SvxLRSpaceItem>(EE_ITEMS_START+9) +#define EE_PARA_OUTLLEVEL TypedWhichId<SfxInt16Item>(EE_ITEMS_START+10) +#define EE_PARA_BULLET TypedWhichId<SvxBulletItem>(EE_ITEMS_START+11) +#define EE_PARA_LRSPACE TypedWhichId<SvxLRSpaceItem>(EE_ITEMS_START+12) +#define EE_PARA_ULSPACE TypedWhichId<SvxULSpaceItem>(EE_ITEMS_START+13) +#define EE_PARA_SBL TypedWhichId<SvxLineSpacingItem>(EE_ITEMS_START+14) +#define EE_PARA_JUST TypedWhichId<SvxAdjustItem>(EE_ITEMS_START+15) +#define EE_PARA_TABS TypedWhichId<SvxTabStopItem>(EE_ITEMS_START+16) +#define EE_PARA_JUST_METHOD TypedWhichId<SvxJustifyMethodItem>(EE_ITEMS_START+17) +#define EE_PARA_VER_JUST TypedWhichId<SvxVerJustifyItem>(EE_ITEMS_START+18) +#define EE_PARA_END (EE_ITEMS_START+18) // Character attributes: -#define EE_CHAR_START (EE_ITEMS_START+18) -#define EE_CHAR_COLOR TypedWhichId<SvxColorItem>(EE_ITEMS_START+18) -#define EE_CHAR_FONTINFO TypedWhichId<SvxFontItem>(EE_ITEMS_START+19) -#define EE_CHAR_FONTHEIGHT TypedWhichId<SvxFontHeightItem>(EE_ITEMS_START+20) -#define EE_CHAR_FONTWIDTH TypedWhichId<SvxCharScaleWidthItem>(EE_ITEMS_START+21) -#define EE_CHAR_WEIGHT TypedWhichId<SvxWeightItem>(EE_ITEMS_START+22) -#define EE_CHAR_UNDERLINE TypedWhichId<SvxUnderlineItem>(EE_ITEMS_START+23) -#define EE_CHAR_STRIKEOUT TypedWhichId<SvxCrossedOutItem>(EE_ITEMS_START+24) -#define EE_CHAR_ITALIC TypedWhichId<SvxPostureItem>(EE_ITEMS_START+25) -#define EE_CHAR_OUTLINE TypedWhichId<SvxContourItem>(EE_ITEMS_START+26) -#define EE_CHAR_SHADOW TypedWhichId<SvxShadowedItem>(EE_ITEMS_START+27) -#define EE_CHAR_ESCAPEMENT TypedWhichId<SvxEscapementItem>(EE_ITEMS_START+28) -#define EE_CHAR_PAIRKERNING TypedWhichId<SvxAutoKernItem>(EE_ITEMS_START+29) -#define EE_CHAR_KERNING TypedWhichId<SvxKerningItem>(EE_ITEMS_START+30) -#define EE_CHAR_WLM TypedWhichId<SvxWordLineModeItem>(EE_ITEMS_START+31) -#define EE_CHAR_LANGUAGE TypedWhichId<SvxLanguageItem>(EE_ITEMS_START+32) -#define EE_CHAR_LANGUAGE_CJK TypedWhichId<SvxLanguageItem>(EE_ITEMS_START+33) -#define EE_CHAR_LANGUAGE_CTL TypedWhichId<SvxLanguageItem>(EE_ITEMS_START+34) -#define EE_CHAR_FONTINFO_CJK TypedWhichId<SvxFontItem>(EE_ITEMS_START+35) -#define EE_CHAR_FONTINFO_CTL TypedWhichId<SvxFontItem>(EE_ITEMS_START+36) -#define EE_CHAR_FONTHEIGHT_CJK TypedWhichId<SvxFontHeightItem>(EE_ITEMS_START+37) -#define EE_CHAR_FONTHEIGHT_CTL TypedWhichId<SvxFontHeightItem>(EE_ITEMS_START+38) -#define EE_CHAR_WEIGHT_CJK TypedWhichId<SvxWeightItem>(EE_ITEMS_START+39) -#define EE_CHAR_WEIGHT_CTL TypedWhichId<SvxWeightItem>(EE_ITEMS_START+40) -#define EE_CHAR_ITALIC_CJK TypedWhichId<SvxPostureItem>(EE_ITEMS_START+41) -#define EE_CHAR_ITALIC_CTL TypedWhichId<SvxPostureItem>(EE_ITEMS_START+42) -#define EE_CHAR_EMPHASISMARK TypedWhichId<SvxEmphasisMarkItem>(EE_ITEMS_START+43) -#define EE_CHAR_RELIEF TypedWhichId<SvxCharReliefItem>(EE_ITEMS_START+44) -#define EE_CHAR_RUBI_DUMMY TypedWhichId<SfxVoidItem>(EE_ITEMS_START+45) -#define EE_CHAR_XMLATTRIBS TypedWhichId<SvXMLAttrContainerItem>(EE_ITEMS_START+46) -#define EE_CHAR_OVERLINE TypedWhichId<SvxOverlineItem>(EE_ITEMS_START+47) -#define EE_CHAR_CASEMAP TypedWhichId<SvxCaseMapItem>(EE_ITEMS_START+48) -#define EE_CHAR_GRABBAG TypedWhichId<SfxGrabBagItem>(EE_ITEMS_START+49) -#define EE_CHAR_BKGCOLOR TypedWhichId<SvxBackgroundColorItem>(EE_ITEMS_START+50) +#define EE_CHAR_START (EE_ITEMS_START+19) +#define EE_CHAR_COLOR TypedWhichId<SvxColorItem>(EE_CHAR_START+0) +#define EE_CHAR_FONTINFO TypedWhichId<SvxFontItem>(EE_CHAR_START+1) +#define EE_CHAR_FONTHEIGHT TypedWhichId<SvxFontHeightItem>(EE_CHAR_START+2) +#define EE_CHAR_FONTWIDTH TypedWhichId<SvxCharScaleWidthItem>(EE_CHAR_START+3) +#define EE_CHAR_WEIGHT TypedWhichId<SvxWeightItem>(EE_CHAR_START+4) +#define EE_CHAR_UNDERLINE TypedWhichId<SvxUnderlineItem>(EE_CHAR_START+5) +#define EE_CHAR_STRIKEOUT TypedWhichId<SvxCrossedOutItem>(EE_CHAR_START+6) +#define EE_CHAR_ITALIC TypedWhichId<SvxPostureItem>(EE_CHAR_START+7) +#define EE_CHAR_OUTLINE TypedWhichId<SvxContourItem>(EE_CHAR_START+8) +#define EE_CHAR_SHADOW TypedWhichId<SvxShadowedItem>(EE_CHAR_START+9) +#define EE_CHAR_ESCAPEMENT TypedWhichId<SvxEscapementItem>(EE_CHAR_START+10) +#define EE_CHAR_PAIRKERNING TypedWhichId<SvxAutoKernItem>(EE_CHAR_START+11) +#define EE_CHAR_KERNING TypedWhichId<SvxKerningItem>(EE_CHAR_START+12) +#define EE_CHAR_WLM TypedWhichId<SvxWordLineModeItem>(EE_CHAR_START+13) +#define EE_CHAR_LANGUAGE TypedWhichId<SvxLanguageItem>(EE_CHAR_START+14) +#define EE_CHAR_LANGUAGE_CJK TypedWhichId<SvxLanguageItem>(EE_CHAR_START+15) +#define EE_CHAR_LANGUAGE_CTL TypedWhichId<SvxLanguageItem>(EE_CHAR_START+16) +#define EE_CHAR_FONTINFO_CJK TypedWhichId<SvxFontItem>(EE_CHAR_START+17) +#define EE_CHAR_FONTINFO_CTL TypedWhichId<SvxFontItem>(EE_CHAR_START+18) +#define EE_CHAR_FONTHEIGHT_CJK TypedWhichId<SvxFontHeightItem>(EE_CHAR_START+19) +#define EE_CHAR_FONTHEIGHT_CTL TypedWhichId<SvxFontHeightItem>(EE_CHAR_START+20) +#define EE_CHAR_WEIGHT_CJK TypedWhichId<SvxWeightItem>(EE_CHAR_START+21) +#define EE_CHAR_WEIGHT_CTL TypedWhichId<SvxWeightItem>(EE_CHAR_START+22) +#define EE_CHAR_ITALIC_CJK TypedWhichId<SvxPostureItem>(EE_CHAR_START+23) +#define EE_CHAR_ITALIC_CTL TypedWhichId<SvxPostureItem>(EE_CHAR_START+24) +#define EE_CHAR_EMPHASISMARK TypedWhichId<SvxEmphasisMarkItem>(EE_CHAR_START+25) +#define EE_CHAR_RELIEF TypedWhichId<SvxCharReliefItem>(EE_CHAR_START+26) +#define EE_CHAR_RUBI_DUMMY TypedWhichId<SfxVoidItem>(EE_CHAR_START+27) +#define EE_CHAR_XMLATTRIBS TypedWhichId<SvXMLAttrContainerItem>(EE_CHAR_START+28) +#define EE_CHAR_OVERLINE TypedWhichId<SvxOverlineItem>(EE_CHAR_START+29) +#define EE_CHAR_CASEMAP TypedWhichId<SvxCaseMapItem>(EE_CHAR_START+30) +#define EE_CHAR_GRABBAG TypedWhichId<SfxGrabBagItem>(EE_CHAR_START+31) +#define EE_CHAR_BKGCOLOR TypedWhichId<SvxBackgroundColorItem>(EE_CHAR_START+32) -#define EE_CHAR_END (EE_ITEMS_START+50) +#define EE_CHAR_END (EE_CHAR_START+32) -#define EE_FEATURE_START (EE_ITEMS_START+51) -#define EE_FEATURE_TAB (EE_ITEMS_START+51) -#define EE_FEATURE_LINEBR (EE_ITEMS_START+52) -#define EE_FEATURE_NOTCONV (EE_ITEMS_START+53) -#define EE_FEATURE_FIELD (EE_ITEMS_START+54) -#define EE_FEATURE_END (EE_ITEMS_START+54) +#define EE_FEATURE_START (EE_CHAR_END+1) +#define EE_FEATURE_TAB (EE_FEATURE_START+0) +#define EE_FEATURE_LINEBR (EE_FEATURE_TAB+1) +#define EE_FEATURE_NOTCONV (EE_FEATURE_LINEBR+1) +#define EE_FEATURE_FIELD (EE_FEATURE_NOTCONV+1) +#define EE_FEATURE_END (EE_FEATURE_FIELD+0) -#define EE_ITEMS_END (EE_ITEMS_START+54) +#define EE_ITEMS_END (EE_FEATURE_END) #define EDITITEMCOUNT ( EE_ITEMS_END - EE_ITEMS_START + 1 ) diff --git a/include/editeng/hyphenzoneitem.hxx b/include/editeng/hyphenzoneitem.hxx index fc718f916bdc..0b573f43c9f5 100644 --- a/include/editeng/hyphenzoneitem.hxx +++ b/include/editeng/hyphenzoneitem.hxx @@ -34,6 +34,7 @@ class EDITENG_DLLPUBLIC SvxHyphenZoneItem final : public SfxPoolItem { bool bHyphen : 1; bool bPageEnd : 1; + bool bNoCapsHyphenation : 1; sal_uInt8 nMinLead; sal_uInt8 nMinTrail; sal_uInt8 nMaxHyphens; @@ -62,6 +63,9 @@ public: void SetPageEnd( const bool bNew ) { bPageEnd = bNew; } bool IsPageEnd() const { return bPageEnd; } + void SetNoCapsHyphenation( const bool bNew ) { bNoCapsHyphenation = bNew; } + bool IsNoCapsHyphenation() const { return bNoCapsHyphenation; } + sal_uInt8 &GetMinLead() { return nMinLead; } sal_uInt8 GetMinLead() const { return nMinLead; } diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h index c41b45af9cb9..5af872b705b3 100644 --- a/include/editeng/memberids.h +++ b/include/editeng/memberids.h @@ -46,6 +46,7 @@ #define MID_HYPHEN_MIN_LEAD 1 #define MID_HYPHEN_MIN_TRAIL 2 #define MID_HYPHEN_MAX_HYPHENS 3 +#define MID_HYPHEN_NO_CAPS 4 // SvxBoxInfoItem #define MID_HORIZONTAL 1 diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index c442fa731384..aaf9cd18328f 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -135,6 +135,7 @@ struct SfxItemPropertySimpleEntry; {OUString(UNO_NAME_EDIT_PARA_ADJUST), EE_PARA_JUST, ::cppu::UnoType<sal_Int16>::get(), 0, MID_PARA_ADJUST }, \ {OUString(UNO_NAME_EDIT_PARA_BMARGIN), EE_PARA_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_LO_MARGIN, PropertyMoreFlags::METRIC_ITEM }, \ {OUString(UNO_NAME_EDIT_PARA_IS_HYPHEN), EE_PARA_HYPHENATE, ::cppu::UnoType<bool>::get(), 0, 0 }, \ + {OUString("ParaHyphenationNoCaps"), EE_PARA_HYPHENATE_NO_CAPS, ::cppu::UnoType<bool>::get(), 0, 0 }, \ {OUString(UNO_NAME_EDIT_PARA_LASTLINEADJ), EE_PARA_JUST, ::cppu::UnoType<sal_Int16>::get(), 0, MID_LAST_LINE_ADJUST }, \ {OUString(UNO_NAME_EDIT_PARA_LMARGIN), EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TXT_LMARGIN, PropertyMoreFlags::METRIC_ITEM }, \ {OUString(UNO_NAME_EDIT_PARA_LINESPACING), EE_PARA_SBL, cppu::UnoType<css::style::LineSpacing>::get(), 0, CONVERT_TWIPS}, \ diff --git a/include/linguistic/lngprophelp.hxx b/include/linguistic/lngprophelp.hxx index 8474767488fe..f05481019704 100644 --- a/include/linguistic/lngprophelp.hxx +++ b/include/linguistic/lngprophelp.hxx @@ -244,11 +244,13 @@ class PropertyHelper_Hyphen : sal_Int16 nHyphMinLeading, nHyphMinTrailing, nHyphMinWordLength; + bool bNoHyphenateCaps; // return values, will be set to default value or current temporary value sal_Int16 nResHyphMinLeading, nResHyphMinTrailing, nResHyphMinWordLength; + bool bResNoHyphenateCaps; PropertyHelper_Hyphen( const PropertyHelper_Hyphen & ) = delete; PropertyHelper_Hyphen & operator = ( const PropertyHelper_Hyphen & ) = delete; @@ -275,6 +277,7 @@ public: sal_Int16 GetMinLeading() const { return nResHyphMinLeading; } sal_Int16 GetMinTrailing() const { return nResHyphMinTrailing; } sal_Int16 GetMinWordLength() const { return nResHyphMinWordLength; } + bool IsNoHyphenateCaps() const { return bResNoHyphenateCaps; } }; class LNG_DLLPUBLIC PropertyHelper_Hyphenation @@ -297,6 +300,7 @@ public: sal_Int16 GetMinLeading() const; sal_Int16 GetMinTrailing() const; sal_Int16 GetMinWordLength() const; + bool IsNoHyphenateCaps() const; /// @throws css::uno::RuntimeException bool addLinguServiceEventListener( const css::uno::Reference< css::linguistic2::XLinguServiceEventListener >& rxListener ); diff --git a/include/unotools/linguprops.hxx b/include/unotools/linguprops.hxx index 346a314503e4..23e0cdaae035 100644 --- a/include/unotools/linguprops.hxx +++ b/include/unotools/linguprops.hxx @@ -35,6 +35,7 @@ #define UPN_HYPH_MIN_LEADING "HyphMinLeading" #define UPN_HYPH_MIN_TRAILING "HyphMinTrailing" #define UPN_HYPH_MIN_WORD_LENGTH "HyphMinWordLength" +#define UPN_HYPH_NO_CAPS "HyphNoCaps" // UNO property names for Lingu // (those not covered by the SpellChecker and Hyphenator @@ -100,6 +101,7 @@ #define UPH_IS_REVERSE_MAPPING 33 #define UPH_IS_GRAMMAR_AUTO 34 #define UPH_IS_GRAMMAR_INTERACTIVE 35 +#define UPH_HYPH_NO_CAPS 36 #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 4418f9ba54a0..02bd9702d980 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -1005,6 +1005,7 @@ namespace xmloff { namespace token { XML_HYPHENATION_LADDER_COUNT, XML_HYPHENATION_PUSH_CHAR_COUNT, XML_HYPHENATION_REMAIN_CHAR_COUNT, + XML_HYPHENATION_NO_CAPS, XML_I, XML_ICON, XML_ICON_SET, diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 3434482486ed..a16420844228 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -42,6 +42,7 @@ #include <linguistic/lngprops.hxx> #include <linguistic/misc.hxx> #include <svtools/strings.hrc> +#include <unotools/charclass.hxx> #include <unotools/pathoptions.hxx> #include <unotools/useroptions.hxx> #include <unotools/lingucfg.hxx> @@ -254,6 +255,7 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo sal_Int16 minTrail = rHelper.GetMinTrailing(); sal_Int16 minLead = rHelper.GetMinLeading(); sal_Int16 minLen = rHelper.GetMinWordLength(); + bool bNoHyphenateCaps = rHelper.IsNoHyphenateCaps(); HyphenDict *dict = nullptr; rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW; @@ -286,6 +288,12 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo eEnc = mvDicts[k].eEnc; CharClass * pCC = mvDicts[k].apCC.get(); + // Don't hyphenate uppercase words if requested + if (bNoHyphenateCaps && aWord == makeUpperCase(aWord, pCC)) + { + return nullptr; + } + // we don't want to work with a default text encoding since following incorrect // results may occur only for specific text and thus may be hard to notice. // Thus better always make a clean exit here if the text encoding is in question. diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx index ed0006c8962b..ba3fbd52e7af 100644 --- a/linguistic/source/lngprophelp.cxx +++ b/linguistic/source/lngprophelp.cxx @@ -522,6 +522,7 @@ void PropertyHelper_Hyphen::SetDefaultValues() nResHyphMinLeading = nHyphMinLeading = 2; nResHyphMinTrailing = nHyphMinTrailing = 2; nResHyphMinWordLength = nHyphMinWordLength = 0; + bResNoHyphenateCaps = bNoHyphenateCaps = false; } @@ -536,6 +537,8 @@ void PropertyHelper_Hyphen::GetCurrentValues() { sal_Int16 *pnVal = nullptr, *pnResVal = nullptr; + bool *pbVal = nullptr; + bool *pbResVal = nullptr; if ( rPropName == UPN_HYPH_MIN_LEADING ) { @@ -552,12 +555,22 @@ void PropertyHelper_Hyphen::GetCurrentValues() pnVal = &nHyphMinWordLength; pnResVal = &nResHyphMinWordLength; } + else if ( rPropName == UPN_HYPH_NO_CAPS ) + { + pbVal = &bNoHyphenateCaps; + pbResVal = &bResNoHyphenateCaps; + } if (pnVal && pnResVal) { GetPropSet()->getPropertyValue( rPropName ) >>= *pnVal; *pnResVal = *pnVal; } + else if (pbVal && pbResVal) + { + GetPropSet()->getPropertyValue( rPropName ) >>= *pbVal; + *pbResVal = *pbVal; + } } } } @@ -570,18 +583,22 @@ bool PropertyHelper_Hyphen::propertyChange_Impl( const PropertyChangeEvent& rEvt if (!bRes && GetPropSet().is() && rEvt.Source == GetPropSet()) { sal_Int16 *pnVal = nullptr; + bool *pbVal = nullptr; switch (rEvt.PropertyHandle) { case UPH_HYPH_MIN_LEADING : pnVal = &nHyphMinLeading; break; case UPH_HYPH_MIN_TRAILING : pnVal = &nHyphMinTrailing; break; case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &nHyphMinWordLength; break; + case UPH_HYPH_NO_CAPS : pbVal = &bNoHyphenateCaps; break; default: SAL_WARN( "linguistic", "unknown property" ); } if (pnVal) rEvt.NewValue >>= *pnVal; + else if (pbVal) + rEvt.NewValue >>= *pbVal; - bRes = (pnVal != nullptr); + bRes = (pnVal != nullptr || pbVal != nullptr); if (bRes) { LinguServiceEvent aEvt(GetEvtObj(), LinguServiceEventFlags::HYPHENATE_AGAIN); @@ -610,10 +627,12 @@ void PropertyHelper_Hyphen::SetTmpPropVals( const PropertyValues &rPropVals ) nResHyphMinLeading = nHyphMinLeading; nResHyphMinTrailing = nHyphMinTrailing; nResHyphMinWordLength = nHyphMinWordLength; + bResNoHyphenateCaps = bNoHyphenateCaps; for (const PropertyValue& rVal : rPropVals) { sal_Int16 *pnResVal = nullptr; + bool *pbResVal = nullptr; if ( rVal.Name == UPN_HYPH_MIN_LEADING ) pnResVal = &nResHyphMinLeading; @@ -621,11 +640,15 @@ void PropertyHelper_Hyphen::SetTmpPropVals( const PropertyValues &rPropVals ) pnResVal = &nResHyphMinTrailing; else if ( rVal.Name == UPN_HYPH_MIN_WORD_LENGTH ) pnResVal = &nResHyphMinWordLength; + else if ( rVal.Name == UPN_HYPH_NO_CAPS ) + pbResVal = &bResNoHyphenateCaps; - DBG_ASSERT( pnResVal, "unknown property" ); + DBG_ASSERT( pnResVal || pbResVal, "unknown property" ); if (pnResVal) rVal.Value >>= *pnResVal; + else if (pbResVal) + rVal.Value >>= *pbResVal; } } @@ -696,6 +719,11 @@ sal_Int16 PropertyHelper_Hyphenation::GetMinWordLength() const return mxPropHelper->GetMinWordLength(); } +bool PropertyHelper_Hyphenation::IsNoHyphenateCaps() const +{ + return mxPropHelper->IsNoHyphenateCaps(); +} + bool PropertyHelper_Hyphenation::addLinguServiceEventListener( const css::uno::Reference< css::linguistic2::XLinguServiceEventListener >& rxListener ) { diff --git a/offapi/com/sun/star/style/ParagraphProperties.idl b/offapi/com/sun/star/style/ParagraphProperties.idl index 27b9457fdde9..30aa9a28c608 100644 --- a/offapi/com/sun/star/style/ParagraphProperties.idl +++ b/offapi/com/sun/star/style/ParagraphProperties.idl @@ -407,6 +407,13 @@ published service ParagraphProperties */ [optional, property, readonly] string ListLabelString; + /** Specifies whether words written in CAPS will be hyphenated. + Setting to `true` will disable hyphenation of words written in CAPS for this paragraph. + + @since LibreOffice 6.5 + */ + [optional, property] boolean ParaHyphenationNoCaps; + }; diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng index 85cbe5debacb..69d43e510d44 100644 --- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng +++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng @@ -2403,4 +2403,13 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. </rng:optional> </rng:define> + <!-- TODO no proposal --> + <rng:define name="style-text-properties-attlist" combine="interleave"> + <rng:optional> + <rng:attribute name="loext:hyphenation-no-caps"> + <rng:ref name="boolean"/> + </rng:attribute> + </rng:optional> + </rng:define> + </rng:grammar> diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 3afb88e02b0c..d324be62bf0a 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -63,6 +63,7 @@ #define UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS "ParaHyphenationMaxLeadingChars" #define UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS "ParaHyphenationMaxTrailingChars" #define UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS "ParaHyphenationMaxHyphens" +#define UNO_NAME_PARA_HYPHENATION_NO_CAPS "ParaHyphenationNoCaps" #define UNO_NAME_LEFT_MARGIN "LeftMargin" #define UNO_NAME_RIGHT_MARGIN "RightMargin" #define UNO_NAME_HEADER_LEFT_MARGIN "HeaderLeftMargin" diff --git a/sw/qa/extras/layout/data/tdf121658.odt b/sw/qa/extras/layout/data/tdf121658.odt Binary files differnew file mode 100644 index 000000000000..b3429ff41af3 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf121658.odt diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 59ee1706ffa2..b98cb3e8cc50 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -22,6 +22,7 @@ #include <editeng/fontitem.hxx> #include <editeng/fhgtitem.hxx> #include <editeng/postitem.hxx> +#include <editeng/unolingu.hxx> #include <fmtanchr.hxx> #include <fmtfsize.hxx> #include <fmtcntnt.hxx> @@ -3556,6 +3557,20 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf105481) CPPUNIT_ASSERT_LESSEQUAL(nTxtBottom, nFormula2Bottom); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf121658) +{ + uno::Reference<linguistic2::XHyphenator> xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString()))) + return; + + createDoc("tdf121658.odt"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + + // Only 2 hyphenated words should appear in the document (in the lowercase words). + // Uppercase words should not be hyphenated. + assertXPath(pXmlDoc, "//Special[@nType='PortionType::Hyphen']", 2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/odfexport/data/tdf121658.odt b/sw/qa/extras/odfexport/data/tdf121658.odt Binary files differnew file mode 100644 index 000000000000..1ab6f75c8de6 --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf121658.odt diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 0334a73debca..b407bdd3e820 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -2307,5 +2307,13 @@ DECLARE_ODFEXPORT_TEST(tdf128504, "tdf128504.docx") CPPUNIT_ASSERT(!visitedStyleName.equalsIgnoreAsciiCase("Visited Internet Link")); } +DECLARE_ODFEXPORT_TEST(tdf121658, "tdf121658.odt") +{ + uno::Reference<container::XNameAccess> xParaStyles(getStyles("ParagraphStyles")); + uno::Reference<beans::XPropertySet> xStyle1(xParaStyles->getByName( + "Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle1, "ParaHyphenationNoCaps")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index c1aacf8c8bf1..133266675553 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1334,13 +1334,13 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor, } static void lcl_InitHyphValues( PropertyValues &rVals, - sal_Int16 nMinLeading, sal_Int16 nMinTrailing ) + sal_Int16 nMinLeading, sal_Int16 nMinTrailing, bool bNoCapsHyphenation ) { sal_Int32 nLen = rVals.getLength(); if (0 == nLen) // yet to be initialized? { - rVals.realloc( 2 ); + rVals.realloc( 3 ); PropertyValue *pVal = rVals.getArray(); pVal[0].Name = UPN_HYPH_MIN_LEADING; @@ -1350,12 +1350,17 @@ static void lcl_InitHyphValues( PropertyValues &rVals, pVal[1].Name = UPN_HYPH_MIN_TRAILING; pVal[1].Handle = UPH_HYPH_MIN_TRAILING; pVal[1].Value <<= nMinTrailing; + + pVal[2].Name = UPN_HYPH_NO_CAPS; + pVal[2].Handle = UPH_HYPH_NO_CAPS; + pVal[2].Value <<= bNoCapsHyphenation; } - else if (2 == nLen) // already initialized once? + else if (3 == nLen) // already initialized once? { PropertyValue *pVal = rVals.getArray(); pVal[0].Value <<= nMinLeading; pVal[1].Value <<= nMinTrailing; + pVal[2].Value <<= bNoCapsHyphenation; } else { OSL_FAIL( "unexpected size of sequence" ); @@ -1364,7 +1369,7 @@ static void lcl_InitHyphValues( PropertyValues &rVals, const PropertyValues & SwTextFormatInfo::GetHyphValues() const { - OSL_ENSURE( 2 == m_aHyphVals.getLength(), + OSL_ENSURE( 3 == m_aHyphVals.getLength(), "hyphenation values not yet initialized" ); return m_aHyphVals; } @@ -1382,7 +1387,8 @@ bool SwTextFormatInfo::InitHyph( const bool bAutoHyphen ) { const sal_Int16 nMinimalLeading = std::max(rAttr.GetMinLead(), sal_uInt8(2)); const sal_Int16 nMinimalTrailing = rAttr.GetMinTrail(); - lcl_InitHyphValues( m_aHyphVals, nMinimalLeading, nMinimalTrailing); + const bool bNoCapsHyphenation = rAttr.IsNoCapsHyphenation(); + lcl_InitHyphValues( m_aHyphVals, nMinimalLeading, nMinimalTrailing, bNoCapsHyphenation); } return bAuto; } diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx index 348055c506f4..bf75f3d133d6 100644 --- a/sw/source/core/unocore/unomapproperties.hxx +++ b/sw/source/core/unocore/unomapproperties.hxx @@ -111,6 +111,7 @@ #define COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01 \ { OUString(UNO_NAME_PARRSID), RES_PARATR_RSID, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { OUString(UNO_NAME_PARA_IS_HYPHENATION), RES_PARATR_HYPHENZONE, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, MID_IS_HYPHEN }, \ + { OUString(UNO_NAME_PARA_HYPHENATION_NO_CAPS), RES_PARATR_HYPHENZONE, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_NO_CAPS }, \ { OUString(UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS), RES_PARATR_HYPHENZONE, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_LEAD }, \ { OUString(UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS), RES_PARATR_HYPHENZONE, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_TRAIL }, \ { OUString(UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS), RES_PARATR_HYPHENZONE, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MAX_HYPHENS }, \ @@ -429,6 +430,7 @@ { OUString(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },\ { OUString(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },\ { OUString(UNO_NAME_PARA_IS_HYPHENATION), RES_PARATR_HYPHENZONE, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, MID_IS_HYPHEN },\ + { OUString(UNO_NAME_PARA_HYPHENATION_NO_CAPS), RES_PARATR_HYPHENZONE, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_NO_CAPS },\ { OUString(UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS), RES_PARATR_HYPHENZONE, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_LEAD },\ { OUString(UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS), RES_PARATR_HYPHENZONE, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_TRAIL },\ { OUString(UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS), RES_PARATR_HYPHENZONE, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MAX_HYPHENS},\ diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 2d04ac4986c0..47db619b20c6 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1013,6 +1013,8 @@ void DocxExport::WriteSettings() { pFS->singleElementNS(XML_w, XML_autoHyphenation, FSNS(XML_w, XML_val), OString::boolean(static_cast<const SvxHyphenZoneItem*>(pItem)->IsHyphen())); + if (static_cast<const SvxHyphenZoneItem*>(pItem)->IsNoCapsHyphenation()) + pFS->singleElementNS(XML_w, XML_doNotHyphenateCaps); } // Even and Odd Headers @@ -1154,13 +1156,6 @@ void DocxExport::WriteSettings() pFS->singleElementNS(XML_w, XML_hyphenationZone, FSNS(XML_w, XML_val), OString::number(nHyphenationZone)); } - else if (rProp.Name == "NoHyphenateCaps") - { - bool bNoHyphenateCaps; - rProp.Value >>= bNoHyphenateCaps; - if (bNoHyphenateCaps) - pFS->singleElementNS(XML_w, XML_doNotHyphenateCaps); - } } } diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 8667929183e2..0d5740e9fa83 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -91,6 +91,7 @@ OUString getPropertyName( PropertyIds eId ) case PROP_PARA_CONTEXT_MARGIN: sName = "ParaContextMargin"; break; case PROP_PARA_BOTTOM_MARGIN: sName = "ParaBottomMargin"; break; case PROP_PARA_IS_HYPHENATION: sName = "ParaIsHyphenation"; break; + case PROP_PARA_HYPHENATION_NO_CAPS: sName = "ParaHyphenationNoCaps"; break; case PROP_PARA_LINE_NUMBER_COUNT: sName = "ParaLineNumberCount"; break; case PROP_PARA_IS_HANGING_PUNCTUATION: sName = "ParaIsHangingPunctuation"; break; case PROP_PARA_LINE_SPACING: sName = "ParaLineSpacing"; break; diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index ce44a1520e6d..a1a0c8f851a1 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -225,6 +225,7 @@ enum PropertyIds ,PROP_PARA_FIRST_LINE_INDENT ,PROP_PARA_IS_HANGING_PUNCTUATION ,PROP_PARA_IS_HYPHENATION + ,PROP_PARA_HYPHENATION_NO_CAPS ,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 05f655675e66..7852547945e7 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -722,7 +722,7 @@ void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x // Auto hyphenation: turns on hyphenation by default, <w:suppressAutoHyphens/> may still disable it at a paragraph level. // Situation is similar for RTF_WIDOWCTRL, which turns on widow / orphan control by default. - if (m_pImpl->m_bAutoHyphenation || m_pImpl->m_bWidowControl) + if (m_pImpl->m_bAutoHyphenation || m_pImpl->m_bNoHyphenateCaps || m_pImpl->m_bWidowControl) { uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDoc, uno::UNO_QUERY); if (!xStyleFamiliesSupplier.is()) @@ -737,6 +737,11 @@ void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x uno::Reference<beans::XPropertySet> xPropertySet(xDefault, uno::UNO_QUERY); xPropertySet->setPropertyValue("ParaIsHyphenation", uno::makeAny(true)); } + if (m_pImpl->m_bNoHyphenateCaps) + { + uno::Reference<beans::XPropertySet> xPropertySet(xDefault, uno::UNO_QUERY); + xPropertySet->setPropertyValue("ParaHyphenationNoCaps", uno::makeAny(true)); + } if (m_pImpl->m_bWidowControl && lcl_isDefault(xPropertyState, "ParaWidows") && lcl_isDefault(xPropertyState, "ParaOrphans")) { uno::Reference<beans::XPropertySet> xPropertySet(xDefault, uno::UNO_QUERY); diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 19c7692be7cd..86344f0d05b9 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -1007,6 +1007,7 @@ namespace xmloff { namespace token { 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 ), + TOKEN( "hyphenation-no-caps", XML_HYPHENATION_NO_CAPS ), TOKEN( "i", XML_I ), TOKEN( "icon", XML_ICON ), TOKEN( "icon-set", XML_ICON_SET ), diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 0136cfee7fce..5340ffd80e16 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -336,6 +336,7 @@ XMLPropertyMapEntry const aXMLParaPropMap[] = MT_E( "ParaHyphenationMaxLeadingChars", FO, HYPHENATION_REMAIN_CHAR_COUNT, XML_TYPE_NUMBER16_NO_ZERO, 0 ), MT_E( "ParaHyphenationMaxTrailingChars",FO, HYPHENATION_PUSH_CHAR_COUNT, XML_TYPE_NUMBER16_NO_ZERO, 0 ), MP_E( "ParaHyphenationMaxHyphens", FO, HYPHENATION_LADDER_COUNT, XML_TYPE_NUMBER16_NONE, 0 ), + MAP_EXT( "ParaHyphenationNoCaps", XML_NAMESPACE_LO_EXT, XML_HYPHENATION_NO_CAPS, XML_TYPE_BOOL|XML_TYPE_PROP_TEXT, 0 ), // RES_PARATR_DROP MP_E( "DropCapWholeWord", STYLE, LENGTH, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BOOL, CTF_DROPCAPWHOLEWORD ), MP_E( "DropCapCharStyleName", STYLE, 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 beb4adb8360e..539cdb53a778 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -925,6 +925,7 @@ hyphenation-keep hyphenation-ladder-count hyphenation-push-char-count hyphenation-remain-char-count +hyphenation-no-caps i icon icon-set |