[Libreoffice-commits] core.git: editeng/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 6 15:32:46 UTC 2021
editeng/source/editeng/editdbg.cxx | 1
editeng/source/editeng/editeng.cxx | 3 +
editeng/source/editeng/impedit.cxx | 64 ++++++++++++++++++------------------
editeng/source/editeng/impedit.hxx | 5 +-
editeng/source/editeng/impedit3.cxx | 16 ++++-----
editeng/source/editeng/impedit4.cxx | 1
6 files changed, 47 insertions(+), 43 deletions(-)
New commits:
commit 3734437acf96c888a8d6ddc8be1d022be3ab9a59
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Apr 6 11:19:27 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Apr 6 17:32:00 2021 +0200
use GetOutputDevice for ImpEditView::GetBackgroundColor
in case the host is using getEditViewCallbacks
Change-Id: Iadc146a585c3fc3df6f77ab8def2d697da5186a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113671
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index 639e936a9558..c54d01aa2fa4 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -21,6 +21,7 @@
#include <memory>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
+#include <vcl/window.hxx>
#include <editeng/lspcitem.hxx>
#include <editeng/lrspitem.hxx>
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 3c06cbf96f51..3f11d39b300b 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -22,8 +22,9 @@
#include <comphelper/lok.hxx>
#include <config_global.h>
-#include <vcl/weld.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
+#include <vcl/window.hxx>
#include <tools/stream.hxx>
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index a42223732294..3c60298cea82 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -36,6 +36,7 @@
#include <vcl/transfer.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weldutils.hxx>
+#include <vcl/window.hxx>
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -50,16 +51,16 @@ using namespace ::com::sun::star::linguistic2;
#define SCRLRANGE 20 // Scroll 1/20 of the width/height, when in QueryDrop
-static void lcl_AllignToPixel( Point& rPoint, OutputDevice const * pOutDev, short nDiffX, short nDiffY )
+static void lcl_AllignToPixel( Point& rPoint, const OutputDevice& rOutDev, short nDiffX, short nDiffY )
{
- rPoint = pOutDev->LogicToPixel( rPoint );
+ rPoint = rOutDev.LogicToPixel( rPoint );
if ( nDiffX )
rPoint.AdjustX(nDiffX );
if ( nDiffY )
rPoint.AdjustY(nDiffY );
- rPoint = pOutDev->PixelToLogic( rPoint );
+ rPoint = rOutDev.PixelToLogic( rPoint );
}
LOKSpecialPositioning::LOKSpecialPositioning(const ImpEditView& rImpEditView, MapUnit eUnit,
@@ -218,6 +219,11 @@ void ImpEditView::SetBackgroundColor( const Color& rColor )
mxBackgroundColor = rColor;
}
+const Color& ImpEditView::GetBackgroundColor() const
+{
+ return mxBackgroundColor ? *mxBackgroundColor : GetOutputDevice().GetBackground().GetColor();
+}
+
void ImpEditView::RegisterViewShell(OutlinerViewShell* pViewShell)
{
mpViewShell = pViewShell;
@@ -472,13 +478,9 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
// pRegion: When not NULL, then only calculate Region.
- OutputDevice* pTarget;
- if (pTargetDevice)
- pTarget = pTargetDevice;
- else
- pTarget = getEditViewCallbacks() ? &getEditViewCallbacks()->EditViewOutputDevice() : pOutWin;
- bool bClipRegion = pTarget->IsClipRegion();
- vcl::Region aOldRegion = pTarget->GetClipRegion();
+ OutputDevice& rTarget = pTargetDevice ? *pTargetDevice : GetOutputDevice();
+ bool bClipRegion = rTarget.IsClipRegion();
+ vcl::Region aOldRegion = rTarget.GetClipRegion();
std::unique_ptr<tools::PolyPolygon> pPolyPoly;
@@ -497,7 +499,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
tools::Rectangle aTmpOutArea( aOutArea );
if ( aTmpOutArea.GetWidth() > pEditEngine->pImpEditEngine->GetPaperSize().Width() )
aTmpOutArea.SetRight( aTmpOutArea.Left() + pEditEngine->pImpEditEngine->GetPaperSize().Width() );
- pTarget->IntersectClipRegion( aTmpOutArea );
+ rTarget.IntersectClipRegion( aTmpOutArea );
if (pOutWin && pOutWin->GetCursor())
pOutWin->GetCursor()->Hide();
@@ -593,7 +595,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
Range aLineXPosStartEnd = pEditEngine->GetLineXPosStartEnd(pTmpPortion, &rLine);
aTopLeft.setX( aLineXPosStartEnd.Min() );
aBottomRight.setX( aLineXPosStartEnd.Max() );
- ImplDrawHighlightRect( pTarget, aTopLeft, aBottomRight, pPolyPoly.get() );
+ ImplDrawHighlightRect(rTarget, aTopLeft, aBottomRight, pPolyPoly.get());
}
else
{
@@ -614,7 +616,7 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
Point aPt1( std::min( nX1, nX2 ), aTopLeft.Y() );
Point aPt2( std::max( nX1, nX2 ), aBottomRight.Y() );
- ImplDrawHighlightRect( pTarget, aPt1, aPt2, pPolyPoly.get() );
+ ImplDrawHighlightRect(rTarget, aPt1, aPt2, pPolyPoly.get());
nTmpStartIndex = nTmpEndIndex;
}
}
@@ -635,10 +637,10 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
if (pOutWin && pOutWin->GetCursor())
pOutWin->GetCursor()->Show();
- if ( bClipRegion )
- pTarget->SetClipRegion( aOldRegion );
+ if (bClipRegion)
+ rTarget.SetClipRegion(aOldRegion);
else
- pTarget->SetClipRegion();
+ rTarget.SetClipRegion();
}
}
@@ -649,14 +651,14 @@ void ImpEditView::GetSelectionRectangles(EditSelection aTmpSel, std::vector<tool
aRegion.GetRegionRectangles(rLogicRects);
}
-void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly )
+void ImpEditView::ImplDrawHighlightRect( OutputDevice& rTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly )
{
if ( rDocPosTopLeft.X() == rDocPosBottomRight.X() )
return;
if (mpLOKSpecialPositioning && pPolyPoly)
{
- MapUnit eDevUnit = _pTarget->GetMapMode().GetMapUnit();
+ MapUnit eDevUnit = rTarget.GetMapMode().GetMapUnit();
tools::Rectangle aSelRect(rDocPosTopLeft, rDocPosBottomRight);
aSelRect = mpLOKSpecialPositioning->GetWindowPos(aSelRect, eDevUnit);
const Point aRefPoint = mpLOKSpecialPositioning->GetRefPoint();
@@ -671,20 +673,20 @@ void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rD
return;
}
- bool bPixelMode = _pTarget->GetMapMode().GetMapUnit() == MapUnit::MapPixel;
+ bool bPixelMode = rTarget.GetMapMode().GetMapUnit() == MapUnit::MapPixel;
Point aPnt1( GetWindowPos( rDocPosTopLeft ) );
Point aPnt2( GetWindowPos( rDocPosBottomRight ) );
if ( !IsVertical() )
{
- lcl_AllignToPixel( aPnt1, _pTarget, +1, 0 );
- lcl_AllignToPixel( aPnt2, _pTarget, 0, ( bPixelMode ? 0 : -1 ) );
+ lcl_AllignToPixel(aPnt1, rTarget, +1, 0);
+ lcl_AllignToPixel(aPnt2, rTarget, 0, (bPixelMode ? 0 : -1));
}
else
{
- lcl_AllignToPixel( aPnt1, _pTarget, 0, +1 );
- lcl_AllignToPixel( aPnt2, _pTarget, ( bPixelMode ? 0 : +1 ), 0 );
+ lcl_AllignToPixel(aPnt1, rTarget, 0, +1 );
+ lcl_AllignToPixel(aPnt2, rTarget, (bPixelMode ? 0 : +1), 0);
}
tools::Rectangle aRect( aPnt1, aPnt2 );
@@ -699,20 +701,20 @@ void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rD
}
else
{
- vcl::Window* pWindow = dynamic_cast< vcl::Window* >(_pTarget);
+ vcl::Window* pWindow = dynamic_cast<vcl::Window*>(&rTarget);
- if(pWindow)
+ if (pWindow)
{
pWindow->Invert( aRect );
}
else
{
- _pTarget->Push(PushFlags::LINECOLOR|PushFlags::FILLCOLOR|PushFlags::RASTEROP);
- _pTarget->SetLineColor();
- _pTarget->SetFillColor(COL_BLACK);
- _pTarget->SetRasterOp(RasterOp::Invert);
- _pTarget->DrawRect(aRect);
- _pTarget->Pop();
+ rTarget.Push(PushFlags::LINECOLOR|PushFlags::FILLCOLOR|PushFlags::RASTEROP);
+ rTarget.SetLineColor();
+ rTarget.SetFillColor(COL_BLACK);
+ rTarget.SetRasterOp(RasterOp::Invert);
+ rTarget.DrawRect(aRect);
+ rTarget.Pop();
}
}
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index eee427f55c6f..a9cacc93111e 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -334,7 +334,7 @@ protected:
void ShowDDCursor( const tools::Rectangle& rRect );
void HideDDCursor();
- void ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly );
+ void ImplDrawHighlightRect(OutputDevice& rTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly);
tools::Rectangle ImplGetEditCursor(EditPaM& aPaM, GetCursorFlags nShowCursorFlags,
sal_Int32& nTextPortionStart, const ParaPortion* pParaPortion) const;
@@ -437,8 +437,7 @@ public:
bool DoInvalidateMore() const { return bool( nControl & EVControlBits::INVONEMORE ); }
void SetBackgroundColor( const Color& rColor );
- const Color & GetBackgroundColor() const {
- return ( mxBackgroundColor ? *mxBackgroundColor : pOutWin->GetBackground().GetColor() ); }
+ const Color& GetBackgroundColor() const;
/// Informs this edit view about which view shell contains it.
void RegisterViewShell(OutlinerViewShell* pViewShell);
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 7df8aaa92bf4..faad2057dfb7 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3857,7 +3857,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const tools::Rectangle& rRect, Ou
tools::Rectangle aClipRect( pView->GetOutputArea() );
aClipRect.Intersection( rRect );
- OutputDevice* pTarget = pTargetDevice ? pTargetDevice : pView->GetWindow();
+ OutputDevice& rTarget = pTargetDevice ? *pTargetDevice : pView->GetOutputDevice();
Point aStartPos;
if ( !IsVertical() )
@@ -3895,18 +3895,18 @@ void ImpEditEngine::Paint( ImpEditView* pView, const tools::Rectangle& rRect, Ou
aClipRect.SetRight( nMaxX );
}
- bool bClipRegion = pTarget->IsClipRegion();
- vcl::Region aOldRegion = pTarget->GetClipRegion();
- pTarget->IntersectClipRegion( aClipRect );
+ bool bClipRegion = rTarget.IsClipRegion();
+ vcl::Region aOldRegion = rTarget.GetClipRegion();
+ rTarget.IntersectClipRegion( aClipRect );
- Paint( pTarget, aClipRect, aStartPos );
+ Paint( &rTarget, aClipRect, aStartPos );
if ( bClipRegion )
- pTarget->SetClipRegion( aOldRegion );
+ rTarget.SetClipRegion( aOldRegion );
else
- pTarget->SetClipRegion();
+ rTarget.SetClipRegion();
- pView->DrawSelectionXOR(pView->GetEditSelection(), nullptr, pTarget);
+ pView->DrawSelectionXOR(pView->GetEditSelection(), nullptr, &rTarget);
}
void ImpEditEngine::InsertContent( ContentNode* pNode, sal_Int32 nPos )
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 9e2a551e2481..d3b24a16a120 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -19,6 +19,7 @@
#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
#include <svl/srchitem.hxx>
#include <editeng/lspcitem.hxx>
More information about the Libreoffice-commits
mailing list