editeng/source/editeng/impedit.cxx |   23 +++++++++++++++--------
 editeng/source/editeng/impedit.hxx |    1 +
 2 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit 7b7905b37f42029611bd375d6ca24d9b9508b8ff
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Oct 13 09:12:14 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Oct 13 17:29:30 2020 +0200

    combine duplicates together
    
    Change-Id: Ic4d5b50051cee4ab65a366ed7d26c222a7ca3008
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104227
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 8b61a4aee975..c879c5ff51c5 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -815,9 +815,16 @@ void ImpEditView::SetSelectionMode( EESelectionMode 
eNewMode )
     }
 }
 
+OutputDevice& ImpEditView::GetOutputDevice() const
+{
+    if (EditViewCallbacks* pCallbacks = getEditViewCallbacks())
+        return pCallbacks->EditViewOutputDevice();
+    return *pOutWin;
+}
+
 void ImpEditView::SetOutputArea( const tools::Rectangle& rRect )
 {
-    const OutputDevice& rOutDev = getEditViewCallbacks() ? 
getEditViewCallbacks()->EditViewOutputDevice() : *pOutWin;
+    const OutputDevice& rOutDev = GetOutputDevice();
     // should be better be aligned on pixels!
     tools::Rectangle aNewRect(rOutDev.LogicToPixel(rRect));
     aNewRect = rOutDev.PixelToLogic(aNewRect);
@@ -1244,7 +1251,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
             aEditCursor.SetTop( GetVisDocTop() );
     }
 
-    const OutputDevice& rOutDev = getEditViewCallbacks() ? 
getEditViewCallbacks()->EditViewOutputDevice() : *pOutWin;
+    const OutputDevice& rOutDev = GetOutputDevice();
 
     long nOnePixel = rOutDev.PixelToLogic( Size( 1, 0 ) ).Width();
 
@@ -1443,7 +1450,7 @@ Pair ImpEditView::Scroll( long ndX, long ndY, 
ScrollRangeCheck nRangeCheck )
     if ( !ndX && !ndY )
         return Pair( 0, 0 );
 
-    const OutputDevice& rOutDev = getEditViewCallbacks() ? 
getEditViewCallbacks()->EditViewOutputDevice() : *GetWindow();
+    const OutputDevice& rOutDev = GetOutputDevice();
 
 #ifdef DBG_UTIL
     tools::Rectangle aR( aOutArea );
@@ -2020,7 +2027,7 @@ bool ImpEditView::IsSelectionAtPoint( const Point& 
rPosPixel )
         return true;
 
     // Logical units ...
-    const OutputDevice& rOutDev = getEditViewCallbacks() ? 
getEditViewCallbacks()->EditViewOutputDevice() : *GetWindow();
+    const OutputDevice& rOutDev = GetOutputDevice();
     Point aMousePos = rOutDev.PixelToLogic(rPosPixel);
 
     if ( ( !GetOutputArea().IsInside( aMousePos ) ) && 
!pEditEngine->pImpEditEngine->IsInSelectionMode() )
@@ -2040,7 +2047,7 @@ bool ImpEditView::SetCursorAtPoint( const Point& 
rPointPixel )
     Point aMousePos( rPointPixel );
 
     // Logical units ...
-    const OutputDevice& rOutDev = getEditViewCallbacks() ? 
getEditViewCallbacks()->EditViewOutputDevice() : *GetWindow();
+    const OutputDevice& rOutDev = GetOutputDevice();
     aMousePos = rOutDev.PixelToLogic( aMousePos );
 
     if ( ( !GetOutputArea().IsInside( aMousePos ) ) && 
!pEditEngine->pImpEditEngine->IsInSelectionMode() )
@@ -2090,7 +2097,7 @@ void ImpEditView::HideDDCursor()
 {
     if ( pDragAndDropInfo && pDragAndDropInfo->bVisCursor )
     {
-        OutputDevice& rOutDev = getEditViewCallbacks() ? 
getEditViewCallbacks()->EditViewOutputDevice() : *GetWindow();
+        OutputDevice& rOutDev = GetOutputDevice();
         rOutDev.DrawOutDev( pDragAndDropInfo->aCurSavedCursor.TopLeft(), 
pDragAndDropInfo->aCurSavedCursor.GetSize(),
                             Point(0,0), 
pDragAndDropInfo->aCurSavedCursor.GetSize(),*pDragAndDropInfo->pBackground );
         pDragAndDropInfo->bVisCursor = false;
@@ -2105,7 +2112,7 @@ void ImpEditView::ShowDDCursor( const tools::Rectangle& 
rRect )
     if (pOutWin && pOutWin->GetCursor())
         pOutWin->GetCursor()->Hide();
 
-    OutputDevice& rOutDev = getEditViewCallbacks() ? 
getEditViewCallbacks()->EditViewOutputDevice() : *GetWindow();
+    OutputDevice& rOutDev = GetOutputDevice();
     Color aOldFillColor = rOutDev.GetFillColor();
     rOutDev.SetFillColor( Color(4210752) );    // GRAY BRUSH_50, OLDSV, change 
to DDCursor!
 
@@ -2439,7 +2446,7 @@ void ImpEditView::dragOver(const 
css::datatransfer::dnd::DropTargetDragEvent& rD
 {
     SolarMutexGuard aVclGuard;
 
-    const OutputDevice& rOutDev = getEditViewCallbacks() ? 
getEditViewCallbacks()->EditViewOutputDevice() : *GetWindow();
+    const OutputDevice& rOutDev = GetOutputDevice();
 
     Point aMousePos( rDTDE.LocationX, rDTDE.LocationY );
     aMousePos = rOutDev.PixelToLogic( aMousePos );
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index da33598365dd..91239dd0e1aa 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -392,6 +392,7 @@ public:
 
     void ScrollStateChange();
 
+    OutputDevice&   GetOutputDevice() const;
     vcl::Window*    GetWindow() const           { return pOutWin; }
 
     void            SetSelectionMode( EESelectionMode eMode );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to