summaryrefslogtreecommitdiff
path: root/cui/source/options/optlingu.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/options/optlingu.cxx')
-rw-r--r--cui/source/options/optlingu.cxx384
1 files changed, 245 insertions, 139 deletions
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index ada93128e6e1..4ec9bd987462 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -17,10 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <utility>
#include <vcl/settings.hxx>
#include <vcl/weld.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>
+#include <o3tl/safeint.hxx>
+#include <officecfg/Office/Security.hxx>
+#include <officecfg/Office/Linguistic.hxx>
#include <unotools/lingucfg.hxx>
#include <unotools/linguprops.hxx>
#include <editeng/unolingu.hxx>
@@ -28,7 +32,9 @@
#include <sfx2/sfxsids.hrc>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <comphelper/dispatchcommand.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/linguistic2/LinguServiceManager.hpp>
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
@@ -41,6 +47,8 @@
#include <com/sun/star/linguistic2/XLinguProperties.hpp>
#include <com/sun/star/lang/XServiceDisplayName.hpp>
#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <unotools/extendedsecurityoptions.hxx>
#include <svl/eitem.hxx>
#include <vcl/svapp.hxx>
@@ -55,6 +63,7 @@
#include <ucbhelper/content.hxx>
+#include <set>
#include <vector>
#include <map>
@@ -65,15 +74,15 @@ using namespace css::uno;
using namespace css::linguistic2;
using namespace css::beans;
-const char cSpell[] = SN_SPELLCHECKER;
-const char cGrammar[] = SN_GRAMMARCHECKER;
-const char cHyph[] = SN_HYPHENATOR;
-const char cThes[] = SN_THESAURUS;
+constexpr OUString cSpell(SN_SPELLCHECKER);
+constexpr OUString cGrammar(SN_GRAMMARCHECKER);
+constexpr OUString cHyph(SN_HYPHENATOR);
+constexpr OUString cThes(SN_THESAURUS);
// static ----------------------------------------------------------------
static sal_Int32 lcl_SeqGetEntryPos(
- const Sequence< OUString > &rSeq, const OUString &rEntry )
+ const Sequence< OUString > &rSeq, std::u16string_view rEntry )
{
sal_Int32 i;
sal_Int32 nLen = rSeq.getLength();
@@ -125,12 +134,12 @@ class ModuleUserData_Impl
OUString sImplName;
public:
- ModuleUserData_Impl( const OUString& sImpName, bool bIsParent, bool bChecked, sal_uInt8 nSetType, sal_uInt8 nSetIndex ) :
+ ModuleUserData_Impl( OUString sImpName, bool bIsParent, bool bChecked, sal_uInt8 nSetType, sal_uInt8 nSetIndex ) :
bParent(bIsParent),
bIsChecked(bChecked),
nType(nSetType),
nIndex(nSetIndex),
- sImplName(sImpName)
+ sImplName(std::move(sImpName))
{
}
bool IsParent() const {return bParent;}
@@ -189,31 +198,31 @@ enum EID_OPTIONS
EID_NUM_PRE_BREAK,
EID_NUM_POST_BREAK,
EID_HYPH_AUTO,
- EID_HYPH_SPECIAL
+ EID_HYPH_SPECIAL,
+ EID_SPELL_CLOSED_COMPOUND,
+ EID_SPELL_HYPHENATED_COMPOUND
};
}
-//! this array must have an entry for every value of EID_OPTIONS.
-// It is used to get the respective property name.
-static const char * aEidToPropName[] =
-{
- UPN_IS_SPELL_AUTO, // EID_SPELL_AUTO
- UPN_IS_GRAMMAR_AUTO, // EID_GRAMMAR_AUTO
- UPN_IS_SPELL_UPPER_CASE, // EID_CAPITAL_WORDS
- UPN_IS_SPELL_WITH_DIGITS, // EID_WORDS_WITH_DIGITS
- UPN_IS_SPELL_SPECIAL, // EID_SPELL_SPECIAL
- UPN_HYPH_MIN_WORD_LENGTH, // EID_NUM_MIN_WORDLEN,
- UPN_HYPH_MIN_LEADING, // EID_NUM_PRE_BREAK
- UPN_HYPH_MIN_TRAILING, // EID_NUM_POST_BREAK
- UPN_IS_HYPH_AUTO, // EID_HYPH_AUTO
- UPN_IS_HYPH_SPECIAL // EID_HYPH_SPECIAL
-};
-
static OUString lcl_GetPropertyName( EID_OPTIONS eEntryId )
{
- DBG_ASSERT( static_cast<unsigned int>(eEntryId) < SAL_N_ELEMENTS(aEidToPropName), "index out of range" );
- return OUString::createFromAscii( aEidToPropName[ static_cast<int>(eEntryId) ] );
+ switch (eEntryId)
+ {
+ case EID_SPELL_AUTO: return UPN_IS_SPELL_AUTO;
+ case EID_GRAMMAR_AUTO: return UPN_IS_GRAMMAR_AUTO;
+ case EID_CAPITAL_WORDS: return UPN_IS_SPELL_UPPER_CASE;
+ case EID_SPELL_CLOSED_COMPOUND: return UPN_IS_SPELL_CLOSED_COMPOUND;
+ case EID_SPELL_HYPHENATED_COMPOUND: return UPN_IS_SPELL_HYPHENATED_COMPOUND;
+ case EID_WORDS_WITH_DIGITS: return UPN_IS_SPELL_WITH_DIGITS;
+ case EID_SPELL_SPECIAL: return UPN_IS_SPELL_SPECIAL;
+ case EID_NUM_MIN_WORDLEN: return UPN_HYPH_MIN_WORD_LENGTH;
+ case EID_NUM_PRE_BREAK: return UPN_HYPH_MIN_LEADING;
+ case EID_NUM_POST_BREAK: return UPN_HYPH_MIN_TRAILING;
+ case EID_HYPH_AUTO: return UPN_IS_HYPH_AUTO;
+ case EID_HYPH_SPECIAL: return UPN_IS_HYPH_SPECIAL;
+ default: assert (false); abort();
+ }
}
namespace {
@@ -324,6 +333,22 @@ struct ServiceInfo_Impl
ServiceInfo_Impl() : bConfigured(false) {}
};
+struct Locale_less
+{
+ bool operator()(const css::lang::Locale& lhs, const css::lang::Locale& rhs) const
+ {
+ if (lhs.Language < rhs.Language)
+ return true;
+ if (lhs.Language > rhs.Language)
+ return false;
+ if (lhs.Country < rhs.Country)
+ return true;
+ if (lhs.Country > rhs.Country)
+ return false;
+ return lhs.Variant < rhs.Variant;
+ }
+};
+
}
typedef std::vector< ServiceInfo_Impl > ServiceInfoArr;
@@ -338,7 +363,7 @@ class SvxLinguData_Impl
ServiceInfoArr aDisplayServiceArr;
sal_uInt32 nDisplayServices;
- Sequence< Locale > aAllServiceLocales;
+ std::set<Locale, Locale_less> aAllServiceLocales;
LangImplNameTable aCfgSpellTable;
LangImplNameTable aCfgHyphTable;
LangImplNameTable aCfgThesTable;
@@ -355,9 +380,9 @@ public:
uno::Reference<XLinguServiceManager2> & GetManager() { return xLinguSrvcMgr; }
void SetChecked( const Sequence< OUString > &rConfiguredServices );
- void Reconfigure( const OUString &rDisplayName, bool bEnable );
+ void Reconfigure( std::u16string_view rDisplayName, bool bEnable );
- const Sequence<Locale> & GetAllSupportedLocales() const { return aAllServiceLocales; }
+ const auto& GetAllSupportedLocales() const { return aAllServiceLocales; }
LangImplNameTable & GetSpellTable() { return aCfgSpellTable; }
LangImplNameTable & GetHyphTable() { return aCfgHyphTable; }
@@ -378,11 +403,11 @@ public:
// language.
Sequence< OUString > GetSortedImplNames( LanguageType nLang, sal_uInt8 nType );
- ServiceInfo_Impl * GetInfoByImplName( const OUString &rSvcImplName );
+ ServiceInfo_Impl * GetInfoByImplName( std::u16string_view rSvcImplName );
};
-static sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, const OUString &rTxt )
+static sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, std::u16string_view rTxt )
{
sal_Int32 nRes = -1;
sal_Int32 nLen = rSeq.getLength();
@@ -415,12 +440,12 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang,
if (pTable->count( nLang ))
aRes = (*pTable)[ nLang ]; // add configured services
sal_Int32 nIdx = aRes.getLength();
- DBG_ASSERT( static_cast<sal_Int32>(nDisplayServices) >= nIdx, "size mismatch" );
+ DBG_ASSERT( nDisplayServices >= o3tl::make_unsigned(nIdx), "size mismatch" );
aRes.realloc( nDisplayServices );
OUString *pRes = aRes.getArray();
// add not configured services
- for (sal_Int32 i = 0; i < static_cast<sal_Int32>(nDisplayServices); ++i)
+ for (sal_uInt32 i = 0; i < nDisplayServices; ++i)
{
const ServiceInfo_Impl &rInfo = aDisplayServiceArr[ i ];
OUString aImplName;
@@ -447,7 +472,7 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang,
}
-ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( const OUString &rSvcImplName )
+ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( std::u16string_view rSvcImplName )
{
for (sal_uInt32 i = 0; i < nDisplayServices; ++i)
{
@@ -463,37 +488,6 @@ ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( const OUString &rSvcImp
return nullptr;
}
-
-static void lcl_MergeLocales(Sequence< Locale >& aAllLocales, const Sequence< Locale >& rAdd)
-{
- Sequence<Locale> aLocToAdd(rAdd.getLength());
- Locale* pLocToAdd = aLocToAdd.getArray();
- sal_Int32 nFound = 0;
- for(const Locale& i : rAdd)
- {
- bool bFound = false;
- for(const Locale& j : std::as_const(aAllLocales))
- {
- if (i.Language == j.Language &&
- i.Country == j.Country &&
- i.Variant == j.Variant)
- {
- bFound = true;
- break;
- }
- }
- if(!bFound)
- {
- pLocToAdd[nFound++] = i;
- }
- }
- sal_Int32 nLength = aAllLocales.getLength();
- aAllLocales.realloc( nLength + nFound);
- Locale* pAllLocales2 = aAllLocales.getArray();
- for(sal_Int32 i = 0; i < nFound; i++)
- pAllLocales2[nLength++] = pLocToAdd[i];
-}
-
static void lcl_MergeDisplayArray(
SvxLinguData_Impl &rData,
const ServiceInfo_Impl &rToAdd )
@@ -554,9 +548,12 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
uno::Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
xLinguSrvcMgr = LinguServiceManager::create(xContext);
- const Locale& rCurrentLocale = Application::GetSettings().GetLanguageTag().getLocale();
- Sequence<Any> aArgs(2);//second arguments has to be empty!
- aArgs.getArray()[0] <<= LinguMgr::GetLinguPropertySet();
+ const Locale& rCurrentLocale = Application::GetSettings().GetUILanguageTag().getLocale();
+ Sequence<Any> aArgs
+ {
+ Any(LinguMgr::GetLinguPropertySet()),
+ Any() // second argument has to be empty!
+ };
//read spell checker
const Sequence< OUString > aSpellNames = xLinguSrvcMgr->getAvailableServices(
@@ -577,7 +574,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
//! suppress display of entries with no supported languages (see feature 110994)
if (aLocales.hasElements())
{
- lcl_MergeLocales( aAllServiceLocales, aLocales );
+ aAllServiceLocales.insert(aLocales.begin(), aLocales.end());
lcl_MergeDisplayArray( *this, aInfo );
}
}
@@ -600,7 +597,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
//! suppress display of entries with no supported languages (see feature 110994)
if (aLocales.hasElements())
{
- lcl_MergeLocales( aAllServiceLocales, aLocales );
+ aAllServiceLocales.insert(aLocales.begin(), aLocales.end());
lcl_MergeDisplayArray( *this, aInfo );
}
}
@@ -622,7 +619,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
//! suppress display of entries with no supported languages (see feature 110994)
if (aLocales.hasElements())
{
- lcl_MergeLocales( aAllServiceLocales, aLocales );
+ aAllServiceLocales.insert(aLocales.begin(), aLocales.end());
lcl_MergeDisplayArray( *this, aInfo );
}
}
@@ -644,13 +641,13 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
//! suppress display of entries with no supported languages (see feature 110994)
if (aLocales.hasElements())
{
- lcl_MergeLocales( aAllServiceLocales, aLocales );
+ aAllServiceLocales.insert(aLocales.begin(), aLocales.end());
lcl_MergeDisplayArray( *this, aInfo );
}
}
Sequence< OUString > aCfgSvcs;
- for(auto const & locale : std::as_const(aAllServiceLocales))
+ for (auto const& locale : aAllServiceLocales)
{
LanguageType nLang = LanguageTag::convertToLanguageType( locale );
@@ -728,9 +725,9 @@ bool SvxLinguData_Impl::AddRemove(
}
-void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable )
+void SvxLinguData_Impl::Reconfigure( std::u16string_view rDisplayName, bool bEnable )
{
- DBG_ASSERT( !rDisplayName.isEmpty(), "empty DisplayName" );
+ DBG_ASSERT( !rDisplayName.empty(), "empty DisplayName" );
ServiceInfo_Impl *pInfo = nullptr;
for (sal_uInt32 i = 0; i < nDisplayServices; ++i)
@@ -823,16 +820,18 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable
SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optlingupage.ui", "OptLinguPage", &rSet)
- , sCapitalWords (CuiResId(RID_SVXSTR_CAPITAL_WORDS))
- , sWordsWithDigits(CuiResId(RID_SVXSTR_WORDS_WITH_DIGITS))
- , sSpellSpecial (CuiResId(RID_SVXSTR_SPELL_SPECIAL))
- , sSpellAuto (CuiResId(RID_SVXSTR_SPELL_AUTO))
- , sGrammarAuto (CuiResId(RID_SVXSTR_GRAMMAR_AUTO))
- , sNumMinWordlen (CuiResId(RID_SVXSTR_NUM_MIN_WORDLEN))
- , sNumPreBreak (CuiResId(RID_SVXSTR_NUM_PRE_BREAK))
- , sNumPostBreak (CuiResId(RID_SVXSTR_NUM_POST_BREAK))
- , sHyphAuto (CuiResId(RID_SVXSTR_HYPH_AUTO))
- , sHyphSpecial (CuiResId(RID_SVXSTR_HYPH_SPECIAL))
+ , sCapitalWords (CuiResId(RID_CUISTR_CAPITAL_WORDS))
+ , sWordsWithDigits(CuiResId(RID_CUISTR_WORDS_WITH_DIGITS))
+ , sSpellSpecial (CuiResId(RID_CUISTR_SPELL_SPECIAL))
+ , sSpellAuto (CuiResId(RID_CUISTR_SPELL_AUTO))
+ , sSpellClosedCompound (CuiResId(RID_CUISTR_SPELL_CLOSED_COMPOUND))
+ , sSpellHyphenatedCompound (CuiResId(RID_CUISTR_SPELL_HYPHENATED_COMPOUND))
+ , sGrammarAuto (CuiResId(RID_CUISTR_GRAMMAR_AUTO))
+ , sNumMinWordlen (CuiResId(RID_CUISTR_NUM_MIN_WORDLEN))
+ , sNumPreBreak (CuiResId(RID_CUISTR_NUM_PRE_BREAK))
+ , sNumPostBreak (CuiResId(RID_CUISTR_NUM_POST_BREAK))
+ , sHyphAuto (CuiResId(RID_CUISTR_HYPH_AUTO))
+ , sHyphSpecial (CuiResId(RID_CUISTR_HYPH_SPECIAL))
, nUPN_HYPH_MIN_WORD_LENGTH(-1)
, nUPN_HYPH_MIN_LEADING(-1)
, nUPN_HYPH_MIN_TRAILING(-1)
@@ -847,6 +846,7 @@ SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController*
, m_xLinguDicsDelPB(m_xBuilder->weld_button("lingudictsdelete"))
, m_xLinguOptionsCLB(m_xBuilder->weld_tree_view("linguoptions"))
, m_xLinguOptionsEditPB(m_xBuilder->weld_button("linguoptionsedit"))
+ , m_xMoreDictsBox(m_xBuilder->weld_box("moredictsbox"))
, m_xMoreDictsLink(m_xBuilder->weld_link_button("moredictslink"))
{
m_xLinguModulesCLB->enable_toggle_buttons(weld::ColumnToggleType::Check);
@@ -870,8 +870,17 @@ SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController*
m_xLinguOptionsCLB->connect_changed( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
m_xLinguOptionsCLB->connect_row_activated(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
- if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
- m_xMoreDictsLink->hide();
+ m_xMoreDictsLink->connect_activate_link(LINK(this, SvxLinguTabPage, OnLinkClick));
+ if (officecfg::Office::Security::Hyperlinks::Open::get() == SvtExtendedSecurityOptions::OPEN_NEVER)
+ m_xMoreDictsBox->hide();
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ // hide User-defined Dictionaries part
+ m_xBuilder->weld_frame("dictsframe")->hide();
+ // hide Get more dictionaries URL + icon
+ m_xMoreDictsBox->hide();
+ }
xProp = LinguMgr::GetLinguPropertySet();
xDicList.set( LinguMgr::GetDictionaryList() );
@@ -915,6 +924,22 @@ std::unique_ptr<SfxTabPage> SvxLinguTabPage::Create( weld::Container* pPage, wel
return std::make_unique<SvxLinguTabPage>( pPage, pController, *rAttrSet );
}
+OUString SvxLinguTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "lingumodulesft", "lingudictsft", "label4" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ sAllStrings += m_xMoreDictsLink->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
{
bool bModified = true; // !!!!
@@ -998,12 +1023,8 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
if (LinguMgr::GetIgnoreAllList() == xDic)
bChecked = true;
xDic->setActive( bChecked );
-
if (bChecked)
- {
- OUString aDicName( xDic->getName() );
- pActiveDic[ nActiveDics++ ] = aDicName;
- }
+ pActiveDic[nActiveDics++] = xDic->getName();
}
}
}
@@ -1042,7 +1063,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
OptionsUserData aPostBreakData(m_xLinguOptionsCLB->get_id(EID_NUM_POST_BREAK).toUInt32());
if ( aPreBreakData.IsModified() || aPostBreakData.IsModified() )
{
- SfxHyphenRegionItem aHyp( GetWhich( SID_ATTR_HYPHENREGION ) );
+ SfxHyphenRegionItem aHyp( SID_ATTR_HYPHENREGION );
aHyp.GetMinLead() = static_cast<sal_uInt8>(aPreBreakData.GetNumericValue());
aHyp.GetMinTrail() = static_cast<sal_uInt8>(aPostBreakData.GetNumericValue());
rCoreSet->Put( aHyp );
@@ -1053,8 +1074,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
const SfxPoolItem* pOld = GetOldItem( *rCoreSet, SID_AUTOSPELL_CHECK );
if ( !pOld || static_cast<const SfxBoolItem*>(pOld)->GetValue() != bNewAutoCheck )
{
- rCoreSet->Put( SfxBoolItem( GetWhich( SID_AUTOSPELL_CHECK ),
- bNewAutoCheck ) );
+ rCoreSet->Put( SfxBoolItem( SID_AUTOSPELL_CHECK, bNewAutoCheck ) );
bModified = true;
}
@@ -1135,7 +1155,7 @@ void SvxLinguTabPage::UpdateModulesBox_Impl()
{
const ServiceInfo_Impl &rInfo = rAllDispSrvcArr[i];
m_xLinguModulesCLB->append();
- m_xLinguModulesCLB->set_id(i, OUString::number(reinterpret_cast<sal_Int64>(&rInfo)));
+ m_xLinguModulesCLB->set_id(i, weld::toId(&rInfo));
m_xLinguModulesCLB->set_toggle(i, rInfo.bConfigured ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguModulesCLB->set_text(i, rInfo.sDisplayName, 0);
}
@@ -1179,6 +1199,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sSpellAuto, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_AUTO));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1188,6 +1209,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sGrammarAuto, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_GRAMMAR_AUTO));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1197,6 +1219,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sCapitalWords, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_UPPER_CASE));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1206,6 +1229,27 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sWordsWithDigits, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_WITH_DIGITS));
+
+ m_xLinguOptionsCLB->append();
+ ++nEntry;
+
+ aLngCfg.GetProperty( UPN_IS_SPELL_CLOSED_COMPOUND ) >>= bVal;
+ nUserData = OptionsUserData( EID_SPELL_CLOSED_COMPOUND, false, 0, true, bVal).GetUserData();
+ m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xLinguOptionsCLB->set_text(nEntry, sSpellClosedCompound, 0);
+ m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_CLOSED_COMPOUND));
+
+ m_xLinguOptionsCLB->append();
+ ++nEntry;
+
+ aLngCfg.GetProperty( UPN_IS_SPELL_HYPHENATED_COMPOUND ) >>= bVal;
+ nUserData = OptionsUserData( EID_SPELL_HYPHENATED_COMPOUND, false, 0, true, bVal).GetUserData();
+ m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xLinguOptionsCLB->set_text(nEntry, sSpellHyphenatedCompound, 0);
+ m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_HYPHENATED_COMPOUND));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1215,6 +1259,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sSpellSpecial, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_SPELL_SPECIAL));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1223,12 +1268,12 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
nUserData = OptionsUserData( EID_NUM_MIN_WORDLEN, true, static_cast<sal_uInt16>(nVal), false, false).GetUserData();
m_xLinguOptionsCLB->set_text(nEntry, sNumMinWordlen + " " + OUString::number(nVal), 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_HYPH_MIN_WORD_LENGTH));
nUPN_HYPH_MIN_WORD_LENGTH = nEntry;
const SfxHyphenRegionItem *pHyp = nullptr;
- sal_uInt16 nWhich = GetWhich( SID_ATTR_HYPHENREGION );
- if ( rSet->GetItemState( nWhich, false ) == SfxItemState::SET )
- pHyp = &static_cast<const SfxHyphenRegionItem &>( rSet->Get( nWhich ) );
+ if ( rSet->GetItemState( SID_ATTR_HYPHENREGION, false ) == SfxItemState::SET )
+ pHyp = & rSet->Get( SID_ATTR_HYPHENREGION );
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1239,6 +1284,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
nUserData = OptionsUserData( EID_NUM_PRE_BREAK, true, static_cast<sal_uInt16>(nVal), false, false).GetUserData();
m_xLinguOptionsCLB->set_text(nEntry, sNumPreBreak + " " + OUString::number(nVal), 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_HYPH_MIN_LEADING));
nUPN_HYPH_MIN_LEADING = nEntry;
m_xLinguOptionsCLB->append();
@@ -1250,6 +1296,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
nUserData = OptionsUserData( EID_NUM_POST_BREAK, true, static_cast<sal_uInt16>(nVal), false, false).GetUserData();
m_xLinguOptionsCLB->set_text(nEntry, sNumPostBreak + " " + OUString::number(nVal), 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_HYPH_MIN_TRAILING));
nUPN_HYPH_MIN_TRAILING = nEntry;
m_xLinguOptionsCLB->append();
@@ -1260,6 +1307,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sHyphAuto, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_HYPH_AUTO));
m_xLinguOptionsCLB->append();
++nEntry;
@@ -1269,6 +1317,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xLinguOptionsCLB->set_text(nEntry, sHyphSpecial, 0);
m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+ m_xLinguOptionsCLB->set_sensitive(nEntry, !aLngCfg.IsReadOnly(UPN_IS_HYPH_SPECIAL));
m_xLinguOptionsCLB->thaw();
@@ -1281,6 +1330,15 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguDicsCLB->get_height_rows(5));
m_xLinguOptionsCLB->set_size_request(m_xLinguOptionsCLB->get_preferred_size().Width(),
m_xLinguOptionsCLB->get_height_rows(5));
+
+ if (officecfg::Office::Linguistic::General::DictionaryList::ActiveDictionaries::isReadOnly())
+ {
+ m_xLinguDicsFT->set_sensitive(false);
+ m_xLinguDicsCLB->set_sensitive(false);
+ m_xLinguDicsNewPB->set_sensitive(false);
+ m_xLinguDicsEditPB->set_sensitive(false);
+ m_xLinguDicsDelPB->set_sensitive(false);
+ }
}
IMPL_LINK(SvxLinguTabPage, BoxDoubleClickHdl_Impl, weld::TreeView&, rBox, bool)
@@ -1327,20 +1385,18 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
if (!pLinguData)
pLinguData.reset( new SvxLinguData_Impl );
- SvxLinguData_Impl aOldLinguData( *pLinguData );
+ SvxLinguData_Impl aOldLinguData(*pLinguData);
SvxEditModulesDlg aDlg(GetFrameWeld(), *pLinguData);
if (aDlg.run() != RET_OK)
- *pLinguData = aOldLinguData;
+ *pLinguData = std::move(aOldLinguData);
// evaluate new status of 'bConfigured' flag
sal_uInt32 nLen = pLinguData->GetDisplayServiceCount();
for (sal_uInt32 i = 0; i < nLen; ++i)
pLinguData->GetDisplayServiceArray()[i].bConfigured = false;
- const Locale* pAllLocales = pLinguData->GetAllSupportedLocales().getConstArray();
- sal_Int32 nLocales = pLinguData->GetAllSupportedLocales().getLength();
- for (sal_Int32 k = 0; k < nLocales; ++k)
+ for (const auto& locale : pLinguData->GetAllSupportedLocales())
{
- LanguageType nLang = LanguageTag::convertToLanguageType( pAllLocales[k] );
+ LanguageType nLang = LanguageTag::convertToLanguageType(locale);
if (pLinguData->GetSpellTable().count( nLang ))
pLinguData->SetChecked( pLinguData->GetSpellTable()[ nLang ] );
if (pLinguData->GetGrammarTable().count( nLang ))
@@ -1483,7 +1539,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
}
else
{
- OSL_FAIL( "rBtn unexpected value" );
+ SAL_WARN("cui.options", "rBtn unexpected value");
}
}
@@ -1515,7 +1571,7 @@ IMPL_LINK(SvxLinguTabPage, SelectHdl_Impl, weld::TreeView&, rBox, void)
}
else
{
- OSL_FAIL( "rBox unexpected value" );
+ SAL_WARN("cui.options", "rBtn unexpected value");
}
}
@@ -1527,20 +1583,26 @@ void SvxLinguTabPage::HideGroups( sal_uInt16 nGrp )
m_xLinguModulesCLB->hide();
m_xLinguModulesEditPB->hide();
- if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
- != SvtExtendedSecurityOptions::OPEN_NEVER )
+ if (officecfg::Office::Security::Hyperlinks::Open::get() != SvtExtendedSecurityOptions::OPEN_NEVER &&
+ !comphelper::LibreOfficeKit::isActive())
{
- m_xMoreDictsLink->show();
+ m_xMoreDictsBox->show();
}
}
}
+IMPL_STATIC_LINK_NOARG(SvxLinguTabPage, OnLinkClick, weld::LinkButton&, bool)
+{
+ comphelper::dispatchCommand(".uno:MoreDictionaries", {});
+ return true;
+}
+
SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& rData)
: GenericDialogController(pParent, "cui/ui/editmodulesdialog.ui", "EditModulesDialog")
- , sSpell(CuiResId(RID_SVXSTR_SPELL))
- , sHyph(CuiResId(RID_SVXSTR_HYPH))
- , sThes(CuiResId(RID_SVXSTR_THES))
- , sGrammar(CuiResId(RID_SVXSTR_GRAMMAR))
+ , sSpell(CuiResId(RID_CUISTR_SPELL))
+ , sHyph(CuiResId(RID_CUISTR_HYPH))
+ , sThes(CuiResId(RID_CUISTR_THES))
+ , sGrammar(CuiResId(RID_CUISTR_GRAMMAR))
, rLinguData(rData)
, m_xModulesCLB(m_xBuilder->weld_tree_view("lingudicts"))
, m_xPrioUpPB(m_xBuilder->weld_button("up"))
@@ -1568,24 +1630,28 @@ SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& r
m_xPrioUpPB->set_sensitive( false );
m_xPrioDownPB->set_sensitive( false );
- if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
+ m_xMoreDictsLink->connect_activate_link(LINK(this, SvxEditModulesDlg, OnLinkClick));
+ if (officecfg::Office::Security::Hyperlinks::Open::get() == SvtExtendedSecurityOptions::OPEN_NEVER)
m_xMoreDictsLink->hide();
// set that we want the checkbox shown if spellchecking is available
m_xLanguageLB->SetLanguageList(SvxLanguageListFlags::EMPTY, false, false, true);
//fill language box
- const Sequence< Locale >& rLoc = rLinguData.GetAllSupportedLocales();
- for (Locale const & locale : rLoc)
- {
- LanguageType nLang = LanguageTag::convertToLanguageType( locale );
- m_xLanguageLB->InsertLanguage(nLang);
- }
- LanguageType eSysLang = MsLangId::getSystemLanguage();
+ const auto& rLoc = rLinguData.GetAllSupportedLocales();
+ std::vector<LanguageType> aLanguages;
+ aLanguages.reserve(rLoc.size());
+ std::transform(rLoc.begin(), rLoc.end(), std::back_inserter(aLanguages),
+ [](Locale const& locale) { return LanguageTag::convertToLanguageType(locale); });
+ m_xLanguageLB->InsertLanguages(aLanguages);
+ LanguageType eSysLang = MsLangId::getConfiguredSystemLanguage();
m_xLanguageLB->set_active_id( eSysLang );
if (m_xLanguageLB->get_active_id() != eSysLang)
m_xLanguageLB->set_active(0);
+ css::uno::Reference < css::uno::XComponentContext > xContext(::comphelper::getProcessComponentContext());
+ m_xReadWriteAccess = css::configuration::ReadWriteAccess::create(xContext, "*");
+
m_xLanguageLB->connect_changed( LINK( this, SvxEditModulesDlg, LangSelectListBoxHdl_Impl ));
LangSelectHdl_Impl(m_xLanguageLB.get());
}
@@ -1593,7 +1659,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& r
SvxEditModulesDlg::~SvxEditModulesDlg()
{
for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
- delete reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+ delete weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
}
IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, weld::TreeView&, rBox, void )
@@ -1604,16 +1670,16 @@ IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, weld::TreeView&, rBox, void )
bool bDisableUp = true;
bool bDisableDown = true;
- ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos).toInt64());
+ ModuleUserData_Impl* pData = weld::fromId<ModuleUserData_Impl*>(rBox.get_id(nCurPos));
if (!pData->IsParent() && pData->GetType() != TYPE_HYPH)
{
if (nCurPos < rBox.n_children() - 1)
{
- bDisableDown = reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos + 1).toInt64())->IsParent();
+ bDisableDown = weld::fromId<ModuleUserData_Impl*>(rBox.get_id(nCurPos + 1))->IsParent();
}
if (nCurPos > 1)
{
- bDisableUp = reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos - 1).toInt64())->IsParent();
+ bDisableUp = weld::fromId<ModuleUserData_Impl*>(rBox.get_id(nCurPos - 1))->IsParent();
}
}
m_xPrioUpPB->set_sensitive(!bDisableUp);
@@ -1622,7 +1688,7 @@ IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, weld::TreeView&, rBox, void )
IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void )
{
- ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(rRowCol.first).toInt64());
+ ModuleUserData_Impl* pData = weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(rRowCol.first));
if (pData->IsParent() || pData->GetType() != TYPE_HYPH)
return;
@@ -1631,7 +1697,7 @@ IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, const weld::TreeView::iter
auto nPos = m_xModulesCLB->get_iter_index_in_parent(rRowCol.first);
for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
{
- pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+ pData = weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
if (!pData->IsParent() && pData->GetType() == TYPE_HYPH && i != nPos)
{
m_xModulesCLB->set_toggle(i, TRISTATE_FALSE);
@@ -1662,7 +1728,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
bool bChanged = false;
for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
{
- ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+ ModuleUserData_Impl* pData = weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
if (pData->IsParent())
{
if (bChanged)
@@ -1705,7 +1771,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
}
for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
- delete reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+ delete weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
m_xModulesCLB->clear();
// display entries for new selected language
@@ -1714,19 +1780,28 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
{
sal_Int32 n;
ServiceInfo_Impl* pInfo;
+ bool bReadOnly = false;
int nRow = 0;
// spellchecker entries
ModuleUserData_Impl* pUserData = new ModuleUserData_Impl(
OUString(), true, false, TYPE_SPELL, 0 );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
+ OUString sId(weld::toId(pUserData));
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_text(nRow, sSpell, 0);
m_xModulesCLB->set_text_emphasis(nRow, true, 0);
++nRow;
+ OUString aLangNodeName = LanguageTag::convertToBcp47(aCurLocale);
+ OUString aConfigPath = officecfg::Office::Linguistic::ServiceManager::path() + "/SpellCheckerList/" + aLangNodeName;
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+
Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) );
const OUString *pName = aNames.getConstArray();
sal_Int32 nNames = aNames.getLength();
@@ -1756,13 +1831,14 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
pUserData = new ModuleUserData_Impl( aImplName, false,
bCheck, TYPE_SPELL, static_cast<sal_uInt8>(nLocalIndex++) );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xModulesCLB->set_text(nRow, aTxt, 0);
m_xModulesCLB->set_text_emphasis(nRow, false, 0);
+ m_xModulesCLB->set_sensitive(nRow, !bReadOnly);
++nRow;
}
}
@@ -1770,13 +1846,20 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
// grammar checker entries
pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_GRAMMAR, 0 );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_text(nRow, sGrammar, 0);
m_xModulesCLB->set_text_emphasis(nRow, true, 0);
++nRow;
+ aConfigPath = officecfg::Office::Linguistic::ServiceManager::path() + "/GrammarCheckerList/" + aLangNodeName;
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+
aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR );
pName = aNames.getConstArray();
nNames = aNames.getLength();
@@ -1807,13 +1890,14 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
pUserData = new ModuleUserData_Impl( aImplName, false,
bCheck, TYPE_GRAMMAR, static_cast<sal_uInt8>(nLocalIndex++) );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xModulesCLB->set_text(nRow, aTxt, 0);
m_xModulesCLB->set_text_emphasis(nRow, false, 0);
+ m_xModulesCLB->set_sensitive(nRow, !bReadOnly);
++nRow;
}
}
@@ -1821,13 +1905,20 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
// hyphenator entries
pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_HYPH, 0 );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_text(nRow, sHyph, 0);
m_xModulesCLB->set_text_emphasis(nRow, true, 0);
++nRow;
+ aConfigPath = officecfg::Office::Linguistic::ServiceManager::path() + "/HyphenatorList/" + aLangNodeName;
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+
aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH );
pName = aNames.getConstArray();
nNames = aNames.getLength();
@@ -1857,13 +1948,14 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
pUserData = new ModuleUserData_Impl( aImplName, false,
bCheck, TYPE_HYPH, static_cast<sal_uInt8>(nLocalIndex++) );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xModulesCLB->set_text(nRow, aTxt, 0);
m_xModulesCLB->set_text_emphasis(nRow, false, 0);
+ m_xModulesCLB->set_sensitive(nRow, !bReadOnly);
++nRow;
}
}
@@ -1871,13 +1963,20 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
// thesaurus entries
pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_THES, 0 );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_text(nRow, sThes, 0);
m_xModulesCLB->set_text_emphasis(nRow, true, 0);
++nRow;
+ aConfigPath = officecfg::Office::Linguistic::ServiceManager::path() + "/ThesaurusList/" + aLangNodeName;
+ if (m_xReadWriteAccess->hasPropertyByHierarchicalName(aConfigPath))
+ {
+ css::beans::Property aProperty = m_xReadWriteAccess->getPropertyByHierarchicalName(aConfigPath);
+ bReadOnly = (aProperty.Attributes & css::beans::PropertyAttribute::READONLY) != 0;
+ }
+
aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES );
pName = aNames.getConstArray();
nNames = aNames.getLength();
@@ -1907,13 +2006,14 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
pUserData = new ModuleUserData_Impl( aImplName, false,
bCheck, TYPE_THES, static_cast<sal_uInt8>(nLocalIndex++) );
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
m_xModulesCLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xModulesCLB->set_text(nRow, aTxt, 0);
m_xModulesCLB->set_text_emphasis(nRow, false, 0);
+ m_xModulesCLB->set_sensitive(nRow, !bReadOnly);
++nRow;
}
}
@@ -1961,4 +2061,10 @@ IMPL_LINK_NOARG(SvxEditModulesDlg, BackHdl_Impl, weld::Button&, void)
LangSelectHdl_Impl(nullptr);
}
+IMPL_STATIC_LINK_NOARG(SvxEditModulesDlg, OnLinkClick, weld::LinkButton&, bool)
+{
+ comphelper::dispatchCommand(".uno:MoreDictionaries", {});
+ return true;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */