зеркало из https://github.com/mozilla/pjs.git
Bug 469499 - Remove MOZ_MACBROWSER ifdefs; r=bsmedberg
This commit is contained in:
Родитель
b3a819c9f8
Коммит
9996772cc1
|
@ -42,14 +42,6 @@ VPATH = @srcdir@
|
|||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = spellchecker
|
||||
DIRS = idl locales
|
||||
|
||||
ifeq (camino,$(MOZ_BUILD_APP))
|
||||
DIRS += osxspell
|
||||
else
|
||||
DIRS += hunspell
|
||||
endif
|
||||
|
||||
DIRS += src
|
||||
DIRS = idl locales hunspell src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Spellchecker Component.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mike Pinkerton.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Mike Pinkerton <mikepinkerton@mac.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = hunspell
|
||||
DIRS = src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Spellchecker Component.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mike Pinkerton.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Mike Pinkerton <mikepinkerton@mac.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = hunspell
|
||||
LIBRARY_NAME = osxspell_s
|
||||
FORCE_STATIC_LIB = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
|
||||
CMMSRCS = \
|
||||
mozOSXSpell.mm \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -1,79 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Spellchecker Component.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mike Pinkerton.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Mike Pinkerton <mikepinkerton@mac.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* This spellchecker is based on the built-in spellchecker on Mac OS X. It
|
||||
* does not use any Hunspell technology or rely on their dictionaries. It's just
|
||||
* a thin wrapper around the Cocoa NSSpellChecker API.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozOSXSpell_h__
|
||||
#define mozOSXSpell_h__
|
||||
|
||||
#include "mozISpellCheckingEngine.h"
|
||||
#include "mozIPersonalDictionary.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
// Use the same contract ID as the Hunspell spellchecker so we get picked up
|
||||
// instead on Mac OS X but we have our own CID.
|
||||
#define MOZ_OSXSPELL_CONTRACTID "@mozilla.org/spellchecker/engine;1"
|
||||
#define MOZ_OSXSPELL_CID \
|
||||
{ /* BAABBAF4-71C3-47F4-A576-E75469E485E2 */ \
|
||||
0xBAABBAF4, 0x71C3, 0x47F4, \
|
||||
{ 0xA5, 0x76, 0xE7, 0x54, 0x69, 0xE4, 0x85, 0xE2} }
|
||||
|
||||
class mozOSXSpell : public mozISpellCheckingEngine
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_MOZISPELLCHECKINGENGINE
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(mozOSXSpell)
|
||||
|
||||
mozOSXSpell();
|
||||
|
||||
private:
|
||||
|
||||
~mozOSXSpell();
|
||||
|
||||
// NSSpellChecker provides the ability to add words to the local dictionary,
|
||||
// but it's much easier to let the rest of Gecko handle that via the personal
|
||||
// dictionary given to us and just be ignorant about new words.
|
||||
nsCOMPtr<mozIPersonalDictionary> mPersonalDictionary;
|
||||
|
||||
nsString mLanguage; // cached to speed up Check()
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,338 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Spellchecker Component.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mike Pinkerton.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Mike Pinkerton <mikepinkerton@mac.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* This spellchecker is based on the built-in spellchecker on Mac OS X. It
|
||||
* does not use any Hunspell technology or rely on their dictionaries. It's just
|
||||
* a thin wrapper around the Cocoa NSSpellChecker API.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozOSXSpell.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsObjCExceptions.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
// utility category we need for PRUnichar<->NSString conversion (taken from Camino)
|
||||
@interface NSString(PRUnicharUtils)
|
||||
+ (id)stringWithPRUnichars:(const PRUnichar*)inString;
|
||||
- (PRUnichar*)createNewUnicodeBuffer;
|
||||
@end
|
||||
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(mozOSXSpell)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(mozOSXSpell)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(mozOSXSpell)
|
||||
NS_INTERFACE_MAP_ENTRY(mozISpellCheckingEngine)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, mozISpellCheckingEngine)
|
||||
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(mozOSXSpell)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(mozOSXSpell, mPersonalDictionary);
|
||||
|
||||
mozOSXSpell::mozOSXSpell()
|
||||
{
|
||||
}
|
||||
|
||||
mozOSXSpell::~mozOSXSpell()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// GetDictionary
|
||||
//
|
||||
// Nothing to do here, we don't have a dictionary on disk, so this is really
|
||||
// just a no-op. The caller is responsible for disposing of |aDictionary|.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::GetDictionary(PRUnichar **aDictionary)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aDictionary);
|
||||
|
||||
*aDictionary = [@"" createNewUnicodeBuffer];
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
//
|
||||
// SetDictionary
|
||||
//
|
||||
// Another no-op as there's nothing to load or initialize.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::SetDictionary(const PRUnichar *aDictionary)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// GetLanguage
|
||||
//
|
||||
// Returns the language of the current dictionary, which should be the l10n
|
||||
// the user is running. The caller is responsible for disposing of |aLanguage|.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::GetLanguage(PRUnichar **aLanguage)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aLanguage);
|
||||
|
||||
if (!mLanguage.Length()) {
|
||||
@try {
|
||||
NSString* lang = [[NSSpellChecker sharedSpellChecker] language];
|
||||
*aLanguage = [lang createNewUnicodeBuffer];
|
||||
}
|
||||
@catch (id exception) {
|
||||
// If we get here, the spelling system on the user's machine is almost
|
||||
// certainly damaged; do what the rest of the OS does, and silently
|
||||
// ignore it.
|
||||
*aLanguage = NULL;
|
||||
}
|
||||
mLanguage.Assign(*aLanguage);
|
||||
}
|
||||
else {
|
||||
*aLanguage = ToNewUnicode(mLanguage);
|
||||
}
|
||||
|
||||
return *aLanguage ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
//
|
||||
// GetProvidesPersonalDictionary
|
||||
//
|
||||
// We let Gecko handle the personal dictionary, even though NSSpellChecker can
|
||||
// handle ignoring words itself.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::GetProvidesPersonalDictionary(PRBool *aProvidesPersonalDictionary)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aProvidesPersonalDictionary);
|
||||
|
||||
*aProvidesPersonalDictionary = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// GetProvidesWordUtils
|
||||
//
|
||||
// I have no idea what this is, so we don't provide it.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::GetProvidesWordUtils(PRBool *aProvidesWordUtils)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aProvidesWordUtils);
|
||||
|
||||
*aProvidesWordUtils = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// GetName
|
||||
//
|
||||
// Name not supported (nor is it in Hunspell impl)
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::GetName(PRUnichar * *aName)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//
|
||||
// GetCopyright
|
||||
//
|
||||
// Copyright not supported (nor is it in Hunspell impl)
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::GetCopyright(PRUnichar * *aCopyright)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//
|
||||
// GetPersonalDictionary
|
||||
//
|
||||
// Return the personal dictionary we've been given with Set.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::GetPersonalDictionary(mozIPersonalDictionary** aPersonalDictionary)
|
||||
{
|
||||
*aPersonalDictionary = mPersonalDictionary;
|
||||
NS_IF_ADDREF(*aPersonalDictionary);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// SetPersonalDictionary
|
||||
//
|
||||
// Hold onto the personal dictionary we're given.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::SetPersonalDictionary(mozIPersonalDictionary* aPersonalDictionary)
|
||||
{
|
||||
mPersonalDictionary = aPersonalDictionary;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// GetDictionaryList
|
||||
//
|
||||
// We only support the OS dictionary from NSSpellChecker so there will only ever
|
||||
// be one. The caller is responsible for disposing of |aDictionaries|.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::GetDictionaryList(PRUnichar ***aDictionaries, PRUint32 *aCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDictionaries);
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
|
||||
*aCount = 1;
|
||||
*aDictionaries = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *)); // only one entry
|
||||
GetLanguage(*aDictionaries);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// Check
|
||||
//
|
||||
// Check if the given word is spelled correctly. If the main dictionary says
|
||||
// it's not, check again against the peronal dictionary we were given.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::Check(const PRUnichar *aWord, PRBool *aResult)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aWord);
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = PR_FALSE;
|
||||
|
||||
NSString* wordStr = [NSString stringWithPRUnichars:aWord];
|
||||
NSRange misspelledRange;
|
||||
@try {
|
||||
misspelledRange = [[NSSpellChecker sharedSpellChecker] checkSpellingOfString:wordStr startingAt:0];
|
||||
}
|
||||
@catch (id exception) {
|
||||
// Silently return true; if something is seriously wrong with the
|
||||
// spelling system on a user's machine, the best thing to do is
|
||||
// to just treat everything as correct.
|
||||
*aResult = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
if (misspelledRange.location != NSNotFound && mPersonalDictionary)
|
||||
mPersonalDictionary->Check(aWord, mLanguage.get(), aResult);
|
||||
else
|
||||
*aResult = PR_TRUE;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
//
|
||||
// Suggest
|
||||
//
|
||||
// Provide a list of suggestions for the incrorectly spelled word |aWord| by
|
||||
// converting the list we get back from NSSpellChecker into an array of PRUnichar
|
||||
// strings. If |aWord| is spelled correctly, |aSuggestions| will be NULL. The caller
|
||||
// is responsible for disposing of |aSuggestions|.
|
||||
//
|
||||
NS_IMETHODIMP mozOSXSpell::Suggest(const PRUnichar *aWord, PRUnichar ***aSuggestions, PRUint32 *aSuggestionCount)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aSuggestions);
|
||||
NS_ENSURE_ARG_POINTER(aSuggestionCount);
|
||||
*aSuggestions = NULL;
|
||||
|
||||
// check the word against the NSSpellChecker
|
||||
NSString* wordStr = [NSString stringWithPRUnichars:aWord];
|
||||
NSArray* guesses = [[NSSpellChecker sharedSpellChecker] guessesForWord:wordStr];
|
||||
*aSuggestionCount = [guesses count];
|
||||
|
||||
// convert results from NSArray to array of PRUnichar's
|
||||
if (*aSuggestionCount) {
|
||||
*aSuggestions = (PRUnichar **)nsMemory::Alloc(*aSuggestionCount * sizeof(PRUnichar *));
|
||||
PRUint32 i = 0;
|
||||
NSEnumerator* e = [guesses objectEnumerator];
|
||||
NSString* guess = nil;
|
||||
while ((guess = [e nextObject])) {
|
||||
(*aSuggestions)[i] = [guess createNewUnicodeBuffer];
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP mozOSXSpell::LoadDictionariesFromDir(nsIFile* aFile)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
//
|
||||
// String utilities taken from Camino
|
||||
//
|
||||
|
||||
@implementation NSString(PRUnicharUtils)
|
||||
|
||||
- (PRUnichar*)createNewUnicodeBuffer
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSNULL;
|
||||
|
||||
PRUint32 length = [self length];
|
||||
PRUnichar* retStr = (PRUnichar*)nsMemory::Alloc((length + 1) * sizeof(PRUnichar));
|
||||
if (!retStr)
|
||||
return NULL;
|
||||
[self getCharacters:retStr];
|
||||
retStr[length] = PRUnichar(0);
|
||||
return retStr;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSNULL;
|
||||
}
|
||||
|
||||
+ (id)stringWithPRUnichars:(const PRUnichar*)inString
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
if (inString)
|
||||
return [self stringWithCharacters:inString length:nsCRT::strlen(inString)];
|
||||
else
|
||||
return [self string];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
@end
|
|
@ -62,13 +62,8 @@ CPPSRCS = \
|
|||
mozInlineSpellWordUtil.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq (camino,$(MOZ_BUILD_APP))
|
||||
SHARED_LIBRARY_LIBS += ../osxspell/src/$(LIB_PREFIX)osxspell_s.$(LIB_SUFFIX)
|
||||
LOCAL_INCLUDES += -I$(srcdir)/../osxspell/src
|
||||
else
|
||||
SHARED_LIBRARY_LIBS += ../hunspell/src/$(LIB_PREFIX)hunspell_s.$(LIB_SUFFIX)
|
||||
LOCAL_INCLUDES += -I$(srcdir)/../hunspell/src
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(LIBS_DIR) \
|
||||
|
|
|
@ -36,14 +36,8 @@
|
|||
|
||||
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
|
||||
#ifdef MOZ_MACBROWSER
|
||||
#include "mozOSXSpell.h"
|
||||
#else
|
||||
#include "mozHunspell.h"
|
||||
#include "mozHunspellDirProvider.h"
|
||||
#endif
|
||||
|
||||
#include "mozSpellChecker.h"
|
||||
#include "mozInlineSpellChecker.h"
|
||||
#include "nsTextServicesCID.h"
|
||||
|
@ -60,13 +54,8 @@
|
|||
0x9fe5d975, 0x9bd, 0x44aa, \
|
||||
{ 0xa0, 0x1a, 0x66, 0x40, 0x2e, 0xa2, 0x86, 0x57} }
|
||||
|
||||
#ifdef MOZ_MACBROWSER
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(mozOSXSpell)
|
||||
#else
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozHunspell, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(mozHunspellDirProvider)
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozSpellChecker, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozPersonalDictionary, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(mozSpellI18NManager)
|
||||
|
@ -104,24 +93,16 @@ mozInlineSpellCheckerConstructor(nsISupports *aOuter, REFNSIID aIID,
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef MOZ_MACBROWSER
|
||||
NS_DEFINE_NAMED_CID(MOZ_OSXSPELL_CID);
|
||||
#else
|
||||
NS_DEFINE_NAMED_CID(MOZ_HUNSPELL_CID);
|
||||
NS_DEFINE_NAMED_CID(HUNSPELLDIRPROVIDER_CID);
|
||||
#endif // MOZ_MACBROWSER
|
||||
NS_DEFINE_NAMED_CID(NS_SPELLCHECKER_CID);
|
||||
NS_DEFINE_NAMED_CID(MOZ_PERSONALDICTIONARY_CID);
|
||||
NS_DEFINE_NAMED_CID(MOZ_SPELLI18NMANAGER_CID);
|
||||
NS_DEFINE_NAMED_CID(MOZ_INLINESPELLCHECKER_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kSpellcheckCIDs[] = {
|
||||
#ifdef MOZ_MACBROWSER
|
||||
{ &kMOZ_OSXSPELL_CID, false, NULL, mozOSXSpellConstructor },
|
||||
#else
|
||||
{ &kMOZ_HUNSPELL_CID, false, NULL, mozHunspellConstructor },
|
||||
{ &kHUNSPELLDIRPROVIDER_CID, false, NULL, mozHunspellDirProviderConstructor },
|
||||
#endif // MOZ_MACBROWSER
|
||||
{ &kNS_SPELLCHECKER_CID, false, NULL, mozSpellCheckerConstructor },
|
||||
{ &kMOZ_PERSONALDICTIONARY_CID, false, NULL, mozPersonalDictionaryConstructor },
|
||||
{ &kMOZ_SPELLI18NMANAGER_CID, false, NULL, mozSpellI18NManagerConstructor },
|
||||
|
@ -130,12 +111,8 @@ static const mozilla::Module::CIDEntry kSpellcheckCIDs[] = {
|
|||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kSpellcheckContracts[] = {
|
||||
#ifdef MOZ_MACBROWSER
|
||||
{ MOZ_OSXSPELL_CONTRACTID, &kMOZ_OSXSPELL_CID },
|
||||
#else
|
||||
{ MOZ_HUNSPELL_CONTRACTID, &kMOZ_HUNSPELL_CID },
|
||||
{ mozHunspellDirProvider::kContractID, &kHUNSPELLDIRPROVIDER_CID },
|
||||
#endif // MOZ_MACBROWSER
|
||||
{ NS_SPELLCHECKER_CONTRACTID, &kNS_SPELLCHECKER_CID },
|
||||
{ MOZ_PERSONALDICTIONARY_CONTRACTID, &kMOZ_PERSONALDICTIONARY_CID },
|
||||
{ MOZ_SPELLI18NMANAGER_CONTRACTID, &kMOZ_SPELLI18NMANAGER_CID },
|
||||
|
@ -144,9 +121,7 @@ static const mozilla::Module::ContractIDEntry kSpellcheckContracts[] = {
|
|||
};
|
||||
|
||||
static const mozilla::Module::CategoryEntry kSpellcheckCategories[] = {
|
||||
#ifndef MOZ_MACBROWSER
|
||||
{ XPCOM_DIRECTORY_PROVIDER_CATEGORY, "spellcheck-directory-provider", mozHunspellDirProvider::kContractID },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче