diff options
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 29 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 16 |
2 files changed, 45 insertions, 0 deletions
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: { |