[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - lingucomponent/Module_lingucomponent.mk lingucomponent/source postprocess/Rdb_services.mk Repository.mk solenv/bin
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 12 20:46:23 UTC 2019
Repository.mk | 2
lingucomponent/Module_lingucomponent.mk | 2
lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx | 11 ++--
lingucomponent/source/spellcheck/macosxspell/macspellimp.mm | 30 +++++++++++
postprocess/Rdb_services.mk | 4 +
solenv/bin/native-code.py | 3 -
6 files changed, 46 insertions(+), 6 deletions(-)
New commits:
commit 9d85335b098dc2988314898cf70f4187d52146fa
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Apr 24 16:21:23 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Aug 12 22:45:47 2019 +0200
tdf#124909: Assume the iOS de_DE dictionary works well enough generically
On macOS, the system says it has a generic "de" dictionary. But on
iOS, it says it is specificaly "de_DE". Assume it is good enough for
the other German variants, too, for now.
Change-Id: I745cc02c1ffa774dbcbfdc1d775ce358957f04f8
(cherry picked from commit 4f46a493eae1ab9d705451738f79876e869622c9)
Reviewed-on: https://gerrit.libreoffice.org/77358
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tor Lillqvist <tml at collabora.com>
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index e317f80142ee..2439fef273f8 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -138,6 +138,20 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
postspdict.push_back( pLangStr );
}
}
+#ifdef IOS
+ // iOS says it has specifically de_DE, but let's assume it is good enough for the other
+ // variants, too, for now.
+ else if ([pLangStr isEqualToString:@"de_DE"])
+ {
+ const std::vector<NSString*> aDE
+ { @"AT", @"BE", @"CH", @"DE", @"LI", @"LU" };
+ for (auto c: aDE)
+ {
+ pLangStr = [@"de_" stringByAppendingString: c];
+ postspdict.push_back( pLangStr );
+ }
+ }
+#endif
else if ([pLangStr isEqualToString:@"en"])
{
// System has en_AU, en_CA, en_GB, and en_IN. Add the rest.
commit 608ac7055ef6c82aeb5b581fbb6e66add4ff8c3a
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Mar 25 14:23:38 2019 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Aug 12 22:45:32 2019 +0200
tdf#124172: Use the MacOSXSpell library on iOS, too
The code needed just a small amount of ifdefs to use UITextChecker on
iOS instead of NSSpellChecker.
Change-Id: I19edfffd3cc317a79beacc0b94668a6fd5ea3b32
Reviewed-on: https://gerrit.libreoffice.org/77357
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tor Lillqvist <tml at collabora.com>
diff --git a/Repository.mk b/Repository.mk
index 268af2df6fd5..9a92cae32d0b 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -485,6 +485,8 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
) \
fps_aqua \
vclplug_osx \
+ ) \
+ $(if $(filter iOS MACOSX,$(OS)), \
MacOSXSpell \
) \
))
diff --git a/lingucomponent/Module_lingucomponent.mk b/lingucomponent/Module_lingucomponent.mk
index 4f3d2424f992..2bde5d5391e5 100644
--- a/lingucomponent/Module_lingucomponent.mk
+++ b/lingucomponent/Module_lingucomponent.mk
@@ -14,7 +14,7 @@ $(eval $(call gb_Module_add_targets,lingucomponent,\
Library_guesslang \
Library_hyphen \
Library_lnth \
- $(if $(filter MACOSX,$(OS)),Library_MacOSXSpell) \
+ $(if $(filter iOS MACOSX,$(OS)),Library_MacOSXSpell) \
Library_spell \
StaticLibrary_ulingu \
Library_numbertext \
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index e0c075ecbc72..cf0f49472ff0 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -22,12 +22,14 @@
#include <cppuhelper/implbase.hxx>
-#ifdef MACOSX
#include <premac.h>
+#ifdef MACOSX
#include <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
-#include <postmac.h>
+#else
+#include <UIKit/UIKit.h>
#endif
+#include <postmac.h>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceDisplayName.hpp>
@@ -63,8 +65,11 @@ class MacSpellChecker :
Locale * aDLocs;
OUString * aDNames;
sal_Int32 numdict;
+#ifdef MACOSX
int macTag; // unique tag for this doc
-
+#else
+ UITextChecker * pChecker;
+#endif
::comphelper::OInterfaceContainerHelper2 aEvtListeners;
Reference< XPropertyChangeListener > xPropHelper;
linguistic::PropertyHelper_Spell * pPropHelper;
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 9b4c715b7ba0..e317f80142ee 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -53,10 +53,14 @@ MacSpellChecker::MacSpellChecker() :
bDisposing = false;
pPropHelper = nullptr;
numdict = 0;
+#ifndef IOS
NSApplicationLoad();
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
macTag = [NSSpellChecker uniqueSpellDocumentTag];
[pool release];
+#else
+ pChecker = [[UITextChecker alloc] init];
+#endif
}
@@ -108,7 +112,11 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
// TODO How on Mac OS X?
// invoke a second dictionary manager to get the shared dictionary list
+#ifdef MACOSX
NSArray *aSpellCheckLanguages = [[NSSpellChecker sharedSpellChecker] availableLanguages];
+#else
+ NSArray *aSpellCheckLanguages = [UITextChecker availableLanguages];
+#endif
for (NSUInteger i = 0; i < [aSpellCheckLanguages count]; i++)
{
@@ -331,8 +339,12 @@ sal_Int16 MacSpellChecker::GetSpellFailure( const OUString &rWord, const Locale
aLang = [aLang stringByAppendingString:aTaggedCountry];
}
+#ifdef MACOSX
NSInteger aCount;
NSRange range = [[NSSpellChecker sharedSpellChecker] checkSpellingOfString:aNSStr startingAt:0 language:aLang wrap:false inSpellDocumentWithTag:macTag wordCount:&aCount];
+#else
+ NSRange range = [pChecker rangeOfMisspelledWordInString:aNSStr range:NSMakeRange(0, [aNSStr length]) startingAt:0 wrap:NO language:aLang];
+#endif
int rVal = 0;
if(range.length>0)
{
@@ -430,8 +442,12 @@ Reference< XSpellAlternatives >
NSString* aTaggedCountry = [@"_" stringByAppendingString:aCountry];
aLang = [aLang stringByAppendingString:aTaggedCountry];
}
+#ifdef MACOSX
[[NSSpellChecker sharedSpellChecker] setLanguage:aLang];
NSArray *guesses = [[NSSpellChecker sharedSpellChecker] guessesForWordRange:NSMakeRange(0, [aNSStr length]) inString:aNSStr language:aLang inSpellDocumentWithTag:0];
+#else
+ NSArray *guesses = [pChecker guessesForWordRange:NSMakeRange(0, [aNSStr length]) inString:aNSStr language:aLang];
+#endif
count = [guesses count];
if (count)
{
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index 7834751c660c..6e92e790339f 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -128,11 +128,13 @@ $(eval $(call gb_Rdb_add_components,services,\
writerperfect/source/calc/wpftcalc \
$(if $(filter MACOSX,$(OS)), \
$(call gb_Helper_optional,AVMEDIA,avmedia/source/macavf/avmediaMacAVF) \
- lingucomponent/source/spellcheck/macosxspell/MacOSXSpell \
fpicker/source/aqua/fps_aqua \
shell/source/backends/macbe/macbe1 \
vcl/vcl.macosx \
) \
+ $(if $(filter iOS MACOSX,$(OS)), \
+ lingucomponent/source/spellcheck/macosxspell/MacOSXSpell \
+ ) \
$(if $(filter WNT,$(OS)), \
avmedia/source/win/avmediawin \
dtrans/source/generic/dtrans \
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index ec04d8b29920..dc64a083c2f7 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -60,7 +60,8 @@ core_factory_list = [
("libvcllo.a", "vcl_component_getFactory"),
("libspelllo.a", "spell_component_getFactory"),
("libpdffilterlo.a", "pdffilter_component_getFactory"),
- ("libsvgiolo.a", "svgio_component_getFactory")
+ ("libsvgiolo.a", "svgio_component_getFactory"),
+ ("libMacOSXSpelllo.a", "MacOSXSpell_component_getFactory", "#ifdef IOS"),
]
core_constructor_list = [
More information about the Libreoffice-commits
mailing list