summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-11-28 11:13:44 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-12-06 12:00:37 +0100
commit72bd0df107ee47c4d54fa88b4960d32ea03e9f69 (patch)
treef4ad346dbf636f32211298aace3a4a34957058f3 /linguistic
parentd8c36a8771398327ba83884a2e0aa82a6d7c8492 (diff)
tdf#121658 Add option to not hyphenate words in CAPS
* Add checkbox to pagraph dialog * Store property in paragraph model * Move docx import/export from grabbag to paragraph model * Add ODF import/export * Add ODF unit test * Add layout test Change-Id: Id4e7c5a0ad145c042f862995d227c31ae2aa0abd Reviewed-on: https://gerrit.libreoffice.org/83979 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/lngprophelp.cxx32
1 files changed, 30 insertions, 2 deletions
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 )
{