summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-01-20 15:04:43 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-01-21 00:54:54 +0100
commit049bbd95c190e0844da3a8dd88b1ce7a9ccf83b7 (patch)
treebd19faddc850498494539d1899c6a7b9e848ad3a
parent06aea80b0482c03e8f0a5f735d3a31ec816a07fe (diff)
editeng: change EditEngine getter to ref in {Imp}EditView
{Imp}EditView always needs to have EditEngine set (or it would crash otherwise), so we can change the getter to return a referece instead of a pointer. This simplifies things a bit because we get rid of all the nullptr checks and makes the interface more clear. Also change direct access to mpEditEngine in {Imp}EditView to use getEditEngine() and getImpEditEngine() (returning a reference) instead. Change-Id: Ib8f9c565b8364144bb9c35c3093c4975af1970c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162333 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--editeng/source/editeng/editeng.cxx5
-rw-r--r--editeng/source/editeng/editundo.cxx2
-rw-r--r--editeng/source/editeng/editview.cxx270
-rw-r--r--editeng/source/editeng/edtspell.cxx36
-rw-r--r--editeng/source/editeng/impedit.cxx347
-rw-r--r--editeng/source/editeng/impedit.hxx6
-rw-r--r--editeng/source/editeng/textconv.cxx40
-rw-r--r--editeng/source/misc/urlfieldhelper.cxx2
-rw-r--r--editeng/source/outliner/outlvw.cxx20
-rw-r--r--forms/source/richtext/specialdispatchers.cxx8
-rw-r--r--include/editeng/editeng.hxx2
-rw-r--r--include/editeng/editview.hxx14
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx4
-rw-r--r--sc/source/ui/Accessibility/AccessibleEditObject.cxx4
-rw-r--r--sc/source/ui/Accessibility/AccessibleText.cxx17
-rw-r--r--sc/source/ui/app/inputhdl.cxx53
-rw-r--r--sc/source/ui/app/inputwin.cxx14
-rw-r--r--sc/source/ui/docshell/docsh4.cxx2
-rw-r--r--sc/source/ui/view/cellsh3.cxx2
-rw-r--r--sc/source/ui/view/editsh.cxx58
-rw-r--r--sc/source/ui/view/gridwin.cxx10
-rw-r--r--sc/source/ui/view/gridwin4.cxx13
-rw-r--r--sc/source/ui/view/spelldialog.cxx2
-rw-r--r--sc/source/ui/view/tabview3.cxx3
-rw-r--r--sc/source/ui/view/viewdata.cxx31
-rw-r--r--sd/qa/unit/TextFittingTest.cxx29
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx2
-rw-r--r--sd/source/ui/docshell/docshel3.cxx2
-rw-r--r--sd/source/ui/func/futext.cxx13
-rw-r--r--sd/source/ui/view/sdwindow.cxx2
-rw-r--r--sd/source/ui/view/viewshel.cxx2
-rw-r--r--starmath/source/edit.cxx16
-rw-r--r--svx/source/dialog/weldeditview.cxx2
-rw-r--r--svx/source/theme/ThemeColorChangerCommon.cxx12
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.cxx10
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx2
-rw-r--r--sw/source/uibase/shells/langhelper.cxx24
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx4
38 files changed, 540 insertions, 545 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index c55ace752c2b..26e8fe3099b4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -88,6 +88,11 @@ static bool bDebugPaint = false;
static rtl::Reference<SfxItemPool> pGlobalPool;
+ImpEditEngine& EditEngine::getImpl()
+{
+ return *pImpEditEngine;
+}
+
EditEngine::EditEngine( SfxItemPool* pItemPool )
{
pImpEditEngine.reset( new ImpEditEngine( this, pItemPool ) );
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 378e1f8f268e..b13ff7109791 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -29,7 +29,7 @@
static void lcl_DoSetSelection( EditView const * pView, sal_uInt16 nPara )
{
EPaM aEPaM( nPara, 0 );
- EditPaM aPaM( pView->GetImpEditEngine()->CreateEditPaM( aEPaM ) );
+ EditPaM aPaM = pView->getImpEditEngine().CreateEditPaM(aEPaM);
aPaM.SetIndex( aPaM.GetNode()->Len() );
EditSelection aSel( aPaM, aPaM );
pView->GetImpEditView()->SetEditSelection( aSel );
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index ff979af96698..c8a974df8ec1 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -151,9 +151,10 @@ EditViewCallbacks::~EditViewCallbacks()
{
}
-EditView::EditView( EditEngine* pEng, vcl::Window* pWindow )
+EditView::EditView(EditEngine* pEditEngine, vcl::Window* pWindow)
+ : pImpEditView(new ImpEditView(this, pEditEngine, pWindow))
{
- pImpEditView.reset( new ImpEditView( this, pEng, pWindow ) );
+ assert(pEditEngine);
}
EditView::~EditView()
@@ -170,14 +171,14 @@ EditViewCallbacks* EditView::getEditViewCallbacks() const
return pImpEditView->getEditViewCallbacks();
}
-ImpEditEngine* EditView::GetImpEditEngine() const
+ImpEditEngine& EditView::getImpEditEngine() const
{
- return pImpEditView->pEditEngine->pImpEditEngine.get();
+ return pImpEditView->getImpEditEngine();
}
-EditEngine* EditView::GetEditEngine() const
+EditEngine& EditView::getEditEngine() const
{
- return pImpEditView->pEditEngine;
+ return pImpEditView->getEditEngine();
}
tools::Rectangle EditView::GetInvalidateRect() const
@@ -264,29 +265,28 @@ void EditView::SetSelection( const ESelection& rESel )
{
// tdf#113591 Get node from EditDoc, as the selection might have a pointer to an
// already deleted node.
- const ContentNode* pNode(pImpEditView->pEditEngine->GetEditDoc().GetEndPaM().GetNode());
+ const ContentNode* pNode(getEditEngine().GetEditDoc().GetEndPaM().GetNode());
if (nullptr != pNode)
pNode->checkAndDeleteEmptyAttribs();
}
- EditSelection aNewSelection( pImpEditView->pEditEngine->pImpEditEngine->ConvertSelection(
- rESel.nStartPara, rESel.nStartPos, rESel.nEndPara, rESel.nEndPos ) );
+ EditSelection aNewSelection(getImpEditEngine().ConvertSelection(rESel.nStartPara, rESel.nStartPos, rESel.nEndPara, rESel.nEndPos));
// If the selection is manipulated after a KeyInput:
- pImpEditView->pEditEngine->CheckIdleFormatter();
+ getEditEngine().CheckIdleFormatter();
// Selection may not start/end at an invisible paragraph:
- const ParaPortion* pPortion = pImpEditView->pEditEngine->FindParaPortion( aNewSelection.Min().GetNode() );
+ const ParaPortion* pPortion = getEditEngine().FindParaPortion( aNewSelection.Min().GetNode() );
if ( !pPortion->IsVisible() )
{
- pPortion = pImpEditView->pEditEngine->GetPrevVisPortion( pPortion );
- ContentNode* pNode = pPortion ? pPortion->GetNode() : pImpEditView->pEditEngine->GetEditDoc().GetObject( 0 );
+ pPortion = getEditEngine().GetPrevVisPortion( pPortion );
+ ContentNode* pNode = pPortion ? pPortion->GetNode() : getEditEngine().GetEditDoc().GetObject( 0 );
aNewSelection.Min() = EditPaM( pNode, pNode->Len() );
}
- pPortion = pImpEditView->pEditEngine->FindParaPortion( aNewSelection.Max().GetNode() );
+ pPortion = getEditEngine().FindParaPortion( aNewSelection.Max().GetNode() );
if ( !pPortion->IsVisible() )
{
- pPortion = pImpEditView->pEditEngine->GetPrevVisPortion( pPortion );
- ContentNode* pNode = pPortion ? pPortion->GetNode() : pImpEditView->pEditEngine->GetEditDoc().GetObject( 0 );
+ pPortion = getEditEngine().GetPrevVisPortion( pPortion );
+ ContentNode* pNode = pPortion ? pPortion->GetNode() : getEditEngine().GetEditDoc().GetObject( 0 );
aNewSelection.Max() = EditPaM( pNode, pNode->Len() );
}
@@ -306,8 +306,8 @@ ESelection EditView::GetSelection() const
{
ESelection aSelection;
- aSelection.nStartPara = pImpEditView->pEditEngine->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Min().GetNode() );
- aSelection.nEndPara = pImpEditView->pEditEngine->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Max().GetNode() );
+ aSelection.nStartPara = getEditEngine().GetEditDoc().GetPos( pImpEditView->GetEditSelection().Min().GetNode() );
+ aSelection.nEndPara = getEditEngine().GetEditDoc().GetPos( pImpEditView->GetEditSelection().Max().GetNode() );
aSelection.nStartPos = pImpEditView->GetEditSelection().Min().GetIndex();
aSelection.nEndPos = pImpEditView->GetEditSelection().Max().GetIndex();
@@ -342,7 +342,7 @@ void EditView::DeleteSelected()
SvtScriptType EditView::GetSelectedScriptType() const
{
- return pImpEditView->pEditEngine->GetScriptType( pImpEditView->GetEditSelection() );
+ return getEditEngine().GetScriptType( pImpEditView->GetEditSelection() );
}
void EditView::GetSelectionRectangles(std::vector<tools::Rectangle>& rLogicRects) const
@@ -352,20 +352,22 @@ void EditView::GetSelectionRectangles(std::vector<tools::Rectangle>& rLogicRects
void EditView::Paint( const tools::Rectangle& rRect, OutputDevice* pTargetDevice )
{
- pImpEditView->pEditEngine->pImpEditEngine->Paint( pImpEditView.get(), rRect, pTargetDevice );
+ getImpEditEngine().Paint( pImpEditView.get(), rRect, pTargetDevice );
}
-void EditView::SetEditEngine( EditEngine* pEditEng )
+void EditView::setEditEngine(EditEngine* pEditEngine)
{
- pImpEditView->pEditEngine = pEditEng;
- EditSelection aStartSel = pImpEditView->pEditEngine->GetEditDoc().GetStartPaM();
+ assert(pEditEngine);
+
+ pImpEditView->mpEditEngine = pEditEngine;
+ EditSelection aStartSel = getEditEngine().GetEditDoc().GetStartPaM();
pImpEditView->SetEditSelection( aStartSel );
}
void EditView::SetWindow( vcl::Window* pWin )
{
pImpEditView->pOutWin = pWin;
- pImpEditView->pEditEngine->pImpEditEngine->GetSelEngine().Reset();
+ getImpEditEngine().GetSelEngine().Reset();
}
vcl::Window* EditView::GetWindow() const
@@ -427,7 +429,7 @@ void EditView::SetOutputArea( const tools::Rectangle& rRect )
// the rest here only if it is an API call:
pImpEditView->CalcAnchorPoint();
- if ( pImpEditView->pEditEngine->pImpEditEngine->GetStatus().AutoPageSize() )
+ if (getImpEditEngine().GetStatus().AutoPageSize() )
pImpEditView->RecalcOutputArea();
pImpEditView->ShowCursor( false, false );
}
@@ -450,7 +452,7 @@ vcl::Cursor* EditView::GetCursor() const
void EditView::InsertText( const OUString& rStr, bool bSelect, bool bLOKShowSelect )
{
- EditEngine* pEE = pImpEditView->pEditEngine;
+ EditEngine& rEditEngine = getEditEngine();
if (bLOKShowSelect)
pImpEditView->DrawSelectionXOR();
@@ -459,24 +461,24 @@ void EditView::InsertText( const OUString& rStr, bool bSelect, bool bLOKShowSele
if ( bSelect )
{
EditSelection aTmpSel( pImpEditView->GetEditSelection() );
- aTmpSel.Adjust( pEE->GetEditDoc() );
+ aTmpSel.Adjust(rEditEngine.GetEditDoc());
aPaM1 = aTmpSel.Min();
}
- pEE->UndoActionStart( EDITUNDO_INSERT );
- EditPaM aPaM2( pEE->InsertText( pImpEditView->GetEditSelection(), rStr ) );
- pEE->UndoActionEnd();
+ rEditEngine.UndoActionStart( EDITUNDO_INSERT );
+ EditPaM aPaM2(rEditEngine.InsertText( pImpEditView->GetEditSelection(), rStr ) );
+ rEditEngine.UndoActionEnd();
if ( bSelect )
{
- DBG_ASSERT( !aPaM1.DbgIsBuggy( pEE->GetEditDoc() ), "Insert: PaM broken" );
+ DBG_ASSERT( !aPaM1.DbgIsBuggy(rEditEngine.GetEditDoc()), "Insert: PaM broken" );
pImpEditView->SetEditSelection( EditSelection( aPaM1, aPaM2 ) );
}
else
pImpEditView->SetEditSelection( EditSelection( aPaM2, aPaM2 ) );
if (bLOKShowSelect)
- pEE->FormatAndLayout( this );
+ rEditEngine.FormatAndLayout( this );
}
bool EditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * pFrameWin )
@@ -521,7 +523,7 @@ tools::Rectangle EditView::GetEditCursor() const
void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bActivate )
{
- if ( !pImpEditView->pEditEngine->HasView( this ) )
+ if (!getEditEngine().HasView(this))
return;
// The control word is more important:
@@ -568,7 +570,7 @@ Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRange
const SfxItemSet& EditView::GetEmptyItemSet() const
{
- return pImpEditView->pEditEngine->GetEmptyItemSet();
+ return getEditEngine().GetEmptyItemSet();
}
void EditView::SetAttribs( const SfxItemSet& rSet )
@@ -576,16 +578,16 @@ void EditView::SetAttribs( const SfxItemSet& rSet )
DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in..." );
pImpEditView->DrawSelectionXOR();
- pImpEditView->pEditEngine->SetAttribs( pImpEditView->GetEditSelection(), rSet, SetAttribsMode::WholeWord );
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getEditEngine().SetAttribs( pImpEditView->GetEditSelection(), rSet, SetAttribsMode::WholeWord );
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
void EditView::RemoveAttribsKeepLanguages( bool bRemoveParaAttribs )
{
pImpEditView->DrawSelectionXOR();
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_RESETATTRIBS );
+ getEditEngine().UndoActionStart( EDITUNDO_RESETATTRIBS );
EditSelection aSelection( pImpEditView->GetEditSelection() );
for (sal_uInt16 nWID = EE_ITEMS_START; nWID <= EE_ITEMS_END; ++nWID)
@@ -594,12 +596,12 @@ void EditView::RemoveAttribsKeepLanguages( bool bRemoveParaAttribs )
EE_CHAR_LANGUAGE_CJK == nWID ||
EE_CHAR_LANGUAGE_CTL == nWID;
if (!bIsLang)
- pImpEditView->pEditEngine->RemoveCharAttribs( aSelection, bRemoveParaAttribs, nWID );
+ getEditEngine().RemoveCharAttribs( aSelection, bRemoveParaAttribs, nWID );
}
- pImpEditView->pEditEngine->UndoActionEnd();
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getEditEngine().UndoActionEnd();
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
void EditView::RemoveAttribs( bool bRemoveParaAttribs, sal_uInt16 nWhich )
@@ -611,45 +613,45 @@ void EditView::RemoveAttribs( bool bRemoveParaAttribs, sal_uInt16 nWhich )
void EditView::RemoveAttribs( EERemoveParaAttribsMode eMode, sal_uInt16 nWhich )
{
pImpEditView->DrawSelectionXOR();
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_RESETATTRIBS );
- pImpEditView->pEditEngine->RemoveCharAttribs( pImpEditView->GetEditSelection(), eMode, nWhich );
- pImpEditView->pEditEngine->UndoActionEnd();
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getEditEngine().UndoActionStart( EDITUNDO_RESETATTRIBS );
+ getEditEngine().RemoveCharAttribs( pImpEditView->GetEditSelection(), eMode, nWhich );
+ getEditEngine().UndoActionEnd();
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
void EditView::RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich )
{
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_RESETATTRIBS );
- pImpEditView->pEditEngine->RemoveCharAttribs( nPara, nWhich );
- pImpEditView->pEditEngine->UndoActionEnd();
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getEditEngine().UndoActionStart( EDITUNDO_RESETATTRIBS );
+ getEditEngine().RemoveCharAttribs( nPara, nWhich );
+ getEditEngine().UndoActionEnd();
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
SfxItemSet EditView::GetAttribs()
{
DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in..." );
- return pImpEditView->pEditEngine->pImpEditEngine->GetAttribs( pImpEditView->GetEditSelection() );
+ return getImpEditEngine().GetAttribs( pImpEditView->GetEditSelection() );
}
void EditView::Undo()
{
- pImpEditView->pEditEngine->Undo( this );
+ getEditEngine().Undo( this );
}
void EditView::Redo()
{
- pImpEditView->pEditEngine->Redo( this );
+ getEditEngine().Redo( this );
}
ErrCode EditView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs )
{
EditSelection aOldSel( pImpEditView->GetEditSelection() );
pImpEditView->DrawSelectionXOR();
- pImpEditView->pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_READ );
- EditPaM aEndPaM = pImpEditView->pEditEngine->pImpEditEngine->Read( rInput, "", eFormat, aOldSel, pHTTPHeaderAttrs );
- pImpEditView->pEditEngine->pImpEditEngine->UndoActionEnd();
+ getImpEditEngine().UndoActionStart( EDITUNDO_READ );
+ EditPaM aEndPaM = getImpEditEngine().Read( rInput, "", eFormat, aOldSel, pHTTPHeaderAttrs );
+ getImpEditEngine().UndoActionEnd();
EditSelection aNewSel( aEndPaM, aEndPaM );
pImpEditView->SetEditSelection( aNewSel );
@@ -672,8 +674,7 @@ Reference<css::datatransfer::clipboard::XClipboard> EditView::GetClipboard() con
css::uno::Reference< css::datatransfer::XTransferable > EditView::GetTransferable() const
{
- uno::Reference< datatransfer::XTransferable > xData =
- GetEditEngine()->CreateTransferable( pImpEditView->GetEditSelection() );
+ uno::Reference< datatransfer::XTransferable > xData = getEditEngine().CreateTransferable( pImpEditView->GetEditSelection() );
return xData;
}
@@ -697,7 +698,7 @@ void EditView::PasteSpecial(SotClipboardFormatId format)
Point EditView::GetWindowPosTopLeft( sal_Int32 nParagraph )
{
- Point aDocPos( pImpEditView->pEditEngine->GetDocPosTopLeft( nParagraph ) );
+ Point aDocPos(getEditEngine().GetDocPosTopLeft(nParagraph));
return pImpEditView->GetWindowPos( aDocPos );
}
@@ -708,14 +709,14 @@ void EditView::SetSelectionMode( EESelectionMode eMode )
OUString EditView::GetSelected() const
{
- return pImpEditView->pEditEngine->pImpEditEngine->GetSelected( pImpEditView->GetEditSelection() );
+ return getImpEditEngine().GetSelected( pImpEditView->GetEditSelection() );
}
void EditView::MoveParagraphs( Range aParagraphs, sal_Int32 nNewPos )
{
- pImpEditView->pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_MOVEPARAS );
- pImpEditView->pEditEngine->pImpEditEngine->MoveParagraphs( aParagraphs, nNewPos, this );
- pImpEditView->pEditEngine->pImpEditEngine->UndoActionEnd();
+ getImpEditEngine().UndoActionStart( EDITUNDO_MOVEPARAS );
+ getImpEditEngine().MoveParagraphs( aParagraphs, nNewPos, this );
+ getImpEditEngine().UndoActionEnd();
}
void EditView::MoveParagraphs( tools::Long nDiff )
@@ -726,14 +727,14 @@ void EditView::MoveParagraphs( tools::Long nDiff )
tools::Long nDest = ( nDiff > 0 ? aRange.Max() : aRange.Min() ) + nDiff;
if ( nDiff > 0 )
nDest++;
- DBG_ASSERT( ( nDest >= 0 ) && ( nDest <= pImpEditView->pEditEngine->GetParagraphCount() ), "MoveParagraphs - wrong Parameters!" );
+ DBG_ASSERT( ( nDest >= 0 ) && ( nDest <= getEditEngine().GetParagraphCount() ), "MoveParagraphs - wrong Parameters!" );
MoveParagraphs( aRange, sal::static_int_cast< sal_Int32 >( nDest ) );
}
void EditView::SetBackgroundColor( const Color& rColor )
{
pImpEditView->SetBackgroundColor( rColor );
- pImpEditView->pEditEngine->SetBackgroundColor( rColor );
+ getEditEngine().SetBackgroundColor( rColor );
}
Color const & EditView::GetBackgroundColor() const
@@ -763,58 +764,58 @@ EVControlBits EditView::GetControlWord() const
std::unique_ptr<EditTextObject> EditView::CreateTextObject()
{
- return pImpEditView->pEditEngine->pImpEditEngine->CreateTextObject( pImpEditView->GetEditSelection() );
+ return getImpEditEngine().CreateTextObject( pImpEditView->GetEditSelection() );
}
void EditView::InsertText( const EditTextObject& rTextObject )
{
pImpEditView->DrawSelectionXOR();
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_INSERT );
- EditSelection aTextSel( pImpEditView->pEditEngine->InsertText( rTextObject, pImpEditView->GetEditSelection() ) );
- pImpEditView->pEditEngine->UndoActionEnd();
+ getEditEngine().UndoActionStart( EDITUNDO_INSERT );
+ EditSelection aTextSel(getEditEngine().InsertText(rTextObject, pImpEditView->GetEditSelection()));
+ getEditEngine().UndoActionEnd();
aTextSel.Min() = aTextSel.Max(); // Selection not retained.
pImpEditView->SetEditSelection( aTextSel );
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
void EditView::InsertText( css::uno::Reference< css::datatransfer::XTransferable > const & xDataObj, const OUString& rBaseURL, bool bUseSpecial )
{
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_INSERT );
+ getEditEngine().UndoActionStart( EDITUNDO_INSERT );
pImpEditView->DeleteSelected();
EditSelection aTextSel =
- pImpEditView->pEditEngine->InsertText(xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial);
- pImpEditView->pEditEngine->UndoActionEnd();
+ getEditEngine().InsertText(xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial);
+ getEditEngine().UndoActionEnd();
aTextSel.Min() = aTextSel.Max(); // Selection not retained.
pImpEditView->SetEditSelection( aTextSel );
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
bool EditView::SetEditEngineUpdateLayout( bool bUpdate )
{
- return pImpEditView->pEditEngine->pImpEditEngine->SetUpdateLayout( bUpdate, this );
+ return getImpEditEngine().SetUpdateLayout( bUpdate, this );
}
void EditView::ForceLayoutCalculation()
{
- pImpEditView->pEditEngine->pImpEditEngine->SetUpdateLayout( true, this, true );
+ getImpEditEngine().SetUpdateLayout( true, this, true );
}
SfxStyleSheet* EditView::GetStyleSheet()
{
EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() );
- sal_Int32 nStartPara = pImpEditView->pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
- sal_Int32 nEndPara = pImpEditView->pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
+ aSel.Adjust(getEditEngine().GetEditDoc());
+ sal_Int32 nStartPara = getEditEngine().GetEditDoc().GetPos( aSel.Min().GetNode() );
+ sal_Int32 nEndPara = getEditEngine().GetEditDoc().GetPos( aSel.Max().GetNode() );
SfxStyleSheet* pStyle = nullptr;
for ( sal_Int32 n = nStartPara; n <= nEndPara; n++ )
{
- SfxStyleSheet* pTmpStyle = pImpEditView->pEditEngine->GetStyleSheet( n );
+ SfxStyleSheet* pTmpStyle = getEditEngine().GetStyleSheet( n );
if ( ( n != nStartPara ) && ( pStyle != pTmpStyle ) )
return nullptr; // Not unique.
pStyle = pTmpStyle;
@@ -850,7 +851,7 @@ EEAnchorMode EditView::GetAnchorMode() const
void EditView::TransliterateText( TransliterationFlags nTransliterationMode )
{
EditSelection aOldSel( pImpEditView->GetEditSelection() );
- EditSelection aNewSel = pImpEditView->pEditEngine->TransliterateText( pImpEditView->GetEditSelection(), nTransliterationMode );
+ EditSelection aNewSel = getEditEngine().TransliterateText( pImpEditView->GetEditSelection(), nTransliterationMode );
if ( aNewSel != aOldSel )
{
pImpEditView->DrawSelectionXOR();
@@ -861,44 +862,44 @@ void EditView::TransliterateText( TransliterationFlags nTransliterationMode )
void EditView::CompleteAutoCorrect( vcl::Window const * pFrameWin )
{
- if ( !HasSelection() && pImpEditView->pEditEngine->pImpEditEngine->GetStatus().DoAutoCorrect() )
+ if ( !HasSelection() && getImpEditEngine().GetStatus().DoAutoCorrect() )
{
pImpEditView->DrawSelectionXOR();
EditSelection aSel = pImpEditView->GetEditSelection();
- aSel = pImpEditView->pEditEngine->EndOfWord( aSel.Max() );
- aSel = pImpEditView->pEditEngine->pImpEditEngine->AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin );
+ aSel = getEditEngine().EndOfWord( aSel.Max() );
+ aSel = getImpEditEngine().AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin );
pImpEditView->SetEditSelection( aSel );
- if ( pImpEditView->pEditEngine->IsModified() )
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ if (getEditEngine().IsModified())
+ getEditEngine().FormatAndLayout( this );
}
}
EESpellState EditView::StartSpeller(weld::Widget* pDialogParent, bool bMultipleDoc)
{
- if ( !pImpEditView->pEditEngine->pImpEditEngine->GetSpeller().is() )
+ if (!getImpEditEngine().GetSpeller().is())
return EESpellState::NoSpeller;
- return pImpEditView->pEditEngine->pImpEditEngine->Spell(this, pDialogParent, bMultipleDoc);
+ return getImpEditEngine().Spell(this, pDialogParent, bMultipleDoc);
}
EESpellState EditView::StartThesaurus(weld::Widget* pDialogParent)
{
- if ( !pImpEditView->pEditEngine->pImpEditEngine->GetSpeller().is() )
+ if (!getImpEditEngine().GetSpeller().is())
return EESpellState::NoSpeller;
- return pImpEditView->pEditEngine->pImpEditEngine->StartThesaurus(this, pDialogParent);
+ return getImpEditEngine().StartThesaurus(this, pDialogParent);
}
void EditView::StartTextConversion(weld::Widget* pDialogParent,
LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont,
sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc )
{
- pImpEditView->pEditEngine->pImpEditEngine->Convert(this, pDialogParent, nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc);
+ getImpEditEngine().Convert(this, pDialogParent, nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc);
}
sal_Int32 EditView::StartSearchAndReplace( const SvxSearchItem& rSearchItem )
{
- return pImpEditView->pEditEngine->pImpEditEngine->StartSearchAndReplace( this, rSearchItem );
+ return getImpEditEngine().StartSearchAndReplace( this, rSearchItem );
}
bool EditView::IsCursorAtWrongSpelledWord()
@@ -916,7 +917,7 @@ bool EditView::IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWron
{
Point aPos(pImpEditView->GetOutputDevice().PixelToLogic(rPosPixel));
aPos = pImpEditView->GetDocPos( aPos );
- EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aPos, false);
+ EditPaM aPaM = getEditEngine().GetPaM(aPos, false);
return pImpEditView->IsWrongSpelledWord( aPaM , bMarkIfWrong );
}
@@ -998,14 +999,14 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
OutputDevice& rDevice = pImpEditView->GetOutputDevice();
Point aPos(rDevice.PixelToLogic(rPosPixel));
aPos = pImpEditView->GetDocPos( aPos );
- EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aPos, false);
- Reference< linguistic2::XSpellChecker1 > xSpeller( pImpEditView->pEditEngine->pImpEditEngine->GetSpeller() );
+ EditPaM aPaM = getEditEngine().GetPaM(aPos, false);
+ Reference< linguistic2::XSpellChecker1 > xSpeller(getImpEditEngine().GetSpeller());
ESelection aOldSel = GetSelection();
if ( !(xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, true )) )
return false;
// PaMtoEditCursor returns Logical units
- tools::Rectangle aTempRect = pImpEditView->pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly );
+ tools::Rectangle aTempRect = getImpEditEngine().PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly );
// GetWindowPos works in Logical units
aTempRect = pImpEditView->GetWindowPos(aTempRect);
// Convert to pixels
@@ -1037,7 +1038,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
// Are there any replace suggestions?
Reference< linguistic2::XSpellAlternatives > xSpellAlt =
- xSpeller->spell( aSelected, static_cast<sal_uInt16>(pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ).nLang), aPropVals );
+ xSpeller->spell( aSelected, static_cast<sal_uInt16>(getImpEditEngine().GetLanguage( aPaM2 ).nLang), aPropVals );
Reference< linguistic2::XLanguageGuessing > xLangGuesser( EditDLL::Get().GetGlobalData()->GetLanguageGuesser() );
@@ -1118,7 +1119,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
aDics = xDicList->getDictionaries();
pDic = aDics.getConstArray();
- LanguageType nCheckedLanguage = pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ).nLang;
+ LanguageType nCheckedLanguage = getImpEditEngine().GetLanguage( aPaM2 ).nLang;
sal_uInt16 nDicCount = static_cast<sal_uInt16>(aDics.getLength());
for (sal_uInt16 i = 0; i < nDicCount; i++)
{
@@ -1174,8 +1175,8 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
//because the loss of focus in the current editeng causes writer
//annotations to save their contents, making the pContent of the
//current EditPams invalid
- EPaM aP = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM);
- EPaM aP2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM2);
+ EPaM aP = getImpEditEngine().CreateEPaM(aPaM);
+ EPaM aP2 = getImpEditEngine().CreateEPaM(aPaM2);
if (comphelper::LibreOfficeKit::isActive())
{
@@ -1188,8 +1189,8 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
OUString sId = xPopupMenu->popup_at_rect(pPopupParent, aTempRect);
- aPaM2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP2);
- aPaM = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP);
+ aPaM2 = getImpEditEngine().CreateEditPaM(aP2);
+ aPaM = getImpEditEngine().CreateEditPaM(aP);
if (sId == "ignore")
{
@@ -1203,7 +1204,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
LanguageType nLangToUse = (sId == "wordlanguage") ? nGuessLangWord : nGuessLangPara;
SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
- SfxItemSet aAttrs = GetEditEngine()->GetEmptyItemSet();
+ SfxItemSet aAttrs = getEditEngine().GetEmptyItemSet();
if (nScriptType == SvtScriptType::LATIN)
aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE ) );
if (nScriptType == SvtScriptType::COMPLEX)
@@ -1218,7 +1219,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
SetSelection( aSel );
}
SetAttribs( aAttrs );
- pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
+ getImpEditEngine().StartOnlineSpellTimer();
SpellCallbackInfo aInf((sId == "wordlanguage") ? SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE);
rCallBack.Call(aInf);
@@ -1258,7 +1259,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
xSavDic->store();
aPaM.GetNode()->GetWrongList()->ResetInvalidRange(0, aPaM.GetNode()->Len());
- pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
+ getImpEditEngine().StartOnlineSpellTimer();
SpellCallbackInfo aInf( SpellCallbackCommand::ADDTODICTIONARY, aSelected );
rCallBack.Call(aInf);
@@ -1270,7 +1271,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
OUString aWord = pAlt[sId.toInt32() - MN_AUTOSTART];
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
if ( pAutoCorrect )
- pAutoCorrect->PutText( aSelected, aWord, pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ).nLang );
+ pAutoCorrect->PutText( aSelected, aWord, getImpEditEngine().GetLanguage( aPaM2 ).nLang );
InsertText( aWord );
}
else if ( sId.toInt32() >= MN_ALTSTART ) // Replace
@@ -1295,7 +1296,7 @@ void EditView::SelectCurrentWord( sal_Int16 nWordType )
{
EditSelection aCurSel( pImpEditView->GetEditSelection() );
pImpEditView->DrawSelectionXOR();
- aCurSel = pImpEditView->pEditEngine->SelectWord(aCurSel.Max(), nWordType);
+ aCurSel = getEditEngine().SelectWord(aCurSel.Max(), nWordType);
pImpEditView->SetEditSelection( aCurSel );
pImpEditView->DrawSelectionXOR();
ShowCursor( true, false );
@@ -1303,26 +1304,26 @@ void EditView::SelectCurrentWord( sal_Int16 nWordType )
void EditView::InsertParaBreak()
{
- pImpEditView->pEditEngine->UndoActionStart(EDITUNDO_INSERT);
+ getEditEngine().UndoActionStart(EDITUNDO_INSERT);
pImpEditView->DeleteSelected();
- EditPaM aPaM(pImpEditView->pEditEngine->InsertParaBreak(pImpEditView->GetEditSelection()));
- pImpEditView->pEditEngine->UndoActionEnd();
+ EditPaM aPaM(getEditEngine().InsertParaBreak(pImpEditView->GetEditSelection()));
+ getEditEngine().UndoActionEnd();
pImpEditView->SetEditSelection(EditSelection(aPaM, aPaM));
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout(this);
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout(this);
}
void EditView::InsertField( const SvxFieldItem& rFld )
{
- EditEngine* pEE = pImpEditView->pEditEngine;
+ EditEngine& rEditEngine = pImpEditView->getEditEngine();
pImpEditView->DrawSelectionXOR();
- pEE->UndoActionStart( EDITUNDO_INSERT );
- EditPaM aPaM( pEE->InsertField( pImpEditView->GetEditSelection(), rFld ) );
- pEE->UndoActionEnd();
+ rEditEngine.UndoActionStart( EDITUNDO_INSERT );
+ EditPaM aPaM(rEditEngine.InsertField(pImpEditView->GetEditSelection(), rFld));
+ rEditEngine.UndoActionEnd();
pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) );
- pEE->UpdateFields();
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pEE->FormatAndLayout( this );
+ rEditEngine.UpdateFields();
+ if (rEditEngine.IsUpdateLayout())
+ rEditEngine.FormatAndLayout( this );
}
const SvxFieldItem* EditView::GetFieldUnderMousePointer() const
@@ -1366,7 +1367,7 @@ const SvxFieldItem* EditView::GetFieldAtSelection(bool* pIsBeforeCursor) const
return nullptr;
// normalize: min < max
- aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() );
+ aSel.Adjust(getEditEngine().GetEditDoc());
const sal_Int32 nMinIndex = aSel.Min().GetIndex();
const sal_Int32 nMaxIndex = aSel.Max().GetIndex();
@@ -1440,18 +1441,17 @@ const SvxFieldData* EditView::GetFieldUnderMouseOrInSelectionOrAtCursor(bool bAl
sal_Int32 EditView::countFieldsOffsetSum(sal_Int32 nPara, sal_Int32 nPos, bool bCanOverflow) const
{
- if (!pImpEditView || !pImpEditView->pEditEngine)
+ if (!pImpEditView)
return 0;
int nOffset = 0;
for (int nCurrentPara = 0; nCurrentPara <= nPara; nCurrentPara++)
{
- int nFields = pImpEditView->pEditEngine->GetFieldCount( nCurrentPara );
+ int nFields = getEditEngine().GetFieldCount( nCurrentPara );
for (int nField = 0; nField < nFields; nField++)
{
- EFieldInfo aFieldInfo
- = pImpEditView->pEditEngine->GetFieldInfo( nCurrentPara, nField );
+ EFieldInfo aFieldInfo = getEditEngine().GetFieldInfo( nCurrentPara, nField );
bool bLastPara = nCurrentPara == nPara;
sal_Int32 nFieldPos = aFieldInfo.aPosition.nIndex;
@@ -1513,7 +1513,7 @@ static void ChangeFontSizeImpl( EditView* pEditView, bool bGrow, const ESelectio
void EditView::ChangeFontSize( bool bGrow, const FontList* pFontList )
{
- EditEngine& rEditEngine = *pImpEditView->pEditEngine;
+ EditEngine& rEditEngine = getEditEngine();
ESelection aSel( GetSelection() );
ESelection aOldSelection( aSel );
@@ -1649,11 +1649,11 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo
OUString EditView::GetSurroundingText() const
{
EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() );
+ aSel.Adjust(getEditEngine().GetEditDoc());
if( HasSelection() )
{
- OUString aStr = pImpEditView->pEditEngine->GetSelected(aSel);
+ OUString aStr = getEditEngine().GetSelected(aSel);
// Stop reconversion if the selected text includes a line break.
if ( aStr.indexOf( 0x0A ) == -1 )
@@ -1665,7 +1665,7 @@ OUString EditView::GetSurroundingText() const
{
aSel.Min().SetIndex( 0 );
aSel.Max().SetIndex( aSel.Max().GetNode()->Len() );
- return pImpEditView->pEditEngine->GetSelected(aSel);
+ return getEditEngine().GetSelected(aSel);
}
}
@@ -1677,8 +1677,8 @@ Selection EditView::GetSurroundingTextSelection() const
if( HasSelection() )
{
EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() );
- OUString aStr = pImpEditView->pEditEngine->GetSelected(aSel);
+ aSel.Adjust(getEditEngine().GetEditDoc());
+ OUString aStr = getEditEngine().GetSelected(aSel);
// Stop reconversion if the selected text includes a line break.
if ( aStr.indexOf( 0x0A ) == -1 )
@@ -1706,7 +1706,7 @@ bool EditView::DeleteSurroundingText(const Selection& rRange)
void EditView::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
{
Point aDocPos(pImpEditView->GetDocPos(rPosition));
- EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aDocPos);
+ EditPaM aPaM = getEditEngine().GetPaM(aDocPos);
EditSelection aSelection(pImpEditView->GetEditSelection());
// Explicitly create or delete the selection.
diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index 36e9f5fd84ae..8fbeefcf3908 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -49,9 +49,9 @@ EditSpellWrapper::EditSpellWrapper(weld::Widget* pWindow,
void EditSpellWrapper::SpellStart( SvxSpellArea eArea )
{
- EditEngine* pEE = pEditView->GetEditEngine();
- ImpEditEngine* pImpEE = pEditView->GetImpEditEngine();
- SpellInfo* pSpellInfo = pImpEE->GetSpellInfo();
+ EditEngine& rEditEngine = pEditView->getEditEngine();
+ ImpEditEngine& rImpEditEngine = pEditView->getImpEditEngine();
+ SpellInfo* pSpellInfo = rImpEditEngine.GetSpellInfo();
if ( eArea == SvxSpellArea::BodyStart )
{
@@ -63,13 +63,13 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea )
pSpellInfo->bSpellToEnd = false;
pSpellInfo->aSpellTo = pSpellInfo->aSpellStart;
pEditView->GetImpEditView()->SetEditSelection(
- pEE->GetEditDoc().GetStartPaM() );
+ rEditEngine.GetEditDoc().GetStartPaM() );
}
else
{
pSpellInfo->bSpellToEnd = true;
- pSpellInfo->aSpellTo = pImpEE->CreateEPaM(
- pEE->GetEditDoc().GetStartPaM() );
+ pSpellInfo->aSpellTo = rImpEditEngine.CreateEPaM(
+ rEditEngine.GetEditDoc().GetStartPaM() );
}
}
else if ( eArea == SvxSpellArea::BodyEnd )
@@ -80,15 +80,15 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea )
if ( !IsStartDone() )
{
pSpellInfo->bSpellToEnd = true;
- pSpellInfo->aSpellTo = pImpEE->CreateEPaM(
- pEE->GetEditDoc().GetEndPaM() );
+ pSpellInfo->aSpellTo = rImpEditEngine.CreateEPaM(
+ rEditEngine.GetEditDoc().GetEndPaM() );
}
else
{
pSpellInfo->bSpellToEnd = false;
pSpellInfo->aSpellTo = pSpellInfo->aSpellStart;
pEditView->GetImpEditView()->SetEditSelection(
- pEE->GetEditDoc().GetEndPaM() );
+ rEditEngine.GetEditDoc().GetEndPaM() );
}
}
else if ( eArea == SvxSpellArea::Body )
@@ -103,24 +103,24 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea )
void EditSpellWrapper::SpellContinue()
{
- SetLast( pEditView->GetImpEditEngine()->ImpSpell( pEditView ) );
+ SetLast(pEditView->getImpEditEngine().ImpSpell(pEditView));
}
bool EditSpellWrapper::SpellMore()
{
- EditEngine* pEE = pEditView->GetEditEngine();
- ImpEditEngine* pImpEE = pEditView->GetImpEditEngine();
- SpellInfo* pSpellInfo = pImpEE->GetSpellInfo();
+ EditEngine& rEditEngine = pEditView->getEditEngine();
+ ImpEditEngine& rImpEditEngine = pEditView->getImpEditEngine();
+ SpellInfo* pSpellInfo = rImpEditEngine.GetSpellInfo();
bool bMore = false;
if ( pSpellInfo->bMultipleDoc )
{
- bMore = pEE->SpellNextDocument();
+ bMore = rEditEngine.SpellNextDocument();
if ( bMore )
{
// The text has been entered into the engine, when backwards then
// it must be behind the selection.
pEditView->GetImpEditView()->SetEditSelection(
- pEE->GetEditDoc().GetStartPaM() );
+ rEditEngine.GetEditDoc().GetStartPaM() );
}
}
return bMore;
@@ -135,10 +135,10 @@ void EditSpellWrapper::ReplaceAll( const OUString &rNewText )
void EditSpellWrapper::CheckSpellTo()
{
- ImpEditEngine* pImpEE = pEditView->GetImpEditEngine();
- SpellInfo* pSpellInfo = pImpEE->GetSpellInfo();
+ ImpEditEngine& rImpEditEngine = pEditView->getImpEditEngine();
+ SpellInfo* pSpellInfo = rImpEditEngine.GetSpellInfo();
EditPaM aPaM( pEditView->GetImpEditView()->GetEditSelection().Max() );
- EPaM aEPaM = pImpEE->CreateEPaM( aPaM );
+ EPaM aEPaM = rImpEditEngine.CreateEPaM( aPaM );
if ( aEPaM.nPara == pSpellInfo->aSpellTo.nPara )
{
// Check if SpellToEnd still has a valid Index, if replace has been
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 598a4c68d1b3..1808b6678cdd 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -178,11 +178,11 @@ Point LOKSpecialPositioning::GetRefPoint() const
// class ImpEditView
-ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindow ) :
+ImpEditView::ImpEditView( EditView* pView, EditEngine* pEditEngine, vcl::Window* pWindow ) :
pEditView(pView),
mpViewShell(nullptr),
mpOtherShell(nullptr),
- pEditEngine(pEng),
+ mpEditEngine(pEditEngine),
pOutWin(pWindow),
nInvMore(1),
nControl(EVControlBits::AUTOSCROLL | EVControlBits::ENABLEPASTE),
@@ -193,7 +193,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo
bReadOnly(false),
bClickedInSelection(false),
bActiveDragAndDropListener(false),
- aOutArea( Point(), pEng->GetPaperSize() ),
+ aOutArea( Point(), mpEditEngine->GetPaperSize() ),
eSelectionMode(EESelectionMode::Std),
eAnchorMode(EEAnchorMode::TopLeft),
mpEditViewCallbacks(nullptr),
@@ -201,8 +201,8 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo
mbSuppressLOKMessages(false),
mbNegativeX(false)
{
- aEditSelection.Min() = pEng->GetEditDoc().GetStartPaM();
- aEditSelection.Max() = pEng->GetEditDoc().GetEndPaM();
+ aEditSelection.Min() = mpEditEngine->GetEditDoc().GetStartPaM();
+ aEditSelection.Max() = mpEditEngine->GetEditDoc().GetEndPaM();
SelectionChanged();
}
@@ -248,12 +248,14 @@ void ImpEditView::SetEditSelection( const EditSelection& rEditSelection )
SelectionChanged();
if (comphelper::LibreOfficeKit::isActive())
+ {
// Tiled rendering: selections are only painted when we are in selection mode.
- pEditEngine->SetInSelectionMode(aEditSelection.HasRange());
+ getEditEngine().SetInSelectionMode(aEditSelection.HasRange());
+ }
- if ( pEditEngine->pImpEditEngine->GetNotifyHdl().IsSet() )
+ if (getImpEditEngine().GetNotifyHdl().IsSet() )
{
- const EditDoc& rDoc = pEditEngine->GetEditDoc();
+ const EditDoc& rDoc = getEditEngine().GetEditDoc();
const EditPaM pmEnd = rDoc.GetEndPaM();
EENotifyType eNotifyType;
if (rDoc.Count() > 1 &&
@@ -267,12 +269,13 @@ void ImpEditView::SetEditSelection( const EditSelection& rEditSelection )
eNotifyType = EE_NOTIFY_TEXTVIEWSELECTIONCHANGED;
}
EENotify aNotify( eNotifyType );
- pEditEngine->pImpEditEngine->GetNotifyHdl().Call( aNotify );
+ getImpEditEngine().GetNotifyHdl().Call( aNotify );
}
- if(pEditEngine->pImpEditEngine->IsFormatted())
+
+ if (getImpEditEngine().IsFormatted())
{
EENotify aNotify(EE_NOTIFY_PROCESSNOTIFICATIONS);
- pEditEngine->pImpEditEngine->GetNotifyHdl().Call(aNotify);
+ getImpEditEngine().GetNotifyHdl().Call(aNotify);
}
}
@@ -489,9 +492,9 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
if ( !pRegion && !comphelper::LibreOfficeKit::isActive())
{
- if ( !pEditEngine->pImpEditEngine->IsUpdateLayout() )
+ if (!getImpEditEngine().IsUpdateLayout())
return;
- if ( pEditEngine->pImpEditEngine->IsInUndo() )
+ if (getImpEditEngine().IsInUndo())
return;
if ( !aTmpSel.HasRange() )
@@ -500,8 +503,8 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
// aTmpOutArea: if OutputArea > Paper width and
// Text > Paper width ( over large fields )
tools::Rectangle aTmpOutArea( aOutArea );
- if ( aTmpOutArea.GetWidth() > pEditEngine->pImpEditEngine->GetPaperSize().Width() )
- aTmpOutArea.SetRight( aTmpOutArea.Left() + pEditEngine->pImpEditEngine->GetPaperSize().Width() );
+ if ( aTmpOutArea.GetWidth() > getImpEditEngine().GetPaperSize().Width() )
+ aTmpOutArea.SetRight( aTmpOutArea.Left() + getImpEditEngine().GetPaperSize().Width() );
rTarget.IntersectClipRegion( aTmpOutArea );
if (pOutWin && pOutWin->GetCursor())
@@ -511,20 +514,20 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
if (comphelper::LibreOfficeKit::isActive() || pRegion)
pPolyPoly = tools::PolyPolygon();
- DBG_ASSERT( !pEditEngine->IsIdleFormatterActive(), "DrawSelectionXOR: Not formatted!" );
- aTmpSel.Adjust( pEditEngine->GetEditDoc() );
+ DBG_ASSERT(!getEditEngine().IsIdleFormatterActive(), "DrawSelectionXOR: Not formatted!");
+ aTmpSel.Adjust(getEditEngine().GetEditDoc());
ContentNode* pStartNode = aTmpSel.Min().GetNode();
ContentNode* pEndNode = aTmpSel.Max().GetNode();
- const sal_Int32 nStartPara = pEditEngine->GetEditDoc().GetPos(pStartNode);
- const sal_Int32 nEndPara = pEditEngine->GetEditDoc().GetPos(pEndNode);
+ const sal_Int32 nStartPara = getEditEngine().GetEditDoc().GetPos(pStartNode);
+ const sal_Int32 nEndPara = getEditEngine().GetEditDoc().GetPos(pEndNode);
if (nStartPara == EE_PARA_NOT_FOUND || nEndPara == EE_PARA_NOT_FOUND)
return;
bool bStartHandleVisible = false;
bool bEndHandleVisible = false;
bool bLOKCalcRTL = mpLOKSpecialPositioning &&
- (mpLOKSpecialPositioning->IsLayoutRTL() || pEditEngine->IsRightToLeft(nStartPara));
+ (mpLOKSpecialPositioning->IsLayoutRTL() || getEditEngine().IsRightToLeft(nStartPara));
auto DrawHighlight = [&, nStartLine = sal_Int32(0), nEndLine = sal_Int32(0)](
const ImpEditEngine::LineAreaInfo& rInfo) mutable {
@@ -575,9 +578,9 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
if (nEndIndex < nStartIndex)
nEndIndex = nStartIndex;
- tools::Rectangle aTmpRect(pEditEngine->pImpEditEngine->GetEditCursor(
+ tools::Rectangle aTmpRect(getImpEditEngine().GetEditCursor(
rInfo.rPortion, *rInfo.pLine, nStartIndex, GetCursorFlags::NONE));
- const Size aLineOffset = pEditEngine->pImpEditEngine->getTopLeftDocOffset(rInfo.aArea);
+ const Size aLineOffset = getImpEditEngine().getTopLeftDocOffset(rInfo.aArea);
aTmpRect.Move(0, aLineOffset.Height());
// Only paint if in the visible range ...
@@ -595,7 +598,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
// Now that we have Bidi, the first/last index doesn't have to be the 'most outside' position
if (!bPartOfLine)
{
- Range aLineXPosStartEnd = pEditEngine->GetLineXPosStartEnd(rInfo.rPortion, *rInfo.pLine);
+ Range aLineXPosStartEnd = getEditEngine().GetLineXPosStartEnd(rInfo.rPortion, *rInfo.pLine);
aTmpRect.SetLeft(aLineXPosStartEnd.Min());
aTmpRect.SetRight(aLineXPosStartEnd.Max());
aTmpRect.Move(aLineOffset.Width(), 0);
@@ -609,15 +612,15 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
while (nTmpStartIndex < nEndIndex)
{
- pEditEngine->pImpEditEngine->GetRightToLeft(rInfo.nPortion, nTmpStartIndex + 1,
+ getImpEditEngine().GetRightToLeft(rInfo.nPortion, nTmpStartIndex + 1,
&nWritingDirStart, &nTmpEndIndex);
if (nTmpEndIndex > nEndIndex)
nTmpEndIndex = nEndIndex;
DBG_ASSERT(nTmpEndIndex > nTmpStartIndex, "DrawSelectionXOR, Start >= End?");
- tools::Long nX1 = pEditEngine->GetXPos(rInfo.rPortion, *rInfo.pLine, nTmpStartIndex, true);
- tools::Long nX2 = pEditEngine->GetXPos(rInfo.rPortion, *rInfo.pLine, nTmpEndIndex);
+ tools::Long nX1 = getEditEngine().GetXPos(rInfo.rPortion, *rInfo.pLine, nTmpStartIndex, true);
+ tools::Long nX2 = getEditEngine().GetXPos(rInfo.rPortion, *rInfo.pLine, nTmpEndIndex);
aTmpRect.SetLeft(std::min(nX1, nX2));
aTmpRect.SetRight(std::max(nX1, nX2));
@@ -631,7 +634,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
}
return ImpEditEngine::CallbackResult::Continue;
};
- pEditEngine->pImpEditEngine->IterateLineAreas(DrawHighlight, ImpEditEngine::IterFlag::none);
+ getImpEditEngine().IterateLineAreas(DrawHighlight, ImpEditEngine::IterFlag::none);
if (comphelper::LibreOfficeKit::isActive() && mpViewShell && pOutWin)
lokSelectionCallback(pPolyPoly, bStartHandleVisible, bEndHandleVisible);
@@ -742,12 +745,12 @@ void ImpEditView::ImplDrawHighlightRect( OutputDevice& rTarget, const Point& rDo
bool ImpEditView::IsVertical() const
{
- return pEditEngine->pImpEditEngine->IsEffectivelyVertical();
+ return getImpEditEngine().IsEffectivelyVertical();
}
bool ImpEditView::IsTopToBottom() const
{
- return pEditEngine->pImpEditEngine->IsTopToBottom();
+ return getImpEditEngine().IsTopToBottom();
}
tools::Rectangle ImpEditView::GetVisDocArea() const
@@ -760,14 +763,14 @@ Point ImpEditView::GetDocPos( const Point& rWindowPos ) const
// Window Position => Position Document
Point aPoint;
- if ( !pEditEngine->pImpEditEngine->IsEffectivelyVertical() )
+ if (!getImpEditEngine().IsEffectivelyVertical())
{
aPoint.setX( rWindowPos.X() - aOutArea.Left() + GetVisDocLeft() );
aPoint.setY( rWindowPos.Y() - aOutArea.Top() + GetVisDocTop() );
}
else
{
- if (pEditEngine->pImpEditEngine->IsTopToBottom())
+ if (getImpEditEngine().IsTopToBottom())
{
aPoint.setX( rWindowPos.Y() - aOutArea.Top() + GetVisDocLeft() );
aPoint.setY( aOutArea.Right() - rWindowPos.X() + GetVisDocTop() );
@@ -787,14 +790,14 @@ Point ImpEditView::GetWindowPos( const Point& rDocPos ) const
// Document position => window position
Point aPoint;
- if ( !pEditEngine->pImpEditEngine->IsEffectivelyVertical() )
+ if (!getImpEditEngine().IsEffectivelyVertical())
{
aPoint.setX( rDocPos.X() + aOutArea.Left() - GetVisDocLeft() );
aPoint.setY( rDocPos.Y() + aOutArea.Top() - GetVisDocTop() );
}
else
{
- if (pEditEngine->pImpEditEngine->IsTopToBottom())
+ if (getImpEditEngine().IsTopToBottom())
{
aPoint.setX( aOutArea.Right() - rDocPos.Y() + GetVisDocTop() );
aPoint.setY( rDocPos.X() + aOutArea.Top() - GetVisDocLeft() );
@@ -815,7 +818,7 @@ tools::Rectangle ImpEditView::GetWindowPos( const tools::Rectangle& rDocRect ) c
Point aPos( GetWindowPos( rDocRect.TopLeft() ) );
Size aSz = rDocRect.GetSize();
tools::Rectangle aRect;
- if ( !pEditEngine->pImpEditEngine->IsEffectivelyVertical() )
+ if (!getImpEditEngine().IsEffectivelyVertical())
{
aRect = tools::Rectangle( aPos, aSz );
}
@@ -906,7 +909,7 @@ void ImpEditView::ResetOutputArea( const tools::Rectangle& rRect )
SetOutputArea(rRect);
// invalidate surrounding areas if update is true
- if(aOldArea.IsEmpty() || !pEditEngine->pImpEditEngine->IsUpdateLayout())
+ if(aOldArea.IsEmpty() || !getImpEditEngine().IsUpdateLayout())
return;
// #i119885# use grown area if needed; do when getting bigger OR smaller
@@ -965,8 +968,8 @@ void ImpEditView::RecalcOutputArea()
// X:
if ( DoAutoWidth() )
{
- if ( pEditEngine->pImpEditEngine->GetStatus().AutoPageWidth() )
- aNewSz.setWidth( pEditEngine->pImpEditEngine->GetPaperSize().Width() );
+ if (getImpEditEngine().GetStatus().AutoPageWidth())
+ aNewSz.setWidth(getImpEditEngine().GetPaperSize().Width());
switch ( eAnchorMode )
{
case EEAnchorMode::TopLeft:
@@ -996,8 +999,8 @@ void ImpEditView::RecalcOutputArea()
// Y:
if ( DoAutoHeight() )
{
- if ( pEditEngine->pImpEditEngine->GetStatus().AutoPageHeight() )
- aNewSz.setHeight( pEditEngine->pImpEditEngine->GetPaperSize().Height() );
+ if (getImpEditEngine().GetStatus().AutoPageHeight())
+ aNewSz.setHeight(getImpEditEngine().GetPaperSize().Height());
switch ( eAnchorMode )
{
case EEAnchorMode::TopLeft:
@@ -1105,13 +1108,13 @@ boost::property_tree::ptree getHyperlinkPropTree(const OUString& sText, const OU
tools::Rectangle ImpEditView::ImplGetEditCursor(EditPaM& aPaM, GetCursorFlags nShowCursorFlags, sal_Int32& nTextPortionStart, ParaPortion const& rParaPortion) const
{
- tools::Rectangle aEditCursor = pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, nShowCursorFlags );
+ tools::Rectangle aEditCursor = getImpEditEngine().PaMtoEditCursor( aPaM, nShowCursorFlags );
if ( !IsInsertMode() && !aEditSelection.HasRange() )
{
if ( aPaM.GetNode()->Len() && ( aPaM.GetIndex() < aPaM.GetNode()->Len() ) )
{
// If we are behind a portion, and the next portion has other direction, we must change position...
- aEditCursor.SetLeft( pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly|GetCursorFlags::PreferPortionStart ).Left() );
+ aEditCursor.SetLeft(getImpEditEngine().PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly|GetCursorFlags::PreferPortionStart ).Left() );
aEditCursor.SetRight( aEditCursor.Left() );
sal_Int32 nTextPortion = rParaPortion.GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, true );
@@ -1122,10 +1125,10 @@ tools::Rectangle ImpEditView::ImplGetEditCursor(EditPaM& aPaM, GetCursorFlags nS
}
else
{
- EditPaM aNext = pEditEngine->CursorRight( aPaM );
- tools::Rectangle aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GetCursorFlags::TextOnly );
+ EditPaM aNext = getEditEngine().CursorRight( aPaM );
+ tools::Rectangle aTmpRect = getImpEditEngine().PaMtoEditCursor( aNext, GetCursorFlags::TextOnly );
if ( aTmpRect.Top() != aEditCursor.Top() )
- aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GetCursorFlags::TextOnly|GetCursorFlags::EndOfLine );
+ aTmpRect = getImpEditEngine().PaMtoEditCursor( aNext, GetCursorFlags::TextOnly|GetCursorFlags::EndOfLine );
aEditCursor.SetRight( aTmpRect.Left() );
}
}
@@ -1145,11 +1148,11 @@ tools::Rectangle ImpEditView::GetEditCursor() const
EditPaM aPaM( aEditSelection.Max() );
sal_Int32 nTextPortionStart = 0;
- sal_Int32 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
+ sal_Int32 nPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() );
if (nPara == EE_PARA_NOT_FOUND) // #i94322
return tools::Rectangle();
- ParaPortion const& rParaPortion = pEditEngine->GetParaPortions().getRef(nPara);
+ ParaPortion const& rParaPortion = getEditEngine().GetParaPortions().getRef(nPara);
GetCursorFlags nShowCursorFlags = nExtraCursorFlags | GetCursorFlags::TextOnly;
@@ -1173,17 +1176,17 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
if ( ( aOutArea.Left() >= aOutArea.Right() ) && ( aOutArea.Top() >= aOutArea.Bottom() ) )
return;
- pEditEngine->CheckIdleFormatter();
- if (!pEditEngine->IsFormatted())
- pEditEngine->pImpEditEngine->FormatDoc();
+ getEditEngine().CheckIdleFormatter();
+ if (!getEditEngine().IsFormatted())
+ getImpEditEngine().FormatDoc();
// For some reasons I end up here during the formatting, if the Outliner
// is initialized in Paint, because no SetPool();
- if ( pEditEngine->pImpEditEngine->IsFormatting() )
+ if (getImpEditEngine().IsFormatting())
return;
- if ( !pEditEngine->pImpEditEngine->IsUpdateLayout() )
+ if (!getImpEditEngine().IsUpdateLayout())
return;
- if ( pEditEngine->pImpEditEngine->IsInUndo() )
+ if (getImpEditEngine().IsInUndo())
return;
if (pOutWin && pOutWin->GetCursor() != GetCursor())
@@ -1192,11 +1195,11 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
EditPaM aPaM( aEditSelection.Max() );
sal_Int32 nTextPortionStart = 0;
- sal_Int32 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
+ sal_Int32 nPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() );
if (nPara == EE_PARA_NOT_FOUND) // #i94322
return;
- ParaPortion const& rParaPortion = pEditEngine->GetParaPortions().getRef(nPara);
+ ParaPortion const& rParaPortion = getEditEngine().GetParaPortions().getRef(nPara);
GetCursorFlags nShowCursorFlags = nExtraCursorFlags | GetCursorFlags::TextOnly;
@@ -1211,7 +1214,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
tools::Rectangle aEditCursor = ImplGetEditCursor(aPaM, nShowCursorFlags, nTextPortionStart, rParaPortion);
- if ( bGotoCursor ) // && (!pEditEngine->pImpEditEngine->GetStatus().AutoPageSize() ) )
+ if ( bGotoCursor ) // && (!getImpEditEngine().GetStatus().AutoPageSize() ) )
{
// check if scrolling is necessary...
// if scrolling, then update () and Scroll ()!
@@ -1221,7 +1224,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
tools::Rectangle aTmpVisArea( GetVisDocArea() );
// aTmpOutArea: if OutputArea > Paper width and
// Text > Paper width ( over large fields )
- tools::Long nMaxTextWidth = !IsVertical() ? pEditEngine->pImpEditEngine->GetPaperSize().Width() : pEditEngine->pImpEditEngine->GetPaperSize().Height();
+ tools::Long nMaxTextWidth = !IsVertical() ? getImpEditEngine().GetPaperSize().Width() : getImpEditEngine().GetPaperSize().Height();
if ( aTmpVisArea.GetWidth() > nMaxTextWidth )
aTmpVisArea.SetRight( aTmpVisArea.Left() + nMaxTextWidth );
@@ -1275,11 +1278,11 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
tools::Long nDiffY = !IsVertical() ? nDocDiffY : (IsTopToBottom() ? nDocDiffX : -nDocDiffX);
if ( nDiffX )
- pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EditStatusFlags::HSCROLL;
+ getEditEngine().GetInternalEditStatus().GetStatusWord() = getEditEngine().GetInternalEditStatus().GetStatusWord() | EditStatusFlags::HSCROLL;
if ( nDiffY )
- pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EditStatusFlags::VSCROLL;
+ getEditEngine().GetInternalEditStatus().GetStatusWord() = getEditEngine().GetInternalEditStatus().GetStatusWord() | EditStatusFlags::VSCROLL;
Scroll( -nDiffX, -nDiffY );
- pEditEngine->pImpEditEngine->DelayedCallStatusHdl();
+ getImpEditEngine().DelayedCallStatusHdl();
}
}
@@ -1351,7 +1354,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
Point aRefPointLogical = GetOutputArea().TopLeft();
// Get the relative coordinates w.r.t refpoint in display hmm.
aCursorRectPureLogical.Move(-aRefPointLogical.X(), -aRefPointLogical.Y());
- if (pEditEngine->IsRightToLeft(nPara) || mpLOKSpecialPositioning->IsLayoutRTL())
+ if (getEditEngine().IsRightToLeft(nPara) || mpLOKSpecialPositioning->IsLayoutRTL())
{
tools::Long nMirrorW = GetOutputArea().GetWidth();
tools::Long nLeft = aCursorRectPureLogical.Left(), nRight = aCursorRectPureLogical.Right();
@@ -1410,7 +1413,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
else
{
// is cursor at a misspelled word ?
- uno::Reference<linguistic2::XSpellChecker1> xSpeller( pEditEngine->pImpEditEngine->GetSpeller() );
+ uno::Reference<linguistic2::XSpellChecker1> xSpeller(getImpEditEngine().GetSpeller());
bool bIsWrong = xSpeller.is() && IsWrongSpelledWord(aPaM, /*bMarkIfWrong*/ false);
EditView* pActiveView = GetEditViewPtr();
@@ -1454,7 +1457,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
}
CursorDirection nCursorDir = CursorDirection::NONE;
- if ( IsInsertMode() && !aEditSelection.HasRange() && ( pEditEngine->pImpEditEngine->HasDifferentRTLLevels( aPaM.GetNode() ) ) )
+ if ( IsInsertMode() && !aEditSelection.HasRange() && (getImpEditEngine().HasDifferentRTLLevels(aPaM.GetNode()) ) )
{
sal_uInt16 nTextPortion = rParaPortion.GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, bool(nShowCursorFlags & GetCursorFlags::PreferPortionStart) );
const TextPortion& rTextPortion = rParaPortion.GetTextPortions()[nTextPortion];
@@ -1470,7 +1473,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
GetCursor()->Show();
{
SvxFont aFont;
- pEditEngine->SeekCursor( aPaM.GetNode(), aPaM.GetIndex()+1, aFont );
+ getEditEngine().SeekCursor( aPaM.GetNode(), aPaM.GetIndex()+1, aFont );
InputContext aInputContext(std::move(aFont), InputContextFlags::Text | InputContextFlags::ExtText);
if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
@@ -1481,7 +1484,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
}
else
{
- pEditEngine->pImpEditEngine->GetStatus().GetStatusWord() = pEditEngine->pImpEditEngine->GetStatus().GetStatusWord() | EditStatusFlags::CURSOROUT;
+ getImpEditEngine().GetStatus().GetStatusWord() = getImpEditEngine().GetStatus().GetStatusWord() | EditStatusFlags::CURSOROUT;
GetCursor()->Hide();
GetCursor()->SetPos( Point( -1, -1 ) );
GetCursor()->SetSize( Size( 0, 0 ) );
@@ -1499,7 +1502,7 @@ void ImpEditView::ScrollStateChange()
Pair ImpEditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRangeCheck )
{
- DBG_ASSERT( pEditEngine->pImpEditEngine->IsFormatted(), "Scroll: Not formatted!" );
+ DBG_ASSERT(getImpEditEngine().IsFormatted(), "Scroll: Not formatted!");
if ( !ndX && !ndY )
return Pair( 0, 0 );
@@ -1533,10 +1536,10 @@ Pair ImpEditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRa
aNewVisArea.AdjustBottom( -ndX );
}
}
- if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( aNewVisArea.Bottom() > static_cast<tools::Long>(pEditEngine->pImpEditEngine->GetTextHeight()) ) )
+ if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( aNewVisArea.Bottom() > static_cast<tools::Long>(getImpEditEngine().GetTextHeight()) ) )
{
// GetTextHeight still optimizing!
- tools::Long nDiff = pEditEngine->pImpEditEngine->GetTextHeight() - aNewVisArea.Bottom(); // negative
+ tools::Long nDiff = getImpEditEngine().GetTextHeight() - aNewVisArea.Bottom(); // negative
aNewVisArea.Move( 0, nDiff ); // could end up in the negative area...
}
if ( aNewVisArea.Top() < 0 )
@@ -1561,9 +1564,9 @@ Pair ImpEditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRa
aNewVisArea.AdjustRight(ndY );
}
}
- if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( aNewVisArea.Right() > static_cast<tools::Long>(pEditEngine->pImpEditEngine->CalcTextWidth( false )) ) )
+ if ( ( nRangeCheck == ScrollRangeCheck::PaperWidthTextSize ) && ( aNewVisArea.Right() > static_cast<tools::Long>(getImpEditEngine().CalcTextWidth( false )) ) )
{
- tools::Long nDiff = pEditEngine->pImpEditEngine->CalcTextWidth( false ) - aNewVisArea.Right(); // negative
+ tools::Long nDiff = getImpEditEngine().CalcTextWidth( false ) - aNewVisArea.Right(); // negative
aNewVisArea.Move( nDiff, 0 ); // could end up in the negative area...
}
if ( aNewVisArea.Left() < 0 )
@@ -1624,10 +1627,10 @@ Pair ImpEditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRa
pCrsr->Show();
}
- if ( pEditEngine->pImpEditEngine->GetNotifyHdl().IsSet() )
+ if (getImpEditEngine().GetNotifyHdl().IsSet())
{
EENotify aNotify( EE_NOTIFY_TEXTVIEWSCROLLED );
- pEditEngine->pImpEditEngine->GetNotifyHdl().Call( aNotify );
+ getImpEditEngine().GetNotifyHdl().Call( aNotify );
}
if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
@@ -1682,10 +1685,10 @@ bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * p
{
if ( !bReadOnly && IsPasteEnabled() )
{
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_PASTE );
+ getImpEditEngine().UndoActionStart( EDITUNDO_PASTE );
uno::Reference<datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
- Paste( aClipBoard, pEditEngine->pImpEditEngine->GetStatus().AllowPasteSpecial() );
- pEditEngine->pImpEditEngine->UndoActionEnd();
+ Paste( aClipBoard, getImpEditEngine().GetStatus().AllowPasteSpecial() );
+ getImpEditEngine().UndoActionEnd();
bDone = true;
}
}
@@ -1696,7 +1699,7 @@ bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * p
}
if( !bDone )
- bDone = pEditEngine->PostKeyEvent( rKeyEvent, GetEditViewPtr(), pFrameWin );
+ bDone = getEditEngine().PostKeyEvent( rKeyEvent, GetEditViewPtr(), pFrameWin );
return bDone;
}
@@ -1720,36 +1723,36 @@ bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent )
CutCopy( aClipBoard, false );
}
- return pEditEngine->pImpEditEngine->MouseButtonUp( rMouseEvent, GetEditViewPtr() );
+ return getImpEditEngine().MouseButtonUp( rMouseEvent, GetEditViewPtr() );
}
void ImpEditView::ReleaseMouse()
{
- pEditEngine->pImpEditEngine->ReleaseMouse();
+ getImpEditEngine().ReleaseMouse();
}
bool ImpEditView::MouseButtonDown( const MouseEvent& rMouseEvent )
{
- pEditEngine->CheckIdleFormatter(); // If fast typing and mouse button downs
+ getEditEngine().CheckIdleFormatter(); // If fast typing and mouse button downs
nTravelXPos = TRAVEL_X_DONTKNOW;
nExtraCursorFlags = GetCursorFlags::NONE;
nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW;
- bool bPrevUpdateLayout = pEditEngine->pImpEditEngine->SetUpdateLayout(true);
+ bool bPrevUpdateLayout = getImpEditEngine().SetUpdateLayout(true);
bClickedInSelection = IsSelectionAtPoint( rMouseEvent.GetPosPixel() );
- bool bRet = pEditEngine->pImpEditEngine->MouseButtonDown( rMouseEvent, GetEditViewPtr() );
- pEditEngine->pImpEditEngine->SetUpdateLayout(bPrevUpdateLayout);
+ bool bRet = getImpEditEngine().MouseButtonDown( rMouseEvent, GetEditViewPtr() );
+ getImpEditEngine().SetUpdateLayout(bPrevUpdateLayout);
return bRet;
}
bool ImpEditView::MouseMove( const MouseEvent& rMouseEvent )
{
- return pEditEngine->pImpEditEngine->MouseMove( rMouseEvent, GetEditViewPtr() );
+ return getImpEditEngine().MouseMove( rMouseEvent, GetEditViewPtr() );
}
bool ImpEditView::Command(const CommandEvent& rCEvt)
{
- pEditEngine->CheckIdleFormatter(); // If fast typing and mouse button down
- return pEditEngine->pImpEditEngine->Command(rCEvt, GetEditViewPtr());
+ getEditEngine().CheckIdleFormatter(); // If fast typing and mouse button down
+ return getImpEditEngine().Command(rCEvt, GetEditViewPtr());
}
@@ -1767,7 +1770,7 @@ bool ImpEditView::IsWrongSpelledWord( const EditPaM& rPaM, bool bMarkIfWrong )
bool bIsWrong = false;
if ( rPaM.GetNode()->GetWrongList() )
{
- EditSelection aSel = pEditEngine->SelectWord( rPaM, css::i18n::WordType::DICTIONARY_WORD );
+ EditSelection aSel = getEditEngine().SelectWord( rPaM, css::i18n::WordType::DICTIONARY_WORD );
bIsWrong = rPaM.GetNode()->GetWrongList()->HasWrong( aSel.Min().GetIndex(), aSel.Max().GetIndex() );
if ( bIsWrong && bMarkIfWrong )
{
@@ -1782,17 +1785,17 @@ bool ImpEditView::IsWrongSpelledWord( const EditPaM& rPaM, bool bMarkIfWrong )
OUString ImpEditView::SpellIgnoreWord()
{
OUString aWord;
- if ( pEditEngine->pImpEditEngine->GetSpeller().is() )
+ if (getImpEditEngine().GetSpeller().is())
{
EditPaM aPaM = GetEditSelection().Max();
if ( !HasSelection() )
{
- EditSelection aSel = pEditEngine->SelectWord(aPaM);
- aWord = pEditEngine->pImpEditEngine->GetSelected( aSel );
+ EditSelection aSel = getEditEngine().SelectWord(aPaM);
+ aWord = getImpEditEngine().GetSelected( aSel );
}
else
{
- aWord = pEditEngine->pImpEditEngine->GetSelected( GetEditSelection() );
+ aWord = getImpEditEngine().GetSelected( GetEditSelection() );
// And deselect
DrawSelectionXOR();
SetEditSelection( EditSelection( aPaM, aPaM ) );
@@ -1804,15 +1807,15 @@ OUString ImpEditView::SpellIgnoreWord()
uno::Reference<linguistic2::XDictionary> xDic = LinguMgr::GetIgnoreAllList();
if (xDic.is())
xDic->add( aWord, false, OUString() );
- EditDoc& rDoc = pEditEngine->GetEditDoc();
+ EditDoc& rDoc = getEditEngine().GetEditDoc();
sal_Int32 nNodes = rDoc.Count();
for ( sal_Int32 n = 0; n < nNodes; n++ )
{
ContentNode* pNode = rDoc.GetObject( n );
pNode->GetWrongList()->MarkWrongsInvalid();
}
- pEditEngine->pImpEditEngine->DoOnlineSpelling( aPaM.GetNode() );
- pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
+ getImpEditEngine().DoOnlineSpelling( aPaM.GetNode() );
+ getImpEditEngine().StartOnlineSpellTimer();
}
}
return aWord;
@@ -1822,17 +1825,17 @@ void ImpEditView::DeleteSelected()
{
DrawSelectionXOR();
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_DELETE );
+ getImpEditEngine().UndoActionStart( EDITUNDO_DELETE );
- EditPaM aPaM = pEditEngine->pImpEditEngine->DeleteSelected( GetEditSelection() );
+ EditPaM aPaM = getImpEditEngine().DeleteSelected( GetEditSelection() );
- pEditEngine->pImpEditEngine->UndoActionEnd();
+ getImpEditEngine().UndoActionEnd();
SetEditSelection( EditSelection( aPaM, aPaM ) );
DrawSelectionXOR();
- pEditEngine->pImpEditEngine->FormatAndLayout( GetEditViewPtr() );
+ getImpEditEngine().FormatAndLayout( GetEditViewPtr() );
ShowCursor( DoAutoScroll(), true );
}
@@ -1842,7 +1845,7 @@ const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_Int32* pPara,
return nullptr;
Point aDocPos( GetDocPos( rPos ) );
- EditPaM aPaM = pEditEngine->GetPaM(aDocPos, false);
+ EditPaM aPaM = getEditEngine().GetPaM(aDocPos, false);
if (!aPaM)
return nullptr;
@@ -1863,7 +1866,7 @@ const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_Int32* pPara,
{
DBG_ASSERT(dynamic_cast<const SvxFieldItem*>(rAttr.GetItem()), "No FieldItem...");
if ( pPara )
- *pPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
+ *pPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() );
if ( pPos )
*pPos = rAttr.GetStart();
return static_cast<const SvxFieldItem*>(rAttr.GetItem());
@@ -1882,16 +1885,16 @@ bool ImpEditView::IsBulletArea( const Point& rPos, sal_Int32* pPara )
return false;
Point aDocPos( GetDocPos( rPos ) );
- EditPaM aPaM = pEditEngine->GetPaM(aDocPos, false);
+ EditPaM aPaM = getEditEngine().GetPaM(aDocPos, false);
if (!aPaM)
return false;
if ( aPaM.GetIndex() == 0 )
{
- sal_Int32 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
- tools::Rectangle aBulletArea = pEditEngine->GetBulletArea( nPara );
- tools::Long nY = pEditEngine->GetDocPosTopLeft( nPara ).Y();
- ParaPortion const& rParaPortion = pEditEngine->GetParaPortions().getRef(nPara);
+ sal_Int32 nPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() );
+ tools::Rectangle aBulletArea = getEditEngine().GetBulletArea( nPara );
+ tools::Long nY = getEditEngine().GetDocPosTopLeft( nPara ).Y();
+ ParaPortion const& rParaPortion = getEditEngine().GetParaPortions().getRef(nPara);
nY += rParaPortion.GetFirstLineOffset();
if ( ( aDocPos.Y() > ( nY + aBulletArea.Top() ) ) &&
( aDocPos.Y() < ( nY + aBulletArea.Bottom() ) ) &&
@@ -1912,7 +1915,7 @@ void ImpEditView::CutCopy(uno::Reference<datatransfer::clipboard::XClipboard> co
if ( !(rxClipboard.is() && HasSelection()) )
return;
- uno::Reference<datatransfer::XTransferable> xData = pEditEngine->CreateTransferable( GetEditSelection() );
+ uno::Reference<datatransfer::XTransferable> xData = getEditEngine().CreateTransferable( GetEditSelection() );
{
SolarMutexReleaser aReleaser;
@@ -1934,9 +1937,9 @@ void ImpEditView::CutCopy(uno::Reference<datatransfer::clipboard::XClipboard> co
if (bCut)
{
- pEditEngine->pImpEditEngine->UndoActionStart(EDITUNDO_CUT);
+ getImpEditEngine().UndoActionStart(EDITUNDO_CUT);
DeleteSelected();
- pEditEngine->pImpEditEngine->UndoActionEnd();
+ getImpEditEngine().UndoActionEnd();
}
}
@@ -1959,18 +1962,18 @@ void ImpEditView::Paste(uno::Reference<datatransfer::clipboard::XClipboard> cons
if ( !xDataObj.is() || !EditEngine::HasValidData( xDataObj ) )
return;
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_PASTE );
+ getImpEditEngine().UndoActionStart( EDITUNDO_PASTE );
EditSelection aSel( GetEditSelection() );
if ( aSel.HasRange() )
{
DrawSelectionXOR();
- aSel = pEditEngine->DeleteSelection(aSel);
+ aSel = getEditEngine().DeleteSelection(aSel);
}
PasteOrDropInfos aPasteOrDropInfos;
- aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
- pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos);
+ aPasteOrDropInfos.nStartPara = getEditEngine().GetEditDoc().GetPos( aSel.Min().GetNode() );
+ getEditEngine().HandleBeginPasteOrDrop(aPasteOrDropInfos);
if ( DoSingleLinePaste() )
{
@@ -1985,7 +1988,7 @@ void ImpEditView::Paste(uno::Reference<datatransfer::clipboard::XClipboard> cons
aData >>= aTmpText;
OUString aText(convertLineEnd(aTmpText, LINEEND_LF));
aText = aText.replaceAll( OUStringChar(LINE_SEP), " " );
- aSel = pEditEngine->InsertText(aSel, aText);
+ aSel = getEditEngine().InsertText(aSel, aText);
}
catch( ... )
{
@@ -1998,18 +2001,18 @@ void ImpEditView::Paste(uno::Reference<datatransfer::clipboard::XClipboard> cons
// Prevent notifications of paragraph inserts et al that would trigger
// a11y to format content in a half-ready state when obtaining
// paragraphs. Collect and broadcast when done instead.
- aSel = pEditEngine->InsertText(
+ aSel = getEditEngine().InsertText(
xDataObj, OUString(), aSel.Min(),
- bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial(), format);
+ bUseSpecial && getEditEngine().GetInternalEditStatus().AllowPasteSpecial(), format);
}
- aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
- pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos);
+ aPasteOrDropInfos.nEndPara = getEditEngine().GetEditDoc().GetPos( aSel.Max().GetNode() );
+ getEditEngine().HandleEndPasteOrDrop(aPasteOrDropInfos);
- pEditEngine->pImpEditEngine->UndoActionEnd();
+ getImpEditEngine().UndoActionEnd();
SetEditSelection( aSel );
- pEditEngine->pImpEditEngine->UpdateSelections();
- pEditEngine->pImpEditEngine->FormatAndLayout( GetEditViewPtr() );
+ getImpEditEngine().UpdateSelections();
+ getImpEditEngine().FormatAndLayout( GetEditViewPtr() );
ShowCursor( DoAutoScroll(), true );
}
@@ -2020,11 +2023,11 @@ bool ImpEditView::IsInSelection( const EditPaM& rPaM )
if ( !aSel.HasRange() )
return false;
- aSel.Adjust( pEditEngine->GetEditDoc() );
+ aSel.Adjust(getEditEngine().GetEditDoc());
- sal_Int32 nStartNode = pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
- sal_Int32 nEndNode = pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
- sal_Int32 nCurNode = pEditEngine->GetEditDoc().GetPos( rPaM.GetNode() );
+ sal_Int32 nStartNode = getEditEngine().GetEditDoc().GetPos( aSel.Min().GetNode() );
+ sal_Int32 nEndNode = getEditEngine().GetEditDoc().GetPos( aSel.Max().GetNode() );
+ sal_Int32 nCurNode = getEditEngine().GetEditDoc().GetPos( rPaM.GetNode() );
if ( ( nCurNode > nStartNode ) && ( nCurNode < nEndNode ) )
return true;
@@ -2068,7 +2071,7 @@ bool ImpEditView::IsSelectionInSinglePara() const
void ImpEditView::CreateAnchor()
{
- pEditEngine->SetInSelectionMode(true);
+ getEditEngine().SetInSelectionMode(true);
EditSelection aNewSelection(GetEditSelection());
aNewSelection.Min() = aNewSelection.Max();
SetEditSelection(aNewSelection);
@@ -2077,7 +2080,7 @@ void ImpEditView::CreateAnchor()
void ImpEditView::DeselectAll()
{
- pEditEngine->SetInSelectionMode(false);
+ getEditEngine().SetInSelectionMode(false);
DrawSelectionXOR();
EditSelection aNewSelection(GetEditSelection());
aNewSelection.Min() = aNewSelection.Max();
@@ -2106,19 +2109,19 @@ bool ImpEditView::IsSelectionAtPoint( const Point& rPosPixel )
const OutputDevice& rOutDev = GetOutputDevice();
Point aMousePos = rOutDev.PixelToLogic(rPosPixel);
- if ( ( !GetOutputArea().Contains( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() )
+ if ( ( !GetOutputArea().Contains( aMousePos ) ) && !getImpEditEngine().IsInSelectionMode() )
{
return false;
}
Point aDocPos( GetDocPos( aMousePos ) );
- EditPaM aPaM = pEditEngine->GetPaM(aDocPos, false);
+ EditPaM aPaM = getEditEngine().GetPaM(aDocPos, false);
return IsInSelection( aPaM );
}
bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
{
- pEditEngine->CheckIdleFormatter();
+ getEditEngine().CheckIdleFormatter();
Point aMousePos( rPointPixel );
@@ -2126,7 +2129,7 @@ bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
const OutputDevice& rOutDev = GetOutputDevice();
aMousePos = rOutDev.PixelToLogic( aMousePos );
- if ( ( !GetOutputArea().Contains( aMousePos ) ) && !pEditEngine->pImpEditEngine->IsInSelectionMode() )
+ if ( ( !GetOutputArea().Contains( aMousePos ) ) && !getImpEditEngine().IsInSelectionMode() )
{
return false;
}
@@ -2136,7 +2139,7 @@ bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
// Can be optimized: first go through the lines within a paragraph for PAM,
// then again with the PaM for the Rect, even though the line is already
// known... This must not be, though!
- EditPaM aPaM = pEditEngine->GetPaM(aDocPos);
+ EditPaM aPaM = getEditEngine().GetPaM(aDocPos);
bool bGotoCursor = DoAutoScroll();
// aTmpNewSel: Diff between old and new, not the new selection, unless for tiled rendering
@@ -2147,7 +2150,7 @@ bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
EditSelection aNewEditSelection( GetEditSelection() );
aNewEditSelection.Max() = aPaM;
- if (!pEditEngine->GetSelectionEngine().HasAnchor())
+ if (!getEditEngine().GetSelectionEngine().HasAnchor())
{
if ( aNewEditSelection.Min() != aPaM )
{
@@ -2168,7 +2171,7 @@ bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
SetEditSelection( aNewEditSelection );
}
- bool bForceCursor = pDragAndDropInfo == nullptr && !pEditEngine->pImpEditEngine->IsInSelectionMode();
+ bool bForceCursor = pDragAndDropInfo == nullptr && !getImpEditEngine().IsInSelectionMode();
ShowCursor( bGotoCursor, bForceCursor );
return true;
}
@@ -2245,7 +2248,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur
Point aMousePosPixel( rDGE.DragOriginX, rDGE.DragOriginY );
EditSelection aCopySel( GetEditSelection() );
- aCopySel.Adjust( pEditEngine->GetEditDoc() );
+ aCopySel.Adjust(getEditEngine().GetEditDoc());
if ( HasSelection() && bClickedInSelection )
{
@@ -2262,7 +2265,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur
{
pDragAndDropInfo.reset(new DragAndDropInfo());
pDragAndDropInfo->pField = pField;
- ContentNode* pNode = pEditEngine->GetEditDoc().GetObject( nPara );
+ ContentNode* pNode = getEditEngine().GetEditDoc().GetObject( nPara );
aCopySel = EditSelection( EditPaM( pNode, nPos ), EditPaM( pNode, nPos+1 ) );
SetEditSelection(aCopySel);
DrawSelectionXOR();
@@ -2273,15 +2276,15 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur
{
pDragAndDropInfo.reset(new DragAndDropInfo());
pDragAndDropInfo->bOutlinerMode = true;
- EditPaM aStartPaM( pEditEngine->GetEditDoc().GetObject( nPara ), 0 );
+ EditPaM aStartPaM(getEditEngine().GetEditDoc().GetObject(nPara), 0);
EditPaM aEndPaM( aStartPaM );
- const SfxInt16Item& rLevel = pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL );
- for ( sal_Int32 n = nPara +1; n < pEditEngine->GetEditDoc().Count(); n++ )
+ const SfxInt16Item& rLevel = getEditEngine().GetParaAttrib(nPara, EE_PARA_OUTLLEVEL);
+ for ( sal_Int32 n = nPara +1; n < getEditEngine().GetEditDoc().Count(); n++ )
{
- const SfxInt16Item& rL = pEditEngine->GetParaAttrib( n, EE_PARA_OUTLLEVEL );
+ const SfxInt16Item& rL = getEditEngine().GetParaAttrib( n, EE_PARA_OUTLLEVEL );
if ( rL.GetValue() > rLevel.GetValue() )
{
- aEndPaM.SetNode( pEditEngine->GetEditDoc().GetObject( n ) );
+ aEndPaM.SetNode( getEditEngine().GetEditDoc().GetObject( n ) );
}
else
{
@@ -2304,9 +2307,9 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur
aSz = GetOutputDevice().PixelToLogic( aSz );
pDragAndDropInfo->nSensibleRange = static_cast<sal_uInt16>(aSz.Width());
pDragAndDropInfo->nCursorWidth = static_cast<sal_uInt16>(aSz.Width()) / 2;
- pDragAndDropInfo->aBeginDragSel = pEditEngine->pImpEditEngine->CreateESel( aCopySel );
+ pDragAndDropInfo->aBeginDragSel = getImpEditEngine().CreateESel( aCopySel );
- uno::Reference<datatransfer::XTransferable> xData = pEditEngine->CreateTransferable(aCopySel);
+ uno::Reference<datatransfer::XTransferable> xData = getEditEngine().CreateTransferable(aCopySel);
sal_Int8 nActions = bReadOnly ? datatransfer::dnd::DNDConstants::ACTION_COPY : datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE;
@@ -2379,32 +2382,32 @@ void ImpEditView::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent
}
DrawSelectionXOR();
- EditSelection aDelSel( pEditEngine->pImpEditEngine->CreateSel( aToBeDelSel ) );
- DBG_ASSERT( !aDelSel.DbgIsBuggy( pEditEngine->GetEditDoc() ), "ToBeDel is buggy!" );
- pEditEngine->DeleteSelection(aDelSel);
+ EditSelection aDelSel(getImpEditEngine().CreateSel(aToBeDelSel));
+ DBG_ASSERT( !aDelSel.DbgIsBuggy(getEditEngine().GetEditDoc()), "ToBeDel is buggy!");
+ getEditEngine().DeleteSelection(aDelSel);
if ( !bBeforeSelection )
{
- DBG_ASSERT( !pEditEngine->pImpEditEngine->CreateSel( aNewSel ).DbgIsBuggy(pEditEngine->GetEditDoc()), "Bad" );
- SetEditSelection( pEditEngine->pImpEditEngine->CreateSel( aNewSel ) );
+ DBG_ASSERT(!getImpEditEngine().CreateSel(aNewSel).DbgIsBuggy(getEditEngine().GetEditDoc()), "Bad");
+ SetEditSelection(getImpEditEngine().CreateSel(aNewSel));
}
- pEditEngine->pImpEditEngine->FormatAndLayout( pEditEngine->pImpEditEngine->GetActiveView() );
+ getImpEditEngine().FormatAndLayout(getImpEditEngine().GetActiveView());
DrawSelectionXOR();
}
else
{
// other EditEngine ...
- if (pEditEngine->HasText()) // #88630# SC is removing the content when switching the task
+ if (getEditEngine().HasText()) // #88630# SC is removing the content when switching the task
DeleteSelected();
}
}
if ( pDragAndDropInfo->bUndoAction )
- pEditEngine->pImpEditEngine->UndoActionEnd();
+ getImpEditEngine().UndoActionEnd();
HideDDCursor();
ShowCursor( DoAutoScroll(), true );
pDragAndDropInfo.reset();
- pEditEngine->GetEndDropHdl().Call(GetEditViewPtr());
+ getEditEngine().GetEndDropHdl().Call(GetEditViewPtr());
}
void ImpEditView::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE )
@@ -2416,14 +2419,14 @@ void ImpEditView::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE
if ( !(pDragAndDropInfo && pDragAndDropInfo->bDragAccepted) )
return;
- pEditEngine->GetBeginDropHdl().Call(GetEditViewPtr());
+ getEditEngine().GetBeginDropHdl().Call(GetEditViewPtr());
bool bChanges = false;
HideDDCursor();
if ( pDragAndDropInfo->bStarterOfDD )
{
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_DRAGANDDROP );
+ getImpEditEngine().UndoActionStart( EDITUNDO_DRAGANDDROP );
pDragAndDropInfo->bUndoAction = true;
}
@@ -2443,23 +2446,23 @@ void ImpEditView::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE
EditPaM aPaM( pDragAndDropInfo->aDropDest );
PasteOrDropInfos aPasteOrDropInfos;
- aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
- pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos);
+ aPasteOrDropInfos.nStartPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() );
+ getEditEngine().HandleBeginPasteOrDrop(aPasteOrDropInfos);
- EditSelection aNewSel = pEditEngine->InsertText(
- xDataObj, OUString(), aPaM, pEditEngine->GetInternalEditStatus().AllowPasteSpecial());
+ EditSelection aNewSel = getEditEngine().InsertText(
+ xDataObj, OUString(), aPaM, getEditEngine().GetInternalEditStatus().AllowPasteSpecial());
- aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() );
- pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos);
+ aPasteOrDropInfos.nEndPara = getEditEngine().GetEditDoc().GetPos( aNewSel.Max().GetNode() );
+ getEditEngine().HandleEndPasteOrDrop(aPasteOrDropInfos);
SetEditSelection( aNewSel );
- pEditEngine->pImpEditEngine->FormatAndLayout( pEditEngine->pImpEditEngine->GetActiveView() );
+ getImpEditEngine().FormatAndLayout(getImpEditEngine().GetActiveView());
if ( pDragAndDropInfo->bStarterOfDD )
{
// Only set if the same engine!
- pDragAndDropInfo->aDropSel.nStartPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
+ pDragAndDropInfo->aDropSel.nStartPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() );
pDragAndDropInfo->aDropSel.nStartPos = aPaM.GetIndex();
- pDragAndDropInfo->aDropSel.nEndPara = pEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() );
+ pDragAndDropInfo->aDropSel.nEndPara = getEditEngine().GetEditDoc().GetPos( aNewSel.Max().GetNode() );
pDragAndDropInfo->aDropSel.nEndPos = aNewSel.Max().GetIndex();
pDragAndDropInfo->bDroppedInMe = true;
}
@@ -2559,15 +2562,15 @@ void ImpEditView::dragOver(const css::datatransfer::dnd::DropTargetDragEvent& rD
}
Point aDocPos( GetDocPos( aMousePos ) );
- EditPaM aPaM = pEditEngine->GetPaM( aDocPos );
+ EditPaM aPaM = getEditEngine().GetPaM( aDocPos );
pDragAndDropInfo->aDropDest = aPaM;
if ( pDragAndDropInfo->bOutlinerMode )
{
- sal_Int32 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
- ParaPortion* pPPortion = pEditEngine->GetParaPortions().SafeGetObject( nPara );
+ sal_Int32 nPara = getEditEngine().GetEditDoc().GetPos( aPaM.GetNode() );
+ ParaPortion* pPPortion = getEditEngine().GetParaPortions().SafeGetObject( nPara );
if (pPPortion)
{
- tools::Long nDestParaStartY = pEditEngine->GetParaPortions().GetYOffset( pPPortion );
+ tools::Long nDestParaStartY = getEditEngine().GetParaPortions().GetYOffset( pPPortion );
tools::Long nRel = aDocPos.Y() - nDestParaStartY;
if ( nRel < ( pPPortion->GetHeight() / 2 ) )
{
@@ -2588,9 +2591,9 @@ void ImpEditView::dragOver(const css::datatransfer::dnd::DropTargetDragEvent& rD
else if ( HasSelection() )
{
// it must not be dropped into a selection
- EPaM aP = pEditEngine->pImpEditEngine->CreateEPaM( aPaM );
+ EPaM aP = getImpEditEngine().CreateEPaM( aPaM );
ESelection aDestSel( aP.nPara, aP.nIndex, aP.nPara, aP.nIndex);
- ESelection aCurSel = pEditEngine->pImpEditEngine->CreateESel( GetEditSelection() );
+ ESelection aCurSel = getImpEditEngine().CreateESel( GetEditSelection() );
aCurSel.Adjust();
if ( !(aDestSel < aCurSel) && !(aDestSel > aCurSel) )
{
@@ -2603,22 +2606,22 @@ void ImpEditView::dragOver(const css::datatransfer::dnd::DropTargetDragEvent& rD
if ( pDragAndDropInfo->bOutlinerMode )
{
tools::Long nDDYPos(0);
- if ( pDragAndDropInfo->nOutlinerDropDest < pEditEngine->GetEditDoc().Count() )
+ if ( pDragAndDropInfo->nOutlinerDropDest < getEditEngine().GetEditDoc().Count() )
{
- ParaPortion* pPPortion = pEditEngine->GetParaPortions().SafeGetObject( pDragAndDropInfo->nOutlinerDropDest );
+ ParaPortion* pPPortion = getEditEngine().GetParaPortions().SafeGetObject( pDragAndDropInfo->nOutlinerDropDest );
if (pPPortion)
- nDDYPos = pEditEngine->GetParaPortions().GetYOffset( pPPortion );
+ nDDYPos = getEditEngine().GetParaPortions().GetYOffset( pPPortion );
}
else
{
- nDDYPos = pEditEngine->pImpEditEngine->GetTextHeight();
+ nDDYPos = getImpEditEngine().GetTextHeight();
}
Point aStartPos( 0, nDDYPos );
aStartPos = GetWindowPos( aStartPos );
Point aEndPos( GetOutputArea().GetWidth(), nDDYPos );
aEndPos = GetWindowPos( aEndPos );
aEditCursor = rOutDev.LogicToPixel( tools::Rectangle( aStartPos, aEndPos ) );
- if ( !pEditEngine->IsEffectivelyVertical() )
+ if (!getEditEngine().IsEffectivelyVertical())
{
aEditCursor.AdjustTop( -1 );
aEditCursor.AdjustBottom( 1 );
@@ -2640,7 +2643,7 @@ void ImpEditView::dragOver(const css::datatransfer::dnd::DropTargetDragEvent& rD
}
else
{
- aEditCursor = pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM );
+ aEditCursor = getImpEditEngine().PaMtoEditCursor( aPaM );
Point aTopLeft( GetWindowPos( aEditCursor.TopLeft() ) );
aEditCursor.SetPos( aTopLeft );
aEditCursor.SetRight( aEditCursor.Left() + pDragAndDropInfo->nCursorWidth );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index b55d91dda690..9a011e90e53c 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -270,7 +270,7 @@ private:
OutlinerViewShell* mpViewShell;
/// Another shell, just listening to our state, if any.
OutlinerViewShell* mpOtherShell;
- EditEngine* pEditEngine;
+ EditEngine* mpEditEngine;
VclPtr<vcl::Window> pOutWin;
EditView::OutWindowSet aOutWindowSet;
std::optional<PointerStyle> mxPointer;
@@ -352,6 +352,10 @@ public:
EditView* GetEditViewPtr() { return pEditView; }
+ EditEngine& getEditEngine() const { return *mpEditEngine; }
+ ImpEditEngine& getImpEditEngine() const { return getEditEngine().getImpl(); }
+
+
sal_uInt16 GetScrollDiffX() const { return nScrollDiffX; }
void SetScrollDiffX( sal_uInt16 n ) { nScrollDiffX = n; }
diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx
index e97be254d6d3..e7d3f1574ce4 100644
--- a/editeng/source/editeng/textconv.cxx
+++ b/editeng/source/editeng/textconv.cxx
@@ -122,17 +122,17 @@ bool TextConvWrapper::ConvMore_impl()
// modified version of SvxSpellWrapper::SpellMore
bool bMore = false;
- EditEngine* pEE = m_pEditView->GetEditEngine();
- ImpEditEngine* pImpEE = m_pEditView->GetImpEditEngine();
- ConvInfo* pConvInfo = pImpEE->GetConvInfo();
+ EditEngine& rEditEngine = m_pEditView->getEditEngine();
+ ImpEditEngine& rImpEditEngine = m_pEditView->getImpEditEngine();
+ ConvInfo* pConvInfo = rImpEditEngine.GetConvInfo();
if ( pConvInfo->bMultipleDoc )
{
- bMore = pEE->ConvertNextDocument();
+ bMore = rEditEngine.ConvertNextDocument();
if ( bMore )
{
// The text has been entered in this engine ...
m_pEditView->GetImpEditView()->SetEditSelection(
- pEE->GetEditDoc().GetStartPaM() );
+ rEditEngine.GetEditDoc().GetStartPaM() );
}
}
return bMore;
@@ -143,9 +143,9 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea )
{
// modified version of EditSpellWrapper::SpellStart
- EditEngine* pEE = m_pEditView->GetEditEngine();
- ImpEditEngine* pImpEE = m_pEditView->GetImpEditEngine();
- ConvInfo* pConvInfo = pImpEE->GetConvInfo();
+ EditEngine& rEditEngine = m_pEditView->getEditEngine();
+ ImpEditEngine& rImpEditEngine = m_pEditView->getImpEditEngine();
+ ConvInfo* pConvInfo = rImpEditEngine.GetConvInfo();
if ( eArea == SvxSpellArea::BodyStart )
{
@@ -156,13 +156,12 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea )
pConvInfo->aConvTo = pConvInfo->aConvStart;
pConvInfo->aConvContinue = EPaM( 0, 0 );
m_pEditView->GetImpEditView()->SetEditSelection(
- pEE->GetEditDoc().GetStartPaM() );
+ rEditEngine.GetEditDoc().GetStartPaM() );
}
else
{
pConvInfo->bConvToEnd = true;
- pConvInfo->aConvTo = pImpEE->CreateEPaM(
- pEE->GetEditDoc().GetStartPaM() );
+ pConvInfo->aConvTo = rImpEditEngine.CreateEPaM(rEditEngine.GetEditDoc().GetStartPaM() );
}
}
else if ( eArea == SvxSpellArea::BodyEnd )
@@ -179,16 +178,14 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea )
else
{
// nothing selected: convert to end of document
- pConvInfo->aConvTo = pImpEE->CreateEPaM(
- pEE->GetEditDoc().GetEndPaM() );
+ pConvInfo->aConvTo = rImpEditEngine.CreateEPaM(rEditEngine.GetEditDoc().GetEndPaM() );
}
}
else if ( eArea == SvxSpellArea::Body )
{
// called by ConvNext_impl...
pConvInfo->aConvContinue = pConvInfo->aConvStart;
- pConvInfo->aConvTo = pImpEE->CreateEPaM(
- pEE->GetEditDoc().GetEndPaM() );
+ pConvInfo->aConvTo = rImpEditEngine.CreateEPaM(rEditEngine.GetEditDoc().GetEndPaM() );
}
else
{
@@ -204,7 +201,7 @@ bool TextConvWrapper::ConvContinue_impl()
// get next convertible text portion and its language
m_aConvText.clear();
m_nConvTextLang = LANGUAGE_NONE;
- m_pEditView->GetImpEditEngine()->ImpConvert( m_aConvText, m_nConvTextLang,
+ m_pEditView->getImpEditEngine().ImpConvert( m_aConvText, m_nConvTextLang,
m_pEditView, GetSourceLanguage(), m_aConvSel,
m_bAllowChange, GetTargetLanguage(), GetTargetFont() );
return !m_aConvText.isEmpty();
@@ -341,15 +338,15 @@ void TextConvWrapper::ReplaceUnit(
m_nUnitOffset = m_nUnitOffset + nUnitStart + aNewTxt.getLength();
// remember current original language for later use
- ImpEditEngine *pImpEditEng = m_pEditView->GetImpEditEngine();
+ ImpEditEngine& rImpEditEngine = m_pEditView->getImpEditEngine();
ESelection aOldSel = m_pEditView->GetSelection();
//EditSelection aOldEditSel = pEditView->GetImpEditView()->GetEditSelection();
#ifdef DBG_UTIL
- LanguageType nOldLang = pImpEditEng->GetLanguage( pImpEditEng->CreateSel( aOldSel ).Min() ).nLang;
+ LanguageType nOldLang = rImpEditEngine.GetLanguage(rImpEditEngine.CreateSel( aOldSel ).Min() ).nLang;
#endif
- pImpEditEng->UndoActionStart( EDITUNDO_INSERT );
+ rImpEditEngine.UndoActionStart( EDITUNDO_INSERT );
// according to FT we should currently not bother about keeping
// attributes in Hangul/Hanja conversion and leave that untouched.
@@ -380,11 +377,10 @@ void TextConvWrapper::ReplaceUnit(
}
}
- pImpEditEng->UndoActionEnd();
+ rImpEditEngine.UndoActionEnd();
// adjust ConvContinue / ConvTo if necessary
- ImpEditEngine* pImpEE = m_pEditView->GetImpEditEngine();
- ConvInfo* pConvInfo = pImpEE->GetConvInfo();
+ ConvInfo* pConvInfo = rImpEditEngine.GetConvInfo();
sal_Int32 nDelta = aNewTxt.getLength() - aOrigTxt.getLength();
if (nDelta != 0)
{
diff --git a/editeng/source/misc/urlfieldhelper.cxx b/editeng/source/misc/urlfieldhelper.cxx
index 57f2a042c6b5..16303c064d50 100644
--- a/editeng/source/misc/urlfieldhelper.cxx
+++ b/editeng/source/misc/urlfieldhelper.cxx
@@ -21,7 +21,7 @@ void URLFieldHelper::RemoveURLField(EditView& pEditView)
if (auto pUrlField = dynamic_cast<const SvxURLField*>(pField))
{
ESelection aSel = pEditView.GetSelection();
- pEditView.GetEditEngine()->QuickInsertText(pUrlField->GetRepresentation(), aSel);
+ pEditView.getEditEngine().QuickInsertText(pUrlField->GetRepresentation(), aSel);
pEditView.Invalidate();
}
}
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 136ecd776c26..4fdf36470252 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -284,7 +284,7 @@ sal_Int32 OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTa
bool OutlinerView::MouseMove( const MouseEvent& rMEvt )
{
- if( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->GetEditEngine()->IsInSelectionMode())
+ if( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->getEditEngine().IsInSelectionMode())
return pEditView->MouseMove( rMEvt );
Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) );
@@ -299,7 +299,7 @@ bool OutlinerView::MouseMove( const MouseEvent& rMEvt )
bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
{
- if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->GetEditEngine()->IsInSelectionMode() )
+ if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->getEditEngine().IsInSelectionMode() )
return pEditView->MouseButtonDown( rMEvt );
Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) );
@@ -347,7 +347,7 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
bool OutlinerView::MouseButtonUp( const MouseEvent& rMEvt )
{
- if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->GetEditEngine()->IsInSelectionMode() )
+ if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->getEditEngine().IsInSelectionMode() )
return pEditView->MouseButtonUp( rMEvt );
Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) );
@@ -1380,13 +1380,13 @@ void OutlinerView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCal
void OutlinerView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs )
{
- sal_Int32 nOldParaCount = pEditView->GetEditEngine()->GetParagraphCount();
+ sal_Int32 nOldParaCount = pEditView->getEditEngine().GetParagraphCount();
ESelection aOldSel = pEditView->GetSelection();
aOldSel.Adjust();
pEditView->Read( rInput, eFormat, pHTTPHeaderAttrs );
- tools::Long nParaDiff = pEditView->GetEditEngine()->GetParagraphCount() - nOldParaCount;
+ tools::Long nParaDiff = pEditView->getEditEngine().GetParagraphCount() - nOldParaCount;
sal_Int32 nChangesStart = aOldSel.nStartPara;
sal_Int32 nChangesEnd = nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara);
@@ -1468,17 +1468,17 @@ bool GetStatusValueForThesaurusFromContext(
{
// get text and locale for thesaurus look up
OUString aText;
- EditEngine *pEditEngine = rEditView.GetEditEngine();
+ EditEngine& rEditEngine = rEditView.getEditEngine();
ESelection aTextSel( rEditView.GetSelection() );
if (!aTextSel.HasRange())
- aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD );
- aText = pEditEngine->GetText( aTextSel );
+ aTextSel = rEditEngine.GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD );
+ aText = rEditEngine.GetText( aTextSel );
aTextSel.Adjust();
- if (!isSingleScriptType(pEditEngine->GetScriptType(aTextSel)))
+ if (!isSingleScriptType(rEditEngine.GetScriptType(aTextSel)))
return false;
- LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos ).nLang;
+ LanguageType nLang = rEditEngine.GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos ).nLang;
OUString aLangText( LanguageTag::convertToBcp47( nLang ) );
// set word and locale to look up as status value
diff --git a/forms/source/richtext/specialdispatchers.cxx b/forms/source/richtext/specialdispatchers.cxx
index d75e06590fc2..d81eb74867cc 100644
--- a/forms/source/richtext/specialdispatchers.cxx
+++ b/forms/source/richtext/specialdispatchers.cxx
@@ -58,7 +58,7 @@ namespace frm
checkDisposed();
- EditEngine* pEngine = getEditView() ? getEditView()->GetEditEngine() : nullptr;
+ EditEngine* pEngine = getEditView() ? &getEditView()->getEditEngine() : nullptr;
OSL_ENSURE( pEngine, "OSelectAllDispatcher::dispatch: no edit engine - but not yet disposed?" );
if ( !pEngine )
return;
@@ -91,7 +91,7 @@ namespace frm
{
FeatureStateEvent aEvent( OAttributeDispatcher::buildStatusEvent() );
- EditEngine* pEngine = getEditView() ? getEditView()->GetEditEngine() : nullptr;
+ EditEngine* pEngine = getEditView() ? &getEditView()->getEditEngine() : nullptr;
OSL_ENSURE( pEngine, "OParagraphDirectionDispatcher::dispatch: no edit engine - but not yet disposed?" );
if ( pEngine && pEngine->IsEffectivelyVertical() )
aEvent.IsEnabled = false;
@@ -112,7 +112,7 @@ namespace frm
checkDisposed();
- EditEngine* pEngine = getEditView() ? getEditView()->GetEditEngine() : nullptr;
+ EditEngine* pEngine = getEditView() ? &getEditView()->getEditEngine() : nullptr;
OSL_ENSURE( pEngine, "OTextDirectionDispatcher::dispatch: no edit engine - but not yet disposed?" );
if ( !pEngine )
return;
@@ -125,7 +125,7 @@ namespace frm
{
FeatureStateEvent aEvent( ORichTextFeatureDispatcher::buildStatusEvent() );
- EditEngine* pEngine = getEditView() ? getEditView()->GetEditEngine() : nullptr;
+ EditEngine* pEngine = getEditView() ? &getEditView()->getEditEngine() : nullptr;
OSL_ENSURE( pEngine, "OTextDirectionDispatcher::dispatch: no edit engine - but not yet disposed?" );
aEvent.IsEnabled = true;
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index bf0b5bb34951..c49a46517fe3 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -159,6 +159,8 @@ public:
const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial,
SotClipboardFormatId format = SotClipboardFormatId::NONE);
+ EDITENG_DLLPRIVATE ImpEditEngine& getImpl();
+
private:
std::unique_ptr<ImpEditEngine> pImpEditEngine;
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 01a0e426c09a..09a0429fdd7e 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -159,13 +159,14 @@ class EDITENG_DLLPUBLIC EditView final
public:
typedef std::vector<VclPtr<vcl::Window>> OutWindowSet;
-public: // Needed for Undo
- ImpEditView* GetImpEditView() const { return pImpEditView.get(); }
- ImpEditEngine* GetImpEditEngine() const;
+ ImpEditView* GetImpEditView() const { return pImpEditView.get(); }
+ ImpEditEngine& getImpEditEngine() const;
+
+ void setEditEngine(EditEngine* pEditEngine);
+ EditEngine& getEditEngine() const;
private:
- std::unique_ptr<ImpEditView>
- pImpEditView;
+ std::unique_ptr<ImpEditView> pImpEditView;
OUString aDicNameSingle;
EditView( const EditView& ) = delete;
@@ -183,9 +184,6 @@ public:
void setEditViewCallbacks(EditViewCallbacks* pEditViewCallbacks);
EditViewCallbacks* getEditViewCallbacks() const;
- void SetEditEngine( EditEngine* pEditEngine );
- EditEngine* GetEditEngine() const;
-
void SetWindow( vcl::Window* pWin );
vcl::Window* GetWindow() const;
OutputDevice& GetOutputDevice() const;
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index c309f1b1fe66..e8010b387393 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1495,8 +1495,8 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
if (mpViewShell->GetViewData().GetEditActivePart() == meSplitPos)
{
ScViewData& rViewData = mpViewShell->GetViewData();
- const EditEngine* pEditEng = rViewData.GetEditView(meSplitPos)->GetEditEngine();
- if (pEditEng && pEditEng->IsUpdateLayout())
+ EditEngine const& rEditEng = rViewData.GetEditView(meSplitPos)->getEditEngine();
+ if (rEditEng.IsUpdateLayout())
{
mpTempAccEdit = new ScAccessibleEditObject(this, rViewData.GetEditView(meSplitPos),
mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
index 7e58af04ef66..3b1eaf532d7a 100644
--- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx
+++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
@@ -191,9 +191,9 @@ AbsoluteScreenPixelRectangle ScAccessibleEditObject::GetBoundingBoxOnScreen() co
{
if ( meObjectType == CellInEditMode )
{
- if ( mpEditView && mpEditView->GetEditEngine() )
+ if (mpEditView)
{
- MapMode aMapMode( mpEditView->GetEditEngine()->GetRefMapMode() );
+ MapMode aMapMode(mpEditView->getEditEngine().GetRefMapMode());
tools::Rectangle aScreenBoundsLog = mpWindow->LogicToPixel( mpEditView->GetOutputArea(), aMapMode );
Point aCellLoc = aScreenBoundsLog.TopLeft();
AbsoluteScreenPixelRectangle aWindowRect = mpWindow->GetWindowExtentsAbsolute();
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 52d5257af8cc..413cf831467b 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -658,10 +658,9 @@ ScDocShell* ScAccessibleCellTextData::GetDocShell(ScTabViewShell* pViewShell)
}
ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, OutputDevice* pWin, bool isClone)
- :
- mpEditView(pEditView),
- mpEditEngine(pEditView ? pEditView->GetEditEngine() : nullptr),
- mpWindow(pWin)
+ : mpEditView(pEditView)
+ , mpEditEngine(pEditView ? &pEditView->getEditEngine() : nullptr)
+ , mpWindow(pWin)
{
// If the object is cloned, do NOT add notify hdl.
mbIsCloned = isClone;
@@ -706,7 +705,7 @@ SvxTextForwarder* ScAccessibleEditObjectTextData::GetTextForwarder()
if ((!mpForwarder && mpEditView) || (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()))
{
if (!mpEditEngine)
- mpEditEngine = mpEditView->GetEditEngine();
+ mpEditEngine = &mpEditView->getEditEngine();
// If the object is cloned, do NOT add notify hdl.
if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()&&!mbIsCloned)
mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) );
@@ -769,12 +768,12 @@ ScAccessibleEditLineTextData::~ScAccessibleEditLineTextData()
delete mpEditEngine;
mpEditEngine = nullptr; // don't access in ScAccessibleEditObjectTextData dtor!
}
- else if (mpTxtWnd && mpTxtWnd->HasEditView() && mpTxtWnd->GetEditView()->GetEditEngine())
+ else if (mpTxtWnd && mpTxtWnd->HasEditView())
{
// the NotifyHdl also has to be removed from the ScTextWnd's EditEngine
// (it's set in ScAccessibleEditLineTextData::GetTextForwarder, and mpEditEngine
// is reset there)
- mpTxtWnd->GetEditView()->GetEditEngine()->SetNotifyHdl(Link<EENotify&,void>());
+ mpTxtWnd->GetEditView()->getEditEngine().SetNotifyHdl(Link<EENotify&,void>());
}
}
@@ -868,8 +867,8 @@ void ScAccessibleEditLineTextData::ResetEditMode()
{
if (mbEditEngineCreated && mpEditEngine)
delete mpEditEngine;
- else if (mpTxtWnd && mpTxtWnd->HasEditView() && mpTxtWnd->GetEditView()->GetEditEngine())
- mpTxtWnd->GetEditView()->GetEditEngine()->SetNotifyHdl(Link<EENotify&,void>());
+ else if (mpTxtWnd && mpTxtWnd->HasEditView())
+ mpTxtWnd->GetEditView()->getEditEngine().SetNotifyHdl(Link<EENotify&,void>());
mpEditEngine = nullptr;
mpForwarder.reset();
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index bec8a2cbe6da..af4e01fec9ec 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -635,15 +635,15 @@ static void lcl_Replace( EditView* pView, const OUString& rNewStr, const ESelect
pView->SetSelection( ESelection( aOldSel.nEndPara, aOldSel.nEndPos,
aOldSel.nEndPara, aOldSel.nEndPos ) );
- EditEngine* pEngine = pView->GetEditEngine();
- pEngine->QuickInsertText( rNewStr, rOldSel );
+ EditEngine& rEngine = pView->getEditEngine();
+ rEngine.QuickInsertText( rNewStr, rOldSel );
// Dummy InsertText for Update and Paint
// To do that we need to cancel the selection from above (before QuickInsertText)
pView->InsertText( OUString() );
- const sal_Int32 nPara = pEngine->GetParagraphCount() - 1;
- const sal_Int32 nLen = pEngine->GetTextLen(nPara);
+ const sal_Int32 nPara = rEngine.GetParagraphCount() - 1;
+ const sal_Int32 nLen = rEngine.GetTextLen(nPara);
ESelection aSel( nPara, nLen, nPara, nLen );
pView->SetSelection( aSel ); // Set cursor to the end
}
@@ -1640,7 +1640,7 @@ void completeFunction( EditView* pView, const OUString& rInsert, bool& rParInser
ESelection aSel = pView->GetSelection();
bool bNoInitialLetter = false;
- OUString aOld = pView->GetEditEngine()->GetText(0);
+ OUString aOld = pView->getEditEngine().GetText(0);
// in case we want just insert a function and not completing
if ( comphelper::LibreOfficeKit::isActive() )
{
@@ -1775,10 +1775,9 @@ void ScInputHandler::LOKPasteFunctionData(const OUString& rFunctionName)
bool bEdit = false;
OUString aFormula;
- const EditEngine* pEditEngine = pEditView->GetEditEngine();
- if (pEditEngine)
+ EditEngine const& rEditEngine = pEditView->getEditEngine();
{
- aFormula = pEditEngine->GetText(0);
+ aFormula = rEditEngine.GetText(0);
/* TODO: LOK: are you sure you want '+' and '-' let start formulas with
* function names? That was meant for "data typist" numeric keyboard
* input. */
@@ -2661,22 +2660,22 @@ static void lcl_SetTopSelection( EditView* pEditView, ESelection& rSel )
{
OSL_ENSURE( rSel.nStartPara==0 && rSel.nEndPara==0, "SetTopSelection: Para != 0" );
- EditEngine* pEngine = pEditView->GetEditEngine();
- sal_Int32 nCount = pEngine->GetParagraphCount();
+ EditEngine& rEngine = pEditView->getEditEngine();
+ sal_Int32 nCount = rEngine.GetParagraphCount();
if (nCount > 1)
{
- sal_Int32 nParLen = pEngine->GetTextLen(rSel.nStartPara);
+ sal_Int32 nParLen = rEngine.GetTextLen(rSel.nStartPara);
while (rSel.nStartPos > nParLen && rSel.nStartPara+1 < nCount)
{
rSel.nStartPos -= nParLen + 1; // Including space from line break
- nParLen = pEngine->GetTextLen(++rSel.nStartPara);
+ nParLen = rEngine.GetTextLen(++rSel.nStartPara);
}
- nParLen = pEngine->GetTextLen(rSel.nEndPara);
+ nParLen = rEngine.GetTextLen(rSel.nEndPara);
while (rSel.nEndPos > nParLen && rSel.nEndPara+1 < nCount)
{
rSel.nEndPos -= nParLen + 1; // Including space from line break
- nParLen = pEngine->GetTextLen(++rSel.nEndPara);
+ nParLen = rEngine.GetTextLen(++rSel.nEndPara);
}
}
@@ -2753,7 +2752,7 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified )
{
// table EditEngine is formatted below, input line needs formatting after paste
// #i20282# not when called from the input line's modify handler
- pTopView->GetEditEngine()->QuickFormatDoc( true );
+ pTopView->getEditEngine().QuickFormatDoc( true );
// #i23720# QuickFormatDoc hides the cursor, but can't show it again because it
// can't safely access the EditEngine's current view, so the cursor has to be
@@ -3085,11 +3084,11 @@ static void lcl_SelectionToEnd( EditView* pView )
{
if ( pView )
{
- EditEngine* pEngine = pView->GetEditEngine();
- sal_Int32 nParCnt = pEngine->GetParagraphCount();
+ EditEngine& rEngine = pView->getEditEngine();
+ sal_Int32 nParCnt = rEngine.GetParagraphCount();
if ( nParCnt == 0 )
nParCnt = 1;
- ESelection aSel( nParCnt-1, pEngine->GetTextLen(nParCnt-1) ); // empty selection, cursor at the end
+ ESelection aSel( nParCnt-1, rEngine.GetTextLen(nParCnt-1) ); // empty selection, cursor at the end
pView->SetSelection( aSel );
}
}
@@ -3762,12 +3761,12 @@ void ScInputHandler::ClearText()
if (pTableView)
{
- pTableView->GetEditEngine()->SetText( "" );
+ pTableView->getEditEngine().SetText( "" );
pTableView->SetSelection( ESelection(0,0, 0,0) );
}
if (pTopView)
{
- pTopView->GetEditEngine()->SetText( "" );
+ pTopView->getEditEngine().SetText( "" );
pTopView->SetSelection( ESelection(0,0, 0,0) );
}
@@ -3957,7 +3956,7 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false
if (pTableView)
{
- pTableView->GetEditEngine()->SetText( aStrLoP );
+ pTableView->getEditEngine().SetText( aStrLoP );
if ( !aStrLoP.isEmpty() )
pTableView->SetSelection( ESelection(0,0, 0,0) ); // before the '%'
@@ -3966,7 +3965,7 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false
}
if (pTopView)
{
- pTopView->GetEditEngine()->SetText( aStrLoP );
+ pTopView->getEditEngine().SetText( aStrLoP );
if ( !aStrLoP.isEmpty() )
pTopView->SetSelection( ESelection(0,0, 0,0) ); // before the '%'
}
@@ -4181,12 +4180,12 @@ void ScInputHandler::InputCommand( const CommandEvent& rCEvt )
{
if (pTableView)
{
- pTableView->GetEditEngine()->SetText( "" );
+ pTableView->getEditEngine().SetText( "" );
pTableView->SetSelection( ESelection(0,0, 0,0) );
}
if (pTopView)
{
- pTopView->GetEditEngine()->SetText( "" );
+ pTopView->getEditEngine().SetText( "" );
pTopView->SetSelection( ESelection(0,0, 0,0) );
}
}
@@ -4524,7 +4523,7 @@ void ScInputHandler::InputChanged( const EditView* pView, bool bFromNotify )
bool bFromTopNotify = ( bFromNotify && pView == pTopView );
bool bNewView = DataChanging(); //FIXME: Is this at all possible?
- aCurrentText = pView->GetEditEngine()->GetText(); // Also remember the string
+ aCurrentText = pView->getEditEngine().GetText(); // Also remember the string
mpEditEngine->SetTextCurrentDefaults( aCurrentText );
DataChanged( bFromTopNotify );
bTextValid = true; // Is set to false in DataChanged
@@ -4625,7 +4624,7 @@ EditView* ScInputHandler::GetFuncEditView()
SetMode( SC_INPUT_TABLE );
bCreatingFuncView = false;
if ( pTableView )
- pTableView->GetEditEngine()->SetText( OUString() );
+ pTableView->getEditEngine().SetText( OUString() );
}
pView = pTableView;
}
@@ -4677,7 +4676,7 @@ void ScInputHandler::InputReplaceSelection( std::u16string_view aStr )
if (pView)
{
pView->SetEditEngineUpdateLayout( false );
- pView->GetEditEngine()->SetText( aFormText );
+ pView->getEditEngine().SetText( aFormText );
pView->SetSelection( ESelection(0,nFormSelStart, 0,nFormSelEnd) );
pView->SetEditEngineUpdateLayout( true );
}
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 7f0cf742b05d..3aa9a36c5af0 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -428,9 +428,9 @@ void ScInputWindow::StartFormula()
TextGrabFocus();
if (pViewSh && !pViewSh->isLOKDesktop())
{
- nStartPara = nEndPara = pView->GetEditEngine()->GetParagraphCount() ?
- (pView->GetEditEngine()->GetParagraphCount() - 1) : 0;
- nStartPos = nEndPos = pView->GetEditEngine()->GetTextLen(nStartPara);
+ nStartPara = nEndPara = pView->getEditEngine().GetParagraphCount() ?
+ (pView->getEditEngine().GetParagraphCount() - 1) : 0;
+ nStartPos = nEndPos = pView->getEditEngine().GetTextLen(nStartPara);
}
}
pView->SetSelection(ESelection(nStartPara, nStartPos, nEndPara, nEndPos));
@@ -675,8 +675,8 @@ void ScInputWindow::SwitchToTextWin()
EditView* pView = mxTextWindow->GetEditView();
if (pView)
{
- sal_Int32 nPara = pView->GetEditEngine()->GetParagraphCount() ? ( pView->GetEditEngine()->GetParagraphCount() - 1 ) : 0;
- sal_Int32 nLen = pView->GetEditEngine()->GetTextLen( nPara );
+ sal_Int32 nPara = pView->getEditEngine().GetParagraphCount() ? ( pView->getEditEngine().GetParagraphCount() - 1 ) : 0;
+ sal_Int32 nLen = pView->getEditEngine().GetTextLen( nPara );
ESelection aSel( nPara, nLen, nPara, nLen );
pView->SetSelection( aSel ); // set cursor to end of text
}
@@ -1406,7 +1406,7 @@ void ScTextWnd::Resize()
int ScTextWnd::GetEditEngTxtHeight() const
{
- return m_xEditView ? m_xEditView->GetEditEngine()->GetTextHeight() : 0;
+ return m_xEditView ? m_xEditView->getEditEngine().GetTextHeight() : 0;
}
void ScTextWnd::SetScrollBarRange()
@@ -1524,7 +1524,7 @@ static void lcl_ModifyRTLDefaults( SfxItemSet& rSet )
static void lcl_ModifyRTLVisArea( EditView* pEditView )
{
tools::Rectangle aVisArea = pEditView->GetVisArea();
- Size aPaper = pEditView->GetEditEngine()->GetPaperSize();
+ Size aPaper = pEditView->getEditEngine().GetPaperSize();
tools::Long nDiff = aPaper.Width() - aVisArea.Right();
aVisArea.AdjustLeft(nDiff );
aVisArea.AdjustRight(nDiff );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index bfe14b6aa138..e6fa6417dacb 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1331,7 +1331,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
const LanguageType nLangToUse = SvtLanguageTable::GetLanguageType( aLangText );
SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
- SfxItemSet aAttrs = pEditView->GetEditEngine()->GetEmptyItemSet();
+ SfxItemSet aAttrs = pEditView->getEditEngine().GetEmptyItemSet();
if (nScriptType == SvtScriptType::LATIN)
aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE ) );
if (nScriptType == SvtScriptType::COMPLEX)
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index b7bd2daa4450..7032a1094dad 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -300,7 +300,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
EditView* pTableView = pHdl->GetActiveView();
pHdl->DataChanging();
if (pTableView)
- pTableView->GetEditEngine()->SetText(aStr);
+ pTableView->getEditEngine().SetText(aStr);
pHdl->DataChanged();
SC_MOD()->SetInputMode(SC_INPUT_NONE);
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index c392f111e203..f9e3fededd5a 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -100,8 +100,8 @@ ScEditShell::ScEditShell(EditView* pView, ScViewData& rData) :
bPastePossible (false),
bIsInsertMode (true)
{
- SetPool( pEditView->GetEditEngine()->GetEmptyItemSet().GetPool() );
- SetUndoManager( &pEditView->GetEditEngine()->GetUndoManager() );
+ SetPool( pEditView->getEditEngine().GetEmptyItemSet().GetPool() );
+ SetUndoManager( &pEditView->getEditEngine().GetUndoManager() );
SetName("EditCell");
SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::EditCell));
}
@@ -127,13 +127,13 @@ void ScEditShell::SetEditView(EditView* pView)
{
pEditView = pView;
pEditView->SetInsertMode( bIsInsertMode );
- SetPool( pEditView->GetEditEngine()->GetEmptyItemSet().GetPool() );
- SetUndoManager( &pEditView->GetEditEngine()->GetUndoManager() );
+ SetPool( pEditView->getEditEngine().GetEmptyItemSet().GetPool() );
+ SetUndoManager( &pEditView->getEditEngine().GetUndoManager() );
}
static void lcl_RemoveAttribs( EditView& rEditView )
{
- ScEditEngineDefaulter* pEngine = static_cast<ScEditEngineDefaulter*>(rEditView.GetEditEngine());
+ ScEditEngineDefaulter* pEngine = static_cast<ScEditEngineDefaulter*>(&rEditView.getEditEngine());
bool bOld = pEngine->SetUpdateLayout(false);
@@ -182,7 +182,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
if (!pTableView)
return;
- EditEngine* pEngine = pTableView->GetEditEngine();
+ EditEngine& rEngine = pTableView->getEditEngine();
pHdl->DataChanging();
bool bSetSelIsRef = false;
@@ -320,10 +320,10 @@ void ScEditShell::Execute( SfxRequest& rReq )
case SID_SELECTALL:
{
- sal_Int32 nPar = pEngine->GetParagraphCount();
+ sal_Int32 nPar = rEngine.GetParagraphCount();
if (nPar)
{
- sal_Int32 nLen = pEngine->GetTextLen(nPar-1);
+ sal_Int32 nLen = rEngine.GetTextLen(nPar-1);
pTableView->SetSelection(ESelection(0,0,nPar-1,nLen));
if (pTopView)
pTopView->SetSelection(ESelection(0,0,nPar-1,nLen));
@@ -346,7 +346,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
EditView* pActiveView = pHdl->GetActiveView();
if( pActiveView )
{
- OUString sInput = pEngine->GetText();
+ OUString sInput = rEngine.GetText();
ESelection aSel( pActiveView->GetSelection() );
if( aSel.HasRange() )
sInput = pActiveView->GetSelected();
@@ -447,7 +447,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
aSet.Put( aSetItem.GetItemSet(), false );
// SetAttribs on the View selects a word, when nothing is selected
- pTableView->GetEditEngine()->QuickSetAttribs( aSet, pTableView->GetSelection() );
+ pTableView->getEditEngine().QuickSetAttribs( aSet, pTableView->GetSelection() );
pTableView->InsertText(aString);
if (pTopView)
pTopView->InsertText(aString);
@@ -533,9 +533,9 @@ void ScEditShell::Execute( SfxRequest& rReq )
case SID_TOGGLE_REL:
{
/* TODO: MLFORMULA: this should work also with multi-line formulas. */
- if (pEngine->GetParagraphCount() == 1)
+ if (rEngine.GetParagraphCount() == 1)
{
- OUString aText = pEngine->GetText();
+ OUString aText = rEngine.GetText();
ESelection aSel = pEditView->GetSelection(); // current View
ScDocument& rDoc = rViewData.GetDocument();
@@ -545,11 +545,11 @@ void ScEditShell::Execute( SfxRequest& rReq )
{
const OUString& aNew = aFinder.GetText();
ESelection aNewSel( 0,aFinder.GetSelStart(), 0,aFinder.GetSelEnd() );
- pEngine->SetText( aNew );
+ rEngine.SetText( aNew );
pTableView->SetSelection( aNewSel );
if ( pTopView )
{
- pTopView->GetEditEngine()->SetText( aNew );
+ pTopView->getEditEngine().SetText( aNew );
pTopView->SetSelection( aNewSel );
}
@@ -620,10 +620,10 @@ void ScEditShell::Execute( SfxRequest& rReq )
{
if (bCellLinksOnly)
{
- sal_Int32 nPar = pEngine->GetParagraphCount();
+ sal_Int32 nPar = rEngine.GetParagraphCount();
if (nPar)
{
- sal_Int32 nLen = pEngine->GetTextLen(nPar - 1);
+ sal_Int32 nLen = rEngine.GetTextLen(nPar - 1);
pTableView->SetSelection(ESelection(0, 0, nPar - 1, nLen));
if (pTopView)
pTopView->SetSelection(ESelection(0, 0, nPar - 1, nLen));
@@ -900,18 +900,18 @@ std::unique_ptr<const SvxFieldData> ScEditShell::GetURLField()
std::unique_ptr<const SvxFieldData> ScEditShell::GetFirstURLFieldFromCell()
{
- EditEngine* pEE = GetEditView()->GetEditEngine();
- sal_Int32 nParaCount = pEE->GetParagraphCount();
+ EditEngine& rEditEngine = GetEditView()->getEditEngine();
+ sal_Int32 nParaCount = rEditEngine.GetParagraphCount();
for (sal_Int32 nPara = 0; nPara < nParaCount; ++nPara)
{
ESelection aSel(nPara, 0);
std::vector<sal_Int32> aPosList;
- pEE->GetPortions(nPara, aPosList);
+ rEditEngine.GetPortions(nPara, aPosList);
for (const auto& rPos : aPosList)
{
aSel.nEndPos = rPos;
- SfxItemSet aEditSet(pEE->GetAttribs(aSel));
+ SfxItemSet aEditSet(rEditEngine.GetAttribs(aSel));
if (aSel.nStartPos + 1 == aSel.nEndPos)
{
// test if the character is a text field
@@ -1211,12 +1211,12 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq)
// apply
- EditEngine* pEngine = pEditView->GetEditEngine();
- bool bOld = pEngine->SetUpdateLayout(false);
+ EditEngine& rEngine = pEditView->getEditEngine();
+ bool bOld = rEngine.SetUpdateLayout(false);
pEditView->SetAttribs( aSet );
- pEngine->SetUpdateLayout(bOld);
+ rEngine.SetUpdateLayout(bOld);
pEditView->Invalidate();
ScInputHandler* pHdl = GetMyInputHdl();
@@ -1305,13 +1305,13 @@ OUString ScEditShell::GetSelectionText( bool bWholeWord )
{
if ( bWholeWord )
{
- EditEngine* pEngine = pEditView->GetEditEngine();
+ EditEngine& rEngine = pEditView->getEditEngine();
ESelection aSel = pEditView->GetSelection();
- OUString aStrCurrentDelimiters = pEngine->GetWordDelimiters();
+ OUString aStrCurrentDelimiters = rEngine.GetWordDelimiters();
- pEngine->SetWordDelimiters(" .,;\"'");
- aStrSelection = pEngine->GetWord( aSel.nEndPara, aSel.nEndPos );
- pEngine->SetWordDelimiters( aStrCurrentDelimiters );
+ rEngine.SetWordDelimiters(" .,;\"'");
+ aStrSelection = rEngine.GetWord( aSel.nEndPara, aSel.nEndPos );
+ rEngine.SetWordDelimiters( aStrCurrentDelimiters );
}
else
{
@@ -1394,7 +1394,7 @@ void ScEditShell::GetUndoState(SfxItemSet &rSet)
EditView* pTopView = pHdl->GetTopView();
if (pTopView)
{
- SfxUndoManager& rTopMgr = pTopView->GetEditEngine()->GetUndoManager();
+ SfxUndoManager& rTopMgr = pTopView->getEditEngine().GetUndoManager();
if ( rTopMgr.GetUndoActionCount() == 0 )
rSet.DisableItem( SID_UNDO );
if ( rTopMgr.GetRedoActionCount() == 0 )
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 3ae1a37f5066..c83d18e57787 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2852,7 +2852,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt )
bool bAlt = rMEvt.IsMod2();
if ( !bAlt && !nButtonDown && ScGlobal::ShouldOpenURL() && pFld )
SetPointer( PointerStyle::RefHand );
- else if ( pEditView->GetEditEngine()->IsEffectivelyVertical() )
+ else if (pEditView->getEditEngine().IsEffectivelyVertical())
SetPointer( PointerStyle::TextVertical );
else
SetPointer( PointerStyle::Text );
@@ -3401,7 +3401,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
}
// if edit mode was just started above, online spelling may be incomplete
- pEditView->GetEditEngine()->CompleteOnlineSpelling();
+ pEditView->getEditEngine().CompleteOnlineSpelling();
// IsCursorAtWrongSpelledWord could be used for !bMouse
// if there was a corresponding ExecuteSpellPopup call
@@ -3500,12 +3500,12 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S
// handle selection within the EditView
EditView* pEditView = mrViewData.GetEditView( eWhich ); // not NULL (HasEditView)
- EditEngine* pEditEngine = pEditView->GetEditEngine();
+ EditEngine& rEditEngine = pEditView->getEditEngine();
tools::Rectangle aOutputArea = pEditView->GetOutputArea();
tools::Rectangle aVisArea = pEditView->GetVisArea();
Point aTextPos = PixelToLogic( rPosPixel );
- if ( pEditEngine->IsEffectivelyVertical() ) // have to manually transform position
+ if (rEditEngine.IsEffectivelyVertical()) // have to manually transform position
{
aTextPos -= aOutputArea.TopRight();
tools::Long nTemp = -aTextPos.X();
@@ -3516,7 +3516,7 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S
aTextPos -= aOutputArea.TopLeft();
aTextPos += aVisArea.TopLeft(); // position in the edit document
- EPosition aDocPosition = pEditEngine->FindDocPosition(aTextPos);
+ EPosition aDocPosition = rEditEngine.FindDocPosition(aTextPos);
ESelection aCompare(aDocPosition.nPara, aDocPosition.nIndex);
ESelection aSelection = pEditView->GetSelection();
aSelection.Adjust(); // needed for IsLess/IsGreater
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index fe8aab80693b..344d99b26cef 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -656,15 +656,15 @@ private:
namespace
{
-int lcl_GetMultiLineHeight(EditEngine* pEditEngine)
+int lcl_GetMultiLineHeight(EditEngine& rEditEngine)
{
int nHeight = 0;
- int nParagraphs = pEditEngine->GetParagraphCount();
- if (nParagraphs > 1 || (nParagraphs > 0 && pEditEngine->GetLineCount(0) > 1))
+ int nParagraphs = rEditEngine.GetParagraphCount();
+ if (nParagraphs > 1 || (nParagraphs > 0 && rEditEngine.GetLineCount(0) > 1))
{
for (int nPara = 0; nPara < nParagraphs; nPara++)
{
- nHeight += pEditEngine->GetLineCount(nPara) * pEditEngine->GetLineHeight(nPara);
+ nHeight += rEditEngine.GetLineCount(nPara) * rEditEngine.GetLineHeight(nPara);
}
}
@@ -1147,9 +1147,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
if (bIsTiledRendering)
{
- EditEngine* pEditEngine = pOtherEditView->GetEditEngine();
- if (pEditEngine)
- aEnd.AdjustY(lcl_GetMultiLineHeight(pEditEngine));
+ EditEngine& rEditEngine = pOtherEditView->getEditEngine();
+ aEnd.AdjustY(lcl_GetMultiLineHeight(rEditEngine));
}
if (bLokRTL)
diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx
index da1e90698b38..015f1bf5c7e2 100644
--- a/sc/source/ui/view/spelldialog.cxx
+++ b/sc/source/ui/view/spelldialog.cxx
@@ -269,7 +269,7 @@ bool ScSpellDialogChildWindow::IsSelectionChanged()
return true;
if( EditView* pEditView = mpViewData->GetSpellingView() )
- if( pEditView->GetEditEngine() != mxEngine.get() )
+ if (&pEditView->getEditEngine() != mxEngine.get())
return true;
ScRangeList aCurrentRangeList;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 444b78b20b64..aad1c8283858 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -125,7 +125,6 @@ void ScExtraEditViewManager::Apply(SfxViewShell* pViewShell, ScSplitPos eWhich)
mpOtherEditView = pOtherViewShell->GetViewData().GetEditView(eWhich);
if (mpOtherEditView != nullptr)
{
- DBG_ASSERT(mpOtherEditView->GetEditEngine(), "Edit view has no valid engine.");
for (int i = 0; i < 4; ++i)
{
ScGridWindow* pWin = mpGridWin[i].get();
@@ -2219,7 +2218,7 @@ void ScTabView::UpdateEditView()
tools::Long nY = GetViewData().GetCurYForTab(nRefTabNo);
aViewData.SetEditEngine(eCurrent,
- static_cast<ScEditEngineDefaulter*>(pEditView->GetEditEngine()),
+ static_cast<ScEditEngineDefaulter*>(&pEditView->getEditEngine()),
pGridWin[i], nX, nY );
if (eCurrent == eActive)
pEditView->ShowCursor( false );
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index e09fdcd62a92..4ce7acd94391 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1543,7 +1543,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
else
{
lcl_LOKRemoveWindow(GetViewShell(), eWhich);
- pEditView[eWhich]->SetEditEngine(pNewEngine);
+ pEditView[eWhich]->setEditEngine(pNewEngine);
}
if (pEditView[eWhich]->GetWindow() != pWin)
@@ -1555,7 +1555,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
}
else
{
- pEditView[eWhich].reset(new EditView( pNewEngine, pWin ));
+ pEditView[eWhich].reset(new EditView(pNewEngine, pWin));
if (bLOKActive)
{
@@ -1873,8 +1873,7 @@ void ScViewData::EditGrowX()
bool bLayoutRTL = rLocalDoc.IsLayoutRTL( nTabNo );
- ScEditEngineDefaulter* pEngine =
- static_cast<ScEditEngineDefaulter*>( pCurView->GetEditEngine() );
+ ScEditEngineDefaulter* pEngine = static_cast<ScEditEngineDefaulter*>(&pCurView->getEditEngine());
vcl::Window* pWin = pCurView->GetWindow();
// Get the left- and right-most column positions.
@@ -2166,38 +2165,38 @@ void ScViewData::EditGrowY( bool bInitial )
return;
}
- EditEngine* pEngine = pCurView->GetEditEngine();
+ EditEngine& rEngine = pCurView->getEditEngine();
vcl::Window* pWin = pCurView->GetWindow();
SCROW nBottom = GetPosY(eVWhich) + VisibleCellsY(eVWhich);
- Size aSize = pEngine->GetPaperSize();
+ Size aSize = rEngine.GetPaperSize();
Size aSizePTwips;
tools::Rectangle aArea = pCurView->GetOutputArea();
tools::Rectangle aAreaPTwips;
if (bLOKPrintTwips)
{
- aSizePTwips = pEngine->GetLOKSpecialPaperSize();
+ aSizePTwips = rEngine.GetLOKSpecialPaperSize();
aAreaPTwips = pCurView->GetLOKSpecialOutputArea();
}
- tools::Long nOldBottom = aArea.Bottom();
- tools::Long nTextHeight = pEngine->GetTextHeight();
+ tools::Long nOldBottom = aArea.Bottom();
+ tools::Long nTextHeight = rEngine.GetTextHeight();
// When editing a formula in a cell with optimal height, allow a larger portion
// to be clipped before extending to following rows, to avoid obscuring cells for
// reference input (next row is likely to be useful in formulas).
tools::Long nAllowedExtra = SC_GROWY_SMALL_EXTRA;
if (nEditEndRow == nEditRow && !(mrDoc.GetRowFlags(nEditRow, nTabNo) & CRFlags::ManualSize) &&
- pEngine->GetParagraphCount() <= 1 )
+ rEngine.GetParagraphCount() <= 1 )
{
// If the (only) paragraph starts with a '=', it's a formula.
// If this is the initial call and the text is empty, allow the larger value, too,
// because this occurs in the normal progress of editing a formula.
// Subsequent calls with empty text might involve changed attributes (including
// font height), so they are treated like normal text.
- OUString aText = pEngine->GetText( 0 );
+ OUString aText = rEngine.GetText( 0 );
if ( ( aText.isEmpty() && bInitial ) || aText.startsWith("=") )
nAllowedExtra = SC_GROWY_BIG_EXTRA;
}
@@ -2251,17 +2250,19 @@ void ScViewData::ResetEditView()
{
EditEngine* pEngine = nullptr;
for (sal_uInt16 i=0; i<4; i++)
+ {
if (pEditView[i])
{
if (bEditActive[i])
{
lcl_LOKRemoveWindow(GetViewShell(), static_cast<ScSplitPos>(i));
- pEngine = pEditView[i]->GetEditEngine();
+ pEngine = &pEditView[i]->getEditEngine();
pEngine->RemoveView(pEditView[i].get());
pEditView[i]->SetOutputArea( tools::Rectangle() );
}
bEditActive[i] = false;
}
+ }
if (pEngine)
pEngine->SetStatusEventHdl( Link<EditStatus&,void>() );
@@ -2269,15 +2270,13 @@ void ScViewData::ResetEditView()
void ScViewData::KillEditView()
{
- EditEngine* pEngine = nullptr;
for (sal_uInt16 i=0; i<4; i++)
if (pEditView[i])
{
if (bEditActive[i])
{
- pEngine = pEditView[i]->GetEditEngine();
- if (pEngine)
- pEngine->RemoveView(pEditView[i].get());
+ EditEngine& rEngine = pEditView[i]->getEditEngine();
+ rEngine.RemoveView(pEditView[i].get());
}
pEditView[i].reset();
}
diff --git a/sd/qa/unit/TextFittingTest.cxx b/sd/qa/unit/TextFittingTest.cxx
index 069825a8e620..998a33dba8c9 100644
--- a/sd/qa/unit/TextFittingTest.cxx
+++ b/sd/qa/unit/TextFittingTest.cxx
@@ -64,50 +64,49 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest)
auto* pOLV = pView1->GetTextEditOutlinerView();
CPPUNIT_ASSERT(pOLV);
auto& rEditView = pOLV->GetEditView();
- auto* pEditEngine = rEditView.GetEditEngine();
- CPPUNIT_ASSERT(pEditEngine);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pEditEngine->GetParagraphCount());
+ auto& rEditEngine = rEditView.getEditEngine();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rEditEngine.GetParagraphCount());
// Add paragraph 4
rEditView.SetSelection(ESelection(3, 0, 3, 0));
rEditView.InsertText(u"\nD4"_ustr);
Scheduler::ProcessEventsToIdle();
- CPPUNIT_ASSERT_EQUAL(sal_Int32(4), pEditEngine->GetParagraphCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), rEditEngine.GetParagraphCount());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(87.49, pEditEngine->getGlobalFontScale().getY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(90.0, pEditEngine->getGlobalSpacingScale().getY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(87.49, rEditEngine.getGlobalFontScale().getY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(90.0, rEditEngine.getGlobalSpacingScale().getY(), 1E-2);
// Add paragraph 5
rEditView.SetSelection(ESelection(4, 0, 4, 0));
rEditView.InsertText(u"\nD5"_ustr);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(5), pEditEngine->GetParagraphCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), rEditEngine.GetParagraphCount());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(54.68, pEditEngine->getGlobalFontScale().getY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pEditEngine->getGlobalSpacingScale().getY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(54.68, rEditEngine.getGlobalFontScale().getY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, rEditEngine.getGlobalSpacingScale().getY(), 1E-2);
// Add paragraph 6
rEditView.SetSelection(ESelection(5, 0, 5, 0));
rEditView.InsertText(u"\nD6"_ustr);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(6), pEditEngine->GetParagraphCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(6), rEditEngine.GetParagraphCount());
// Delete paragraph 6
rEditView.SetSelection(ESelection(4, EE_TEXTPOS_MAX_COUNT, 5, EE_TEXTPOS_MAX_COUNT));
rEditView.DeleteSelected();
- CPPUNIT_ASSERT_EQUAL(sal_Int32(5), pEditEngine->GetParagraphCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), rEditEngine.GetParagraphCount());
// Delete paragraph 5
rEditView.SetSelection(ESelection(3, EE_TEXTPOS_MAX_COUNT, 4, EE_TEXTPOS_MAX_COUNT));
rEditView.DeleteSelected();
- CPPUNIT_ASSERT_EQUAL(sal_Int32(4), pEditEngine->GetParagraphCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), rEditEngine.GetParagraphCount());
// Delete paragraph 4
rEditView.SetSelection(ESelection(2, EE_TEXTPOS_MAX_COUNT, 3, EE_TEXTPOS_MAX_COUNT));
rEditView.DeleteSelected();
- CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pEditEngine->GetParagraphCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rEditEngine.GetParagraphCount());
// not ideal - scaling should be 100%, but close enough
- CPPUNIT_ASSERT_DOUBLES_EQUAL(99.05, pEditEngine->getGlobalFontScale().getY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pEditEngine->getGlobalSpacingScale().getY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(99.05, rEditEngine.getGlobalFontScale().getY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, rEditEngine.getGlobalSpacingScale().getY(), 1E-2);
// are we still in text edit mode?
CPPUNIT_ASSERT_EQUAL(true, pView1->IsTextEdit());
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 99a58a085376..fffaf70ee863 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -167,7 +167,7 @@ EditEngine* AnnotationTextWindow::GetEditEngine() const
OutlinerView* pOutlinerView = mrContents.GetOutlinerView();
if (!pOutlinerView)
return nullptr;
- return pOutlinerView->GetEditView().GetEditEngine();
+ return &pOutlinerView->GetEditView().getEditEngine();
}
void AnnotationTextWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx
index f310ddcfc676..1e3ab4512792 100644
--- a/sd/source/ui/docshell/docshel3.cxx
+++ b/sd/source/ui/docshell/docshel3.cxx
@@ -335,7 +335,7 @@ void DrawDocShell::Execute( SfxRequest& rReq )
const LanguageType nLangToUse = SvtLanguageTable::GetLanguageType( aNewLangTxt );
SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
- SfxItemSet aAttrs = rEditView.GetEditEngine()->GetEmptyItemSet();
+ SfxItemSet aAttrs = rEditView.getEditEngine().GetEmptyItemSet();
if (nScriptType == SvtScriptType::LATIN)
aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE ) );
if (nScriptType == SvtScriptType::COMPLEX)
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 549248f15223..11ca800e6844 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -1377,14 +1377,11 @@ void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFo
pOLV = pView->GetTextEditOutlinerView();
if( pOLV )
{
- EditEngine* pEditEngine = pOLV->GetEditView().GetEditEngine();
- if( pEditEngine )
- {
- ESelection aSel;
- aSel.nEndPara = pEditEngine->GetParagraphCount()-1;
- aSel.nEndPos = pEditEngine->GetTextLen(aSel.nEndPara);
- pOLV->SetSelection(aSel);
- }
+ EditEngine& rEditEngine = pOLV->GetEditView().getEditEngine();
+ ESelection aSel;
+ aSel.nEndPara = rEditEngine.GetParagraphCount() - 1;
+ aSel.nEndPos = rEditEngine.GetTextLen(aSel.nEndPara);
+ pOLV->SetSelection(aSel);
ChangeFontSize( bGrow, pOLV, pFontList, pView );
}
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 6d5481318e8e..c684bee2caa8 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -219,7 +219,7 @@ void Window::KeyInput(const KeyEvent& rKEvt)
{
mpViewShell->GetDoc()->dumpAsXml(nullptr);
if (OutlinerView *pOLV = mpViewShell->GetView()->GetTextEditOutlinerView())
- pOLV->GetEditView().GetEditEngine()->dumpAsXmlEditDoc(nullptr);
+ pOLV->GetEditView().getEditEngine().dumpAsXmlEditDoc(nullptr);
return;
}
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 2ed4099fc5d9..3a91c7efb6bc 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -542,7 +542,7 @@ uno::Reference<datatransfer::XTransferable> ViewShell::GetSelectionTransferable(
return uno::Reference<datatransfer::XTransferable>();
EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView();
- return rEditView.GetEditEngine()->CreateTransferable(rEditView.GetSelection());
+ return rEditView.getEditEngine().CreateTransferable(rEditView.GetSelection());
}
void ViewShell::SetGraphicMm100Position(bool bStart, const Point& rPosition)
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index bc1138a18d44..f36634a16b14 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -312,7 +312,7 @@ bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt)
// as we don't support RTL in Math, we need to swap values from selection when they were done
// in RTL form
aSelection.Adjust();
- OUString selected = pEditView->GetEditEngine()->GetText(aSelection);
+ OUString selected = pEditView->getEditEngine().GetText(aSelection);
// Check is auto close brackets/braces is disabled
SmModule *pMod = SM_MOD();
@@ -322,7 +322,7 @@ bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt)
autoClose = true;
else if (selected.isEmpty() && !aSelection.HasRange())
{
- selected = pEditView->GetEditEngine()->GetText(aSelection.nEndPara);
+ selected = pEditView->getEditEngine().GetText(aSelection.nEndPara);
if (!selected.isEmpty())
{
sal_Int32 index = selected.indexOf("\n", aSelection.nEndPos);
@@ -543,7 +543,7 @@ void SmEditTextWindow::SetText(const OUString& rText)
aModifyIdle.Start();
// Apply zoom to smeditwindow text
- static_cast<SmEditEngine*>(pEditView->GetEditEngine())->executeZoom(pEditView);
+ static_cast<SmEditEngine&>(pEditView->getEditEngine()).executeZoom(pEditView);
pEditView->SetSelection(eSelection);
}
@@ -780,7 +780,7 @@ void SmEditTextWindow::InsertText(const OUString& rText)
// Note: Insertion of a space in front of commands is done here and
// in SmEditWindow::InsertCommand.
ESelection aSelection = pEditView->GetSelection();
- OUString aCurrentFormula = pEditView->GetEditEngine()->GetText();
+ OUString aCurrentFormula = pEditView->getEditEngine().GetText();
sal_Int32 nStartIndex = 0;
// get the start position (when we get a multi line formula)
@@ -850,11 +850,9 @@ void SmEditWindow::DeleteEditView()
{
if (EditView* pEditView = GetEditView())
{
- if (EditEngine* pEditEngine = pEditView->GetEditEngine())
- {
- pEditEngine->SetStatusEventHdl( Link<EditStatus&,void>() );
- pEditEngine->RemoveView(pEditView);
- }
+ EditEngine& rEditEngine = pEditView->getEditEngine();
+ rEditEngine.SetStatusEventHdl( Link<EditStatus&,void>() );
+ rEditEngine.RemoveView(pEditView);
mxTextControlWin.reset();
mxTextControl.reset();
}
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index 46ab95eb9a18..d1b5e4b73e4a 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -144,7 +144,7 @@ void WeldEditView::Resize()
pEditView->ShowCursor();
const tools::Long nMaxVisAreaStart
- = pEditView->GetEditEngine()->GetTextHeight() - aOutputSize.Height();
+ = pEditView->getEditEngine().GetTextHeight() - aOutputSize.Height();
tools::Rectangle aVisArea(pEditView->GetVisArea());
if (aVisArea.Top() > nMaxVisAreaStart)
{
diff --git a/svx/source/theme/ThemeColorChangerCommon.cxx b/svx/source/theme/ThemeColorChangerCommon.cxx
index bca8ea1a1bb7..120a6bea03d9 100644
--- a/svx/source/theme/ThemeColorChangerCommon.cxx
+++ b/svx/source/theme/ThemeColorChangerCommon.cxx
@@ -62,9 +62,7 @@ bool updateEditEngTextSections(model::ColorSet const& rColorSet, SdrObject* pObj
if (!pOutlinerView)
return false;
- auto* pEditEngine = pOutlinerView->GetEditView().GetEditEngine();
- if (!pEditEngine)
- return false;
+ auto& rEditEngine = pOutlinerView->GetEditView().getEditEngine();
OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject();
if (pOutlinerParagraphObject)
@@ -82,9 +80,9 @@ bool updateEditEngTextSections(model::ColorSet const& rColorSet, SdrObject* pObj
model::ComplexColor const& rComplexColor = pItem->getComplexColor();
if (rComplexColor.isValidThemeType())
{
- SfxItemSet aSet(pEditEngine->GetAttribs(rSection.mnParagraph, rSection.mnStart,
- rSection.mnEnd,
- GetAttribsFlags::CHARATTRIBS));
+ SfxItemSet aSet(rEditEngine.GetAttribs(rSection.mnParagraph, rSection.mnStart,
+ rSection.mnEnd,
+ GetAttribsFlags::CHARATTRIBS));
Color aNewColor = rColorSet.resolveColor(rComplexColor);
std::unique_ptr<SvxColorItem> pNewItem(pItem->Clone());
pNewItem->setColor(aNewColor);
@@ -92,7 +90,7 @@ bool updateEditEngTextSections(model::ColorSet const& rColorSet, SdrObject* pObj
ESelection aSelection(rSection.mnParagraph, rSection.mnStart, rSection.mnParagraph,
rSection.mnEnd);
- pEditEngine->QuickSetAttribs(aSet, aSelection);
+ rEditEngine.QuickSetAttribs(aSet, aSelection);
}
}
}
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 281544a7afe5..c1490856028a 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -83,7 +83,7 @@ EditEngine* SidebarTextControl::GetEditEngine() const
OutlinerView* pOutlinerView = mrSidebarWin.GetOutlinerView();
if (!pOutlinerView)
return nullptr;
- return pOutlinerView->GetEditView().GetEditEngine();
+ return &pOutlinerView->GetEditView().getEditEngine();
}
void SidebarTextControl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
@@ -110,14 +110,14 @@ void SidebarTextControl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
EditView* pEditView = GetEditView();
pEditView->setEditViewCallbacks(this);
- EditEngine* pEditEngine = GetEditEngine();
+ EditEngine& rEditEngine = pEditView->getEditEngine();
// For tdf#143443 note we want an 'infinite' height initially (which is the
// editengines default). For tdf#144686 it is helpful if the initial width
// is the "SidebarWidth" so the calculated text height is always meaningful
// for layout in the sidebar.
- Size aPaperSize(mrPostItMgr.GetSidebarWidth(), pEditEngine->GetPaperSize().Height());
- pEditEngine->SetPaperSize(aPaperSize);
- pEditEngine->SetRefDevice(mrDocView.GetWrtShell().getIDocumentDeviceAccess().getReferenceDevice(false));
+ Size aPaperSize(mrPostItMgr.GetSidebarWidth(), rEditEngine.GetPaperSize().Height());
+ rEditEngine.SetPaperSize(aPaperSize);
+ rEditEngine.SetRefDevice(mrDocView.GetWrtShell().getIDocumentDeviceAccess().getReferenceDevice(false));
pEditView->SetOutputArea(tools::Rectangle(Point(0, 0), aOutputSize));
pEditView->SetBackgroundColor(aBgColor);
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 4d9a1817305f..d97b666d5fa5 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -418,7 +418,7 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq)
case FN_FORMAT_RESET: // delete hard text attributes
{
pOLV->RemoveAttribsKeepLanguages( true );
- pOLV->GetEditView().GetEditEngine()->RemoveFields();
+ pOLV->GetEditView().getEditEngine().RemoveFields();
rReq.Done();
}
break;
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx
index 453e0c1d93aa..db4c612433ee 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -58,11 +58,11 @@ namespace SwLangHelper
{
ESelection aSelection = pOLV->GetSelection();
EditView& rEditView=pOLV->GetEditView();
- EditEngine* pEditEngine=rEditView.GetEditEngine();
+ EditEngine& rEditEngine = rEditView.getEditEngine();
// the value of used script types
const SvtScriptType nScriptType =pOLV->GetSelectedScriptType();
- OUString aScriptTypesInUse( OUString::number( static_cast<int>(nScriptType) ) );//pEditEngine->GetScriptType(aSelection)
+ OUString aScriptTypesInUse( OUString::number( static_cast<int>(nScriptType) ) );//rEditEngine.GetScriptType(aSelection)
// get keyboard language
OUString aKeyboardLang;
@@ -78,11 +78,11 @@ namespace SwLangHelper
aCurrentLang = SvtLanguageTable::GetLanguageString( nLang );
// build sequence for status value
- uno::Sequence< OUString > aSeq{ aCurrentLang,
+ uno::Sequence<OUString> aSeq{ aCurrentLang,
aScriptTypesInUse,
aKeyboardLang,
- SwLangHelper::GetTextForLanguageGuessing( pEditEngine,
- aSelection ) };
+ SwLangHelper::GetTextForLanguageGuessing(&rEditEngine, aSelection)
+ };
// set sequence as status value
SfxStringListItem aItem( SID_LANGUAGE_STATUS );
@@ -200,7 +200,7 @@ namespace SwLangHelper
if (nLang == LANGUAGE_DONTKNOW)
return;
- EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : nullptr;
+ EditEngine* pEditEngine = pOLV ? &pOLV->GetEditView().getEditEngine() : nullptr;
OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
//get ScriptType
@@ -284,7 +284,7 @@ namespace SwLangHelper
// (for paragraph is handled by previously having set the selection to the
// whole paragraph)
- EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : nullptr;
+ EditEngine* pEditEngine = pOLV ? &pOLV->GetEditView().getEditEngine() : nullptr;
OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
if (pEditEngine)
{
@@ -332,13 +332,13 @@ namespace SwLangHelper
// ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks
// when setting a new language attribute
- EditEngine* pEditEngine = rEditView.GetEditEngine();
- EEControlBits nCntrl = pEditEngine->GetControlWord();
+ EditEngine& rEditEngine = rEditView.getEditEngine();
+ EEControlBits nCntrl = rEditEngine.GetControlWord();
// turn off
- pEditEngine->SetControlWord(nCntrl & ~EEControlBits::ONLINESPELLING);
+ rEditEngine.SetControlWord(nCntrl & ~EEControlBits::ONLINESPELLING);
//turn back on
- pEditEngine->SetControlWord(nCntrl);
- pEditEngine->CompleteOnlineSpelling();
+ rEditEngine.SetControlWord(nCntrl);
+ rEditEngine.CompleteOnlineSpelling();
rEditView.Invalidate();
}
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index c01d0e179507..222583517e42 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3742,7 +3742,7 @@ uno::Reference<datatransfer::XTransferable> SwXTextDocument::getSelection()
{
// Editing shape text
EditView& rEditView = pSdrView->GetTextEditOutlinerView()->GetEditView();
- xTransferable = rEditView.GetEditEngine()->CreateTransferable(rEditView.GetSelection());
+ xTransferable = rEditView.getEditEngine().CreateTransferable(rEditView.GetSelection());
}
}
@@ -3752,7 +3752,7 @@ uno::Reference<datatransfer::XTransferable> SwXTextDocument::getSelection()
{
// Editing postit text.
EditView& rEditView = pWin->GetOutlinerView()->GetEditView();
- xTransferable = rEditView.GetEditEngine()->CreateTransferable(rEditView.GetSelection());
+ xTransferable = rEditView.getEditEngine().CreateTransferable(rEditView.GetSelection());
}
}