sc/Library_sc.mk | 1 sc/source/ui/app/scmod.cxx | 60 +++++++++++++++++++++++++++++- sc/source/ui/app/scmod2.cxx | 88 -------------------------------------------- 3 files changed, 58 insertions(+), 91 deletions(-)
New commits: commit d7916449d7ecb5247f2b61a7b6cb21cfb0a1e6b3 Author: Marcos Paulo de Souza <marcos.souza....@gmail.com> Date: Thu Feb 13 19:55:04 2014 -0200 Unify scmod and scmod2 Change-Id: Ib086ba744ac3f5fbd8e96ceda73e9fe2d578929f Reviewed-on: https://gerrit.libreoffice.org/8036 Reviewed-by: Marcos Souza <marcos.souza....@gmail.com> Tested-by: Marcos Souza <marcos.souza....@gmail.com> diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 2b2ef76..c723a4e 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -365,7 +365,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/app/rfindlst \ sc/source/ui/app/scdll \ sc/source/ui/app/scmod \ - sc/source/ui/app/scmod2 \ sc/source/ui/app/seltrans \ sc/source/ui/app/transobj \ sc/source/ui/app/typemap \ diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 41dde36..0a0cbd7 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -61,6 +61,13 @@ #include <svx/svxerr.hxx> #include <tools/diagnose_ex.h> +#include <editeng/unolingu.hxx> +#include <unotools/lingucfg.hxx> +#include <i18nlangtag/mslangid.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/lang/Locale.hpp> #include "scmod.hxx" #include "global.hxx" @@ -2222,8 +2229,6 @@ SfxTabPage* ScModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const Sfx return pRet; } -//------------------------------------------------------------------ - IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo ) { //! mit ScFieldEditEngine zusammenfassen !!! @@ -2392,4 +2397,55 @@ void ScModule::PopAnyRefDlg() } } +using namespace com::sun::star; + +#define LINGUPROP_AUTOSPELL "IsSpellAuto" + +void ScModule::GetSpellSettings( sal_uInt16& rDefLang, sal_uInt16& rCjkLang, sal_uInt16& rCtlLang, + bool& rAutoSpell ) +{ + // use SvtLinguConfig instead of service LinguProperties to avoid + // loading the linguistic component + SvtLinguConfig aConfig; + + SvtLinguOptions aOptions; + aConfig.GetOptions( aOptions ); + + rDefLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN); + rCjkLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN); + rCtlLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX); + rAutoSpell = aOptions.bIsSpellAuto; +} + +void ScModule::SetAutoSpellProperty( sal_Bool bSet ) +{ + // use SvtLinguConfig instead of service LinguProperties to avoid + // loading the linguistic component + SvtLinguConfig aConfig; + + uno::Any aAny; + aAny <<= bSet; + aConfig.SetProperty( OUString( LINGUPROP_AUTOSPELL ), aAny ); +} + +sal_Bool ScModule::HasThesaurusLanguage( sal_uInt16 nLang ) +{ + if ( nLang == LANGUAGE_NONE ) + return false; + + sal_Bool bHasLang = false; + try + { + uno::Reference< linguistic2::XThesaurus > xThes(LinguMgr::GetThesaurus()); + if ( xThes.is() ) + bHasLang = xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ); + } + catch( uno::Exception& ) + { + OSL_FAIL("Error in Thesaurus"); + } + + return bHasLang; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/app/scmod2.cxx b/sc/source/ui/app/scmod2.cxx deleted file mode 100644 index 962cbdd..0000000 --- a/sc/source/ui/app/scmod2.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <editeng/unolingu.hxx> -#include <unotools/lingucfg.hxx> -#include <i18nlangtag/mslangid.hxx> -#include <i18nlangtag/languagetag.hxx> -#include <com/sun/star/i18n/ScriptType.hpp> -#include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/lang/Locale.hpp> - -using namespace com::sun::star; - -#include "scmod.hxx" - -//------------------------------------------------------------------ - -#define LINGUPROP_AUTOSPELL "IsSpellAuto" - -//------------------------------------------------------------------ - -void ScModule::GetSpellSettings( sal_uInt16& rDefLang, sal_uInt16& rCjkLang, sal_uInt16& rCtlLang, - bool& rAutoSpell ) -{ - // use SvtLinguConfig instead of service LinguProperties to avoid - // loading the linguistic component - SvtLinguConfig aConfig; - - SvtLinguOptions aOptions; - aConfig.GetOptions( aOptions ); - - rDefLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN); - rCjkLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN); - rCtlLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX); - rAutoSpell = aOptions.bIsSpellAuto; -} - -void ScModule::SetAutoSpellProperty( sal_Bool bSet ) -{ - // use SvtLinguConfig instead of service LinguProperties to avoid - // loading the linguistic component - SvtLinguConfig aConfig; - - uno::Any aAny; - aAny <<= bSet; - aConfig.SetProperty( OUString( LINGUPROP_AUTOSPELL ), aAny ); -} - - - -sal_Bool ScModule::HasThesaurusLanguage( sal_uInt16 nLang ) -{ - if ( nLang == LANGUAGE_NONE ) - return false; - - sal_Bool bHasLang = false; - try - { - uno::Reference< linguistic2::XThesaurus > xThes(LinguMgr::GetThesaurus()); - if ( xThes.is() ) - bHasLang = xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ); - } - catch( uno::Exception& ) - { - OSL_FAIL("Error in Thesaurus"); - } - - return bHasLang; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits