summaryrefslogtreecommitdiff
path: root/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
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 /lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
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 'lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx')
-rw-r--r--lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx8
1 files changed, 8 insertions, 0 deletions
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.