21#include <com/sun/star/i18n/WordType.hpp>
47#include <osl/diagnose.h>
80 bool bKeyProcessed =
false;
85 sal_uInt16 nCode = aKeyCode.
GetCode();
94 if ( eFunc != KeyFuncType::DONTKNOW )
98 case KeyFuncType::CUT:
103 bKeyProcessed =
true;
107 case KeyFuncType::COPY:
110 bKeyProcessed =
true;
113 case KeyFuncType::PASTE:
118 bKeyProcessed =
true;
122 case KeyFuncType::DELETE:
139 eFunc = KeyFuncType::DONTKNOW;
142 if ( eFunc == KeyFuncType::DONTKNOW )
155 bKeyProcessed =
true;
161 bKeyProcessed =
true;
203 SAL_WARN_IF( nTemp < 0,
"editeng",
"OutlinerView::PostKeyEvent - overflow");
213 bKeyProcessed =
true;
217 if( !bKeyProcessed && !bSelection &&
231 bKeyProcessed =
true;
239 return bKeyProcessed ||
pEditView->PostKeyEvent( rKEvt, pFrameWin );
246 Point aMousePosWin =
pEditView->GetOutputDevice().PixelToLogic( rPosPix );
247 if( !
pEditView->GetOutputArea().Contains( aMousePosWin ) )
255 Point aPaperPos( aMousePosWin );
291 if( !
pEditView->GetOutputArea().Contains( aMousePosWin ) )
295 pEditView->GetWindow()->SetPointer( aPointer );
303 return pEditView->MouseButtonDown( rMEvt );
306 if( !
pEditView->GetOutputArea().Contains( aMousePosWin ) )
310 pEditView->GetWindow()->SetPointer( aPointer );
320 sal_Int32 nEndPara = nPara;
327 else if( rMEvt.
GetClicks() == 2 && bHasChildren )
344 return pEditView->MouseButtonDown( rMEvt );
351 return pEditView->MouseButtonUp( rMEvt );
354 if( !
pEditView->GetOutputArea().Contains( aMousePosWin ) )
358 pEditView->GetWindow()->SetPointer( aPointer );
360 return pEditView->MouseButtonUp( rMEvt );
412 pEditView->SetEditEngineUpdateLayout( bUpdate );
422 if ( bIncludeHiddenChildren )
450 sal_Int16 nMinDepth = -1;
457 sal_Int16 nOldDepth = pPara->
GetDepth();
458 sal_Int16 nNewDepth = nOldDepth + nDiff;
460 if( bOutlinerView && nPara )
463 if( (bPage && (nDiff == +1)) || (!bPage && (nDiff == -1) && (nOldDepth <= 0)) )
485 if( (nOldDepth == 0) && (nNewDepth == -1) )
489 if( nOldDepth == -1 )
497 if( nOldDepth < nMinDepth )
498 nMinDepth = nOldDepth;
499 if( nNewDepth < nMinDepth )
500 nMinDepth = nNewDepth;
502 if( nOldDepth != nNewDepth )
549 for ( sal_Int32
n = aSel.
nEndPara+1;
n < nParas;
n++ )
552 if ( pPara->
GetDepth() < nMinDepth )
559 pEditView->SetEditEngineUpdateLayout(
true );
610 for ( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
648 sal_Int32 nStart, nParaCount;
653 pEditView->SetEditEngineUpdateLayout( bPrevUpdateLayout );
694 for( sal_Int32 nPara = 0; nPara < nParaCount; nPara++ )
698 pEditView->SetEditEngineUpdateLayout( bPrevUpdateLayout );
714 aSelList.push_back(pPara);
752 ePointerStyle = PointerStyle::RefHand;
756 ePointerStyle = PointerStyle::Move;
759 return ePointerStyle;
778 if( nCurParaCount < nPrevParaCount )
779 nSize = nSize - ( nPrevParaCount - nCurParaCount );
781 nSize = nSize + ( nCurParaCount - nPrevParaCount );
792 sal_Int32 nLast = nFirst+
nCount;
806 sal_Int32 nPages = 0;
809 if ( !bIncludeFirstSelected )
811 for ( sal_Int32 nPara = nStartPara; nPara <= aSel.
nEndPara; nPara++ )
814 DBG_ASSERT(pPara,
"ImpCalcSelectedPages: invalid Selection? ");
842 sal_Int16 nNewDepth = -2;
843 const SvxNumRule* pDefaultBulletNumRule =
nullptr;
848 DBG_ASSERT(pPara,
"OutlinerView::ToggleBullets(), illegal selection?");
852 if( nNewDepth == -2 )
855 if ( nNewDepth == 0 )
862 pDefaultBulletNumRule = pNumBulletItem ? &pNumBulletItem->
GetNumRule() :
nullptr;
868 if( nNewDepth == -1 )
880 if ( pDefaultBulletNumRule )
888 SvxNumRule aNewNumRule( *pDefaultBulletNumRule );
900 sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
911 const bool bHandleBullets,
917 bool bToggleOn =
true;
922 if ( nBulletNumberingStatus != 0 && bHandleBullets )
927 else if ( nBulletNumberingStatus != 1 && !bHandleBullets )
958 DBG_ASSERT(pPara,
"OutlinerView::EnableBullets(), illegal selection?");
967 const sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
976 const bool bHandleBullets,
978 const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,
979 const bool bAtSelection )
989 sal_Int32 nStartPara = 0;
990 sal_Int32 nEndPara = 0;
1004 for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara)
1007 DBG_ASSERT(pPara,
"OutlinerView::ApplyBulletsNumbering(..), illegal selection?");
1024 bool bApplyNumRule =
false;
1025 if ( !bCheckCurrentNumRuleBeforeApplyingNewNumRule )
1027 bApplyNumRule =
true;
1034 bApplyNumRule =
true;
1043 bApplyNumRule =
true;
1045 else if ( !bHandleBullets
1049 bApplyNumRule =
true;
1054 if ( bApplyNumRule )
1072 for ( sal_uInt16 nLevel = 0; nLevel < nLevelCnt; ++nLevel )
1081 aNewRule.
SetLevel(nLevel, &aNewFmtClone);
1094 const sal_uInt16 nParaCount =
static_cast<sal_uInt16
>(
pOwner->
pParaList->GetParagraphCount());
1105 const bool bAtSelection )
1107 sal_Int32 nStartPara = 0;
1108 sal_Int32 nEndPara = 0;
1125 for ( sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara )
1128 DBG_ASSERT(pPara,
"OutlinerView::SwitchOffBulletsNumbering(...), illegal paragraph index?");
1144 const sal_uInt16 nParaCount =
static_cast<sal_uInt16
>(
pOwner->
pParaList->GetParagraphCount());
1163 pEditView->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
1165 pEditView->RemoveAttribs( bRemoveParaAttribs );
1166 if ( bRemoveParaAttribs )
1205 pEditView->GetSelectionRectangles(rLogicRects);
1225 pEditView->ShowCursor( bGotoCursor,
true, bActivate );
1265 return pEditView->StartThesaurus(pDialogParent);
1270 sal_Int32 nOptions,
bool bIsInteractive,
bool bMultipleDoc )
1278 pEditView->StartTextConversion(pDialogParent, nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc);
1282 OSL_FAIL(
"unexpected language" );
1289 return pEditView->StartSearchAndReplace( rSearchItem );
1294 pEditView->TransliterateText( nTransliterationMode );
1305 pEditView->Scroll( nHorzScroll, nVertScroll );
1340 return pEditView->GetFieldUnderMousePointer();
1345 return pEditView->GetFieldAtSelection();
1372 return pEditView->IsCursorAtWrongSpelledWord();
1378 return pEditView->IsWrongSpelledWordAtPos( rPosPixel,
false );
1383 pEditView->ExecuteSpellPopup(rPosPixel, rStartDlg);
1388 sal_Int32 nOldParaCount =
pEditView->GetEditEngine()->GetParagraphCount();
1392 pEditView->Read( rInput, eFormat, pHTTPHeaderAttrs );
1395 sal_Int32 nChangesStart = aOldSel.
nStartPara;
1396 sal_Int32 nChangesEnd = nChangesStart + nParaDiff + (aOldSel.
nEndPara-aOldSel.
nStartPara);
1398 for ( sal_Int32
n = nChangesStart;
n <= nChangesEnd;
n++ )
1409 pEditView->SetBackgroundColor( rColor );
1414 pEditView->RegisterViewShell(pViewShell);
1429 return pEditView->GetSelectedScriptType();
1439 return pEditView->GetSurroundingTextSelection();
1444 return pEditView->DeleteSurroundingText(rSelection);
1455 if (nScriptType & SvtScriptType::LATIN)
1457 if (nScriptType & SvtScriptType::ASIAN)
1459 if (nScriptType & SvtScriptType::COMPLEX)
1462 return nScriptCount == 1;
1470 OUString &rStatusVal,
1479 aTextSel = pEditEngine->
GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD );
1480 aText = pEditEngine->
GetText( aTextSel );
1483 if (!isSingleScriptType(pEditEngine->
GetScriptType(aTextSel)))
1490 rStatusVal = aText +
"#" + aLangText;
1493 return aText.getLength() > 0;
OUString GetWord(sal_Int32 nPara, sal_Int32 nIndex)
OUString GetText(LineEnd eEnd=LINEEND_LF) const
editeng::LanguageSpan GetLanguage(const EditPaM &rPaM) const
SvtScriptType GetScriptType(const ESelection &rSelection) const
static bool DoesKeyChangeText(const KeyEvent &rKeyEvent)
ESelection GetSelection() const
void SelectCurrentWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES)
bool HasSelection() const
void InsertText(const OUString &rNew, bool bSelect=false, bool bLOKShowSelect=true)
void ShowCursor(bool bGotoCursor=true, bool bForceVisCursor=true, bool bActivate=false)
EditEngine * GetEditEngine() const
const vcl::KeyCode & GetKeyCode() const
static OUString convertToBcp47(LanguageType nLangID)
sal_uInt16 GetClicks() const
const Point & GetPosPixel() const
const EditTextObject & GetTextObject() const
Interface class to not depend on SfxViewShell in editeng.
EDITENG_DLLPRIVATE void ImpPasted(sal_Int32 nStart, sal_Int32 nPrevParaCount, sal_Int32 nSize)
bool MouseMove(const MouseEvent &)
bool Command(const CommandEvent &rCEvt)
void ToggleBullets()
enables bullets for the selected paragraphs if the bullets/numbering of the first paragraph is off or...
void ToggleBulletsNumbering(const bool bToggle, const bool bHandleBullets, const SvxNumRule *pNumRule)
void AdjustDepth(short nDX)
void ApplyBulletsNumbering(const bool bHandleBullets, const SvxNumRule *pNewNumRule, const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule, const bool bAtSelection=false)
apply bullets/numbering for paragraphs
void SetStyleSheet(const OUString &rStyleName)
void SetSelection(const ESelection &)
SvtScriptType GetSelectedScriptType() const
void SelectFieldAtCursor()
Select the field at the current cursor position.
void StartTextConversion(weld::Widget *pDialogParent, LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc)
void Paint(const tools::Rectangle &rRect, OutputDevice *pTargetDevice=nullptr)
std::unique_ptr< EditView > pEditView
void SetControlWord(EVControlBits nWord)
void GetSelectionRectangles(std::vector< tools::Rectangle > &rLogicRects) const
bool HasSelection() const
EDITENG_DLLPRIVATE sal_Int32 ImpCalcSelectedPages(bool bIncludeFirstSelected)
void InsertField(const SvxFieldItem &rFld)
void EnsureNumberingIsOn()
enables numbering for the selected paragraphs that are not enabled and ignore all selected paragraphs...
EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs(bool bIncludeHiddenChildren)
bool IsWrongSpelledWordAtPos(const Point &rPosPixel)
void SetReadOnly(bool bReadOnly)
EDITENG_DLLPRIVATE void ImpToggleExpand(Paragraph const *pParentPara)
sal_Int32 StartSearchAndReplace(const SvxSearchItem &rSearchItem)
void Read(SvStream &rInput, EETextFormat eFormat, SvKeyValueIterator *pHTTPHeaderAttrs)
void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll)
const SvxFieldItem * GetFieldAtSelection() const
bool MouseButtonUp(const MouseEvent &)
void RegisterViewShell(OutlinerViewShell *pViewShell)
Informs this edit view about which view shell contains it.
void InsertText(const OUString &rNew, bool bSelect=false)
void SwitchOffBulletsNumbering(const bool bAtSelection=false)
switch off bullets/numbering for paragraphs
void SetOutputArea(const tools::Rectangle &rRect)
void TransliterateText(TransliterationFlags nTransliterationMode)
EDITENG_DLLPRIVATE void ImplExpandOrCollaps(sal_Int32 nStartPara, sal_Int32 nEndPara, bool bExpand)
void SetBackgroundColor(const Color &rColor)
OUString GetSurroundingText() const
void SetVisArea(const tools::Rectangle &rRect)
vcl::Window * GetWindow() const
void RemoveAttribs(bool bRemoveParaAttribs, bool bKeepLanguages=false)
const SfxStyleSheet * GetStyleSheet() const
tools::Rectangle const & GetOutputArea() const
void CreateSelectionList(std::vector< Paragraph * > &aSelList)
tools::Rectangle GetVisArea() const
EESpellState StartThesaurus(weld::Widget *pDialogParent)
void HideCursor(bool bDeactivate=false)
ESelection GetSelection() const
bool PostKeyEvent(const KeyEvent &rKEvt, vcl::Window const *pFrameWin=nullptr)
const SvxFieldData * GetFieldAtCursor() const
Return the field at the current cursor position or nullptr if no field found.
void AdjustHeight(tools::Long nDY)
const SvxFieldItem * GetFieldUnderMousePointer() const
EVControlBits GetControlWord() const
void Paste(bool bUseSpecial=false)
EEAnchorMode GetAnchorMode() const
void SetWindow(vcl::Window *pWindow)
void ExecuteSpellPopup(const Point &rPosPixel, const Link< SpellCallbackInfo &, void > &rCallBack)
OutlinerView(Outliner *pOut, vcl::Window *pWindow)
Outliner * GetOutliner() const
void SetAttribs(const SfxItemSet &)
bool MouseButtonDown(const MouseEvent &)
void RemoveAttribsKeepLanguages(bool bRemoveParaAttribs)
sal_uInt16 GetInvalidateMore() const
EDITENG_DLLPRIVATE sal_Int32 ImpInitPaste(sal_Int32 &rStart)
Link< LinkParamNone *, void > aEndCutPasteLink
OUString GetSelected() const
Selection GetSurroundingTextSelection() const
bool IsCursorAtWrongSpelledWord()
PointerStyle GetPointer(const Point &rPosPixel)
void SetAnchorMode(EEAnchorMode eMode)
void StartSpeller(weld::Widget *pDialogParent)
void SetInvalidateMore(sal_uInt16 nPixel)
void Select(Paragraph const *pParagraph, bool bSelect=true)
void SelectRange(sal_Int32 nFirst, sal_Int32 nCount)
Color const & GetBackgroundColor() const
EDITENG_DLLPRIVATE sal_Int32 ImpCheckMousePos(const Point &rPosPixel, MouseTarget &reTarget)
bool DeleteSurroundingText(const Selection &rRange)
void ShowCursor(bool bGotoCursor=true, bool bActivate=false)
bool Expand(Paragraph const *)
SfxStyleSheetPool * GetStyleSheetPool()
void ImplCheckParagraphs(sal_Int32 nStart, sal_Int32 nEnd)
bool IsTextPos(const Point &rPaperPos, sal_uInt16 nBorder)
OutlinerMode GetOutlinerMode() const
const SvxNumberFormat * GetNumberFormat(sal_Int32 nPara) const
sal_Int16 GetDepth(sal_Int32 nPara) const
void SetStyleSheet(sal_Int32 nPara, SfxStyleSheet *pStyle)
std::unique_ptr< OutlinerEditEng > pEditEngine
bool ImplHasNumberFormat(sal_Int32 nPara) const
void InsertUndo(std::unique_ptr< EditUndo > pUndo)
bool SetUpdateLayout(bool bUpdate)
void SetDepth(Paragraph *pParagraph, sal_Int16 nNewDepth)
void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &)
void ImplCalcBulletText(sal_Int32 nPara, bool bRecalcLevel, bool bRecalcChildren)
void ImplCheckNumBulletItem(sal_Int32 nPara)
sal_Int32 GetBulletsNumberingStatus(const sal_Int32 nParaStart, const sal_Int32 nParaEnd) const
determine the bullets/numbering status of the given paragraphs
bool IsUndoEnabled() const
void ImpTextPasted(sal_Int32 nStartPara, sal_Int32 nCount)
bool Collapse(Paragraph const *)
void UndoActionStart(sal_uInt16 nId)
std::unique_ptr< ParagraphList > pParaList
static constexpr sal_Int16 gnMinDepth
bool ImpCanDeleteSelectedPages(OutlinerView *pCurView)
void ImplSetLevelDependentStyleSheet(sal_Int32 nPara)
SfxItemSet const & GetParaAttribs(sal_Int32 nPara) const
void DepthChangedHdl(Paragraph *, ParaFlag nPrevFlags)
void ImplInitDepth(sal_Int32 nPara, sal_Int16 nDepth, bool bCreateUndo)
void ImpFilterIndents(sal_Int32 nFirstPara, sal_Int32 nLastPara)
sal_Int32 nDepthChangedHdlPrevDepth
bool ImpCanIndentSelectedPages(OutlinerView *pCurView)
Paragraph * Insert(const OUString &rText, sal_Int32 nAbsPos=EE_PARA_APPEND, sal_Int16 nDepth=0)
Point GetDocPos(const Point &rPaperPos) const
void InvalidateBullet(sal_Int32 nPara)
sal_Int16 GetDepth() const
bool HasFlag(ParaFlag nFlag) const
void RemoveFlag(ParaFlag nFlag)
void SetFlag(ParaFlag nFlag)
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
This item stores a field (SvxFieldData).
const SvxFieldData * GetField() const
const SvxNumRule & GetNumRule() const
sal_uInt16 GetLevelCount() const
const SvxNumberFormat * Get(sal_uInt16 nLevel) const
void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat &rFmt, bool bIsValid=true)
SvxNumType GetNumberingType() const
sal_uInt16 GetCode() const
KeyFuncType GetFunction() const
#define DBG_ASSERT(sCon, aError)
#define EE_PARA_NOT_FOUND
#define EE_PARA_MAX_COUNT
constexpr TypedWhichId< SfxBoolItem > EE_PARA_BULLETSTATE(EE_PARA_START+9)
constexpr TypedWhichId< SvxNumBulletItem > EE_PARA_NUMBULLET(EE_PARA_START+5)
constexpr sal_uInt16 KEY_RETURN
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_BACKSPACE
#define LANGUAGE_CHINESE_TRADITIONAL
#define LANGUAGE_CHINESE_SIMPLIFIED
#define SAL_WARN_IF(condition, area, stream)
void ReplaceTextWithSynonym(EditView &rEditView, const OUString &rSynonmText)
bool GetStatusValueForThesaurusFromContext(OUString &rStatusVal, LanguageType &rLang, const EditView &rEditView)