diff options
Diffstat (limited to 'linguistic')
-rw-r--r--[-rwxr-xr-x] | linguistic/JunitTest_linguistic_complex.mk (renamed from linguistic/qa/complex/linguistic/makefile.mk) | 52 | ||||
-rwxr-xr-x[-rw-r--r--] | linguistic/JunitTest_linguistic_unoapi.mk | 72 | ||||
-rw-r--r-- | linguistic/Library_lng.mk | 86 | ||||
-rw-r--r-- | linguistic/Module_linguistic.mk | 13 | ||||
-rwxr-xr-x | linguistic/Package_inc.mk | 40 | ||||
-rw-r--r-- | linguistic/inc/linguistic/hyphdta.hxx | 13 | ||||
-rw-r--r-- | linguistic/inc/linguistic/lngdllapi.h | 45 | ||||
-rw-r--r-- | linguistic/inc/linguistic/lngprophelp.hxx | 93 | ||||
-rw-r--r-- | linguistic/inc/linguistic/misc.hxx | 24 | ||||
-rw-r--r-- | linguistic/inc/linguistic/spelldta.hxx | 6 | ||||
-rw-r--r-- | linguistic/prj/build.lst | 8 | ||||
-rw-r--r-- | linguistic/prj/d.lst | 13 | ||||
-rwxr-xr-x | linguistic/prj/makefile.mk (renamed from linguistic/inc/makefile.mk) | 27 | ||||
-rw-r--r-- | linguistic/source/grammarchecker.cxx | 305 | ||||
-rw-r--r-- | linguistic/source/grammarchecker.hxx | 109 | ||||
-rw-r--r-- | linguistic/source/hyphdta.cxx | 16 | ||||
-rw-r--r-- | linguistic/source/lngprophelp.cxx | 155 | ||||
-rwxr-xr-x | linguistic/source/makefile.mk | 117 | ||||
-rw-r--r-- | linguistic/source/spelldta.cxx | 10 |
19 files changed, 551 insertions, 653 deletions
diff --git a/linguistic/qa/complex/linguistic/makefile.mk b/linguistic/JunitTest_linguistic_complex.mk index 43a88ee0a198..705ab853a199 100755..100644 --- a/linguistic/qa/complex/linguistic/makefile.mk +++ b/linguistic/JunitTest_linguistic_complex.mk @@ -2,7 +2,7 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2000, 2010 Oracle and/or its affiliates. +# Copyright 2000, 2011 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # @@ -25,37 +25,29 @@ # #************************************************************************* -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE +$(eval $(call gb_JunitTest_JunitTest,linguistic_complex,SRCDIR)) -PRJ = ../../.. -PRJNAME = sc -TARGET = qa_complex_linguistic +$(eval $(call gb_JunitTest_set_defs,linguistic_complex,\ + $$(DEFS) \ + -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/linguistic/qa/complex/linguistic/testdocuments \ +)) -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = complex/linguistic +$(eval $(call gb_JunitTest_add_jars,linguistic_complex,\ + $(OUTDIR)/bin/OOoRunner.jar \ + $(OUTDIR)/bin/ridl.jar \ + $(OUTDIR)/bin/test.jar \ + $(OUTDIR)/bin/test-tools.jar \ + $(OUTDIR)/bin/unoil.jar \ + $(OUTDIR)/bin/jurt.jar \ +)) -# here store only Files which contain a @Test -JAVATESTFILES = \ - HangulHanjaConversion.java +$(eval $(call gb_JunitTest_add_sourcefiles,linguistic_complex,\ + linguistic/qa/complex/linguistic/HangulHanjaConversion \ + linguistic/qa/complex/linguistic/TestDocument \ +)) -# put here all other files -JAVAFILES = $(JAVATESTFILES) \ - TestDocument.java +$(eval $(call gb_JunitTest_add_classes,linguistic_complex,\ + complex.linguistic.HangulHanjaConversion \ +)) -JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) - -# Sample how to debug -# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y - -.END - -.INCLUDE: settings.mk -.INCLUDE: target.mk -.INCLUDE: installationtest.mk - -ALLTAR : javatest - -.END +# vim: set noet sw=4 ts=4: diff --git a/linguistic/JunitTest_linguistic_unoapi.mk b/linguistic/JunitTest_linguistic_unoapi.mk index 2036fef787fd..c6638746b71c 100644..100755 --- a/linguistic/JunitTest_linguistic_unoapi.mk +++ b/linguistic/JunitTest_linguistic_unoapi.mk @@ -1,49 +1,53 @@ -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +#************************************************************************* # -# 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 or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. # -# 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. +# OpenOffice.org - a multi-platform office productivity suite # -# The Initial Developer of the Original Code is -# Bjoern Michaelsen, Canonical Ltd. <bjoern.michaelsen@canonical.com> -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. +# This file is part of OpenOffice.org. # -# Major Contributor(s): +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. # -# For minor contributions see the git repository. +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). # -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_JunitTest_JunitTest,linguistic_unoapi,SRCDIR)) -$(eval $(call gb_JunitTest_JunitTest,configmgr_unoapi)) +$(eval $(call gb_JunitTest_set_defs,linguistic_unoapi,\ + $$(DEFS) \ + -Dorg.openoffice.test.arg.sce=$(SRCDIR)/linguistic/qa/unoapi/lng.sce \ + -Dorg.openoffice.test.arg.xcl=$(SRCDIR)/linguistic/qa/unoapi/knownissues.xcl \ + -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/linguistic/qa/unoapi \ +)) -$(eval $(call gb_JunitTest_set_defs,configmgr_unoapi,\ - $$(DEFS) \ - -Dorg.openoffice.test.arg.sce=$(SRCDIR)/configmgr/qa/unoapi/module.sce \ - -Dorg.openoffice.test.arg.xcl=$(SRCDIR)/configmgr/qa/unoapi/knownissues.xcl \ - -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/configmgr/qa/unoapi/testdocuments \ +$(eval $(call gb_JunitTest_add_jars,linguistic_unoapi,\ + $(OUTDIR)/bin/OOoRunner.jar \ + $(OUTDIR)/bin/ridl.jar \ + $(OUTDIR)/bin/test.jar \ + $(OUTDIR)/bin/unoil.jar \ + $(OUTDIR)/bin/jurt.jar \ )) -$(eval $(call gb_JunitTest_add_jars,configmgr_unoapi,\ - $(OUTDIR)/bin/OOoRunner.jar \ - $(OUTDIR)/bin/ridl.jar \ - $(OUTDIR)/bin/test.jar \ - $(OUTDIR)/bin/unoil.jar \ - $(OUTDIR)/bin/jurt.jar \ +$(eval $(call gb_JunitTest_add_sourcefiles,linguistic_unoapi,\ + linguistic/qa/unoapi/Test \ )) -$(eval $(call gb_JunitTest_add_classes,configmgr_unoapi,\ - org.openoffice.test.UnoApiTest \ +$(eval $(call gb_JunitTest_add_classes,linguistic_unoapi,\ + org.openoffice.linguistic.qa.unoapi.Test \ )) # vim: set noet sw=4 ts=4: diff --git a/linguistic/Library_lng.mk b/linguistic/Library_lng.mk new file mode 100644 index 000000000000..00fcc94143b0 --- /dev/null +++ b/linguistic/Library_lng.mk @@ -0,0 +1,86 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Library_Library,lng)) + +$(eval $(call gb_Library_add_package_headers,lng,linguistic_inc)) + +$(eval $(call gb_Library_add_precompiled_header,lng,$(SRCDIR)/linguistic/inc/pch/precompiled_linguistic)) + +$(eval $(call gb_Library_set_componentfile,lng,linguistic/source/lng)) + +$(eval $(call gb_Library_set_include,lng,\ + $$(INCLUDE) \ + -I$(SRCDIR)/linguistic/inc \ + -I$(SRCDIR)/linguistic/inc/pch \ + -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_defs,lng,\ + -DLNG_DLLIMPLEMENTATION \ +)) + +$(eval $(call gb_Library_add_linked_libs,lng,\ + comphelper \ + cppu \ + cppuhelper \ + i18nisolang1 \ + sal \ + svl \ + tl \ + ucbhelper \ + utl \ + xo \ + $(gb_STDLIBS) \ +)) + +$(call gb_Library_use_external,lng,icuuc) + +$(eval $(call gb_Library_add_exception_objects,lng,\ + linguistic/source/convdic \ + linguistic/source/convdiclist \ + linguistic/source/convdicxml \ + linguistic/source/dicimp \ + linguistic/source/dlistimp \ + linguistic/source/gciterator \ + linguistic/source/hhconvdic \ + linguistic/source/hyphdsp \ + linguistic/source/hyphdta \ + linguistic/source/iprcache \ + linguistic/source/lngopt \ + linguistic/source/lngprophelp \ + linguistic/source/lngreg \ + linguistic/source/lngsvcmgr \ + linguistic/source/misc \ + linguistic/source/misc2 \ + linguistic/source/spelldsp \ + linguistic/source/spelldta \ + linguistic/source/thesdsp \ + linguistic/source/thesdta \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/linguistic/Module_linguistic.mk b/linguistic/Module_linguistic.mk index 4ed03eed4331..1c1651657d4b 100644 --- a/linguistic/Module_linguistic.mk +++ b/linguistic/Module_linguistic.mk @@ -27,8 +27,19 @@ $(eval $(call gb_Module_Module,linguistic)) +$(eval $(call gb_Module_add_targets,linguistic,\ + Library_lng \ + Package_inc \ +)) + +#$(eval $(call gb_Module_add_check_targets,linguistic,\ +#)) + $(eval $(call gb_Module_add_subsequentcheck_targets,linguistic,\ JunitTest_linguistic_unoapi \ )) -# vim: set noet ts=4 sw=4: +# was disabled in old build system +# JunitTest_linguistic_complex \ + +# vim: set noet sw=4 ts=4: diff --git a/linguistic/Package_inc.mk b/linguistic/Package_inc.mk new file mode 100755 index 000000000000..4c86bddc7c96 --- /dev/null +++ b/linguistic/Package_inc.mk @@ -0,0 +1,40 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +$(eval $(call gb_Package_Package,linguistic_inc,$(SRCDIR)/linguistic/inc)) + +# add files to the package +# SOURCE_RELPATH/file.ext is the name of the source file (relative to the root give above) +# DESTINATION_RELPATH/file.ext is the destination file (relative to $(OUTDIR)) +$(eval $(call gb_Package_add_file,linguistic_inc,inc/linguistic/lngdllapi.h,linguistic/lngdllapi.h)) +$(eval $(call gb_Package_add_file,linguistic_inc,inc/linguistic/hyphdta.hxx,linguistic/hyphdta.hxx)) +$(eval $(call gb_Package_add_file,linguistic_inc,inc/linguistic/lngprophelp.hxx,linguistic/lngprophelp.hxx)) +$(eval $(call gb_Package_add_file,linguistic_inc,inc/linguistic/lngprops.hxx,linguistic/lngprops.hxx)) +$(eval $(call gb_Package_add_file,linguistic_inc,inc/linguistic/misc.hxx,linguistic/misc.hxx)) +$(eval $(call gb_Package_add_file,linguistic_inc,inc/linguistic/spelldta.hxx,linguistic/spelldta.hxx)) + +# vim: set noet sw=4 ts=4: diff --git a/linguistic/inc/linguistic/hyphdta.hxx b/linguistic/inc/linguistic/hyphdta.hxx index e8c4c41b4d2e..ffdc36a01509 100644 --- a/linguistic/inc/linguistic/hyphdta.hxx +++ b/linguistic/inc/linguistic/hyphdta.hxx @@ -29,15 +29,12 @@ #ifndef _LINGUISTIC_HYPHDTA_HXX_ #define _LINGUISTIC_HYPHDTA_HXX_ - #include <com/sun/star/linguistic2/XHyphenatedWord.hpp> #include <com/sun/star/linguistic2/XPossibleHyphens.hpp> - #include <tools/solar.h> - #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type #include <cppuhelper/implbase1.hxx> // helper for implementations - +#include <linguistic/lngdllapi.h> namespace linguistic { @@ -90,6 +87,9 @@ public: void SetWord( ::rtl::OUString &rTxt ) { aWord = rTxt; } void SetHyphenatedWord( ::rtl::OUString &rTxt ) { aHyphenatedWord = rTxt; } void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; } + static com::sun::star::uno::Reference <com::sun::star::linguistic2::XHyphenatedWord> LNG_DLLPUBLIC CreateHyphenatedWord( + const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos, + const ::rtl::OUString &rHyphenatedWord, sal_Int16 nHyphenPos ); }; @@ -132,6 +132,11 @@ public: sal_Int16 GetLanguage() { return nLanguage; } void SetWord( ::rtl::OUString &rTxt ) { aWord = rTxt; } void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; } + + static com::sun::star::uno::Reference < com::sun::star::linguistic2::XPossibleHyphens > LNG_DLLPUBLIC CreatePossibleHyphens + (const ::rtl::OUString &rWord, sal_Int16 nLang, + const ::rtl::OUString &rHyphWord, + const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions); }; } // namespace linguistic diff --git a/linguistic/inc/linguistic/lngdllapi.h b/linguistic/inc/linguistic/lngdllapi.h new file mode 100644 index 000000000000..265a11d8b51a --- /dev/null +++ b/linguistic/inc/linguistic/lngdllapi.h @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_LNG_DLLAPI_H +#define INCLUDED_LNG_DLLAPI_H + +#include "sal/config.h" +#include "sal/types.h" + +#if defined LNG_DLLIMPLEMENTATION +#define LNG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define LNG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#define LNG_DLLPRIVATE SAL_DLLPRIVATE + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/inc/linguistic/lngprophelp.hxx b/linguistic/inc/linguistic/lngprophelp.hxx index c32c70437de2..18528eb465b0 100644 --- a/linguistic/inc/linguistic/lngprophelp.hxx +++ b/linguistic/inc/linguistic/lngprophelp.hxx @@ -30,14 +30,13 @@ #define _LINGUISTIC_LNGPROPHELP_HXX_ #include <tools/solar.h> - #include <uno/lbnames.h> #include <cppuhelper/implbase2.hxx> #include <cppuhelper/interfacecontainer.h> #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/beans/PropertyValues.hpp> - #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> +#include <linguistic/lngdllapi.h> namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; @@ -180,6 +179,28 @@ public: throw(::com::sun::star::uno::RuntimeException); }; +class LNG_DLLPUBLIC PropertyHelper_Thesaurus +{ + PropertyHelper_Thes* pInst; + com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > xPropHelper; + + // disallow use of copy-constructor and assignment-operator + PropertyHelper_Thesaurus( const PropertyHelper_Thes & ); + PropertyHelper_Thesaurus & operator = ( const PropertyHelper_Thes & ); + +public: + PropertyHelper_Thesaurus( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > &rxSource, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > &rxPropSet ); + ~PropertyHelper_Thesaurus(); + void AddAsPropListener(); + void RemoveAsPropListener(); + void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals ); +}; + + class PropertyHelper_Spell : public PropertyChgHelper { @@ -230,6 +251,41 @@ public: }; +class LNG_DLLPUBLIC PropertyHelper_Spelling +{ + PropertyHelper_Spell* pInst; + com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > xPropHelper; + + // disallow use of copy-constructor and assignment-operator + PropertyHelper_Spelling( const PropertyHelper_Spell & ); + PropertyHelper_Spelling & operator = ( const PropertyHelper_Spell & ); + +public: + PropertyHelper_Spelling( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > &rxSource, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > &rxPropSet ); + ~PropertyHelper_Spelling(); + + void AddAsPropListener(); + void RemoveAsPropListener(); + void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals ); + sal_Int16 GetMaxNumberOfSuggestions() const; + sal_Bool IsSpellUpperCase() const; + sal_Bool IsSpellWithDigits() const; + sal_Bool IsSpellCapitalization() const; + sal_Bool addLinguServiceEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener ) + throw(::com::sun::star::uno::RuntimeException); + sal_Bool removeLinguServiceEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener ) + throw(::com::sun::star::uno::RuntimeException); +}; + + class PropertyHelper_Hyphen : public PropertyChgHelper { @@ -274,6 +330,39 @@ public: sal_Int16 GetMinWordLength() const { return nResHyphMinWordLength; } }; +class LNG_DLLPUBLIC PropertyHelper_Hyphenation +{ + PropertyHelper_Hyphen* pInst; + com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > xPropHelper; + + // disallow use of copy-constructor and assignment-operator + PropertyHelper_Hyphenation( const PropertyHelper_Hyphen & ); + PropertyHelper_Hyphenation & operator = ( const PropertyHelper_Hyphen & ); + +public: + PropertyHelper_Hyphenation( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > &rxSource, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > &rxPropSet); + ~PropertyHelper_Hyphenation(); + + void AddAsPropListener(); + void RemoveAsPropListener(); + void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals ); + sal_Int16 GetMinLeading() const; + sal_Int16 GetMinTrailing() const; + sal_Int16 GetMinWordLength() const; + sal_Bool addLinguServiceEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener ) + throw(::com::sun::star::uno::RuntimeException); + sal_Bool removeLinguServiceEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener ) + throw(::com::sun::star::uno::RuntimeException); +}; + } // namespace linguistic #endif diff --git a/linguistic/inc/linguistic/misc.hxx b/linguistic/inc/linguistic/misc.hxx index bff3d3b6ef36..7699735c971e 100644 --- a/linguistic/inc/linguistic/misc.hxx +++ b/linguistic/inc/linguistic/misc.hxx @@ -29,7 +29,6 @@ #ifndef _LINGUISTIC_MISC_HXX_ #define _LINGUISTIC_MISC_HXX_ - #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/beans/PropertyValues.hpp> @@ -48,6 +47,7 @@ #include <unotools/charclass.hxx> #include <osl/thread.h> #include <osl/mutex.hxx> +#include <linguistic/lngdllapi.h> namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; @@ -95,7 +95,7 @@ namespace linguistic #define DIC_ERR_NOT_EXISTS 4 -::osl::Mutex & GetLinguMutex(); +LNG_DLLPUBLIC ::osl::Mutex& GetLinguMutex(); LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang ); @@ -108,7 +108,7 @@ sal_Int32 LevDistance( const rtl::OUString &rTxt1, const rtl::OUString &rTxt2 ); ::com::sun::star::lang::Locale CreateLocale( LanguageType eLang ); -LanguageType +LNG_DLLPUBLIC LanguageType LocaleToLanguage( const ::com::sun::star::lang::Locale& rLocale ); ::com::sun::star::lang::Locale& @@ -135,14 +135,14 @@ sal_Bool FileExists( const String &rURL ); /// @returns an URL for a new and writable dictionary rDicName. /// The URL will point to the path given by 'GetDictionaryWriteablePath' -String GetWritableDictionaryURL( const String &rDicName ); +LNG_DLLPUBLIC String GetWritableDictionaryURL( const String &rDicName ); // looks for the specified file in the list of paths. // In case of multiple occurrences only the first found is returned. String SearchFileInPaths( const String &rFile, const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rPaths ); -sal_Int32 GetPosInWordToCheck( const rtl::OUString &rTxt, sal_Int32 nPos ); +LNG_DLLPUBLIC sal_Int32 GetPosInWordToCheck( const rtl::OUString &rTxt, sal_Int32 nPos ); ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > @@ -151,8 +151,8 @@ sal_Int32 GetPosInWordToCheck( const rtl::OUString &rTxt, sal_Int32 nPos ) ::com::sun::star::linguistic2::XHyphenatedWord > &rxHyphWord ); -sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage ); -sal_Bool IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage ); +LNG_DLLPUBLIC sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage ); +LNG_DLLPUBLIC sal_Bool IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage ); inline sal_Bool IsUpper( const String &rText, sal_Int16 nLanguage ) { return IsUpper( rText, 0, rText.Len(), nLanguage ); } inline sal_Bool IsLower( const String &rText, sal_Int16 nLanguage ) { return IsLower( rText, 0, rText.Len(), nLanguage ); } @@ -162,12 +162,12 @@ String ToUpper( const String &rText, sal_Int16 nLanguage ); String ToTitle( const String &rText, sal_Int16 nLanguage ); sal_Unicode ToLower( const sal_Unicode cChar, sal_Int16 nLanguage ); sal_Unicode ToUpper( const sal_Unicode cChar, sal_Int16 nLanguage ); -sal_Bool HasDigits( const ::rtl::OUString &rText ); -sal_Bool IsNumeric( const String &rText ); +LNG_DLLPUBLIC sal_Bool HasDigits( const ::rtl::OUString &rText ); +LNG_DLLPUBLIC sal_Bool IsNumeric( const String &rText ); ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetOneInstanceService( const char *pServiceName ); -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetLinguProperties(); +LNG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetLinguProperties(); ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > GetSearchableDictionaryList(); ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > GetDictionaryList(); ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList(); @@ -188,13 +188,13 @@ sal_Bool IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rP const ::rtl::OUString& rWord, sal_Int16 nLanguage, sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry ); -sal_uInt8 AddEntryToDic( +LNG_DLLPUBLIC sal_uInt8 AddEntryToDic( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > &rxDic, const ::rtl::OUString &rWord, sal_Bool bIsNeg, const ::rtl::OUString &rRplcTxt, sal_Int16 nRplcLang, sal_Bool bStripDot = sal_True ); -sal_Bool SaveDictionaries( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > &xDicList ); +LNG_DLLPUBLIC sal_Bool SaveDictionaries( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > &xDicList ); // AppExitLstnr: // virtual base class that calls it AtExit function when the application diff --git a/linguistic/inc/linguistic/spelldta.hxx b/linguistic/inc/linguistic/spelldta.hxx index 0e501ee0002e..81ff61791b30 100644 --- a/linguistic/inc/linguistic/spelldta.hxx +++ b/linguistic/inc/linguistic/spelldta.hxx @@ -37,6 +37,7 @@ #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type #include <cppuhelper/implbase2.hxx> +#include <linguistic/lngdllapi.h> namespace com { namespace sun { namespace star { namespace linguistic2 { @@ -122,8 +123,9 @@ public: // non-interface specific functions void SetWordLanguage(const ::rtl::OUString &rWord, sal_Int16 nLang); void SetFailureType(sal_Int16 nTypeP); - void SetAlternatives( - const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt ); + void SetAlternatives( const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt ); + static com::sun::star::uno::Reference < com::sun::star::linguistic2::XSpellAlternatives > LNG_DLLPUBLIC CreateSpellAlternatives( + const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nTypeP, const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt ); }; diff --git a/linguistic/prj/build.lst b/linguistic/prj/build.lst index 7ee07a2f6f27..3ef507e2e115 100644 --- a/linguistic/prj/build.lst +++ b/linguistic/prj/build.lst @@ -1,8 +1,2 @@ lg linguistic : svl xmloff ucbhelper comphelper ICU:icu LIBXSLT:libxslt NULL -lg linguistic usr1 - all lg_mkout NULL -lg linguistic\prj get - all lg_prj NULL -lg linguistic\inc nmake - all lg_inc NULL -lg linguistic\source nmake - all lg_src lg_inc NULL - -# could be we need a Japanese office version -# lg linguistic\qa\complex\linguistic nmake - all lg_qa_complex NULL +lg linguistic\prj nmake - all lg_prj NULL diff --git a/linguistic/prj/d.lst b/linguistic/prj/d.lst index f983a5e2a1bf..e69de29bb2d1 100644 --- a/linguistic/prj/d.lst +++ b/linguistic/prj/d.lst @@ -1,13 +0,0 @@ -..\%__SRC%\bin\lng* %_DEST%\bin\lng* -..\%__SRC%\lib\ilng* %_DEST%\lib\ilng* -..\%__SRC%\lib\liblng*.a %_DEST%\lib\liblng*.a -..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib -..\%__SRC%\lib\liblng*.so %_DEST%\lib\liblng*.so - -..\xml\*.xml %_DEST%\xml\*.xml - -mkdir: %_DEST%\inc\linguistic -..\inc\linguistic\*.hxx %_DEST%\inc\linguistic\*.hxx - -..\%__SRC%\misc\lng.component %_DEST%\xml\lng.component - diff --git a/linguistic/inc/makefile.mk b/linguistic/prj/makefile.mk index fa5aad7b0a40..88cd9dfe08b8 100755 --- a/linguistic/inc/makefile.mk +++ b/linguistic/prj/makefile.mk @@ -24,24 +24,17 @@ # for a copy of the LGPLv3 License. # #************************************************************************* -PRJ=.. - -PRJNAME=linguistic -TARGET=inc - -# --- Settings ----------------------------------------------------- -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- -# --- Targets ------------------------------------------------------- +PRJ=.. +TARGET=prj -.INCLUDE : target.mk +.INCLUDE : settings.mk -.IF "$(ENABLE_PCH)"!="" -ALLTAR : \ - $(SLO)$/precompiled.pch \ - $(SLO)$/precompiled_ex.pch - -.ENDIF # "$(ENABLE_PCH)"!="" +.IF "$(VERBOSE)"!="" +VERBOSEFLAG := +.ELSE +VERBOSEFLAG := -s +.ENDIF +all: + cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog diff --git a/linguistic/source/grammarchecker.cxx b/linguistic/source/grammarchecker.cxx deleted file mode 100644 index a5c1fa11b564..000000000000 --- a/linguistic/source/grammarchecker.cxx +++ /dev/null @@ -1,305 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_linguistic.hxx" - -#include <sal/config.h> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/linguistic2/XGrammarChecker.hpp> -#include <com/sun/star/i18n/XBreakIterator.hpp> -#include <cppuhelper/implbase4.hxx> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include "linguistic/misc.hxx" -#include "defs.hxx" -#include <cppuhelper/factory.hxx> -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -#include <cppuhelper/interfacecontainer.h> -#include <com/sun/star/container/XContentEnumerationAccess.hpp> -#include <com/sun/star/container/XEnumeration.hpp> -#include <com/sun/star/linguistic2/XSupportedLocales.hpp> -#include <com/sun/star/linguistic2/SingleGrammarError.hpp> -#include <com/sun/star/linguistic2/GrammarCheckingResult.hpp> -#include "lngopt.hxx" -#include <comphelper/extract.hxx> -#include <unotools/processfactory.hxx> -#include <map> -#include <com/sun/star/text/TextMarkupType.hpp> - -#include "grammarchecker.hxx" - -using namespace ::utl; -using namespace ::rtl; -using namespace ::com::sun::star; - - -GrammarChecker::GrammarChecker( /*uno::Reference< uno::XComponentContext > const & context*/ ) - /*m_xContext(context)*/ -{} - -GrammarChecker::~GrammarChecker() -{ -} - - -sal_Bool SAL_CALL GrammarChecker::isSpellChecker() throw (uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - return sal_False; -} - - -sal_Bool SAL_CALL GrammarChecker::hasLocale( const lang::Locale & aLocale ) throw (uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - (void) aLocale; - return sal_False; -} - -uno::Sequence< lang::Locale > SAL_CALL GrammarChecker::getLocales( ) throw (uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - return uno::Sequence< lang::Locale >(); -} - - -void SAL_CALL GrammarChecker::startDocument(sal_Int32 nDocId) - throw (uno::RuntimeException, lang::IllegalArgumentException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - (void) nDocId; -} - -void SAL_CALL GrammarChecker::startParagraph(sal_Int32 nDocId) - throw (uno::RuntimeException, lang::IllegalArgumentException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - (void) nDocId; -} - -void SAL_CALL GrammarChecker::endParagraph( sal_Int32 nDocId ) - throw (uno::RuntimeException, lang::IllegalArgumentException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - (void) nDocId; -} - -void SAL_CALL GrammarChecker::endDocument(sal_Int32 nDocId) - throw (uno::RuntimeException, lang::IllegalArgumentException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - (void) nDocId; -} - -linguistic2::GrammarCheckingResult SAL_CALL GrammarChecker::doGrammarChecking( - sal_Int32 nDocId, - const rtl::OUString& rText, - const lang::Locale& rLocale, - sal_Int32 nStartOfSentencePos, - sal_Int32 nSuggestedSentenceEndPos, - const uno::Sequence< ::sal_Int32 >& rLanguagePortions, - const uno::Sequence< lang::Locale >& rLanguagePortionsLocales ) - throw (lang::IllegalArgumentException, uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - - (void) rLanguagePortions; - (void) rLanguagePortionsLocales; - - linguistic2::GrammarCheckingResult aRes; - aRes.nDocumentId = nDocId; - aRes.aText = rText; - aRes.aLocale = rLocale; - aRes.nEndOfSentencePos = nSuggestedSentenceEndPos; - aRes.xGrammarChecker = this; - aRes.aGrammarErrors = GrammarCheckingInDummy( nDocId, rText, rLocale, nStartOfSentencePos, nSuggestedSentenceEndPos );; - - return aRes; -} - -uno::Sequence< linguistic2::SingleGrammarError > GrammarChecker::GrammarCheckingInDummy( - sal_Int32 nDocId, - const OUString & rFlatParaText, - const lang::Locale & rLocale, - sal_Int32 nStartOfSentencePos, - sal_Int32 nSuggestedSentenceEndPos ) -{ - (void) nDocId; - (void) rFlatParaText; - (void) rLocale; - (void) nStartOfSentencePos; - (void) nSuggestedSentenceEndPos; - - - typedef std::map< OUString, uno::Sequence<OUString> > Error_t; - Error_t aError; - uno::Sequence< OUString > aSuggestion(1); - OUString *pSeggestion = aSuggestion.getArray(); - pSeggestion[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("Modified")); - - aError[OUString(RTL_CONSTASCII_USTRINGPARAM("GrammarError"))] = aSuggestion; - aError[OUString(RTL_CONSTASCII_USTRINGPARAM("Grammar Error"))] = aSuggestion; - - typedef std::vector< linguistic2::SingleGrammarError> ErrorVector_t; - ErrorVector_t aErrorVector; - - OUString aText = rFlatParaText.copy( nStartOfSentencePos, nSuggestedSentenceEndPos - nStartOfSentencePos ); - sal_Int32 nIndexOf = 0; - for(Error_t::const_iterator it = aError.begin(); it != aError.end(); ++it) - { - - while(nIndexOf >= 0) - { - nIndexOf=aText.indexOf(it->first, nIndexOf); - if(nIndexOf > -1) - { - //error found - linguistic2::SingleGrammarError aErr; - aErr.nErrorStart = nIndexOf + nStartOfSentencePos; - nIndexOf += it->first.getLength(); - aErr.nErrorLength = it->first.getLength(); - aErr.nErrorType = text::TextMarkupType::GRAMMAR; - aErr.nErrorLevel = 0; - aErr.aShortComment = OUString(); - aErr.aFullComment = OUString(); - aErr.aNewLocale = rLocale; - aErr.aSuggestions = it->second; - - aErrorVector.push_back( aErr ); - } - } - nIndexOf = 0; - } - - sal_Int32 nCount = aErrorVector.size(); - uno::Sequence< linguistic2::SingleGrammarError > aErrors( nCount ); - if( nCount > 0 ) - { - linguistic2::SingleGrammarError* pErrors = aErrors.getArray(); - for (sal_Int32 i=0; i < nCount; ++i) - { - pErrors[i] = aErrorVector[i]; - } - } - return aErrors; -} - - -sal_Bool SAL_CALL GrammarChecker::hasOptionsDialog( ) throw (uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - return sal_False; -} - -void SAL_CALL GrammarChecker::runOptionsDialog() - throw (uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); -} - -void SAL_CALL GrammarChecker::dispose( ) throw (uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); -} - -void SAL_CALL GrammarChecker::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw (uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - (void) xListener; -} - -void SAL_CALL GrammarChecker::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw (uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - (void) xListener; -} - -sal_Bool SAL_CALL GrammarChecker::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - - uno::Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); ++i ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; -} - -uno::Sequence< OUString > GrammarChecker::getSupportedServiceNames_Static( ) throw() -{ - - uno::Sequence< OUString > aSNS( 1 ); // more than 1 service possible - aSNS.getArray()[0] = A2OU( "com.sun.star.linguistic2.GrammarChecker" );//SN_LINGU_SERVCICE_MANAGER - return aSNS; -} - -uno::Sequence< OUString > SAL_CALL GrammarChecker::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - return getSupportedServiceNames_Static(); -} - -OUString SAL_CALL GrammarChecker::getImplementationName( ) throw(uno::RuntimeException) -{ - osl::Guard< osl::Mutex > aGuard(GetMutex()); - return getImplementationName_Static(); -} - -uno::Reference< uno::XInterface > SAL_CALL GrammarChecker_CreateInstance( - const uno::Reference< lang::XMultiServiceFactory > & /*rSMgr*/ ) - throw(uno::Exception) -{ - uno::Reference< uno::XInterface > xService = (cppu::OWeakObject*) new GrammarChecker; - return xService; -} - -void * SAL_CALL GrammarChecker_getFactory( const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager, void * /*pRegistryKey*/ ) -{ - - void * pRet = 0; - if ( !GrammarChecker::getImplementationName_Static().compareToAscii( pImplName ) ) - { - uno::Reference< lang::XSingleServiceFactory > xFactory = - cppu::createOneInstanceFactory( - pServiceManager, - GrammarChecker::getImplementationName_Static(), - GrammarChecker_CreateInstance, - GrammarChecker::getSupportedServiceNames_Static()); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/grammarchecker.hxx b/linguistic/source/grammarchecker.hxx deleted file mode 100644 index d7443530ab0d..000000000000 --- a/linguistic/source/grammarchecker.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _LINGUISTIC_GRAMMARCHECKER_HXX_ -#define _LINGUISTIC_GRAMMARCHECKER_HXX_ - - -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/linguistic2/XGrammarChecker.hpp> -#include <com/sun/star/linguistic2/SingleGrammarError.hpp> -#include <com/sun/star/linguistic2/XSupportedLocales.hpp> - -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/interfacecontainer.h> - -#include <map> - - -class GrammarChecker: - public cppu::WeakImplHelper3 - < - ::com::sun::star::linguistic2::XGrammarChecker, - ::com::sun::star::lang::XComponent, - ::com::sun::star::lang::XServiceInfo - > -{ - - // disallow use of copy c-tor and assignment operator - GrammarChecker( const GrammarChecker & ); - GrammarChecker & operator = ( const GrammarChecker & ); - -public: - explicit GrammarChecker( /* uno::Reference< uno::XComponentContext > const & rXContext */ ); - virtual ~GrammarChecker(); - - // XSupportedLocales - virtual ::sal_Bool SAL_CALL hasLocale( const ::com::sun::star::lang::Locale & aLocale) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( ) throw ( ::com::sun::star::uno::RuntimeException ); - - // XGrammarChecker - virtual ::sal_Bool SAL_CALL isSpellChecker( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL startDocument( ::sal_Int32 nDocId ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL startParagraph( ::sal_Int32 nDocId ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endParagraph( ::sal_Int32 nDocId ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endDocument( ::sal_Int32 nDocId ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::linguistic2::GrammarCheckingResult SAL_CALL doGrammarChecking( ::sal_Int32 nDocId, const ::rtl::OUString& aText, const ::com::sun::star::lang::Locale& aLocale, ::sal_Int32 nStartOfSentencePos, ::sal_Int32 nSuggestedEndOfSentencePos, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& aLanguagePortions, const ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale >& aLanguagePortionsLocales ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL hasOptionsDialog( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL runOptionsDialog( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - static inline ::rtl::OUString getImplementationName_Static(); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); - - ::com::sun::star::uno::Sequence< ::com::sun::star::linguistic2::SingleGrammarError > GrammarCheckingInDummy( - ::sal_Int32 nDocId, const ::rtl::OUString &rFlatParaText, const ::com::sun::star::lang::Locale & rLocale, - ::sal_Int32 nStartOfSentencePos, ::sal_Int32 nSuggestedSentenceEndPos ); - - - inline ::osl::Mutex & GetMutex() - { - static osl::Mutex aMutex; - return aMutex; - } -}; - -inline ::rtl::OUString GrammarChecker::getImplementationName_Static() -{ - return A2OU( "com.sun.star.lingu2.GrammarChecker" ); -} - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/hyphdta.cxx b/linguistic/source/hyphdta.cxx index d03636db7dad..12244e21fc57 100644 --- a/linguistic/source/hyphdta.cxx +++ b/linguistic/source/hyphdta.cxx @@ -181,6 +181,22 @@ Sequence< sal_Int16 > SAL_CALL PossibleHyphens::getHyphenationPositions() return aOrigHyphenPos; } +com::sun::star::uno::Reference <com::sun::star::linguistic2::XHyphenatedWord> HyphenatedWord::CreateHyphenatedWord( + const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos, + const ::rtl::OUString &rHyphenatedWord, sal_Int16 nHyphenPos ) +{ + return new HyphenatedWord( rWord, nLang, nHyphenationPos, rHyphenatedWord, nHyphenPos ); +} + +com::sun::star::uno::Reference < com::sun::star::linguistic2::XPossibleHyphens > PossibleHyphens::CreatePossibleHyphens + (const ::rtl::OUString &rWord, sal_Int16 nLang, + const ::rtl::OUString &rHyphWord, + const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions) +{ + return new PossibleHyphens( rWord, nLang, rHyphWord, rPositions ); +} + + } // namespace linguistic diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx index 8a5c17c27827..ef5a910e0867 100644 --- a/linguistic/source/lngprophelp.cxx +++ b/linguistic/source/lngprophelp.cxx @@ -707,6 +707,161 @@ void PropertyHelper_Hyphen::SetTmpPropVals( const PropertyValues &rPropVals ) } } +PropertyHelper_Thesaurus::PropertyHelper_Thesaurus( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > &rxSource, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > &rxPropSet ) +{ + pInst = new PropertyHelper_Thes( rxSource, rxPropSet ); + xPropHelper = pInst; +} + +PropertyHelper_Thesaurus::~PropertyHelper_Thesaurus() +{ +} + +void PropertyHelper_Thesaurus::AddAsPropListener() +{ + pInst->AddAsPropListener(); +} + +void PropertyHelper_Thesaurus::RemoveAsPropListener() +{ + pInst->RemoveAsPropListener(); +} + +void PropertyHelper_Thesaurus::SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals ) +{ + pInst->SetTmpPropVals( rPropVals ); +} + +PropertyHelper_Hyphenation::PropertyHelper_Hyphenation( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > &rxSource, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > &rxPropSet) +{ + pInst = new PropertyHelper_Hyphen( rxSource, rxPropSet ); + xPropHelper = pInst; +} + +PropertyHelper_Hyphenation::~PropertyHelper_Hyphenation() +{ +} + +void PropertyHelper_Hyphenation::AddAsPropListener() +{ + pInst->AddAsPropListener(); +} + +void PropertyHelper_Hyphenation::RemoveAsPropListener() +{ + pInst->RemoveAsPropListener(); +} + +void PropertyHelper_Hyphenation::SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals ) +{ + pInst->SetTmpPropVals( rPropVals ); +} + +sal_Int16 PropertyHelper_Hyphenation::GetMinLeading() const +{ + return pInst->GetMinLeading(); +} + +sal_Int16 PropertyHelper_Hyphenation::GetMinTrailing() const +{ + return pInst->GetMinTrailing(); +} + +sal_Int16 PropertyHelper_Hyphenation::GetMinWordLength() const +{ + return pInst->GetMinWordLength(); +} + +sal_Bool PropertyHelper_Hyphenation::addLinguServiceEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener ) + throw(::com::sun::star::uno::RuntimeException) +{ + return pInst->addLinguServiceEventListener( rxListener ); +} + +sal_Bool PropertyHelper_Hyphenation::removeLinguServiceEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener ) + throw(::com::sun::star::uno::RuntimeException) +{ + return pInst->removeLinguServiceEventListener( rxListener ); +} + +PropertyHelper_Spelling::PropertyHelper_Spelling( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > &rxSource, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > &rxPropSet ) +{ + pInst = new PropertyHelper_Spell( rxSource, rxPropSet ); + xPropHelper = pInst; +} + +PropertyHelper_Spelling::~PropertyHelper_Spelling() +{ +} + +void PropertyHelper_Spelling::AddAsPropListener() +{ + pInst->AddAsPropListener(); +} + +void PropertyHelper_Spelling::RemoveAsPropListener() +{ + pInst->RemoveAsPropListener(); +} + +void PropertyHelper_Spelling::SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals ) +{ + pInst->SetTmpPropVals( rPropVals ); +} + +sal_Int16 PropertyHelper_Spelling::GetMaxNumberOfSuggestions() const +{ + return pInst->GetMaxNumberOfSuggestions(); +} + +sal_Bool PropertyHelper_Spelling::IsSpellUpperCase() const +{ + return pInst->IsSpellUpperCase(); +} + +sal_Bool PropertyHelper_Spelling::IsSpellWithDigits() const +{ + return pInst->IsSpellWithDigits(); +} + +sal_Bool PropertyHelper_Spelling::IsSpellCapitalization() const +{ + return pInst->IsSpellCapitalization(); +} + +sal_Bool PropertyHelper_Spelling::addLinguServiceEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener ) + throw(::com::sun::star::uno::RuntimeException) +{ + return pInst->addLinguServiceEventListener( rxListener ); +} + +sal_Bool PropertyHelper_Spelling::removeLinguServiceEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener ) + throw(::com::sun::star::uno::RuntimeException) +{ + return pInst->removeLinguServiceEventListener( rxListener ); +} + + } // namespace linguistic diff --git a/linguistic/source/makefile.mk b/linguistic/source/makefile.mk deleted file mode 100755 index 5d6909e57f96..000000000000 --- a/linguistic/source/makefile.mk +++ /dev/null @@ -1,117 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=linguistic -TARGET=lng -ENABLE_EXCEPTIONS=sal_True - -#----- Settings --------------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/convdiclist.obj\ - $(SLO)$/convdic.obj\ - $(SLO)$/convdicxml.obj\ - $(SLO)$/dicimp.obj\ - $(SLO)$/dlistimp.obj\ - $(SLO)$/hhconvdic.obj\ - $(SLO)$/hyphdsp.obj\ - $(SLO)$/hyphdta.obj\ - $(SLO)$/iprcache.obj\ - $(SLO)$/lngopt.obj\ - $(SLO)$/lngprophelp.obj\ - $(SLO)$/lngreg.obj\ - $(SLO)$/lngsvcmgr.obj\ - $(SLO)$/misc.obj\ - $(SLO)$/misc2.obj\ - $(SLO)$/spelldsp.obj\ - $(SLO)$/spelldta.obj\ - $(SLO)$/thesdsp.obj\ - $(SLO)$/thesdta.obj\ - $(SLO)$/gciterator.obj - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) - -SHL1STDLIBS= \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(COMPHELPERLIB) \ - $(TOOLSLIB) \ - $(I18NISOLANGLIB) \ - $(SVLLIB) \ - $(SALLIB) \ - $(XMLOFFLIB) \ - $(UCBHELPERLIB) \ - $(UNOTOOLSLIB) \ - $(ICUUCLIB) - -# build DLL -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1DEPN= $(SLB)$/$(TARGET).lib -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -.IF "$(COM)" == "MSC" -SHL1IMPLIB= ilng -.ELSE -SHL1IMPLIB= lng$(DLLPOSTFIX) -.ENDIF - -# build DEF file -DEF1NAME =$(SHL1TARGET) -DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt -DEFLIB1NAME =$(TARGET) -DEF1DES =Linguistic main DLL - - -.IF "$(GUI)"=="WNT" -DEF1EXPORT1 = component_getFactory -.ENDIF - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - -$(MISC)$/$(SHL1TARGET).flt: makefile.mk - @echo ------------------------------ - @echo Making: $@ - @echo lcl > $@ - @echo component >> $@ - @echo __CT >> $@ - - -ALLTAR : $(MISC)/lng.component - -$(MISC)/lng.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - lng.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt lng.component diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx index 3bc4ce100451..ced7de88ed0f 100644 --- a/linguistic/source/spelldta.cxx +++ b/linguistic/source/spelldta.cxx @@ -359,6 +359,16 @@ void SpellAlternatives::SetAlternatives( const Sequence< OUString > &rAlt ) } +com::sun::star::uno::Reference < com::sun::star::linguistic2::XSpellAlternatives > SpellAlternatives::CreateSpellAlternatives( + const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nTypeP, const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt ) +{ + SpellAlternatives* pAlt = new SpellAlternatives; + pAlt->SetWordLanguage( rWord, nLang ); + pAlt->SetFailureType( nTypeP ); + pAlt->SetAlternatives( rAlt ); + return Reference < XSpellAlternatives >(pAlt); +} + } // namespace linguistic |