summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx2
-rw-r--r--framework/source/uielement/statusbarmanager.cxx5
-rw-r--r--include/vcl/event.hxx47
-rw-r--r--sc/source/ui/sidebar/CellLineStyleValueSet.cxx2
-rw-r--r--sd/source/ui/animations/CustomAnimationCreateDialog.cxx2
-rw-r--r--sfx2/source/appl/newhelp.cxx4
-rw-r--r--sfx2/source/statbar/stbitem.cxx2
-rw-r--r--svtools/source/control/ctrlbox.cxx53
-rw-r--r--svtools/source/control/valueset.cxx2
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.cxx9
-rw-r--r--svx/source/gallery2/galctrl.cxx2
-rw-r--r--svx/source/sidebar/line/LineWidthValueSet.cxx2
-rw-r--r--svx/source/sidebar/tools/ValueSetWithTextControl.cxx2
-rw-r--r--svx/source/stbctrls/modctrl.cxx4
-rw-r--r--svx/source/stbctrls/pszctrl.cxx4
-rw-r--r--svx/source/stbctrls/selctrl.cxx2
-rw-r--r--svx/source/stbctrls/xmlsecctrl.cxx4
-rw-r--r--svx/source/stbctrls/zoomctrl.cxx2
-rw-r--r--svx/source/stbctrls/zoomsliderctrl.cxx2
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx30
-rw-r--r--sw/source/ui/frmdlg/column.cxx2
-rw-r--r--sw/source/uibase/utlui/viewlayoutctrl.cxx4
-rw-r--r--vcl/source/control/combobox.cxx4
-rw-r--r--vcl/source/control/ilstbox.cxx4
-rw-r--r--vcl/source/control/lstbox.cxx8
-rw-r--r--vcl/source/window/status.cxx4
26 files changed, 107 insertions, 101 deletions
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index db448d2dc28d..0d3c96deb694 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -346,7 +346,7 @@ namespace svx
void SuggestionSet::UserDraw( const UserDrawEvent& rUDEvt )
{
- OutputDevice* pDev = rUDEvt.GetDevice();
+ vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
Rectangle aRect = rUDEvt.GetRect();
sal_uInt16 nItemId = rUDEvt.GetItemId();
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index a9a33a41c053..5a034bb95c87 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -576,10 +576,9 @@ void StatusBarManager::UserDraw( const UserDrawEvent& rUDEvt )
if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
{
uno::Reference< frame::XStatusbarController > xController( it->second );
- if ( xController.is() && rUDEvt.GetDevice() )
+ if (xController.is() && rUDEvt.GetRenderContext())
{
- uno::Reference< awt::XGraphics > xGraphics =
- rUDEvt.GetDevice()->CreateUnoGraphics();
+ uno::Reference< awt::XGraphics > xGraphics = rUDEvt.GetRenderContext()->CreateUnoGraphics();
awt::Rectangle aRect( rUDEvt.GetRect().Left(),
rUDEvt.GetRect().Top(),
diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx
index 973203356ac1..085182a41d0c 100644
--- a/include/vcl/event.hxx
+++ b/include/vcl/event.hxx
@@ -296,45 +296,48 @@ inline HelpEvent::HelpEvent( HelpEventMode nHelpMode )
mbKeyboardActivated = true;
}
-
-// - UserDrawEvent -
-
-
+/// Event to pass information for UserDraw() handling eg. in comboboxes.
class VCL_DLLPUBLIC UserDrawEvent
{
private:
- VclPtr<OutputDevice> mpOutDev;
+ /// Window that owns the user draw.
+ VclPtr<vcl::Window> mpWindow;
+
+ /// RenderContext to which we should draw - can be a VirtualDevice or anything.
+ VclPtr<vcl::RenderContext> mpRenderContext;
+
Rectangle maOutRect;
sal_uInt16 mnItemId;
sal_uInt16 mnStyle;
public:
- UserDrawEvent();
- UserDrawEvent( OutputDevice* pOut,
- const Rectangle& rOutRect,
- sal_uInt16 nId, sal_uInt16 nStyle = 0 );
+ UserDrawEvent();
+ UserDrawEvent(vcl::Window* pWindow, vcl::RenderContext* pRenderContext,
+ const Rectangle& rOutRect, sal_uInt16 nId, sal_uInt16 nStyle = 0);
- OutputDevice* GetDevice() const { return mpOutDev; }
+ vcl::Window* GetWindow() const { return mpWindow; }
+ vcl::RenderContext* GetRenderContext() const { return mpRenderContext; }
const Rectangle& GetRect() const { return maOutRect; }
- sal_uInt16 GetItemId() const { return mnItemId; }
- sal_uInt16 GetStyle() const { return mnStyle; }
+ sal_uInt16 GetItemId() const { return mnItemId; }
+ sal_uInt16 GetStyle() const { return mnStyle; }
};
inline UserDrawEvent::UserDrawEvent()
+ : mpWindow(nullptr)
+ , mpRenderContext(nullptr)
+ , mnItemId(0)
+ , mnStyle(0)
{
- mpOutDev = NULL;
- mnItemId = 0;
- mnStyle = 0;
}
-inline UserDrawEvent::UserDrawEvent( OutputDevice* pOut,
- const Rectangle& rOutRect,
- sal_uInt16 nId, sal_uInt16 nStyle ) :
- maOutRect( rOutRect )
+inline UserDrawEvent::UserDrawEvent(vcl::Window* pWindow, vcl::RenderContext* pRenderContext,
+ const Rectangle& rOutRect, sal_uInt16 nId, sal_uInt16 nStyle)
+ : mpWindow(pWindow)
+ , mpRenderContext(pRenderContext)
+ , maOutRect( rOutRect )
+ , mnItemId(nId)
+ , mnStyle(nStyle)
{
- mpOutDev = pOut;
- mnItemId = nId;
- mnStyle = nStyle;
}
diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
index b0da0a8583da..7f3c6444d1a4 100644
--- a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
+++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx
@@ -69,7 +69,7 @@ void CellLineStyleValueSet::SetSelItem(sal_uInt16 nSel)
void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt )
{
Rectangle aRect = rUDEvt.GetRect();
- OutputDevice* pDev = rUDEvt.GetDevice();
+ vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
sal_uInt16 nItemId = rUDEvt.GetItemId();
long nRectHeight = aRect.GetHeight();
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
index 333baa7b0b35..db86cd5d31ff 100644
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
@@ -112,7 +112,7 @@ void CategoryListBox::UserDraw( const UserDrawEvent& rUDEvt )
if( ListBox::GetEntryFlags(nItem) & ListBoxEntryFlags::DisableSelection )
{
Rectangle aOutRect( rUDEvt.GetRect() );
- OutputDevice* pDev = rUDEvt.GetDevice();
+ vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
// fill the background
Color aColor (GetSettings().GetStyleSettings().GetDialogColor());
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 1627160142dc..11b838edaab3 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -503,10 +503,10 @@ void IndexBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
// indent sub entries
Point aPos( rUDEvt.GetRect().TopLeft() );
aPos.X() += 8;
- aPos.Y() += ( rUDEvt.GetRect().GetHeight() - rUDEvt.GetDevice()->GetTextHeight() ) / 2;
+ aPos.Y() += (rUDEvt.GetRect().GetHeight() - rUDEvt.GetRenderContext()->GetTextHeight()) / 2;
OUString aEntry( GetEntry( rUDEvt.GetItemId() ) );
sal_Int32 nPos = aEntry.indexOf( ';' );
- rUDEvt.GetDevice()->DrawText( aPos, ( nPos !=-1 ) ? aEntry.copy( nPos + 1 ) : aEntry );
+ rUDEvt.GetRenderContext()->DrawText(aPos, (nPos !=-1) ? aEntry.copy(nPos + 1) : aEntry);
}
else
DrawEntry( rUDEvt, false, true, true );
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx
index d3dea7c7fe7d..204fee2207ce 100644
--- a/sfx2/source/statbar/stbitem.cxx
+++ b/sfx2/source/statbar/stbitem.cxx
@@ -396,7 +396,7 @@ throw ( ::uno::RuntimeException, std::exception )
if ( pOutDev )
{
::Rectangle aRect = VCLRectangle( rOutputRectangle );
- UserDrawEvent aUserDrawEvent( pOutDev, aRect, pBar->GetCurItemId(), (sal_uInt16)nStyle );
+ UserDrawEvent aUserDrawEvent(nullptr, pOutDev, aRect, pBar->GetCurItemId(), static_cast<sal_uInt16>(nStyle));
Paint( aUserDrawEvent );
}
}
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 871b5c1b8b50..8cbd6fbcde74 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -258,11 +258,12 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt )
const Rectangle aRect(aPos, aImageSize);
- rUDEvt.GetDevice()->Push();
- rUDEvt.GetDevice()->SetFillColor( pData->aColor );
- rUDEvt.GetDevice()->SetLineColor( rUDEvt.GetDevice()->GetTextColor() );
- rUDEvt.GetDevice()->DrawRect(aRect);
- rUDEvt.GetDevice()->Pop();
+ vcl::RenderContext* pRenderContext = rUDEvt.GetRenderContext();
+ pRenderContext->Push();
+ pRenderContext->SetFillColor(pData->aColor);
+ pRenderContext->SetLineColor(pRenderContext->GetTextColor());
+ pRenderContext->DrawRect(aRect);
+ pRenderContext->Pop();
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0);
@@ -276,7 +277,7 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt )
if(!aBlendFrame.IsEmpty())
{
- rUDEvt.GetDevice()->DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
+ pRenderContext->DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
}
}
@@ -1125,15 +1126,16 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
nX += IMGOUTERTEXTSPACE;
const bool bSymbolFont = isSymbolFont(rInfo);
+ vcl::RenderContext* pRenderContext = rUDEvt.GetRenderContext();
- Color aTextColor = rUDEvt.GetDevice()->GetTextColor();
- vcl::Font aOldFont( rUDEvt.GetDevice()->GetFont() );
+ Color aTextColor = pRenderContext->GetTextColor();
+ vcl::Font aOldFont(pRenderContext->GetFont());
Size aSize( aOldFont.GetSize() );
aSize.Height() += EXTRAFONTSIZE;
vcl::Font aFont( rInfo );
aFont.SetSize( aSize );
- rUDEvt.GetDevice()->SetFont( aFont );
- rUDEvt.GetDevice()->SetTextColor( aTextColor );
+ pRenderContext->SetFont(aFont);
+ pRenderContext->SetTextColor(aTextColor);
bool bUsingCorrectFont = true;
Rectangle aTextRect;
@@ -1142,29 +1144,29 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
OUString sFontName = rInfo.GetName();
//If it shouldn't or can't draw its own name because it doesn't have the glyphs
- if (!canRenderNameOfSelectedFont(*rUDEvt.GetDevice()))
+ if (!canRenderNameOfSelectedFont(*pRenderContext))
bUsingCorrectFont = false;
else
{
//Make sure it fits in the available height, shrinking the font if necessary
- bUsingCorrectFont = shrinkFontToFit(sFontName, nH, aFont, *rUDEvt.GetDevice(), aTextRect) != 0;
+ bUsingCorrectFont = shrinkFontToFit(sFontName, nH, aFont, *pRenderContext, aTextRect) != 0;
}
if (!bUsingCorrectFont)
{
- rUDEvt.GetDevice()->SetFont(aOldFont);
- rUDEvt.GetDevice()->GetTextBoundRect(aTextRect, sFontName, 0, 0);
+ pRenderContext->SetFont(aOldFont);
+ pRenderContext->GetTextBoundRect(aTextRect, sFontName, 0, 0);
}
long nTextHeight = aTextRect.GetHeight();
long nDesiredGap = (nH-nTextHeight)/2;
long nVertAdjust = nDesiredGap - aTextRect.Top();
Point aPos( nX, aTopLeft.Y() + nVertAdjust );
- rUDEvt.GetDevice()->DrawText( aPos, sFontName );
+ pRenderContext->DrawText(aPos, sFontName);
long nTextX = aPos.X() + aTextRect.GetWidth() + GAPTOEXTRAPREVIEW;
if (!bUsingCorrectFont)
- rUDEvt.GetDevice()->SetFont( aFont );
+ pRenderContext->SetFont(aFont);
OUString sSampleText;
@@ -1173,7 +1175,7 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
const bool bNameBeginsWithLatinText = rInfo.GetName()[0] <= 'z';
if (bNameBeginsWithLatinText || !bUsingCorrectFont)
- sSampleText = makeShortRepresentativeTextForSelectedFont(*rUDEvt.GetDevice());
+ sSampleText = makeShortRepresentativeTextForSelectedFont(*pRenderContext);
}
//If we're not a symbol font, but could neither render our own name and
@@ -1221,7 +1223,7 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
OUString sText = makeShortRepresentativeTextForScript(aScripts[i]);
if (!sText.isEmpty())
{
- bool bHasSampleTextGlyphs = (-1 == rUDEvt.GetDevice()->HasGlyphs(aFont, sText));
+ bool bHasSampleTextGlyphs = (-1 == pRenderContext->HasGlyphs(aFont, sText));
if (bHasSampleTextGlyphs)
{
sSampleText = sText;
@@ -1241,7 +1243,7 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
OUString sText = makeShortMinimalTextForScript(aMinimalScripts[i]);
if (!sText.isEmpty())
{
- bool bHasSampleTextGlyphs = (-1 == rUDEvt.GetDevice()->HasGlyphs(aFont, sText));
+ bool bHasSampleTextGlyphs = (-1 == pRenderContext->HasGlyphs(aFont, sText));
if (bHasSampleTextGlyphs)
{
sSampleText = sText;
@@ -1255,22 +1257,23 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
//render something representative of what it would like to render then
//make up some semi-random text that it *can* display
if (bSymbolFont || (!bUsingCorrectFont && sSampleText.isEmpty()))
- sSampleText = makeShortRepresentativeSymbolTextForSelectedFont(*rUDEvt.GetDevice());
+ sSampleText = makeShortRepresentativeSymbolTextForSelectedFont(*pRenderContext);
if (!sSampleText.isEmpty())
{
- const Size &rItemSize = rUDEvt.GetDevice()->GetOutputSize();
+ const Size &rItemSize = rUDEvt.GetWindow()->GetOutputSize();
+
//leave a little border at the edge
long nSpace = rItemSize.Width() - nTextX - IMGOUTERTEXTSPACE;
if (nSpace >= 0)
{
//Make sure it fits in the available height, and get how wide that would be
- long nWidth = shrinkFontToFit(sSampleText, nH, aFont, *rUDEvt.GetDevice(), aTextRect);
+ long nWidth = shrinkFontToFit(sSampleText, nH, aFont, *pRenderContext, aTextRect);
//Chop letters off until it fits in the available width
while (nWidth > nSpace || nWidth > MAXPREVIEWWIDTH)
{
sSampleText = sSampleText.copy(0, sSampleText.getLength()-1);
- nWidth = rUDEvt.GetDevice()->GetTextBoundRect(aTextRect, sSampleText, 0, 0) ?
+ nWidth = pRenderContext->GetTextBoundRect(aTextRect, sSampleText, 0, 0) ?
aTextRect.GetWidth() : 0;
}
@@ -1281,12 +1284,12 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
nDesiredGap = (nH-nTextHeight)/2;
nVertAdjust = nDesiredGap - aTextRect.Top();
aPos = Point(nTextX + nSpace - nWidth, aTopLeft.Y() + nVertAdjust);
- rUDEvt.GetDevice()->DrawText( aPos, sSampleText );
+ pRenderContext->DrawText(aPos, sSampleText);
}
}
}
- rUDEvt.GetDevice()->SetFont( aOldFont );
+ pRenderContext->SetFont(aOldFont);
DrawEntry( rUDEvt, false, false); // draw separator
}
else
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 4866dc3ef59b..584329dd0645 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -299,7 +299,7 @@ void ValueSet::ImplFormatItem(vcl::RenderContext& rRenderContext, ValueSetItem*
if (pItem->meType == VALUESETITEM_USERDRAW)
{
- UserDrawEvent aUDEvt(maVirDev.get(), aRect, pItem->mnId);
+ UserDrawEvent aUDEvt(this, maVirDev.get(), aRect, pItem->mnId);
UserDraw(aUDEvt);
}
else
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
index 8242a78fd037..b3855f692e7b 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -134,7 +134,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
25, 50,
30, 70,
35, 90, // up to here line positions
- 05, 10, // character positions
+ 5, 10, // character positions
10, 30,
15, 50,
20, 70,
@@ -145,9 +145,10 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
const Color aBackColor = rStyleSettings.GetFieldColor();
const Color aTextColor = rStyleSettings.GetFieldTextColor();
- OutputDevice* pDev = rUDEvt.GetDevice();
+ vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
Rectangle aRect = rUDEvt.GetRect();
- sal_uInt16 nItemId = rUDEvt.GetItemId();
+ sal_uInt16 nItemId = rUDEvt.GetItemId();
+
long nRectWidth = aRect.GetWidth();
long nRectHeight = aRect.GetHeight();
Size aRectSize(nRectWidth, aRect.GetHeight());
@@ -503,7 +504,7 @@ void SvxBmpNumValueSet::UserDraw(const UserDrawEvent& rUDEvt)
SvxNumValueSet::UserDraw(rUDEvt);
Rectangle aRect = rUDEvt.GetRect();
- OutputDevice* pDev = rUDEvt.GetDevice();
+ vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
sal_uInt16 nItemId = rUDEvt.GetItemId();
Point aBLPos = aRect.TopLeft();
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index cf03018d974c..e05b8abd7c15 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -355,7 +355,7 @@ void GalleryIconView::UserDraw(const UserDrawEvent& rUDEvt)
const Point aPos(
((aSize.Width() - aBitmapExSizePixel.Width()) >> 1) + rRect.Left(),
((aSize.Height() - aBitmapExSizePixel.Height()) >> 1) + rRect.Top());
- OutputDevice* pDev = rUDEvt.GetDevice();
+ OutputDevice* pDev = rUDEvt.GetRenderContext();
if(aBitmapEx.IsTransparent())
{
diff --git a/svx/source/sidebar/line/LineWidthValueSet.cxx b/svx/source/sidebar/line/LineWidthValueSet.cxx
index db4fe239b835..c800e686f9a0 100644
--- a/svx/source/sidebar/line/LineWidthValueSet.cxx
+++ b/svx/source/sidebar/line/LineWidthValueSet.cxx
@@ -102,7 +102,7 @@ void LineWidthValueSet::SetCusEnable(bool bEnable)
void LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt )
{
Rectangle aRect = rUDEvt.GetRect();
- OutputDevice* pDev = rUDEvt.GetDevice();
+ vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
sal_uInt16 nItemId = rUDEvt.GetItemId();
long nRectHeight = aRect.GetHeight();
diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
index 1b47ccd5b4ba..80bceaeda362 100644
--- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
+++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
@@ -146,7 +146,7 @@ void ValueSetWithTextControl::ReplaceItemImages(
void ValueSetWithTextControl::UserDraw( const UserDrawEvent& rUDEvt )
{
const Rectangle aRect = rUDEvt.GetRect();
- OutputDevice* pDev = rUDEvt.GetDevice();
+ vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
pDev->Push( PushFlags::ALL );
const sal_uInt16 nItemId = rUDEvt.GetItemId();
diff --git a/svx/source/stbctrls/modctrl.cxx b/svx/source/stbctrls/modctrl.cxx
index 5374f369c5f7..d22b3a550e1a 100644
--- a/svx/source/stbctrls/modctrl.cxx
+++ b/svx/source/stbctrls/modctrl.cxx
@@ -150,8 +150,8 @@ Point centerImage(const Rectangle& rBoundingRect, const Image& rImg)
void SvxModifyControl::Paint( const UserDrawEvent& rUsrEvt )
{
- OutputDevice* pDev = rUsrEvt.GetDevice();
- Rectangle aRect = rUsrEvt.GetRect();
+ vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();
+ Rectangle aRect(rUsrEvt.GetRect());
ImplData::ModificationState state = mxImpl->mnModState;
Point aPt = centerImage(aRect, mxImpl->maImages[state]);
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index 951317c7ab72..4dd90d97f447 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -351,8 +351,8 @@ void SvxPosSizeStatusBarControl::Command( const CommandEvent& rCEvt )
void SvxPosSizeStatusBarControl::Paint( const UserDrawEvent& rUsrEvt )
{
- OutputDevice* pDev = rUsrEvt.GetDevice();
- assert(pDev && "no OutputDevice on UserDrawEvent");
+ vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();
+
const Rectangle& rRect = rUsrEvt.GetRect();
StatusBar& rBar = GetStatusBar();
Point aItemPos = rBar.GetItemTextPos( GetId() );
diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx
index 5ddf609bc932..c44f45625bb9 100644
--- a/svx/source/stbctrls/selctrl.cxx
+++ b/svx/source/stbctrls/selctrl.cxx
@@ -139,7 +139,7 @@ bool SvxSelectionModeControl::MouseButtonDown( const MouseEvent& rEvt )
void SvxSelectionModeControl::Paint( const UserDrawEvent& rUsrEvt )
{
const Rectangle aControlRect = getControlRect();
- OutputDevice* pDev = rUsrEvt.GetDevice();
+ vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();
Rectangle aRect = rUsrEvt.GetRect();
Size aImgSize( maImage.GetSizePixel() );
diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx
index 325bb00c7f54..0c530b64a3c2 100644
--- a/svx/source/stbctrls/xmlsecctrl.cxx
+++ b/svx/source/stbctrls/xmlsecctrl.cxx
@@ -142,8 +142,8 @@ void XmlSecStatusBarControl::Command( const CommandEvent& rCEvt )
void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt )
{
- OutputDevice* pDev = rUsrEvt.GetDevice();
- DBG_ASSERT( pDev, "-XmlSecStatusBarControl::Paint(): no Output Device... this will lead to nirvana..." );
+ vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();
+
Rectangle aRect = rUsrEvt.GetRect();
Color aOldLineColor = pDev->GetLineColor();
Color aOldFillColor = pDev->GetFillColor();
diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx
index bbec9029fd85..024ee30f0524 100644
--- a/svx/source/stbctrls/zoomctrl.cxx
+++ b/svx/source/stbctrls/zoomctrl.cxx
@@ -186,7 +186,7 @@ SvxZoomPageStatusBarControl::SvxZoomPageStatusBarControl(sal_uInt16 _nSlotId,
void SvxZoomPageStatusBarControl::Paint(const UserDrawEvent& rUsrEvt)
{
- OutputDevice* pDev = rUsrEvt.GetDevice();
+ vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();
Rectangle aRect = rUsrEvt.GetRect();
Point aPt = centerImage(aRect, maImage);
pDev->DrawImage(aPt, maImage);
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index 81f2b23f8476..aa78ada2ffc7 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -252,7 +252,7 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt )
return;
const Rectangle aControlRect = getControlRect();
- OutputDevice* pDev = rUsrEvt.GetDevice();
+ vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();
Rectangle aRect = rUsrEvt.GetRect();
Rectangle aSlider = aRect;
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 4475e2595acc..eb96a7640e64 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -161,7 +161,7 @@ private:
void ReleaseFocus();
static Color TestColorsVisible(const Color &FontCol, const Color &BackCol);
static void UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName);
- void SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, OutputDevice *pDevice, const OUString &rStyleName, bool bIsNotSelected);
+ void SetupEntry(vcl::RenderContext& rRenderContext, vcl::Window* pParent, sal_uInt16 nItem, const Rectangle& rRect, const OUString& rStyleName, bool bIsNotSelected);
static bool AdjustFontForItemHeight(OutputDevice* pDevice, Rectangle& rTextRect, long nHeight);
DECL_LINK( MenuSelectHdl, Menu * );
};
@@ -585,7 +585,7 @@ bool SvxStyleBox_Impl::AdjustFontForItemHeight(OutputDevice* pDevice, Rectangle&
void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName)
{
- OutputDevice *pDevice = rUDEvt.GetDevice();
+ vcl::RenderContext *pDevice = rUDEvt.GetRenderContext();
// IMG_TXT_DISTANCE in ilstbox.hxx is 6, then 1 is added as
// nBorder, and we are adding 1 in order to look better when
@@ -604,7 +604,7 @@ void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString
pDevice->DrawText(aPos, rStyleName);
}
-void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, OutputDevice* pDevice, const OUString& rStyleName, bool bIsNotSelected)
+void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Window* pParent, sal_uInt16 nItem, const Rectangle& rRect, const OUString& rStyleName, bool bIsNotSelected)
{
unsigned int nId = rRect.GetHeight() != 0 ? (rRect.getY() / rRect.GetHeight()) : MAX_STYLES_ENTRIES;
if (nItem == 0 || nItem == GetEntryCount() - 1)
@@ -637,7 +637,7 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp
if ( pFontItem && pFontHeightItem )
{
Size aFontSize( 0, pFontHeightItem->GetHeight() );
- Size aPixelSize( pDevice->LogicToPixel( aFontSize, pShell->GetMapUnit() ) );
+ Size aPixelSize(rRenderContext.LogicToPixel(aFontSize, pShell->GetMapUnit()));
// setup the font properties
SvxFont aFont;
@@ -686,11 +686,11 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp
aFont.SetEmphasisMark( static_cast< const SvxEmphasisMarkItem* >( pItem )->GetEmphasisMark() );
// setup the device & draw
- vcl::Font aOldFont( pDevice->GetFont() );
+ vcl::Font aOldFont(rRenderContext.GetFont());
Color aFontCol = COL_AUTO, aBackCol = COL_AUTO;
- pDevice->SetFont( aFont );
+ rRenderContext.SetFont(aFont);
pItem = aItemSet.GetItem( SID_ATTR_CHAR_COLOR );
// text color, when nothing is selected
@@ -715,8 +715,8 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp
if ( aBackCol != COL_AUTO )
{
- pDevice->SetFillColor( aBackCol );
- pDevice->DrawRect(rRect);
+ rRenderContext.SetFillColor(aBackCol);
+ rRenderContext.DrawRect(rRect);
}
}
break;
@@ -726,11 +726,11 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp
// when the font and background color are too similar, adjust the Font-Color
if( (aFontCol != COL_AUTO) || (aBackCol != COL_AUTO) )
- aFontCol = TestColorsVisible(aFontCol, (aBackCol != COL_AUTO) ? aBackCol : pDevice->GetBackground().GetColor());
+ aFontCol = TestColorsVisible(aFontCol, (aBackCol != COL_AUTO) ? aBackCol : rRenderContext.GetBackground().GetColor());
// set text color
if ( aFontCol != COL_AUTO )
- pDevice->SetTextColor( aFontCol );
+ rRenderContext.SetTextColor(aFontCol);
// handle the push-button
if (bIsNotSelected)
@@ -742,9 +742,9 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp
{
if (nId < MAX_STYLES_ENTRIES)
{
- if(m_pButtons[nId] == nullptr)
+ if (!m_pButtons[nId] && pParent)
{
- m_pButtons[nId] = VclPtr<MenuButton>::Create(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS);
+ m_pButtons[nId] = VclPtr<MenuButton>::Create(pParent, WB_FLATBUTTON | WB_NOPOINTERFOCUS);
m_pButtons[nId]->SetSizePixel(Size(BUTTON_WIDTH, rRect.GetHeight()));
m_pButtons[nId]->SetPopupMenu(&m_aMenu);
}
@@ -762,13 +762,13 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
sal_uInt16 nItem = rUDEvt.GetItemId();
OUString aStyleName( GetEntry( nItem ) );
- OutputDevice *pDevice = rUDEvt.GetDevice();
+ vcl::RenderContext *pDevice = rUDEvt.GetRenderContext();
pDevice->Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
const Rectangle& rRect(rUDEvt.GetRect());
bool bIsNotSelected = rUDEvt.GetItemId() != GetSelectEntryPos();
- SetupEntry(nItem, rRect, pDevice, aStyleName, bIsNotSelected);
+ SetupEntry(*pDevice, rUDEvt.GetWindow(), nItem, rRect, aStyleName, bIsNotSelected);
UserDrawEntry(rUDEvt, aStyleName);
@@ -798,7 +798,7 @@ void SvxStyleBox_Impl::CalcOptimalExtraUserWidth()
OUString sStyleName(GetEntry(i));
Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
- SetupEntry(i, Rectangle(0, 0, RECT_MAX, ITEM_HEIGHT), this, sStyleName, true);
+ SetupEntry(*this /*FIXME rendercontext*/, this, i, Rectangle(0, 0, RECT_MAX, ITEM_HEIGHT), sStyleName, true);
Rectangle aTextRectForActualFont;
GetTextBoundRect(aTextRectForActualFont, sStyleName);
if (AdjustFontForItemHeight(this, aTextRectForActualFont, ITEM_HEIGHT))
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 903926976f31..266011e86c3e 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -1352,7 +1352,7 @@ void SwColumnPage::SetInSection(bool bSet)
void ColumnValueSet::UserDraw(const UserDrawEvent& rUDEvt)
{
- OutputDevice* pDev = rUDEvt.GetDevice();
+ vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
Rectangle aRect = rUDEvt.GetRect();
diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx
index 68f2559576e3..2536586458f9 100644
--- a/sw/source/uibase/utlui/viewlayoutctrl.cxx
+++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx
@@ -111,8 +111,8 @@ void SwViewLayoutControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState
void SwViewLayoutControl::Paint( const UserDrawEvent& rUsrEvt )
{
- OutputDevice* pDev = rUsrEvt.GetDevice();
- Rectangle aRect = rUsrEvt.GetRect();
+ vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();
+ Rectangle aRect(rUsrEvt.GetRect());
const Rectangle aControlRect = getControlRect();
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 096452a21baf..4f41c31c420c 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1254,8 +1254,8 @@ void ComboBox::EnableUserDraw( bool bUserDraw )
void ComboBox::DrawEntry(const UserDrawEvent& rEvt, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos)
{
- DBG_ASSERT(rEvt.GetDevice() == mpImplLB->GetMainWindow(), "DrawEntry?!");
- mpImplLB->GetMainWindow()->DrawEntry(*rEvt.GetDevice(), rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos);
+ DBG_ASSERT(rEvt.GetWindow() == mpImplLB->GetMainWindow(), "DrawEntry?!");
+ mpImplLB->GetMainWindow()->DrawEntry(*rEvt.GetRenderContext(), rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos);
}
void ComboBox::SetSeparatorPos( sal_Int32 n )
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 5d47dacf9580..d13931877b44 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1736,7 +1736,7 @@ void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32
nCurr = GetEntryList()->FindEntry(GetEntryList()->GetEntryText(nCurr));
nCurr = sal::static_int_cast<sal_Int32>(nCurr - GetEntryList()->GetMRUCount());
- UserDrawEvent aUDEvt(&rRenderContext, aRect, nPos, nCurr);
+ UserDrawEvent aUDEvt(this, &rRenderContext, aRect, nPos, nCurr);
userDrawSignal(&aUDEvt);
mbInUserDraw = false;
}
@@ -2747,7 +2747,7 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout)
if ( IsUserDrawEnabled() )
{
mbInUserDraw = true;
- UserDrawEvent aUDEvt(&rRenderContext, maFocusRect, mnItemPos, 0);
+ UserDrawEvent aUDEvt(this, &rRenderContext, maFocusRect, mnItemPos, 0);
userDrawSignal( &aUDEvt );
mbInUserDraw = false;
}
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index b476d8647ada..315e405b7a7a 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1383,10 +1383,10 @@ void ListBox::UserDraw( const UserDrawEvent& )
void ListBox::DrawEntry(const UserDrawEvent& rEvt, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos)
{
- if (rEvt.GetDevice() == mpImplLB->GetMainWindow())
- mpImplLB->GetMainWindow()->DrawEntry(*rEvt.GetDevice(), rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
- else if (rEvt.GetDevice() == mpImplWin)
- mpImplWin->DrawEntry(*rEvt.GetDevice(), bDrawImage, bDrawText, bDrawTextAtImagePos);
+ if (rEvt.GetWindow() == mpImplLB->GetMainWindow())
+ mpImplLB->GetMainWindow()->DrawEntry(*rEvt.GetRenderContext(), rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
+ else if (rEvt.GetWindow() == mpImplWin)
+ mpImplWin->DrawEntry(*rEvt.GetRenderContext(), bDrawImage, bDrawText, bDrawTextAtImagePos);
}
void ListBox::SetUserItemSize( const Size& rSz )
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 0ea944d82c66..bc1e553f2421 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -415,14 +415,14 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen
{
mbInUserDraw = true;
mpImplData->mpVirDev->EnableRTL( IsRTLEnabled() );
- UserDrawEvent aODEvt(mpImplData->mpVirDev, Rectangle(Point(), aTextRectSize), pItem->mnId);
+ UserDrawEvent aODEvt(this, mpImplData->mpVirDev, Rectangle(Point(), aTextRectSize), pItem->mnId);
UserDraw(aODEvt);
mpImplData->mpVirDev->EnableRTL(false);
mbInUserDraw = false;
}
else
{
- UserDrawEvent aODEvt(&rRenderContext, aTextRect, pItem->mnId);
+ UserDrawEvent aODEvt(this, &rRenderContext, aTextRect, pItem->mnId);
UserDraw(aODEvt);
}
}