summaryrefslogtreecommitdiff
path: root/sw/source/ui/shells/drwtxtex.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/shells/drwtxtex.cxx')
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx134
1 files changed, 93 insertions, 41 deletions
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
index 94d49720a50c..c95ad7e64c1c 100644
--- a/sw/source/ui/shells/drwtxtex.cxx
+++ b/sw/source/ui/shells/drwtxtex.cxx
@@ -27,8 +27,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-#include <hintids.hxx>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <i18npool/mslangid.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
#include <tools/shl.hxx>
#include <svx/svdview.hxx>
#include <editeng/spltitem.hxx>
@@ -37,9 +43,7 @@
#include <editeng/widwitem.hxx>
#include <editeng/kernitem.hxx>
#include <editeng/escpitem.hxx>
-#ifndef _SVX_PARAITEM_HXX //autogen
#include <editeng/lspcitem.hxx>
-#endif
#include <editeng/adjitem.hxx>
#include <editeng/crsditem.hxx>
#include <editeng/shdditem.hxx>
@@ -49,9 +53,7 @@
#include <editeng/fhgtitem.hxx>
#include <editeng/colritem.hxx>
#include <editeng/wghtitem.hxx>
-#ifndef _SVX_CNTRITEM_HXX //autogen
#include <editeng/cntritem.hxx>
-#endif
#include <editeng/postitem.hxx>
#include <editeng/frmdiritem.hxx>
#include <svx/svdoutl.hxx>
@@ -59,6 +61,8 @@
#include <svl/whiter.hxx>
#include <svl/cjkoptions.hxx>
#include <svl/ctloptions.hxx>
+#include <svtools/langtab.hxx>
+#include <svl/languageoptions.hxx>
#include <sfx2/bindings.hxx>
#include <vcl/msgbox.hxx>
#include <sfx2/dispatch.hxx>
@@ -67,48 +71,66 @@
#include <editeng/editstat.hxx>
#include <svx/hlnkitem.hxx>
#include <svx/htmlmode.hxx>
+#include <svl/languageoptions.hxx>
+#include <svl/slstitm.hxx>
#include <editeng/langitem.hxx>
+#include <svtools/langtab.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/scripttypeitem.hxx>
#include <editeng/writingmodeitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/outliner.hxx>
+#include <vcl/window.hxx>
+#include <editeng/editview.hxx>
+#include <vcl/outdev.hxx>
+#include <editeng/hyznitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/orphitem.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/spltitem.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdview.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/widwitem.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
+
+#include <cmdid.h>
#include <doc.hxx>
-#include <wview.hxx>
-#include <viewopt.hxx>
-#include <wrtsh.hxx>
-#include <uitool.hxx>
+#include <docstat.hxx>
+#include <drwtxtsh.hxx>
+#include <edtwin.hxx>
+#include <globals.hrc>
+#include <hintids.hxx>
+#include <initui.hxx> // fuer SpellPointer
+#include <langhelper.hxx>
#include <pardlg.hxx>
+#include <shells.hrc>
+#include <string.h>
#include <swdtflvr.hxx>
-#include <drwtxtsh.hxx>
#include <swmodule.hxx>
-#include <initui.hxx> // fuer SpellPointer
-#include <edtwin.hxx>
#include <swwait.hxx>
-#include <docstat.hxx>
-
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <uitool.hxx>
+#include <viewopt.hxx>
+#include <wrtsh.hxx>
+#include <wview.hxx>
-#include <cmdid.h>
-#include <globals.hrc>
-#include <shells.hrc>
#include "swabstdlg.hxx"
#include "chrdlg.hrc"
#include "misc.hrc"
-//modified on Jul. 30th
-#include <svl/languageoptions.hxx>
-#include <editeng/langitem.hxx>
-#include <svtools/langtab.hxx>
-#include <svl/slstitm.hxx>
-#include <string.h>
-
-#include <editeng/eeitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/outliner.hxx>
-#include <vcl/window.hxx>
-#include <editeng/editview.hxx>
-#include <vcl/outdev.hxx>
#include <langhelper.hxx>
@@ -148,6 +170,18 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh);
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;
+ }
+
case SID_ATTR_CHAR_FONT:
case SID_ATTR_CHAR_FONTHEIGHT:
case SID_ATTR_CHAR_WEIGHT:
@@ -569,7 +603,27 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet)
nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);;
break;
}
- case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST;
+
+ case SID_THES:
+ {
+ String aStatusVal;
+ LanguageType nLang = LANGUAGE_NONE;
+ bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
+ rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
+
+ // disable "Thesaurus" context menu entry if there is nothing to look up
+ uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
+ lang::Locale aLocale( SvxCreateLocale( nLang ) );
+ 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;
+ }
+
+ case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST;
case SID_ATTR_PARA_ADJUST_RIGHT: eAdjust = SVX_ADJUST_RIGHT; goto ASK_ADJUST;
case SID_ATTR_PARA_ADJUST_CENTER: eAdjust = SVX_ADJUST_CENTER; goto ASK_ADJUST;
case SID_ATTR_PARA_ADJUST_BLOCK: eAdjust = SVX_ADJUST_BLOCK; goto ASK_ADJUST;
@@ -620,19 +674,17 @@ ASK_ESCAPE:
}
break;
- case FN_THESAURUS_DLG:
+ case SID_THESAURUS:
{
// disable "Thesaurus" if the language is not supported
const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault(
GetWhichOfScript( RES_CHRATR_LANGUAGE,
GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage())) );
- LanguageType nLang = ((const SvxLanguageItem &)
- rItem).GetLanguage();
- //
+ LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage();
+
uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
- if (!xThes.is() || nLang == LANGUAGE_NONE ||
- !xThes->hasLocale( SvxCreateLocale( nLang ) ))
- rSet.DisableItem( FN_THESAURUS_DLG );
+ if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) ))
+ rSet.DisableItem( SID_THESAURUS );
nSlotId = 0;
}
break;