From ef0af5032ad283ffb3b4521eb097a118d58f332a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 13 May 2013 10:43:34 +0200 Subject: fdo#46808, Convert linguistic2::LingProperties to new style API-CHANGE: Removed the following interfaces from the IDL because no-one was using them: interface com::sun::star::beans::XFastPropertySet; interface com::sun::star::lang::XComponent; But the service still implements them, so old code should keep on working. Change-Id: Iab058fb42bd1a54e0b9632e99e564fdc0869fe6e --- cui/source/options/treeopt.cxx | 25 +---- editeng/source/editeng/edtspell.cxx | 1 - editeng/source/misc/splwrap.cxx | 19 +--- editeng/source/misc/unolingu.cxx | 13 +-- include/editeng/unolingu.hxx | 9 +- include/linguistic/misc.hxx | 4 +- linguistic/inc/iprcache.hxx | 5 +- linguistic/source/hyphdsp.hxx | 6 +- linguistic/source/iprcache.cxx | 10 +- linguistic/source/lngopt.cxx | 26 ++++- linguistic/source/lngopt.hxx | 81 +++++++++++++- linguistic/source/misc.cxx | 33 ++---- offapi/UnoApi_offapi.mk | 3 +- .../com/sun/star/linguistic2/LinguProperties.idl | 110 +------------------ .../com/sun/star/linguistic2/XLinguProperties.idl | 122 +++++++++++++++++++++ offapi/type_reference/offapi.rdb | Bin 6833664 -> 6833152 bytes 16 files changed, 272 insertions(+), 195 deletions(-) create mode 100644 offapi/com/sun/star/linguistic2/XLinguProperties.idl diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 8f5c20f3d5d4..78e127b2b383 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -1436,23 +1437,14 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet) { bSaveSpellCheck = ( (const SfxBoolItem*)pItem )->GetValue(); } - Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - Reference< XPropertySet > xProp( - xMgr->createInstance( OUString( "com.sun.star.linguistic2.LinguProperties" ) ), - UNO_QUERY ); + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< XLinguProperties > xProp = LinguProperties::create( xContext ); if ( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_HYPHENREGION, sal_False, &pItem ) ) { const SfxHyphenRegionItem* pHyphenItem = (const SfxHyphenRegionItem*)pItem; - if (xProp.is()) - { - xProp->setPropertyValue( - OUString(UPN_HYPH_MIN_LEADING), - makeAny((sal_Int16) pHyphenItem->GetMinLead()) ); - xProp->setPropertyValue( - OUString(UPN_HYPH_MIN_TRAILING), - makeAny((sal_Int16) pHyphenItem->GetMinTrail()) ); - } + xProp->setHyphMinLeading( (sal_Int16) pHyphenItem->GetMinLead() ); + xProp->setHyphMinTrailing( (sal_Int16) pHyphenItem->GetMinTrail() ); bSaveSpellCheck = sal_True; } @@ -1483,12 +1475,7 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet) pDispatch->Execute(SID_AUTOSPELL_CHECK, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, pItem, 0L); - if (xProp.is()) - { - xProp->setPropertyValue( - OUString(UPN_IS_SPELL_AUTO), - makeAny(bOnlineSpelling) ); - } + xProp->setIsSpellAuto( bOnlineSpelling ); } if( bSaveSpellCheck ) diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 5e9503e79813..3e1a3c9675f2 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -136,7 +136,6 @@ sal_Bool EditSpellWrapper::SpellMore() { // The text has been entered into the engine, when backwords then // it must be behind the selection. - Reference< XPropertySet > xProp( SvxGetLinguPropertySet() ); pEditView->GetImpEditView()->SetEditSelection( pEE->GetEditDoc().GetStartPaM() ); } diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx index 6b810985e264..318998405c70 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -160,11 +160,8 @@ SvxSpellWrapper::SvxSpellWrapper( Window* pWn, bRevAllowed ( bRevAllow ), bAllRight ( bIsAllRight ) { - Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); - sal_Bool bWrapReverse = xProp.is() ? - *(sal_Bool*)xProp->getPropertyValue( - OUString(UPN_IS_WRAP_REVERSE) ).getValue() - : sal_False; + Reference< linguistic2::XLinguProperties > xProp( SvxGetLinguPropertySet() ); + sal_Bool bWrapReverse = xProp.is() ? xProp->getIsWrapReverse() : sal_False; bReverse = bRevAllow && bWrapReverse; bStartDone = bOther || ( !bReverse && bStart ); bEndDone = bReverse && bStart && !bOther; @@ -399,11 +396,8 @@ void SvxSpellWrapper::SpellDocument( ) sal_Bool SvxSpellWrapper::SpellNext( ) { - Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); - sal_Bool bWrapReverse = xProp.is() ? - *(sal_Bool*)xProp->getPropertyValue( - OUString(UPN_IS_WRAP_REVERSE) ).getValue() - : sal_False; + Reference< linguistic2::XLinguProperties > xProp( SvxGetLinguPropertySet() ); + sal_Bool bWrapReverse = xProp.is() ? xProp->getIsWrapReverse() : sal_False; sal_Bool bActRev = bRevAllowed && bWrapReverse; // bActRev is the direction after Spell checking, bReverse is the one @@ -447,10 +441,7 @@ sal_Bool SvxSpellWrapper::SpellNext( ) } else if ( bStartDone && bEndDone ) { - sal_Bool bIsSpellSpecial = xProp.is() ? - *(sal_Bool*)xProp->getPropertyValue( - OUString(UPN_IS_SPELL_SPECIAL) ).getValue() - : sal_False; + sal_Bool bIsSpellSpecial = xProp.is() ? xProp->getIsSpellSpecial() : sal_False; // Body area done, ask for special area if( !IsHyphen() && bIsSpellSpecial && HasOtherCnt() ) { diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 4a0c2490c2bd..d4a72d68609f 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -517,7 +518,7 @@ uno::Reference< XSpellChecker1 > LinguMgr::xSpell = 0; uno::Reference< XHyphenator > LinguMgr::xHyph = 0; uno::Reference< XThesaurus > LinguMgr::xThes = 0; uno::Reference< XSearchableDictionaryList > LinguMgr::xDicList = 0; -uno::Reference< XPropertySet > LinguMgr::xProp = 0; +uno::Reference< XLinguProperties > LinguMgr::xProp = 0; uno::Reference< XDictionary > LinguMgr::xIgnoreAll = 0; uno::Reference< XDictionary > LinguMgr::xChangeAll = 0; @@ -557,7 +558,7 @@ uno::Reference< XSearchableDictionaryList > LinguMgr::GetDictionaryList() return xDicList.is() ? xDicList : GetDicList(); } -uno::Reference< XPropertySet > LinguMgr::GetLinguPropertySet() +uno::Reference< linguistic2::XLinguProperties > LinguMgr::GetLinguPropertySet() { return xProp.is() ? xProp : GetProp(); } @@ -634,7 +635,7 @@ uno::Reference< XSearchableDictionaryList > LinguMgr::GetDicList() return xDicList; } -uno::Reference< XPropertySet > LinguMgr::GetProp() +uno::Reference< linguistic2::XLinguProperties > LinguMgr::GetProp() { if (bExiting) return 0; @@ -642,9 +643,7 @@ uno::Reference< XPropertySet > LinguMgr::GetProp() if (!pExitLstnr) pExitLstnr = new LinguMgrExitLstnr; - uno::Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() ); - xProp = uno::Reference< XPropertySet > ( xMgr->createInstance( - "com.sun.star.linguistic2.LinguProperties" ), UNO_QUERY ); + xProp = linguistic2::LinguProperties::create( getProcessComponentContext() ); return xProp; } @@ -756,7 +755,7 @@ uno::Reference< XSearchableDictionaryList > SvxGetDictionaryList() return LinguMgr::GetDictionaryList(); } -uno::Reference< XPropertySet > SvxGetLinguPropertySet() +uno::Reference< XLinguProperties > SvxGetLinguPropertySet() { return LinguMgr::GetLinguPropertySet(); } diff --git a/include/editeng/unolingu.hxx b/include/editeng/unolingu.hxx index 09f570228f95..9e21010c26b8 100644 --- a/include/editeng/unolingu.hxx +++ b/include/editeng/unolingu.hxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -52,7 +53,7 @@ class EDITENG_DLLPUBLIC LinguMgr static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList; static ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > xProp; + ::com::sun::star::linguistic2::XLinguProperties > xProp; static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > xIgnoreAll; @@ -71,7 +72,7 @@ class EDITENG_DLLPUBLIC LinguMgr static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDicList(); static ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > GetProp(); + ::com::sun::star::linguistic2::XLinguProperties > GetProp(); static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetStandard(); static ::com::sun::star::uno::Reference< @@ -94,7 +95,7 @@ public: static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList(); static ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > GetLinguPropertySet(); + ::com::sun::star::linguistic2::XLinguProperties > GetLinguPropertySet(); static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager2 > GetLngSvcMgr(); @@ -167,7 +168,7 @@ EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > SvxGetDictionaryList(); EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > SvxGetLinguPropertySet(); + ::com::sun::star::linguistic2::XLinguProperties > SvxGetLinguPropertySet(); //TODO: remove argument or provide SvxGetIgnoreAllList with the same one EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > SvxGetOrCreatePosDic( diff --git a/include/linguistic/misc.hxx b/include/linguistic/misc.hxx index c15d2fc70dab..8e7b4b1353f1 100644 --- a/include/linguistic/misc.hxx +++ b/include/linguistic/misc.hxx @@ -29,6 +29,7 @@ #include #include #include +#include #include // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type #include // helper for implementations @@ -56,7 +57,6 @@ class LocaleDataWrapper; #define SN_SPELLCHECKER "com.sun.star.linguistic2.SpellChecker" #define SN_HYPHENATOR "com.sun.star.linguistic2.Hyphenator" #define SN_THESAURUS "com.sun.star.linguistic2.Thesaurus" -#define SN_LINGU_PROPERTIES "com.sun.star.linguistic2.LinguProperties" namespace linguistic @@ -150,7 +150,7 @@ LNG_DLLPUBLIC sal_Bool IsNumeric( const String &rText ); ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetOneInstanceService( const char *pServiceName ); -LNG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetLinguProperties(); +LNG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguProperties > GetLinguProperties(); ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList(); ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList(); diff --git a/linguistic/inc/iprcache.hxx b/linguistic/inc/iprcache.hxx index c38264f29dbc..0d3b8a5895a5 100644 --- a/linguistic/inc/iprcache.hxx +++ b/linguistic/inc/iprcache.hxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -61,7 +62,7 @@ class FlushListener : ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > xPropSet; + ::com::sun::star::linguistic2::XLinguProperties > xPropSet; Flushable *pFlushObj; // don't allow to use copy-constructor and assignment-operator @@ -75,7 +76,7 @@ public: inline void SetFlushObj( Flushable *pFO) { pFlushObj = pFO; } void SetDicList( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &rDL ); - void SetPropSet( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &rPS ); + void SetPropSet( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguProperties > &rPS ); //XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource ) throw(::com::sun::star::uno::RuntimeException); diff --git a/linguistic/source/hyphdsp.hxx b/linguistic/source/hyphdsp.hxx index 6bcc72b23b1d..cebfbd3bafcb 100644 --- a/linguistic/source/hyphdsp.hxx +++ b/linguistic/source/hyphdsp.hxx @@ -55,7 +55,7 @@ class HyphenatorDispatcher : HyphSvcByLangMap_t aSvcMap; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > xPropSet; + ::com::sun::star::linguistic2::XLinguProperties > xPropSet; ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList; @@ -66,7 +66,7 @@ class HyphenatorDispatcher : HyphenatorDispatcher & operator = (const HyphenatorDispatcher &); inline ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > + ::com::sun::star::linguistic2::XLinguProperties > GetPropSet(); inline ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > @@ -139,7 +139,7 @@ public: inline ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > + ::com::sun::star::linguistic2::XLinguProperties > HyphenatorDispatcher::GetPropSet() { return xPropSet.is() ? diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx index 327203473ff3..2b5a37ce03d8 100644 --- a/linguistic/source/iprcache.cxx +++ b/linguistic/source/iprcache.cxx @@ -59,7 +59,7 @@ static const struct static void lcl_AddAsPropertyChangeListener( Reference< XPropertyChangeListener > xListener, - Reference< XPropertySet > &rPropSet ) + Reference< XLinguProperties > &rPropSet ) { if (xListener.is() && rPropSet.is()) { @@ -74,7 +74,7 @@ static void lcl_AddAsPropertyChangeListener( static void lcl_RemoveAsPropertyChangeListener( Reference< XPropertyChangeListener > xListener, - Reference< XPropertySet > &rPropSet ) + Reference< XLinguProperties > &rPropSet ) { if (xListener.is() && rPropSet.is()) { @@ -126,7 +126,7 @@ void FlushListener::SetDicList( Reference &rDL ) } -void FlushListener::SetPropSet( Reference< XPropertySet > &rPS ) +void FlushListener::SetPropSet( Reference< XLinguProperties > &rPS ) { MutexGuard aGuard( GetLinguMutex() ); @@ -207,14 +207,14 @@ SpellCache::SpellCache() xFlushLstnr = pFlushLstnr; Reference aDictionaryList(GetDictionaryList()); pFlushLstnr->SetDicList( aDictionaryList ); //! after reference is established - Reference aPropertySet(GetLinguProperties()); + Reference aPropertySet(GetLinguProperties()); pFlushLstnr->SetPropSet( aPropertySet ); //! after reference is established } SpellCache::~SpellCache() { Reference aEmptyList; - Reference aEmptySet; + Reference aEmptySet; pFlushLstnr->SetDicList( aEmptyList ); pFlushLstnr->SetPropSet( aEmptySet ); } diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index fc69367d75be..75babc93dfce 100644 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -458,10 +458,34 @@ uno::Sequence< OUString > LinguProps::getSupportedServiceNames_Static() MutexGuard aGuard( GetLinguMutex() ); uno::Sequence< OUString > aSNS( 1 ); // more than 1 service possible - aSNS.getArray()[0] = SN_LINGU_PROPERTIES; + aSNS.getArray()[0] = "com.sun.star.linguistic2.LinguProperties"; return aSNS; } +sal_Bool LinguProps::getPropertyBool(const OUString& aPropertyName) throw (css::uno::RuntimeException) +{ + uno::Any any = getPropertyValue(aPropertyName); + sal_Bool b = sal_False; + any >>= b; + return b; +} + +sal_Int16 LinguProps::getPropertyInt16(const OUString& aPropertyName) throw (css::uno::RuntimeException) +{ + uno::Any any = getPropertyValue(aPropertyName); + sal_Int16 b = sal_False; + any >>= b; + return b; +} + +Locale LinguProps::getPropertyLocale(const OUString& aPropertyName) throw (css::uno::RuntimeException) +{ + uno::Any any = getPropertyValue(aPropertyName); + css::lang::Locale b; + any >>= b; + return b; +} + void * SAL_CALL LinguProps_getFactory( const sal_Char * pImplName, XMultiServiceFactory *pServiceManager, void * ) { diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx index bc46e0c59ac2..c4bbc6ce5550 100644 --- a/linguistic/source/lngopt.hxx +++ b/linguistic/source/lngopt.hxx @@ -27,12 +27,14 @@ #include #include #include -#include #include +#include #include +#include #include #include #include +#include #include #include @@ -92,7 +94,7 @@ typedef cppu::OMultiTypeInterfaceContainerHelperVar class LinguProps : public cppu::WeakImplHelper5 < - com::sun::star::beans::XPropertySet, + com::sun::star::linguistic2::XLinguProperties, com::sun::star::beans::XFastPropertySet, com::sun::star::beans::XPropertyAccess, com::sun::star::lang::XComponent, @@ -113,9 +115,84 @@ class LinguProps : void launchEvent( const ::com::sun::star::beans::PropertyChangeEvent &rEvt ) const; + sal_Bool getPropertyBool(const OUString& aPropertyName) throw (css::uno::RuntimeException); + sal_Int16 getPropertyInt16(const OUString& aPropertyName) throw (css::uno::RuntimeException); + css::lang::Locale getPropertyLocale(const OUString& aPropertyName) throw (css::uno::RuntimeException); + void setProperty(const OUString& aPropertyName, sal_Bool p1) throw (css::uno::RuntimeException) + { setPropertyValue( aPropertyName, css::uno::Any(p1) ); } + void setProperty(const OUString& aPropertyName, sal_Int16 p1) throw (css::uno::RuntimeException) + { setPropertyValue( aPropertyName, css::uno::Any(p1) ); } + void setProperty(const OUString& aPropertyName, css::lang::Locale p1) throw (css::uno::RuntimeException) + { setPropertyValue( aPropertyName, css::uno::Any(p1) ); } + public: LinguProps(); + virtual sal_Bool SAL_CALL getIsUseDictionaryList() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_USE_DICTIONARY_LIST); } + virtual void SAL_CALL setIsUseDictionaryList(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_USE_DICTIONARY_LIST, p1); } + virtual sal_Bool SAL_CALL getIsIgnoreControlCharacters() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_IGNORE_CONTROL_CHARACTERS); } + virtual void SAL_CALL setIsIgnoreControlCharacters(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_IGNORE_CONTROL_CHARACTERS, p1); } + virtual sal_Bool SAL_CALL getIsSpellUpperCase() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_SPELL_UPPER_CASE); } + virtual void SAL_CALL setIsSpellUpperCase(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_SPELL_UPPER_CASE, p1); } + virtual sal_Bool SAL_CALL getIsSpellWithDigits() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_SPELL_WITH_DIGITS); } + virtual void SAL_CALL setIsSpellWithDigits(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_SPELL_WITH_DIGITS, p1); } + virtual sal_Bool SAL_CALL getIsSpellCapitalization() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_SPELL_CAPITALIZATION); } + virtual void SAL_CALL setIsSpellCapitalization(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_SPELL_CAPITALIZATION, p1); } + virtual sal_Int16 SAL_CALL getHyphMinLeading() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_HYPH_MIN_LEADING); } + virtual void SAL_CALL setHyphMinLeading(sal_Int16 p1) throw (css::uno::RuntimeException) + { setProperty(UPN_HYPH_MIN_LEADING, p1); } + virtual sal_Int16 SAL_CALL getHyphMinTrailing() throw (css::uno::RuntimeException) + { return getPropertyInt16(UPN_HYPH_MIN_TRAILING); } + virtual void SAL_CALL setHyphMinTrailing(sal_Int16 p1) throw (css::uno::RuntimeException) + { setProperty(UPN_HYPH_MIN_TRAILING, p1); } + virtual sal_Int16 SAL_CALL getHyphMinWordLength() throw (css::uno::RuntimeException) + { return getPropertyInt16(UPN_HYPH_MIN_WORD_LENGTH); } + virtual void SAL_CALL setHyphMinWordLength(sal_Int16 p1) throw (css::uno::RuntimeException) + { setProperty(UPN_HYPH_MIN_WORD_LENGTH, p1); } + virtual com::sun::star::lang::Locale SAL_CALL getDefaultLocale() throw (css::uno::RuntimeException) + { return getPropertyLocale(UPN_DEFAULT_LOCALE); } + virtual void SAL_CALL setDefaultLocale(const com::sun::star::lang::Locale& p1) throw (css::uno::RuntimeException) + { setProperty(UPN_DEFAULT_LOCALE, p1); } + virtual sal_Bool SAL_CALL getIsHyphAuto() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_HYPH_AUTO); } + virtual void SAL_CALL setIsHyphAuto(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_HYPH_AUTO, p1); } + virtual sal_Bool SAL_CALL getIsHyphSpecial() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_HYPH_SPECIAL); } + virtual void SAL_CALL setIsHyphSpecial(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_HYPH_SPECIAL, p1); } + virtual sal_Bool SAL_CALL getIsSpellAuto() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_SPELL_AUTO); } + virtual void SAL_CALL setIsSpellAuto(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_SPELL_AUTO, p1); } + virtual sal_Bool SAL_CALL getIsSpellSpecial() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_SPELL_SPECIAL); } + virtual void SAL_CALL setIsSpellSpecial(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_SPELL_SPECIAL, p1); } + virtual sal_Bool SAL_CALL getIsWrapReverse() throw (css::uno::RuntimeException) + { return getPropertyBool(UPN_IS_WRAP_REVERSE); } + virtual void SAL_CALL setIsWrapReverse(sal_Bool p1) throw (css::uno::RuntimeException) + { setProperty(UPN_IS_WRAP_REVERSE, p1); } + virtual com::sun::star::lang::Locale SAL_CALL getDefaultLocale_CJK() throw (css::uno::RuntimeException) + { return getPropertyLocale(UPN_DEFAULT_LOCALE_CJK); } + virtual void SAL_CALL setDefaultLocale_CJK(const com::sun::star::lang::Locale& p1) throw (css::uno::RuntimeException) + { setProperty(UPN_DEFAULT_LOCALE_CJK, p1); } + virtual css::lang::Locale SAL_CALL getDefaultLocale_CTL() throw (css::uno::RuntimeException) + { return getPropertyLocale(UPN_DEFAULT_LOCALE_CTL); } + virtual void SAL_CALL setDefaultLocale_CTL(const com::sun::star::lang::Locale& p1) throw (css::uno::RuntimeException) + { setProperty(UPN_DEFAULT_LOCALE_CTL, p1); } + // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 10e343f756e6..91c59b5bae7b 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -24,19 +24,19 @@ #include #include #include -#include #include #include #include +#include #include #include #include - -#include -#include -#include #include #include +#include +#include +#include +#include #include #include #include @@ -741,28 +741,9 @@ sal_Bool IsNumeric( const String &rText ) -uno::Reference< XInterface > GetOneInstanceService( const char *pServiceName ) -{ - uno::Reference< XInterface > xRef; - - uno::Reference< XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - try - { - xRef = xMgr->createInstance( OUString::createFromAscii( pServiceName ) ); - } - catch (const uno::Exception &) - { - DBG_ASSERT( 0, "createInstance failed" ); - } - - return xRef; -} - -uno::Reference< XPropertySet > GetLinguProperties() +uno::Reference< XLinguProperties > GetLinguProperties() { - return uno::Reference< XPropertySet > ( - GetOneInstanceService( SN_LINGU_PROPERTIES ), UNO_QUERY ); + return LinguProperties::create( comphelper::getProcessComponentContext() ); } uno::Reference< XSearchableDictionaryList > GetDictionaryList() diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index f11dd388169b..e01b64de9d4d 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -223,6 +223,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/linguistic ConversionDictionaryList \ DictionaryList \ LanguageGuessing \ + LinguProperties \ LinguServiceManager \ Proofreader \ ProofreadingIterator \ @@ -967,7 +968,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/linguis Dictionary \ HangulHanjaConversionDictionary \ Hyphenator \ - LinguProperties \ SpellChecker \ Thesaurus \ )) @@ -2799,6 +2799,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/linguistic2,\ XHyphenatedWord \ XHyphenator \ XLanguageGuessing \ + XLinguProperties \ XLinguServiceEventBroadcaster \ XLinguServiceEventListener \ XLinguServiceManager \ diff --git a/offapi/com/sun/star/linguistic2/LinguProperties.idl b/offapi/com/sun/star/linguistic2/LinguProperties.idl index ffa183af95f5..4d56bba1a802 100644 --- a/offapi/com/sun/star/linguistic2/LinguProperties.idl +++ b/offapi/com/sun/star/linguistic2/LinguProperties.idl @@ -20,120 +20,14 @@ #ifndef __com_sun_star_linguistic2_LinguProperties_idl__ #define __com_sun_star_linguistic2_LinguProperties_idl__ -#include -#include -#include -#include +#include module com { module sun { module star { module linguistic2 { /** the set of linguistic relevant properties. */ -published service LinguProperties -{ - interface com::sun::star::beans::XPropertySet; - interface com::sun::star::beans::XFastPropertySet; - interface com::sun::star::lang::XComponent; - - /** defines whether new German spelling rules should be used for German - text or not when doing spell checking or hyphenation, or using the - thesaurus. - - @deprecated since OOo 3.0.1 - */ - [property, maybevoid] boolean IsGermanPreReform; - - /** defines if the dictionary-list should be used for spell checking - and hyphenation or not. - */ - [property] boolean IsUseDictionaryList; - - /** defines if control characters should be ignored or not, by the linguistic - (i.e., spell checker, hyphenator and thesaurus). - */ - [property] boolean IsIgnoreControlCharacters; - - /** defines if words with only uppercase letters should be - subject to spell checking or not. - */ - [property] boolean IsSpellUpperCase; - - /** defines if words containing digits (or numbers) should be - subject to spell checking or not. - */ - [property] boolean IsSpellWithDigits; - - /** defines if the capitalization of words should be checked or not. - */ - [property] boolean IsSpellCapitalization; - - /** the minimum number of characters of a word to remain before the - hyphen when doing hyphenation. - */ - [property] short HyphMinLeading; - - /** the minimum number of characters of a word to remain after the - hyphen when doing hyphenation. - */ - [property] short HyphMinTrailing; - - /** the minimum length of a word in order to be hyphenated. - */ - [property] short HyphMinWordLength; - - /** the default western language for new documents. - */ - [property] com::sun::star::lang::Locale DefaultLocale; - - /** defines whether interactive hyphenation should be performed without - requiring the user to select every hyphenation position after the user - has triggered the hyphenation. - */ - [property] boolean IsHyphAuto; - - /** defines whether hyphenation should be done in special regions of - documents or not. - */ - [property] boolean IsHyphSpecial; - - /** indicates whether spell checking should be done automatically or not. - */ - [property] boolean IsSpellAuto; - - /** indicates whether the markings for incorrectly spelled text should be - hidden or not. - - @deprecated since OOo 3.0.1 - */ - [property, maybevoid] boolean IsSpellHide; - - /** indicates if spell checking should be performed in all available - languages. - - @deprecated since OOo 3.0.1 - */ - [property, maybevoid] boolean IsSpellInAllLanguages; - - /** defines whether spell checking should be done in special regions of - documents or not. - */ - [property] boolean IsSpellSpecial; - - /** defines whether spell checking should be done in reverse - direction or not. - */ - [property] boolean IsWrapReverse; - - /** the default language for CJK languages. - */ - [property] com::sun::star::lang::Locale DefaultLocale_CJK; - - /** the default language for CTL languages. - */ - [property] com::sun::star::lang::Locale DefaultLocale_CTL; - -}; +published service LinguProperties : XLinguProperties; }; }; }; }; diff --git a/offapi/com/sun/star/linguistic2/XLinguProperties.idl b/offapi/com/sun/star/linguistic2/XLinguProperties.idl new file mode 100644 index 000000000000..83b39f6016f3 --- /dev/null +++ b/offapi/com/sun/star/linguistic2/XLinguProperties.idl @@ -0,0 +1,122 @@ +/* -*- 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 . + */ + +#ifndef __com_sun_star_linguistic2_XLinguProperties_idl__ +#define __com_sun_star_linguistic2_XLinguProperties_idl__ + +#include +#include +#include +#include + + +module com { module sun { module star { module linguistic2 { + +/** + Interface for LinguProperties service. + + @since LibreOffice 4.1 +*/ +published interface XLinguProperties +{ + interface com::sun::star::beans::XPropertySet; + + /** defines if the dictionary-list should be used for spell checking + and hyphenation or not. + */ + [attribute] boolean IsUseDictionaryList; + + /** defines if control characters should be ignored or not, by the linguistic + (i.e., spell checker, hyphenator and thesaurus). + */ + [attribute] boolean IsIgnoreControlCharacters; + + /** defines if words with only uppercase letters should be + subject to spell checking or not. + */ + [attribute] boolean IsSpellUpperCase; + + /** defines if words containing digits (or numbers) should be + subject to spell checking or not. + */ + [attribute] boolean IsSpellWithDigits; + + /** defines if the capitalization of words should be checked or not. + */ + [attribute] boolean IsSpellCapitalization; + + /** the minimum number of characters of a word to remain before the + hyphen when doing hyphenation. + */ + [attribute] short HyphMinLeading; + + /** the minimum number of characters of a word to remain after the + hyphen when doing hyphenation. + */ + [attribute] short HyphMinTrailing; + + /** the minimum length of a word in order to be hyphenated. + */ + [attribute] short HyphMinWordLength; + + /** the default western language for new documents. + */ + [attribute] com::sun::star::lang::Locale DefaultLocale; + + /** defines whether interactive hyphenation should be performed without + requiring the user to select every hyphenation position after the user + has triggered the hyphenation. + */ + [attribute] boolean IsHyphAuto; + + /** defines whether hyphenation should be done in special regions of + documents or not. + */ + [attribute] boolean IsHyphSpecial; + + /** indicates whether spell checking should be done automatically or not. + */ + [attribute] boolean IsSpellAuto; + + /** defines whether spell checking should be done in special regions of + documents or not. + */ + [attribute] boolean IsSpellSpecial; + + /** defines whether spell checking should be done in reverse + direction or not. + */ + [attribute] boolean IsWrapReverse; + + /** the default language for CJK languages. + */ + [attribute] com::sun::star::lang::Locale DefaultLocale_CJK; + + /** the default language for CTL languages. + */ + [attribute] com::sun::star::lang::Locale DefaultLocale_CTL; + +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/offapi.rdb b/offapi/type_reference/offapi.rdb index fc2dc3299087..0d73ab1bc233 100644 Binary files a/offapi/type_reference/offapi.rdb and b/offapi/type_reference/offapi.rdb differ -- cgit v1.2.3