32#include <editeng/editeng.hxx>
42#include <svx/svxids.hrc>
43#include <osl/diagnose.h>
65 OUString aScriptTypesInUse( OUString::number(
static_cast<int>(nScriptType) ) );
68 OUString aKeyboardLang;
74 OUString aCurrentLang(
"*");
81 uno::Sequence< OUString >
aSeq{ aCurrentLang,
95 bool bRestoreSelection =
false;
101 OUString aNewLangText;
112 if (aNewLangText ==
"*" )
122 if (!aNewLangText.isEmpty())
124 static constexpr OUStringLiteral aSelectionLangPrefix(
u"Current_");
125 static constexpr OUStringLiteral aParagraphLangPrefix(
u"Paragraph_");
126 static constexpr OUStringLiteral aDocumentLangPrefix(
u"Default_");
129 bool bForSelection =
true;
130 bool bForParagraph =
false;
131 if (-1 != (
nPos = aNewLangText.indexOf( aSelectionLangPrefix )))
134 aNewLangText = aNewLangText.replaceAt(
nPos, aSelectionLangPrefix.getLength(),
u"");
135 bForSelection =
true;
137 else if (-1 != (
nPos = aNewLangText.indexOf( aParagraphLangPrefix )))
140 aNewLangText = aNewLangText.replaceAt(
nPos, aParagraphLangPrefix.getLength(),
u"");
141 bForSelection =
true;
142 bForParagraph =
true;
144 else if (-1 != (
nPos = aNewLangText.indexOf( aDocumentLangPrefix )))
147 aNewLangText = aNewLangText.replaceAt(
nPos, aDocumentLangPrefix.getLength(),
u"");
148 bForSelection =
false;
153 bRestoreSelection =
true;
168 if (aNewLangText ==
"LANGUAGE_NONE")
170 else if (aNewLangText ==
"RESET_LANGUAGES")
189 return bRestoreSelection;
204 OSL_ENSURE( !pOLV || pEditEngine,
"OutlinerView without EditEngine???" );
207 sal_uInt16 nLangWhichId = 0;
208 bool bIsSingleScriptType =
true;
215 bIsSingleScriptType =
false;
216 OSL_FAIL(
"unexpected case" );
218 if (!bIsSingleScriptType)
242 switch (nLangWhichId)
266 const sal_uInt16 aLangWhichId_EE[3] =
274 const sal_uInt16 aLangWhichId_Writer[3] =
288 OSL_ENSURE( !pOLV || pEditEngine,
"OutlinerView without EditEngine???" );
291 for (sal_uInt16
i : aLangWhichId_EE)
298 for (sal_uInt16
i : aLangWhichId_Writer)
306 for (sal_uInt16
i : aLangWhichId_Writer)
338 pEditEngine->
SetControlWord(nCntrl & ~EEControlBits::ONLINESPELLING);
372 if (
nState > SfxItemState::DEFAULT && pItem)
377 else if (
nState == SfxItemState::DEFAULT)
382 else if (
nState == SfxItemState::DONTCARE)
399 sal_uInt16 nLangWhichId = 0;
400 bool bIsSingleScriptType =
true;
406 default: bIsSingleScriptType =
false;
break;
411 if (bIsSingleScriptType)
418 const sal_uInt16 aScriptTypes[3] =
435 OSL_ENSURE( nCurrentLang !=
LANGUAGE_SYSTEM,
"failed to get the language?" );
447 sal_uInt16 nLangWhichId = 0;
448 bool bIsSingleScriptType =
true;
454 default: bIsSingleScriptType =
false;
459 if (bIsSingleScriptType)
466 const sal_uInt16 aScriptTypes[3] =
483 OSL_ENSURE( nCurrentLang !=
LANGUAGE_SYSTEM,
"failed to get the language?" );
497 if (!aText.isEmpty())
501 const sal_Int32 nStt = nEnd > 100 ? nEnd - 100 : 0;
503 nEnd = aText.getLength() - nEnd > 100 ? nEnd + 100 : aText.getLength();
504 aText = aText.copy( nStt, nEnd - nStt );
516 if (!aText.isEmpty())
519 sal_Int32 nEnd = rDocSelection.
nEndPos;
521 nStt = nEnd > 100 ? nEnd - 100 : 0;
523 nEnd = aText.getLength() - nEnd > 100 ? nEnd + 100 : aText.getLength();
524 aText = aText.copy( nStt, nEnd - nStt );
const OUString & GetValue() const
OUString GetText(LineEnd eEnd=LINEEND_LF) const
EEControlBits GetControlWord() const
void CompleteOnlineSpelling()
void SetControlWord(EEControlBits nWord)
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
void RemoveAttribs(bool bRemoveParaAttribs=false, sal_uInt16 nWhich=0)
void SetSelection(const ESelection &rNewSel)
const SfxItemSet & GetEmptyItemSet() const
LanguageType GetInputLanguage() const
EditEngine * GetEditEngine() const
SvtScriptType GetSelectedScriptType() const
ESelection GetSelection() const
EditView & GetEditView() const
static SfxAbstractDialogFactory * Create()
void Invalidate(sal_uInt16 nId)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
const T * GetArg(sal_uInt16 nSlotId) const
void Done(bool bRemove=false)
void SetStringList(const css::uno::Sequence< OUString > &rList)
SfxBindings & GetBindings()
weld::Window * GetFrameWeld() const
SfxViewFrame & GetViewFrame() const
static OUString GetLanguageString(const LanguageType eType)
static LanguageType GetLanguageType(std::u16string_view rStr)
LanguageType GetLanguage() const
void ExtendedSelectAll(bool bFootnotes=true)
void Push()
store a copy of the current cursor on the cursor stack
bool MovePara(SwWhichPara, SwMoveFnCollection const &)
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
void EndAction(const bool bIdleEnd=false)
SwDocShell * GetDocShell()
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in document.
SvtScriptType GetScriptType() const
returns the script type of the selection
void ResetAttr(const o3tl::sorted_vector< sal_uInt16 > &attrs=o3tl::sorted_vector< sal_uInt16 >(), SwPaM *pCursor=nullptr)
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
PaM is Point and Mark: a selection of the document model.
SwNode & GetPointNode() const
const SwPosition * GetPoint() const
SwTextNode is a paragraph in the document model.
const OUString & GetText() const
const SfxItemPool & GetAttrPool() const
Used by the UI to modify the document model.
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
std::pair< const_iterator, bool > insert(Value &&x)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
OUString const aScriptType
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
#define LANGUAGE_DONTKNOW
Sequence< sal_Int8 > aSeq
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
LanguageType GetCurrentLanguage(SfxItemSet const &aSet, SvtScriptType nScriptType)
void SelectPara(EditView &rEditView, const ESelection &rCurSel)
void SetLanguage_None(SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet)
void ResetLanguages(SwWrtShell &rWrtSh, OutlinerView const *pOLV=nullptr)
void SelectCurrentPara(SwWrtShell &rWrtSh)
void GetLanguageStatus(OutlinerView *pOLV, SfxItemSet &rSet)
bool SetLanguageStatus(OutlinerView *pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh)
void SetLanguage(SwWrtShell &rWrtSh, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
OUString GetTextForLanguageGuessing(EditEngine const *rEditEngine, const ESelection &rDocSelection)
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
bool GoCurrPara(SwPaM &rPam, SwMoveFnCollection const &aPosPara)
SwMoveFnCollection const & fnParaStart
SwMoveFnCollection const & fnParaEnd
static LanguageType nLang
sal_Int32 GetContentIndex() const