summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-05-03 10:59:32 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-03-11 07:50:32 +0000
commit3137258e346a9c16b2e61747fd926a1e7d358d02 (patch)
tree02a19c5f59b7f6e4528f35ad8cc0c8785598ce8b /editeng
parent6874c25f98dcfe5116d96a1282c4231c3f2d623a (diff)
Resolves: #i118905# Changed EditEngine to be able to paint to overlay directly
i.e. paint to VirtualDevice as well, not only to Window. Removed the no longer needed switch between buffered and unbuffered overlay, this removes the flickering white block. (cherry picked from commit 5ab32faf2426fa60f975d0b544cfd671cdc7983b) Conflicts: editeng/inc/editeng/outliner.hxx editeng/source/editeng/impedit.hxx editeng/source/editeng/impedit3.cxx editeng/source/editeng/impedit4.cxx svx/inc/svx/sdr/overlay/overlaymanager.hxx svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx svx/inc/svx/sdrpaintwindow.hxx svx/inc/svx/svdpagv.hxx svx/source/sdr/overlay/overlaymanager.cxx svx/source/svdraw/sdrpaintwindow.cxx svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdpagv.cxx Change-Id: Ibf4fcba77b120187fbae2454d136d2acd74be119
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editeng/editview.hxx3
-rw-r--r--editeng/inc/editeng/outliner.hxx2
-rw-r--r--editeng/source/editeng/editview.cxx4
-rw-r--r--editeng/source/editeng/impedit.cxx45
-rw-r--r--editeng/source/editeng/impedit.hxx6
-rw-r--r--editeng/source/editeng/impedit3.cxx48
-rw-r--r--editeng/source/editeng/impedit4.cxx2
-rw-r--r--editeng/source/outliner/outlvw.cxx4
8 files changed, 66 insertions, 48 deletions
diff --git a/editeng/inc/editeng/editview.hxx b/editeng/inc/editeng/editview.hxx
index aea70fd87fba..9a2fa855cfce 100644
--- a/editeng/inc/editeng/editview.hxx
+++ b/editeng/inc/editeng/editview.hxx
@@ -49,6 +49,7 @@ class SvKeyValueIterator;
class SfxStyleSheet;
class Font;
class FontList;
+class OutputDevice;
#include <editeng/editdata.hxx>
#include <com/sun/star/uno/Reference.h>
@@ -88,7 +89,7 @@ public:
void SetWindow( Window* pWin );
Window* GetWindow() const;
- void Paint( const Rectangle& rRect );
+ void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
void Invalidate();
Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG );
diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx
index 70531b0798df..1bb02965ccb2 100644
--- a/editeng/inc/editeng/outliner.hxx
+++ b/editeng/inc/editeng/outliner.hxx
@@ -240,7 +240,7 @@ public:
void Scroll( long nHorzScroll, long nVertScroll );
- void Paint( const Rectangle& rRect );
+ void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
sal_Bool PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL );
sal_Bool MouseButtonDown( const MouseEvent& );
sal_Bool MouseButtonUp( const MouseEvent& );
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 14b24f41d5a0..283b30aa0fcf 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -290,11 +290,11 @@ sal_uInt16 EditView::GetSelectedScriptType() const
return PIMPE->GetScriptType( pImpEditView->GetEditSelection() );
}
-void EditView::Paint( const Rectangle& rRect )
+void EditView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice )
{
DBG_CHKTHIS( EditView, 0 );
DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- PIMPEE->Paint( pImpEditView, rRect );
+ PIMPEE->Paint( pImpEditView, rRect, pTargetDevice );
}
void EditView::SetEditEngine( EditEngine* pEditEng )
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index c97aec10e28d..bc7e5e6f47c9 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -126,7 +126,7 @@ void ImpEditView::SetEditSelection( const EditSelection& rEditSelection )
}
-void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
+void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion, OutputDevice* pTargetDevice )
{
if ( GetSelectionMode() == EE_SELMODE_HIDDEN )
return;
@@ -142,8 +142,9 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
if ( pRegion )
pPolyPoly = new PolyPolygon;
- sal_Bool bClipRegion = pOutWin->IsClipRegion();
- Region aOldRegion = pOutWin->GetClipRegion();
+ OutputDevice* pTarget = pTargetDevice ? pTargetDevice : pOutWin;
+ sal_Bool bClipRegion = pTarget->IsClipRegion();
+ Region aOldRegion = pTarget->GetClipRegion();
if ( !pRegion )
{
@@ -160,7 +161,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
Rectangle aTmpOutArea( aOutArea );
if ( aTmpOutArea.GetWidth() > pEditEngine->pImpEditEngine->GetPaperSize().Width() )
aTmpOutArea.Right() = aTmpOutArea.Left() + pEditEngine->pImpEditEngine->GetPaperSize().Width();
- pOutWin->IntersectClipRegion( aTmpOutArea );
+ pTarget->IntersectClipRegion( aTmpOutArea );
if ( pOutWin->GetCursor() )
pOutWin->GetCursor()->Hide();
@@ -238,7 +239,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
Range aLineXPosStartEnd = pEditEngine->GetLineXPosStartEnd(pTmpPortion, pLine);
aTopLeft.X() = aLineXPosStartEnd.Min();
aBottomRight.X() = aLineXPosStartEnd.Max();
- ImplDrawHighlightRect( pOutWin, aTopLeft, aBottomRight, pPolyPoly );
+ ImplDrawHighlightRect( pTarget, aTopLeft, aBottomRight, pPolyPoly );
}
else
{
@@ -259,7 +260,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
Point aPt1( Min( nX1, nX2 ), aTopLeft.Y() );
Point aPt2( Max( nX1, nX2 ), aBottomRight.Y() );
- ImplDrawHighlightRect( pOutWin, aPt1, aPt2, pPolyPoly );
+ ImplDrawHighlightRect( pTarget, aPt1, aPt2, pPolyPoly );
nTmpStartIndex = nTmpEndIndex;
}
@@ -279,30 +280,30 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
pOutWin->GetCursor()->Show();
if ( bClipRegion )
- pOutWin->SetClipRegion( aOldRegion );
+ pTarget->SetClipRegion( aOldRegion );
else
- pOutWin->SetClipRegion();
+ pTarget->SetClipRegion();
}
}
-void ImpEditView::ImplDrawHighlightRect( Window* _pOutWin, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, PolyPolygon* pPolyPoly )
+void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, PolyPolygon* pPolyPoly )
{
if ( rDocPosTopLeft.X() != rDocPosBottomRight.X() )
{
- sal_Bool bPixelMode = _pOutWin->GetMapMode() == MAP_PIXEL;
+ sal_Bool bPixelMode = _pTarget->GetMapMode() == MAP_PIXEL;
Point aPnt1( GetWindowPos( rDocPosTopLeft ) );
Point aPnt2( GetWindowPos( rDocPosBottomRight ) );
if ( !IsVertical() )
{
- lcl_AllignToPixel( aPnt1, _pOutWin, +1, 0 );
- lcl_AllignToPixel( aPnt2, _pOutWin, 0, ( bPixelMode ? 0 : -1 ) );
+ lcl_AllignToPixel( aPnt1, _pTarget, +1, 0 );
+ lcl_AllignToPixel( aPnt2, _pTarget, 0, ( bPixelMode ? 0 : -1 ) );
}
else
{
- lcl_AllignToPixel( aPnt1, _pOutWin, 0, +1 );
- lcl_AllignToPixel( aPnt2, _pOutWin, ( bPixelMode ? 0 : +1 ), 0 );
+ lcl_AllignToPixel( aPnt1, _pTarget, 0, +1 );
+ lcl_AllignToPixel( aPnt2, _pTarget, ( bPixelMode ? 0 : +1 ), 0 );
}
Rectangle aRect( aPnt1, aPnt2 );
@@ -317,7 +318,21 @@ void ImpEditView::ImplDrawHighlightRect( Window* _pOutWin, const Point& rDocPosT
}
else
{
- _pOutWin->Invert( aRect );
+ Window* pWindow = dynamic_cast< Window* >(_pTarget);
+
+ if(pWindow)
+ {
+ pWindow->Invert( aRect );
+ }
+ else
+ {
+ _pTarget->Push(PUSH_LINECOLOR|PUSH_FILLCOLOR|PUSH_RASTEROP);
+ _pTarget->SetLineColor();
+ _pTarget->SetFillColor(COL_BLACK);
+ _pTarget->SetRasterOp(ROP_INVERT);
+ _pTarget->DrawRect(aRect);
+ _pTarget->Pop();
+ }
}
}
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 2cd8a6de83ec..a38bab197425 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -253,7 +253,7 @@ protected:
void ShowDDCursor( const Rectangle& rRect );
void HideDDCursor();
- void ImplDrawHighlightRect( Window* pOutWin, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, PolyPolygon* pPolyPoly );
+ void ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, PolyPolygon* pPolyPoly );
public:
ImpEditView( EditView* pView, EditEngine* pEng, Window* pWindow );
@@ -301,7 +301,7 @@ public:
sal_Bool HasSelection() const { return aEditSelection.HasRange(); }
void DrawSelection() { DrawSelection( aEditSelection ); }
- void DrawSelection( EditSelection, Region* pRegion = NULL );
+ void DrawSelection( EditSelection, Region* pRegion = NULL, OutputDevice* pTargetDevice = NULL );
Window* GetWindow() const { return pOutWin; }
@@ -718,7 +718,7 @@ public:
void FormatDoc();
void FormatFullDoc();
void UpdateViews( EditView* pCurView = 0 );
- void Paint( ImpEditView* pView, const Rectangle& rRect, sal_Bool bUseVirtDev = sal_False );
+ void Paint( ImpEditView* pView, const Rectangle& rRect, OutputDevice* pTargetDevice = 0, sal_Bool bUseVirtDev = sal_False );
void Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aStartPos, sal_Bool bStripOnly = sal_False, short nOrientation = 0 );
sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent, EditView* pView );
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 024bcd95b545..dbc691047bab 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -295,7 +295,7 @@ void ImpEditEngine::UpdateViews( EditView* pCurView )
aClipRec = pView->pImpEditView->GetWindowPos( aClipRec );
if ( pView == pCurView )
- Paint( pView->pImpEditView, aClipRec, sal_True );
+ Paint( pView->pImpEditView, aClipRec, 0, sal_True );
else
pView->GetWindow()->Invalidate( aClipRec );
}
@@ -3636,7 +3636,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
pOutDev->SetFont( aOldFont );
}
-void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool bUseVirtDev )
+void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, OutputDevice* pTargetDevice, sal_Bool bUseVirtDev )
{
DBG_ASSERT( pView, "No View - No Paint!" );
DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 );
@@ -3648,11 +3648,11 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b
Rectangle aClipRec( pView->GetOutputArea() );
aClipRec.Intersection( rRec );
- Window* pOutWin = pView->GetWindow();
+ OutputDevice* pTarget = pTargetDevice ? pTargetDevice : pView->GetWindow();
if ( bUseVirtDev )
{
- Rectangle aClipRecPixel( pOutWin->LogicToPixel( aClipRec ) );
+ Rectangle aClipRecPixel( pTarget->LogicToPixel( aClipRec ) );
if ( !IsVertical() )
{
// etwas mehr, falls abgerundet!
@@ -3667,7 +3667,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b
// If aClipRecPixel > XXXX, then invalidate?!
- VirtualDevice* pVDev = GetVirtualDevice( pOutWin->GetMapMode(), pOutWin->GetDrawMode() );
+ VirtualDevice* pVDev = GetVirtualDevice( pTarget->GetMapMode(), pTarget->GetDrawMode() );
pVDev->SetDigitLanguage( GetRefDevice()->GetDigitLanguage() );
{
@@ -3730,7 +3730,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b
// Otherwise, the line below must also be printed out:
Rectangle aTmpRec( Point( 0, 0 ), aClipRec.GetSize() );
- aClipRec = pOutWin->PixelToLogic( aClipRecPixel );
+ aClipRec = pTarget->PixelToLogic( aClipRecPixel );
Point aStartPos;
if ( !IsVertical() )
{
@@ -3755,36 +3755,38 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b
if ( GetTextRanger() )
{
// Some problems here with push/pop, why?!
- bClipRegion = pOutWin->IsClipRegion();
- aOldRegion = pOutWin->GetClipRegion();
+// pTarget->Push( PUSH_CLIPREGION|PUSH_MAPMODE );
+ bClipRegion = pTarget->IsClipRegion();
+ aOldRegion = pTarget->GetClipRegion();
// How do I get the polygon to the right place??
// The polygon is based on the view, not the Window
// => reset origin...
- aOldMapMode = pOutWin->GetMapMode();
+ aOldMapMode = pTarget->GetMapMode();
Point aOrigin = aOldMapMode.GetOrigin();
Point aViewPos = pView->GetOutputArea().TopLeft();
aOrigin.Move( aViewPos.X(), aViewPos.Y() );
aClipRec.Move( -aViewPos.X(), -aViewPos.Y() );
MapMode aNewMapMode( aOldMapMode );
aNewMapMode.SetOrigin( aOrigin );
- pOutWin->SetMapMode( aNewMapMode );
- pOutWin->SetClipRegion( Region( GetTextRanger()->GetPolyPolygon() ) );
+ pTarget->SetMapMode( aNewMapMode );
+ pTarget->SetClipRegion( Region( GetTextRanger()->GetPolyPolygon() ) );
}
- pOutWin->DrawOutDev( aClipRec.TopLeft(), aClipRec.GetSize(),
+ pTarget->DrawOutDev( aClipRec.TopLeft(), aClipRec.GetSize(),
Point(0,0), aClipRec.GetSize(), *pVDev );
if ( GetTextRanger() )
{
+// pTarget->Pop();
if ( bClipRegion )
- pOutWin->SetClipRegion( aOldRegion );
+ pTarget->SetClipRegion( aOldRegion );
else
- pOutWin->SetClipRegion();
- pOutWin->SetMapMode( aOldMapMode );
+ pTarget->SetClipRegion();
+ pTarget->SetMapMode( aOldMapMode );
}
- pView->DrawSelection();
+ pView->DrawSelection(pView->GetEditSelection(), 0, pTarget);
}
else
{
@@ -3815,18 +3817,18 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b
aClipRec.Right() = nMaxX;
}
- sal_Bool bClipRegion = pOutWin->IsClipRegion();
- Region aOldRegion = pOutWin->GetClipRegion();
- pOutWin->IntersectClipRegion( aClipRec );
+ sal_Bool bClipRegion = pTarget->IsClipRegion();
+ Region aOldRegion = pTarget->GetClipRegion();
+ pTarget->IntersectClipRegion( aClipRec );
- Paint( pOutWin, aClipRec, aStartPos );
+ Paint( pTarget, aClipRec, aStartPos );
if ( bClipRegion )
- pOutWin->SetClipRegion( aOldRegion );
+ pTarget->SetClipRegion( aOldRegion );
else
- pOutWin->SetClipRegion();
+ pTarget->SetClipRegion();
- pView->DrawSelection();
+ pView->DrawSelection(pView->GetEditSelection(), 0, pTarget);
}
}
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 829887517576..6509300c4521 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2389,7 +2389,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel
// convert to window coordinates ....
aClipRec.SetPos( pView->pImpEditView->GetWindowPos( aClipRec.TopLeft() ) );
// If selected, then VDev ...
- Paint( pView->pImpEditView, aClipRec, pView->HasSelection() );
+ Paint( pView->pImpEditView, aClipRec, 0, pView->HasSelection() );
}
}
}
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 6bbbf42099a2..9ad91bafb20f 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -69,7 +69,7 @@ OutlinerView::~OutlinerView()
delete pEditView;
}
-void OutlinerView::Paint( const Rectangle& rRect )
+void OutlinerView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice )
{
DBG_CHKTHIS(OutlinerView,0);
@@ -78,7 +78,7 @@ void OutlinerView::Paint( const Rectangle& rRect )
if( pOwner->bFirstParaIsEmpty )
pOwner->Insert( String() );
- pEditView->Paint( rRect );
+ pEditView->Paint( rRect, pTargetDevice );
}
sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin )