diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2024-01-21 17:48:27 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2024-01-25 11:02:05 +0100 |
commit | 290ad80ad225ba8570fa792fd1c8dbe7a7d107f0 (patch) | |
tree | a420c65840e4c6bfeb10c5a15c13a2d11f9b3a19 | |
parent | e5d6133283bacb6bced8cdbedaeae6b3bd2f179e (diff) |
editeng: in EditView, access ImpEditView as a reference
EditView access to ImpEditView can be done as a reference as the
ImpEditView instance is created on EditView construction and is
always valid as long as EditView is alive.
Also change all access to ImpEditView instance to use the
getImpl() method insteady of direct access.
Change-Id: If64f8f8494c3a4f52f860ea8dee798edd51b6c6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162528
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 45 | ||||
-rw-r--r-- | editeng/source/editeng/editsel.cxx | 8 | ||||
-rw-r--r-- | editeng/source/editeng/editundo.cxx | 52 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 359 | ||||
-rw-r--r-- | editeng/source/editeng/edtspell.cxx | 11 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 98 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 18 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 84 | ||||
-rw-r--r-- | editeng/source/editeng/impedit5.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/textconv.cxx | 6 | ||||
-rw-r--r-- | include/editeng/editview.hxx | 4 |
11 files changed, 339 insertions, 348 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index d4bcfe337c86..61b979abd320 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -309,11 +309,11 @@ void EditEngine::InsertView(EditView* pEditView, size_t nIndex) rViews.insert(rViews.begin()+nIndex, pEditView); EditSelection aStartSel = pImpEditEngine->GetEditDoc().GetStartPaM(); - pEditView->pImpEditView->SetEditSelection( aStartSel ); + pEditView->getImpl().SetEditSelection( aStartSel ); if ( !pImpEditEngine->GetActiveView() ) pImpEditEngine->SetActiveView( pEditView ); - pEditView->pImpEditView->AddDragAndDropListeners(); + pEditView->getImpl().AddDragAndDropListeners(); } EditView* EditEngine::RemoveView( EditView* pView ) @@ -334,7 +334,7 @@ EditView* EditEngine::RemoveView( EditView* pView ) pImpEditEngine->SetActiveView( nullptr ); pImpEditEngine->GetSelEngine().SetCurView( nullptr ); } - pView->pImpEditView->RemoveDragAndDropListeners(); + pView->getImpl().RemoveDragAndDropListeners(); } return pRemoved; @@ -401,11 +401,10 @@ void EditEngine::SetPaperSize( const Size& rNewSize ) for (EditView* pView : pImpEditEngine->maEditViews) { if ( bAutoPageSize ) - pView->pImpEditView->RecalcOutputArea(); - else if ( pView->pImpEditView->DoAutoSize() ) + pView->getImpl().RecalcOutputArea(); + else if (pView->getImpl().DoAutoSize()) { - pView->pImpEditView->ResetOutputArea( tools::Rectangle( - pView->pImpEditView->GetOutputArea().TopLeft(), aNewSize ) ); + pView->getImpl().ResetOutputArea(tools::Rectangle(pView->getImpl().GetOutputArea().TopLeft(), aNewSize)); } } @@ -1009,7 +1008,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v GetCursorFlags nNewCursorFlags = GetCursorFlags::NONE; bool bSetCursorFlags = true; - EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); + EditSelection aCurSel( pEditView->getImpl().GetEditSelection() ); DBG_ASSERT( !aCurSel.IsInvalid(), "Blinde Selection in EditEngine::PostKeyEvent" ); OUString aAutoText( pImpEditEngine->GetAutoCompleteText() ); @@ -1127,7 +1126,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v if ( aCurSel.HasRange() ) { Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetSystemPrimarySelection()); - pEditView->pImpEditView->CutCopy( aSelection, false ); + pEditView->getImpl().CutCopy( aSelection, false ); } bMoved = true; @@ -1210,9 +1209,9 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v break; } - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); pImpEditEngine->UndoActionStart( EDITUNDO_DELETE ); - aCurSel = pImpEditEngine->DeleteLeftOrRight( aCurSel, nDel, nMode ); + aCurSel = getImpl().DeleteLeftOrRight( aCurSel, nDel, nMode ); pImpEditEngine->UndoActionEnd(); bModified = true; bAllowIdle = false; @@ -1245,7 +1244,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v { if ( !bReadOnly ) { - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); if ( !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() ) { pImpEditEngine->UndoActionStart( EDITUNDO_INSERT ); @@ -1300,7 +1299,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v if ( !bReadOnly && IsSimpleCharInput( rKeyEvent ) ) { sal_Unicode nCharCode = rKeyEvent.GetCharCode(); - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); // Autocorrection? if ( ( pImpEditEngine->GetStatus().DoAutoCorrect() ) && ( SvxAutoCorrect::IsAutoCorrectChar( nCharCode ) || @@ -1374,8 +1373,8 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v { pImpEditEngine->SetAutoCompleteText( aComplete, false ); Point aPos = pImpEditEngine->PaMtoEditCursor( aCurSel.Max() ).TopLeft(); - aPos = pEditView->pImpEditView->GetWindowPos( aPos ); - aPos = pEditView->pImpEditView->GetWindow()->LogicToPixel( aPos ); + aPos = pEditView->getImpl().GetWindowPos( aPos ); + aPos = pEditView->getImpl().GetWindow()->LogicToPixel( aPos ); aPos = pEditView->GetWindow()->OutputToScreenPixel( aPos ); aPos.AdjustY( -3 ); Help::ShowQuickHelp( pEditView->GetWindow(), tools::Rectangle( aPos, Size( 1, 1 ) ), aComplete, QuickHelpFlags::Bottom|QuickHelpFlags::Left ); @@ -1391,28 +1390,28 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v } } - pEditView->pImpEditView->SetEditSelection( aCurSel ); + pEditView->getImpl().SetEditSelection( aCurSel ); if (comphelper::LibreOfficeKit::isActive()) { - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); } pImpEditEngine->UpdateSelections(); if ( ( !IsEffectivelyVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) ) || ( IsEffectivelyVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) )) { - pEditView->pImpEditView->nTravelXPos = TRAVEL_X_DONTKNOW; + pEditView->getImpl().nTravelXPos = TRAVEL_X_DONTKNOW; } if ( /* ( nCode != KEY_HOME ) && ( nCode != KEY_END ) && */ ( !IsEffectivelyVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) ) || ( IsEffectivelyVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) )) { - pEditView->pImpEditView->SetCursorBidiLevel( CURSOR_BIDILEVEL_DONTKNOW ); + pEditView->getImpl().SetCursorBidiLevel( CURSOR_BIDILEVEL_DONTKNOW ); } if ( bSetCursorFlags ) - pEditView->pImpEditView->nExtraCursorFlags = nNewCursorFlags; + pEditView->getImpl().nExtraCursorFlags = nNewCursorFlags; if ( bModified ) { @@ -1426,8 +1425,8 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v } else if ( bMoved ) { - bool bGotoCursor = pEditView->pImpEditView->DoAutoScroll(); - pEditView->pImpEditView->ShowCursor( bGotoCursor, true ); + bool bGotoCursor = pEditView->getImpl().DoAutoScroll(); + pEditView->getImpl().ShowCursor( bGotoCursor, true ); pImpEditEngine->CallStatusHdl(); } @@ -2555,7 +2554,7 @@ void EditEngine::ParagraphHeightChanged( sal_Int32 nPara ) } for (EditView* pView : pImpEditEngine->maEditViews) - pView->pImpEditView->ScrollStateChange(); + pView->getImpl().ScrollStateChange(); } OUString EditEngine::GetUndoComment( sal_uInt16 nId ) const diff --git a/editeng/source/editeng/editsel.cxx b/editeng/source/editeng/editsel.cxx index 3aeed7a6e357..4bdfff88155b 100644 --- a/editeng/source/editeng/editsel.cxx +++ b/editeng/source/editeng/editsel.cxx @@ -31,7 +31,7 @@ EditSelFunctionSet::EditSelFunctionSet() void EditSelFunctionSet::CreateAnchor() { if ( pCurView ) - pCurView->pImpEditView->CreateAnchor(); + pCurView->getImpl().CreateAnchor(); } void EditSelFunctionSet::DestroyAnchor() @@ -42,13 +42,13 @@ void EditSelFunctionSet::DestroyAnchor() void EditSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel, bool ) { if ( pCurView ) - pCurView->pImpEditView->SetCursorAtPoint( rPointPixel ); + pCurView->getImpl().SetCursorAtPoint( rPointPixel ); } bool EditSelFunctionSet::IsSelectionAtPoint( const Point& rPointPixel ) { if ( pCurView ) - return pCurView->pImpEditView->IsSelectionAtPoint( rPointPixel ); + return pCurView->getImpl().IsSelectionAtPoint( rPointPixel ); return false; } @@ -69,7 +69,7 @@ void EditSelFunctionSet::BeginDrag() void EditSelFunctionSet::DeselectAll() { if ( pCurView ) - pCurView->pImpEditView->DeselectAll(); + pCurView->getImpl().DeselectAll(); } diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index b13ff7109791..7ff299e7efbd 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -32,7 +32,7 @@ static void lcl_DoSetSelection( EditView const * pView, sal_uInt16 nPara ) EditPaM aPaM = pView->getImpEditEngine().CreateEditPaM(aEPaM); aPaM.SetIndex( aPaM.GetNode()->Len() ); EditSelection aSel( aPaM, aPaM ); - pView->GetImpEditView()->SetEditSelection( aSel ); + pView->getImpl().SetEditSelection( aSel ); } EditUndoManager::EditUndoManager(sal_uInt16 nMaxUndoActionCount ) @@ -64,18 +64,18 @@ bool EditUndoManager::Undo() } } - mpEditEngine->GetActiveView()->GetImpEditView()->DrawSelectionXOR(); // Remove the old selection + mpEditEngine->GetActiveView()->getImpl().DrawSelectionXOR(); // Remove the old selection mpEditEngine->SetUndoMode( true ); bool bDone = SfxUndoManager::Undo(); mpEditEngine->SetUndoMode( false ); - EditSelection aNewSel( mpEditEngine->GetActiveView()->GetImpEditView()->GetEditSelection() ); + EditSelection aNewSel( mpEditEngine->GetActiveView()->getImpl().GetEditSelection() ); DBG_ASSERT( !aNewSel.IsInvalid(), "Invalid selection after Undo () "); DBG_ASSERT( !aNewSel.DbgIsBuggy( mpEditEngine->GetEditDoc() ), "Broken selection afte Undo () "); aNewSel.Min() = aNewSel.Max(); - mpEditEngine->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); + mpEditEngine->GetActiveView()->getImpl().SetEditSelection( aNewSel ); if (mpEditEngine->IsUpdateLayout()) mpEditEngine->FormatAndLayout( mpEditEngine->GetActiveView(), true ); @@ -100,18 +100,18 @@ bool EditUndoManager::Redo() } } - mpEditEngine->GetActiveView()->GetImpEditView()->DrawSelectionXOR(); // Remove the old selection + mpEditEngine->GetActiveView()->getImpl().DrawSelectionXOR(); // Remove the old selection mpEditEngine->SetUndoMode( true ); bool bDone = SfxUndoManager::Redo(); mpEditEngine->SetUndoMode( false ); - EditSelection aNewSel( mpEditEngine->GetActiveView()->GetImpEditView()->GetEditSelection() ); + EditSelection aNewSel( mpEditEngine->GetActiveView()->getImpl().GetEditSelection() ); DBG_ASSERT( !aNewSel.IsInvalid(), "Invalid selection after Undo () "); DBG_ASSERT( !aNewSel.DbgIsBuggy( mpEditEngine->GetEditDoc() ), "Broken selection afte Undo () "); aNewSel.Min() = aNewSel.Max(); - mpEditEngine->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); + mpEditEngine->GetActiveView()->getImpl().SetEditSelection( aNewSel ); if (mpEditEngine->IsUpdateLayout()) mpEditEngine->FormatAndLayout( mpEditEngine->GetActiveView() ); @@ -122,7 +122,7 @@ EditUndo::EditUndo(sal_uInt16 nI, EditEngine* pEE) : nId(nI), mnViewShellId(-1), mpEditEngine(pEE) { const EditView* pEditView = mpEditEngine ? mpEditEngine->GetActiveView() : nullptr; - const OutlinerViewShell* pViewShell = pEditView ? pEditView->GetImpEditView()->GetViewShell() : nullptr; + const OutlinerViewShell* pViewShell = pEditView ? pEditView->getImpl().GetViewShell() : nullptr; if (pViewShell) mnViewShellId = pViewShell->GetViewShellId(); } @@ -173,7 +173,7 @@ void EditUndoDelContent::Undo() ContentNode* pNode = mpContentNode.get(); GetEditEngine()->InsertContent(std::move(mpContentNode), nNode); EditSelection aSel(EditPaM(pNode, 0), EditPaM(pNode, pNode->Len())); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aSel); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection(aSel); } void EditUndoDelContent::Redo() @@ -208,7 +208,7 @@ void EditUndoDelContent::Redo() EditPaM aPaM(pCheckNode, pCheckNode->Len()); - pEE->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); + pEE->GetActiveView()->getImpl().SetEditSelection( EditSelection( aPaM, aPaM ) ); } EditUndoConnectParas::EditUndoConnectParas( @@ -270,7 +270,7 @@ void EditUndoConnectParas::Undo() GetEditEngine()->SetStyleSheet( nNode+1, static_cast<SfxStyleSheet*>(GetEditEngine()->GetStyleSheetPool()->Find( aRightStyleName, eRightStyleFamily )) ); } - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection( EditSelection( aPaM, aPaM ) ); } void EditUndoConnectParas::Redo() @@ -278,7 +278,7 @@ void EditUndoConnectParas::Redo() DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: Np Active View!" ); EditPaM aPaM = GetEditEngine()->ConnectContents( nNode, bBackward ); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection( EditSelection( aPaM, aPaM ) ); } EditUndoSplitPara::EditUndoSplitPara( @@ -292,14 +292,14 @@ void EditUndoSplitPara::Undo() { DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditPaM aPaM = GetEditEngine()->ConnectContents(nNode, false); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection( EditSelection( aPaM, aPaM ) ); } void EditUndoSplitPara::Redo() { DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditPaM aPaM = GetEditEngine()->SplitContent(nNode, nSepPos); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aPaM ) ); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection( EditSelection( aPaM, aPaM ) ); } EditUndoInsertChars::EditUndoInsertChars( @@ -315,7 +315,7 @@ void EditUndoInsertChars::Undo() EditSelection aSel( aPaM, aPaM ); aSel.Max().SetIndex( aSel.Max().GetIndex() + aText.getLength() ); EditPaM aNewPaM( GetEditEngine()->DeleteSelection(aSel) ); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aNewPaM, aNewPaM ) ); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection( EditSelection( aNewPaM, aNewPaM ) ); } void EditUndoInsertChars::Redo() @@ -325,7 +325,7 @@ void EditUndoInsertChars::Redo() GetEditEngine()->InsertText(EditSelection(aPaM, aPaM), aText); EditPaM aNewPaM( aPaM ); aNewPaM.SetIndex( aNewPaM.GetIndex() + aText.getLength() ); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( EditSelection( aPaM, aNewPaM ) ); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection( EditSelection( aPaM, aNewPaM ) ); } bool EditUndoInsertChars::Merge( SfxUndoAction* pNextAction ) @@ -357,7 +357,7 @@ void EditUndoRemoveChars::Undo() EditSelection aSel( aPaM, aPaM ); GetEditEngine()->InsertText(aSel, aText); aSel.Max().SetIndex( aSel.Max().GetIndex() + aText.getLength() ); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aSel); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection(aSel); } void EditUndoRemoveChars::Redo() @@ -367,7 +367,7 @@ void EditUndoRemoveChars::Redo() EditSelection aSel( aPaM, aPaM ); aSel.Max().SetIndex( aSel.Max().GetIndex() + aText.getLength() ); EditPaM aNewPaM = GetEditEngine()->DeleteSelection(aSel); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aNewPaM); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection(aNewPaM); } EditUndoInsertFeature::EditUndoInsertFeature( @@ -392,7 +392,7 @@ void EditUndoInsertFeature::Undo() aSel.Max().SetIndex( aSel.Max().GetIndex()+1 ); GetEditEngine()->DeleteSelection(aSel); aSel.Max().SetIndex( aSel.Max().GetIndex()-1 ); // For Selection - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aSel); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection(aSel); } void EditUndoInsertFeature::Redo() @@ -404,7 +404,7 @@ void EditUndoInsertFeature::Redo() if ( pFeature->Which() == EE_FEATURE_FIELD ) GetEditEngine()->UpdateFieldsOnly(); aSel.Max().SetIndex( aSel.Max().GetIndex()+1 ); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection(aSel); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection(aSel); } EditUndoMoveParagraphs::EditUndoMoveParagraphs( @@ -433,14 +433,14 @@ void EditUndoMoveParagraphs::Undo() nTmpDest += aTmpRange.Len(); EditSelection aNewSel = GetEditEngine()->MoveParagraphs(aTmpRange, nTmpDest); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection( aNewSel ); } void EditUndoMoveParagraphs::Redo() { DBG_ASSERT( GetEditEngine()->GetActiveView(), "Undo/Redo: No Active View!" ); EditSelection aNewSel = GetEditEngine()->MoveParagraphs(nParagraphs, nDest); - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection( aNewSel ); } EditUndoSetStyleSheet::EditUndoSetStyleSheet( @@ -577,7 +577,7 @@ void EditUndoSetAttribs::ImpSetSelection() { EditEngine* pEE = GetEditEngine(); EditSelection aSel = pEE->CreateSelection(aESel); - pEE->GetActiveView()->GetImpEditView()->SetEditSelection(aSel); + pEE->GetActiveView()->getImpl().SetEditSelection(aSel); } EditUndoTransliteration::EditUndoTransliteration(EditEngine* pEE, const ESelection& rESel, TransliterationFlags nM) : @@ -622,7 +622,7 @@ void EditUndoTransliteration::Undo() aNewSel.Max().SetIndex( aNewSel.Max().GetIndex() + aDelSel.Min().GetIndex() ); } pEE->DeleteSelected( aDelSel ); - pEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); + pEE->GetActiveView()->getImpl().SetEditSelection( aNewSel ); } void EditUndoTransliteration::Redo() @@ -632,7 +632,7 @@ void EditUndoTransliteration::Redo() EditSelection aSel = pEE->CreateSelection(aOldESel); EditSelection aNewSel = pEE->TransliterateText( aSel, nMode ); - pEE->GetActiveView()->GetImpEditView()->SetEditSelection( aNewSel ); + pEE->GetActiveView()->getImpl().SetEditSelection( aNewSel ); } EditUndoMarkSelection::EditUndoMarkSelection(EditEngine* pEE, const ESelection& rSel) : @@ -648,7 +648,7 @@ void EditUndoMarkSelection::Undo() if ( GetEditEngine()->IsFormatted() ) GetEditEngine()->GetActiveView()->SetSelection( aSelection ); else - GetEditEngine()->GetActiveView()->GetImpEditView()->SetEditSelection( GetEditEngine()->CreateSelection(aSelection) ); + GetEditEngine()->GetActiveView()->getImpl().SetEditSelection(GetEditEngine()->CreateSelection(aSelection)); } } diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index c8a974df8ec1..791902f4e486 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -152,7 +152,7 @@ EditViewCallbacks::~EditViewCallbacks() } EditView::EditView(EditEngine* pEditEngine, vcl::Window* pWindow) - : pImpEditView(new ImpEditView(this, pEditEngine, pWindow)) + : mpImpEditView(new ImpEditView(this, pEditEngine, pWindow)) { assert(pEditEngine); } @@ -163,32 +163,32 @@ EditView::~EditView() void EditView::setEditViewCallbacks(EditViewCallbacks* pEditViewCallbacks) { - pImpEditView->setEditViewCallbacks(pEditViewCallbacks); + getImpl().setEditViewCallbacks(pEditViewCallbacks); } EditViewCallbacks* EditView::getEditViewCallbacks() const { - return pImpEditView->getEditViewCallbacks(); + return getImpl().getEditViewCallbacks(); } ImpEditEngine& EditView::getImpEditEngine() const { - return pImpEditView->getImpEditEngine(); + return getImpl().getImpEditEngine(); } EditEngine& EditView::getEditEngine() const { - return pImpEditView->getEditEngine(); + return getImpl().getEditEngine(); } tools::Rectangle EditView::GetInvalidateRect() const { - if ( !pImpEditView->DoInvalidateMore() ) - return pImpEditView->aOutArea; + if ( !getImpl().DoInvalidateMore() ) + return getImpl().aOutArea; else { - tools::Rectangle aRect( pImpEditView->aOutArea ); - tools::Long nMore = pImpEditView->GetOutputDevice().PixelToLogic( Size( pImpEditView->GetInvalidateMore(), 0 ) ).Width(); + tools::Rectangle aRect( getImpl().aOutArea ); + tools::Long nMore = getImpl().GetOutputDevice().PixelToLogic( Size( getImpl().GetInvalidateMore(), 0 ) ).Width(); aRect.AdjustLeft( -nMore ); aRect.AdjustRight(nMore ); aRect.AdjustTop( -nMore ); @@ -209,7 +209,7 @@ tools::Rectangle lcl_negateRectX(const tools::Rectangle& rRect) void EditView::InvalidateWindow(const tools::Rectangle& rClipRect) { bool bNegativeX = IsNegativeX(); - if (EditViewCallbacks* pEditViewCallbacks = pImpEditView->getEditViewCallbacks()) + if (EditViewCallbacks* pEditViewCallbacks = getImpl().getEditViewCallbacks()) { // do not invalidate and trigger a global repaint, but forward // the need for change to the applied EditViewCallback, can e.g. @@ -229,7 +229,7 @@ void EditView::InvalidateOtherViewWindows( const tools::Rectangle& rInvRect ) if (comphelper::LibreOfficeKit::isActive()) { bool bNegativeX = IsNegativeX(); - for (auto& pWin : pImpEditView->aOutWindowSet) + for (auto& pWin : getImpl().aOutWindowSet) { if (pWin) { @@ -243,18 +243,18 @@ void EditView::InvalidateOtherViewWindows( const tools::Rectangle& rInvRect ) void EditView::Invalidate() { const tools::Rectangle& rInvRect = GetInvalidateRect(); - pImpEditView->InvalidateAtWindow(rInvRect); + getImpl().InvalidateAtWindow(rInvRect); InvalidateOtherViewWindows(rInvRect); } void EditView::SetReadOnly( bool bReadOnly ) { - pImpEditView->bReadOnly = bReadOnly; + getImpl().bReadOnly = bReadOnly; } bool EditView::IsReadOnly() const { - return pImpEditView->bReadOnly; + return getImpl().bReadOnly; } void EditView::SetSelection( const ESelection& rESel ) @@ -290,10 +290,10 @@ void EditView::SetSelection( const ESelection& rESel ) aNewSelection.Max() = EditPaM( pNode, pNode->Len() ); } - pImpEditView->DrawSelectionXOR(); - pImpEditView->SetEditSelection( aNewSelection ); - pImpEditView->DrawSelectionXOR(); - bool bGotoCursor = pImpEditView->DoAutoScroll(); + getImpl().DrawSelectionXOR(); + getImpl().SetEditSelection( aNewSelection ); + getImpl().DrawSelectionXOR(); + bool bGotoCursor = getImpl().DoAutoScroll(); // comments section in Writer: // don't scroll to the selection if it is @@ -306,78 +306,78 @@ ESelection EditView::GetSelection() const { ESelection aSelection; - aSelection.nStartPara = getEditEngine().GetEditDoc().GetPos( pImpEditView->GetEditSelection().Min().GetNode() ); - aSelection.nEndPara = getEditEngine().GetEditDoc().GetPos( pImpEditView->GetEditSelection().Max().GetNode() ); + aSelection.nStartPara = getEditEngine().GetEditDoc().GetPos( getImpl().GetEditSelection().Min().GetNode() ); + aSelection.nEndPara = getEditEngine().GetEditDoc().GetPos( getImpl().GetEditSelection().Max().GetNode() ); - aSelection.nStartPos = pImpEditView->GetEditSelection().Min().GetIndex(); - aSelection.nEndPos = pImpEditView->GetEditSelection().Max().GetIndex(); + aSelection.nStartPos = getImpl().GetEditSelection().Min().GetIndex(); + aSelection.nEndPos = getImpl().GetEditSelection().Max().GetIndex(); return aSelection; } bool EditView::HasSelection() const { - return pImpEditView->HasSelection(); + return getImpl().HasSelection(); } bool EditView::IsSelectionFullPara() const { - return pImpEditView->IsSelectionFullPara(); + return getImpl().IsSelectionFullPara(); } bool EditView::IsSelectionWithinSinglePara() const { - return pImpEditView->IsSelectionInSinglePara(); + return getImpl().IsSelectionInSinglePara(); } bool EditView::IsSelectionAtPoint(const Point& rPointPixel) { - return pImpEditView->IsSelectionAtPoint(rPointPixel); + return getImpl().IsSelectionAtPoint(rPointPixel); } void EditView::DeleteSelected() { - pImpEditView->DeleteSelected(); + getImpl().DeleteSelected(); } SvtScriptType EditView::GetSelectedScriptType() const { - return getEditEngine().GetScriptType( pImpEditView->GetEditSelection() ); + return getEditEngine().GetScriptType( getImpl().GetEditSelection() ); } void EditView::GetSelectionRectangles(std::vector<tools::Rectangle>& rLogicRects) const { - return pImpEditView->GetSelectionRectangles(pImpEditView->GetEditSelection(), rLogicRects); + return getImpl().GetSelectionRectangles(getImpl().GetEditSelection(), rLogicRects); } void EditView::Paint( const tools::Rectangle& rRect, OutputDevice* pTargetDevice ) { - getImpEditEngine().Paint( pImpEditView.get(), rRect, pTargetDevice ); + getImpEditEngine().Paint(&getImpl(), rRect, pTargetDevice); } void EditView::setEditEngine(EditEngine* pEditEngine) { assert(pEditEngine); - pImpEditView->mpEditEngine = pEditEngine; + getImpl().mpEditEngine = pEditEngine; EditSelection aStartSel = getEditEngine().GetEditDoc().GetStartPaM(); - pImpEditView->SetEditSelection( aStartSel ); + getImpl().SetEditSelection( aStartSel ); } void EditView::SetWindow( vcl::Window* pWin ) { - pImpEditView->pOutWin = pWin; + getImpl().pOutWin = pWin; getImpEditEngine().GetSelEngine().Reset(); } vcl::Window* EditView::GetWindow() const { - return pImpEditView->pOutWin; + return getImpl().pOutWin; } OutputDevice& EditView::GetOutputDevice() const { - return pImpEditView->GetOutputDevice(); + return getImpl().GetOutputDevice(); } LanguageType EditView::GetInputLanguage() const @@ -390,7 +390,7 @@ LanguageType EditView::GetInputLanguage() const bool EditView::HasOtherViewWindow( vcl::Window* pWin ) { - OutWindowSet& rOutWindowSet = pImpEditView->aOutWindowSet; + OutWindowSet& rOutWindowSet = getImpl().aOutWindowSet; auto found = std::find(rOutWindowSet.begin(), rOutWindowSet.end(), pWin); return (found != rOutWindowSet.end()); } @@ -399,13 +399,13 @@ bool EditView::AddOtherViewWindow( vcl::Window* pWin ) { if (HasOtherViewWindow(pWin)) return false; - pImpEditView->aOutWindowSet.emplace_back(pWin); + getImpl().aOutWindowSet.emplace_back(pWin); return true; } bool EditView::RemoveOtherViewWindow( vcl::Window* pWin ) { - OutWindowSet& rOutWindowSet = pImpEditView->aOutWindowSet; + OutWindowSet& rOutWindowSet = getImpl().aOutWindowSet; auto found = std::find(rOutWindowSet.begin(), rOutWindowSet.end(), pWin); if (found == rOutWindowSet.end()) return false; @@ -415,38 +415,38 @@ bool EditView::RemoveOtherViewWindow( vcl::Window* pWin ) void EditView::SetVisArea( const tools::Rectangle& rRect ) { - pImpEditView->SetVisDocStartPos( rRect.TopLeft() ); + getImpl().SetVisDocStartPos( rRect.TopLeft() ); } tools::Rectangle EditView::GetVisArea() const { - return pImpEditView->GetVisDocArea(); + return getImpl().GetVisDocArea(); } void EditView::SetOutputArea( const tools::Rectangle& rRect ) { - pImpEditView->SetOutputArea( rRect ); + getImpl().SetOutputArea( rRect ); // the rest here only if it is an API call: - pImpEditView->CalcAnchorPoint(); + getImpl().CalcAnchorPoint(); if (getImpEditEngine().GetStatus().AutoPageSize() ) - pImpEditView->RecalcOutputArea(); - pImpEditView->ShowCursor( false, false ); + getImpl().RecalcOutputArea(); + getImpl().ShowCursor( false, false ); } const tools::Rectangle& EditView::GetOutputArea() const { - return pImpEditView->GetOutputArea(); + return getImpl().GetOutputArea(); } PointerStyle EditView::GetPointer() const { - return pImpEditView->GetPointer(); + return getImpl().GetPointer(); } vcl::Cursor* EditView::GetCursor() const { - return pImpEditView->pCursor.get(); + return getImpl().pCursor.get(); } void EditView::InsertText( const OUString& rStr, bool bSelect, bool bLOKShowSelect ) @@ -455,27 +455,27 @@ void EditView::InsertText( const OUString& rStr, bool bSelect, bool bLOKShowSele EditEngine& rEditEngine = getEditEngine(); if (bLOKShowSelect) - pImpEditView->DrawSelectionXOR(); + getImpl().DrawSelectionXOR(); EditPaM aPaM1; if ( bSelect ) { - EditSelection aTmpSel( pImpEditView->GetEditSelection() ); + EditSelection aTmpSel( getImpl().GetEditSelection() ); aTmpSel.Adjust(rEditEngine.GetEditDoc()); aPaM1 = aTmpSel.Min(); } rEditEngine.UndoActionStart( EDITUNDO_INSERT ); - EditPaM aPaM2(rEditEngine.InsertText( pImpEditView->GetEditSelection(), rStr ) ); + EditPaM aPaM2(rEditEngine.InsertText( getImpl().GetEditSelection(), rStr ) ); rEditEngine.UndoActionEnd(); if ( bSelect ) { DBG_ASSERT( !aPaM1.DbgIsBuggy(rEditEngine.GetEditDoc()), "Insert: PaM broken" ); - pImpEditView->SetEditSelection( EditSelection( aPaM1, aPaM2 ) ); + getImpl().SetEditSelection( EditSelection( aPaM1, aPaM2 ) ); } else - pImpEditView->SetEditSelection( EditSelection( aPaM2, aPaM2 ) ); + getImpl().SetEditSelection( EditSelection( aPaM2, aPaM2 ) ); if (bLOKShowSelect) rEditEngine.FormatAndLayout( this ); @@ -483,42 +483,42 @@ void EditView::InsertText( const OUString& rStr, bool bSelect, bool bLOKShowSele bool EditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * pFrameWin ) { - return pImpEditView->PostKeyEvent( rKeyEvent, pFrameWin ); + return getImpl().PostKeyEvent( rKeyEvent, pFrameWin ); } bool EditView::MouseButtonUp( const MouseEvent& rMouseEvent ) { - return pImpEditView->MouseButtonUp( rMouseEvent ); + return getImpl().MouseButtonUp( rMouseEvent ); } void EditView::ReleaseMouse() { - return pImpEditView->ReleaseMouse(); + return getImpl().ReleaseMouse(); } bool EditView::MouseButtonDown( const MouseEvent& rMouseEvent ) { - return pImpEditView->MouseButtonDown( rMouseEvent ); + return getImpl().MouseButtonDown( rMouseEvent ); } bool EditView::MouseMove( const MouseEvent& rMouseEvent ) { - return pImpEditView->MouseMove( rMouseEvent ); + return getImpl().MouseMove( rMouseEvent ); } bool EditView::Command(const CommandEvent& rCEvt) { - return pImpEditView->Command(rCEvt); + return getImpl().Command(rCEvt); } void EditView::SetBroadcastLOKViewCursor(bool bSet) { - pImpEditView->SetBroadcastLOKViewCursor(bSet); + getImpl().SetBroadcastLOKViewCursor(bSet); } tools::Rectangle EditView::GetEditCursor() const { - return pImpEditView->GetEditCursor(); + return getImpl().GetEditCursor(); } void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bActivate ) @@ -527,45 +527,45 @@ void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bActivat return; // The control word is more important: - if ( !pImpEditView->DoAutoScroll() ) + if ( !getImpl().DoAutoScroll() ) bGotoCursor = false; - pImpEditView->ShowCursor( bGotoCursor, bForceVisCursor ); + getImpl().ShowCursor( bGotoCursor, bForceVisCursor ); - if (pImpEditView->mpViewShell && !bActivate) + if (getImpl().mpViewShell && !bActivate) { - if (!pImpEditView->pOutWin) + if (!getImpl().pOutWin) return; - VclPtr<vcl::Window> pParent = pImpEditView->pOutWin->GetParentWithLOKNotifier(); + VclPtr<vcl::Window> pParent = getImpl().pOutWin->GetParentWithLOKNotifier(); if (pParent && pParent->GetLOKWindowId() != 0) return; static const OString aPayload = OString::boolean(true); - pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); - pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible"_ostr, aPayload); + getImpl().mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); + getImpl().mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible"_ostr, aPayload); } } void EditView::HideCursor(bool bDeactivate) { - pImpEditView->GetCursor()->Hide(); + getImpl().GetCursor()->Hide(); - if (pImpEditView->mpViewShell && !bDeactivate) + if (getImpl().mpViewShell && !bDeactivate) { - if (!pImpEditView->pOutWin) + if (!getImpl().pOutWin) return; - VclPtr<vcl::Window> pParent = pImpEditView->pOutWin->GetParentWithLOKNotifier(); + VclPtr<vcl::Window> pParent = getImpl().pOutWin->GetParentWithLOKNotifier(); if (pParent && pParent->GetLOKWindowId() != 0) return; OString aPayload = OString::boolean(false); - pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); - pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible"_ostr, aPayload); + getImpl().mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload); + getImpl().mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible"_ostr, aPayload); } } Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRangeCheck ) { - return pImpEditView->Scroll( ndX, ndY, nRangeCheck ); + return getImpl().Scroll( ndX, ndY, nRangeCheck ); } const SfxItemSet& EditView::GetEmptyItemSet() const @@ -575,10 +575,10 @@ const SfxItemSet& EditView::GetEmptyItemSet() const void EditView::SetAttribs( const SfxItemSet& rSet ) { - DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in..." ); + DBG_ASSERT( !getImpl().aEditSelection.IsInvalid(), "Blind Selection in..." ); - pImpEditView->DrawSelectionXOR(); - getEditEngine().SetAttribs( pImpEditView->GetEditSelection(), rSet, SetAttribsMode::WholeWord ); + getImpl().DrawSelectionXOR(); + getEditEngine().SetAttribs( getImpl().GetEditSelection(), rSet, SetAttribsMode::WholeWord ); if (getEditEngine().IsUpdateLayout()) getEditEngine().FormatAndLayout( this ); } @@ -586,9 +586,9 @@ void EditView::SetAttribs( const SfxItemSet& rSet ) void EditView::RemoveAttribsKeepLanguages( bool bRemoveParaAttribs ) { - pImpEditView->DrawSelectionXOR(); + getImpl().DrawSelectionXOR(); getEditEngine().UndoActionStart( EDITUNDO_RESETATTRIBS ); - EditSelection aSelection( pImpEditView->GetEditSelection() ); + EditSelection aSelection( getImpl().GetEditSelection() ); for (sal_uInt16 nWID = EE_ITEMS_START; nWID <= EE_ITEMS_END; ++nWID) { @@ -612,9 +612,9 @@ void EditView::RemoveAttribs( bool bRemoveParaAttribs, sal_uInt16 nWhich ) void EditView::RemoveAttribs( EERemoveParaAttribsMode eMode, sal_uInt16 nWhich ) { - pImpEditView->DrawSelectionXOR(); + getImpl().DrawSelectionXOR(); getEditEngine().UndoActionStart( EDITUNDO_RESETATTRIBS ); - getEditEngine().RemoveCharAttribs( pImpEditView->GetEditSelection(), eMode, nWhich ); + getEditEngine().RemoveCharAttribs( getImpl().GetEditSelection(), eMode, nWhich ); getEditEngine().UndoActionEnd(); if (getEditEngine().IsUpdateLayout()) getEditEngine().FormatAndLayout( this ); @@ -631,8 +631,8 @@ void EditView::RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich ) SfxItemSet EditView::GetAttribs() { - DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in..." ); - return getImpEditEngine().GetAttribs( pImpEditView->GetEditSelection() ); + DBG_ASSERT( !getImpl().aEditSelection.IsInvalid(), "Blind Selection in..." ); + return getImpEditEngine().GetAttribs( getImpl().GetEditSelection() ); } void EditView::Undo() @@ -647,15 +647,15 @@ void EditView::Redo() ErrCode EditView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ) { - EditSelection aOldSel( pImpEditView->GetEditSelection() ); - pImpEditView->DrawSelectionXOR(); + EditSelection aOldSel( getImpl().GetEditSelection() ); + getImpl().DrawSelectionXOR(); getImpEditEngine().UndoActionStart( EDITUNDO_READ ); EditPaM aEndPaM = getImpEditEngine().Read( rInput, "", eFormat, aOldSel, pHTTPHeaderAttrs ); getImpEditEngine().UndoActionEnd(); EditSelection aNewSel( aEndPaM, aEndPaM ); - pImpEditView->SetEditSelection( aNewSel ); - bool bGotoCursor = pImpEditView->DoAutoScroll(); + getImpl().SetEditSelection( aNewSel ); + bool bGotoCursor = getImpl().DoAutoScroll(); ShowCursor( bGotoCursor ); return rInput.GetError(); @@ -664,52 +664,52 @@ ErrCode EditView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterat void EditView::Cut() { Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard()); - pImpEditView->CutCopy( aClipBoard, true ); + getImpl().CutCopy( aClipBoard, true ); } Reference<css::datatransfer::clipboard::XClipboard> EditView::GetClipboard() const { - return pImpEditView->GetClipboard(); + return getImpl().GetClipboard(); } 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( getImpl().GetEditSelection() ); return xData; } void EditView::Copy() { Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard()); - pImpEditView->CutCopy( aClipBoard, false ); + getImpl().CutCopy( aClipBoard, false ); } void EditView::Paste() { Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard()); - pImpEditView->Paste( aClipBoard ); + getImpl().Paste( aClipBoard ); } void EditView::PasteSpecial(SotClipboardFormatId format) { Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard()); - pImpEditView->Paste(aClipBoard, true, format ); + getImpl().Paste(aClipBoard, true, format ); } Point EditView::GetWindowPosTopLeft( sal_Int32 nParagraph ) { Point aDocPos(getEditEngine().GetDocPosTopLeft(nParagraph)); - return pImpEditView->GetWindowPos( aDocPos ); + return getImpl().GetWindowPos( aDocPos ); } void EditView::SetSelectionMode( EESelectionMode eMode ) { - pImpEditView->SetSelectionMode( eMode ); + getImpl().SetSelectionMode( eMode ); } OUString EditView::GetSelected() const { - return getImpEditEngine().GetSelected( pImpEditView->GetEditSelection() ); + return getImpEditEngine().GetSelected( getImpl().GetEditSelection() ); } void EditView::MoveParagraphs( Range aParagraphs, sal_Int32 nNewPos ) @@ -733,50 +733,50 @@ void EditView::MoveParagraphs( tools::Long nDiff ) void EditView::SetBackgroundColor( const Color& rColor ) { - pImpEditView->SetBackgroundColor( rColor ); + getImpl().SetBackgroundColor( rColor ); getEditEngine().SetBackgroundColor( rColor ); } Color const & EditView::GetBackgroundColor() const { - return pImpEditView->GetBackgroundColor(); + return getImpl().GetBackgroundColor(); } void EditView::RegisterViewShell(OutlinerViewShell* pViewShell) { - pImpEditView->RegisterViewShell(pViewShell); + getImpl().RegisterViewShell(pViewShell); } void EditView::RegisterOtherShell(OutlinerViewShell* pOtherShell) { - pImpEditView->RegisterOtherShell(pOtherShell); + getImpl().RegisterOtherShell(pOtherShell); } void EditView::SetControlWord( EVControlBits nWord ) { - pImpEditView->nControl = nWord; + getImpl().nControl = nWord; } EVControlBits EditView::GetControlWord() const { - return pImpEditView->nControl; + return getImpl().nControl; } std::unique_ptr<EditTextObject> EditView::CreateTextObject() { - return getImpEditEngine().CreateTextObject( pImpEditView->GetEditSelection() ); + return getImpEditEngine().CreateTextObject( getImpl().GetEditSelection() ); } void EditView::InsertText( const EditTextObject& rTextObject ) { - pImpEditView->DrawSelectionXOR(); + getImpl().DrawSelectionXOR(); getEditEngine().UndoActionStart( EDITUNDO_INSERT ); - EditSelection aTextSel(getEditEngine().InsertText(rTextObject, pImpEditView->GetEditSelection())); + EditSelection aTextSel(getEditEngine().InsertText(rTextObject, getImpl().GetEditSelection())); getEditEngine().UndoActionEnd(); aTextSel.Min() = aTextSel.Max(); // Selection not retained. - pImpEditView->SetEditSelection( aTextSel ); + getImpl().SetEditSelection( aTextSel ); if (getEditEngine().IsUpdateLayout()) getEditEngine().FormatAndLayout( this ); } @@ -784,13 +784,13 @@ void EditView::InsertText( const EditTextObject& rTextObject ) void EditView::InsertText( css::uno::Reference< css::datatransfer::XTransferable > const & xDataObj, const OUString& rBaseURL, bool bUseSpecial ) { getEditEngine().UndoActionStart( EDITUNDO_INSERT ); - pImpEditView->DeleteSelected(); + getImpl().DeleteSelected(); EditSelection aTextSel = - getEditEngine().InsertText(xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial); + getEditEngine().InsertText(xDataObj, rBaseURL, getImpl().GetEditSelection().Max(), bUseSpecial); getEditEngine().UndoActionEnd(); aTextSel.Min() = aTextSel.Max(); // Selection not retained. - pImpEditView->SetEditSelection( aTextSel ); + getImpl().SetEditSelection( aTextSel ); if (getEditEngine().IsUpdateLayout()) getEditEngine().FormatAndLayout( this ); } @@ -807,7 +807,7 @@ void EditView::ForceLayoutCalculation() SfxStyleSheet* EditView::GetStyleSheet() { - EditSelection aSel( pImpEditView->GetEditSelection() ); + EditSelection aSel( getImpl().GetEditSelection() ); aSel.Adjust(getEditEngine().GetEditDoc()); sal_Int32 nStartPara = getEditEngine().GetEditDoc().GetPos( aSel.Min().GetNode() ); sal_Int32 nEndPara = getEditEngine().GetEditDoc().GetPos( aSel.Max().GetNode() ); @@ -830,33 +830,33 @@ const SfxStyleSheet* EditView::GetStyleSheet() const bool EditView::IsInsertMode() const { - return pImpEditView->IsInsertMode(); + return getImpl().IsInsertMode(); } void EditView::SetInsertMode( bool bInsert ) { - pImpEditView->SetInsertMode( bInsert ); + getImpl().SetInsertMode( bInsert ); } void EditView::SetAnchorMode( EEAnchorMode eMode ) { - pImpEditView->SetAnchorMode( eMode ); + getImpl().SetAnchorMode( eMode ); } EEAnchorMode EditView::GetAnchorMode() const { - return pImpEditView->GetAnchorMode(); + return getImpl().GetAnchorMode(); } void EditView::TransliterateText( TransliterationFlags nTransliterationMode ) { - EditSelection aOldSel( pImpEditView->GetEditSelection() ); - EditSelection aNewSel = getEditEngine().TransliterateText( pImpEditView->GetEditSelection(), nTransliterationMode ); + EditSelection aOldSel( getImpl().GetEditSelection() ); + EditSelection aNewSel = getEditEngine().TransliterateText( getImpl().GetEditSelection(), nTransliterationMode ); if ( aNewSel != aOldSel ) { - pImpEditView->DrawSelectionXOR(); - pImpEditView->SetEditSelection( aNewSel ); - pImpEditView->DrawSelectionXOR(); + getImpl().DrawSelectionXOR(); + getImpl().SetEditSelection( aNewSel ); + getImpl().DrawSelectionXOR(); } } @@ -864,11 +864,11 @@ void EditView::CompleteAutoCorrect( vcl::Window const * pFrameWin ) { if ( !HasSelection() && getImpEditEngine().GetStatus().DoAutoCorrect() ) { - pImpEditView->DrawSelectionXOR(); - EditSelection aSel = pImpEditView->GetEditSelection(); + getImpl().DrawSelectionXOR(); + EditSelection aSel = getImpl().GetEditSelection(); aSel = getEditEngine().EndOfWord( aSel.Max() ); aSel = getImpEditEngine().AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin ); - pImpEditView->SetEditSelection( aSel ); + getImpl().SetEditSelection( aSel ); if (getEditEngine().IsModified()) getEditEngine().FormatAndLayout( this ); } @@ -907,18 +907,18 @@ bool EditView::IsCursorAtWrongSpelledWord() bool bIsWrong = false; if ( !HasSelection() ) { - EditPaM aPaM = pImpEditView->GetEditSelection().Max(); - bIsWrong = pImpEditView->IsWrongSpelledWord( aPaM, false/*bMarkIfWrong*/ ); + EditPaM aPaM = getImpl().GetEditSelection().Max(); + bIsWrong = getImpl().IsWrongSpelledWord( aPaM, false/*bMarkIfWrong*/ ); } return bIsWrong; } bool EditView::IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWrong ) { - Point aPos(pImpEditView->GetOutputDevice().PixelToLogic(rPosPixel)); - aPos = pImpEditView->GetDocPos( aPos ); + Point aPos(getImpl().GetOutputDevice().PixelToLogic(rPosPixel)); + aPos = getImpl().GetDocPos( aPos ); EditPaM aPaM = getEditEngine().GetPaM(aPos, false); - return pImpEditView->IsWrongSpelledWord( aPaM , bMarkIfWrong ); + return getImpl().IsWrongSpelledWord( aPaM , bMarkIfWrong ); } static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, LanguageType nGuessLangWord, @@ -996,23 +996,23 @@ static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, LanguageType nGuessLa bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void> &rCallBack) { - OutputDevice& rDevice = pImpEditView->GetOutputDevice(); + OutputDevice& rDevice = getImpl().GetOutputDevice(); Point aPos(rDevice.PixelToLogic(rPosPixel)); - aPos = pImpEditView->GetDocPos( aPos ); + aPos = getImpl().GetDocPos( aPos ); EditPaM aPaM = getEditEngine().GetPaM(aPos, false); Reference< linguistic2::XSpellChecker1 > xSpeller(getImpEditEngine().GetSpeller()); ESelection aOldSel = GetSelection(); - if ( !(xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, true )) ) + if ( !(xSpeller.is() && getImpl().IsWrongSpelledWord( aPaM, true )) ) return false; // PaMtoEditCursor returns Logical units tools::Rectangle aTempRect = getImpEditEngine().PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly ); // GetWindowPos works in Logical units - aTempRect = pImpEditView->GetWindowPos(aTempRect); + aTempRect = getImpl().GetWindowPos(aTempRect); // Convert to pixels aTempRect = rDevice.LogicToPixel(aTempRect); - weld::Widget* pPopupParent = pImpEditView->GetPopupParent(aTempRect); + weld::Widget* pPopupParent = getImpl().GetPopupParent(aTempRect); std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "editeng/ui/spellmenu.ui")); std::unique_ptr<weld::Menu> xPopupMenu(xBuilder->weld_menu("editviewspellmenu")); std::unique_ptr<weld::Menu> xInsertMenu(xBuilder->weld_menu("insertmenu")); // add word to user-dictionaries @@ -1194,7 +1194,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac if (sId == "ignore") { - OUString aWord = pImpEditView->SpellIgnoreWord(); + OUString aWord = getImpl().SpellIgnoreWord(); SpellCallbackInfo aInf( SpellCallbackCommand::IGNOREWORD, aWord ); rCallBack.Call(aInf); SetSelection( aOldSel ); @@ -1289,38 +1289,38 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac OUString EditView::SpellIgnoreWord() { - return pImpEditView->SpellIgnoreWord(); + return getImpl().SpellIgnoreWord(); } void EditView::SelectCurrentWord( sal_Int16 nWordType ) { - EditSelection aCurSel( pImpEditView->GetEditSelection() ); - pImpEditView->DrawSelectionXOR(); + EditSelection aCurSel( getImpl().GetEditSelection() ); + getImpl().DrawSelectionXOR(); aCurSel = getEditEngine().SelectWord(aCurSel.Max(), nWordType); - pImpEditView->SetEditSelection( aCurSel ); - pImpEditView->DrawSelectionXOR(); + getImpl().SetEditSelection( aCurSel ); + getImpl().DrawSelectionXOR(); ShowCursor( true, false ); } void EditView::InsertParaBreak() { getEditEngine().UndoActionStart(EDITUNDO_INSERT); - pImpEditView->DeleteSelected(); - EditPaM aPaM(getEditEngine().InsertParaBreak(pImpEditView->GetEditSelection())); + getImpl().DeleteSelected(); + EditPaM aPaM(getEditEngine().InsertParaBreak(getImpl().GetEditSelection())); getEditEngine().UndoActionEnd(); - pImpEditView->SetEditSelection(EditSelection(aPaM, aPaM)); + getImpl().SetEditSelection(EditSelection(aPaM, aPaM)); if (getEditEngine().IsUpdateLayout()) getEditEngine().FormatAndLayout(this); } void EditView::InsertField( const SvxFieldItem& rFld ) { - EditEngine& rEditEngine = pImpEditView->getEditEngine(); - pImpEditView->DrawSelectionXOR(); + EditEngine& rEditEngine = getImpl().getEditEngine(); + getImpl().DrawSelectionXOR(); rEditEngine.UndoActionStart( EDITUNDO_INSERT ); - EditPaM aPaM(rEditEngine.InsertField(pImpEditView->GetEditSelection(), rFld)); + EditPaM aPaM(rEditEngine.InsertField(getImpl().GetEditSelection(), rFld)); rEditEngine.UndoActionEnd(); - pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) ); + getImpl().SetEditSelection( EditSelection( aPaM, aPaM ) ); rEditEngine.UpdateFields(); if (rEditEngine.IsUpdateLayout()) rEditEngine.FormatAndLayout( this ); @@ -1335,17 +1335,17 @@ const SvxFieldItem* EditView::GetFieldUnderMousePointer() const const SvxFieldItem* EditView::GetField( const Point& rPos, sal_Int32* pPara, sal_Int32* pPos ) const { - return pImpEditView->GetField( rPos, pPara, pPos ); + return getImpl().GetField( rPos, pPara, pPos ); } const SvxFieldItem* EditView::GetFieldUnderMousePointer( sal_Int32& nPara, sal_Int32& nPos ) const { Point aPos; - if (EditViewCallbacks* pEditViewCallbacks = pImpEditView->getEditViewCallbacks()) + if (EditViewCallbacks* pEditViewCallbacks = getImpl().getEditViewCallbacks()) aPos = pEditViewCallbacks->EditViewPointerPosPixel(); else - aPos = pImpEditView->GetWindow()->GetPointerPosPixel(); - OutputDevice& rDevice = pImpEditView->GetOutputDevice(); + aPos = getImpl().GetWindow()->GetPointerPosPixel(); + OutputDevice& rDevice = getImpl().GetOutputDevice(); aPos = rDevice.PixelToLogic(aPos); return GetField( aPos, &nPara, &nPos ); } @@ -1362,7 +1362,7 @@ const SvxFieldItem* EditView::GetFieldAtSelection(bool bAlsoCheckBeforeCursor) c const SvxFieldItem* EditView::GetFieldAtSelection(bool* pIsBeforeCursor) const { // a field is a dummy character - so it cannot span nodes or be a selection larger than 1 - EditSelection aSel( pImpEditView->GetEditSelection() ); + EditSelection aSel( getImpl().GetEditSelection() ); if (aSel.Min().GetNode() != aSel.Max().GetNode()) return nullptr; @@ -1441,9 +1441,6 @@ const SvxFieldData* EditView::GetFieldUnderMouseOrInSelectionOrAtCursor(bool bAl sal_Int32 EditView::countFieldsOffsetSum(sal_Int32 nPara, sal_Int32 nPos, bool bCanOverflow) const { - if (!pImpEditView) - return 0; - int nOffset = 0; for (int nCurrentPara = 0; nCurrentPara <= nPara; nCurrentPara++) @@ -1487,12 +1484,12 @@ sal_Int32 EditView::GetPosWithField(sal_Int32 nPara, sal_Int32 nPos) const void EditView::SetInvalidateMore( sal_uInt16 nPixel ) { - pImpEditView->SetInvalidateMore( nPixel ); + getImpl().SetInvalidateMore( nPixel ); } sal_uInt16 EditView::GetInvalidateMore() const { - return pImpEditView->GetInvalidateMore(); + return getImpl().GetInvalidateMore(); } static void ChangeFontSizeImpl( EditView* pEditView, bool bGrow, const ESelection& rSel, const FontList* pFontList ) @@ -1648,7 +1645,7 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo OUString EditView::GetSurroundingText() const { - EditSelection aSel( pImpEditView->GetEditSelection() ); + EditSelection aSel( getImpl().GetEditSelection() ); aSel.Adjust(getEditEngine().GetEditDoc()); if( HasSelection() ) @@ -1676,7 +1673,7 @@ Selection EditView::GetSurroundingTextSelection() const if( HasSelection() ) { - EditSelection aSel( pImpEditView->GetEditSelection() ); + EditSelection aSel( getImpl().GetEditSelection() ); aSel.Adjust(getEditEngine().GetEditDoc()); OUString aStr = getEditEngine().GetSelected(aSel); @@ -1705,99 +1702,99 @@ bool EditView::DeleteSurroundingText(const Selection& rRange) void EditView::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark) { - Point aDocPos(pImpEditView->GetDocPos(rPosition)); + Point aDocPos(getImpl().GetDocPos(rPosition)); EditPaM aPaM = getEditEngine().GetPaM(aDocPos); - EditSelection aSelection(pImpEditView->GetEditSelection()); + EditSelection aSelection(getImpl().GetEditSelection()); // Explicitly create or delete the selection. if (bClearMark) { - pImpEditView->DeselectAll(); - aSelection = pImpEditView->GetEditSelection(); + getImpl().DeselectAll(); + aSelection = getImpl().GetEditSelection(); } else - pImpEditView->CreateAnchor(); + getImpl().CreateAnchor(); if (bPoint) aSelection.Max() = aPaM; else aSelection.Min() = aPaM; - if (pImpEditView->GetEditSelection().Min() != aSelection.Min()) + if (getImpl().GetEditSelection().Min() != aSelection.Min()) { - const ContentNode* pNode(pImpEditView->GetEditSelection().Min().GetNode()); + const ContentNode* pNode(getImpl().GetEditSelection().Min().GetNode()); if (nullptr != pNode) pNode->checkAndDeleteEmptyAttribs(); } - pImpEditView->DrawSelectionXOR(aSelection); - if (pImpEditView->GetEditSelection() != aSelection) - pImpEditView->SetEditSelection(aSelection); + getImpl().DrawSelectionXOR(aSelection); + if (getImpl().GetEditSelection() != aSelection) + getImpl().SetEditSelection(aSelection); ShowCursor(/*bGotoCursor=*/false); } void EditView::DrawSelectionXOR(OutlinerViewShell* pOtherShell) { - pImpEditView->RegisterOtherShell(pOtherShell); - pImpEditView->DrawSelectionXOR(); - pImpEditView->RegisterOtherShell(nullptr); + getImpl().RegisterOtherShell(pOtherShell); + getImpl().DrawSelectionXOR(); + getImpl().RegisterOtherShell(nullptr); } void EditView::InitLOKSpecialPositioning(MapUnit eUnit, const tools::Rectangle& rOutputArea, const Point& rVisDocStartPos) { - pImpEditView->InitLOKSpecialPositioning(eUnit, rOutputArea, rVisDocStartPos); + getImpl().InitLOKSpecialPositioning(eUnit, rOutputArea, rVisDocStartPos); } void EditView::SetLOKSpecialOutputArea(const tools::Rectangle& rOutputArea) { - pImpEditView->SetLOKSpecialOutputArea(rOutputArea); + getImpl().SetLOKSpecialOutputArea(rOutputArea); } const tools::Rectangle & EditView::GetLOKSpecialOutputArea() const { - return pImpEditView->GetLOKSpecialOutputArea(); + return getImpl().GetLOKSpecialOutputArea(); } void EditView::SetLOKSpecialVisArea(const tools::Rectangle& rVisArea) { - pImpEditView->SetLOKSpecialVisArea(rVisArea); + getImpl().SetLOKSpecialVisArea(rVisArea); } tools::Rectangle EditView::GetLOKSpecialVisArea() const { - return pImpEditView->GetLOKSpecialVisArea(); + return getImpl().GetLOKSpecialVisArea(); } bool EditView::HasLOKSpecialPositioning() const { - return pImpEditView->HasLOKSpecialPositioning(); + return getImpl().HasLOKSpecialPositioning(); } void EditView::SetLOKSpecialFlags(LOKSpecialFlags eFlags) { - pImpEditView->SetLOKSpecialFlags(eFlags); + getImpl().SetLOKSpecialFlags(eFlags); } void EditView::SuppressLOKMessages(bool bSet) { - pImpEditView->SuppressLOKMessages(bSet); + getImpl().SuppressLOKMessages(bSet); } bool EditView::IsSuppressLOKMessages() const { - return pImpEditView->IsSuppressLOKMessages(); + return getImpl().IsSuppressLOKMessages(); } void EditView::SetNegativeX(bool bSet) { - pImpEditView->SetNegativeX(bSet); + getImpl().SetNegativeX(bSet); } bool EditView::IsNegativeX() const { - return pImpEditView->IsNegativeX(); + return getImpl().IsNegativeX(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 8fbeefcf3908..c9fdc2bfde3b 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -62,8 +62,7 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) { pSpellInfo->bSpellToEnd = false; pSpellInfo->aSpellTo = pSpellInfo->aSpellStart; - pEditView->GetImpEditView()->SetEditSelection( - rEditEngine.GetEditDoc().GetStartPaM() ); + pEditView->getImpl().SetEditSelection(rEditEngine.GetEditDoc().GetStartPaM()); } else { @@ -87,8 +86,7 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) { pSpellInfo->bSpellToEnd = false; pSpellInfo->aSpellTo = pSpellInfo->aSpellStart; - pEditView->GetImpEditView()->SetEditSelection( - rEditEngine.GetEditDoc().GetEndPaM() ); + pEditView->getImpl().SetEditSelection(rEditEngine.GetEditDoc().GetEndPaM()); } } else if ( eArea == SvxSpellArea::Body ) @@ -119,8 +117,7 @@ bool EditSpellWrapper::SpellMore() { // The text has been entered into the engine, when backwards then // it must be behind the selection. - pEditView->GetImpEditView()->SetEditSelection( - rEditEngine.GetEditDoc().GetStartPaM() ); + pEditView->getImpl().SetEditSelection(rEditEngine.GetEditDoc().GetStartPaM()); } } return bMore; @@ -137,7 +134,7 @@ void EditSpellWrapper::CheckSpellTo() { ImpEditEngine& rImpEditEngine = pEditView->getImpEditEngine(); SpellInfo* pSpellInfo = rImpEditEngine.GetSpellInfo(); - EditPaM aPaM( pEditView->GetImpEditView()->GetEditSelection().Max() ); + EditPaM aPaM( pEditView->getImpl().GetEditSelection().Max() ); EPaM aEPaM = rImpEditEngine.CreateEPaM( aPaM ); if ( aEPaM.nPara == pSpellInfo->aSpellTo.nPara ) { diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 0ff7c9c477c1..46a209f831fa 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -311,7 +311,7 @@ bool ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pView ) GetSelEngine().SelMouseButtonDown( rMEvt ); // Special treatment - EditSelection aCurSel( pView->pImpEditView->GetEditSelection() ); + EditSelection aCurSel( pView->getImpl().GetEditSelection() ); if ( rMEvt.IsShift() ) return true; @@ -321,9 +321,9 @@ bool ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pView ) maSelEngine.CursorPosChanging( true, false ); EditSelection aNewSelection( SelectWord( aCurSel ) ); - pView->pImpEditView->DrawSelectionXOR(); - pView->pImpEditView->SetEditSelection( aNewSelection ); - pView->pImpEditView->DrawSelectionXOR(); + pView->getImpl().DrawSelectionXOR(); + pView->getImpl().SetEditSelection( aNewSelection ); + pView->getImpl().DrawSelectionXOR(); pView->ShowCursor(); } else if ( rMEvt.GetClicks() == 3 ) @@ -334,9 +334,9 @@ bool ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pView ) EditSelection aNewSelection( aCurSel ); aNewSelection.Min().SetIndex( 0 ); aNewSelection.Max().SetIndex( aCurSel.Min().GetNode()->Len() ); - pView->pImpEditView->DrawSelectionXOR(); - pView->pImpEditView->SetEditSelection( aNewSelection ); - pView->pImpEditView->DrawSelectionXOR(); + pView->getImpl().DrawSelectionXOR(); + pView->getImpl().SetEditSelection( aNewSelection ); + pView->getImpl().DrawSelectionXOR(); pView->ShowCursor(); } return true; @@ -352,7 +352,7 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) { pView->DeleteSelected(); mpIMEInfos.reset(); - EditPaM aPaM = pView->GetImpEditView()->GetEditSelection().Max(); + EditPaM aPaM = pView->getImpl().GetEditSelection().Max(); OUString aOldTextAfterStartPos = aPaM.GetNode()->Copy( aPaM.GetIndex() ); sal_Int32 nMax = aOldTextAfterStartPos.indexOf( CH_FEATURE ); if ( nMax != -1 ) // don't overwrite features! @@ -384,7 +384,7 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) { aSel = DeleteSelected( aSel ); aSel = AutoCorrect( aSel, nCharCode, mpIMEInfos->bWasCursorOverwrite ); - pView->pImpEditView->SetEditSelection( aSel ); + pView->getImpl().SetEditSelection( aSel ); } } @@ -477,7 +477,7 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) { if (mpIMEInfos) { - EditPaM aPaM( pView->pImpEditView->GetEditSelection().Max() ); + EditPaM aPaM( pView->getImpl().GetEditSelection().Max() ); tools::Rectangle aR1 = PaMtoEditCursor( aPaM ); sal_Int32 nInputEnd = mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen; @@ -493,7 +493,7 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) if ( nInputEnd > rLine.GetEnd() ) nInputEnd = rLine.GetEnd(); tools::Rectangle aR2 = PaMtoEditCursor( EditPaM( aPaM.GetNode(), nInputEnd ), GetCursorFlags::EndOfLine ); - tools::Rectangle aRect = pView->GetImpEditView()->GetWindowPos( aR1 ); + tools::Rectangle aRect = pView->getImpl().GetWindowPos( aR1 ); auto nExtTextInputWidth = aR2.Left() - aR1.Right(); if (EditViewCallbacks* pEditViewCallbacks = pView->getEditViewCallbacks()) pEditViewCallbacks->EditViewCursorRect(aRect, nExtTextInputWidth); @@ -547,7 +547,7 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) { if (mpIMEInfos) { - EditPaM aPaM( pView->pImpEditView->GetEditSelection().Max() ); + EditPaM aPaM( pView->getImpl().GetEditSelection().Max() ); if ( !IsFormatted() ) FormatDoc(); @@ -580,7 +580,7 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) { tools::Rectangle aR = GetEditCursor(*pParaPortion, *rInfo.pLine, n, GetCursorFlags::NONE); aR.Move(getTopLeftDocOffset(rInfo.aArea)); - aRects[n - nMinPos] = pView->GetImpEditView()->GetWindowPos(aR); + aRects[n - nMinPos] = pView->getImpl().GetWindowPos(aR); } } } @@ -613,7 +613,7 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent& rMEvt, EditView* pView ) mbInSelection = false; // Special treatments - EditSelection aCurSel( pView->pImpEditView->GetEditSelection() ); + EditSelection aCurSel( pView->getImpl().GetEditSelection() ); if ( aCurSel.HasRange() ) return true; @@ -683,7 +683,7 @@ void ImpEditEngine::Clear() for (size_t nView = maEditViews.size(); nView; ) { EditView* pView = maEditViews[--nView]; - pView->pImpEditView->SetEditSelection( aSel ); + pView->getImpl().SetEditSelection( aSel ); } // Related: tdf#82115 Fix crash when handling input method events. @@ -701,7 +701,7 @@ EditPaM ImpEditEngine::RemoveText() EditSelection aEmptySel( aStartPaM, aStartPaM ); for (EditView* pView : maEditViews) { - pView->pImpEditView->SetEditSelection( aEmptySel ); + pView->getImpl().SetEditSelection( aEmptySel ); } ResetUndoManager(); return maEditDoc.GetStartPaM(); @@ -723,7 +723,7 @@ void ImpEditEngine::SetText(const OUString& rText) for (EditView* pView : maEditViews) { - pView->pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) ); + pView->getImpl().SetEditSelection( EditSelection( aPaM, aPaM ) ); // If no text then also no Format&Update // => The text remains. if (rText.isEmpty() && IsUpdateLayout()) @@ -802,7 +802,7 @@ EditSelection const & ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, Edit // Actually, only necessary for up/down, but whatever. CheckIdleFormatter(); - EditPaM aPaM(pEditView->pImpEditView->GetEditSelection().Max()); + EditPaM aPaM(pEditView->getImpl().GetEditSelection().Max()); EditPaM aOldPaM( aPaM ); @@ -950,30 +950,30 @@ EditSelection const & ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, Edit // May cause, a CreateAnchor or deselection all maSelEngine.SetCurView(pEditView); maSelEngine.CursorPosChanging( bKeyModifySelection, aTranslatedKeyEvent.GetKeyCode().IsMod1() ); - EditPaM aOldEnd(pEditView->pImpEditView->GetEditSelection().Max()); + EditPaM aOldEnd(pEditView->getImpl().GetEditSelection().Max()); { - EditSelection aNewSelection(pEditView->pImpEditView->GetEditSelection()); + EditSelection aNewSelection(pEditView->getImpl().GetEditSelection()); aNewSelection.Max() = aPaM; - pEditView->pImpEditView->SetEditSelection(aNewSelection); - // const_cast<EditPaM&>(pEditView->pImpEditView->GetEditSelection().Max()) = aPaM; + pEditView->getImpl().SetEditSelection(aNewSelection); + // const_cast<EditPaM&>(pEditView->getImpl().GetEditSelection().Max()) = aPaM; } if ( bKeyModifySelection ) { // Then the selection is expanded ... or the whole selection is painted in case of tiled rendering. - EditSelection aTmpNewSel( comphelper::LibreOfficeKit::isActive() ? pEditView->pImpEditView->GetEditSelection().Min() : aOldEnd, aPaM ); - pEditView->pImpEditView->DrawSelectionXOR( aTmpNewSel ); + EditSelection aTmpNewSel( comphelper::LibreOfficeKit::isActive() ? pEditView->getImpl().GetEditSelection().Min() : aOldEnd, aPaM ); + pEditView->getImpl().DrawSelectionXOR( aTmpNewSel ); } else { - EditSelection aNewSelection(pEditView->pImpEditView->GetEditSelection()); + EditSelection aNewSelection(pEditView->getImpl().GetEditSelection()); aNewSelection.Min() = aPaM; - pEditView->pImpEditView->SetEditSelection(aNewSelection); - // const_cast<EditPaM&>(pEditView->pImpEditView->GetEditSelection().Min()) = aPaM; + pEditView->getImpl().SetEditSelection(aNewSelection); + // const_cast<EditPaM&>(pEditView->getImpl().GetEditSelection().Min()) = aPaM; } - return pEditView->pImpEditView->GetEditSelection(); + return pEditView->getImpl().GetEditSelection(); } EditPaM ImpEditEngine::CursorVisualStartEnd( EditView const * mpEditView, const EditPaM& rPaM, bool bStart ) @@ -989,7 +989,7 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView const * mpEditView, const const EditLine& rLine = pParaPortion->GetLines()[nLine]; bool bEmptyLine = rLine.GetStart() == rLine.GetEnd(); - mpEditView->pImpEditView->nExtraCursorFlags = GetCursorFlags::NONE; + mpEditView->getImpl().nExtraCursorFlags = GetCursorFlags::NONE; if ( !bEmptyLine ) { @@ -1015,14 +1015,14 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView const * mpEditView, const if ( bStart ) { - mpEditView->pImpEditView->SetCursorBidiLevel( bPortionRTL ? 0 : 1 ); + mpEditView->getImpl().SetCursorBidiLevel( bPortionRTL ? 0 : 1 ); // Maybe we must be *behind* the character if (bPortionRTL && mpEditView->IsInsertMode()) aPaM.SetIndex( aPaM.GetIndex()+1 ); } else { - mpEditView->pImpEditView->SetCursorBidiLevel( bPortionRTL ? 1 : 0 ); + mpEditView->getImpl().SetCursorBidiLevel( bPortionRTL ? 1 : 0 ); if ( !bPortionRTL && mpEditView->IsInsertMode() ) aPaM.SetIndex( aPaM.GetIndex()+1 ); } @@ -1044,7 +1044,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView const * pEditView, const const EditLine& rLine = pParaPortion->GetLines()[nLine]; bool bEmptyLine = rLine.GetStart() == rLine.GetEnd(); - pEditView->pImpEditView->nExtraCursorFlags = GetCursorFlags::NONE; + pEditView->getImpl().nExtraCursorFlags = GetCursorFlags::NONE; bool bParaRTL = IsRightToLeft( nPara ); @@ -1095,12 +1095,12 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView const * pEditView, const if (bVisualToLeft != bool(nRTLLevel % 2)) { aPaM = CursorLeft( aPaM, nCharacterIteratorMode ); - pEditView->pImpEditView->SetCursorBidiLevel( 1 ); + pEditView->getImpl().SetCursorBidiLevel( 1 ); } else { aPaM = CursorRight( aPaM, nCharacterIteratorMode ); - pEditView->pImpEditView->SetCursorBidiLevel( 0 ); + pEditView->getImpl().SetCursorBidiLevel( 0 ); } bDone = true; } @@ -1140,13 +1140,13 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView const * pEditView, const if ( !bGotoEndOfPrevLine && !bGotoStartOfNextLine ) { aPaM.SetIndex( rLine.GetStart() + ubidi_getLogicalIndex( pBidi, nVisPos, &nError ) ); - pEditView->pImpEditView->SetCursorBidiLevel( 0 ); + pEditView->getImpl().SetCursorBidiLevel( 0 ); } } else { bool bWasBehind = false; - bool bBeforePortion = !nPosInLine || pEditView->pImpEditView->GetCursorBidiLevel() == 1; + bool bBeforePortion = !nPosInLine || pEditView->getImpl().GetCursorBidiLevel() == 1; if ( nPosInLine && ( !bBeforePortion ) ) // before the next portion bWasBehind = true; // step one back, otherwise visual will be unusable when rtl portion follows. @@ -1185,7 +1185,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView const * pEditView, const else if ( !bVisualToLeft && bRTLPortion && ( bWasBehind || !_rTextPortion.IsRightToLeft() ) ) aPaM.SetIndex( aPaM.GetIndex()+1 ); - pEditView->pImpEditView->SetCursorBidiLevel( _nPortionStart ); + pEditView->getImpl().SetCursorBidiLevel( _nPortionStart ); } } @@ -1272,13 +1272,13 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView const * pView ) const EditLine& rLine = pPPortion->GetLines()[nLine]; tools::Long nX; - if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW ) + if ( pView->getImpl().nTravelXPos == TRAVEL_X_DONTKNOW ) { nX = GetXPos(*pPPortion, rLine, rPaM.GetIndex()); - pView->pImpEditView->nTravelXPos = nX + mnOnePixelInRef; + pView->getImpl().nTravelXPos = nX + mnOnePixelInRef; } else - nX = pView->pImpEditView->nTravelXPos; + nX = pView->getImpl().nTravelXPos; EditPaM aNewPaM( rPaM ); if ( nLine ) // same paragraph @@ -1315,14 +1315,14 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView const * pView ) sal_Int32 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); tools::Long nX; - if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW ) + if ( pView->getImpl().nTravelXPos == TRAVEL_X_DONTKNOW ) { const EditLine& rLine = pPPortion->GetLines()[nLine]; nX = GetXPos(*pPPortion, rLine, rPaM.GetIndex()); - pView->pImpEditView->nTravelXPos = nX + mnOnePixelInRef; + pView->getImpl().nTravelXPos = nX + mnOnePixelInRef; } else - nX = pView->pImpEditView->nTravelXPos; + nX = pView->getImpl().nTravelXPos; EditPaM aNewPaM( rPaM ); if ( nLine < pPPortion->GetLines().Count()-1 ) @@ -3726,7 +3726,7 @@ void ImpEditEngine::UpdateSelections() // If the node is valid, the index has yet to be examined! for (EditView* pView : maEditViews) { - EditSelection aCurSel( pView->pImpEditView->GetEditSelection() ); + EditSelection aCurSel( pView->getImpl().GetEditSelection() ); bool bChanged = false; for (const std::unique_ptr<DeletedNodeInfo> & aDeletedNode : maDeletedNodes) { @@ -3757,7 +3757,7 @@ void ImpEditEngine::UpdateSelections() ParaPortion& rParaPortion = GetParaPortions().getRef(nPara); EditSelection aTmpSelection(EditPaM(rParaPortion.GetNode(), 0)); - pView->pImpEditView->SetEditSelection( aTmpSelection ); + pView->getImpl().SetEditSelection( aTmpSelection ); bChanged=true; break; // for loop } @@ -3768,12 +3768,12 @@ void ImpEditEngine::UpdateSelections() if ( aCurSel.Min().GetIndex() > aCurSel.Min().GetNode()->Len() ) { aCurSel.Min().SetIndex( aCurSel.Min().GetNode()->Len() ); - pView->pImpEditView->SetEditSelection( aCurSel ); + pView->getImpl().SetEditSelection( aCurSel ); } if ( aCurSel.Max().GetIndex() > aCurSel.Max().GetNode()->Len() ) { aCurSel.Max().SetIndex( aCurSel.Max().GetNode()->Len() ); - pView->pImpEditView->SetEditSelection( aCurSel ); + pView->getImpl().SetEditSelection( aCurSel ); } } } @@ -3825,12 +3825,12 @@ void ImpEditEngine::SetActiveView( EditView* pView ) return; if (mpActiveView && mpActiveView->HasSelection()) - mpActiveView->pImpEditView->DrawSelectionXOR(); + mpActiveView->getImpl().DrawSelectionXOR(); mpActiveView = pView; if (mpActiveView && mpActiveView->HasSelection()) - mpActiveView->pImpEditView->DrawSelectionXOR(); + mpActiveView->getImpl().DrawSelectionXOR(); // NN: Quick fix for #78668#: // When editing of a cell in Calc is ended, the edit engine is not deleted, diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b03c9d0f330b..bc0bf2823037 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -332,7 +332,7 @@ void ImpEditEngine::UpdateViews( EditView* pCurView ) if ( !aClipRect.IsEmpty() ) { // convert to window coordinates... - aClipRect = pView->pImpEditView->GetWindowPos( aClipRect ); + aClipRect = pView->getImpl().GetWindowPos( aClipRect ); // moved to one executing method to allow finer control pView->InvalidateWindow(aClipRect); @@ -343,7 +343,7 @@ void ImpEditEngine::UpdateViews( EditView* pCurView ) if ( pCurView ) { - bool bGotoCursor = pCurView->pImpEditView->DoAutoScroll(); + bool bGotoCursor = pCurView->getImpl().DoAutoScroll(); pCurView->ShowCursor( bGotoCursor ); } @@ -442,8 +442,7 @@ void ImpEditEngine::FormatDoc() for (EditView* pView : maEditViews) { - ImpEditView* pImpView = pView->pImpEditView.get(); - pImpView->ScrollStateChange(); + pView->getImpl().ScrollStateChange(); } } @@ -479,16 +478,15 @@ void ImpEditEngine::FormatDoc() { for (EditView* pView : maEditViews) { - ImpEditView* pImpView = pView->pImpEditView.get(); - if ( pImpView->DoAutoHeight() ) + ImpEditView& rImpView = pView->getImpl(); + if (rImpView.DoAutoHeight()) { - Size aSz( pImpView->GetOutputArea().GetWidth(), mnCurTextHeight ); + Size aSz(rImpView.GetOutputArea().GetWidth(), mnCurTextHeight); if ( aSz.Height() > maMaxAutoPaperSize.Height() ) aSz.setHeight( maMaxAutoPaperSize.Height() ); else if ( aSz.Height() < maMinAutoPaperSize.Height() ) aSz.setHeight( maMinAutoPaperSize.Height() ); - pImpView->ResetOutputArea( tools::Rectangle( - pImpView->GetOutputArea().TopLeft(), aSz ) ); + rImpView.ResetOutputArea( tools::Rectangle(rImpView.GetOutputArea().TopLeft(), aSz)); } } } @@ -587,7 +585,7 @@ void ImpEditEngine::CheckAutoPageSize() for (EditView* pView : maEditViews) { - pView->pImpEditView->RecalcOutputArea(); + pView->getImpl().RecalcOutputArea(); } } diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 9db6b3ebfc54..6bab867f012e 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1484,10 +1484,10 @@ EESpellState ImpEditEngine::Spell(EditView* pEditView, weld::Widget* pDialogPare // In MultipleDoc always from the front / rear ... if ( bMultipleDoc ) { - pEditView->pImpEditView->SetEditSelection( maEditDoc.GetStartPaM() ); + pEditView->getImpl().SetEditSelection( maEditDoc.GetStartPaM() ); } - EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); + EditSelection aCurSel( pEditView->getImpl().GetEditSelection() ); CreateSpellInfo( bMultipleDoc ); bool bIsStart = false; @@ -1503,12 +1503,12 @@ EESpellState ImpEditEngine::Spell(EditView* pEditView, weld::Widget* pDialogPare if ( !bMultipleDoc ) { - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); if ( aCurSel.Max().GetIndex() > aCurSel.Max().GetNode()->Len() ) aCurSel.Max().SetIndex( aCurSel.Max().GetNode()->Len() ); aCurSel.Min() = aCurSel.Max(); - pEditView->pImpEditView->SetEditSelection( aCurSel ); - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().SetEditSelection( aCurSel ); + pEditView->getImpl().DrawSelectionXOR(); pEditView->ShowCursor( true, false ); } EESpellState eState = mpSpellInfo->eState; @@ -1559,11 +1559,11 @@ void ImpEditEngine::Convert( EditView* pEditView, weld::Widget* pDialogParent, // In MultipleDoc always from the front / rear ... if ( bMultipleDoc ) - pEditView->pImpEditView->SetEditSelection( maEditDoc.GetStartPaM() ); + pEditView->getImpl().SetEditSelection( maEditDoc.GetStartPaM() ); // initialize pConvInfo - EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); + EditSelection aCurSel( pEditView->getImpl().GetEditSelection() ); aCurSel.Adjust( maEditDoc ); mpConvInfo.reset(new ConvInfo); mpConvInfo->bMultipleDoc = bMultipleDoc; @@ -1624,12 +1624,12 @@ void ImpEditEngine::Convert( EditView* pEditView, weld::Widget* pDialogParent, if ( !bMultipleDoc ) { - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); if ( aCurSel.Max().GetIndex() > aCurSel.Max().GetNode()->Len() ) aCurSel.Max().SetIndex( aCurSel.Max().GetNode()->Len() ); aCurSel.Min() = aCurSel.Max(); - pEditView->pImpEditView->SetEditSelection( aCurSel ); - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().SetEditSelection( aCurSel ); + pEditView->getImpl().DrawSelectionXOR(); pEditView->ShowCursor( true, false ); } mpConvInfo.reset(); @@ -1825,9 +1825,9 @@ void ImpEditEngine::ImpConvert( OUString &rConvTxt, LanguageType &rConvTxtLang, mpConvInfo->aConvContinue = CreateEPaM( aCurSel.Max() ); } - pEditView->pImpEditView->DrawSelectionXOR(); - pEditView->pImpEditView->SetEditSelection( aCurSel ); - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); + pEditView->getImpl().SetEditSelection( aCurSel ); + pEditView->getImpl().DrawSelectionXOR(); pEditView->ShowCursor( true, false ); rConvTxt = aRes; @@ -1841,7 +1841,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView ) DBG_ASSERT(mxSpeller.is(), "No spell checker set!"); ContentNode* pLastNode = maEditDoc.GetObject( maEditDoc.Count()-1 ); - EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); + EditSelection aCurSel( pEditView->getImpl().GetEditSelection() ); aCurSel.Min() = aCurSel.Max(); Reference< XSpellAlternatives > xSpellAlt; @@ -1894,9 +1894,9 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView ) mpSpellInfo->eState = EESpellState::ErrorFound; } - pEditView->pImpEditView->DrawSelectionXOR(); - pEditView->pImpEditView->SetEditSelection( aCurSel ); - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); + pEditView->getImpl().SetEditSelection( aCurSel ); + pEditView->getImpl().DrawSelectionXOR(); pEditView->ShowCursor( true, false ); return xSpellAlt; } @@ -1949,7 +1949,7 @@ bool ImpEditEngine::SpellSentence(EditView const & rEditView, svx::SpellPortions& rToFill ) { bool bRet = false; - EditSelection aCurSel( rEditView.pImpEditView->GetEditSelection() ); + EditSelection aCurSel( rEditView.getImpl().GetEditSelection() ); if (!mpSpellInfo) CreateSpellInfo( true ); mpSpellInfo->aCurSentenceStart = aCurSel.Min(); @@ -1999,7 +1999,7 @@ bool ImpEditEngine::SpellSentence(EditView const & rEditView, while( xAlt.is() ); //set the selection to the end of the current sentence - rEditView.pImpEditView->SetEditSelection(aSentencePaM.Max()); + rEditView.getImpl().SetEditSelection(aSentencePaM.Max()); } return bRet; } @@ -2050,7 +2050,7 @@ void ImpEditEngine::AddPortionIterated( //iterate over the text to find changes in language //set the mark equal to the point EditPaM aCursor(aStart); - rEditView.pImpEditView->SetEditSelection( aCursor ); + rEditView.getImpl().SetEditSelection( aCursor ); LanguageType eStartLanguage = GetLanguage( aCursor ).nLang; //search for a field attribute at the beginning - only the end position //of this field is kept to end a portion at that position @@ -2108,7 +2108,7 @@ void ImpEditEngine::ApplyChangedSentence(EditView const & rEditView, // get current paragraph length to calculate later on how the sentence length changed, // in order to place the cursor at the end of the sentence again - EditSelection aOldSel( rEditView.pImpEditView->GetEditSelection() ); + EditSelection aOldSel( rEditView.getImpl().GetEditSelection() ); sal_Int32 nOldLen = aOldSel.Max().GetNode()->Len(); UndoActionStart( EDITUNDO_INSERT ); @@ -2134,7 +2134,7 @@ void ImpEditEngine::ApplyChangedSentence(EditView const & rEditView, if(!bSetToEnd) { bSetToEnd = true; - rEditView.pImpEditView->SetEditSelection( aCurrentOldPosition->Max() ); + rEditView.getImpl().SetEditSelection( aCurrentOldPosition->Max() ); } SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage ); @@ -2208,11 +2208,11 @@ void ImpEditEngine::ApplyChangedSentence(EditView const & rEditView, // restore cursor position to the end of the modified sentence. // (This will define the continuation position for spell/grammar checking) // First: check if the sentence/para length changed - const sal_Int32 nDelta = rEditView.pImpEditView->GetEditSelection().Max().GetNode()->Len() - nOldLen; + const sal_Int32 nDelta = rEditView.getImpl().GetEditSelection().Max().GetNode()->Len() - nOldLen; const sal_Int32 nEndOfSentence = aOldSel.Max().GetIndex() + nDelta; aNext = EditPaM( aOldSel.Max().GetNode(), nEndOfSentence ); } - rEditView.pImpEditView->SetEditSelection( aNext ); + rEditView.getImpl().SetEditSelection( aNext ); if (IsUpdateLayout()) FormatAndLayout(); @@ -2223,7 +2223,7 @@ void ImpEditEngine::PutSpellingToSentenceStart( EditView const & rEditView ) { if (mpSpellInfo && !mpSpellInfo->aLastSpellContentSelections.empty()) { - rEditView.pImpEditView->SetEditSelection(mpSpellInfo->aLastSpellContentSelections.begin()->Min()); + rEditView.getImpl().SetEditSelection(mpSpellInfo->aLastSpellContentSelections.begin()->Min()); } } @@ -2247,7 +2247,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, bool bSpellAtC EditPaM aCursorPos; if (mpActiveView && !bSpellAtCursorPos) { - aCursorPos = mpActiveView->pImpEditView->GetEditSelection().Max(); + aCursorPos = mpActiveView->getImpl().GetEditSelection().Max(); } bool bRestartTimer = false; @@ -2398,8 +2398,8 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, bool bSpellAtC if ( !aClipRect.IsEmpty() ) { // convert to window coordinates... - aClipRect.SetPos( pView->pImpEditView->GetWindowPos( aClipRect.TopLeft() ) ); - pView->pImpEditView->InvalidateAtWindow(aClipRect); + aClipRect.SetPos( pView->getImpl().GetWindowPos( aClipRect.TopLeft() ) ); + pView->getImpl().InvalidateAtWindow(aClipRect); } } } @@ -2466,7 +2466,7 @@ void ImpEditEngine::ClearSpellErrors() EESpellState ImpEditEngine::StartThesaurus(EditView* pEditView, weld::Widget* pDialogParent) { - EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); + EditSelection aCurSel( pEditView->getImpl().GetEditSelection() ); if ( !aCurSel.HasRange() ) aCurSel = SelectWord( aCurSel, css::i18n::WordType::DICTIONARY_WORD ); OUString aWord( GetSelected( aCurSel ) ); @@ -2481,9 +2481,9 @@ EESpellState ImpEditEngine::StartThesaurus(EditView* pEditView, weld::Widget* pD if (xDlg->Execute() == RET_OK) { // Replace Word... - pEditView->pImpEditView->DrawSelectionXOR(); - pEditView->pImpEditView->SetEditSelection( aCurSel ); - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); + pEditView->getImpl().SetEditSelection( aCurSel ); + pEditView->getImpl().DrawSelectionXOR(); pEditView->InsertText(xDlg->GetWord()); pEditView->ShowCursor(true, false); } @@ -2495,7 +2495,7 @@ sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSe { sal_Int32 nFound = 0; - EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); + EditSelection aCurSel( pEditView->getImpl().GetEditSelection() ); // FIND_ALL is not possible without multiple selection. if ( ( rSearchItem.GetCommand() == SvxSearchCmd::FIND ) || @@ -2523,7 +2523,7 @@ sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSe SvxSearchItem aTmpItem( rSearchItem ); aTmpItem.SetBackward( false ); - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); aCurSel.Adjust( maEditDoc ); EditPaM aStartPaM = aTmpItem.GetSelection() ? aCurSel.Min() : maEditDoc.GetStartPaM(); @@ -2542,13 +2542,13 @@ sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSe EditPaM aNewPaM( aFoundSel.Max() ); if ( aNewPaM.GetIndex() > aNewPaM.GetNode()->Len() ) aNewPaM.SetIndex( aNewPaM.GetNode()->Len() ); - pEditView->pImpEditView->SetEditSelection( aNewPaM ); + pEditView->getImpl().SetEditSelection( aNewPaM ); FormatAndLayout( pEditView ); UndoActionEnd(); } else { - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); pEditView->ShowCursor( true, false ); } } @@ -2557,7 +2557,7 @@ sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSe bool ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEditView ) { - EditSelection aSel( pEditView->pImpEditView->GetEditSelection() ); + EditSelection aSel( pEditView->getImpl().GetEditSelection() ); aSel.Adjust( maEditDoc ); EditPaM aStartPaM( aSel.Max() ); if ( rSearchItem.GetSelection() && !rSearchItem.GetBackward() ) @@ -2571,18 +2571,18 @@ bool ImpEditEngine::Search( const SvxSearchItem& rSearchItem, EditView* pEditVie bFound = ImpSearch( rSearchItem, aSel, aStartPaM, aFoundSel ); } - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); if ( bFound ) { // First, set the minimum, so the whole word is in the visible range. - pEditView->pImpEditView->SetEditSelection( aFoundSel.Min() ); + pEditView->getImpl().SetEditSelection( aFoundSel.Min() ); pEditView->ShowCursor( true, false ); - pEditView->pImpEditView->SetEditSelection( aFoundSel ); + pEditView->getImpl().SetEditSelection( aFoundSel ); } else - pEditView->pImpEditView->SetEditSelection( aSel.Max() ); + pEditView->getImpl().SetEditSelection( aSel.Max() ); - pEditView->pImpEditView->DrawSelectionXOR(); + pEditView->getImpl().DrawSelectionXOR(); pEditView->ShowCursor( true, false ); return bFound; } diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index b60de1944be5..8a4b39b47e71 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -224,7 +224,7 @@ ViewShellId ImpEditEngine::CreateViewShellId() ViewShellId nRet(-1); const EditView* pEditView = mpEditEngine ? mpEditEngine->GetActiveView() : nullptr; - const OutlinerViewShell* pViewShell = pEditView ? pEditView->GetImpEditView()->GetViewShell() : nullptr; + const OutlinerViewShell* pViewShell = pEditView ? pEditView->getImpl().GetViewShell() : nullptr; if (pViewShell) nRet = pViewShell->GetViewShellId(); diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index e7d3f1574ce4..0534d3420cc4 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -131,7 +131,7 @@ bool TextConvWrapper::ConvMore_impl() if ( bMore ) { // The text has been entered in this engine ... - m_pEditView->GetImpEditView()->SetEditSelection( + m_pEditView->getImpl().SetEditSelection( rEditEngine.GetEditDoc().GetStartPaM() ); } } @@ -155,7 +155,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) pConvInfo->bConvToEnd = false; pConvInfo->aConvTo = pConvInfo->aConvStart; pConvInfo->aConvContinue = EPaM( 0, 0 ); - m_pEditView->GetImpEditView()->SetEditSelection( + m_pEditView->getImpl().SetEditSelection( rEditEngine.GetEditDoc().GetStartPaM() ); } else @@ -340,7 +340,7 @@ void TextConvWrapper::ReplaceUnit( // remember current original language for later use ImpEditEngine& rImpEditEngine = m_pEditView->getImpEditEngine(); ESelection aOldSel = m_pEditView->GetSelection(); - //EditSelection aOldEditSel = pEditView->GetImpEditView()->GetEditSelection(); + //EditSelection aOldEditSel = pEditView->getImpl().GetEditSelection(); #ifdef DBG_UTIL LanguageType nOldLang = rImpEditEngine.GetLanguage(rImpEditEngine.CreateSel( aOldSel ).Min() ).nLang; diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index 09a0429fdd7e..c48aa9346dc4 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -159,14 +159,14 @@ class EDITENG_DLLPUBLIC EditView final public: typedef std::vector<VclPtr<vcl::Window>> OutWindowSet; - ImpEditView* GetImpEditView() const { return pImpEditView.get(); } + ImpEditView& getImpl() const { return *mpImpEditView; } ImpEditEngine& getImpEditEngine() const; void setEditEngine(EditEngine* pEditEngine); EditEngine& getEditEngine() const; private: - std::unique_ptr<ImpEditView> pImpEditView; + std::unique_ptr<ImpEditView> mpImpEditView; OUString aDicNameSingle; EditView( const EditView& ) = delete; |