Unify scmod and scmod2
Change-Id: Ib086ba744ac3f5fbd8e96ceda73e9fe2d578929f Reviewed-on: https://gerrit.libreoffice.org/8036 Reviewed-by: Marcos Souza <marcos.souza.org@gmail.com> Tested-by: Marcos Souza <marcos.souza.org@gmail.com>
This commit is contained in:
committed by
Marcos Souza
parent
53e3d79c63
commit
d7916449d7
@@ -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 \
|
||||
|
@@ -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: */
|
||||
|
@@ -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: */
|
Reference in New Issue
Block a user