summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-01-18 18:27:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-17 12:56:51 +0200
commit9090dc1f3b27195f5defd35586ac79357992be21 (patch)
treed39f4b624ae337d5c9ce76eba8521b76e53afa05 /svtools
parentc8cf2e0e088b74afa52564945a9c005b3b86bf7e (diff)
split OutputDevice from Window
as part of a longer-term goal of doing our widget rendering only inside a top-level render- context. I moved all of the OutputDevice-related code that existed in vcl::Window into a new subclass of OutputDevice called WindowOutputDevice. Notes for further work (*) not sure why we are getting an 1x1 surface in SvpSalGraphics::releaseCairoContext, but to fix it I clamp the size there (*) might have to dump VCLXDevice, and move it's code down into VCLXWindow and VCLXVirtualDevice (*) can we remove use of VCLXDevice in other places, in favour of just talking to the VCL code? Change-Id: I105946377f5322677d6f7d0c1c23847178a720b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113204 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/brwbox/brwbox1.cxx6
-rw-r--r--svtools/source/brwbox/brwbox2.cxx18
-rw-r--r--svtools/source/brwbox/brwbox3.cxx2
-rw-r--r--svtools/source/brwbox/datwin.cxx6
-rw-r--r--svtools/source/brwbox/editbrowsebox.cxx10
-rw-r--r--svtools/source/control/ruler.cxx16
-rw-r--r--svtools/source/control/tabbar.cxx38
-rw-r--r--svtools/source/table/tablecontrol.cxx2
-rw-r--r--svtools/source/table/tabledatawindow.cxx4
9 files changed, 51 insertions, 51 deletions
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index f815556553a9..e42dad407478 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -620,7 +620,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
}
// actually scroll+invalidate
- pDataWin->SetClipRegion();
+ pDataWin->GetOutDev()->SetClipRegion();
bool bSelVis = bSelectionIsVisible;
bSelectionIsVisible = false;
if( GetBackground().IsScrollable() )
@@ -1165,7 +1165,7 @@ void BrowseBox::RowInserted( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint,
if ( !bLastRow )
{
// scroll down the rows behind the new row
- pDataWin->SetClipRegion();
+ pDataWin->GetOutDev()->SetClipRegion();
if( pDataWin->GetBackground().IsScrollable() )
{
pDataWin->Scroll( 0, GetDataRowHeight() * nNumRows,
@@ -1311,7 +1311,7 @@ void BrowseBox::RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint )
if (nRow < nRowCount)
{
tools::Long nY = (nRow-nTopRow) * GetDataRowHeight();
- pDataWin->SetClipRegion();
+ pDataWin->GetOutDev()->SetClipRegion();
if( pDataWin->GetBackground().IsScrollable() )
{
pDataWin->Scroll( 0, - static_cast<short>(GetDataRowHeight()) * nNumRows,
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index e52421f9cdcd..ea1472c05f6a 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -353,14 +353,14 @@ void BrowseBox::DrawCursor()
}
else
{
- Color rCol = bReallyHide ? pDataWin->GetFillColor() : m_aCursorColor;
- Color aOldFillColor = pDataWin->GetFillColor();
- Color aOldLineColor = pDataWin->GetLineColor();
- pDataWin->SetFillColor();
- pDataWin->SetLineColor( rCol );
- pDataWin->DrawRect( aCursor );
- pDataWin->SetLineColor( aOldLineColor );
- pDataWin->SetFillColor( aOldFillColor );
+ Color rCol = bReallyHide ? pDataWin->GetOutDev()->GetFillColor() : m_aCursorColor;
+ Color aOldFillColor = pDataWin->GetOutDev()->GetFillColor();
+ Color aOldLineColor = pDataWin->GetOutDev()->GetLineColor();
+ pDataWin->GetOutDev()->SetFillColor();
+ pDataWin->GetOutDev()->SetLineColor( rCol );
+ pDataWin->GetOutDev()->DrawRect( aCursor );
+ pDataWin->GetOutDev()->SetLineColor( aOldLineColor );
+ pDataWin->GetOutDev()->SetFillColor( aOldFillColor );
}
}
@@ -1317,7 +1317,7 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt )
nDragX = nResizeX = rEvtPos.X();
SetPointer( PointerStyle::HSplit );
CaptureMouse();
- pDataWin->DrawLine( Point( nDragX, 0 ),
+ pDataWin->GetOutDev()->DrawLine( Point( nDragX, 0 ),
Point( nDragX, pDataWin->GetSizePixel().Height() ) );
nMinResizeX = nX + MIN_COLUMNWIDTH;
return;
diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx
index 9e7f77a2cb6a..d6bcdfeb4fc1 100644
--- a/svtools/source/brwbox/brwbox3.cxx
+++ b/svtools/source/brwbox/brwbox3.cxx
@@ -528,7 +528,7 @@ OUString BrowseBox::GetAccessibleCellText(sal_Int32 _nRow, sal_uInt16 _nColPos)
bool BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector )
{
- return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector );
+ return GetOutDev()->GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector );
}
tools::Rectangle BrowseBox::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index a8a20fae8918..a7bbde76fe28 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -235,9 +235,9 @@ void InitSettings_Impl(vcl::Window* pWin)
{
const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings();
- pWin->ApplyControlFont(*pWin, rStyleSettings.GetFieldFont());
- pWin->ApplyControlForeground(*pWin, rStyleSettings.GetWindowTextColor());
- pWin->ApplyControlBackground(*pWin, rStyleSettings.GetWindowColor());
+ pWin->ApplyControlFont(*pWin->GetOutDev(), rStyleSettings.GetFieldFont());
+ pWin->ApplyControlForeground(*pWin->GetOutDev(), rStyleSettings.GetWindowTextColor());
+ pWin->ApplyControlBackground(*pWin->GetOutDev(), rStyleSettings.GetWindowColor());
}
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 236897d0d96e..60946af94032 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -219,7 +219,7 @@ namespace svt
else
{
// don't paint the current cell
- if (&rDev == &GetDataWindow())
+ if (rDev.GetOwnerWindow() == &GetDataWindow())
// but only if we're painting onto our data win (which is the usual painting)
if (nPaintRow == nEditRow)
{
@@ -738,7 +738,7 @@ namespace svt
else
GetDataWindow().SetControlFont();
- GetDataWindow().SetZoomedPointFont(GetDataWindow(), aFont);
+ GetDataWindow().SetZoomedPointFont(*GetDataWindow().GetOutDev(), aFont);
}
if (bFont || bForeground)
@@ -762,13 +762,13 @@ namespace svt
{
GetDataWindow().SetControlBackground(GetControlBackground());
GetDataWindow().SetBackground(GetDataWindow().GetControlBackground());
- GetDataWindow().SetFillColor(GetDataWindow().GetControlBackground());
+ GetDataWindow().GetOutDev()->SetFillColor(GetDataWindow().GetControlBackground());
}
else
{
GetDataWindow().SetControlBackground();
GetDataWindow().SetBackground(rStyleSettings.GetFieldColor());
- GetDataWindow().SetFillColor(rStyleSettings.GetFieldColor());
+ GetDataWindow().GetOutDev()->SetFillColor(rStyleSettings.GetFieldColor());
}
}
@@ -1196,7 +1196,7 @@ namespace svt
aBoxSize);
pCheckBoxPaint->SetPosSizePixel(aRect.TopLeft(), aRect.GetSize());
- pCheckBoxPaint->Draw(&GetDataWindow(), aRect.TopLeft(), DrawFlags::NONE);
+ pCheckBoxPaint->Draw(GetDataWindow().GetOutDev(), aRect.TopLeft(), DrawFlags::NONE);
}
void EditBrowseBox::AsynchGetFocus()
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 61b5b60d539f..df3f981af0d7 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -231,7 +231,7 @@ void Ruler::ImplInit( WinBits nWinBits )
// Setup the default size
tools::Rectangle aRect;
- GetTextBoundRect( aRect, "0123456789" );
+ GetOutDev()->GetTextBoundRect( aRect, "0123456789" );
tools::Long nDefHeight = aRect.GetHeight() + RULER_OFF * 2 + ruler_tab.textoff * 2 + mnBorderWidth;
Size aDefSize;
@@ -245,7 +245,7 @@ void Ruler::ImplInit( WinBits nWinBits )
Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) :
Window( pParent, nWinStyle & WB_3DLOOK ),
- maVirDev( VclPtr<VirtualDevice>::Create(*this) ),
+ maVirDev( VclPtr<VirtualDevice>::Create(*GetOutDev()) ),
maMapMode( MapUnit::Map100thMM ),
mpSaveData(new ImplRulerData),
mpData(nullptr),
@@ -410,7 +410,7 @@ void Ruler::ImplInvertLines(vcl::RenderContext& rRenderContext)
aTempRect.SetLeft( aTempRect.Right() - RULER_OFF + 1 );
}
rRenderContext.Erase(aTempRect);
- Invert(aRect);
+ GetOutDev()->Invert(aRect);
}
}
mnUpdateFlags = 0;
@@ -988,7 +988,7 @@ void Ruler::ApplySettings(vcl::RenderContext& rRenderContext)
ApplyControlFont(rRenderContext, aFont);
- ApplyControlForeground(*this, rStyleSettings.GetDarkShadowColor());
+ ApplyControlForeground(*GetOutDev(), rStyleSettings.GetDarkShadowColor());
SetTextFillColor();
Color aColor;
@@ -1008,12 +1008,12 @@ void Ruler::ImplInitSettings(bool bFont, bool bForeground, bool bBackground)
Size aSize(adjustSize(aFont.GetFontSize().Width()), adjustSize(aFont.GetFontSize().Height()));
aFont.SetFontSize(aSize);
- ApplyControlFont(*this, aFont);
+ ApplyControlFont(*GetOutDev(), aFont);
}
if (bForeground || bFont)
{
- ApplyControlForeground(*this, rStyleSettings.GetDarkShadowColor());
+ ApplyControlForeground(*GetOutDev(), rStyleSettings.GetDarkShadowColor());
SetTextFillColor();
}
@@ -1022,7 +1022,7 @@ void Ruler::ImplInitSettings(bool bFont, bool bForeground, bool bBackground)
Color aColor;
svtools::ColorConfig aColorConfig;
aColor = aColorConfig.GetColorValue(svtools::APPBACKGROUND).nColor;
- ApplyControlBackground(*this, aColor);
+ ApplyControlBackground(*GetOutDev(), aColor);
}
maVirDev->SetSettings( GetSettings() );
@@ -2247,7 +2247,7 @@ bool Ruler::StartDocDrag( const MouseEvent& rMEvt, RulerType eDragType )
if (!IsReallyVisible())
{
// set mpData for ImplDocHitTest()
- ImplFormat(*this);
+ ImplFormat(*GetOutDev());
}
Invalidate(InvalidateFlags::NoErase);
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 445dd838202f..c7c777c9085f 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -586,7 +586,7 @@ void TabBar::ImplInitSettings( bool bFont, bool bBackground )
{
vcl::Font aToolFont = rStyleSettings.GetToolFont();
aToolFont.SetWeight( WEIGHT_BOLD );
- ApplyControlFont(*this, aToolFont);
+ ApplyControlFont(*GetOutDev(), aToolFont);
// Adapt font size if window too small?
while (GetTextHeight() > (GetOutputSizePixel().Height() - 1))
@@ -601,7 +601,7 @@ void TabBar::ImplInitSettings( bool bFont, bool bBackground )
if (bBackground)
{
- ApplyControlBackground(*this, rStyleSettings.GetFaceColor());
+ ApplyControlBackground(*GetOutDev(), rStyleSettings.GetFaceColor());
}
}
@@ -2021,7 +2021,7 @@ bool TabBar::StartEditMode(sal_uInt16 nPageId)
weld::Entry& rEntry = mpImpl->mxEdit->get_widget();
rEntry.set_text(GetPageText(mnEditId));
mpImpl->mxEdit->SetPosSizePixel(Point(nX, aRect.Top() + mnOffY + 1), Size(nWidth, aRect.GetHeight() - 3));
- vcl::Font aFont = GetPointFont(*this); // FIXME RenderContext
+ vcl::Font aFont = GetPointFont(*GetOutDev()); // FIXME RenderContext
Color aForegroundColor;
Color aBackgroundColor;
@@ -2308,8 +2308,8 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos)
if (nOldFirstPos != mnFirstPos)
{
tools::Rectangle aRect(mnOffX, 0, mnLastOffX, maWinSize.Height());
- SetFillColor(GetBackground().GetColor());
- DrawRect(aRect);
+ GetOutDev()->SetFillColor(GetBackground().GetColor());
+ GetOutDev()->DrawRect(aRect);
Invalidate(aRect);
}
}
@@ -2324,8 +2324,8 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos)
if (mnDropPos < nItemCount)
{
- SetLineColor(aBlackColor);
- SetFillColor(aBlackColor);
+ GetOutDev()->SetLineColor(aBlackColor);
+ GetOutDev()->SetFillColor(aBlackColor);
auto& pItem = mpImpl->mpItemList[mnDropPos];
nX = pItem->maRect.Left();
@@ -2336,20 +2336,20 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos)
if (!pItem->IsDefaultTabBgColor() && !pItem->mbSelect)
{
- SetLineColor(pItem->maTabTextColor);
- SetFillColor(pItem->maTabTextColor);
+ GetOutDev()->SetLineColor(pItem->maTabTextColor);
+ GetOutDev()->SetFillColor(pItem->maTabTextColor);
}
tools::Polygon aPoly(3);
aPoly.SetPoint(Point(nX, nY), 0);
aPoly.SetPoint(Point(nX + nTriangleWidth, nY - nTriangleWidth), 1);
aPoly.SetPoint(Point(nX + nTriangleWidth, nY + nTriangleWidth), 2);
- DrawPolygon(aPoly);
+ GetOutDev()->DrawPolygon(aPoly);
}
if (mnDropPos > 0 && mnDropPos < nItemCount + 1)
{
- SetLineColor(aBlackColor);
- SetFillColor(aBlackColor);
+ GetOutDev()->SetLineColor(aBlackColor);
+ GetOutDev()->SetFillColor(aBlackColor);
auto& pItem = mpImpl->mpItemList[mnDropPos - 1];
nX = pItem->maRect.Right();
@@ -2357,14 +2357,14 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos)
nX++;
if (!pItem->IsDefaultTabBgColor() && !pItem->mbSelect)
{
- SetLineColor(pItem->maTabTextColor);
- SetFillColor(pItem->maTabTextColor);
+ GetOutDev()->SetLineColor(pItem->maTabTextColor);
+ GetOutDev()->SetFillColor(pItem->maTabTextColor);
}
tools::Polygon aPoly(3);
aPoly.SetPoint(Point(nX, nY), 0);
aPoly.SetPoint(Point(nX - nTriangleWidth, nY - nTriangleWidth), 1);
aPoly.SetPoint(Point(nX - nTriangleWidth, nY + nTriangleWidth), 2);
- DrawPolygon(aPoly);
+ GetOutDev()->DrawPolygon(aPoly);
}
return mnDropPos;
@@ -2387,9 +2387,9 @@ void TabBar::HideDropPos()
// immediately call Paint, as it is not possible during drag and drop
tools::Rectangle aRect( nX-1, nY1, nX+3, nY2 );
vcl::Region aRegion( aRect );
- SetClipRegion( aRegion );
+ GetOutDev()->SetClipRegion( aRegion );
Invalidate(aRect);
- SetClipRegion();
+ GetOutDev()->SetClipRegion();
}
if (mnDropPos > 0 && mnDropPos < nItemCount + 1)
{
@@ -2398,9 +2398,9 @@ void TabBar::HideDropPos()
// immediately call Paint, as it is not possible during drag and drop
tools::Rectangle aRect(nX - 2, nY1, nX + 1, nY2);
vcl::Region aRegion(aRect);
- SetClipRegion(aRegion);
+ GetOutDev()->SetClipRegion(aRegion);
Invalidate(aRect);
- SetClipRegion();
+ GetOutDev()->SetClipRegion();
}
mbDropPos = false;
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 433535a07e1e..a2d49695c540 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -57,7 +57,7 @@ namespace svt::table
// by default, use the background as determined by the style settings
const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
SetBackground( Wallpaper( aWindowColor ) );
- SetFillColor( aWindowColor );
+ GetOutDev()->SetFillColor( aWindowColor );
SetCompoundControl( true );
}
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index 837097516eda..06e6902b0444 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -38,7 +38,7 @@ namespace svt::table
// by default, use the background as determined by the style settings
const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
SetBackground( Wallpaper( aWindowColor ) );
- SetFillColor( aWindowColor );
+ GetOutDev()->SetFillColor( aWindowColor );
}
TableDataWindow::~TableDataWindow()
@@ -97,7 +97,7 @@ namespace svt::table
tools::Rectangle const aCellRect( aCell.getRect() );
PTableRenderer const pRenderer = pTableModel->getRenderer();
- if ( pRenderer->FitsIntoCell( aCellToolTip, *this, aCellRect ) )
+ if ( pRenderer->FitsIntoCell( aCellToolTip, *GetOutDev(), aCellRect ) )
aCellToolTip.clear();
}