diff options
-rw-r--r-- | cui/source/options/optlingu.cxx | 32 | ||||
-rw-r--r-- | include/linguistic/lngprophelp.hxx | 9 | ||||
-rw-r--r-- | include/unotools/linguprops.hxx | 78 | ||||
-rw-r--r-- | linguistic/source/iprcache.cxx | 6 | ||||
-rw-r--r-- | linguistic/source/lngopt.cxx | 58 | ||||
-rw-r--r-- | linguistic/source/lngprophelp.cxx | 70 | ||||
-rw-r--r-- | svtools/source/config/accessibilityoptions.cxx | 3 | ||||
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 12 |
8 files changed, 112 insertions, 156 deletions
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 865f56e16840..3460582c2116 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -196,26 +196,22 @@ enum EID_OPTIONS } -//! 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_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 { diff --git a/include/linguistic/lngprophelp.hxx b/include/linguistic/lngprophelp.hxx index 52af61c4e61c..f8ddd5d36991 100644 --- a/include/linguistic/lngprophelp.hxx +++ b/include/linguistic/lngprophelp.hxx @@ -55,7 +55,7 @@ typedef cppu::WeakImplHelper class UNLESS_MERGELIBS(LNG_DLLPUBLIC) PropertyChgHelper : public PropertyChgHelperBase { - css::uno::Sequence< OUString > aPropNames; + std::vector< OUString > aPropNames; css::uno::Reference< css::uno::XInterface > xMyEvtObj; ::comphelper::OInterfaceContainerHelper2 aLngSvcEvtListeners; css::uno::Reference< css::beans::XPropertySet > xPropSet; @@ -77,14 +77,11 @@ protected: virtual void SetDefaultValues(); virtual void GetCurrentValues(); - css::uno::Sequence< OUString > & - GetPropNames() { return aPropNames; } + std::vector< OUString > & GetPropNames() { return aPropNames; } css::uno::Reference< css::beans::XPropertySet > & GetPropSet() { return xPropSet; } - void AddPropNames( const char *pNewNames[], sal_Int32 nCount ); - virtual bool propertyChange_Impl( const css::beans::PropertyChangeEvent& rEvt ); public: @@ -117,7 +114,7 @@ public: void RemoveAsPropListener(); void LaunchEvent( const css::linguistic2::LinguServiceEvent& rEvt ); - const css::uno::Sequence< OUString > & + const std::vector< OUString > & GetPropNames() const { return aPropNames; } const css::uno::Reference< css::beans::XPropertySet > & GetPropSet() const { return xPropSet; } diff --git a/include/unotools/linguprops.hxx b/include/unotools/linguprops.hxx index 23e0cdaae035..00400f05d31e 100644 --- a/include/unotools/linguprops.hxx +++ b/include/unotools/linguprops.hxx @@ -16,56 +16,59 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#pragma once -#ifndef INCLUDED_UNOTOOLS_LINGUPROPS_HXX -#define INCLUDED_UNOTOOLS_LINGUPROPS_HXX +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif // UNO property names for general options -#define UPN_IS_GERMAN_PRE_REFORM "IsGermanPreReform" /*! deprecated #i91949 !*/ -#define UPN_IS_USE_DICTIONARY_LIST "IsUseDictionaryList" -#define UPN_IS_IGNORE_CONTROL_CHARACTERS "IsIgnoreControlCharacters" -#define UPN_ACTIVE_DICTIONARIES "ActiveDictionaries" +constexpr OUStringLiteral UPN_IS_GERMAN_PRE_REFORM = u"IsGermanPreReform"; /*! deprecated #i91949 !*/ +constexpr OUStringLiteral UPN_IS_USE_DICTIONARY_LIST = u"IsUseDictionaryList"; +constexpr OUStringLiteral UPN_IS_IGNORE_CONTROL_CHARACTERS = u"IsIgnoreControlCharacters"; +constexpr OUStringLiteral UPN_ACTIVE_DICTIONARIES = u"ActiveDictionaries"; // UNO property names for SpellChecker -#define UPN_IS_SPELL_UPPER_CASE "IsSpellUpperCase" -#define UPN_IS_SPELL_WITH_DIGITS "IsSpellWithDigits" -#define UPN_IS_SPELL_CAPITALIZATION "IsSpellCapitalization" +constexpr OUStringLiteral UPN_IS_SPELL_UPPER_CASE = u"IsSpellUpperCase"; +constexpr OUStringLiteral UPN_IS_SPELL_WITH_DIGITS = u"IsSpellWithDigits"; +constexpr OUStringLiteral UPN_IS_SPELL_CAPITALIZATION = u"IsSpellCapitalization"; // UNO property names for Hyphenator -#define UPN_HYPH_MIN_LEADING "HyphMinLeading" -#define UPN_HYPH_MIN_TRAILING "HyphMinTrailing" -#define UPN_HYPH_MIN_WORD_LENGTH "HyphMinWordLength" -#define UPN_HYPH_NO_CAPS "HyphNoCaps" +constexpr OUStringLiteral UPN_HYPH_MIN_LEADING = u"HyphMinLeading"; +constexpr OUStringLiteral UPN_HYPH_MIN_TRAILING = u"HyphMinTrailing"; +constexpr OUStringLiteral UPN_HYPH_MIN_WORD_LENGTH = u"HyphMinWordLength"; +constexpr OUStringLiteral UPN_HYPH_NO_CAPS = u"HyphNoCaps"; // UNO property names for Lingu // (those not covered by the SpellChecker and Hyphenator // properties and more likely to be used in other modules only) -#define UPN_DEFAULT_LANGUAGE "DefaultLanguage" -#define UPN_DEFAULT_LOCALE "DefaultLocale" -#define UPN_DEFAULT_LOCALE_CJK "DefaultLocale_CJK" -#define UPN_DEFAULT_LOCALE_CTL "DefaultLocale_CTL" -#define UPN_IS_HYPH_AUTO "IsHyphAuto" -#define UPN_IS_HYPH_SPECIAL "IsHyphSpecial" -#define UPN_IS_SPELL_AUTO "IsSpellAuto" -#define UPN_IS_SPELL_HIDE "IsSpellHide" /*! deprecated #i91949 !*/ -#define UPN_IS_SPELL_IN_ALL_LANGUAGES "IsSpellInAllLanguages" /*! deprecated #i91949 !*/ -#define UPN_IS_SPELL_SPECIAL "IsSpellSpecial" -#define UPN_IS_WRAP_REVERSE "IsWrapReverse" -#define UPN_DATA_FILES_CHANGED_CHECK_VALUE "DataFilesChangedCheckValue" +constexpr OUStringLiteral UPN_DEFAULT_LANGUAGE = u"DefaultLanguage"; +constexpr OUStringLiteral UPN_DEFAULT_LOCALE = u"DefaultLocale"; +constexpr OUStringLiteral UPN_DEFAULT_LOCALE_CJK = u"DefaultLocale_CJK"; +constexpr OUStringLiteral UPN_DEFAULT_LOCALE_CTL = u"DefaultLocale_CTL"; +constexpr OUStringLiteral UPN_IS_HYPH_AUTO = u"IsHyphAuto"; +constexpr OUStringLiteral UPN_IS_HYPH_SPECIAL = u"IsHyphSpecial"; +constexpr OUStringLiteral UPN_IS_SPELL_AUTO = u"IsSpellAuto"; +constexpr OUStringLiteral UPN_IS_SPELL_HIDE = u"IsSpellHide"; /*! deprecated #i91949 !*/ +constexpr OUStringLiteral UPN_IS_SPELL_IN_ALL_LANGUAGES = u"IsSpellInAllLanguages"; /*! deprecated #i91949 !*/ +constexpr OUStringLiteral UPN_IS_SPELL_SPECIAL = u"IsSpellSpecial"; +constexpr OUStringLiteral UPN_IS_WRAP_REVERSE = u"IsWrapReverse"; +constexpr OUStringLiteral UPN_DATA_FILES_CHANGED_CHECK_VALUE = u"DataFilesChangedCheckValue"; // UNO property names for text conversion options -#define UPN_ACTIVE_CONVERSION_DICTIONARIES "ActiveConversionDictionaries" -#define UPN_IS_IGNORE_POST_POSITIONAL_WORD "IsIgnorePostPositionalWord" -#define UPN_IS_AUTO_CLOSE_DIALOG "IsAutoCloseDialog" -#define UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST "IsShowEntriesRecentlyUsedFirst" -#define UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES "IsAutoReplaceUniqueEntries" -#define UPN_IS_DIRECTION_TO_SIMPLIFIED "IsDirectionToSimplified" -#define UPN_IS_USE_CHARACTER_VARIANTS "IsUseCharacterVariants" -#define UPN_IS_TRANSLATE_COMMON_TERMS "IsTranslateCommonTerms" -#define UPN_IS_REVERSE_MAPPING "IsReverseMapping" +constexpr OUStringLiteral UPN_ACTIVE_CONVERSION_DICTIONARIES = u"ActiveConversionDictionaries"; +constexpr OUStringLiteral UPN_IS_IGNORE_POST_POSITIONAL_WORD = u"IsIgnorePostPositionalWord"; +constexpr OUStringLiteral UPN_IS_AUTO_CLOSE_DIALOG = u"IsAutoCloseDialog"; +constexpr OUStringLiteral UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST = u"IsShowEntriesRecentlyUsedFirst"; +constexpr OUStringLiteral UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES = u"IsAutoReplaceUniqueEntries"; +constexpr OUStringLiteral UPN_IS_DIRECTION_TO_SIMPLIFIED = u"IsDirectionToSimplified"; +constexpr OUStringLiteral UPN_IS_USE_CHARACTER_VARIANTS = u"IsUseCharacterVariants"; +constexpr OUStringLiteral UPN_IS_TRANSLATE_COMMON_TERMS = u"IsTranslateCommonTerms"; +constexpr OUStringLiteral UPN_IS_REVERSE_MAPPING = u"IsReverseMapping"; -#define UPN_IS_GRAMMAR_AUTO "IsAutoGrammarCheck" -#define UPN_IS_GRAMMAR_INTERACTIVE "IsInteractiveGrammarCheck" +constexpr OUStringLiteral UPN_IS_GRAMMAR_AUTO = u"IsAutoGrammarCheck"; +constexpr OUStringLiteral UPN_IS_GRAMMAR_INTERACTIVE = u"IsInteractiveGrammarCheck"; // uno property handles #define UPH_IS_GERMAN_PRE_REFORM 0 @@ -102,6 +105,9 @@ #define UPH_IS_GRAMMAR_AUTO 34 #define UPH_IS_GRAMMAR_INTERACTIVE 35 #define UPH_HYPH_NO_CAPS 36 + +#ifdef __GNUC__ +#pragma GCC diagnostic pop #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx index cf9c4db0b266..89db6246f883 100644 --- a/linguistic/source/iprcache.cxx +++ b/linguistic/source/iprcache.cxx @@ -41,7 +41,7 @@ namespace linguistic const struct { - const char *pPropName; + OUString aPropName; sal_Int32 nPropHdl; } aFlushProperties[ NUM_FLUSH_PROPS ] = { @@ -62,7 +62,7 @@ static void lcl_AddAsPropertyChangeListener( for (auto& aFlushPropertie : aFlushProperties) { rPropSet->addPropertyChangeListener( - OUString::createFromAscii(aFlushPropertie.pPropName), xListener ); + aFlushPropertie.aPropName, xListener ); } } } @@ -77,7 +77,7 @@ static void lcl_RemoveAsPropertyChangeListener( for (auto& aFlushPropertie : aFlushProperties) { rPropSet->removePropertyChangeListener( - OUString::createFromAscii(aFlushPropertie.pPropName), xListener ); + aFlushPropertie.aPropName, xListener ); } } } diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index 8ddbac6ca9e2..517117306a86 100644 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -82,7 +82,7 @@ namespace { struct WID_Name { sal_Int32 nWID; - const char *pPropertyName; + OUString aPropertyName; }; } @@ -91,7 +91,7 @@ struct WID_Name //! since the WID is used as index in this table! WID_Name const aWID_Name[] = { - { 0, nullptr }, + { 0, "" }, { UPH_IS_USE_DICTIONARY_LIST, UPN_IS_USE_DICTIONARY_LIST }, { UPH_IS_IGNORE_CONTROL_CHARACTERS, UPN_IS_IGNORE_CONTROL_CHARACTERS }, { UPH_IS_SPELL_UPPER_CASE, UPN_IS_SPELL_UPPER_CASE }, @@ -102,16 +102,16 @@ WID_Name const aWID_Name[] = { UPH_HYPH_MIN_WORD_LENGTH, UPN_HYPH_MIN_WORD_LENGTH }, { UPH_DEFAULT_LOCALE, UPN_DEFAULT_LOCALE }, { UPH_IS_SPELL_AUTO, UPN_IS_SPELL_AUTO }, - { 0, nullptr }, - { 0, nullptr }, + { 0, "" }, + { 0, "" }, { UPH_IS_SPELL_SPECIAL, UPN_IS_SPELL_SPECIAL }, { UPH_IS_HYPH_AUTO, UPN_IS_HYPH_AUTO }, { UPH_IS_HYPH_SPECIAL, UPN_IS_HYPH_SPECIAL }, { UPH_IS_WRAP_REVERSE, UPN_IS_WRAP_REVERSE }, - { 0, nullptr }, - { 0, nullptr }, - { 0, nullptr }, - { 0, nullptr }, + { 0, "" }, + { 0, "" }, + { 0, "" }, + { 0, "" }, { UPH_DEFAULT_LANGUAGE, UPN_DEFAULT_LANGUAGE }, { UPH_DEFAULT_LOCALE_CJK, UPN_DEFAULT_LOCALE_CJK }, { UPH_DEFAULT_LOCALE_CTL, UPN_DEFAULT_LOCALE_CTL } @@ -125,7 +125,7 @@ OUString LinguOptions::GetName( sal_Int32 nWID ) OUString aRes; if (0 <= nWID && nWID < sal_Int32(SAL_N_ELEMENTS(aWID_Name)) && aWID_Name[ nWID ].nWID == nWID) - aRes = OUString::createFromAscii(aWID_Name[nWID].pPropertyName); + aRes = aWID_Name[nWID].aPropertyName; else OSL_FAIL("lng : unknown WID"); @@ -138,45 +138,45 @@ static const SfxItemPropertyMapEntry* lcl_GetLinguProps() { static const SfxItemPropertyMapEntry aLinguProps[] = { - { u"" UPN_DEFAULT_LANGUAGE, UPH_DEFAULT_LANGUAGE, + { UPN_DEFAULT_LANGUAGE, UPH_DEFAULT_LANGUAGE, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, - { u"" UPN_DEFAULT_LOCALE, UPH_DEFAULT_LOCALE, + { UPN_DEFAULT_LOCALE, UPH_DEFAULT_LOCALE, ::cppu::UnoType<Locale>::get(), 0, 0 }, - { u"" UPN_DEFAULT_LOCALE_CJK, UPH_DEFAULT_LOCALE_CJK, + { UPN_DEFAULT_LOCALE_CJK, UPH_DEFAULT_LOCALE_CJK, ::cppu::UnoType<Locale>::get(), 0, 0 }, - { u"" UPN_DEFAULT_LOCALE_CTL, UPH_DEFAULT_LOCALE_CTL, + { UPN_DEFAULT_LOCALE_CTL, UPH_DEFAULT_LOCALE_CTL, ::cppu::UnoType<Locale>::get(), 0, 0 }, - { u"" UPN_HYPH_MIN_LEADING, UPH_HYPH_MIN_LEADING, + { UPN_HYPH_MIN_LEADING, UPH_HYPH_MIN_LEADING, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, - { u"" UPN_HYPH_MIN_TRAILING, UPH_HYPH_MIN_TRAILING, + { UPN_HYPH_MIN_TRAILING, UPH_HYPH_MIN_TRAILING, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, - { u"" UPN_HYPH_MIN_WORD_LENGTH, UPH_HYPH_MIN_WORD_LENGTH, + { UPN_HYPH_MIN_WORD_LENGTH, UPH_HYPH_MIN_WORD_LENGTH, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, - { u"" UPN_IS_GERMAN_PRE_REFORM, UPH_IS_GERMAN_PRE_REFORM, /*! deprecated !*/ + { UPN_IS_GERMAN_PRE_REFORM, UPH_IS_GERMAN_PRE_REFORM, /*! deprecated !*/ cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_HYPH_AUTO, UPH_IS_HYPH_AUTO, + { UPN_IS_HYPH_AUTO, UPH_IS_HYPH_AUTO, cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_HYPH_SPECIAL, UPH_IS_HYPH_SPECIAL, + { UPN_IS_HYPH_SPECIAL, UPH_IS_HYPH_SPECIAL, cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_IGNORE_CONTROL_CHARACTERS, UPH_IS_IGNORE_CONTROL_CHARACTERS, + { UPN_IS_IGNORE_CONTROL_CHARACTERS, UPH_IS_IGNORE_CONTROL_CHARACTERS, cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_SPELL_AUTO, UPH_IS_SPELL_AUTO, + { UPN_IS_SPELL_AUTO, UPH_IS_SPELL_AUTO, cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_SPELL_CAPITALIZATION, UPH_IS_SPELL_CAPITALIZATION, + { UPN_IS_SPELL_CAPITALIZATION, UPH_IS_SPELL_CAPITALIZATION, cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_SPELL_HIDE, UPH_IS_SPELL_HIDE, /*! deprecated !*/ + { UPN_IS_SPELL_HIDE, UPH_IS_SPELL_HIDE, /*! deprecated !*/ cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_SPELL_IN_ALL_LANGUAGES, UPH_IS_SPELL_IN_ALL_LANGUAGES, /*! deprecated !*/ + { UPN_IS_SPELL_IN_ALL_LANGUAGES, UPH_IS_SPELL_IN_ALL_LANGUAGES, /*! deprecated !*/ cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_SPELL_SPECIAL, UPH_IS_SPELL_SPECIAL, + { UPN_IS_SPELL_SPECIAL, UPH_IS_SPELL_SPECIAL, cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_SPELL_UPPER_CASE, UPH_IS_SPELL_UPPER_CASE, + { UPN_IS_SPELL_UPPER_CASE, UPH_IS_SPELL_UPPER_CASE, cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_SPELL_WITH_DIGITS, UPH_IS_SPELL_WITH_DIGITS, + { UPN_IS_SPELL_WITH_DIGITS, UPH_IS_SPELL_WITH_DIGITS, cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_USE_DICTIONARY_LIST, UPH_IS_USE_DICTIONARY_LIST, + { UPN_IS_USE_DICTIONARY_LIST, UPH_IS_USE_DICTIONARY_LIST, cppu::UnoType<bool>::get(), 0, 0 }, - { u"" UPN_IS_WRAP_REVERSE, UPH_IS_WRAP_REVERSE, + { UPN_IS_WRAP_REVERSE, UPH_IS_WRAP_REVERSE, cppu::UnoType<bool>::get(), 0, 0 }, { u"", 0, css::uno::Type(), 0, 0 } }; diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx index 93bc24e8c04a..bcc3f7a691a4 100644 --- a/linguistic/source/lngprophelp.cxx +++ b/linguistic/source/lngprophelp.cxx @@ -48,31 +48,16 @@ namespace linguistic { -static const char *aCH[] = -{ - UPN_IS_IGNORE_CONTROL_CHARACTERS, - UPN_IS_USE_DICTIONARY_LIST, -}; - -const int nCHCount = SAL_N_ELEMENTS(aCH); - - PropertyChgHelper::PropertyChgHelper( const Reference< XInterface > &rxSource, Reference< XLinguProperties > const &rxPropSet, int nAllowedEvents ) : - aPropNames (nCHCount), + aPropNames ({UPN_IS_IGNORE_CONTROL_CHARACTERS, UPN_IS_USE_DICTIONARY_LIST}), xMyEvtObj (rxSource), aLngSvcEvtListeners (GetLinguMutex()), xPropSet (rxPropSet), nEvtFlags (nAllowedEvents) { - OUString *pName = aPropNames.getArray(); - for (sal_Int32 i = 0; i < nCHCount; ++i) - { - pName[i] = OUString::createFromAscii( aCH[i] ); - } - SetDefaultValues(); } @@ -80,23 +65,6 @@ PropertyChgHelper::~PropertyChgHelper() { } - -void PropertyChgHelper::AddPropNames( const char *pNewNames[], sal_Int32 nCount ) -{ - if (pNewNames && nCount) - { - sal_Int32 nLen = GetPropNames().getLength(); - GetPropNames().realloc( nLen + nCount ); - OUString *pName = GetPropNames().getArray(); - for (sal_Int32 i = 0; i < nCount; ++i) - { - pName[ nLen + i ] = OUString::createFromAscii( pNewNames[ i ] ); - - } - } -} - - void PropertyChgHelper::SetDefaultValues() { bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters = true; @@ -107,7 +75,7 @@ void PropertyChgHelper::SetDefaultValues() void PropertyChgHelper::GetCurrentValues() { const auto& rPropNames = GetPropNames(); - if (!(GetPropSet().is() && rPropNames.hasElements())) + if (!GetPropSet().is() || rPropNames.empty()) return; for (const OUString& rPropName : rPropNames) @@ -256,7 +224,7 @@ void SAL_CALL PropertyChgHelper::disposing( const EventObject& rSource ) { RemoveAsPropListener(); xPropSet = nullptr; - aPropNames.realloc( 0 ); + aPropNames.clear(); } } @@ -316,22 +284,15 @@ void SAL_CALL } -// list of properties from the property set to be used -// and listened to -static const char *aSP[] = -{ - UPN_IS_SPELL_UPPER_CASE, - UPN_IS_SPELL_WITH_DIGITS, - UPN_IS_SPELL_CAPITALIZATION -}; - - PropertyHelper_Spell::PropertyHelper_Spell( const Reference< XInterface > & rxSource, Reference< XLinguProperties > const &rxPropSet ) : PropertyChgHelper ( rxSource, rxPropSet, AE_SPELLCHECKER ) { - AddPropNames( aSP, SAL_N_ELEMENTS(aSP) ); + auto& rPropNames = GetPropNames(); + rPropNames.push_back(UPN_IS_SPELL_UPPER_CASE); + rPropNames.push_back(UPN_IS_SPELL_WITH_DIGITS); + rPropNames.push_back(UPN_IS_SPELL_CAPITALIZATION); SetDefaultValues(); GetCurrentValues(); } @@ -357,7 +318,7 @@ void PropertyHelper_Spell::GetCurrentValues() PropertyChgHelper::GetCurrentValues(); const auto& rPropNames = GetPropNames(); - if (!(GetPropSet().is() && rPropNames.hasElements())) + if (!GetPropSet().is() || rPropNames.empty()) return; for (const OUString& rPropName : rPropNames) @@ -490,20 +451,15 @@ void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals ) } } -static const char *aHP[] = -{ - UPN_HYPH_MIN_LEADING, - UPN_HYPH_MIN_TRAILING, - UPN_HYPH_MIN_WORD_LENGTH -}; - - PropertyHelper_Hyphen::PropertyHelper_Hyphen( const Reference< XInterface > & rxSource, Reference< XLinguProperties > const &rxPropSet ) : PropertyChgHelper ( rxSource, rxPropSet, AE_HYPHENATOR ) { - AddPropNames( aHP, SAL_N_ELEMENTS(aHP) ); + auto& rPropNames = GetPropNames(); + rPropNames.push_back(UPN_HYPH_MIN_LEADING); + rPropNames.push_back(UPN_HYPH_MIN_TRAILING); + rPropNames.push_back(UPN_HYPH_MIN_WORD_LENGTH); SetDefaultValues(); GetCurrentValues(); } @@ -530,7 +486,7 @@ void PropertyHelper_Hyphen::GetCurrentValues() PropertyChgHelper::GetCurrentValues(); const auto& rPropNames = GetPropNames(); - if (!(GetPropSet().is() && rPropNames.hasElements())) + if (!GetPropSet().is() || rPropNames.empty()) return; for (const OUString& rPropName : rPropNames) diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 576d43a0b376..7debdf47327e 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -137,8 +137,9 @@ bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedText() const try { + static constexpr OUStringLiteral PROPNAME = u"IsAllowAnimatedText"; if(m_xNode.is()) - m_xNode->getPropertyValue("IsAllowAnimatedText") >>= bRet; + m_xNode->getPropertyValue(PROPNAME) >>= bRet; } catch(const css::uno::Exception&) { diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index bfb7959bc488..3b9232690fc2 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -213,7 +213,7 @@ namespace { struct NamesToHdl { const char *pFullPropName; // full qualified name as used in configuration - const char *pPropName; // property name only (atom) of above + OUString aPropName; // property name only (atom) of above sal_Int32 nHdl; // numeric handle representing the property }; @@ -257,9 +257,9 @@ NamesToHdl const aNamesToHdl[] = {/* 31 */ "GrammarChecking/IsInteractiveCheck", UPN_IS_GRAMMAR_INTERACTIVE, UPH_IS_GRAMMAR_INTERACTIVE}, /* similar to entry 0 (thus no own configuration entry) but with different property name and type */ -{ nullptr, UPN_DEFAULT_LANGUAGE, UPH_DEFAULT_LANGUAGE}, +{ nullptr, UPN_DEFAULT_LANGUAGE, UPH_DEFAULT_LANGUAGE}, -{ nullptr, nullptr, -1} +{ nullptr, "", -1} }; uno::Sequence< OUString > SvtLinguConfigItem::GetPropertyNames() @@ -304,16 +304,16 @@ bool SvtLinguConfigItem::GetHdlByName( } else { - while (pEntry && pEntry->pPropName != nullptr) + while (pEntry && pEntry->pFullPropName != nullptr) { - if (rPropertyName.equalsAscii( pEntry->pPropName )) + if (rPropertyName == pEntry->aPropName ) { rnHdl = pEntry->nHdl; break; } ++pEntry; } - return pEntry && pEntry->pPropName != nullptr; + return pEntry && pEntry->pFullPropName != nullptr; } } |