diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-11-19 09:18:11 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-12-06 18:34:57 +0100 |
commit | 506d8f1792cd004d97c6d3e84c21da10e68adf08 (patch) | |
tree | a650a70d7a95cf931fba01db1b360272c7c6cc3f /sw | |
parent | fd0bb8b743f7b74cb223f41814741cd775a2b4fb (diff) |
tdf#128191 Show infobar when hyphenation info for text language is missing
During doc loading it's too early to add infobars,
thus add a mechanism to display infobars once view is ready
Change-Id: Ie963a304d2101a5bbdd59130c354d581ff7d2e9b
Reviewed-on: https://gerrit.libreoffice.org/83161
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/strings.hrc | 2 | ||||
-rw-r--r-- | sw/source/core/text/inftxt.cxx | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 1ef224407aa5..cc421939d2e2 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -385,6 +385,8 @@ #define RID_STR_SYSTEM NC_("RID_STR_SYSTEM", "[System]") #define STR_MULT_INTERACT_HYPH_WARN NC_("STR_MULT_INTERACT_HYPH_WARN", "The interactive hyphenation is already active\nin a different document") #define STR_HYPH_TITLE NC_("STR_HYPH_TITLE", "Hyphenation") +#define STR_HYPH_MISSING NC_("STR_HYPH_MISSING", "Missing hyphenation info") +#define STR_HYPH_MISSING_DETAIL NC_("STR_HYPH_MISSING", "Please install the hyphenation package for locale “%1”.") // Undo #define STR_CANT_UNDO NC_("STR_CANT_UNDO", "not possible") diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index f0933284feaa..9fc9116fe1e4 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -23,6 +23,7 @@ #include <unotools/lingucfg.hxx> #include <hintids.hxx> #include <svl/ctloptions.hxx> +#include <sfx2/infobar.hxx> #include <sfx2/printer.hxx> #include <sal/log.hxx> #include <editeng/hyphenzoneitem.hxx> @@ -61,6 +62,8 @@ #include <pam.hxx> #include <numrule.hxx> #include <EnhancedPDFExportHelper.hxx> +#include <docsh.hxx> +#include <strings.hrc> using namespace ::com::sun::star; using namespace ::com::sun::star::linguistic2; @@ -1450,9 +1453,15 @@ bool SwTextFormatInfo::IsHyphenate() const if (!xHyph->hasLocale(g_pBreakIt->GetLocale(eTmp))) { - // TODO: Add an infobar for this case, tdf#128191 - SAL_WARN("sw", "missing hyphenation package for locale: " - << g_pBreakIt->GetLocale(eTmp).Language); + SfxObjectShell* pShell = m_pFrame->GetDoc().GetDocShell(); + if (pShell) + { + pShell->AppendInfoBarWhenReady( + "hyphenationmissing", SwResId(STR_HYPH_MISSING), + SwResId(STR_HYPH_MISSING_DETAIL) + .replaceFirst("%1", g_pBreakIt->GetLocale(eTmp).Language), + InfobarType::WARNING); + } } return xHyph->hasLocale( g_pBreakIt->GetLocale(eTmp) ); |