diff options
author | Thomas Lange <tl@openoffice.org> | 2009-11-25 16:50:53 +0000 |
---|---|---|
committer | Thomas Lange <tl@openoffice.org> | 2009-11-25 16:50:53 +0000 |
commit | 26999baa19f28e4916df28bc8c2eca2f88b70cbd (patch) | |
tree | b31179ccbbc0982b271071b6668526750957129a | |
parent | 457052817ad4b0e04dda1d0931f7b8c900c0818f (diff) |
#i51258# thesaurus for right click context menu
-rw-r--r-- | sd/sdi/drtxtob.sdi | 6 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 29 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 16 | ||||
-rw-r--r-- | sd/uiconfig/sdraw/menubar/menubar.xml | 2 | ||||
-rw-r--r-- | sd/uiconfig/simpress/menubar/menubar.xml | 2 |
5 files changed, 53 insertions, 2 deletions
diff --git a/sd/sdi/drtxtob.sdi b/sd/sdi/drtxtob.sdi index 4e2ca49c0b82..f4133f0f4643 100644 --- a/sd/sdi/drtxtob.sdi +++ b/sd/sdi/drtxtob.sdi @@ -202,5 +202,11 @@ shell TextObjectBar ExecMethod = Execute; StateMethod = GetAttrState; ] + SID_THES + [ + ExecMethod = Execute ; + StateMethod = GetAttrState ; + ] + } diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 55980ff02050..7e3e48b7a59d 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -33,14 +33,21 @@ #include "TextObjectBar.hxx" +#include <com/sun/star/i18n/WordType.hpp> +#include <i18npool/mslangid.hxx> #include <svx/ulspitem.hxx> #include <svx/lspcitem.hxx> #include <svx/adjitem.hxx> +#include <svx/editview.hxx> +#include <svx/editeng.hxx> +#include <svx/outliner.hxx> +#include <svx/unolingu.hxx> #include <vcl/vclenum.hxx> #include <sfx2/app.hxx> #include <svtools/whiter.hxx> #include <svtools/itempool.hxx> +#include <svtools/stritem.hxx> #include <svtools/style.hxx> #include <svtools/languageoptions.hxx> #include <sfx2/tplpitem.hxx> @@ -73,6 +80,8 @@ using namespace sd; +using namespace ::com::sun::star; + #define TextObjectBar #include "sdslots.hxx" @@ -373,6 +382,26 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } break; + case SID_THES: + { + EditView & rEditView = mpView->GetTextEditOutlinerView()->GetEditView();; + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + lang::Locale aLocale( SvxCreateLocale( nLang ) ); + uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() ); + if (!bIsLookUpWord || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + + //! avoid puting the same item as SfxBoolItem at the end of this function
+ nSlotId = 0;
+ } + break; + default: break; } diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 9c2733c933dd..b128472ac61c 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -33,6 +33,12 @@ #include "TextObjectBar.hxx" +#include <com/sun/star/i18n/WordType.hpp> + +//#include <i18npool/mslangid.hxx> +#include <svx/editview.hxx> +#include <svx/editeng.hxx> +#include <svx/unolingu.hxx> #include <svx/outliner.hxx> #ifndef _ULSPITEM_HXX @@ -341,6 +347,16 @@ void TextObjectBar::Execute( SfxRequest &rReq ) } break; + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); + } + break; default: { diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml index 04e085c6050f..a7ce6d3f76cb 100644 --- a/sd/uiconfig/sdraw/menubar/menubar.xml +++ b/sd/uiconfig/sdraw/menubar/menubar.xml @@ -214,7 +214,7 @@ <menu:menupopup> <menu:menuitem menu:id=".uno:HangulHanjaConversion"/> <menu:menuitem menu:id=".uno:ChineseConversion"/> - <menu:menuitem menu:id=".uno:Thesaurus"/> + <menu:menuitem menu:id=".uno:ThesaurusDialog"/> <menu:menuitem menu:id=".uno:Hyphenation"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:MoreDictionaries"/> diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index 2483b61bd01e..fd565d5d7c8c 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -242,7 +242,7 @@ <menu:menupopup> <menu:menuitem menu:id=".uno:HangulHanjaConversion"/> <menu:menuitem menu:id=".uno:ChineseConversion"/> - <menu:menuitem menu:id=".uno:Thesaurus"/> + <menu:menuitem menu:id=".uno:ThesaurusDialog"/> <menu:menuitem menu:id=".uno:Hyphenation"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:MoreDictionaries"/> |