diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2010-09-29 10:05:34 +0200 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2010-09-29 10:05:34 +0200 |
commit | 1f64b659bd4789052399373357c19e7e8c34f3f9 (patch) | |
tree | 035894eecfa10adb02823b6611f33a8c3b40f12d /cui | |
parent | 76ce927a891e8dd3ba9ccd33bfdce0451102755b (diff) | |
parent | ff4d607364b8033782b42cef9d2e33b99fb2e160 (diff) |
CWS-TOOLING: integrate CWS tl82
Diffstat (limited to 'cui')
-rwxr-xr-x | cui/source/dialogs/SpellDialog.cxx | 103 | ||||
-rwxr-xr-x | cui/source/dialogs/thesdlg.cxx | 37 | ||||
-rwxr-xr-x[-rw-r--r--] | cui/source/options/webconninfo.cxx | 6 |
3 files changed, 61 insertions, 85 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 303b54688eea..4fde01da986e 100755 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -76,6 +76,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::linguistic2; +using ::rtl::OUString; + #define C2U(cChar) ::rtl::OUString::createFromAscii(cChar) // struct SpellDialog_Impl --------------------------------------------- @@ -930,7 +932,7 @@ void SpellDialog::SetTitle_Impl(LanguageType nLang) -----------------------------------------------------------------------*/ void SpellDialog::InitUserDicts() { - sal_uInt16 nLang = aLanguageLB.GetSelectLanguage(); + const LanguageType nLang = aLanguageLB.GetSelectLanguage(); const Reference< XDictionary > *pDic = 0; @@ -948,51 +950,50 @@ void SpellDialog::InitUserDicts() pImpl->aDics = xDicList->getDictionaries(); } - // Benutzerbuecher anzeigen + SvtLinguConfig aCfg; + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + + // list suitable dictionaries + bool bEnable = false; const sal_Int32 nSize = pImpl->aDics.getLength(); pDic = pImpl->aDics.getConstArray(); - sal_Int32 i; delete aAddToDictMB.GetPopupMenu(); PopupMenu* pMenu = new PopupMenu; - for (i = 0; i < nSize; ++i ) + pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); + USHORT nItemId = 1; // menu items should be enumerated from 1 and not 0 + for (sal_Int32 i = 0; i < nSize; ++i) { - Reference< XDictionary > xDic( pDic[i], UNO_QUERY ); - if (!xDic.is() || SvxGetIgnoreAllList() == xDic) + uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); + if (!xDicTmp.is() || SvxGetIgnoreAllList() == xDicTmp) continue; - // add only active and not read-only dictionaries to list - // from which to choose from - Reference< frame::XStorable > xStor( xDic, UNO_QUERY ); - if ( xDic->isActive() && (!xStor.is() || !xStor->isReadonly()) ) + uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY ); + LanguageType nActLanguage = SvxLocaleToLanguage( xDicTmp->getLocale() ); + if( xDicTmp->isActive() + && xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE + && (nLang == nActLanguage || LANGUAGE_NONE == nActLanguage ) + && (!xStor.is() || !xStor->isReadonly()) ) { - sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE; - pMenu->InsertItem( (USHORT)i + 1, ::GetDicInfoStr( xDic->getName(), - SvxLocaleToLanguage( xDic->getLocale() ), bNegativ ) ); - } - } - aAddToDictMB.SetPopupMenu(pMenu); - - aAddToDictMB.Disable(); + pMenu->InsertItem( nItemId, xDicTmp->getName() ); + bEnable = sal_True; - sal_uInt16 k; - for ( k = 0; k < pMenu->GetItemCount(); ++k ) - { - sal_uInt16 nId = pMenu->GetItemId(k) - 1; - sal_Bool bFound = sal_False; - - const sal_uInt16 nDicLang = SvxLocaleToLanguage( pDic[nId]->getLocale() ); - const sal_Bool bDicNegativ = - pDic[nId]->getDictionaryType() == DictionaryType_NEGATIVE; - // Stimmt die Sprache "uberein, dann enable - if ((nDicLang == nLang || nDicLang == LANGUAGE_NONE) && !bDicNegativ) - bFound = sal_True; + uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); + if (xSvcInfo.is()) + { + OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage( + xSvcInfo->getImplementationName(), bHC) ); + if (aDictionaryImageUrl.getLength() > 0) + { + Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); + pMenu->SetItemImage( nItemId, aImage ); + } + } - if (bFound) - { - aAddToDictMB.Enable(); - break; + ++nItemId; } } + aAddToDictMB.SetPopupMenu(pMenu); + aAddToDictMB.Enable( bEnable ); } /*-- 20.10.2003 15:31:06--------------------------------------------------- @@ -1000,31 +1001,39 @@ void SpellDialog::InitUserDicts() IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton ) { aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - USHORT nItem = pButton->GetCurItemId(); //GetErrorText() returns the current error even if the text is already //manually changed - String sNewWord= aSentenceED.GetErrorText(); + const String aNewWord= aSentenceED.GetErrorText(); + + USHORT nItemId = pButton->GetCurItemId(); + PopupMenu *pMenu = pButton->GetPopupMenu(); + String aDicName ( pMenu->GetItemText( nItemId ) ); + + uno::Reference< linguistic2::XDictionary > xDic; + uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); + if (xDicList.is()) + xDic = xDicList->getDictionaryByName( aDicName ); - Reference< XDictionary > xDic( pImpl->aDics.getConstArray()[ nItem - 1 ], UNO_QUERY ); sal_Int16 nAddRes = DIC_ERR_UNKNOWN; if (xDic.is()) { - String sTmpTxt( sNewWord ); - sal_Bool bNegEntry = xDic->getDictionaryType() == DictionaryType_NEGATIVE; - nAddRes = linguistic::AddEntryToDic( xDic, sTmpTxt, bNegEntry, - ::rtl::OUString(), LANGUAGE_NONE ); + nAddRes = linguistic::AddEntryToDic( xDic, aNewWord, FALSE, OUString(), LANGUAGE_NONE ); + // save modified user-dictionary if it is persistent + uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); + if (xSavDic.is()) + xSavDic->store(); - if(nAddRes == DIC_ERR_NONE) + if (nAddRes == DIC_ERR_NONE) { SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink); - pAction->SetDictionary(xDic); - pAction->SetAddedWord(sTmpTxt); - aSentenceED.AddUndoAction(pAction); + pAction->SetDictionary( xDic ); + pAction->SetAddedWord( aNewWord ); + aSentenceED.AddUndoAction( pAction ); } // failed because there is already an entry? - if (DIC_ERR_NONE != nAddRes && xDic->getEntry( sTmpTxt ).is()) + if (DIC_ERR_NONE != nAddRes && xDic->getEntry( aNewWord ).is()) nAddRes = DIC_ERR_NONE; } if (DIC_ERR_NONE != nAddRes) @@ -1032,8 +1041,6 @@ IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton ) SvxDicError( this, nAddRes ); return 0; // Nicht weitermachen } - // nach dem Aufnehmen ggf. '='-Zeichen entfernen - sNewWord.EraseAllChars( sal_Unicode( '=' ) ); // go on SpellContinue_Impl(); diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index ec04362b488d..c1811b196895 100755 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -57,6 +57,7 @@ #include <i18npool/mslangid.hxx> #include <comphelper/processfactory.hxx> #include <osl/file.hxx> +#include <svl/lngmisc.hxx> #include <stack> @@ -73,36 +74,6 @@ using ::rtl::OUString; #define A2S(x) String::CreateFromAscii( x ) - -// GetReplaceEditString ------------------------------- - -static void GetReplaceEditString( String &rText ) -{ - // The strings returned by the thesaurus saometimes have some - // explanation text put in between '(' and ')' or a trailing '*'. - // These parts should not be put in the ReplaceEdit Text that may get - // inserted into the document. Thus we strip them from the text. - - xub_StrLen nPos = rText.Search( sal_Unicode('(') ); - while (STRING_NOTFOUND != nPos) - { - xub_StrLen nEnd = rText.Search( sal_Unicode(')'), nPos ); - if (STRING_NOTFOUND != nEnd) - rText.Erase( nPos, nEnd-nPos+1 ); - else - break; - nPos = rText.Search( sal_Unicode('(') ); - } - - nPos = rText.Search( sal_Unicode('*') ); - if (STRING_NOTFOUND != nPos) - rText.Erase( nPos ); - - // remove any possible remaining ' ' that may confuse the thesaurus - // when it gets called with the text - rText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); -} - // class LookUpComboBox_Impl -------------------------------------------------- LookUpComboBox_Impl::LookUpComboBox_Impl( @@ -488,7 +459,7 @@ IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) { USHORT nPos = pBox->GetSelectEntryPos(); String aStr( pBox->GetEntry( nPos ) ); - GetReplaceEditString( aStr ); + aStr = linguistic::GetThesaurusReplaceText( aStr ); aWordCB.SetText( aStr ); LookUp_Impl(); } @@ -507,7 +478,7 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox if (pData && !pData->IsHeader()) { aStr = pData->GetText(); - GetReplaceEditString( aStr ); + aStr = linguistic::GetThesaurusReplaceText( aStr ); } aReplaceEdit.SetText( aStr ); } @@ -525,7 +496,7 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis if (pData && !pData->IsHeader()) { aStr = pData->GetText(); - GetReplaceEditString( aStr ); + aStr = linguistic::GetThesaurusReplaceText( aStr ); } aWordCB.SetText( aStr ); diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx index 5c5dcdae4ade..c52168fb1ab6 100644..100755 --- a/cui/source/options/webconninfo.cxx +++ b/cui/source/options/webconninfo.cxx @@ -311,10 +311,8 @@ IMPL_LINK( WebConnectionInfoDialog, ChangePasswordHdl, PushButton*, EMPTYARG ) ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 ); ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); - ::comphelper::DocPasswordRequest* pPasswordRequest - = new ::comphelper::DocPasswordRequest( - ::comphelper::DocPasswordRequestType_STANDARD, - task::PasswordRequestMode_PASSWORD_CREATE, aURL ); + ::comphelper::SimplePasswordRequest* pPasswordRequest + = new ::comphelper::SimplePasswordRequest( task::PasswordRequestMode_PASSWORD_CREATE ); uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest ); uno::Reference< task::XInteractionHandler > xInteractionHandler( |