libreoffice-voikko-5.0/0000755000000000000000000000000012627600371013631 5ustar rootrootlibreoffice-voikko-5.0/ChangeLog0000644000000000000000000002154312627600371015410 0ustar rootroot2015-09-24 Harri Pitkänen * Re-write the extension code in Python instead of C++. 2015-04-14 Harri Pitkänen * Initial support for non-hardcoded locales. 2014-08-22 Harri Pitkänen * Unconditionally enable grammar checker since it is now used only with dictionaries and backends that support it. 2014-08-19 Harri Pitkänen * Switch to passive component registration. 2013-10-16 Harri Pitkänen * Re-license under MPL 2.0 and GPLv3+. 2013-10-10 Harri Pitkänen * Support grammar checkers and hyphenators for languages other than Finnish. 2013-10-06 Harri Pitkänen * Configuration option "Check capitalization" was removed in LibreOffice 4.0, no need to support it anymore. 2013-09-17 Harri Pitkänen * Support more languages for LibreOffice. 2013-07-29 Harri Pitkänen * Increase version number to 4.0. * LibreOffice 4.1 or later is now needed for building and running the extension. 2013-06-26 Harri Pitkänen * Avoid querying available spelling languages too often since it's very slow for zhfst spellers. 2013-06-19 Harri Pitkänen * Support more languages for LibreOffice. 2003-05-30 Sjur Moshagen * Support more languages for LibreOffice. 2013-01-06 Harri Pitkänen * Support more languages for LibreOffice. 2012-10-27 Harri Pitkänen * Support more languages for LibreOffice. 2012-02-01 Harri Pitkänen * Add Komi language mappings. 2012-01-20 Harri Pitkänen * Fix build with MSVC 2005. * Update license texts for standalone extension. 2012-01-19 Harri Pitkänen * Add links to extended grammar checker help. 2012-01-02 Harri Pitkänen * Avoid double delete of component objects. 2011-02-17 Tarja Lindfors * New icon. 2011-02-16 Harri Pitkänen * Specify English as the fallback language for settings dialog. 2011-02-05 Harri Pitkänen * Rename source package to libreoffice-voikko. * Add new codes to language mapping table. * Remove -Werror from compiler flags, STLPort (used on 32 bit Linux) headers contain code that triggers warnings with recent GCC. 2011-02-01 Harri Pitkänen * Remove %origin% expansion trick from configuration, it has been unused since version 3.0. * Document that the extension now targets primarily LibreOffice. 2010-12-22 Harri Pitkänen * Add support for spell checking multiple languages. 2010-07-27 David Tardon * Fix broken config.xcu to work with stricter validation in OOo 3.3. 2010-05-31 Harri Pitkänen * Switch to new libvoikko 3.0 API (Trac #11). * Ignoring grammar checker rules works (Trac #12). 2010-05-07 Harri Pitkänen * Add license attribute that allows suppressing the license dialog with unopkg --suppress-license. 2010-04-23 Harri Pitkänen * Remove references to malaga and glib libraries for Windows and OS X. * Increase version number to 3.1.1. 2010-01-05 Harri Pitkänen * Fix error handling for cases where configuration is somehow damaged. Partially fixes SF.net bug #2919454. 2009-10-26 Harri Pitkänen * Reduce scope of a variable to fix cppcheck warning. 2009-10-04 Harri Pitkänen * Re-enable grammar checker on Windows, since it works when libvoikko has been built with MSVC. * Document the fact that MSVC should be used for building libvoikko on Windows. Change the build system so that libvoikko-1.def -> libvoikko-1.lib conversion is no longer done, because MSVC creates libvoikko-1.lib automatically. * Allow copying entire directories when creating standalone extensions. Update the names of files to be copied for libvoikko 2.2. 2009-07-27 Petr Mladek * Change order of linker flags on Linux to enable building with -Wl,--as-needed. 2009-05-15 Harri Pitkänen * Replace the icon with something less irritating and add svg version. 2009-04-11 Harri Pitkänen * Implement listing of available dictionaries in standalone extensions. 2009-04-05 Harri Pitkänen * Print debug info to stderr instead of stdout to avoid buffering. 2009-03-15 Harri Pitkänen * Enable VOIKKO_OPT_ACCEPT_BULLETED_LISTS_IN_GC to silence false positives in bulleted lists. 2009-03-15 Harri Pitkänen * Disable grammar checker on Windows, it does not work. 2009-03-11 Harri Pitkänen * Read dictionary variant from registry on startup. 2009-03-06 Harri Pitkänen * Fall back to default dictionary if specified variant is not available. * Show more ugly warnings when SHOW_UGLY_WARNINGS=1. 2009-02-15 Harri Pitkänen * Allow changing dictionary variant in settings. 2009-02-14 Harri Pitkänen * Turn PropertyManager into a proper singleton. 2009-01-31 Harri Pitkänen * Turn SpellChecker, Hyphenator and GrammarChecker into singletons. 2009-01-04 Harri Pitkänen * Add option for preventing hyphenation of unknown or foreign words. 2008-12-29 Harri Pitkänen * Adapt to grammar checking framework API changes in OOo 3.0.1. 2008-10-12 Harri Pitkänen * Use VOIKKO_OPT_ACCEPT_UNFINISHED_PARAGRAPHS_IN_GC from libvoikko 2.1. * Enable grammar checker by default. * Increase version number to 3.1. 2008-08-23 Harri Pitkänen * Detect UI language and use that to offer grammar error explanations in correct language. 2008-08-16 Harri Pitkänen * Add grammar checker implementation. 2008-08-10 Harri Pitkänen * Adapt to SDK changes on Windows. 2008-08-09 Harri Pitkänen * Adapt to SDK changes on OS X. 2008-07-25 Harri Pitkänen * Adapt to DEV300_m26. 2008-07-21 Harri Pitkänen * Add setting (checkbox) for compound word hyphenation and store the value to the registry. * Use new compound word hyphenation setting when hyphenating. * Add build option SHOW_UGLY_WARNINGS to be used in binary test builds. 2008-07-19 Harri Pitkänen * Add settings dialog. * Add build option for disabling the grammar checker. 2008-07-18 Harri Pitkänen * Add icon and publisher information for new extension manager. 2008-07-10 Harri Pitkänen * Build fixes, thanks to Caolan McNamara from RedHat. 2008-03-30 Harri Pitkänen * Add stub for grammar checker implementation. * Documentation fixes. 2008-03-24 Harri Pitkänen * Respect HyphMinLeading and HyphMinTrailing in Hyphenator::createPossibleHyphens. 2008-03-23 Harri Pitkänen * Update license to GPL v3 or later. * Update extension version and required OOo version for openoffice.org-voikko 3.0 and OOo 3.0. * Use PackageInformationProvider to get the extension installation path. * Use thread unsafe UNO purpose environment. 2008-01-23 Harri Pitkänen * Add Makefile targets 'extension-files', 'oxt' and 'install-unpacked'. 'extension-files' is the new default, 'all' refers to 'oxt'. 2008-01-22 Harri Pitkänen * Use locale encoding with file names. * Add displayname to description.xml for OOo 2.4. 2008-01-19 Harri Pitkänen * Standalone extension support for OS X 10.5. * Update README. 2008-01-18 Harri Pitkänen * Makefile support for OS X 10.5 (Intel). 2007-11-17 Harri Pitkänen * Add magic key "VoikkoGetStatusInformation" for obtaining diagnostics from production builds. * Increase version number to 2.2. 2007-08-19 Harri Pitkänen * Update README * Makefile cleanup 2007-06-19 Harri Pitkänen * Adapt for libvoikko 1.5 * Increase version number to 2.1 * Use private vocabulary files when building as standalone extension * Add support for displaying license text upon extension installation (not enabled by default) 2007-06-14 Harri Pitkänen * Add support for building on Windows with Microsoft Visual C++ 2005 Express Edition * Fix some warnings generated by MSVC 2007-05-12 Harri Pitkänen * Return immediately from Hyphenator::hyphenate and Hyphenator::createPossibleHyphens if initialization has not been done. 2007-05-07 Harri Pitkänen * Do not hyphenate at ' * Increase version number to 2.0.1 2007-04-19 Harri Pitkänen * Initial ChangeLog entry for version 2.0rc1 libreoffice-voikko-5.0/README0000644000000000000000000000712312627600371014514 0ustar rootrootWhat is this? ============= This is libreoffice-voikko, a multi language spellchecker, grammar checker and hyphenator extension for LibreOffice. It uses libvoikko for all linguistic operations. License ======= This package is distributed under the terms of Mozilla Public License Version 2.0 (see COPYING). Alternatively, the source code may be used under the terms of the GNU General Public License, version 3 or later. Authors ======= Source code: 2005 - 2015 Harri Pitkänen (hatapitk@iki.fi) Icon: 2011 Tarja Lindfors (tarja@puimula.org) Porting status ============== - Linux: This is the primary development platform, and should always work - Other platforms: The extension is platform independent Python code and should work as long as libvoikko is available for the platform. Platform identifiers to be used as directory names for native libraries on some of the common platforms are: Windows (64 bit): Windows-64bit-WindowsPE Windows (32 bit): Windows-32bit-WindowsPE Requirements ============ - LibreOffice 4.1 or later (must come with Python 3 or later) - Libvoikko version 3.8.1 or later. - Make, sed, find and zip for packaging. Instructions for packaging ========================== - Install all of the required software listed above. - Run "make oxt". This will build the extensions package voikko.oxt under subdirectory build. * There are some settings available that can be used to customize the build. Please see "build settings" in Makefile. You may change any of these settings by running "make VARIABLE=value" instead of "make". Supported Make targets ====================== - extension-files Builds the extension files under build/oxt. - oxt Builds the extensions package voikko.oxt under subdirectory build. - all Same as 'oxt'. - install-unpacked DESTDIR=some_directory Installs the unpacked extension under directory DESTDIR. Default for DESTDIR is /usr/lib/libreoffice-voikko. - dist-gzip Builds the source package. - clean Removes all files generated by other targets. Diagnostic tools ================ Setting environment variable PYUNO_LOGLEVEL=ARGS before starting LibreOffice causes debug information from PyUNO to be printed to stderr. Setting environment variable VOIKKO_DEBUG to any value before starting LibreOffice causes debug output from this extension to be printed to stderr. To debug possible initialization errors in production builds, try listing spelling suggestions for string "VoikkoGetStatusInformation". This will return a string that contains all successfully initialized languages and failed initializations along with error messages from libvoikko. Bug reports and patches ======================= Patches and bug reports can be sent to the author (hatapitk@iki.fi). The web site for libreoffice-voikko is located at http://voikko.puimula.org Change history ============== Version 2.0 was an almost total rewrite of the previous version 1.2. This version was designed to work well with libvoikko and aimed to use the best current practices for OpenOffice.org extension development. The old code was based on the internals of OpenOffice.org 1.0 and designed to work with a non-free Finnish spellchecking library. Version 3.0 added support for grammar checking. Version 3.2 added support for spell checking in languages other than Finnish. Version 4.0 extended support for grammar checkers and hyphenators to any language. The license was changed from GPL to MPL. Version 5.0 changed the implementation language from C++ to Python in order to make the extension code platform independent. For more detailed changes since 2.0 see ChangeLog. libreoffice-voikko-5.0/COPYING0000644000000000000000000004052612627600371014673 0ustar rootrootMozilla Public License Version 2.0 ================================== 1. Definitions -------------- 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means (a) that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or (b) that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: (a) any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or (b) any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions -------------------------------- 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and (b) under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: (a) for any code that a Contributor has removed from Covered Software; or (b) for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or (c) under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities ------------------- 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: (a) such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and (b) You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation --------------------------------------------------- If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination -------------- 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. ************************************************************************ * * * 6. Disclaimer of Warranty * * ------------------------- * * * * Covered Software is provided under this License on an "as is" * * basis, without warranty of any kind, either expressed, implied, or * * statutory, including, without limitation, warranties that the * * Covered Software is free of defects, merchantable, fit for a * * particular purpose or non-infringing. The entire risk as to the * * quality and performance of the Covered Software is with You. * * Should any Covered Software prove defective in any respect, You * * (not any Contributor) assume the cost of any necessary servicing, * * repair, or correction. This disclaimer of warranty constitutes an * * essential part of this License. No use of any Covered Software is * * authorized under this License except under this disclaimer. * * * ************************************************************************ ************************************************************************ * * * 7. Limitation of Liability * * -------------------------- * * * * Under no circumstances and under no legal theory, whether tort * * (including negligence), contract, or otherwise, shall any * * Contributor, or anyone who distributes Covered Software as * * permitted above, be liable to You for any direct, indirect, * * special, incidental, or consequential damages of any character * * including, without limitation, damages for lost profits, loss of * * goodwill, work stoppage, computer failure or malfunction, or any * * and all other commercial damages or losses, even if such party * * shall have been informed of the possibility of such damages. This * * limitation of liability shall not apply to liability for death or * * personal injury resulting from such party's negligence to the * * extent applicable law prohibits such limitation. Some * * jurisdictions do not allow the exclusion or limitation of * * incidental or consequential damages, so this exclusion and * * limitation may not apply to You. * * * ************************************************************************ 8. Litigation ------------- Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous ---------------- This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License --------------------------- 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice ------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice --------------------------------------------------------- This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. libreoffice-voikko-5.0/oxt/0000755000000000000000000000000012627600371014443 5ustar rootrootlibreoffice-voikko-5.0/oxt/description.xml.template0000644000000000000000000000214012627600371021317 0ustar rootroot Writing aids based on Voikko Voikko-pohjaiset kirjoituksen aputyökalut Voikon kehittäjäyhteisö Voikko development community libreoffice-voikko-5.0/oxt/SettingsDialog_en_US.default0000644000000000000000000000000012627600371022010 0ustar rootrootlibreoffice-voikko-5.0/oxt/config.xcs0000644000000000000000000000114312627600371016426 0ustar rootroot libreoffice-voikko-5.0/oxt/pythonpath/0000755000000000000000000000000012627600371016641 5ustar rootrootlibreoffice-voikko-5.0/oxt/pythonpath/SettingsEventHandler.py0000644000000000000000000001403412627600371023315 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import unohelper import logging import uno from com.sun.star.lang import XServiceInfo from com.sun.star.awt import XContainerWindowEventHandler from com.sun.star.beans import UnknownPropertyException from PropertyManager import PropertyManager from VoikkoHandlePool import VoikkoHandlePool from libvoikko import Voikko class SettingsEventHandler(unohelper.Base, XServiceInfo, XContainerWindowEventHandler): def __init__(self, ctx, *args): print("SettingsEventHandler.__init__") self.__dictionaryVariantList = ["standard: standard dictionary"] # From XServiceInfo def getImplementationName(self): return SettingsEventHandler.IMPLEMENTATION_NAME def supportsService(self, serviceName): return serviceName in self.getSupportedServiceNames() def getSupportedServiceNames(self): return SettingsEventHandler.SUPPORTED_SERVICE_NAMES # From XContainerWindowEventHandler def callHandlerMethod(self, xWindow, eventObject, methodName): if methodName != "external_event": return False if eventObject == "ok": self.__saveOptionsFromWindowToRegistry(xWindow) PropertyManager.getInstance().reloadVoikkoSettings() return True if eventObject == "back" or eventObject == "initialize": self.__initOptionsWindowFromRegistry(xWindow) return True return False def getSupportedMethodNames(self): return ("external_event",) def __initOptionsWindowFromRegistry(self, window): logging.debug("initOptionsWindowFromRegistry()"); hyphWordPartsValue = False hyphUnknownWordsValue = True try: hyphWordPartsValue = PropertyManager.getInstance().readFromRegistry("/org.puimula.ooovoikko.Config/hyphenator", "hyphWordParts") hyphUnknownWordsValue = PropertyManager.getInstance().readFromRegistry("/org.puimula.ooovoikko.Config/hyphenator", "hyphUnknownWords") except UnknownPropertyException as e: logging.exception("SettingsEventHandler: UnknownPropertyException", e) return logging.debug("hyphWordParts = " + str(hyphWordPartsValue)) hyphWordParts = window.getControl("hyphWordParts") hyphWordPartsProps = hyphWordParts.getModel() hyphWordPartsProps.setPropertyValue("State", 1 if hyphWordPartsValue else 0) hyphUnknownWords = window.getControl("hyphUnknownWords") hyphUnknownWordsProps = hyphUnknownWords.getModel() hyphUnknownWordsProps.setPropertyValue("State", 1 if hyphUnknownWordsValue else 0) self.__initVariantDropdown(window) def __saveOptionsFromWindowToRegistry(self, window): logging.debug("SettingsEventHandler.__saveOptionsFromWindowToRegistry") hyphWordParts = window.getControl("hyphWordParts") hyphWordPartsProps = hyphWordParts.getModel() hyphWordPartsValue = hyphWordPartsProps.getPropertyValue("State") # 0 = unchecked, 1 = checked hyphUnknownWords = window.getControl("hyphUnknownWords") hyphUnknownWordsProps = hyphUnknownWords.getModel() hyphUnknownWordsValue = hyphUnknownWordsProps.getPropertyValue("State") # 0 = unchecked, 1 = checked rootView = PropertyManager.getRegistryProperties("/org.puimula.ooovoikko.Config/hyphenator") rootView.setHierarchicalPropertyValue("hyphWordParts", hyphWordPartsValue == 1) rootView.setHierarchicalPropertyValue("hyphUnknownWords", hyphUnknownWordsValue == 1) rootView.commitChanges() # dictionary variant variantValue = self.__getSelectedVariant(window) rootView = PropertyManager.getRegistryProperties("/org.puimula.ooovoikko.Config/dictionary") rootView.setHierarchicalPropertyValue("variant", variantValue) rootView.commitChanges() def __initVariantDropdown(self, windowContainer): variantDropdown = windowContainer.getControl("variant") variantProps = variantDropdown.getModel() # populate dropdown list with available variants self.__initAvailableVariants() uno.invoke(variantProps, "setPropertyValue", ("StringItemList", uno.Any("[]string", tuple(self.__dictionaryVariantList)))) # read selected dictionary variant from registry registryVariantValue = "standard" try: registryVariantValue = PropertyManager.getInstance().readFromRegistry("/org.puimula.ooovoikko.Config/dictionary", "variant") except UnknownPropertyException as e: logging.exception(e) return registryVariantValue = registryVariantValue + ": " selectedValues = [0] for i, dVariant in enumerate(self.__dictionaryVariantList): if dVariant.startswith(registryVariantValue): selectedValues[0] = i; break; # set the selected item in the dropdown list uno.invoke(variantProps, "setPropertyValue", ("SelectedItems", uno.Any("[]short", tuple(selectedValues)))) def __initAvailableVariants(self): dicts = Voikko.listDicts(VoikkoHandlePool.getInstance().getDictionaryPath()) self.__dictionaryVariantList = [] for vDict in dicts: dictName = vDict.variant + ": " + vDict.description self.__dictionaryVariantList.append(dictName) def __getSelectedVariant(self, windowContainer): variantDropdown = windowContainer.getControl("variant") variantProps = variantDropdown.getModel() # get all values stringListValue = variantProps.getPropertyValue("StringItemList") # get the selected item index selectedValues = variantProps.getPropertyValue("SelectedItems") # parse the variant id from the string selectedValue = stringListValue[selectedValues[0]] if ":" in selectedValue: return selectedValue[0:selectedValue.find(":")] logging.error("Failed to get the selected variant, returning default") return "standard" SettingsEventHandler.IMPLEMENTATION_NAME = "org.puimula.ooovoikko.SettingsEventHandlerImplementation" SettingsEventHandler.SUPPORTED_SERVICE_NAMES = ("org.puimula.ooovoikko.SettingsEventHandlerService",) libreoffice-voikko-5.0/oxt/pythonpath/SpellChecker.py0000644000000000000000000000724212627600371021564 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import logging import unohelper from com.sun.star.linguistic2 import XSpellChecker, XLinguServiceEventBroadcaster from com.sun.star.lang import XServiceInfo, XInitialization, XServiceDisplayName from VoikkoHandlePool import VoikkoHandlePool from SpellAlternatives import SpellAlternatives from PropertyManager import PropertyManager class SpellChecker(unohelper.Base, XServiceInfo, XSpellChecker, XLinguServiceEventBroadcaster, XInitialization, XServiceDisplayName): def __init__(self, ctx, *args): logging.debug("SpellChecker.__init__") # From XServiceInfo def getImplementationName(self): return SpellChecker.IMPLEMENTATION_NAME def supportsService(self, serviceName): return serviceName in self.getSupportedServiceNames() def getSupportedServiceNames(self): return SpellChecker.SUPPORTED_SERVICE_NAMES # From XSupportedLocales def getLocales(self): return VoikkoHandlePool.getInstance().getSupportedSpellingLocales() def hasLocale(self, aLocale): return VoikkoHandlePool.getInstance().supportsSpellingLocale(aLocale) # From XSpellChecker def isValid(self, word, locale, properties): VoikkoHandlePool.mutex.acquire() try: voikko = VoikkoHandlePool.getInstance().getHandle(locale) if voikko is None: return False PropertyManager.getInstance().setValues(properties) result = voikko.spell(word) PropertyManager.getInstance().resetValues(properties) return result finally: VoikkoHandlePool.mutex.release() def spell(self, word, locale, properties): # Check if diagnostic message should be returned if word == "VoikkoGetStatusInformation": suggestions = [VoikkoHandlePool.getInstance().getInitializationStatus()] return SpellAlternatives(word, suggestions, locale) VoikkoHandlePool.mutex.acquire() try: voikko = VoikkoHandlePool.getInstance().getHandle(locale) if voikko is None: return None PropertyManager.getInstance().setValues(properties) if voikko.spell(word): PropertyManager.getInstance().resetValues(properties) return None suggestions = voikko.suggest(word) PropertyManager.getInstance().resetValues(properties) return SpellAlternatives(word, suggestions, locale) finally: VoikkoHandlePool.mutex.release() # From XLinguServiceEventBroadcaster def addLinguServiceEventListener(self, xLstnr): logging.debug("SpellChecker.addLinguServiceEventListener") VoikkoHandlePool.mutex.acquire() try: return PropertyManager.getInstance().addLinguServiceEventListener(xLstnr) finally: VoikkoHandlePool.mutex.release() def removeLinguServiceEventListener(self, xLstnr): logging.debug("SpellChecker.removeLinguServiceEventListener") VoikkoHandlePool.mutex.acquire() try: return PropertyManager.getInstance().removeLinguServiceEventListener(xLstnr) finally: VoikkoHandlePool.mutex.release() # From XInitialization def initialize(self, seq): pass # From XServiceDisplayName def getServiceDisplayName(self, locale): if locale.Language == "fi": return "Oikoluku (Voikko)" else: return "Spellchecker (Voikko)" SpellChecker.IMPLEMENTATION_NAME = "voikko.SpellChecker" SpellChecker.SUPPORTED_SERVICE_NAMES = ("com.sun.star.linguistic2.SpellChecker",) libreoffice-voikko-5.0/oxt/pythonpath/GrammarChecker.py0000644000000000000000000001073712627600371022076 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import logging import unohelper from com.sun.star.linguistic2 import XProofreader, ProofreadingResult, SingleProofreadingError from com.sun.star.lang import XServiceInfo, XInitialization, XServiceDisplayName from com.sun.star.beans import PropertyValue from com.sun.star.text.TextMarkupType import PROOFREADING from VoikkoHandlePool import VoikkoHandlePool from PropertyManager import PropertyManager class GrammarChecker(unohelper.Base, XServiceInfo, XProofreader, XInitialization, XServiceDisplayName): def __init__(self, ctx, *args): logging.debug("GrammarChecker.__init__") self.__ignoredErrors = set() # Grammar checker error codes that should be ignored # From XServiceInfo def getImplementationName(self): return GrammarChecker.IMPLEMENTATION_NAME def supportsService(self, serviceName): return serviceName in self.getSupportedServiceNames() def getSupportedServiceNames(self): return GrammarChecker.SUPPORTED_SERVICE_NAMES # From XSupportedLocales def getLocales(self): return VoikkoHandlePool.getInstance().getSupportedGrammarLocales() def hasLocale(self, aLocale): return VoikkoHandlePool.getInstance().supportsGrammarLocale(aLocale) # From XProofreader def isSpellChecker(self): return False def doProofreading(self, aDocumentIdentifier, aText, aLocale, nStartOfSentencePos, nSuggestedBehindEndOfSentencePosition, aProperties): logging.debug("GrammarChecker.doProofreading") result = ProofreadingResult() result.aDocumentIdentifier = aDocumentIdentifier result.xFlatParagraph = None result.aText = aText result.aLocale = aLocale result.nStartOfSentencePosition = nStartOfSentencePos result.nBehindEndOfSentencePosition = nSuggestedBehindEndOfSentencePosition result.xProofreader = self VoikkoHandlePool.mutex.acquire() try: voikko = VoikkoHandlePool.getInstance().getHandle(aLocale) if voikko is None: logging.error("GrammarChecker.doProofreading called without initializing libvoikko") return result gcErrors = [] gcI = 0 vErrorCount = 0 for vError in voikko.grammarErrors(aText, PropertyManager.getInstance().getMessageLanguage()): startPos = vError.startPos errorLength = vError.errorLen if startPos < result.nStartOfSentencePosition: continue if startPos >= result.nBehindEndOfSentencePosition: break if startPos + errorLength > result.nBehindEndOfSentencePosition: result.nBehindEndOfSentencePosition = startPos + errorLength # we have a real grammar error errorCode = vError.errorCode ruleIdentifier = str(errorCode) if ruleIdentifier in self.__ignoredErrors: # ignore this error continue suggestions = vError.suggestions gcError = SingleProofreadingError() gcErrors.append(gcError) gcError.nErrorStart = startPos gcError.nErrorLength = errorLength gcError.nErrorType = PROOFREADING comment = vError.shortDescription gcError.aShortComment = comment gcError.aFullComment = comment gcError.aRuleIdentifier = ruleIdentifier detailUrl = PropertyValue() detailUrl.Name = "FullCommentURL" detailUrl.Value = "http://voikko.puimula.org/gchelp/fi/" + ruleIdentifier + ".html" gcError.aProperties = (detailUrl,) # add suggestions if len(suggestions) > 0: gcError.aSuggestions = tuple(suggestions) result.aErrors = tuple(gcErrors) result.nStartOfNextSentencePosition = result.nBehindEndOfSentencePosition return result finally: VoikkoHandlePool.mutex.release() def ignoreRule(self, ruleIdentifier, locale): self.__ignoredErrors.add(ruleIdentifier) def resetIgnoreRules(self): ignoredErrors.clear() # From XInitialization def initialize(self): pass # From XServiceDisplayName def getServiceDisplayName(self, locale): if locale.Language == "fi": return "Kieliopin tarkistus (Voikko)" else: return "Grammar checker (Voikko)" GrammarChecker.IMPLEMENTATION_NAME = "voikko.GrammarChecker" GrammarChecker.SUPPORTED_SERVICE_NAMES = ("com.sun.star.linguistic2.Proofreader",) libreoffice-voikko-5.0/oxt/pythonpath/PropertyManager.py0000644000000000000000000002463512627600371022344 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import logging import unohelper import os import sys import locale import uno from VoikkoHandlePool import VoikkoHandlePool from com.sun.star.beans import XPropertyChangeListener, UnknownPropertyException, PropertyValue from com.sun.star.linguistic2 import LinguServiceEvent from com.sun.star.linguistic2.LinguServiceEventFlags import SPELL_CORRECT_WORDS_AGAIN, SPELL_WRONG_WORDS_AGAIN, HYPHENATE_AGAIN, PROOFREAD_AGAIN class PropertyManager(unohelper.Base, XPropertyChangeListener): def __init__(self): self.__messageLanguage = "en_US" VoikkoHandlePool.getInstance().setInstallationPath(self.__getInstallationPath()) logging.debug("PropertyManager.__init__") self.__linguPropSet = None self.__hyphMinLeading = 2 self.__hyphMinTrailing = 2 self.__hyphMinWordLength = 5 self.__hyphWordParts = False self.__hyphUnknownWords = True self.__linguEventListeners = {} try: dictVariant = self.readFromRegistry("/org.puimula.ooovoikko.Config/dictionary", "variant") VoikkoHandlePool.getInstance().setPreferredGlobalVariant(dictVariant) logging.debug("Initial dictionary variant '" + dictVariant + "'") except UnknownPropertyException as e: logging.debug("Setting initial dictionary variant to default") VoikkoHandlePool.getInstance().setPreferredGlobalVariant("") self.initialize() def propertyChange(self, evt): logging.debug("PropertyManager.propertyChange") self.__setProperties(self.__linguPropSet) event = LinguServiceEvent() event.nEvent = SPELL_CORRECT_WORDS_AGAIN | SPELL_WRONG_WORDS_AGAIN | HYPHENATE_AGAIN | PROOFREAD_AGAIN self.__sendLinguEvent(event); def __setUiLanguage(self): try: lang = self.readFromRegistry("org.openoffice.Office.Linguistic/General", "UILocale") logging.debug("Specified UI locale = '" + lang + "'") if lang is not None and len(lang) > 0: self.__messageLanguage = lang else: # Use system default language lang = locale.getdefaultlocale()[0] if lang is not None: logging.debug("Locale language = '" + lang + "'") self.__messageLanguage = lang except UnknownPropertyException: logging.error("PropertyManager.initialize caught UnknownPropertyException") def initialize(self): logging.debug("PropertyManager.initialize: starting") self.__setUiLanguage() VoikkoHandlePool.getInstance().setGlobalBooleanOption(PropertyManager.VOIKKO_OPT_IGNORE_DOT, True) VoikkoHandlePool.getInstance().setGlobalBooleanOption(PropertyManager.VOIKKO_OPT_NO_UGLY_HYPHENATION, True) # Set these options globally until OOo bug #97945 is resolved. VoikkoHandlePool.getInstance().setGlobalBooleanOption(PropertyManager.VOIKKO_OPT_ACCEPT_TITLES_IN_GC, True) VoikkoHandlePool.getInstance().setGlobalBooleanOption(PropertyManager.VOIKKO_OPT_ACCEPT_BULLETED_LISTS_IN_GC, True) VoikkoHandlePool.getInstance().setGlobalBooleanOption(PropertyManager.VOIKKO_OPT_ACCEPT_UNFINISHED_PARAGRAPHS_IN_GC, True) compContext = uno.getComponentContext() servManager = compContext.ServiceManager self.__linguPropSet = servManager.createInstanceWithContext("com.sun.star.linguistic2.LinguProperties", compContext) self.__linguPropSet.addPropertyChangeListener("IsSpellWithDigits", self) self.__linguPropSet.addPropertyChangeListener("IsSpellUpperCase", self) logging.debug("PropertyManager.initialize: property manager initalized") # synchronize the local settings from global preferences self.__setProperties(self.__linguPropSet) self.readVoikkoSettings() # request that all users of linguistic services run the spellchecker and hyphenator # again with updated settings event = LinguServiceEvent() event.nEvent = SPELL_CORRECT_WORDS_AGAIN | SPELL_WRONG_WORDS_AGAIN | HYPHENATE_AGAIN | PROOFREAD_AGAIN self.__sendLinguEvent(event) def getHyphMinLeading(self): return self.__hyphMinLeading def getHyphMinTrailing(self): return self.__hyphMinTrailing def getHyphMinWordLength(self): return self.__hyphMinWordLength def addLinguServiceEventListener(self, xLstnr): logging.debug("PropertyManager.addLinguServiceEventListener") if id(xLstnr) in self.__linguEventListeners: return False self.__linguEventListeners[id(xLstnr)] = xLstnr return True def removeLinguServiceEventListener(self, xLstnr): logging.debug("PropertyManager.removeLinguServiceEventListener") if id(xLstnr) in self.__linguEventListeners: del self.__linguEventListeners[id(xLstnr)] return True return False def readVoikkoSettings(self): try: self.__hyphWordParts = self.readFromRegistry("/org.puimula.ooovoikko.Config/hyphenator", "hyphWordParts") self.__hyphUnknownWords = self.readFromRegistry("/org.puimula.ooovoikko.Config/hyphenator", "hyphUnknownWords") except UnknownPropertyException as e: logging.exception("PropertyManager.readVoikkoSettings", e) self.__syncHyphenatorSettings() def __getInstallationPath(self): dname = os.path.dirname(sys.modules[__name__].__file__) if dname.endswith("pythonpath"): dname = dname[:-11] logging.debug("PropertyManager.getInstallationPath: '" + dname + "'") return dname else: logging.debug("PropertyManager.getInstallationPath: not using unexpect '" + dname + "'") return None def readFromRegistry(self, group, key): rootView = PropertyManager.getRegistryProperties(group) if rootView is None: logging.error("PropertyManager.readFromRegistry: failed to obtain rootView " + group) raise UnknownPropertyException() return rootView.getHierarchicalPropertyValue(key) def getMessageLanguage(self): return self.__messageLanguage def reloadVoikkoSettings(self): voikko = VoikkoHandlePool.getInstance() event = LinguServiceEvent() event.nEvent = 0 try: hyphWordParts = self.readFromRegistry("/org.puimula.ooovoikko.Config/hyphenator", "hyphWordParts") if hyphWordParts != self.__hyphWordParts: event.nEvent = event.nEvent | HYPHENATE_AGAIN self.__hyphWordParts = hyphWordParts hyphUnknownWords = self.readFromRegistry("/org.puimula.ooovoikko.Config/hyphenator", "hyphUnknownWords") if hyphUnknownWords != self.__hyphUnknownWords: event.nEvent = event.nEvent | HYPHENATE_AGAIN self.__hyphUnknownWords = hyphUnknownWords dictVariant = self.readFromRegistry("/org.puimula.ooovoikko.Config/dictionary", "variant") if dictVariant is None or dictVariant == "": dictVariant = voikko.getPreferredGlobalVariant() if dictVariant != voikko.getPreferredGlobalVariant(): event.nEvent = event.nEvent | SPELL_CORRECT_WORDS_AGAIN | SPELL_WRONG_WORDS_AGAIN | PROOFREAD_AGAIN voikko.setPreferredGlobalVariant(dictVariant) except UnknownPropertyException as e: logging.exception("PropertyManager.reloadVoikkoSettings", e) self.__syncHyphenatorSettings() self.__sendLinguEvent(event) def __setProperties(self, properties): for p in ["IsSpellWithDigits", "IsSpellUpperCase", "HyphMinLeading", "HyphMinTrailing", "HyphMinWordLength"]: pValue = PropertyValue() pValue.Name = p pValue.Value = properties.getPropertyValue(p) self.setValue(pValue) def setValues(self, values): for v in values: self.setValue(v) def resetValues(self, values): for v in values: globalV = PropertyValue() globalV.Name = v.Name globalV.Value = self.__linguPropSet.getPropertyValue(v.Name) self.setValue(globalV) def setValue(self, value): if value.Name == "IsSpellWithDigits": VoikkoHandlePool.getInstance().setGlobalBooleanOption(PropertyManager.VOIKKO_OPT_IGNORE_NUMBERS, not value.Value) elif value.Name == "IsSpellUpperCase": VoikkoHandlePool.getInstance().setGlobalBooleanOption(PropertyManager.VOIKKO_OPT_IGNORE_UPPERCASE, not value.Value) elif value.Name == "HyphMinLeading": if value.Value is not None: self.__hyphMinLeading = value.Value self.__syncHyphenatorSettings() elif value.Name == "HyphMinTrailing": if value.Value is not None: self.__hyphMinTrailing = value.Value self.__syncHyphenatorSettings() elif value.Name == "HyphMinWordLength": if value.Value is not None: self.__hyphMinWordLength = value.Value self.__syncHyphenatorSettings() def __syncHyphenatorSettings(self): if self.__hyphWordParts: VoikkoHandlePool.getInstance().setGlobalIntegerOption(PropertyManager.VOIKKO_MIN_HYPHENATED_WORD_LENGTH, self.__hyphMinWordLength) else: VoikkoHandlePool.getInstance().setGlobalIntegerOption(PropertyManager.VOIKKO_MIN_HYPHENATED_WORD_LENGTH, 2) VoikkoHandlePool.getInstance().setGlobalBooleanOption(PropertyManager.VOIKKO_OPT_HYPHENATE_UNKNOWN_WORDS, self.__hyphUnknownWords) def __sendLinguEvent(self, event): logging.debug("PropertyManager.sendLinguEvent") for key, lstnr in self.__linguEventListeners.items(): logging.debug("PropertyManager.sendLinguEvent sending event") lstnr.processLinguServiceEvent(event) def getRegistryProperties(group): logging.debug("PropertyManager.getRegistryProperties: " + group) compContext = uno.getComponentContext() servManager = compContext.ServiceManager provider = servManager.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", compContext) pathArgument = PropertyValue() pathArgument.Name = "nodepath" pathArgument.Value = group aArguments = (pathArgument,) rootView = provider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aArguments) return rootView; getRegistryProperties = staticmethod(getRegistryProperties) def getInstance(): if PropertyManager.instance is None: PropertyManager.instance = PropertyManager() return PropertyManager.instance getInstance = staticmethod(getInstance) PropertyManager.instance = None PropertyManager.VOIKKO_OPT_IGNORE_NUMBERS = 1 PropertyManager.VOIKKO_OPT_IGNORE_UPPERCASE = 3 PropertyManager.VOIKKO_MIN_HYPHENATED_WORD_LENGTH = 9 PropertyManager.VOIKKO_OPT_HYPHENATE_UNKNOWN_WORDS = 15 PropertyManager.VOIKKO_OPT_IGNORE_DOT = 0 PropertyManager.VOIKKO_OPT_NO_UGLY_HYPHENATION = 4 PropertyManager.VOIKKO_OPT_ACCEPT_TITLES_IN_GC = 13 PropertyManager.VOIKKO_OPT_ACCEPT_BULLETED_LISTS_IN_GC = 16 PropertyManager.VOIKKO_OPT_ACCEPT_UNFINISHED_PARAGRAPHS_IN_GC = 14 libreoffice-voikko-5.0/oxt/pythonpath/Hyphenator.py0000644000000000000000000001320412627600371021334 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import logging import unohelper from com.sun.star.linguistic2 import XHyphenator, XLinguServiceEventBroadcaster from com.sun.star.lang import XServiceInfo, XInitialization, XServiceDisplayName from VoikkoHandlePool import VoikkoHandlePool from HyphenatedWord import HyphenatedWord from PossibleHyphens import PossibleHyphens from PropertyManager import PropertyManager class Hyphenator(unohelper.Base, XServiceInfo, XHyphenator, XLinguServiceEventBroadcaster, XInitialization, XServiceDisplayName): def __init__(self, ctx, *args): logging.debug("Hyphenator.__init__") # From XServiceInfo def getImplementationName(self): return Hyphenator.IMPLEMENTATION_NAME def supportsService(self, serviceName): return serviceName in self.getSupportedServiceNames() def getSupportedServiceNames(self): return Hyphenator.SUPPORTED_SERVICE_NAMES # From XSupportedLocales def getLocales(self): return VoikkoHandlePool.getInstance().getSupportedHyphenationLocales() def hasLocale(self, aLocale): return VoikkoHandlePool.getInstance().supportsHyphenationLocale(aLocale) # From XHyphenator def hyphenate(self, word, locale, nMaxLeading, properties): logging.debug("Hyphenator.hyphenate") if len(word) > 10000: return None VoikkoHandlePool.mutex.acquire() try: voikko = VoikkoHandlePool.getInstance().getHandle(locale) if voikko is None: return None PropertyManager.getInstance().setValues(properties) minLeading = PropertyManager.getInstance().getHyphMinLeading() minTrailing = PropertyManager.getInstance().getHyphMinTrailing() wlen = len(word) # If the word is too short to be hyphenated, return no hyphenation points if wlen < PropertyManager.getInstance().getHyphMinWordLength() or wlen < minLeading + minTrailing: PropertyManager.getInstance().resetValues(properties) return None hyphenationPoints = voikko.getHyphenationPattern(word) if hyphenationPoints is None: PropertyManager.getInstance().resetValues(properties) return None # find the hyphenation point hyphenPos = -1 i = wlen - minTrailing # The last generally allowed hyphenation point if i > nMaxLeading: i = nMaxLeading # The last allowed point on this line while i >= minLeading and hyphenPos == -1: if word[i] == '\'': i = i - 1 continue if hyphenationPoints[i] == '-' or hyphenationPoints[i] == '=': hyphenPos = i break i = i - 1 # return the result PropertyManager.getInstance().resetValues(properties) if hyphenPos != -1: return HyphenatedWord(word, hyphenPos - 1, locale) else: return None finally: VoikkoHandlePool.mutex.release() def queryAlternativeSpelling(self, word, locale, index, properties): logging.debug("Hyphenator.queryAlternativeSpelling") # Implementing this might be necessary, although everything seems to work fine without it. return None def createPossibleHyphens(self, word, locale, properties): logging.debug("Hyphenator.createPossibleHyphens") wlen = len(word) if wlen > 10000: return None VoikkoHandlePool.mutex.acquire() try: voikko = VoikkoHandlePool.getInstance().getHandle(locale) if voikko is None: return None PropertyManager.getInstance().setValues(properties) # If the word is too short to be hyphenated, return no hyphenation points minLeading = PropertyManager.getInstance().getHyphMinLeading() minTrailing = PropertyManager.getInstance().getHyphMinTrailing() if wlen < PropertyManager.getInstance().getHyphMinWordLength() or wlen < minLeading + minTrailing: PropertyManager.getInstance().resetValues(properties) return None hyphenationPoints = voikko.getHyphenationPattern(word) if hyphenationPoints is None: PropertyManager.getInstance().resetValues(properties) return None hyphenSeq = [] hyphenatedWord = "" for i in range(0, wlen): hyphenatedWord = hyphenatedWord + word[i] if i >= minLeading - 1 and i < wlen - minTrailing and hyphenationPoints[i + 1] == '-': hyphenSeq.append(i) hyphenatedWord = hyphenatedWord + "=" res = PossibleHyphens(word, hyphenatedWord, hyphenSeq, locale) PropertyManager.getInstance().resetValues(properties) return res finally: VoikkoHandlePool.mutex.release() # From XLinguServiceEventBroadcaster def addLinguServiceEventListener(self, xLstnr): logging.debug("Hyphenator.addLinguServiceEventListener") VoikkoHandlePool.mutex.acquire() try: return PropertyManager.getInstance().addLinguServiceEventListener(xLstnr) finally: VoikkoHandlePool.mutex.release() def removeLinguServiceEventListener(self, xLstnr): logging.debug("Hyphenator.removeLinguServiceEventListener") VoikkoHandlePool.mutex.acquire() try: return PropertyManager.getInstance().removeLinguServiceEventListener(xLstnr) finally: VoikkoHandlePool.mutex.release() # From XInitialization def initialize(self, seq): pass # From XServiceDisplayName def getServiceDisplayName(self, locale): if locale.Language == "fi": return "Tavutus (Voikko)" else: return "Hyphenator (Voikko)" Hyphenator.IMPLEMENTATION_NAME = "voikko.Hyphenator" Hyphenator.SUPPORTED_SERVICE_NAMES = ("com.sun.star.linguistic2.Hyphenator",) libreoffice-voikko-5.0/oxt/pythonpath/PossibleHyphens.py0000644000000000000000000000210412627600371022327 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import unohelper from com.sun.star.linguistic2 import XPossibleHyphens class PossibleHyphens(unohelper.Base, XPossibleHyphens): def __init__(self, word, hyphenatedWord, positions, locale): self.__word = word self.__hyphenatedWord = hyphenatedWord self.__hyphenationPositions = positions self.__locale = locale def getWord(self): return self.__word def getLocale(self): return self.__locale def getPossibleHyphens(self): return self.__hyphenatedWord def getHyphenationPositions(self): return tuple(self.__hyphenationPositions) libreoffice-voikko-5.0/oxt/pythonpath/VoikkoHandlePool.py0000644000000000000000000004125312627600371022430 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import logging import os import platform from libvoikko import Voikko, VoikkoException from collections import defaultdict from threading import RLock from com.sun.star.lang import Locale class Bcp47ToLoMapping: def __init__(self, bcpTag, loLanguage, loRegion): self.bcpTag = bcpTag self.loLanguage = loLanguage self.loRegion = loRegion BCP_TO_LO_MAPPING = [ Bcp47ToLoMapping("af", "af", "NA"), \ Bcp47ToLoMapping("af", "af", "ZA"), \ Bcp47ToLoMapping("am", "am", "ET"), \ Bcp47ToLoMapping("ar", "ar", "AE"), \ Bcp47ToLoMapping("ar", "ar", "BH"), \ Bcp47ToLoMapping("ar", "ar", "DJ"), \ Bcp47ToLoMapping("ar", "ar", "DZ"), \ Bcp47ToLoMapping("ar", "ar", "EG"), \ Bcp47ToLoMapping("ar", "ar", "ER"), \ Bcp47ToLoMapping("ar", "ar", "IL"), \ Bcp47ToLoMapping("ar", "ar", "IQ"), \ Bcp47ToLoMapping("ar", "ar", "JO"), \ Bcp47ToLoMapping("ar", "ar", "KM"), \ Bcp47ToLoMapping("ar", "ar", "KW"), \ Bcp47ToLoMapping("ar", "ar", "LB"), \ Bcp47ToLoMapping("ar", "ar", "LY"), \ Bcp47ToLoMapping("ar", "ar", "MA"), \ Bcp47ToLoMapping("ar", "ar", "MR"), \ Bcp47ToLoMapping("ar", "ar", "OM"), \ Bcp47ToLoMapping("ar", "ar", "PS"), \ Bcp47ToLoMapping("ar", "ar", "QA"), \ Bcp47ToLoMapping("ar", "ar", "SA"), \ Bcp47ToLoMapping("ar", "ar", "SD"), \ Bcp47ToLoMapping("ar", "ar", "SO"), \ Bcp47ToLoMapping("ar", "ar", "SY"), \ Bcp47ToLoMapping("ar", "ar", "TD"), \ Bcp47ToLoMapping("ar", "ar", "TN"), \ Bcp47ToLoMapping("ar", "ar", "YE"), \ Bcp47ToLoMapping("bn", "bn", "BD"), \ Bcp47ToLoMapping("bn", "bn", "IN"), \ Bcp47ToLoMapping("ca", "ca", "AD"), \ Bcp47ToLoMapping("ca", "ca", "ES"), \ Bcp47ToLoMapping("cs", "cs", "CZ"), \ Bcp47ToLoMapping("csb", "csb", "PL"), \ Bcp47ToLoMapping("cv", "cv", "RU"), \ Bcp47ToLoMapping("cy", "cy", "GB"), \ Bcp47ToLoMapping("da", "da", "DK"), \ Bcp47ToLoMapping("de", "de", "DE"), \ Bcp47ToLoMapping("de-AT", "de", "AT"), \ Bcp47ToLoMapping("de-BE", "de", "BE"), \ Bcp47ToLoMapping("de-CH", "de", "CH"), \ Bcp47ToLoMapping("de-LU", "de", "LU"), \ Bcp47ToLoMapping("el", "el", "GR"), \ Bcp47ToLoMapping("en-US", "en", "US"), \ Bcp47ToLoMapping("en-US", "en", "ZA"), \ Bcp47ToLoMapping("eo", "eo", ""), \ Bcp47ToLoMapping("es", "es", "ES"), \ Bcp47ToLoMapping("es-MX", "es", "MX"), \ Bcp47ToLoMapping("et", "et", "EE"), \ Bcp47ToLoMapping("eu", "eu", ""), \ Bcp47ToLoMapping("fa", "fa", "IR"), \ Bcp47ToLoMapping("fi", "fi", "FI"), \ Bcp47ToLoMapping("fo", "fo", "FO"), \ Bcp47ToLoMapping("fr", "fr", "FR"), \ Bcp47ToLoMapping("fr-BE", "fr", "BE"), \ Bcp47ToLoMapping("fr-CA", "fr", "CA"), \ Bcp47ToLoMapping("fr-CH", "fr", "CH"), \ Bcp47ToLoMapping("fr-LU", "fr", "LU"), \ Bcp47ToLoMapping("fr-MC", "fr", "MC"), \ Bcp47ToLoMapping("fur", "fur", "IT"), \ Bcp47ToLoMapping("fy", "fy", "NL"), \ Bcp47ToLoMapping("ga", "ga", "IE"), \ Bcp47ToLoMapping("gd", "gd", "GB"), \ Bcp47ToLoMapping("gl", "gl", "ES"), \ Bcp47ToLoMapping("gn", "gug", "PY"), \ Bcp47ToLoMapping("gu", "gu", "IN"), \ Bcp47ToLoMapping("he", "he", "IL"), \ Bcp47ToLoMapping("hi", "hi", "IN"), \ Bcp47ToLoMapping("hr", "hr", "BA"), \ Bcp47ToLoMapping("hr", "hr", "HR"), \ Bcp47ToLoMapping("hu", "hu", "HU"), \ Bcp47ToLoMapping("ia", "ia", ""), \ Bcp47ToLoMapping("id", "id", "ID"), \ Bcp47ToLoMapping("is", "is", "IS"), \ Bcp47ToLoMapping("it", "it", "CH"), \ Bcp47ToLoMapping("it", "it", "IT"), \ Bcp47ToLoMapping("kca", "kca", "RU"), \ Bcp47ToLoMapping("kk", "kk", "KZ"), \ Bcp47ToLoMapping("kl", "kl", "GL"), \ Bcp47ToLoMapping("koi", "koi", "RU"), \ Bcp47ToLoMapping("kpv", "kpv", "RU"), \ Bcp47ToLoMapping("ku", "ku", "TR"), \ Bcp47ToLoMapping("ku", "ku", "SY"), \ Bcp47ToLoMapping("kum", "kum", "RU"), \ Bcp47ToLoMapping("ky", "ky", "CN"), \ Bcp47ToLoMapping("ky", "ky", "KG"), \ Bcp47ToLoMapping("la", "la", "VA"), \ Bcp47ToLoMapping("liv", "liv", "LV"), \ Bcp47ToLoMapping("liv", "liv", "RU"), \ Bcp47ToLoMapping("ln", "ln", "CD"), \ Bcp47ToLoMapping("lt", "lt", "LT"), \ Bcp47ToLoMapping("lv", "lv", "LV"), \ Bcp47ToLoMapping("mdf", "mdf", "RU"), \ Bcp47ToLoMapping("mhr", "mhr", "RU"), \ Bcp47ToLoMapping("mk", "mk", "MK"), \ Bcp47ToLoMapping("ml", "ml", "IN"), \ Bcp47ToLoMapping("mrj", "mrj", "RU"), \ Bcp47ToLoMapping("ms", "ms", ""), \ Bcp47ToLoMapping("ms", "ms", "BN"), \ Bcp47ToLoMapping("ms", "ms", "MY"), \ Bcp47ToLoMapping("myv", "myv", "RU"), \ Bcp47ToLoMapping("nb", "nb", "NO"), \ Bcp47ToLoMapping("ne", "ne", "IN"), \ Bcp47ToLoMapping("ne", "ne", "NP"), \ Bcp47ToLoMapping("nio", "nio", "RU"), \ Bcp47ToLoMapping("nl", "nl", "BE"), \ Bcp47ToLoMapping("nl", "nl", "NL"), \ Bcp47ToLoMapping("nn", "nn", "NO"), \ Bcp47ToLoMapping("nog", "nog", "RU"), \ Bcp47ToLoMapping("nr", "nr", "ZA"), \ Bcp47ToLoMapping("nso", "ns", "ZA"), \ Bcp47ToLoMapping("nso", "nso", "ZA"), \ Bcp47ToLoMapping("ny", "ny", "MW"), \ Bcp47ToLoMapping("oc", "oc", "FR"), \ Bcp47ToLoMapping("olo", "olo", "RU"), \ Bcp47ToLoMapping("or", "or", "IN"), \ Bcp47ToLoMapping("pa", "pa", "IN"), \ Bcp47ToLoMapping("pa", "pa", "PK"), \ Bcp47ToLoMapping("pap-BQ", "pap", "BQ"), \ Bcp47ToLoMapping("pap-CW", "pap", "CW"), \ Bcp47ToLoMapping("pjt", "pjt", "AU"), \ Bcp47ToLoMapping("pl", "pl", "PL"), \ Bcp47ToLoMapping("pt", "pt", "PT"), \ Bcp47ToLoMapping("pt-BR", "pt", "BR"), \ Bcp47ToLoMapping("qu", "qu", "BO"), \ Bcp47ToLoMapping("qu", "qu", "EC"), \ Bcp47ToLoMapping("qu", "qu", "PE"), \ Bcp47ToLoMapping("ro", "ro", "MD"), \ Bcp47ToLoMapping("ro", "ro", "RO"), \ Bcp47ToLoMapping("ru", "ru", "RU"), \ Bcp47ToLoMapping("rw", "rw", "RW"), \ Bcp47ToLoMapping("se", "se", "FI"), \ Bcp47ToLoMapping("se", "se", "NO"), \ Bcp47ToLoMapping("se", "se", "SE"), \ Bcp47ToLoMapping("sid", "sid", "ET"), \ Bcp47ToLoMapping("sjd", "sjd", "RU"), \ Bcp47ToLoMapping("sk", "sk", "SK"), \ Bcp47ToLoMapping("sl", "sl", "SI"), \ Bcp47ToLoMapping("sma", "sma", "NO"), \ Bcp47ToLoMapping("sma", "sma", "SE"), \ Bcp47ToLoMapping("smj", "smj", "NO"), \ Bcp47ToLoMapping("smj", "smj", "SE"), \ Bcp47ToLoMapping("smn", "smn", "FI"), \ Bcp47ToLoMapping("sms", "sms", "FI"), \ Bcp47ToLoMapping("ss", "ss", "ZA"), \ Bcp47ToLoMapping("st", "st", "ZA"), \ Bcp47ToLoMapping("sv", "sv", "FI"), \ Bcp47ToLoMapping("sv", "sv", "SE"), \ Bcp47ToLoMapping("sw", "sw", "KE"), \ Bcp47ToLoMapping("sw", "sw", "TZ"), \ Bcp47ToLoMapping("ta", "ta", "IN"), \ Bcp47ToLoMapping("tet", "tet", "ID"), \ Bcp47ToLoMapping("tet", "tet", "TL"), \ Bcp47ToLoMapping("tl", "tl", "PH"), \ Bcp47ToLoMapping("tn", "tn", "BW"), \ Bcp47ToLoMapping("tn", "tn", "ZA"), \ Bcp47ToLoMapping("ts", "ts", "ZA"), \ Bcp47ToLoMapping("tt", "tt", "RU"), \ Bcp47ToLoMapping("udm", "udm", "RU"), \ Bcp47ToLoMapping("uk", "uk", "UA"), \ Bcp47ToLoMapping("vep", "vep", "RU"), \ Bcp47ToLoMapping("vi", "vi", "VN"), \ Bcp47ToLoMapping("vro", "vro", "EE"), \ Bcp47ToLoMapping("xh", "xh", "ZA"), \ Bcp47ToLoMapping("yrk", "yrk", "RU"), \ # Added a new block of language codes - should be sorted and merged with the rest when accepted. Bcp47ToLoMapping("an", "an", "ES"), \ Bcp47ToLoMapping("as", "as", "IN"), \ Bcp47ToLoMapping("as-BT", "as", "BT"), \ Bcp47ToLoMapping("ast", "ast", "ES"), \ Bcp47ToLoMapping("av", "av", "RU"), \ Bcp47ToLoMapping("av-AZ", "av", "AZ"), \ Bcp47ToLoMapping("av-GE", "av", "GE"), \ Bcp47ToLoMapping("av-KZ", "av", "KZ"), \ Bcp47ToLoMapping("azj", "azj", "AZ"), \ Bcp47ToLoMapping("azj-RU", "azj", "RU"), \ Bcp47ToLoMapping("bak", "bak", "RU"), \ Bcp47ToLoMapping("bak-KZ", "bak", "KZ"), \ Bcp47ToLoMapping("be", "be", "BY"), \ Bcp47ToLoMapping("bg", "bg", "BG"), \ Bcp47ToLoMapping("bla", "bla", "CA"), \ Bcp47ToLoMapping("bla-US", "bla", "US"), \ Bcp47ToLoMapping("br", "br", "FR"), \ Bcp47ToLoMapping("bxr", "bxr", "RU"), \ Bcp47ToLoMapping("ce", "ce", "RU"), \ Bcp47ToLoMapping("ceb", "ceb", "PH"), \ Bcp47ToLoMapping("chp", "chp", "CA"), \ Bcp47ToLoMapping("ciw", "ciw", "US"), \ Bcp47ToLoMapping("cos", "cos", "FR"), \ Bcp47ToLoMapping("crk", "crk", "CA"), \ Bcp47ToLoMapping("crk-US", "crk", "US"), \ Bcp47ToLoMapping("dsb", "dsb", "DE"), \ Bcp47ToLoMapping("eve", "eve", "RU"), \ Bcp47ToLoMapping("evn", "evn", "CN"), \ Bcp47ToLoMapping("evn-RU", "evn", "RU"), \ Bcp47ToLoMapping("fkv", "fkv", "NO"), \ Bcp47ToLoMapping("fry", "fry", "NL"), \ Bcp47ToLoMapping("glk", "glk", "IR"), \ Bcp47ToLoMapping("grn", "grn", "PY"), \ Bcp47ToLoMapping("guc", "guc", "CO"), \ Bcp47ToLoMapping("guc-VE", "guc", "VE"), \ Bcp47ToLoMapping("gv", "gv", "IM"), \ Bcp47ToLoMapping("hdn", "hdn", "CA"), \ Bcp47ToLoMapping("hdn-US", "hdn", "US"), \ Bcp47ToLoMapping("hsb", "hsb", "DE"), \ Bcp47ToLoMapping("hy", "hy", "AM"), \ Bcp47ToLoMapping("ik", "ik", "US"), \ Bcp47ToLoMapping("izh", "izh", "RU"), \ Bcp47ToLoMapping("kaa", "kaa", "UZ"), \ Bcp47ToLoMapping("kaa-RU", "kaa", "RU"), \ Bcp47ToLoMapping("kaz", "kaz", "KZ"), \ Bcp47ToLoMapping("khk", "khk", "MN"), \ Bcp47ToLoMapping("khk-KG", "khk", "KG"), \ Bcp47ToLoMapping("khk-RU", "khk", "RU"), \ Bcp47ToLoMapping("khk-CN", "khk", "CN"), \ Bcp47ToLoMapping("kw", "kw", "UK"), \ Bcp47ToLoMapping("ltz", "ltz", "LU"), \ Bcp47ToLoMapping("ml", "ml", "IN"), \ Bcp47ToLoMapping("mr", "mr", "IN"), \ Bcp47ToLoMapping("mt", "mt", "MT"), \ Bcp47ToLoMapping("ndl", "ndl", "CD"), \ Bcp47ToLoMapping("quz", "quz", "PE"), \ Bcp47ToLoMapping("qve", "qve", "PE"), \ Bcp47ToLoMapping("rup", "rup", "MK"), \ Bcp47ToLoMapping("rup-GR", "rup", "GR"), \ Bcp47ToLoMapping("rup-RO", "rup", "RO"), \ Bcp47ToLoMapping("sc", "sc", "IT"), \ Bcp47ToLoMapping("sel", "sel", "RU"), \ Bcp47ToLoMapping("si", "si", "LK"), \ Bcp47ToLoMapping("sje", "sje", "SE"), \ Bcp47ToLoMapping("so", "so", "SO"), \ Bcp47ToLoMapping("sq", "sq", "AL"), \ Bcp47ToLoMapping("sto", "sto", "CA"), \ Bcp47ToLoMapping("te", "te", "IN"), \ Bcp47ToLoMapping("tg", "tg", "TJ"), \ Bcp47ToLoMapping("tg-UZ", "tg", "UZ"), \ Bcp47ToLoMapping("tl", "tl", "PH"), \ Bcp47ToLoMapping("tk", "tk", "TM"), \ Bcp47ToLoMapping("tku", "tku", "MX"), \ Bcp47ToLoMapping("tus", "tus", "CA"), \ Bcp47ToLoMapping("tyv", "tyv", "RU"), \ Bcp47ToLoMapping("ur", "ur", "PK"), \ Bcp47ToLoMapping("uz", "uz", "UZ"), \ Bcp47ToLoMapping("uz-KG", "uz", "KG"), \ Bcp47ToLoMapping("zu", "zu", "ZA"), \ Bcp47ToLoMapping("zu-LS", "zu", "LS"), \ Bcp47ToLoMapping("zu-SZ", "zu", "SZ") ] class VoikkoHandlePool: def __init__(self): self.__supportedSpellingLocales = [] self.__supportedHyphenationLocales = [] self.__supportedGrammarCheckingLocales = [] self.__installationPath = None self.__handles = {} self.__initializationErrors = {} self.__globalBooleanOptions = {} self.__globalIntegerOptions = {} self.__preferredGlobalVariant = None self.__bcpToOOoMap = defaultdict(list) for m in BCP_TO_LO_MAPPING: self.__bcpToOOoMap[m.bcpTag].append(m) def getInstance(): if VoikkoHandlePool.instance is None: VoikkoHandlePool.instance = VoikkoHandlePool() return VoikkoHandlePool.instance getInstance = staticmethod(getInstance) def getInstallationPath(self): return self.__installationPath def getDictionaryPath(self): return os.path.join(self.getInstallationPath(), "voikko") def __openHandleWithVariant(self, language, fullVariant): logging.debug("VoikkoHandlePool.__openHandleWithVariant") try: voikkoHandle = Voikko(fullVariant, self.getDictionaryPath()) self.__handles[language] = voikkoHandle for booleanOpt, booleanValue in self.__globalBooleanOptions.items(): voikkoHandle.setBooleanOption(booleanOpt, booleanValue) for integerOpt, integerValue in self.__globalIntegerOptions.items(): voikkoHandle.setIntegerOption(integerOpt, integerValue) return voikkoHandle; except VoikkoException as e: self.__initializationErrors[language] = e.args[0] return None def __openHandle(self, language): if self.__preferredGlobalVariant is not None: languageWithVariant = language + "-x-" + self.__preferredGlobalVariant handle = self.__openHandleWithVariant(language, languageWithVariant) if handle is not None: return handle return self.__openHandleWithVariant(language, language) def getHandle(self, locale): language = None if locale.Language == "qlt": language = locale.Variant else: language = locale.Language if language in self.__handles: return self.__handles[language] if language in self.__initializationErrors: return None return self.__openHandle(language) def closeAllHandles(self): for key, value in self.__handles.items(): value.terminate() self.__handles.clear() self.__initializationErrors.clear() def setGlobalBooleanOption(self, option, value): if option in self.__globalBooleanOptions and self.__globalBooleanOptions[option] == value: return self.__globalBooleanOptions[option] = value for lang, handle in self.__handles.items(): handle.setBooleanOption(option, value) def setGlobalIntegerOption(self, option, value): if option in self.__globalIntegerOptions and self.__globalIntegerOptions[option] == value: return self.__globalIntegerOptions[option] = value for lang, handle in self.__handles.items(): handle.setIntegerOption(option, value) def __addLocale(self, locales, language): matchingMappings = self.__bcpToOOoMap[language] for bcpMapping in matchingMappings: locales.append(Locale(bcpMapping.loLanguage, bcpMapping.loRegion, "")) if len(matchingMappings) == 0: if len(language) <= 3: # assume this is ISO 639-1 or ISO 639-3 code locales.append(Locale(language, "", "")) else: locales.append(Locale("qlt", "", language)) def __getSupportedLocalesForOperation(self, localeList, localeOperation): # optimization: if we already have found some locales, don't search for more if len(localeList) == 0: languages = localeOperation(self.getDictionaryPath()) for lang in languages: self.__addLocale(localeList, lang) return tuple(localeList) def getSupportedSpellingLocales(self): return self.__getSupportedLocalesForOperation(self.__supportedSpellingLocales, Voikko.listSupportedSpellingLanguages) def getSupportedHyphenationLocales(self): return self.__getSupportedLocalesForOperation(self.__supportedHyphenationLocales, Voikko.listSupportedHyphenationLanguages) def getSupportedGrammarLocales(self): return self.__getSupportedLocalesForOperation(self.__supportedGrammarCheckingLocales, Voikko.listSupportedGrammarCheckingLanguages) def getInitializationStatus(self): """Returns initialization status diagnostics""" status = "Init OK:[" for key, value in self.__handles.items(): status = status + key + " " status = status + "] FAILED:[" for key, value in self.__initializationErrors.items(): status = status + key + ":'" + value + "' " status = status + "]" return status def setPreferredGlobalVariant(self, variant): if variant != self.__preferredGlobalVariant: self.__preferredGlobalVariant = variant self.closeAllHandles() def setInstallationPath(self, path): self.__installationPath = path searchPath = os.path.join(path, "voikko", platform.system() + "-" + "-".join(platform.architecture())) logging.debug("VoikkoHandlePool.setInstallationPath: library search path is " + searchPath) Voikko.setLibrarySearchPath(searchPath) def getPreferredGlobalVariant(self): return self.__preferredGlobalVariant def __containsLocale(self, localeToFind, locales): for locale in locales: if locale.Language == localeToFind.Language and locale.Country == localeToFind.Country: return True if locale.Language == "qlt" and \ (locale.Variant == localeToFind.Language or (localeToFind.Language == "qlt" and locale.Variant == localeToFind.Variant)): return True if localeToFind.Language == "qlt": # See if we can try again with a trimmed tag: some tags may contain extra # components that can be skipped while matching such as country in crk-Cans-CN tagToFind = localeToFind.Variant tagLen = len(tagToFind) if tagLen > 9 and tagToFind[tagLen - 3] == "-": loc = Locale("qlt", "", tagToFind[0:-3]) return __containsLocale(loc, locales) return False def supportsSpellingLocale(self, locale): return self.__containsLocale(locale, self.getSupportedSpellingLocales()) def supportsHyphenationLocale(self, locale): return self.__containsLocale(locale, self.getSupportedHyphenationLocales()) def supportsGrammarLocale(self, locale): return self.__containsLocale(locale, self.getSupportedGrammarLocales()) VoikkoHandlePool.instance = None VoikkoHandlePool.mutex = RLock() libreoffice-voikko-5.0/oxt/pythonpath/HyphenatedWord.py0000644000000000000000000000260112627600371022137 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import logging import unohelper from com.sun.star.linguistic2 import XHyphenatedWord class HyphenatedWord(unohelper.Base, XHyphenatedWord): def __init__(self, word, pos, locale): self.__word = word self.__hyphenPos = pos self.__locale = locale if word[pos + 1] == '-': self.__hyphenatedWord = word[:pos+1] + word[pos+2:] self.__isAlternative = True else: self.__hyphenatedWord = word self.__isAlternative = False logging.debug("HyphenatedWord.__init__: " + word) logging.debug("HyphenatedWord.__init__: " + str(pos)) def getWord(self): return self.__word def getHyphenatedWord(self): return self.__hyphenatedWord def getLocale(self): return self.__locale def getHyphenationPos(self): return self.__hyphenPos def getHyphenPos(self): return self.__hyphenPos def isAlternativeSpelling(self): return self.__isAlternative libreoffice-voikko-5.0/oxt/pythonpath/SpellAlternatives.py0000644000000000000000000000230012627600371022647 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import unohelper from com.sun.star.linguistic2 import XSpellAlternatives from com.sun.star.linguistic2.SpellFailure import SPELLING_ERROR class SpellAlternatives(unohelper.Base, XSpellAlternatives): def __init__(self, word, alternatives, locale): self.__word = word self.__alternatives = alternatives self.__locale = locale def getWord(self): return self.__word def getLocale(self): return self.__locale def getFailureType(self): # If Voikko supported specific failure types, we could use them here return SPELLING_ERROR def getAlternativesCount(self): return len(self.__alternatives) def getAlternatives(self): return tuple(self.__alternatives) libreoffice-voikko-5.0/oxt/license_en-US.txt0000644000000000000000000010552212627600371017642 0ustar rootroot Libreoffice-voikko © 2005 - 2015 Harri Pitkänen (hatapitk@iki.fi) Spell checker, hyphenator and grammar checker for LibreOffice. This extension uses and may include libvoikko and Suomi-malaga. For more information, see the copyright notices in the source code packages which should have been made available to you by the distributor of this program. This program as a whole may be freely used, and it may be distributed under the GNU General Public License, version 3 or later (see below). GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . libreoffice-voikko-5.0/oxt/license_fi.txt0000644000000000000000000010570012627600371017307 0ustar rootroot Libreoffice-voikko © 2005 - 2015 Harri Pitkänen (hatapitk@iki.fi) Lisäosa oikolukuun, tavutukseen ja kieliopin tarkistukseen LibreOfficelle. Tämä lisäosa käyttää libvoikkoa ja Suomi-malagaa, ja nämä komponentit voivat tulla lisäosan mukana. Tarkempaa tietoa käytetyistä komponenteista ja niiden tekijöistä löydät lähdekoodipaketeista, jotka tämän ohjelman levittäjän on kuulunut laittaa saatavillesi. Tätä ohjelmaa saa kokonaisuudessaan käyttää vapaasti, ja sitä saa levittää edelleen "GNU General Public License"-lisenssin version 3 tai myöhempien ehdoilla (ks. alla). GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . libreoffice-voikko-5.0/oxt/icon.svg0000644000000000000000000000750412627600371016122 0ustar rootroot image/svg+xml libreoffice-voikko-5.0/oxt/SettingsDialog_en_US.properties0000644000000000000000000000107412627600371022574 0ustar rootroot# SettingsDialog strings (English) 0.voikkoasetukset.HelpText= 1.voikkoasetukset.Title=Settings for Voikko 6.voikkoasetukset.hyphenationFrame.HelpText= 7.voikkoasetukset.hyphenationFrame.Label=Hyphenation 8.voikkoasetukset.hyphWordParts.HelpText= 9.voikkoasetukset.hyphWordParts.Label=Apply hyphenation settings to compound word parts 10.voikkoasetukset.hyphUnknownWords.HelpText= 11.voikkoasetukset.hyphUnknownWords.Label=Hyphenate unknown or foreign words 12.voikkoasetukset.vocabularyFrame.Label=Vocabulary 13.voikkoasetukset.topLine.Label=Writing aids based on Voikko libreoffice-voikko-5.0/oxt/SettingsDialog_fi_FI.properties0000644000000000000000000000112412627600371022533 0ustar rootroot# SettingsDialog strings (Finnish) 0.voikkoasetukset.HelpText= 1.voikkoasetukset.Title=Voikon asetukset 6.voikkoasetukset.hyphenationFrame.HelpText= 7.voikkoasetukset.hyphenationFrame.Label=Tavutus 8.voikkoasetukset.hyphWordParts.HelpText= 9.voikkoasetukset.hyphWordParts.Label=Noudata tavutusasetuksia my\u00f6s yhdyssanojen osissa 10.voikkoasetukset.hyphUnknownWords.HelpText= 11.voikkoasetukset.hyphUnknownWords.Label=Tavuta tuntemattomat tai vieraskieliset sanat 12.voikkoasetukset.vocabularyFrame.Label=Sanasto 13.voikkoasetukset.topLine.Label=Voikko-pohjaiset kirjoituksen aputy\u00f6kalut libreoffice-voikko-5.0/oxt/config.xcu0000644000000000000000000000113312627600371016427 0ustar rootroot standard false true libreoffice-voikko-5.0/oxt/SettingsDialog.xdl0000644000000000000000000000432112627600371020074 0ustar rootroot libreoffice-voikko-5.0/oxt/icon.png0000644000000000000000000000371412627600371016106 0ustar rootrootPNG  IHDR7*sBIT|d pHYs4wtEXtSoftwarewww.inkscape.org<IIDAThyu.!$ &Z-MSQSGM3c5A^Q$GIb(.}oaC]d=o?gSDR|}s]e)>)M|%î\J7`JM"ʆJ܊ y"[DMTW%ԗyv;%/eF,Qn'-"+3#v/J2">wڷlANI燳jN8gG7t˜iXI,&&R o$>."˜R!|h'U{,E.Ngrxdvدe~ڲMV8: ."õch\n no8/˾BK7 `;QR1xmv5&x2tts'DtF䔮6dD=mfcX0xi/n% #X{9j@* N9 B)RJQЍ2~= SM~577zj]Sم?_ZdIENDB`libreoffice-voikko-5.0/oxt/voikko.components0000644000000000000000000000140512627600371020054 0ustar rootroot libreoffice-voikko-5.0/oxt/Linguistic.xcu0000644000000000000000000000153012627600371017275 0ustar rootroot fi-FI voikko.GrammarChecker libreoffice-voikko-5.0/oxt/SettingsDialog.xcu0000644000000000000000000000202312627600371020101 0ustar rootroot org.puimula.ooovoikko Voikko Voikko %origin%/SettingsDialog.xdl org.puimula.ooovoikko.SettingsEventHandlerImplementation libreoffice-voikko-5.0/oxt/META-INF/0000755000000000000000000000000012627600371015603 5ustar rootrootlibreoffice-voikko-5.0/oxt/META-INF/manifest.xml0000644000000000000000000000157512627600371020143 0ustar rootroot libreoffice-voikko-5.0/oxt/lovoikko.py0000644000000000000000000000346112627600371016656 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. import os import logging import unohelper from SettingsEventHandler import SettingsEventHandler from SpellChecker import SpellChecker from Hyphenator import Hyphenator from GrammarChecker import GrammarChecker from PropertyManager import PropertyManager if "VOIKKO_DEBUG" in os.environ: logging.getLogger().setLevel(logging.DEBUG) # name of g_ImplementationHelper is significant, Python component loader expects to find it g_ImplementationHelper = unohelper.ImplementationHelper() g_ImplementationHelper.addImplementation(SettingsEventHandler, \ SettingsEventHandler.IMPLEMENTATION_NAME, SettingsEventHandler.SUPPORTED_SERVICE_NAMES,) g_ImplementationHelper.addImplementation(SpellChecker, \ SpellChecker.IMPLEMENTATION_NAME, SpellChecker.SUPPORTED_SERVICE_NAMES,) g_ImplementationHelper.addImplementation(Hyphenator, \ Hyphenator.IMPLEMENTATION_NAME, Hyphenator.SUPPORTED_SERVICE_NAMES,) g_ImplementationHelper.addImplementation(GrammarChecker, \ GrammarChecker.IMPLEMENTATION_NAME, GrammarChecker.SUPPORTED_SERVICE_NAMES,) # Force initialization of property manager so that it is done before anything else PropertyManager.getInstance() libreoffice-voikko-5.0/Makefile0000644000000000000000000001175212627600371015277 0ustar rootroot# Libreoffice-voikko: Linguistic extension for LibreOffice # Copyright (C) 2005 - 2015 Harri Pitkänen # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. # # Alternatively, the contents of this file may be used under the terms of # the GNU General Public License Version 3 or later (the "GPL"), in which # case the provisions of the GPL are applicable instead of those above. ############################################################################### # ===== Build settings ===== # Version number of the libreoffice-voikko extension VOIKKO_VERSION=5.0 # If you want to have a license text to be displayed upon the installation # of this extension, uncomment the following. # SHOW_LICENSE=1 # Setting this option to 1 causes ugly warnings to be added to visible places # in the extension without removing any functionality (codename "tekstintuho"). # Useful for binary builds that are released for public testing. # SHOW_UGLY_WARNINGS=1 # Destination directory when installing unpacked extension with # make install-unpacked DESTDIR=/usr/lib/libreoffice-voikko # Uncomment the following if you want to build a standalone extension. # Files to be delivered with the extension must be placed under directory voikko/ # and libvoikko.py under oxt/pythonpath/ # STANDALONE_EXTENSION=1 # === End build settings === # Platform specific variables ifdef SystemRoot # Windows COPYDIR=xcopy /E /I COPY=copy PS="\" MKDIR=mkdir else COPYDIR=cp -r COPY=cp PS="/" MKDIR=mkdir -p endif ZIP=zip SED=sed FIND=find # Build extension package name ifdef SHOW_UGLY_WARNINGS VOIKKO_PACKAGENAME:=tekstintuho else VOIKKO_PACKAGENAME:=voikko endif SRC_AND_DIST=config.xcu config.xcs icon.png SettingsDialog.xdl SettingsDialog_en_US.properties \ SettingsDialog_fi_FI.properties SettingsDialog_en_US.default SettingsDialog.xcu Linguistic.xcu \ voikko.components META-INF/manifest.xml lovoikko.py \ pythonpath/SettingsEventHandler.py pythonpath/SpellChecker.py pythonpath/VoikkoHandlePool.py \ pythonpath/SpellAlternatives.py pythonpath/PropertyManager.py pythonpath/Hyphenator.py \ pythonpath/HyphenatedWord.py pythonpath/PossibleHyphens.py pythonpath/GrammarChecker.py SRCDIST=COPYING Makefile README ChangeLog oxt/description.xml.template \ $(patsubst %,oxt/%,$(SRC_AND_DIST)) \ oxt/icon.svg oxt/license_fi.txt oxt/license_en-US.txt COPY_TEMPLATES=$(SRC_AND_DIST) ifdef SHOW_LICENSE COPY_TEMPLATES+=license_fi.txt license_en-US.txt endif ifdef STANDALONE_EXTENSION STANDALONE_EXTENSION_FILES=$(shell find voikko -type f '!' -name '.*' '!' -path 'voikko*/.*') COPY_TEMPLATES+=pythonpath/libvoikko.py else STANDALONE_EXTENSION_FILES= endif EXTENSION_FILES=build/oxt/description.xml \ $(patsubst %,build/oxt/%,$(STANDALONE_EXTENSION_FILES)) \ $(patsubst %,build/oxt/%,$(COPY_TEMPLATES)) # Targets .PHONY: extension-files oxt install-unpacked all clean dist-gzip extension-files : $(EXTENSION_FILES) oxt: $(EXTENSION_FILES) cd build/oxt && $(ZIP) -r -9 ../$(VOIKKO_PACKAGENAME).oxt \ $(patsubst build/oxt/%,%,$^) all: oxt install-unpacked: extension-files install -m 755 -d "$(DESTDIR)" "$(DESTDIR)/META-INF" install -m 644 build/oxt/META-INF/manifest.xml "$(DESTDIR)/META-INF" install -m 644 build/oxt/description.xml \ $(patsubst %,build/oxt/%,$(STANDALONE_EXTENSION_FILES)) \ $(patsubst %,build/oxt/%,$(COPY_TEMPLATES)) $(DESTDIR) # Sed scripts for modifying templates DESCRIPTION_SEDSCRIPT:=s/VOIKKO_VERSION/$(VOIKKO_VERSION)/g ifdef SHOW_LICENSE DESCRIPTION_SEDSCRIPT:=$(DESCRIPTION_SEDSCRIPT);/SHOW_LICENSE/d endif ifdef SHOW_UGLY_WARNINGS DESCRIPTION_SEDSCRIPT:=$(DESCRIPTION_SEDSCRIPT);s/Voikko/TEKSTINTUHO/g endif DESCRIPTION_SEDSCRIPT:="$(DESCRIPTION_SEDSCRIPT)" # Create extension files build/oxt/description.xml: oxt/description.xml.template -$(MKDIR) $(subst /,$(PS),$(@D)) $(SED) -e $(DESCRIPTION_SEDSCRIPT) < $^ > $@ $(patsubst %,build/oxt/%,$(COPY_TEMPLATES)): build/oxt/%: oxt/% -$(MKDIR) $(subst /,$(PS),$(@D)) $(COPY) "$(subst /,$(PS),$^)" "$(subst /,$(PS),$@)" $(patsubst %,build/oxt/%,$(STANDALONE_EXTENSION_FILES)): build/oxt/%: % -$(MKDIR) $(subst /,$(PS),$(@D)) $(COPYDIR) "$(subst /,$(PS),$^)" "$(subst /,$(PS),$@)" # Rules for creating the source distribution dist-gzip: libreoffice-voikko-$(VOIKKO_VERSION).tar.gz libreoffice-voikko-$(VOIKKO_VERSION).tar.gz: $(patsubst %,libreoffice-voikko-$(VOIKKO_VERSION)/%, \ $(sort $(SRCDIST))) tar c --group 0 --owner 0 libreoffice-voikko-$(VOIKKO_VERSION) | gzip -9 > $@ $(patsubst %,libreoffice-voikko-$(VOIKKO_VERSION)/%, $(sort $(SRCDIST))): \ libreoffice-voikko-$(VOIKKO_VERSION)/%: % install --mode=644 -D $^ $@ # The clean target clean: rm -rf build libreoffice-voikko-$(VOIKKO_VERSION) rm -f libreoffice-voikko-$(VOIKKO_VERSION).tar.gz