diff options
Diffstat (limited to 'vcl/source')
71 files changed, 897 insertions, 623 deletions
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index b630bc086aee..662cfa26ac6b 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -264,9 +264,9 @@ HelpTextWindow::HelpTextWindow( vcl::Window* pParent, const OUString& rText, sal if( mnStyle & QuickHelpFlags::BiDiRtl ) { - ComplexTextLayoutFlags nLayoutMode = GetLayoutMode(); + ComplexTextLayoutFlags nLayoutMode = GetOutDev()->GetLayoutMode(); nLayoutMode |= ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft; - SetLayoutMode( nLayoutMode ); + GetOutDev()->SetLayoutMode( nLayoutMode ); } SetHelpText( rText ); Window::SetHelpText( rText ); @@ -326,13 +326,13 @@ void HelpTextWindow::dispose() void HelpTextWindow::SetHelpText( const OUString& rHelpText ) { maHelpText = rHelpText; - ApplySettings(*this); + ApplySettings(*GetOutDev()); if ( mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.getLength() < HELPTEXTMAXLEN && maHelpText.indexOf('\n') < 0) { Size aSize; aSize.setHeight( GetTextHeight() ); if ( mnStyle & QuickHelpFlags::CtrlText ) - aSize.setWidth( GetCtrlTextWidth( maHelpText ) ); + aSize.setWidth( GetOutDev()->GetCtrlTextWidth( maHelpText ) ); else aSize.setWidth( GetTextWidth( maHelpText ) ); maTextRect = tools::Rectangle( Point( HELPTEXTMARGIN_QUICK, HELPTEXTMARGIN_QUICK ), aSize ); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 20ad4154d23f..813d74470139 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -321,7 +321,7 @@ Size SalInstanceWidget::get_pixel_size(const OUString& rText) const return Size(m_xWidget->GetTextWidth(rText), m_xWidget->GetTextHeight()); } -vcl::Font SalInstanceWidget::get_font() { return m_xWidget->GetPointFont(*m_xWidget); } +vcl::Font SalInstanceWidget::get_font() { return m_xWidget->GetPointFont(*m_xWidget->GetOutDev()); } OString SalInstanceWidget::get_buildable_name() const { return m_xWidget->get_id().toUtf8(); } @@ -1251,7 +1251,7 @@ std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const void SalInstanceWidget::DoRecursivePaint(vcl::Window* pWindow, const Point& rRenderLogicPos, OutputDevice& rOutput) { - pWindow->Push(); + rOutput.Push(); bool bOldMapModeEnabled = pWindow->IsMapModeEnabled(); if (pWindow->GetMapMode().GetMapUnit() != rOutput.GetMapMode().GetMapUnit()) @@ -1297,7 +1297,7 @@ void SalInstanceWidget::DoRecursivePaint(vcl::Window* pWindow, const Point& rRen xOutput.disposeAndClear(); pWindow->EnableMapMode(bOldMapModeEnabled); - pWindow->Pop(); + rOutput.Pop(); for (vcl::Window* pChild = pWindow->GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next)) @@ -3303,7 +3303,7 @@ void SalInstanceEntry::set_message_type(weld::EntryMessageType eType) void SalInstanceEntry::set_font(const vcl::Font& rFont) { - m_xEntry->SetPointFont(*m_xEntry, rFont); + m_xEntry->SetPointFont(*m_xEntry->GetOutDev(), rFont); m_xEntry->Invalidate(); } @@ -5765,8 +5765,9 @@ void SalInstanceTextView::set_monospace(bool bMonospace) vcl::Font aOrigFont = m_xTextView->GetControlFont(); vcl::Font aFont; if (bMonospace) - aFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_FIXED, LANGUAGE_DONTKNOW, - GetDefaultFontFlags::OnlyOne, m_xTextView); + aFont + = OutputDevice::GetDefaultFont(DefaultFontType::UI_FIXED, LANGUAGE_DONTKNOW, + GetDefaultFontFlags::OnlyOne, m_xTextView->GetOutDev()); else aFont = Application::GetSettings().GetStyleSettings().GetFieldFont(); aFont.SetFontHeight(aOrigFont.GetFontHeight()); @@ -6062,7 +6063,7 @@ SalInstanceDrawingArea::~SalInstanceDrawingArea() Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>()); } -OutputDevice& SalInstanceDrawingArea::get_ref_device() { return *m_xDrawingArea; } +OutputDevice& SalInstanceDrawingArea::get_ref_device() { return *m_xDrawingArea->GetOutDev(); } void SalInstanceDrawingArea::click(const Point& rPos) { @@ -6384,7 +6385,7 @@ void SalInstanceComboBoxWithEdit::set_entry_font(const vcl::Font& rFont) { Edit* pEdit = m_xComboBox->GetSubEdit(); assert(pEdit); - pEdit->SetPointFont(*pEdit, rFont); + pEdit->SetPointFont(*pEdit->GetOutDev(), rFont); m_xComboBox->SetControlFont(rFont); // tdf#134601 set it as control font to take effect properly pEdit->Invalidate(); } @@ -6393,7 +6394,7 @@ vcl::Font SalInstanceComboBoxWithEdit::get_entry_font() { Edit* pEdit = m_xComboBox->GetSubEdit(); assert(pEdit); - return pEdit->GetPointFont(*pEdit); + return pEdit->GetPointFont(*pEdit->GetOutDev()); } void SalInstanceComboBoxWithEdit::set_custom_renderer(bool bOn) @@ -6438,7 +6439,7 @@ void SalInstanceComboBoxWithEdit::HandleEventListener(VclWindowEvent& rEvent) { if (rEvent.GetId() == VclEventId::DropdownPreOpen) { - Size aRowSize(signal_custom_get_size(*m_xComboBox)); + Size aRowSize(signal_custom_get_size(*m_xComboBox->GetOutDev())); m_xComboBox->SetUserItemSize(aRowSize); } CallHandleEventListener(rEvent); @@ -6520,14 +6521,14 @@ public: virtual void set_entry_font(const vcl::Font& rFont) override { Edit& rEntry = m_pEntry->getEntry(); - rEntry.SetPointFont(rEntry, rFont); + rEntry.SetPointFont(*rEntry.GetOutDev(), rFont); rEntry.Invalidate(); } virtual vcl::Font get_entry_font() override { Edit& rEntry = m_pEntry->getEntry(); - return rEntry.GetPointFont(rEntry); + return rEntry.GetPointFont(*rEntry.GetOutDev()); } virtual void set_entry_placeholder_text(const OUString& rText) override diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 963a2a2f9457..0e74c7b8ee7e 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -670,8 +670,8 @@ void Application::SetSettings( const AllSettings& rSettings ) tools::Long nOldDPIY = 0; if ( pFirstFrame ) { - nOldDPIX = pFirstFrame->GetDPIX(); - nOldDPIY = pFirstFrame->GetDPIY(); + nOldDPIX = pFirstFrame->GetOutDev()->GetDPIX(); + nOldDPIY = pFirstFrame->GetOutDev()->GetDPIY(); vcl::Window::ImplInitAppFontData(pFirstFrame); } vcl::Window* pFrame = pFirstFrame; @@ -702,8 +702,8 @@ void Application::SetSettings( const AllSettings& rSettings ) pFirstFrame = pSVData->maFrameData.mpFirstFrame; if ( pFirstFrame ) { - if ( (pFirstFrame->GetDPIX() != nOldDPIX) || - (pFirstFrame->GetDPIY() != nOldDPIY) ) + if ( (pFirstFrame->GetOutDev()->GetDPIX() != nOldDPIX) || + (pFirstFrame->GetOutDev()->GetDPIY() != nOldDPIY) ) { VirtualDevice* pVirDev = pSVData->maGDIData.mpFirstVirDev; while ( pVirDev ) @@ -712,8 +712,8 @@ void Application::SetSettings( const AllSettings& rSettings ) (pVirDev->GetDPIX() == nOldDPIX) && (pVirDev->GetDPIY() == nOldDPIY) ) { - pVirDev->SetDPIX( pFirstFrame->GetDPIX() ); - pVirDev->SetDPIY( pFirstFrame->GetDPIY() ); + pVirDev->SetDPIX( pFirstFrame->GetOutDev()->GetDPIX() ); + pVirDev->SetDPIY( pFirstFrame->GetOutDev()->GetDPIY() ); if ( pVirDev->IsMapModeEnabled() ) { MapMode aMapMode = pVirDev->GetMapMode(); @@ -1037,10 +1037,6 @@ ImplSVEvent * Application::PostUserEvent( const Link<void*,void>& rLink, void* p if (bReferenceLink) { SolarMutexGuard aGuard; - // Double check that this is indeed a vcl::Window instance. - assert(dynamic_cast<vcl::Window *>( - static_cast<OutputDevice *>(rLink.GetInstance())) == - static_cast<vcl::Window *>(rLink.GetInstance())); pSVEvent->mpInstanceRef = static_cast<vcl::Window *>(rLink.GetInstance()); } @@ -1072,7 +1068,7 @@ vcl::Window* Application::GetFocusWindow() OutputDevice* Application::GetDefaultDevice() { - return ImplGetDefaultWindow(); + return ImplGetDefaultWindow()->GetOutDev(); } vcl::Window* Application::GetFirstTopLevelWindow() diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index a0a52b91e591..ba5fce26278a 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -44,6 +44,7 @@ #include <salgdi.hxx> #include <svdata.hxx> #include <salsys.hxx> +#include <windowdev.hxx> #include <units.hrc> #include <print.h> diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 7eb83ab10ecf..d5a305103faa 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -51,6 +51,7 @@ #include <vcl/print.hxx> #include <debugevent.hxx> #include <scrwnd.hxx> +#include <windowdev.hxx> #ifdef _WIN32 #include <svsys.h> diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index b35121b78850..e9d557430b42 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -615,8 +615,10 @@ weld::Window* GetPopupParent(vcl::Window& rOutWin, tools::Rectangle& rRect) void SetPointFont(OutputDevice& rDevice, const vcl::Font& rFont) { - if (vcl::Window* pDefaultDevice = dynamic_cast<vcl::Window*>(Application::GetDefaultDevice())) - pDefaultDevice->SetPointFont(rDevice, rFont); + auto pDefaultDevice = Application::GetDefaultDevice(); + if (pDefaultDevice) + if (vcl::Window* pDefaultWindow = pDefaultDevice->GetOwnerWindow()) + pDefaultWindow->SetPointFont(rDevice, rFont); } } diff --git a/vcl/source/control/PriorityHBox.cxx b/vcl/source/control/PriorityHBox.cxx index cb3219bf5a5c..c3477d23f30d 100644 --- a/vcl/source/control/PriorityHBox.cxx +++ b/vcl/source/control/PriorityHBox.cxx @@ -128,10 +128,10 @@ void PriorityHBox::Resize() if (pWindow && pWindow->GetParent() == this) { - nCurrentWidth -= pWindow->GetOutputWidthPixel() + get_spacing(); + nCurrentWidth -= pWindow->GetOutDev()->GetOutputWidthPixel() + get_spacing(); pWindow->Show(); pPrioritable->HideContent(); - nCurrentWidth += pWindow->GetOutputWidthPixel() + get_spacing(); + nCurrentWidth += pWindow->GetOutDev()->GetOutputWidthPixel() + get_spacing(); } } @@ -150,7 +150,7 @@ void PriorityHBox::Resize() if (pWindow) { - nCurrentWidth -= pWindow->GetOutputWidthPixel() + get_spacing(); + nCurrentWidth -= pWindow->GetOutDev()->GetOutputWidthPixel() + get_spacing(); pWindow->Show(); pPrioritable->ShowContent(); nCurrentWidth += getLayoutRequisition(*pWindow).Width() + get_spacing(); diff --git a/vcl/source/control/PriorityMergedHBox.cxx b/vcl/source/control/PriorityMergedHBox.cxx index 43b13b5175f8..b67368d87628 100644 --- a/vcl/source/control/PriorityMergedHBox.cxx +++ b/vcl/source/control/PriorityMergedHBox.cxx @@ -69,8 +69,8 @@ void PriorityMergedHBox::Resize() if (pWindow && pWindow->GetParent() == this && pWindow->IsVisible()) { - if (pWindow->GetOutputWidthPixel()) - nCurrentWidth -= pWindow->GetOutputWidthPixel(); + if (pWindow->GetOutDev()->GetOutputWidthPixel()) + nCurrentWidth -= pWindow->GetOutDev()->GetOutputWidthPixel(); else nCurrentWidth -= DUMMY_WIDTH; pWindow->Hide(); diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index d6529c8bf311..42d3da20c2a2 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2823,7 +2823,7 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, DrawButtonFlags void RadioButton::ImplAdjustNWFSizes() { - Push( PushFlags::MAPMODE ); + GetOutDev()->Push( PushFlags::MAPMODE ); SetMapMode(MapMode(MapUnit::MapPixel)); ImplControlValue aControlValue; @@ -2845,7 +2845,7 @@ void RadioButton::ImplAdjustNWFSizes() } } - Pop(); + GetOutDev()->Pop(); } Size RadioButton::CalcMinimumSize(tools::Long nMaxWidth) const @@ -2910,7 +2910,7 @@ void RadioButton::ShowFocus(const tools::Rectangle& rRect) aInRect.SetLeft( rRect.Left() ); // exclude the radio element itself from the focusrect - DrawNativeControl(ControlType::Radiobutton, ControlPart::Focus, aInRect, + GetOutDev()->DrawNativeControl(ControlType::Radiobutton, ControlPart::Focus, aInRect, ControlState::FOCUSED, aControlValue, OUString()); } Button::ShowFocus(rRect); @@ -3613,7 +3613,7 @@ Image CheckBox::GetCheckImage( const AllSettings& rSettings, DrawButtonFlags nFl void CheckBox::ImplAdjustNWFSizes() { - Push( PushFlags::MAPMODE ); + GetOutDev()->Push( PushFlags::MAPMODE ); SetMapMode(MapMode(MapUnit::MapPixel)); ImplControlValue aControlValue; @@ -3635,7 +3635,7 @@ void CheckBox::ImplAdjustNWFSizes() } } - Pop(); + GetOutDev()->Pop(); } Size CheckBox::CalcMinimumSize( tools::Long nMaxWidth ) const @@ -3686,7 +3686,7 @@ void CheckBox::ShowFocus(const tools::Rectangle& rRect) aInRect.SetLeft( rRect.Left() ); // exclude the checkbox itself from the focusrect - DrawNativeControl(ControlType::Checkbox, ControlPart::Focus, aInRect, + GetOutDev()->DrawNativeControl(ControlType::Checkbox, ControlPart::Focus, aInRect, ControlState::FOCUSED, aControlValue, OUString()); } Button::ShowFocus(rRect); diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx index 7b8f9a061eb8..c03740f3063c 100644 --- a/vcl/source/control/calendar.cxx +++ b/vcl/source/control/calendar.cxx @@ -125,7 +125,7 @@ void Calendar::ImplInitSettings() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); maSelColor = rStyleSettings.GetHighlightTextColor(); - SetPointFont(*this, rStyleSettings.GetToolFont()); + SetPointFont(*GetOutDev(), rStyleSettings.GetToolFont()); SetTextColor(rStyleSettings.GetFieldTextColor()); SetBackground(Wallpaper(rStyleSettings.GetFieldColor())); } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index f749e7ab9d36..2f8143028422 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -703,7 +703,7 @@ void ComboBox::DataChanged( const DataChangedEvent& rDCEvt ) if (m_pImpl->m_pBtn) { - m_pImpl->m_pBtn->SetSettings( GetSettings() ); + m_pImpl->m_pBtn->GetOutDev()->SetSettings( GetSettings() ); ImplInitDropDownButton( m_pImpl->m_pBtn ); } Resize(); diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 4f89e19b66ef..f0c01cdc4b0c 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -65,10 +65,10 @@ void Control::dispose() void Control::EnableRTL( bool bEnable ) { // convenience: for controls also switch layout mode - SetLayoutMode( bEnable ? ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft : + GetOutDev()->SetLayoutMode( bEnable ? ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft : ComplexTextLayoutFlags::TextOriginLeft ); CompatStateChanged( StateChangedType::Mirroring ); - OutputDevice::EnableRTL(bEnable); + Window::EnableRTL(bEnable); } void Control::Resize() @@ -427,7 +427,7 @@ void Control::ApplySettings(vcl::RenderContext& rRenderContext) void Control::ImplInitSettings() { - ApplySettings(*this); + ApplySettings(*GetOutDev()); } tools::Rectangle Control::DrawControlText( OutputDevice& _rTargetDevice, const tools::Rectangle& rRect, const OUString& _rStr, diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 87aafd4bcb3b..f7ebe26568e6 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -327,7 +327,7 @@ void Edit::ImplInit(vcl::Window* pParent, WinBits nStyle) SetCursor( new vcl::Cursor ); SetPointer( PointerStyle::Text ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL( mxDnDListener, uno::UNO_QUERY ); uno::Reference< datatransfer::dnd::XDragGestureRecognizer > xDGR = GetDragGestureRecognizer(); @@ -484,7 +484,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const tools::Rectangl pDX = pDXBuffer.get(); } - GetCaretPositions(aText, pDX, 0, nLen); + GetOutDev()->GetCaretPositions(aText, pDX, 0, nLen); } tools::Long nTH = GetTextHeight(); @@ -1045,16 +1045,16 @@ void Edit::ImplPaintBorder(vcl::RenderContext const & rRenderContext) aClipRgn.Move(aBorderOffs.X(), aBorderOffs.Y()); } - vcl::Region oldRgn(pBorder->GetClipRegion()); - pBorder->SetClipRegion(aClipRgn); + vcl::Region oldRgn(pBorder->GetOutDev()->GetClipRegion()); + pBorder->GetOutDev()->SetClipRegion(aClipRgn); - pBorder->Paint(*pBorder, tools::Rectangle()); + pBorder->Paint(*pBorder->GetOutDev(), tools::Rectangle()); - pBorder->SetClipRegion(oldRgn); + pBorder->GetOutDev()->SetClipRegion(oldRgn); } else { - pBorder->Paint(*pBorder, tools::Rectangle()); + pBorder->Paint(*pBorder->GetOutDev(), tools::Rectangle()); } } @@ -1080,7 +1080,7 @@ void Edit::ImplShowCursor( bool bOnlyIfVisible ) pDX = pDXBuffer.get(); } - GetCaretPositions( aText, pDX, 0, aText.getLength() ); + GetOutDev()->GetCaretPositions( aText, pDX, 0, aText.getLength() ); if( maSelection.Max() < aText.getLength() ) nTextPos = pDX[ 2*maSelection.Max() ]; @@ -1201,7 +1201,7 @@ sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const pDX = pDXBuffer.get(); } - GetCaretPositions( aText, pDX, 0, aText.getLength() ); + GetOutDev()->GetCaretPositions( aText, pDX, 0, aText.getLength() ); tools::Long nX = rWindowPos.X() - mnXOffset - ImplGetExtraXOffset(); for (sal_Int32 i = 0; i < aText.getLength(); aText.iterateCodePoints(&i)) { @@ -2133,7 +2133,7 @@ void Edit::Command( const CommandEvent& rCEvt ) OUString aText = ImplGetText(); std::vector<tools::Long> aDX(2*(aText.getLength()+1)); - GetCaretPositions( aText, aDX.data(), 0, aText.getLength() ); + GetOutDev()->GetCaretPositions( aText, aDX.data(), 0, aText.getLength() ); tools::Long nTH = GetTextHeight(); Point aPos( mnXOffset, ImplGetTextYPosition() ); @@ -2193,12 +2193,12 @@ void Edit::StateChanged( StateChangedType nType ) if (GetParent()->GetStyle() & WB_LEFT) mnAlign = EDIT_ALIGN_RIGHT; if (nType == StateChangedType::Mirroring) - SetLayoutMode(ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft); + GetOutDev()->SetLayoutMode(ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft); } else if (mbIsSubEdit && !GetParent()->IsRTLEnabled()) { if (nType == StateChangedType::Mirroring) - SetLayoutMode(ComplexTextLayoutFlags::TextOriginLeft); + GetOutDev()->SetLayoutMode(ComplexTextLayoutFlags::TextOriginLeft); } if (nStyle & WB_RIGHT) @@ -2216,7 +2216,7 @@ void Edit::StateChanged( StateChangedType nType ) { if (!mpSubEdit) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplShowCursor(); Invalidate(); } @@ -2225,7 +2225,7 @@ void Edit::StateChanged( StateChangedType nType ) { if (!mpSubEdit) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -2242,7 +2242,7 @@ void Edit::DataChanged( const DataChangedEvent& rDCEvt ) { if ( !mpSubEdit ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplShowCursor(); Invalidate(); } @@ -2257,7 +2257,7 @@ void Edit::ImplShowDDCursor() { tools::Long nTextWidth = GetTextWidth( maText.toString(), 0, mpDDInfo->nDropPos ); tools::Long nTextHeight = GetTextHeight(); - tools::Rectangle aCursorRect( Point( nTextWidth + mnXOffset, (GetOutputSize().Height()-nTextHeight)/2 ), Size( 2, nTextHeight ) ); + tools::Rectangle aCursorRect( Point( nTextWidth + mnXOffset, (GetOutDev()->GetOutputSize().Height()-nTextHeight)/2 ), Size( 2, nTextHeight ) ); mpDDInfo->aCursor.SetWindow( this ); mpDDInfo->aCursor.SetPos( aCursorRect.TopLeft() ); mpDDInfo->aCursor.SetSize( aCursorRect.GetSize() ); diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 82675d720c9a..6ed615dd6259 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -72,7 +72,7 @@ void FixedText::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, nullptr ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); } WinBits FixedText::ImplInitStyle( WinBits nStyle ) @@ -257,24 +257,24 @@ void FixedText::StateChanged( StateChangedType nType ) if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) != (GetStyle() & FIXEDTEXT_VIEW_STYLE) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } else if ( (nType == StateChangedType::Zoom) || (nType == StateChangedType::ControlFont) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -288,7 +288,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -349,7 +349,7 @@ Size FixedText::GetOptimalSize() const void FixedText::FillLayoutData() const { mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); - ImplDraw(const_cast<FixedText*>(this), DrawFlags::NONE, Point(), GetOutputSizePixel(), true); + ImplDraw(const_cast<FixedText*>(this)->GetOutDev(), DrawFlags::NONE, Point(), GetOutputSizePixel(), true); //const_cast<FixedText*>(this)->Invalidate(); } @@ -456,7 +456,7 @@ void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, nullptr ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); } WinBits FixedLine::ImplInitStyle( WinBits nStyle ) @@ -535,7 +535,7 @@ void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext) if (rStyleSettings.GetOptions() & StyleSettingsOptions::Mono) nStyle |= DrawTextFlags::Mono; - aRect = DrawControlText(*this, aRect, aText, nStyle, nullptr, nullptr); + aRect = DrawControlText(*GetOutDev(), aRect, aText, nStyle, nullptr, nullptr); tools::Long nTop = aRect.Top() + ((aRect.GetHeight() - 1) / 2); aDecoView.DrawSeparator(Point(aRect.Right() + FIXEDLINE_TEXT_BORDER, nTop), Point(aOutSize.Width() - 1, nTop), false); @@ -619,17 +619,17 @@ void FixedLine::StateChanged( StateChangedType nType ) (nType == StateChangedType::Style) || (nType == StateChangedType::ControlFont) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -643,7 +643,7 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -664,7 +664,7 @@ void FixedBitmap::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, nullptr ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); } WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) @@ -770,7 +770,7 @@ void FixedBitmap::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -782,7 +782,7 @@ void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -798,7 +798,7 @@ void FixedImage::ImplInit( vcl::Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, nullptr ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); } WinBits FixedImage::ImplInitStyle( WinBits nStyle ) @@ -917,7 +917,7 @@ void FixedImage::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -929,7 +929,7 @@ void FixedImage::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx index b7f3500fc029..01baaf575b16 100644 --- a/vcl/source/control/fixedhyper.cxx +++ b/vcl/source/control/fixedhyper.cxx @@ -53,7 +53,7 @@ void FixedHyperlink::Initialize() // changes the color to link color SetControlForeground( Application::GetSettings().GetStyleSettings().GetLinkColor() ); // calculates text len - m_nTextLen = GetCtrlTextWidth( GetText() ); + m_nTextLen = GetOutDev()->GetCtrlTextWidth( GetText() ); SetClickHdl(LINK(this, FixedHyperlink, HandleClick)); } @@ -147,7 +147,7 @@ void FixedHyperlink::SetURL( const OUString& rNewURL ) void FixedHyperlink::SetText(const OUString& rNewDescription) { FixedText::SetText(rNewDescription); - m_nTextLen = GetCtrlTextWidth(GetText()); + m_nTextLen = GetOutDev()->GetCtrlTextWidth(GetText()); } bool FixedHyperlink::set_property(const OString &rKey, const OUString &rValue) diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index 73094dfcc454..b904b73c66e8 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -133,19 +133,19 @@ void ImageControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan bool bFlat = (GetBorderStyle() == WindowBorderStyle::MONO); tools::Rectangle aRect(Point(0,0), pBorderWindow->GetOutputSizePixel()); - Color oldLineCol = pBorderWindow->GetLineColor(); - Color oldFillCol = pBorderWindow->GetFillColor(); - pBorderWindow->SetFillColor(); - pBorderWindow->SetLineColor(bFlat ? COL_WHITE : COL_BLACK); - pBorderWindow->DrawRect(aRect); + Color oldLineCol = pBorderWindow->GetOutDev()->GetLineColor(); + Color oldFillCol = pBorderWindow->GetOutDev()->GetFillColor(); + pBorderWindow->GetOutDev()->SetFillColor(); + pBorderWindow->GetOutDev()->SetLineColor(bFlat ? COL_WHITE : COL_BLACK); + pBorderWindow->GetOutDev()->DrawRect(aRect); aRect.AdjustLeft( 1 ); aRect.AdjustRight( -1 ); aRect.AdjustTop( 1 ); aRect.AdjustBottom( -1 ); - pBorderWindow->SetLineColor(bFlat ? COL_BLACK : COL_WHITE); - pBorderWindow->DrawRect(aRect); - pBorderWindow->SetLineColor(oldLineCol); - pBorderWindow->SetFillColor(oldFillCol); + pBorderWindow->GetOutDev()->SetLineColor(bFlat ? COL_BLACK : COL_WHITE); + pBorderWindow->GetOutDev()->DrawRect(aRect); + pBorderWindow->GetOutDev()->SetLineColor(oldLineCol); + pBorderWindow->GetOutDev()->SetFillColor(oldFillCol); } diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index 4f4ae02cdfaa..2eae406b4299 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -2260,10 +2260,10 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAd bool bCalcOverlap = (bAdd && pOtherRects && !pOtherRects->empty()); bool bResetClipRegion = false; - if( !pView->IsClipRegion() ) + if( !pView->GetOutDev()->IsClipRegion() ) { bResetClipRegion = true; - pView->SetClipRegion(vcl::Region(GetOutputRect())); + pView->GetOutDev()->SetClipRegion(vcl::Region(GetOutputRect())); } for( size_t nPos = 0; nPos < nCount; nPos++ ) @@ -2334,7 +2334,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAd pView->PaintImmediately(); if( bResetClipRegion ) - pView->SetClipRegion(); + pView->GetOutDev()->SetClipRegion(); } void SvxIconChoiceCtrl_Impl::SelectRange( diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index a97d0f42c18c..e8315f85aec0 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -472,11 +472,11 @@ ImplListBoxWindow::ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle ) mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND; - SetLineColor(); + GetOutDev()->SetLineColor(); SetTextFillColor(); SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplCalcMetrics(); } @@ -629,7 +629,7 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) else { // normal single line case - const SalLayoutGlyphs* pGlyphs = rEntry.GetTextGlyphs(this); + const SalLayoutGlyphs* pGlyphs = rEntry.GetTextGlyphs(GetOutDev()); aMetrics.nTextWidth = static_cast<sal_uInt16>(GetTextWidth(rEntry.maStr, 0, -1, nullptr, pGlyphs)); if( aMetrics.nTextWidth > mnMaxTxtWidth ) @@ -1745,7 +1745,7 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 void ImplListBoxWindow::FillLayoutData() const { mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); - const_cast<ImplListBoxWindow*>(this)->Invalidate(tools::Rectangle(Point(0, 0), GetOutputSize())); + const_cast<ImplListBoxWindow*>(this)->Invalidate(tools::Rectangle(Point(0, 0), GetOutDev()->GetOutputSize())); } void ImplListBoxWindow::ImplDoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) @@ -1962,7 +1962,7 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) if ( nType == StateChangedType::Zoom ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplCalcMetrics(); Invalidate(); } @@ -1973,18 +1973,18 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlFont ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplCalcMetrics(); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if( nType == StateChangedType::Enable ) @@ -2005,7 +2005,7 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { ImplClearLayoutData(); - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplCalcMetrics(); Invalidate(); } @@ -2497,7 +2497,7 @@ void ImplWin::FillLayoutData() const { mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); ImplWin* pThis = const_cast<ImplWin*>(this); - pThis->ImplDraw(*pThis, true); + pThis->ImplDraw(*pThis->GetOutDev(), true); } bool ImplWin::PreNotify( NotifyEvent& rNEvt ) @@ -2572,7 +2572,7 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout) if( ! (nParentStyle & WB_BORDER) || (nParentStyle & WB_NOBORDER) ) { tools::Rectangle aParentRect( Point( 0, 0 ), pWin->GetSizePixel() ); - pWin->DrawNativeControl( ControlType::Listbox, ControlPart::Entire, aParentRect, + pWin->GetOutDev()->DrawNativeControl( ControlType::Listbox, ControlPart::Entire, aParentRect, nState, aControlValue, OUString() ); } @@ -2771,7 +2771,7 @@ void ImplWin::ShowFocus(const tools::Rectangle& rRect) vcl::Window *pWin = GetParent(); tools::Rectangle aParentRect(Point(0, 0), pWin->GetSizePixel()); - pWin->DrawNativeControl(ControlType::Listbox, ControlPart::Focus, aParentRect, + pWin->GetOutDev()->DrawNativeControl(ControlType::Listbox, ControlPart::Focus, aParentRect, ControlState::FOCUSED, aControlValue, OUString()); } Control::ShowFocus(rRect); @@ -2983,7 +2983,7 @@ void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking ) vcl::Window *pGrandparent = GetParent()->GetParent(); const OutputDevice *pGrandparentOutDev = pGrandparent->GetOutDev(); - if( pGrandparent->ImplIsAntiparallel() ) + if( pGrandparent->GetOutDev()->ImplIsAntiparallel() ) pGrandparentOutDev->ReMirror( aRect ); // mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795 diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx index c96e133a506f..3091d62fe9ab 100644 --- a/vcl/source/control/ivctrl.cxx +++ b/vcl/source/control/ivctrl.cxx @@ -92,7 +92,7 @@ SvtIconChoiceCtrl::SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle ) _pImpl ( new SvxIconChoiceCtrl_Impl( this, nWinStyle ) ) { - SetLineColor(); + GetOutDev()->SetLineColor(); _pImpl->InitSettings(); _pImpl->SetPositionMode( SvxIconChoiceCtrlPositionMode::AutoArrange ); } @@ -234,9 +234,9 @@ void SvtIconChoiceCtrl::SetFont(const vcl::Font& rFont) void SvtIconChoiceCtrl::SetPointFont(const vcl::Font& rFont) { - if (rFont != GetPointFont(*this)) //FIXME + if (rFont != GetPointFont(*GetOutDev())) //FIXME { - Control::SetPointFont(*this, rFont); //FIXME + Control::SetPointFont(*GetOutDev(), rFont); //FIXME _pImpl->FontModified(); } } diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 0f7528c8a5f4..43576679338b 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -483,10 +483,10 @@ void ListBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( mpImplWin ) { - mpImplWin->SetSettings( GetSettings() ); // If not yet set... - mpImplWin->ApplySettings(*mpImplWin); + mpImplWin->GetOutDev()->SetSettings( GetSettings() ); // If not yet set... + mpImplWin->ApplySettings(*mpImplWin->GetOutDev()); - mpBtn->SetSettings( GetSettings() ); + mpBtn->GetOutDev()->SetSettings( GetSettings() ); ImplInitDropDownButton( mpBtn ); } diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx index d27214bc9015..42fb8231327d 100644 --- a/vcl/source/control/notebookbar.cxx +++ b/vcl/source/control/notebookbar.cxx @@ -294,13 +294,13 @@ void NotebookBar::UpdateBackground() { SetBackground(aWallpaper); UpdatePersonaSettings(); - SetSettings( PersonaSettings ); + GetOutDev()->SetSettings( PersonaSettings ); } else { SetBackground(rStyleSettings.GetDialogColor()); UpdateDefaultSettings(); - SetSettings( DefaultSettings ); + GetOutDev()->SetSettings( DefaultSettings ); } Invalidate(tools::Rectangle(Point(0,0), GetSizePixel())); diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx index ef8d2867018a..eabd2b29e942 100644 --- a/vcl/source/control/prgsbar.cxx +++ b/vcl/source/control/prgsbar.cxx @@ -105,8 +105,8 @@ void ProgressBar::ImplInitSettings( bool bFont, else aColor.IncreaseLuminance( 64 ); } - SetLineColor(); - SetFillColor( aColor ); + GetOutDev()->SetLineColor(); + GetOutDev()->SetFillColor( aColor ); /* FIXME: !!! We do not support text output at the moment SetTextColor( aColor ); SetTextFillColor(); diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 848260b4b9b5..8b812b6e2a01 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -728,7 +728,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) switch ( meScrollType ) { case ScrollType::LineUp: - if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rMousePos, bIsInside )? bIsInside: maBtn1Rect.IsInside( rMousePos ) ) @@ -741,7 +741,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) break; case ScrollType::LineDown: - if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rMousePos, bIsInside )? bIsInside: maBtn2Rect.IsInside( rMousePos ) ) @@ -755,7 +755,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) case ScrollType::PageUp: // HitTestNativeScrollbar, see remark at top of file - if ( HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft: ControlPart::TrackVertUpper, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft: ControlPart::TrackVertUpper, maPage1Rect, rMousePos, bIsInside )? bIsInside: maPage1Rect.IsInside( rMousePos ) ) @@ -769,7 +769,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) case ScrollType::PageDown: // HitTestNativeScrollbar, see remark at top of file - if ( HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzRight: ControlPart::TrackVertLower, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzRight: ControlPart::TrackVertLower, maPage2Rect, rMousePos, bIsInside )? bIsInside: maPage2Rect.IsInside( rMousePos ) ) @@ -822,7 +822,7 @@ void ScrollBar::ImplDragThumb( const Point& rMousePos ) PaintImmediately(); } else - ImplDraw(*this); + ImplDraw(*GetOutDev()); mnDelta = mnThumbPos-nOldPos; Scroll(); @@ -843,13 +843,13 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip) { // rMEvt coordinates are in twips. - Push(PushFlags::MAPMODE); + GetOutDev()->Push(PushFlags::MAPMODE); EnableMapMode(); MapMode aMapMode = GetMapMode(); aMapMode.SetOrigin(Point(0, 0)); SetMapMode(aMapMode); aPosPixel = LogicToPixel(rMEvt.GetPosPixel()); - Pop(); + GetOutDev()->Pop(); } const Point& rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rMEvt.GetPosPixel() : aPosPixel); StartTrackingFlags nTrackFlags = StartTrackingFlags::NONE; @@ -860,7 +860,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) Point aPoint( 0, 0 ); tools::Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); - if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rMousePos, bIsInside )? bIsInside: maBtn1Rect.IsInside( rMousePos ) ) @@ -871,7 +871,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) meScrollType = ScrollType::LineUp; } } - else if ( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, + else if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rMousePos, bIsInside )? bIsInside: maBtn2Rect.IsInside( rMousePos ) ) @@ -884,7 +884,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) } else { - bool bThumbHit = HitTestNativeScrollbar( bHorizontal? ControlPart::ThumbHorz : ControlPart::ThumbVert, + bool bThumbHit = GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::ThumbHorz : ControlPart::ThumbVert, maThumbRect, rMousePos, bIsInside ) ? bIsInside : maThumbRect.IsInside( rMousePos ); @@ -929,14 +929,14 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) Invalidate(); } } - else if(bPage && (!HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzArea : ControlPart::TrackVertArea, + else if(bPage && (!GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzArea : ControlPart::TrackVertArea, aControlRegion, rMousePos, bIsInside ) || bIsInside) ) { nTrackFlags = StartTrackingFlags::ButtonRepeat; // HitTestNativeScrollbar, see remark at top of file - if ( HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, + if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, maPage1Rect, rMousePos, bIsInside )? bIsInside: maPage1Rect.IsInside( rMousePos ) ) @@ -1016,13 +1016,13 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip) { // rTEvt coordinates are in twips. - Push(PushFlags::MAPMODE); + GetOutDev()->Push(PushFlags::MAPMODE); EnableMapMode(); MapMode aMapMode = GetMapMode(); aMapMode.SetOrigin(Point(0, 0)); SetMapMode(aMapMode); aPosPixel = LogicToPixel(rTEvt.GetMouseEvent().GetPosPixel()); - Pop(); + GetOutDev()->Pop(); } const Point rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rTEvt.GetMouseEvent().GetPosPixel() : aPosPixel); @@ -1129,7 +1129,7 @@ void ScrollBar::ImplInvert() aRect.AdjustBottom( -2 ); } - Invert( aRect ); + GetOutDev()->Invert( aRect ); } void ScrollBar::GetFocus() @@ -1217,30 +1217,30 @@ tools::Rectangle* ScrollBar::ImplFindPartRect( const Point& rPt ) Point aPoint( 0, 0 ); tools::Rectangle aControlRegion( aPoint, GetOutputSizePixel() ); - if( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, + if( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rPt, bIsInside )? bIsInside: maBtn1Rect.IsInside( rPt ) ) return &maBtn1Rect; - else if( HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, + else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rPt, bIsInside )? bIsInside: maBtn2Rect.IsInside( rPt ) ) return &maBtn2Rect; // HitTestNativeScrollbar, see remark at top of file - else if( HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, + else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, maPage1Rect, rPt, bIsInside)? bIsInside: maPage1Rect.IsInside( rPt ) ) return &maPage1Rect; // HitTestNativeScrollbar, see remark at top of file - else if( HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzRight : ControlPart::TrackVertLower, + else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzRight : ControlPart::TrackVertLower, maPage2Rect, rPt, bIsInside)? bIsInside: maPage2Rect.IsInside( rPt ) ) return &maPage2Rect; // HitTestNativeScrollbar, see remark at top of file - else if( HitTestNativeScrollbar( bHorizontal ? ControlPart::ThumbHorz : ControlPart::ThumbVert, + else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::ThumbHorz : ControlPart::ThumbVert, maThumbRect, rPt, bIsInside)? bIsInside: maThumbRect.IsInside( rPt ) ) @@ -1263,7 +1263,7 @@ bool ScrollBar::PreNotify( NotifyEvent& rNEvt ) tools::Rectangle* pLastRect = ImplFindPartRect( GetLastPointerPosPixel() ); if( pRect != pLastRect || pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow() ) { - vcl::Region aRgn( GetActiveClipRegion() ); + vcl::Region aRgn( GetOutDev()->GetActiveClipRegion() ); vcl::Region aClipRegion; if ( pRect ) @@ -1278,10 +1278,10 @@ bool ScrollBar::PreNotify( NotifyEvent& rNEvt ) aClipRegion.Union( maBtn2Rect ); } - SetClipRegion( aClipRegion ); + GetOutDev()->SetClipRegion( aClipRegion ); Invalidate(aClipRegion.GetBoundRect()); - SetClipRegion( aRgn ); + GetOutDev()->SetClipRegion( aRgn ); } } } diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx index 90e2676eda52..4e0689ecbfe1 100644 --- a/vcl/source/control/spinbtn.cxx +++ b/vcl/source/control/spinbtn.cxx @@ -443,18 +443,18 @@ bool SpinButton::PreNotify( NotifyEvent& rNEvt ) tools::Rectangle* pLastRect = ImplFindPartRect( GetLastPointerPosPixel() ); if (pRect != pLastRect || (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow())) { - vcl::Region aRgn(GetActiveClipRegion()); + vcl::Region aRgn(GetOutDev()->GetActiveClipRegion()); if (pLastRect) { - SetClipRegion(vcl::Region(*pLastRect)); + GetOutDev()->SetClipRegion(vcl::Region(*pLastRect)); Invalidate(*pLastRect); - SetClipRegion( aRgn ); + GetOutDev()->SetClipRegion( aRgn ); } if (pRect) { - SetClipRegion(vcl::Region(*pRect)); + GetOutDev()->SetClipRegion(vcl::Region(*pRect)); Invalidate(*pRect); - SetClipRegion(aRgn); + GetOutDev()->SetClipRegion(aRgn); } } } diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index bc47d369d7ae..faeed4062e32 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -106,10 +106,10 @@ bool ImplDrawNativeSpinfield(vcl::RenderContext& rRenderContext, vcl::Window con // convert from screen space to borderwin space aClipRect.SetPos(pBorder->ScreenToOutputPixel(pWin->OutputToScreenPixel(aClipRect.TopLeft()))); - oldRgn = pBorder->GetClipRegion(); - pBorder->SetClipRegion(vcl::Region(aClipRect)); + oldRgn = pBorder->GetOutDev()->GetClipRegion(); + pBorder->GetOutDev()->SetClipRegion(vcl::Region(aClipRect)); - pContext = pBorder; + pContext = pBorder->GetOutDev(); } tools::Rectangle aBound, aContent; @@ -132,7 +132,7 @@ bool ImplDrawNativeSpinfield(vcl::RenderContext& rRenderContext, vcl::Window con ControlState::ENABLED, rSpinbuttonValue, OUString()); if (!pWin->SupportsDoubleBuffering()) - pBorder->SetClipRegion(oldRgn); + pBorder->GetOutDev()->SetClipRegion(oldRgn); } } return bNativeOK; @@ -313,7 +313,7 @@ void SpinField::ImplInit(vcl::Window* pParent, WinBits nWinStyle) // Some themes want external spin buttons, therefore the main // spinfield should not overdraw the border between its encapsulated // edit field and the spin buttons - if ((nWinStyle & WB_SPIN) && ImplUseNativeBorder(*this, nWinStyle)) + if ((nWinStyle & WB_SPIN) && ImplUseNativeBorder(*GetOutDev(), nWinStyle)) { SetBackground(); mpEdit.set(VclPtr<Edit>::Create(this, WB_NOBORDER)); @@ -641,7 +641,7 @@ void SpinField::ImplCalcButtonAreas(OutputDevice* pDev, const Size& rOutSz, tool ! (GetStyle() & WB_DROPDOWN) && IsNativeControlSupported(ControlType::Spinbox, ControlPart::Entire)) { - vcl::Window *pWin = static_cast<vcl::Window*>(pDev); + vcl::Window *pWin = pDev->GetOwnerWindow(); vcl::Window *pBorder = pWin->GetWindow( GetWindowType::Border ); // get the system's spin button size @@ -698,7 +698,7 @@ void SpinField::Resize() if (GetStyle() & (WB_SPIN | WB_DROPDOWN)) { - ImplCalcButtonAreas( this, aSize, maDropDownRect, maUpperRect, maLowerRect ); + ImplCalcButtonAreas( GetOutDev(), aSize, maDropDownRect, maUpperRect, maLowerRect ); ImplControlValue aControlValue; Point aPoint; @@ -854,18 +854,18 @@ bool SpinField::PreNotify(NotifyEvent& rNEvt) else { // paint directly - vcl::Region aRgn( GetActiveClipRegion() ); + vcl::Region aRgn( GetOutDev()->GetActiveClipRegion() ); if (pLastRect) { - SetClipRegion(vcl::Region(*pLastRect)); + GetOutDev()->SetClipRegion(vcl::Region(*pLastRect)); Invalidate(*pLastRect); - SetClipRegion( aRgn ); + GetOutDev()->SetClipRegion( aRgn ); } if (pRect) { - SetClipRegion(vcl::Region(*pRect)); + GetOutDev()->SetClipRegion(vcl::Region(*pRect)); Invalidate(*pRect); - SetClipRegion( aRgn ); + GetOutDev()->SetClipRegion( aRgn ); } } } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 6ac2762f3022..14e2510d33d0 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -226,7 +226,7 @@ ImplTabItem* TabControl::ImplGetItem( sal_uInt16 nId ) const Size TabControl::ImplGetItemSize( ImplTabItem* pItem, tools::Long nMaxWidth ) { pItem->maFormatText = pItem->maText; - Size aSize( GetCtrlTextWidth( pItem->maFormatText ), GetTextHeight() ); + Size aSize( GetOutDev()->GetCtrlTextWidth( pItem->maFormatText ), GetTextHeight() ); Size aImageSize( 0, 0 ); if( !!pItem->maTabImage ) { @@ -267,7 +267,7 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, tools::Long nMaxWidth ) { if (pItem->maFormatText.getLength() > aAppendStr.getLength()) pItem->maFormatText = pItem->maFormatText.replaceAt( pItem->maFormatText.getLength()-aAppendStr.getLength()-1, 1, "" ); - aSize.setWidth( GetCtrlTextWidth( pItem->maFormatText ) ); + aSize.setWidth( GetOutDev()->GetCtrlTextWidth( pItem->maFormatText ) ); aSize.AdjustWidth(aImageSize.Width() ); aSize.AdjustWidth(TAB_TABOFFSET_X*2 ); } @@ -756,7 +756,7 @@ void TabControl::ImplShowFocus() Size aTabSize = aRect.GetSize(); Size aImageSize( 0, 0 ); tools::Long nTextHeight = GetTextHeight(); - tools::Long nTextWidth = GetCtrlTextWidth( rItem.maFormatText ); + tools::Long nTextWidth = GetOutDev()->GetCtrlTextWidth( rItem.maFormatText ); sal_uInt16 nOff; if ( !(GetSettings().GetStyleSettings().GetOptions() & StyleSettingsOptions::Mono) ) diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index aa4940e33eba..5c6926d09129 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -1879,7 +1879,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, tools: if ( !IsFormatted() ) FormatDoc(); - vcl::Window* const pOutWin = dynamic_cast<vcl::Window*>(pOutDev); + vcl::Window* const pOutWin = pOutDev ? pOutDev->GetOwnerWindow() : nullptr; const bool bTransparent = (pOutWin && pOutWin->IsPaintTransparent()); tools::Long nY = rStartPos.Y(); diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index aef67e174cfb..fb5e1cb6aa9f 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -174,7 +174,7 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* pWindow ) : pWindow->SetCursor( mpImpl->mpCursor.get() ); pWindow->SetInputContext( InputContext( pEng->GetFont(), InputContextFlags::Text|InputContextFlags::ExtText ) ); - pWindow->SetLineColor(); + pWindow->GetOutDev()->SetLineColor(); if ( pWindow->GetDragGestureRecognizer().is() ) { diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 7e90c4b59de3..18fad279898b 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -972,7 +972,7 @@ void VclMultiLineEdit::ImplInitSettings(bool bBackground) vcl::Font aFont = rStyleSettings.GetFieldFont(); aFont.SetTransparent(IsPaintTransparent()); - ApplyControlFont(*this, aFont); + ApplyControlFont(*GetOutDev(), aFont); vcl::Font TheFont = GetFont(); TheFont.SetColor(aTextColor); diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index a31f8e768ece..fd7e13bc30df 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -374,7 +374,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos ) // flush output from time to time if( i++ > nSyncCount ) { - static_cast<vcl::Window*>( pOut )->Flush(); + pOut->Flush(); i = 0; } } @@ -392,7 +392,7 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S Size rDestSize( pOut->LogicToPixel( rLogicDestSize ) ); - const vcl::Window* win = dynamic_cast <vcl::Window*> ( pOut ); + const vcl::Window* win = pOut ? pOut->GetOwnerWindow() : nullptr; if (!win) win = Application::GetActiveTopWindow(); @@ -404,7 +404,7 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S try { - uno::Reference<rendering::XCanvas> xCanvas = win->GetCanvas (); + uno::Reference<rendering::XCanvas> xCanvas = win->GetOutDev()->GetCanvas (); if (!xCanvas.is()) return false; diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index 0091f6878182..b7329c073ef1 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -145,7 +145,7 @@ void ImplAnimView::drawToPos( sal_uLong nPos ) vcl::PaintBufferGuardPtr pGuard; if (mpRenderContext->GetOutDevType() == OUTDEV_WINDOW) { - vcl::Window* pWindow = static_cast<vcl::Window*>(mpRenderContext.get()); + vcl::Window* pWindow = static_cast<vcl::WindowOutputDevice*>(mpRenderContext.get())->GetOwnerWindow(); pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); pRenderContext = pGuard->GetRenderContext(); } @@ -177,7 +177,7 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev ) vcl::PaintBufferGuardPtr pGuard; if (!pVDev && mpRenderContext->GetOutDevType() == OUTDEV_WINDOW) { - vcl::Window* pWindow = static_cast<vcl::Window*>(mpRenderContext.get()); + vcl::Window* pWindow = static_cast<vcl::WindowOutputDevice*>(mpRenderContext.get())->GetOwnerWindow(); pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); pRenderContext = pGuard->GetRenderContext(); } diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 35d7088fee7e..f6b7d443b307 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -137,7 +137,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, ImplSVData* pSVData = ImplGetSVData(); if ( !pOutDev ) - pOutDev = ImplGetDefaultWindow(); + pOutDev = ImplGetDefaultWindow()->GetOutDev(); if( !pOutDev ) return; diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index a7047fa8d93a..b6c7fcff82e3 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -514,9 +514,9 @@ void OutputDevice::ImplClearAllFontData(bool bNewFontLists) vcl::Window * pFrame = pSVData->maFrameData.mpFirstFrame; if ( pFrame ) { - if ( pFrame->AcquireGraphics() ) + if ( pFrame->GetOutDev()->AcquireGraphics() ) { - OutputDevice *pDevice = pFrame; + OutputDevice *pDevice = pFrame->GetOutDev(); pDevice->mpGraphics->ClearDevFontCache(); pDevice->mpGraphics->GetDevFontList(pFrame->mpWindowImpl->mpFrameData->mxFontCollection.get()); } @@ -542,12 +542,12 @@ void OutputDevice::ImplUpdateFontDataForAllFrames( const FontUpdateHandler_t pHd vcl::Window* pFrame = pSVData->maFrameData.mpFirstFrame; while ( pFrame ) { - ( pFrame->*pHdl )( bNewFontLists ); + ( pFrame->GetOutDev()->*pHdl )( bNewFontLists ); vcl::Window* pSysWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap; while ( pSysWin ) { - ( pSysWin->*pHdl )( bNewFontLists ); + ( pSysWin->GetOutDev()->*pHdl )( bNewFontLists ); pSysWin = pSysWin->mpWindowImpl->mpNextOverlap; } diff --git a/vcl/source/toolkit/group.cxx b/vcl/source/toolkit/group.cxx index 29d11b8eadc1..040befebbdfb 100644 --- a/vcl/source/toolkit/group.cxx +++ b/vcl/source/toolkit/group.cxx @@ -170,7 +170,7 @@ void GroupBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, void GroupBox::FillLayoutData() const { mpControlData->mpLayoutData.reset( new vcl::ControlLayoutData ); - const_cast<GroupBox*>(this)->ImplDraw( const_cast<GroupBox*>(this), DrawFlags::NONE, Point(), GetOutputSizePixel(), true ); + const_cast<GroupBox*>(this)->ImplDraw( const_cast<GroupBox*>(this)->GetOutDev(), DrawFlags::NONE, Point(), GetOutputSizePixel(), true ); } void GroupBox::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) diff --git a/vcl/source/treelist/headbar.cxx b/vcl/source/treelist/headbar.cxx index 882015e02a84..91cb86cc73ca 100644 --- a/vcl/source/treelist/headbar.cxx +++ b/vcl/source/treelist/headbar.cxx @@ -130,16 +130,16 @@ void HeaderBar::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if (bFont) - ApplyControlFont(*this, rStyleSettings.GetToolFont()); + ApplyControlFont(*GetOutDev(), rStyleSettings.GetToolFont()); if (bForeground || bFont) { - ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); + ApplyControlForeground(*GetOutDev(), rStyleSettings.GetButtonTextColor()); SetTextFillColor(); } if (bBackground) - ApplyControlBackground(*this, rStyleSettings.GetFaceColor()); + ApplyControlBackground(*GetOutDev(), rStyleSettings.GetFaceColor()); } tools::Long HeaderBar::ImplGetItemPos( sal_uInt16 nPos ) const @@ -239,30 +239,30 @@ void HeaderBar::ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) aEndPos.setX( aRect2.Left()+6 ); } - SetRasterOp( RasterOp::Invert ); - DrawRect( aStartRect ); - DrawLine( aStartPos, aEndPos ); + GetOutDev()->SetRasterOp( RasterOp::Invert ); + GetOutDev()->DrawRect( aStartRect ); + GetOutDev()->DrawLine( aStartPos, aEndPos ); if ( nEndPos > nStartPos ) { - DrawLine( Point( aEndPos.X()+1, aEndPos.Y()-3 ), + GetOutDev()->DrawLine( Point( aEndPos.X()+1, aEndPos.Y()-3 ), Point( aEndPos.X()+1, aEndPos.Y()+3 ) ); - DrawLine( Point( aEndPos.X()+2, aEndPos.Y()-2 ), + GetOutDev()->DrawLine( Point( aEndPos.X()+2, aEndPos.Y()-2 ), Point( aEndPos.X()+2, aEndPos.Y()+2 ) ); - DrawLine( Point( aEndPos.X()+3, aEndPos.Y()-1 ), + GetOutDev()->DrawLine( Point( aEndPos.X()+3, aEndPos.Y()-1 ), Point( aEndPos.X()+3, aEndPos.Y()+1 ) ); - DrawPixel( Point( aEndPos.X()+4, aEndPos.Y() ) ); + GetOutDev()->DrawPixel( Point( aEndPos.X()+4, aEndPos.Y() ) ); } else { - DrawLine( Point( aEndPos.X()-1, aEndPos.Y()-3 ), + GetOutDev()->DrawLine( Point( aEndPos.X()-1, aEndPos.Y()-3 ), Point( aEndPos.X()-1, aEndPos.Y()+3 ) ); - DrawLine( Point( aEndPos.X()-2, aEndPos.Y()-2 ), + GetOutDev()->DrawLine( Point( aEndPos.X()-2, aEndPos.Y()-2 ), Point( aEndPos.X()-2, aEndPos.Y()+2 ) ); - DrawLine( Point( aEndPos.X()-3, aEndPos.Y()-1 ), + GetOutDev()->DrawLine( Point( aEndPos.X()-3, aEndPos.Y()-1 ), Point( aEndPos.X()-3, aEndPos.Y()+1 ) ); - DrawPixel( Point( aEndPos.X()-4, aEndPos.Y() ) ); + GetOutDev()->DrawPixel( Point( aEndPos.X()-4, aEndPos.Y() ) ); } - SetRasterOp( RasterOp::OverPaint ); + GetOutDev()->SetRasterOp( RasterOp::OverPaint ); } void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh, diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 7397305e0aba..60b8a5962e42 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -259,7 +259,7 @@ void SvImpLBox::Clear() m_pView->Control::SetMapMode( aMapMode ); m_aHorSBar->SetRange( aRange ); m_aHorSBar->SetSizePixel(Size(m_aOutputSize.Width(),m_nHorSBarHeight)); - m_pView->SetClipRegion(); + m_pView->GetOutDev()->SetClipRegion(); if( GetUpdateMode() ) m_pView->Invalidate( GetVisibleArea() ); m_nFlags |= LBoxFlags::Filling; @@ -563,11 +563,11 @@ void SvImpLBox::RecalcFocusRect() m_pView->HideFocus(); tools::Long nY = GetEntryLine( m_pCursor ); tools::Rectangle aRect = m_pView->GetFocusRect( m_pCursor, nY ); - vcl::Region aOldClip( m_pView->GetClipRegion()); + vcl::Region aOldClip( m_pView->GetOutDev()->GetClipRegion()); vcl::Region aClipRegion( GetClipRegionRect() ); - m_pView->SetClipRegion( aClipRegion ); + m_pView->GetOutDev()->SetClipRegion( aClipRegion ); m_pView->ShowFocus( aRect ); - m_pView->SetClipRegion( aOldClip ); + m_pView->GetOutDev()->SetClipRegion( aOldClip ); } } @@ -646,21 +646,21 @@ void SvImpLBox::ShowCursor( bool bShow ) { if( !bShow || !m_pCursor || !m_pView->HasFocus() ) { - vcl::Region aOldClip( m_pView->GetClipRegion()); + vcl::Region aOldClip( m_pView->GetOutDev()->GetClipRegion()); vcl::Region aClipRegion( GetClipRegionRect() ); - m_pView->SetClipRegion( aClipRegion ); + m_pView->GetOutDev()->SetClipRegion( aClipRegion ); m_pView->HideFocus(); - m_pView->SetClipRegion( aOldClip ); + m_pView->GetOutDev()->SetClipRegion( aOldClip ); } else { tools::Long nY = GetEntryLine( m_pCursor ); tools::Rectangle aRect = m_pView->GetFocusRect( m_pCursor, nY ); - vcl::Region aOldClip( m_pView->GetClipRegion()); + vcl::Region aOldClip( m_pView->GetOutDev()->GetClipRegion()); vcl::Region aClipRegion( GetClipRegionRect() ); - m_pView->SetClipRegion( aClipRegion ); + m_pView->GetOutDev()->SetClipRegion( aClipRegion ); m_pView->ShowFocus( aRect ); - m_pView->SetClipRegion( aOldClip ); + m_pView->GetOutDev()->SetClipRegion( aOldClip ); } } @@ -2803,7 +2803,7 @@ void SvImpLBox::PaintDDCursor(SvTreeListEntry* pEntry, bool bShow) pViewData->SetDragTarget(bShow); #ifdef MACOSX // in MacOS we need to draw directly (as we are synchronous) or no invalidation happens - m_pView->PaintEntry1(*pEntry, GetEntryLine(pEntry), *m_pView); + m_pView->PaintEntry1(*pEntry, GetEntryLine(pEntry), *m_pView->GetOutDev()); #else InvalidateEntry(pEntry); #endif @@ -2842,7 +2842,7 @@ tools::Rectangle SvImpLBox::GetVisibleArea() const void SvImpLBox::Invalidate() { - m_pView->SetClipRegion(); + m_pView->GetOutDev()->SetClipRegion(); } void SvImpLBox::SetCurEntry( SvTreeListEntry* pEntry ) diff --git a/vcl/source/treelist/svlbitm.cxx b/vcl/source/treelist/svlbitm.cxx index aaf9124765aa..0736ee65109c 100644 --- a/vcl/source/treelist/svlbitm.cxx +++ b/vcl/source/treelist/svlbitm.cxx @@ -292,7 +292,7 @@ void SvLBoxString::InitViewData( if (mbEmphasized) { - pView->Push(); + pView->GetOutDev()->Push(); vcl::Font aFont( pView->GetFont()); aFont.SetWeight(WEIGHT_BOLD); pView->Control::SetFont( aFont ); @@ -300,7 +300,7 @@ void SvLBoxString::InitViewData( if (mbCustom) { - Size aSize = pView->MeasureCustomEntry(*pView, *pEntry); + Size aSize = pView->MeasureCustomEntry(*pView->GetOutDev(), *pEntry); pViewData->mnWidth = aSize.Width(); pViewData->mnHeight = aSize.Height(); } @@ -311,7 +311,7 @@ void SvLBoxString::InitViewData( } if (mbEmphasized) - pView->Pop(); + pView->GetOutDev()->Pop(); } int SvLBoxString::CalcWidth(const SvTreeListBox* pView) const @@ -443,7 +443,7 @@ void SvLBoxButton::InitViewData(SvTreeListBox* pView,SvTreeListEntry* pEntry, Sv ControlType eCtrlType = (pData->IsRadio())? ControlType::Radiobutton : ControlType::Checkbox; if ( pView ) - ImplAdjustBoxSize(aSize, eCtrlType, *pView); + ImplAdjustBoxSize(aSize, eCtrlType, *pView->GetOutDev()); pViewData->mnWidth = aSize.Width(); pViewData->mnHeight = aSize.Height(); } diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index e653edf73b04..5ebe086708ac 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -1053,7 +1053,7 @@ void SvHeaderTabListBox::GrabTableFocus() bool SvHeaderTabListBox::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 SvHeaderTabListBox::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 1fc5feaf21fc..f2357b890fe2 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -1275,7 +1275,7 @@ void SvTreeListBox::InitTreeView() AdjustEntryHeightAndRecalc(); SetSpaceBetweenEntries( 0 ); - SetLineColor(); + GetOutDev()->SetLineColor(); InitSettings(); ImplInitStyle(); SetTabs(); @@ -3432,7 +3432,7 @@ void SvTreeListBox::StateChanged( StateChangedType eType ) void SvTreeListBox::ApplySettings(vcl::RenderContext& rRenderContext) { - SetPointFont(rRenderContext, GetPointFont(*this)); + SetPointFont(rRenderContext, GetPointFont(*GetOutDev())); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor()); @@ -3448,7 +3448,7 @@ void SvTreeListBox::InitSettings() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); vcl::Font aFont = rStyleSettings.GetFieldFont(); - SetPointFont(*this, aFont); + SetPointFont(*GetOutDev(), aFont); AdjustEntryHeightAndRecalc(); SetTextColor(rStyleSettings.GetFieldTextColor()); diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 36af49a38afe..7b713cf8d043 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -1757,8 +1757,8 @@ void DrawingAreaUIObject::execute(const OUString& rAction, const StringMap& rPar double fPosX = std::atof(sPosX2.getStr()); double fPosY = std::atof(sPoxY2.getStr()); - fPosX = fPosX * mxDrawingArea->GetOutputWidthPixel(); - fPosY = fPosY * mxDrawingArea->GetOutputHeightPixel(); + fPosX = fPosX * mxDrawingArea->GetOutDev()->GetOutputWidthPixel(); + fPosY = fPosY * mxDrawingArea->GetOutDev()->GetOutputHeightPixel(); MouseEvent aEvent(Point(fPosX, fPosY), 1, MouseEventModifiers::NONE, MOUSE_LEFT, 0); mxDrawingArea->MouseButtonDown(aEvent); diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index 4e3768286554..ad432c33cfb4 100644 --- a/vcl/source/window/accessibility.cxx +++ b/vcl/source/window/accessibility.cxx @@ -437,7 +437,7 @@ OUString Window::getDefaultAccessibleName() const break; } - return GetNonMnemonicString( aAccessibleName ); + return OutputDevice::GetNonMnemonicString( aAccessibleName ); } void Window::SetAccessibleDescription( const OUString& rDescription ) diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index ec1e95c9db46..e343a7bd4ae1 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -155,13 +155,13 @@ void ImplBorderWindowView::ImplInitTitle(ImplBorderFrameData* pData) { if (pData->mnTitleType == BorderWindowTitleType::Small) { - pBorderWindow->SetPointFont(*pBorderWindow, rStyleSettings.GetFloatTitleFont() ); + pBorderWindow->SetPointFont(*pBorderWindow->GetOutDev(), rStyleSettings.GetFloatTitleFont() ); pData->mnTitleHeight = rStyleSettings.GetFloatTitleHeight(); } else // pData->mnTitleType == BorderWindowTitleType::Normal { // FIXME RenderContext - pBorderWindow->SetPointFont(*pBorderWindow, rStyleSettings.GetTitleFont()); + pBorderWindow->SetPointFont(*pBorderWindow->GetOutDev(), rStyleSettings.GetTitleFont()); pData->mnTitleHeight = rStyleSettings.GetTitleHeight(); } tools::Long nTextHeight = pBorderWindow->GetTextHeight(); @@ -398,10 +398,8 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, tools::Long nWidth, to mnHeight = nHeight; mbNWFBorder = false; - vcl::Window *pWin = nullptr, *pCtrl = nullptr; - if (mpOutDev->GetOutDevType() == OUTDEV_WINDOW) - pWin = static_cast<vcl::Window*>(mpOutDev.get()); - + vcl::Window *pWin = mpOutDev->GetOwnerWindow(); + vcl::Window *pCtrl = nullptr; if (pWin) pCtrl = mpBorderWindow->GetWindow(GetWindowType::Client); @@ -705,7 +703,7 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, c { Edit* pEdit = static_cast<Edit*>(pCtrl)->GetSubEdit(); if (pEdit && !pEdit->SupportsDoubleBuffering()) - pCtrl->Paint(*pCtrl, tools::Rectangle()); // make sure the buttons are also drawn as they might overwrite the border + pCtrl->Paint(*pCtrl->GetOutDev(), tools::Rectangle()); // make sure the buttons are also drawn as they might overwrite the border } } @@ -1735,7 +1733,7 @@ void ImplBorderWindow::Resize() PosSizeFlags::Width | PosSizeFlags::Height ); // UpdateView - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); Window::Resize(); @@ -1783,7 +1781,7 @@ void ImplBorderWindow::InitView() else mpBorderView.reset(new ImplStdBorderWindowView( this )); Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); } void ImplBorderWindow::UpdateView( bool bNewView, const Size& rNewOutSize ) @@ -1806,7 +1804,7 @@ void ImplBorderWindow::UpdateView( bool bNewView, const Size& rNewOutSize ) mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); aSize.AdjustWidth(nLeftBorder+nRightBorder ); aSize.AdjustHeight(nTopBorder+nBottomBorder ); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); } vcl::Window* pClientWindow = ImplGetClientWindow(); @@ -1887,7 +1885,7 @@ void ImplBorderWindow::SetCloseButton() { SetStyle( GetStyle() | WB_CLOSEABLE ); Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); } @@ -1895,7 +1893,7 @@ void ImplBorderWindow::SetDockButton( bool bDockButton ) { mbDockBtn = bDockButton; Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); } @@ -1903,7 +1901,7 @@ void ImplBorderWindow::SetHideButton( bool bHideButton ) { mbHideBtn = bHideButton; Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); } @@ -1911,7 +1909,7 @@ void ImplBorderWindow::SetMenuButton( bool bMenuButton ) { mbMenuBtn = bMenuButton; Size aSize = GetOutputSizePixel(); - mpBorderView->Init( this, aSize.Width(), aSize.Height() ); + mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() ); InvalidateBorder(); } diff --git a/vcl/source/window/bubblewindow.cxx b/vcl/source/window/bubblewindow.cxx index a1b97c3d49c3..f4e491242c52 100644 --- a/vcl/source/window/bubblewindow.cxx +++ b/vcl/source/window/bubblewindow.cxx @@ -87,26 +87,26 @@ void BubbleWindow::SetTitleAndText( const OUString& rTitle, Resize(); } -void BubbleWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& /*rRect*/) +void BubbleWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) { LineInfo aThickLine( LineStyle::Solid, 2 ); - DrawPolyLine( maRectPoly, aThickLine ); - DrawPolyLine( maTriPoly ); + rRenderContext.DrawPolyLine( maRectPoly, aThickLine ); + rRenderContext.DrawPolyLine( maTriPoly ); - Color aOldLine = GetLineColor(); + Color aOldLine = rRenderContext.GetLineColor(); Size aSize = GetSizePixel(); tools::Long nTipOffset = aSize.Width() - TIP_RIGHT_OFFSET + mnTipOffset; - SetLineColor( GetSettings().GetStyleSettings().GetHelpColor() ); - DrawLine( Point( nTipOffset+2, TIP_HEIGHT ), + rRenderContext.SetLineColor( GetSettings().GetStyleSettings().GetHelpColor() ); + rRenderContext.DrawLine( Point( nTipOffset+2, TIP_HEIGHT ), Point( nTipOffset + TIP_WIDTH -1 , TIP_HEIGHT ), aThickLine ); - SetLineColor( aOldLine ); + rRenderContext.SetLineColor( aOldLine ); Size aImgSize = maBubbleImage.GetSizePixel(); - DrawImage( Point( BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ), maBubbleImage ); + rRenderContext.DrawImage( Point( BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ), maBubbleImage ); vcl::Font aOldFont = GetFont(); vcl::Font aBoldFont = aOldFont; @@ -115,12 +115,12 @@ void BubbleWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Re SetFont( aBoldFont ); tools::Rectangle aTitleRect = maTitleRect; aTitleRect.Move( aImgSize.Width(), 0 ); - DrawText( aTitleRect, maBubbleTitle, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); + rRenderContext.DrawText( aTitleRect, maBubbleTitle, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); SetFont( aOldFont ); tools::Rectangle aTextRect = maTextRect; aTextRect.Move( aImgSize.Width(), 0 ); - DrawText( aTextRect, maBubbleText, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); + rRenderContext.DrawText( aTextRect, maBubbleText, DrawTextFlags::MultiLine | DrawTextFlags::WordBreak ); } void BubbleWindow::MouseButtonDown( const MouseEvent& ) diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx index b5c262df2c1a..f55283cff886 100644 --- a/vcl/source/window/clipping.cxx +++ b/vcl/source/window/clipping.cxx @@ -27,7 +27,7 @@ namespace vcl { -vcl::Region Window::GetOutputBoundsClipRegion() const +vcl::Region WindowOutputDevice::GetOutputBoundsClipRegion() const { vcl::Region aClip(GetClipRegion()); aClip.Intersect(tools::Rectangle(Point(), GetOutputSize())); @@ -35,17 +35,17 @@ vcl::Region Window::GetOutputBoundsClipRegion() const return aClip; } -void Window::InitClipRegion() +void WindowOutputDevice::InitClipRegion() { DBG_TESTSOLARMUTEX(); vcl::Region aRegion; - if ( mpWindowImpl->mbInPaint ) - aRegion = *(mpWindowImpl->mpPaintRegion); + if ( mxOwnerWindow->mpWindowImpl->mbInPaint ) + aRegion = *(mxOwnerWindow->mpWindowImpl->mpPaintRegion); else { - aRegion = ImplGetWinChildClipRegion(); + aRegion = mxOwnerWindow->ImplGetWinChildClipRegion(); // only this region is in frame coordinates, so re-mirror it // the mpWindowImpl->mpPaintRegion above is already correct (see ImplCallPaint()) ! if( ImplIsAntiparallel() ) @@ -94,11 +94,11 @@ void Window::ExpandPaintClipRegion( const vcl::Region& rRegion ) return; vcl::Region aPixRegion = LogicToPixel( rRegion ); - vcl::Region aDevPixRegion = ImplPixelToDevicePixel( aPixRegion ); + vcl::Region aDevPixRegion = GetOutDev()->ImplPixelToDevicePixel( aPixRegion ); vcl::Region aWinChildRegion = ImplGetWinChildClipRegion(); // only this region is in frame coordinates, so re-mirror it - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aWinChildRegion ); @@ -108,7 +108,7 @@ void Window::ExpandPaintClipRegion( const vcl::Region& rRegion ) if( ! aDevPixRegion.IsEmpty() ) { mpWindowImpl->mpPaintRegion->Union( aDevPixRegion ); - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; } } @@ -125,19 +125,19 @@ vcl::Region Window::GetWindowClipRegionPixel() const if ( aWinRegion == aWinClipRegion ) aWinClipRegion.SetNull(); - aWinClipRegion.Move( -mnOutOffX, -mnOutOffY ); + aWinClipRegion.Move( -GetOutDev()->mnOutOffX, -GetOutDev()->mnOutOffY ); return aWinClipRegion; } -vcl::Region Window::GetActiveClipRegion() const +vcl::Region WindowOutputDevice::GetActiveClipRegion() const { vcl::Region aRegion(true); - if ( mpWindowImpl->mbInPaint ) + if ( mxOwnerWindow->mpWindowImpl->mbInPaint ) { - aRegion = *(mpWindowImpl->mpPaintRegion); + aRegion = *(mxOwnerWindow->mpWindowImpl->mpPaintRegion); aRegion.Move( -mnOutOffX, -mnOutOffY ); } @@ -147,9 +147,9 @@ vcl::Region Window::GetActiveClipRegion() const return PixelToLogic( aRegion ); } -void Window::ClipToPaintRegion(tools::Rectangle& rDstRect) +void WindowOutputDevice::ClipToPaintRegion(tools::Rectangle& rDstRect) { - const vcl::Region aPaintRgn(GetPaintRegion()); + const vcl::Region aPaintRgn(mxOwnerWindow->GetPaintRegion()); if (!aPaintRgn.IsNull()) rDstRect.Intersection(LogicToPixel(aPaintRgn.GetBoundRect())); @@ -251,7 +251,7 @@ void Window::ImplInitWinClipRegion() // Build Window Region mpWindowImpl->maWinClipRegion = GetOutputRectPixel(); if ( mpWindowImpl->mbWinRegion ) - mpWindowImpl->maWinClipRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + mpWindowImpl->maWinClipRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); // ClipSiblings if ( mpWindowImpl->mbClipSiblings && !ImplIsOverlapWindow() ) @@ -325,7 +325,7 @@ bool Window::ImplSysObjClip( const vcl::Region* pOldRegion ) mpWindowImpl->mpSysObj->ResetClipRegion(); else { - aRegion.Move( -mnOutOffX, -mnOutOffY ); + aRegion.Move( -GetOutDev()->mnOutOffX, -GetOutDev()->mnOutOffY ); // set/update clip region RectangleVector aRectangles; @@ -410,7 +410,7 @@ bool Window::ImplSetClipFlagChildren( bool bSysObjOnlySmaller ) if ( bSysObjOnlySmaller && !mpWindowImpl->mbInitWinClipRegion ) pOldRegion.reset(new vcl::Region( mpWindowImpl->maWinClipRegion )); - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mbInitWinClipRegion = true; vcl::Window* pWindow = mpWindowImpl->mpFirstChild; @@ -423,14 +423,14 @@ bool Window::ImplSetClipFlagChildren( bool bSysObjOnlySmaller ) if ( !ImplSysObjClip( pOldRegion.get() ) ) { - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mbInitWinClipRegion = true; bUpdate = false; } } else { - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mbInitWinClipRegion = true; vcl::Window* pWindow = mpWindowImpl->mpFirstChild; @@ -469,7 +469,7 @@ bool Window::ImplSetClipFlag( bool bSysObjOnlySmaller ) if ( pParent && ((pParent->GetStyle() & WB_CLIPCHILDREN) || (mpWindowImpl->mnParentClipMode & ParentClipMode::Clip)) ) { - pParent->mbInitClipRegion = true; + pParent->GetOutDev()->mbInitClipRegion = true; pParent->mpWindowImpl->mbInitChildRegion = true; } @@ -503,7 +503,7 @@ void Window::ImplIntersectWindowRegion( vcl::Region& rRegion ) { rRegion.Intersect( GetOutputRectPixel() ); if ( mpWindowImpl->mbWinRegion ) - rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + rRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); } void Window::ImplExcludeWindowRegion( vcl::Region& rRegion ) @@ -511,7 +511,7 @@ void Window::ImplExcludeWindowRegion( vcl::Region& rRegion ) if ( mpWindowImpl->mbWinRegion ) { vcl::Region aRegion( GetOutputRectPixel() ); - aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); rRegion.Exclude( aRegion ); } else @@ -603,7 +603,7 @@ void Window::ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Re { vcl::Region aRegion( rSourceRect ); if ( mpWindowImpl->mbWinRegion ) - rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + rRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); vcl::Region aTempRegion; vcl::Window* pWindow; @@ -665,15 +665,15 @@ void Window::ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Re } } -void Window::SaveBackground(VirtualDevice& rSaveDevice, const Point& rPos, const Size& rSize, const Size&) const +void WindowOutputDevice::SaveBackground(VirtualDevice& rSaveDevice, const Point& rPos, const Size& rSize, const Size&) const { MapMode aTempMap(GetMapMode()); aTempMap.SetOrigin(Point()); rSaveDevice.SetMapMode(aTempMap); - if ( mpWindowImpl->mpPaintRegion ) + if ( mxOwnerWindow->mpWindowImpl->mpPaintRegion ) { - vcl::Region aClip( *mpWindowImpl->mpPaintRegion ); + vcl::Region aClip( *mxOwnerWindow->mpWindowImpl->mpPaintRegion ); const Point aPixPos( LogicToPixel( rPos ) ); aClip.Move( -mnOutOffX, -mnOutOffY ); diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx index d7f2b56aab28..90ac32298784 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -123,7 +123,7 @@ static void ImplCursorInvert(vcl::Window* pWindow, ImplCursorData const * pData) if (bDoubleBuffering) pGuard.reset(new vcl::PaintBufferGuard(pWindow->ImplGetWindowImpl()->mpFrameData, pWindow)); - vcl::RenderContext* pRenderContext = bDoubleBuffering ? pGuard->GetRenderContext() : pWindow; + vcl::RenderContext* pRenderContext = bDoubleBuffering ? pGuard->GetRenderContext() : pWindow->GetOutDev(); tools::Rectangle aPaintRect = ImplCursorInvert(pRenderContext, pData); if (bDoubleBuffering) @@ -155,7 +155,7 @@ void vcl::Cursor::ImplDraw() if (mpData && mpData->mpWindow) { // calculate output area - if (ImplPrepForDraw(mpData->mpWindow, *mpData)) + if (ImplPrepForDraw(mpData->mpWindow->GetOutDev(), *mpData)) { // display ImplCursorInvert(mpData->mpWindow, mpData.get()); diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index 20529e4a1aa6..b43b13788f09 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -566,7 +566,7 @@ void ImplDrawButton( OutputDevice *const pDev, tools::Rectangle aFillRect, void ImplDrawFrame( OutputDevice *const pDev, tools::Rectangle& rRect, const StyleSettings& rStyleSettings, DrawFrameStyle nStyle, DrawFrameFlags nFlags ) { - vcl::Window *const pWin = (pDev->GetOutDevType()==OUTDEV_WINDOW) ? static_cast<vcl::Window*>(pDev) : nullptr; + vcl::Window * pWin = pDev->GetOwnerWindow(); const bool bMenuStyle(nFlags & DrawFrameFlags::Menu); @@ -610,7 +610,7 @@ void ImplDrawFrame( OutputDevice *const pDev, tools::Rectangle& rRect, // if bNoDraw is true then don't call the drawing routine // but just update the target rectangle if( bNoDraw || - pWin->DrawNativeControl( ControlType::Frame, ControlPart::Border, aBound, ControlState::ENABLED, + pWin->GetOutDev()->DrawNativeControl( ControlType::Frame, ControlPart::Border, aBound, ControlState::ENABLED, aControlValue, OUString()) ) { rRect = aContent; @@ -998,14 +998,14 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo { Point aStart( rStart ), aStop( rStop ); const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings(); - vcl::Window *const pWin = (mpOutDev->GetOutDevType()==OUTDEV_WINDOW) ? static_cast<vcl::Window*>(mpOutDev.get()) : nullptr; + vcl::Window *const pWin = mpOutDev->GetOwnerWindow(); if(pWin) { ControlPart nPart = ( bVertical ? ControlPart::SeparatorVert : ControlPart::SeparatorHorz ); bool nativeSupported = pWin->IsNativeControlSupported( ControlType::Fixedline, nPart ); ImplControlValue aValue; tools::Rectangle aRect(rStart,rStop); - if(nativeSupported && pWin->DrawNativeControl(ControlType::Fixedline,nPart,aRect,ControlState::NONE,aValue,OUString())) + if(nativeSupported && pWin->GetOutDev()->DrawNativeControl(ControlType::Fixedline,nPart,aRect,ControlState::NONE,aValue,OUString())) return; } diff --git a/vcl/source/window/dndeventdispatcher.cxx b/vcl/source/window/dndeventdispatcher.cxx index 47adfcf87d5a..0afa4501eb71 100644 --- a/vcl/source/window/dndeventdispatcher.cxx +++ b/vcl/source/window/dndeventdispatcher.cxx @@ -58,7 +58,7 @@ vcl::Window* DNDEventDispatcher::findTopLevelWindow(Point location) while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplIsAntiparallel() ) + if( pChildWindow->GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pChildWinOutDev = pChildWindow->GetOutDev(); pChildWinOutDev->ReMirror( location ); diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index a7abd42b168b..a03e2146d944 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -80,7 +80,7 @@ ImplDockFloatWin2::ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits, // copy state of DockingWindow if ( pDockingWin ) { - SetSettings( pDockingWin->GetWindow()->GetSettings() ); + GetOutDev()->SetSettings( pDockingWin->GetWindow()->GetSettings() ); Enable( pDockingWin->GetWindow()->IsEnabled(), false ); EnableInput( pDockingWin->GetWindow()->IsInputEnabled(), false ); AlwaysEnableInput( pDockingWin->GetWindow()->IsAlwaysEnableInput(), false ); diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 3b622cf1cd73..68b0ccb9916a 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -92,7 +92,7 @@ ImplDockFloatWin::ImplDockFloatWin( vcl::Window* pParent, WinBits nWinBits, // copy settings of DockingWindow if ( pDockingWin ) { - SetSettings( pDockingWin->GetSettings() ); + GetOutDev()->SetSettings( pDockingWin->GetSettings() ); Enable( pDockingWin->IsEnabled(), false ); EnableInput( pDockingWin->IsInputEnabled(), false ); AlwaysEnableInput( pDockingWin->IsAlwaysEnableInput(), false ); diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx index 2a831a0ec995..4a01c3823110 100644 --- a/vcl/source/window/event.cxx +++ b/vcl/source/window/event.cxx @@ -340,10 +340,6 @@ ImplSVEvent * Window::PostUserEvent( const Link<void*,void>& rLink, void* pCalle pSVEvent->mbCall = true; if (bReferenceLink) { - // Double check that this is indeed a vcl::Window instance. - assert(dynamic_cast<vcl::Window *>( - static_cast<OutputDevice *>(rLink.GetInstance())) == - static_cast<vcl::Window *>(rLink.GetInstance())); pSVEvent->mpInstanceRef = static_cast<vcl::Window *>(rLink.GetInstance()); } diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 1bc1b2a9a3cd..0b333f87df76 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -485,7 +485,7 @@ Point FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const Point& const OutputDevice *pWindowOutDev = pReference->GetOutDev(); // compare coordinates in absolute screen coordinates - if( pReference->HasMirroredGraphics() ) + if( pWindowOutDev->HasMirroredGraphics() ) { if(!pReference->IsRTLEnabled() ) pWindowOutDev->ReMirror( aAbsolute ); @@ -509,7 +509,7 @@ tools::Rectangle FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, co // compare coordinates in absolute screen coordinates // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509 - if( pReference->HasMirroredGraphics() ) + if( pParentWinOutDev->HasMirroredGraphics() ) { if(!pReference->IsRTLEnabled() ) pParentWinOutDev->ReMirror(aFloatRect); @@ -531,7 +531,7 @@ tools::Rectangle FloatingWindow::ImplConvertToRelPos(vcl::Window* pReference, co // compare coordinates in absolute screen coordinates // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509 - if( pReference->HasMirroredGraphics() ) + if( pParentWinOutDev->HasMirroredGraphics() ) { aFloatRect = pReference->ImplUnmirroredAbsoluteScreenToOutputPixel(aFloatRect); aFloatRect.SetPos(pReference->OutputToScreenPixel(aFloatRect.TopLeft())); diff --git a/vcl/source/window/globalization.cxx b/vcl/source/window/globalization.cxx index d5ae5c5747ad..9521829785cf 100644 --- a/vcl/source/window/globalization.cxx +++ b/vcl/source/window/globalization.cxx @@ -19,13 +19,24 @@ #include <vcl/window.hxx> #include <vcl/outdev.hxx> +#include <windowdev.hxx> +#include <window.h> namespace vcl { -void Window::EnableRTL ( bool bEnable ) +void WindowOutputDevice::EnableRTL ( bool bEnable ) { - CompatStateChanged( StateChangedType::Mirroring ); - OutputDevice::EnableRTL(bEnable); + if (mbEnableRTL != bEnable) + mxOwnerWindow->ImplEnableRTL(bEnable); +} + +void Window::ImplEnableRTL( bool bEnable ) +{ + if (mpWindowImpl->mxOutDev->mbEnableRTL != bEnable) + { + CompatStateChanged( StateChangedType::Mirroring ); + mpWindowImpl->mxOutDev->OutputDevice::EnableRTL(bEnable); + } } } /* namespace vcl */ diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 79a843e5d30d..2a76145e9247 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1812,7 +1812,7 @@ VclScrolledWindow::VclScrolledWindow(vcl::Window *pParent) StyleSettings aStyle = aAllSettings.GetStyleSettings(); aStyle.SetMonoColor(aStyle.GetShadowColor()); aAllSettings.SetStyleSettings(aStyle); - SetSettings(aAllSettings); + GetOutDev()->SetSettings(aAllSettings); Link<ScrollBar*,void> aLink( LINK( this, VclScrolledWindow, ScrollBarHdl ) ); m_pVScroll->SetScrollHdl(aLink); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 8f4019dd9d52..531e2ccae77f 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1446,7 +1446,7 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) tools::Long nMinMenuItemHeight = nFontHeight; tools::Long nCheckHeight = 0, nRadioHeight = 0; - Size aMaxSize = ImplGetNativeCheckAndRadioSize(*pWin, nCheckHeight, nRadioHeight); // FIXME + Size aMaxSize = ImplGetNativeCheckAndRadioSize(*pWin->GetOutDev(), nCheckHeight, nRadioHeight); // FIXME if( aMaxSize.Height() > nMinMenuItemHeight ) nMinMenuItemHeight = aMaxSize.Height(); @@ -1524,8 +1524,8 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) // Text: if ( (pData->eType == MenuItemType::STRING) || (pData->eType == MenuItemType::STRINGIMAGE) ) { - const SalLayoutGlyphs* pGlyphs = pData->GetTextGlyphs(pWin); - tools::Long nTextWidth = pWin->GetCtrlTextWidth(pData->aText, pGlyphs); + const SalLayoutGlyphs* pGlyphs = pData->GetTextGlyphs(pWin->GetOutDev()); + tools::Long nTextWidth = pWin->GetOutDev()->GetCtrlTextWidth(pData->aText, pGlyphs); tools::Long nTextHeight = pWin->GetTextHeight(); if (IsMenuBar()) @@ -1575,21 +1575,21 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) nTitleHeight = 0; if (!IsMenuBar() && aTitleText.getLength() > 0) { // Set expected font - pWin->Push(PushFlags::FONT); + pWin->GetOutDev()->Push(PushFlags::FONT); vcl::Font aFont = pWin->GetFont(); aFont.SetWeight(WEIGHT_BOLD); pWin->SetFont(aFont); // Compute text bounding box tools::Rectangle aTextBoundRect; - pWin->GetTextBoundRect(aTextBoundRect, aTitleText); + pWin->GetOutDev()->GetTextBoundRect(aTextBoundRect, aTitleText); // Vertically, one height of char + extra space for decoration nTitleHeight = aTextBoundRect.GetSize().Height() + 4 * SPACE_AROUND_TITLE ; aSz.AdjustHeight(nTitleHeight ); tools::Long nWidth = aTextBoundRect.GetSize().Width() + 4 * SPACE_AROUND_TITLE; - pWin->Pop(); + pWin->GetOutDev()->Pop(); if ( nWidth > nMaxWidth ) nMaxWidth = nWidth; } @@ -2247,12 +2247,12 @@ void Menu::ImplFillLayoutData() const mpLayoutData.reset(new MenuLayoutData); if (IsMenuBar()) { - ImplPaint(*pWindow, pWindow->GetOutputSizePixel(), 0, 0, nullptr, false, true); // FIXME + ImplPaint(*pWindow->GetOutDev(), pWindow->GetOutputSizePixel(), 0, 0, nullptr, false, true); // FIXME } else { MenuFloatingWindow* pFloat = static_cast<MenuFloatingWindow*>(pWindow.get()); - ImplPaint(*pWindow, pWindow->GetOutputSizePixel(), pFloat->nScrollerHeight, pFloat->ImplGetStartY(), + ImplPaint(*pWindow->GetOutDev(), pWindow->GetOutputSizePixel(), pFloat->nScrollerHeight, pFloat->ImplGetStartY(), nullptr, false, true); //FIXME } } @@ -2725,7 +2725,7 @@ int MenuBar::GetMenuBarHeight() const else { vcl::Window* pMenubarWin = GetWindow(); - nMenubarHeight = pMenubarWin ? pMenubarWin->GetOutputHeightPixel() : 0; + nMenubarHeight = pMenubarWin ? pMenubarWin->GetOutDev()->GetOutputHeightPixel() : 0; } return nMenubarHeight; } diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index b3c78549dd49..1f945e0a95c3 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -1015,7 +1015,7 @@ void MenuBarWindow::StateChanged( StateChangedType nType ) if (nType == StateChangedType::ControlForeground || nType == StateChangedType::ControlBackground) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } else if (nType == StateChangedType::Enable) @@ -1033,7 +1033,7 @@ void MenuBarWindow::LayoutChanged() if (!m_pMenu) return; - ApplySettings(*this); + ApplySettings(*GetOutDev()); // if the font was changed. tools::Long nHeight = m_pMenu->ImplCalcSize(this).Height(); @@ -1107,7 +1107,7 @@ void MenuBarWindow::ImplInitStyleSettings() aStyle.SetMenuHighlightTextColor(aHighlightTextColor); } aSettings.SetStyleSettings(aStyle); - OutputDevice::SetSettings(aSettings); + GetOutDev()->SetSettings(aSettings); } void MenuBarWindow::DataChanged( const DataChangedEvent& rDCEvt ) @@ -1119,7 +1119,7 @@ void MenuBarWindow::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); ImplInitStyleSettings(); LayoutChanged(); } diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index dd1e2c6ea557..d4d59e90d5c2 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -46,7 +46,7 @@ MenuFloatingWindow::MenuFloatingWindow( Menu* pMen, vcl::Window* pParent, WinBit { mpWindowImpl->mbMenuFloatingWindow= true; - ApplySettings(*this); + ApplySettings(*GetOutDev()); SetPopupModeEndHdl( LINK( this, MenuFloatingWindow, PopupEnd ) ); @@ -130,7 +130,7 @@ void MenuFloatingWindow::dispose() void MenuFloatingWindow::Resize() { - InitMenuClipRegion(*this); // FIXME + InitMenuClipRegion(*GetOutDev()); // FIXME } void MenuFloatingWindow::ApplySettings(vcl::RenderContext& rRenderContext) @@ -149,7 +149,7 @@ void MenuFloatingWindow::ApplySettings(vcl::RenderContext& rRenderContext) aStyle.SetMenuHighlightTextColor(aHighlightTextColor); } aSettings.SetStyleSettings(aStyle); - OutputDevice::SetSettings(aSettings); + GetOutDev()->SetSettings(aSettings); } const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); @@ -405,7 +405,7 @@ void MenuFloatingWindow::EnableScrollMenu( bool b ) bScrollMenu = b; nScrollerHeight = b ? static_cast<sal_uInt16>(GetSettings().GetStyleSettings().GetScrollBarSize()) /2 : 0; bScrollDown = true; - InitMenuClipRegion(*this); + InitMenuClipRegion(*GetOutDev()); } void MenuFloatingWindow::Start() @@ -1289,7 +1289,7 @@ void MenuFloatingWindow::StateChanged( StateChangedType nType ) if ( ( nType == StateChangedType::ControlForeground ) || ( nType == StateChangedType::ControlBackground ) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } @@ -1303,7 +1303,7 @@ void MenuFloatingWindow::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { - ApplySettings(*this); + ApplySettings(*GetOutDev()); Invalidate(); } } diff --git a/vcl/source/window/menuwindow.cxx b/vcl/source/window/menuwindow.cxx index fae4746a689e..a3412e0778b3 100644 --- a/vcl/source/window/menuwindow.cxx +++ b/vcl/source/window/menuwindow.cxx @@ -33,7 +33,7 @@ static sal_uLong ImplChangeTipTimeout( sal_uLong nTimeout, vcl::Window *pWindow sal_uLong nRet = aHelpSettings.GetTipTimeout(); aHelpSettings.SetTipTimeout( nTimeout ); aAllSettings.SetHelpSettings( aHelpSettings ); - pWindow->SetSettings( aAllSettings ); + pWindow->GetOutDev()->SetSettings( aAllSettings ); return nRet; } diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index 7a6afc56c79d..101a586b9b68 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -56,7 +56,7 @@ namespace vcl { WindowHitTest Window::ImplHitTest( const Point& rFramePos ) { Point aFramePos( rFramePos ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aFramePos ); @@ -66,8 +66,8 @@ WindowHitTest Window::ImplHitTest( const Point& rFramePos ) if ( mpWindowImpl->mbWinRegion ) { Point aTempPos = aFramePos; - aTempPos.AdjustX( -mnOutOffX ); - aTempPos.AdjustY( -mnOutOffY ); + aTempPos.AdjustX( -GetOutDev()->mnOutOffX ); + aTempPos.AdjustY( -GetOutDev()->mnOutOffY ); if ( !mpWindowImpl->maWinRegion.IsInside( aTempPos ) ) return WindowHitTest::NONE; } @@ -144,8 +144,8 @@ void Window::ImplCallMouseMove( sal_uInt16 nMouseCode, bool bModChanged ) bool bLeave; // check for MouseLeave bLeave = ((nX < 0) || (nY < 0) || - (nX >= mpWindowImpl->mpFrameWindow->mnOutWidth) || - (nY >= mpWindowImpl->mpFrameWindow->mnOutHeight)) && + (nX >= mpWindowImpl->mpFrameWindow->GetOutDev()->mnOutWidth) || + (nY >= mpWindowImpl->mpFrameWindow->GetOutDev()->mnOutHeight)) && !ImplGetSVData()->mpWinData->mpCaptureWin; nMode |= MouseEventModifiers::SYNTHETIC; if ( bModChanged ) @@ -528,9 +528,9 @@ void Window::SetPointerPosPixel( const Point& rPos ) pOutDev->ReMirror( aPos ); } // mirroring is required here, SetPointerPos bypasses SalGraphics - aPos.setX( mpGraphics->mirror2( aPos.X(), *this ) ); + aPos.setX( GetOutDev()->mpGraphics->mirror2( aPos.X(), *GetOutDev() ) ); } - else if( ImplIsAntiparallel() ) + else if( GetOutDev()->ImplIsAntiparallel() ) { pOutDev->ReMirror( aPos ); } @@ -550,7 +550,7 @@ Point Window::GetPointerPosPixel() { Point aPos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aPos ); @@ -562,7 +562,7 @@ Point Window::GetLastPointerPosPixel() { Point aPos( mpWindowImpl->mpFrameData->mnBeforeLastMouseX, mpWindowImpl->mpFrameData->mnBeforeLastMouseY ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aPos ); @@ -591,7 +591,7 @@ Window::PointerState Window::GetPointerState() if (mpWindowImpl->mpFrame) { SalFrame::SalPointerState aSalPointerState = mpWindowImpl->mpFrame->GetPointerState(); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); pOutDev->ReMirror( aSalPointerState.maPos ); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index f692bc64342f..d132b034dfe5 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -82,21 +82,22 @@ PaintBufferGuard::PaintBufferGuard(ImplFrameData* pFrameData, vcl::Window* pWind nFlags |= PushFlags::TEXTLAYOUTMODE; nFlags |= PushFlags::TEXTLANGUAGE; pFrameData->mpBuffer->Push(nFlags); - pFrameData->mpBuffer->SetClipRegion(pWindow->GetClipRegion()); - pFrameData->mpBuffer->SetFillColor(pWindow->GetFillColor()); + auto& rDev = *pWindow->GetOutDev(); + pFrameData->mpBuffer->SetClipRegion(rDev.GetClipRegion()); + pFrameData->mpBuffer->SetFillColor(rDev.GetFillColor()); pFrameData->mpBuffer->SetFont(pWindow->GetFont()); - pFrameData->mpBuffer->SetLineColor(pWindow->GetLineColor()); + pFrameData->mpBuffer->SetLineColor(rDev.GetLineColor()); pFrameData->mpBuffer->SetMapMode(pWindow->GetMapMode()); - pFrameData->mpBuffer->SetRefPoint(pWindow->GetRefPoint()); + pFrameData->mpBuffer->SetRefPoint(rDev.GetRefPoint()); pFrameData->mpBuffer->SetSettings(pWindow->GetSettings()); pFrameData->mpBuffer->SetTextColor(pWindow->GetTextColor()); pFrameData->mpBuffer->SetTextLineColor(pWindow->GetTextLineColor()); pFrameData->mpBuffer->SetOverlineColor(pWindow->GetOverlineColor()); pFrameData->mpBuffer->SetTextFillColor(pWindow->GetTextFillColor()); pFrameData->mpBuffer->SetTextAlign(pWindow->GetTextAlign()); - pFrameData->mpBuffer->SetRasterOp(pWindow->GetRasterOp()); - pFrameData->mpBuffer->SetLayoutMode(pWindow->GetLayoutMode()); - pFrameData->mpBuffer->SetDigitLanguage(pWindow->GetDigitLanguage()); + pFrameData->mpBuffer->SetRasterOp(rDev.GetRasterOp()); + pFrameData->mpBuffer->SetLayoutMode(rDev.GetLayoutMode()); + pFrameData->mpBuffer->SetDigitLanguage(rDev.GetDigitLanguage()); mnOutOffX = pFrameData->mpBuffer->GetOutOffXPixel(); mnOutOffY = pFrameData->mpBuffer->GetOutOffYPixel(); @@ -131,7 +132,7 @@ PaintBufferGuard::~PaintBufferGuard() COVERITY_NOEXCEPT_FALSE aPaintRectSize = m_pWindow->PixelToLogic(aRectanglePixel.GetSize()); } - m_pWindow->DrawOutDev(m_aPaintRect.TopLeft(), aPaintRectSize, m_aPaintRect.TopLeft(), aPaintRectSize, *mpFrameData->mpBuffer); + m_pWindow->GetOutDev()->DrawOutDev(m_aPaintRect.TopLeft(), aPaintRectSize, m_aPaintRect.TopLeft(), aPaintRectSize, *mpFrameData->mpBuffer); } } @@ -157,7 +158,7 @@ vcl::RenderContext* PaintBufferGuard::GetRenderContext() if (mpFrameData->mpBuffer) return mpFrameData->mpBuffer; else - return m_pWindow; + return m_pWindow->GetOutDev(); } } @@ -302,14 +303,14 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) { // direct painting Wallpaper aBackground = m_pWindow->GetBackground(); - m_pWindow->ApplySettings(*m_pWindow); + m_pWindow->ApplySettings(*m_pWindow->GetOutDev()); // Restore bitmap background if it was lost. if (aBackground.IsBitmap() && !m_pWindow->GetBackground().IsBitmap()) { m_pWindow->SetBackground(aBackground); } - m_pWindow->PushPaintHelper(this, *m_pWindow); - m_pWindow->Paint(*m_pWindow, m_aPaintRect); + m_pWindow->PushPaintHelper(this, *m_pWindow->GetOutDev()); + m_pWindow->Paint(*m_pWindow->GetOutDev(), m_aPaintRect); } #if HAVE_FEATURE_OPENGL VCL_GL_INFO("PaintHelper::DoPaint end on " << @@ -479,7 +480,7 @@ void Window::PushPaintHelper(PaintHelper *pHelper, vcl::RenderContext& rRenderCo if ( mpWindowImpl->mpCursor ) pHelper->SetRestoreCursor(mpWindowImpl->mpCursor->ImplSuspend()); - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mbInPaint = true; // restore Paint-Region @@ -488,12 +489,12 @@ void Window::PushPaintHelper(PaintHelper *pHelper, vcl::RenderContext& rRenderCo tools::Rectangle aPaintRect = rPaintRegion.GetBoundRect(); // RTL: re-mirror paint rect and region at this window - if (ImplIsAntiparallel()) + if (GetOutDev()->ImplIsAntiparallel()) { rRenderContext.ReMirror(aPaintRect); rRenderContext.ReMirror(rPaintRegion); } - aPaintRect = ImplDevicePixelToLogic(aPaintRect); + aPaintRect = GetOutDev()->ImplDevicePixelToLogic(aPaintRect); mpWindowImpl->mpPaintRegion = &rPaintRegion; mpWindowImpl->maInvalidateRegion.SetEmpty(); @@ -524,7 +525,7 @@ void Window::PopPaintHelper(PaintHelper const *pHelper) ImplInvertFocus(*mpWindowImpl->mpWinData->mpFocusRect); } mpWindowImpl->mbInPaint = false; - mbInitClipRegion = true; + GetOutDev()->mbInitClipRegion = true; mpWindowImpl->mpPaintRegion = nullptr; if (mpWindowImpl->mpCursor) mpWindowImpl->mpCursor->ImplResume(pHelper->GetRestoreCursor()); @@ -579,7 +580,7 @@ void Window::ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlag { // call PrePaint. PrePaint may add to the invalidate region as well as // other parameters used below. - PrePaint(*this); + PrePaint(*GetOutDev()); mpWindowImpl->mbPaintFrame = false; @@ -602,7 +603,7 @@ void Window::ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlag Invalidate(*pRegion, InvalidateFlags::NoChildren | InvalidateFlags::NoErase | InvalidateFlags::NoTransparent | InvalidateFlags::NoClipChildren); // call PostPaint before returning - PostPaint(*this); + PostPaint(*GetOutDev()); return; } @@ -617,7 +618,7 @@ void Window::ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlag mpWindowImpl->mnPaintFlags = ImplPaintFlags::NONE; // call PostPaint - PostPaint(*this); + PostPaint(*GetOutDev()); } void Window::ImplCallOverlapPaint() @@ -820,7 +821,7 @@ void Window::ImplInvalidate( const vcl::Region* pRegion, InvalidateFlags nFlags if ( pRegion ) { // RTL: remirror region before intersecting it - if ( ImplIsAntiparallel() ) + if ( GetOutDev()->ImplIsAntiparallel() ) { const OutputDevice *pOutDev = GetOutDev(); @@ -1003,7 +1004,7 @@ void Window::ImplUpdateAll() pWindow->ImplCallOverlapPaint(); if ( bFlush ) - Flush(); + GetOutDev()->Flush(); } void Window::PrePaint(vcl::RenderContext& /*rRenderContext*/) @@ -1127,7 +1128,7 @@ vcl::Region Window::GetPaintRegion() const if ( mpWindowImpl->mpPaintRegion ) { vcl::Region aRegion = *mpWindowImpl->mpPaintRegion; - aRegion.Move( -mnOutOffX, -mnOutOffY ); + aRegion.Move( -GetOutDev()->mnOutOffX, -GetOutDev()->mnOutOffY ); return PixelToLogic( aRegion ); } else @@ -1139,7 +1140,7 @@ vcl::Region Window::GetPaintRegion() const void Window::Invalidate( InvalidateFlags nFlags ) { - if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) ) + if ( !comphelper::LibreOfficeKit::isActive() && (!GetOutDev()->IsDeviceOutputNecessary() || !GetOutDev()->mnOutWidth || !GetOutDev()->mnOutHeight) ) return; ImplInvalidate( nullptr, nFlags ); @@ -1148,7 +1149,7 @@ void Window::Invalidate( InvalidateFlags nFlags ) void Window::Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags ) { - if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) ) + if ( !comphelper::LibreOfficeKit::isActive() && (!GetOutDev()->IsDeviceOutputNecessary() || !GetOutDev()->mnOutWidth || !GetOutDev()->mnOutHeight) ) return; OutputDevice *pOutDev = GetOutDev(); @@ -1164,7 +1165,7 @@ void Window::Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags ) void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags ) { - if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) ) + if ( !comphelper::LibreOfficeKit::isActive() && (!GetOutDev()->IsDeviceOutputNecessary() || !GetOutDev()->mnOutWidth || !GetOutDev()->mnOutHeight) ) return; if ( rRegion.IsNull() ) @@ -1174,7 +1175,7 @@ void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags ) } else { - vcl::Region aRegion = ImplPixelToDevicePixel( LogicToPixel( rRegion ) ); + vcl::Region aRegion = GetOutDev()->ImplPixelToDevicePixel( LogicToPixel( rRegion ) ); if ( !aRegion.IsEmpty() ) { ImplInvalidate( &aRegion, nFlags ); @@ -1228,7 +1229,7 @@ void Window::PixelInvalidate(const tools::Rectangle* pRectangle) void Window::Validate() { - if ( !comphelper::LibreOfficeKit::isActive() && (!IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight) ) + if ( !comphelper::LibreOfficeKit::isActive() && (!GetOutDev()->IsDeviceOutputNecessary() || !GetOutDev()->mnOutWidth || !GetOutDev()->mnOutHeight) ) return; ImplValidate(); @@ -1333,7 +1334,7 @@ void Window::PaintImmediately() } if ( bFlush ) - Flush(); + GetOutDev()->Flush(); } void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos ) @@ -1351,13 +1352,13 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP pDevice->SetFont(aCopyFont); pDevice->SetTextColor(GetTextColor()); - if (IsLineColor()) - pDevice->SetLineColor(GetLineColor()); + if (GetOutDev()->IsLineColor()) + pDevice->SetLineColor(GetOutDev()->GetLineColor()); else pDevice->SetLineColor(); - if (IsFillColor()) - pDevice->SetFillColor(GetFillColor()); + if (GetOutDev()->IsFillColor()) + pDevice->SetFillColor(GetOutDev()->GetFillColor()); else pDevice->SetFillColor(); @@ -1377,11 +1378,11 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP pDevice->SetTextFillColor(); pDevice->SetTextAlign(GetTextAlign()); - pDevice->SetRasterOp(GetRasterOp()); + pDevice->SetRasterOp(GetOutDev()->GetRasterOp()); tools::Rectangle aPaintRect(Point(), GetOutputSizePixel()); - vcl::Region aClipRegion(GetClipRegion()); + vcl::Region aClipRegion(GetOutDev()->GetClipRegion()); pDevice->SetClipRegion(); aClipRegion.Intersect(aPaintRect); pDevice->SetClipRegion(aClipRegion); @@ -1403,8 +1404,8 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP { if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() ) { - tools::Long nDeltaX = pChild->mnOutOffX - mnOutOffX; - tools::Long nDeltaY = pChild->mnOutOffY - mnOutOffY; + tools::Long nDeltaX = pChild->GetOutDev()->mnOutOffX - GetOutDev()->mnOutOffX; + tools::Long nDeltaY = pChild->GetOutDev()->mnOutOffY - GetOutDev()->mnOutOffY; Point aPos( i_rPos ); aPos += Point(nDeltaX, nDeltaY); @@ -1418,49 +1419,49 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP bool bRVisible = mpWindowImpl->mbReallyVisible; mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible; - bool bDevOutput = mbDevOutput; - mbDevOutput = true; + bool bDevOutput = GetOutDev()->mbDevOutput; + GetOutDev()->mbDevOutput = true; const OutputDevice *pOutDev = GetOutDev(); tools::Long nOldDPIX = pOutDev->GetDPIX(); tools::Long nOldDPIY = pOutDev->GetDPIY(); - mnDPIX = i_pTargetOutDev->GetDPIX(); - mnDPIY = i_pTargetOutDev->GetDPIY(); - bool bOutput = IsOutputEnabled(); - EnableOutput(); + GetOutDev()->mnDPIX = i_pTargetOutDev->GetDPIX(); + GetOutDev()->mnDPIY = i_pTargetOutDev->GetDPIY(); + bool bOutput = GetOutDev()->IsOutputEnabled(); + GetOutDev()->EnableOutput(); SAL_WARN_IF( GetMapMode().GetMapUnit() != MapUnit::MapPixel, "vcl.window", "MapMode must be PIXEL based" ); if ( GetMapMode().GetMapUnit() != MapUnit::MapPixel ) return; // preserve graphicsstate - Push(); - vcl::Region aClipRegion( GetClipRegion() ); - SetClipRegion(); + GetOutDev()->Push(); + vcl::Region aClipRegion( GetOutDev()->GetClipRegion() ); + GetOutDev()->SetClipRegion(); - GDIMetaFile* pOldMtf = GetConnectMetaFile(); + GDIMetaFile* pOldMtf = GetOutDev()->GetConnectMetaFile(); GDIMetaFile aMtf; - SetConnectMetaFile( &aMtf ); + GetOutDev()->SetConnectMetaFile( &aMtf ); // put a push action to metafile - Push(); + GetOutDev()->Push(); // copy graphics state to metafile vcl::Font aCopyFont = GetFont(); - if( nOldDPIX != mnDPIX || nOldDPIY != mnDPIY ) + if( nOldDPIX != GetOutDev()->mnDPIX || nOldDPIY != GetOutDev()->mnDPIY ) { - aCopyFont.SetFontHeight( aCopyFont.GetFontHeight() * mnDPIY / nOldDPIY ); - aCopyFont.SetAverageFontWidth( aCopyFont.GetAverageFontWidth() * mnDPIX / nOldDPIX ); + aCopyFont.SetFontHeight( aCopyFont.GetFontHeight() * GetOutDev()->mnDPIY / nOldDPIY ); + aCopyFont.SetAverageFontWidth( aCopyFont.GetAverageFontWidth() * GetOutDev()->mnDPIX / nOldDPIX ); } SetFont( aCopyFont ); SetTextColor( GetTextColor() ); - if( IsLineColor() ) - SetLineColor( GetLineColor() ); + if( GetOutDev()->IsLineColor() ) + GetOutDev()->SetLineColor( GetOutDev()->GetLineColor() ); else - SetLineColor(); - if( IsFillColor() ) - SetFillColor( GetFillColor() ); + GetOutDev()->SetLineColor(); + if( GetOutDev()->IsFillColor() ) + GetOutDev()->SetFillColor( GetOutDev()->GetFillColor() ); else - SetFillColor(); + GetOutDev()->SetFillColor(); if( IsTextLineColor() ) SetTextLineColor( GetTextLineColor() ); else @@ -1474,32 +1475,32 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP else SetTextFillColor(); SetTextAlign( GetTextAlign() ); - SetRasterOp( GetRasterOp() ); - if( IsRefPoint() ) - SetRefPoint( GetRefPoint() ); + GetOutDev()->SetRasterOp( GetOutDev()->GetRasterOp() ); + if( GetOutDev()->IsRefPoint() ) + GetOutDev()->SetRefPoint( GetOutDev()->GetRefPoint() ); else - SetRefPoint(); - SetLayoutMode( GetLayoutMode() ); + GetOutDev()->SetRefPoint(); + GetOutDev()->SetLayoutMode( GetOutDev()->GetLayoutMode() ); - SetDigitLanguage( GetDigitLanguage() ); + GetOutDev()->SetDigitLanguage( GetOutDev()->GetDigitLanguage() ); tools::Rectangle aPaintRect(Point(0, 0), GetOutputSizePixel()); aClipRegion.Intersect( aPaintRect ); - SetClipRegion( aClipRegion ); + GetOutDev()->SetClipRegion( aClipRegion ); // do the actual paint // background if( ! IsPaintTransparent() && IsBackground() && ! (GetParentClipMode() & ParentClipMode::NoClip ) ) { - Erase(*this); + Erase(*GetOutDev()); } // foreground - Paint(*this, aPaintRect); + Paint(*GetOutDev(), aPaintRect); // put a pop action to metafile - Pop(); + GetOutDev()->Pop(); - SetConnectMetaFile( pOldMtf ); - EnableOutput( bOutput ); + GetOutDev()->SetConnectMetaFile( pOldMtf ); + GetOutDev()->EnableOutput( bOutput ); mpWindowImpl->mbReallyVisible = bRVisible; // paint metafile to VDev @@ -1520,10 +1521,10 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP { if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() ) { - tools::Long nDeltaX = pChild->mnOutOffX - mnOutOffX; + tools::Long nDeltaX = pChild->GetOutDev()->mnOutOffX - GetOutDev()->mnOutOffX; if( pOutDev->HasMirroredGraphics() ) - nDeltaX = mnOutWidth - nDeltaX - pChild->mnOutWidth; + nDeltaX = GetOutDev()->mnOutWidth - nDeltaX - pChild->GetOutDev()->mnOutWidth; tools::Long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel(); Point aPos( i_rPos ); Point aDelta( nDeltaX, nDeltaY ); @@ -1533,13 +1534,13 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP } // restore graphics state - Pop(); + GetOutDev()->Pop(); - EnableOutput( bOutput ); + GetOutDev()->EnableOutput( bOutput ); mpWindowImpl->mbReallyVisible = bRVisible; - mbDevOutput = bDevOutput; - mnDPIX = nOldDPIX; - mnDPIY = nOldDPIY; + GetOutDev()->mbDevOutput = bDevOutput; + GetOutDev()->mnDPIX = nOldDPIX; + GetOutDev()->mnDPIY = nOldDPIY; } void Window::PaintToDevice(OutputDevice* pDev, const Point& rPos) @@ -1575,7 +1576,7 @@ void Window::PaintToDevice(OutputDevice* pDev, const Point& rPos) void Window::Erase(vcl::RenderContext& rRenderContext) { - if (!IsDeviceOutputNecessary() || ImplIsRecordLayout()) + if (!GetOutDev()->IsDeviceOutputNecessary() || GetOutDev()->ImplIsRecordLayout()) return; bool bNativeOK = false; @@ -1599,28 +1600,28 @@ void Window::Erase(vcl::RenderContext& rRenderContext) nState, ImplControlValue(), OUString()); } - if (mbBackground && !bNativeOK) + if (GetOutDev()->mbBackground && !bNativeOK) { - RasterOp eRasterOp = GetRasterOp(); + RasterOp eRasterOp = GetOutDev()->GetRasterOp(); if (eRasterOp != RasterOp::OverPaint) - SetRasterOp(RasterOp::OverPaint); - rRenderContext.DrawWallpaper(0, 0, mnOutWidth, mnOutHeight, maBackground); + GetOutDev()->SetRasterOp(RasterOp::OverPaint); + rRenderContext.DrawWallpaper(0, 0, GetOutDev()->mnOutWidth, GetOutDev()->mnOutHeight, GetOutDev()->maBackground); if (eRasterOp != RasterOp::OverPaint) rRenderContext.SetRasterOp(eRasterOp); } - if (mpAlphaVDev) - mpAlphaVDev->Erase(); + if (GetOutDev()->mpAlphaVDev) + GetOutDev()->mpAlphaVDev->Erase(); } void Window::ImplScroll( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags ) { - if ( !IsDeviceOutputNecessary() ) + if ( !GetOutDev()->IsDeviceOutputNecessary() ) return; - nHorzScroll = ImplLogicWidthToDevicePixel( nHorzScroll ); - nVertScroll = ImplLogicHeightToDevicePixel( nVertScroll ); + nHorzScroll = GetOutDev()->ImplLogicWidthToDevicePixel( nHorzScroll ); + nVertScroll = GetOutDev()->ImplLogicHeightToDevicePixel( nVertScroll ); if ( !nHorzScroll && !nVertScroll ) return; @@ -1646,7 +1647,7 @@ void Window::ImplScroll( const tools::Rectangle& rRect, OutputDevice *pOutDev = GetOutDev(); // RTL: check if this window requires special action - bool bReMirror = ImplIsAntiparallel(); + bool bReMirror = GetOutDev()->ImplIsAntiparallel(); tools::Rectangle aRectMirror( rRect ); if( bReMirror ) @@ -1686,7 +1687,7 @@ void Window::ImplScroll( const tools::Rectangle& rRect, if ( nFlags & ScrollFlags::Clip ) aRegion.Intersect( rRect ); if ( mpWindowImpl->mbWinRegion ) - aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); aRegion.Exclude( aInvalidateRegion ); @@ -1698,8 +1699,8 @@ void Window::ImplScroll( const tools::Rectangle& rRect, else ImplClipChildren( aRegion ); } - if ( mbClipRegion && (nFlags & ScrollFlags::UseClipRegion) ) - aRegion.Intersect( maRegion ); + if ( GetOutDev()->mbClipRegion && (nFlags & ScrollFlags::UseClipRegion) ) + aRegion.Intersect( GetOutDev()->maRegion ); if ( !aRegion.IsEmpty() ) { if ( mpWindowImpl->mpWinData ) @@ -1734,7 +1735,7 @@ void Window::ImplScroll( const tools::Rectangle& rRect, pGraphics->CopyArea( rRect.Left()+nHorzScroll, rRect.Top()+nVertScroll, rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight(), - *this ); + *GetOutDev() ); } #endif if ( mpWindowImpl->mpWinData ) diff --git a/vcl/source/window/settings.cxx b/vcl/source/window/settings.cxx index d7fee9b1b755..f9af6982a0d4 100644 --- a/vcl/source/window/settings.cxx +++ b/vcl/source/window/settings.cxx @@ -37,20 +37,20 @@ namespace vcl { -void Window::SetSettings( const AllSettings& rSettings ) +void WindowOutputDevice::SetSettings( const AllSettings& rSettings ) { SetSettings( rSettings, false ); } -void Window::SetSettings( const AllSettings& rSettings, bool bChild ) +void WindowOutputDevice::SetSettings( const AllSettings& rSettings, bool bChild ) { - if ( mpWindowImpl->mpBorderWindow ) + if ( auto pBorderWindow = mxOwnerWindow->mpWindowImpl->mpBorderWindow.get() ) { - mpWindowImpl->mpBorderWindow->SetSettings( rSettings, false ); - if ( (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) && - static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow ) - static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->SetSettings( rSettings, true ); + static_cast<vcl::WindowOutputDevice*>(pBorderWindow->GetOutDev())->SetSettings( rSettings, false ); + if ( (pBorderWindow->GetType() == WindowType::BORDERWINDOW) && + static_cast<ImplBorderWindow*>(pBorderWindow)->mpMenuBarWindow ) + static_cast<vcl::WindowOutputDevice*>(static_cast<ImplBorderWindow*>(pBorderWindow)->mpMenuBarWindow->GetOutDev())->SetSettings( rSettings, true ); } AllSettings aOldSettings(*mxSettings); @@ -58,20 +58,20 @@ void Window::SetSettings( const AllSettings& rSettings, bool bChild ) AllSettingsFlags nChangeFlags = aOldSettings.GetChangeFlags( rSettings ); // recalculate AppFont-resolution and DPI-resolution - ImplInitResolutionSettings(); + mxOwnerWindow->ImplInitResolutionSettings(); if ( bool(nChangeFlags) ) { DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, &aOldSettings, nChangeFlags ); - DataChanged( aDCEvt ); + mxOwnerWindow->DataChanged( aDCEvt ); } if ( bChild ) { - vcl::Window* pChild = mpWindowImpl->mpFirstChild; + vcl::Window* pChild = mxOwnerWindow->mpWindowImpl->mpFirstChild; while ( pChild ) { - pChild->SetSettings( rSettings, bChild ); + static_cast<vcl::WindowOutputDevice*>(pChild->GetOutDev())->SetSettings( rSettings, bChild ); pChild = pChild->mpWindowImpl->mpNext; } } @@ -88,8 +88,8 @@ void Window::UpdateSettings( const AllSettings& rSettings, bool bChild ) static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->UpdateSettings( rSettings, true ); } - AllSettings aOldSettings(*mxSettings); - AllSettingsFlags nChangeFlags = mxSettings->Update( AllSettings::GetWindowUpdate(), rSettings ); + AllSettings aOldSettings(*mpWindowImpl->mxOutDev->mxSettings); + AllSettingsFlags nChangeFlags = mpWindowImpl->mxOutDev->mxSettings->Update( AllSettings::GetWindowUpdate(), rSettings ); // recalculate AppFont-resolution and DPI-resolution ImplInitResolutionSettings(); @@ -101,9 +101,9 @@ void Window::UpdateSettings( const AllSettings& rSettings, bool bChild ) * so we can spare all our users the hassle of reacting on * this in their respective DataChanged. */ - MouseSettings aSet( mxSettings->GetMouseSettings() ); + MouseSettings aSet( mpWindowImpl->mxOutDev->mxSettings->GetMouseSettings() ); aSet.SetWheelBehavior( aOldSettings.GetMouseSettings().GetWheelBehavior() ); - mxSettings->SetMouseSettings( aSet ); + mpWindowImpl->mxOutDev->mxSettings->SetMouseSettings( aSet ); if( (nChangeFlags & AllSettingsFlags::STYLE) && IsBackground() ) { diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index 394fec0f34c2..7c4a31dde9c8 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -140,8 +140,8 @@ Splitter::Splitter( vcl::Window* pParent, WinBits nStyle ) : ImplInit( pParent, nStyle ); - SetLineColor(); - SetFillColor(); + GetOutDev()->SetLineColor(); + GetOutDev()->SetFillColor(); } Splitter::~Splitter() @@ -201,7 +201,7 @@ bool Splitter::ImplSplitterActive() tools::Long nA = rSettings.GetScrollBarSize(); tools::Long nB = StyleSettings::GetSplitSize(); - Size aSize = GetOutputSize(); + Size aSize = GetOutDev()->GetOutputSize(); if ( mbHorzSplit ) { if( aSize.Width() == nB && aSize.Height() == nA ) @@ -349,7 +349,7 @@ void Splitter::ImplKbdTracking( vcl::KeyCode aKeyCode ) else { Point aNewPos; - Size aSize = mpRefWin->GetOutputSize(); + Size aSize = mpRefWin->GetOutDev()->GetOutputSize(); Point aPos = GetPosPixel(); // depending on the position calc allows continuous moves or snaps to row/columns // continuous mode is active when position is at the origin or end of the splitter @@ -492,7 +492,7 @@ void Splitter::ImplStartKbdSplitting() // because we have no mouse position we take either the position // of the splitter window or the last split position // the other coordinate is just the center of the reference window - Size aSize = mpRefWin->GetOutputSize(); + Size aSize = mpRefWin->GetOutDev()->GetOutputSize(); Point aPos = GetPosPixel(); if( mbHorzSplit ) maDragPos = Point( ImplSplitterActive() ? aPos.X() : mnSplitPos, aSize.Height()/2 ); @@ -509,7 +509,7 @@ void Splitter::ImplRestoreSplitter() { // set splitter in the center of the ref window StartSplit(); - Size aSize = mpRefWin->GetOutputSize(); + Size aSize = mpRefWin->GetOutDev()->GetOutputSize(); Point aPos( aSize.Width()/2 , aSize.Height()/2); if ( mnLastSplitPos != mnSplitPos && mnLastSplitPos > 5 ) { diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx index 60f7303f33bc..3a04e3c8f8d1 100644 --- a/vcl/source/window/stacking.cxx +++ b/vcl/source/window/stacking.cxx @@ -707,7 +707,7 @@ void Window::ImplResetReallyVisible() { bool bBecameReallyInvisible = mpWindowImpl->mbReallyVisible; - mbDevOutput = false; + GetOutDev()->mbDevOutput = false; mpWindowImpl->mbReallyVisible = false; mpWindowImpl->mbReallyShown = false; diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 73b6ea80515a..4be4b722111d 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -112,7 +112,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) Window::ImplInit( pParent, nStyle & ~WB_BORDER, nullptr ); // remember WinBits - mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *this ); + mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *GetOutDev() ); mnCurItemId = 0; mbFormat = true; mbProgressMode = false; @@ -194,7 +194,7 @@ void StatusBar::ApplySettings(vcl::RenderContext& rRenderContext) void StatusBar::ImplInitSettings() { - ApplySettings(*this); + ApplySettings(*GetOutDev()); mpImplData->mpVirDev->SetFont(GetFont()); mpImplData->mpVirDev->SetTextColor(GetTextColor()); @@ -286,7 +286,7 @@ void StatusBar::ImplFormat() } nX = STATUSBAR_OFFSET_X; - if( HasMirroredGraphics() && IsRTLEnabled() ) + if( GetOutDev()->HasMirroredGraphics() && IsRTLEnabled() ) nX += ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset; } @@ -1139,14 +1139,14 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const OUString& rText, int nCha tools::Long nWidth; if (nCharsWidth != -1) { - std::unique_ptr<SalLayout> pSalLayout = ImplLayout("0",0,-1); + std::unique_ptr<SalLayout> pSalLayout = GetOutDev()->ImplLayout("0",0,-1); const SalLayoutGlyphs glyphs = pSalLayout ? pSalLayout->GetGlyphs() : SalLayoutGlyphs(); nWidth = GetTextWidth("0",0,-1,nullptr,pSalLayout ? &glyphs : nullptr); nWidth = nWidth * nCharsWidth + nFudge; } else { - std::unique_ptr<SalLayout> pSalLayout = ImplLayout(pItem->maText,0,-1); + std::unique_ptr<SalLayout> pSalLayout = GetOutDev()->ImplLayout(pItem->maText,0,-1); const SalLayoutGlyphs glyphs = pSalLayout ? pSalLayout->GetGlyphs() : SalLayoutGlyphs(); nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pSalLayout ? &glyphs : nullptr) + nFudge; // Store the calculated layout. diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index ecba89c0aac1..ab8be281c3a4 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -1125,7 +1125,7 @@ VclPtr<VirtualDevice> SystemWindow::createScreenshot() xOutput->SetOutputSizePixel(aSize); Point aPos; - xOutput->DrawOutDev(aPos, aSize, aPos, aSize, *this); + xOutput->DrawOutDev(aPos, aSize, aPos, aSize, *GetOutDev()); return xOutput; } diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 5b9a956edb7a..0e67a1f10d0b 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -118,6 +118,10 @@ static ImplTBDragMgr* ImplGetTBDragMgr() return pSVData->maCtrlData.mpTBDragMgr; } +int ToolBox::ImplGetDragWidth( const vcl::Window& rWindow, bool bHorz ) +{ + return ImplGetDragWidth(*rWindow.GetOutDev(), bHorz); +} int ToolBox::ImplGetDragWidth( const vcl::RenderContext& rRenderContext, bool bHorz ) { int nWidth = TB_DRAGWIDTH; @@ -478,7 +482,7 @@ void ToolBox::ImplDrawBackground(vcl::RenderContext& rRenderContext, const tools // make sure we do not invalidate/erase too much if (IsInPaint()) - aPaintRegion.Intersect(GetActiveClipRegion()); + aPaintRegion.Intersect(GetOutDev()->GetActiveClipRegion()); rRenderContext.Push(PushFlags::CLIPREGION); rRenderContext.IntersectClipRegion( aPaintRegion ); @@ -1244,12 +1248,12 @@ void ToolBox::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if (bFont) - ApplyControlFont(*this, rStyleSettings.GetToolFont()); + ApplyControlFont(*GetOutDev(), rStyleSettings.GetToolFont()); if (bForeground || bFont) - ApplyForegroundSettings(*this, rStyleSettings); + ApplyForegroundSettings(*GetOutDev(), rStyleSettings); if (bBackground) { - ApplyBackgroundSettings(*this, rStyleSettings); + ApplyBackgroundSettings(*GetOutDev(), rStyleSettings); EnableChildTransparentMode(IsPaintTransparent()); } } @@ -1477,7 +1481,7 @@ bool ToolBox::ImplCalcItem() } else { - item.maItemSize = Size( GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET, + item.maItemSize = Size( GetOutDev()->GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET, GetTextHeight() ); item.mbVisibleText = true; } @@ -1487,7 +1491,7 @@ bool ToolBox::ImplCalcItem() // we're drawing text only if ( bText || !bImage ) { - item.maItemSize = Size( GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET, + item.maItemSize = Size( GetOutDev()->GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET, GetTextHeight() ); item.mbVisibleText = true; } @@ -1499,7 +1503,7 @@ bool ToolBox::ImplCalcItem() else { // we're drawing images and text - item.maItemSize.setWidth( bText ? GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET : 0 ); + item.maItemSize.setWidth( bText ? GetOutDev()->GetCtrlTextWidth( item.maText )+TB_TEXTOFFSET : 0 ); item.maItemSize.setHeight( bText ? GetTextHeight() : 0 ); if ( meTextPosition == ToolBoxTextPosition::Right ) @@ -2691,7 +2695,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si bool bRotate = false; if ( bText ) { - const Size aTxtSize(GetCtrlTextWidth(pItem->maText), GetTextHeight()); + const Size aTxtSize(GetOutDev()->GetCtrlTextWidth(pItem->maText), GetTextHeight()); tools::Long nTextOffX = nOffX; tools::Long nTextOffY = nOffY; @@ -3003,7 +3007,7 @@ bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel ) if ( mnCurPos != ITEM_NOTFOUND ) { InvalidateItem(mnCurPos); - Flush(); + GetOutDev()->Flush(); } } } diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index a9dd9142f47a..fd338243ee22 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1049,10 +1049,10 @@ void ToolBox::SetItemText( ToolBoxItemId nItemId, const OUString& rText ) if ( !mbCalc && ((meButtonType != ButtonType::SYMBOLONLY) || !pItem->maImage) ) { - tools::Long nOldWidth = GetCtrlTextWidth( pItem->maText ); + tools::Long nOldWidth = GetOutDev()->GetCtrlTextWidth( pItem->maText ); pItem->maText = MnemonicGenerator::EraseAllMnemonicChars(rText); mpData->ImplClearLayoutData(); - if ( nOldWidth != GetCtrlTextWidth( pItem->maText ) ) + if ( nOldWidth != GetOutDev()->GetCtrlTextWidth( pItem->maText ) ) ImplInvalidate( true ); else ImplUpdateItem( nPos ); @@ -1135,7 +1135,7 @@ void ToolBox::SetItemDown( ToolBoxItemId nItemId, bool bDown ) { mnCurPos = nPos; InvalidateItem(mnCurPos); - Flush(); + GetOutDev()->Flush(); } } else @@ -1143,7 +1143,7 @@ void ToolBox::SetItemDown( ToolBoxItemId nItemId, bool bDown ) if ( nPos == mnCurPos ) { InvalidateItem(mnCurPos); - Flush(); + GetOutDev()->Flush(); mnCurPos = ITEM_NOTFOUND; } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index c0a9bf8b141b..0a279983d02d 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -90,19 +90,17 @@ using namespace ::com::sun::star::datatransfer::dnd; namespace vcl { Window::Window( WindowType nType ) - : OutputDevice(OUTDEV_WINDOW) - , mpWindowImpl(new WindowImpl( nType )) + : mpWindowImpl(new WindowImpl( *this, nType )) { // true: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active - mbEnableRTL = AllSettings::GetLayoutRTL(); + mpWindowImpl->mxOutDev->mbEnableRTL = AllSettings::GetLayoutRTL(); } Window::Window( vcl::Window* pParent, WinBits nStyle ) - : OutputDevice(OUTDEV_WINDOW) - , mpWindowImpl(new WindowImpl( WindowType::WINDOW )) + : mpWindowImpl(new WindowImpl( *this, WindowType::WINDOW )) { // true: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active - mbEnableRTL = AllSettings::GetLayoutRTL(); + mpWindowImpl->mxOutDev->mbEnableRTL = AllSettings::GetLayoutRTL(); ImplInit( pParent, nStyle, nullptr ); } @@ -154,7 +152,7 @@ void Window::dispose() // Dispose of the canvas implementation (which, currently, has an // own wrapper window as a child to this one. - ImplDisposeCanvas(); + GetOutDev()->ImplDisposeCanvas(); mpWindowImpl->mbInDispose = true; @@ -484,7 +482,7 @@ void Window::dispose() } // release SalGraphics - OutputDevice *pOutDev = GetOutDev(); + VclPtr<OutputDevice> pOutDev = GetOutDev(); pOutDev->ReleaseGraphics(); // remove window from the lists @@ -553,7 +551,9 @@ void Window::dispose() // should be the last statements mpWindowImpl.reset(); - OutputDevice::dispose(); + pOutDev.disposeAndClear(); + // just to make loplugin:vclwidgets happy + VclReferenceBase::dispose(); } Window::~Window() @@ -569,23 +569,29 @@ Window::~Window() ::OutputDevice const* Window::GetOutDev() const { - return this; + return mpWindowImpl->mxOutDev.get(); } ::OutputDevice* Window::GetOutDev() { - return this; + return mpWindowImpl->mxOutDev.get(); +} + +Color WindowOutputDevice::GetBackgroundColor() const +{ + return mxOwnerWindow->GetDisplayBackground().GetColor(); } -Color Window::GetBackgroundColor() const +bool WindowOutputDevice::CanEnableNativeWidget() const { - return GetDisplayBackground().GetColor(); + return mxOwnerWindow->IsNativeWidgetEnabled(); } } /* namespace vcl */ -WindowImpl::WindowImpl( WindowType nType ) +WindowImpl::WindowImpl( vcl::Window& rWindow, WindowType nType ) { + mxOutDev = VclPtr<vcl::WindowOutputDevice>::Create(rWindow); maZoom = Fraction( 1, 1 ); maWinRegion = vcl::Region(true); maWinClipRegion = vcl::Region(true); @@ -809,11 +815,14 @@ ImplFrameData::ImplFrameData( vcl::Window *pWindow ) namespace vcl { -bool Window::AcquireGraphics() const +bool WindowOutputDevice::AcquireGraphics() const { DBG_TESTSOLARMUTEX(); - if ( mpGraphics ) + if (isDisposed()) + return false; + + if (mpGraphics) return true; mbInitLineColor = true; @@ -824,17 +833,17 @@ bool Window::AcquireGraphics() const ImplSVData* pSVData = ImplGetSVData(); - mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics(); + mpGraphics = mxOwnerWindow->mpWindowImpl->mpFrame->AcquireGraphics(); // try harder if no wingraphics was available directly if ( !mpGraphics ) { // find another output device in the same frame - OutputDevice* pReleaseOutDev = pSVData->maGDIData.mpLastWinGraphics; + vcl::WindowOutputDevice* pReleaseOutDev = pSVData->maGDIData.mpLastWinGraphics.get(); while ( pReleaseOutDev ) { - if ( static_cast<vcl::Window*>(pReleaseOutDev)->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame ) + if ( pReleaseOutDev->mxOwnerWindow && pReleaseOutDev->mxOwnerWindow->mpWindowImpl->mpFrame == mxOwnerWindow->mpWindowImpl->mpFrame ) break; - pReleaseOutDev = pReleaseOutDev->mpPrevGraphics; + pReleaseOutDev = static_cast<vcl::WindowOutputDevice*>(pReleaseOutDev->mpPrevGraphics.get()); } if ( pReleaseOutDev ) @@ -851,7 +860,7 @@ bool Window::AcquireGraphics() const if ( !pSVData->maGDIData.mpLastWinGraphics ) break; pSVData->maGDIData.mpLastWinGraphics->ReleaseGraphics(); - mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics(); + mpGraphics = mxOwnerWindow->mpWindowImpl->mpFrame->AcquireGraphics(); } } } @@ -859,12 +868,12 @@ bool Window::AcquireGraphics() const if ( mpGraphics ) { // update global LRU list of wingraphics - mpNextGraphics = pSVData->maGDIData.mpFirstWinGraphics; - pSVData->maGDIData.mpFirstWinGraphics = const_cast<vcl::Window*>(this); + mpNextGraphics = pSVData->maGDIData.mpFirstWinGraphics.get(); + pSVData->maGDIData.mpFirstWinGraphics = const_cast<vcl::WindowOutputDevice*>(this); if ( mpNextGraphics ) - mpNextGraphics->mpPrevGraphics = const_cast<vcl::Window*>(this); + mpNextGraphics->mpPrevGraphics = const_cast<vcl::WindowOutputDevice*>(this); if ( !pSVData->maGDIData.mpLastWinGraphics ) - pSVData->maGDIData.mpLastWinGraphics = const_cast<vcl::Window*>(this); + pSVData->maGDIData.mpLastWinGraphics = const_cast<vcl::WindowOutputDevice*>(this); mpGraphics->SetXORMode( (RasterOp::Invert == meRasterOp) || (RasterOp::Xor == meRasterOp), RasterOp::Invert == meRasterOp ); mpGraphics->setAntiAlias(bool(mnAntialiasing & AntialiasingFlags::Enable)); @@ -873,7 +882,7 @@ bool Window::AcquireGraphics() const return mpGraphics != nullptr; } -void Window::ReleaseGraphics( bool bRelease ) +void WindowOutputDevice::ReleaseGraphics( bool bRelease ) { DBG_TESTSOLARMUTEX(); @@ -886,7 +895,9 @@ void Window::ReleaseGraphics( bool bRelease ) ImplSVData* pSVData = ImplGetSVData(); - vcl::Window* pWindow = this; + vcl::Window* pWindow = mxOwnerWindow.get(); + if (!pWindow) + return; if ( bRelease ) pWindow->mpWindowImpl->mpFrame->ReleaseGraphics( mpGraphics ); @@ -894,11 +905,11 @@ void Window::ReleaseGraphics( bool bRelease ) if ( mpPrevGraphics ) mpPrevGraphics->mpNextGraphics = mpNextGraphics; else - pSVData->maGDIData.mpFirstWinGraphics = static_cast<vcl::Window*>(mpNextGraphics.get()); + pSVData->maGDIData.mpFirstWinGraphics = static_cast<vcl::WindowOutputDevice*>(mpNextGraphics.get()); if ( mpNextGraphics ) mpNextGraphics->mpPrevGraphics = mpPrevGraphics; else - pSVData->maGDIData.mpLastWinGraphics = static_cast<vcl::Window*>(mpPrevGraphics.get()); + pSVData->maGDIData.mpLastWinGraphics = static_cast<vcl::WindowOutputDevice*>(mpPrevGraphics.get()); mpGraphics = nullptr; mpPrevGraphics = nullptr; @@ -969,7 +980,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p mpWindowImpl->mnStyle = nStyle; if( pParent && ! mpWindowImpl->mbFrame ) - mbEnableRTL = AllSettings::GetLayoutRTL(); + mpWindowImpl->mxOutDev->mbEnableRTL = AllSettings::GetLayoutRTL(); // test for frame creation if ( mpWindowImpl->mbFrame ) @@ -1064,8 +1075,8 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p mpWindowImpl->mpRealParent = pRealParent; // #99318: make sure fontcache and list is available before call to SetSettings - mxFontCollection = mpWindowImpl->mpFrameData->mxFontCollection; - mxFontCache = mpWindowImpl->mpFrameData->mxFontCache; + mpWindowImpl->mxOutDev->mxFontCollection = mpWindowImpl->mpFrameData->mxFontCollection; + mpWindowImpl->mxOutDev->mxFontCache = mpWindowImpl->mpFrameData->mxFontCache; if ( mpWindowImpl->mbFrame ) { @@ -1079,7 +1090,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p OutputDevice *pOutDev = GetOutDev(); if ( pOutDev->AcquireGraphics() ) { - mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY ); + mpWindowImpl->mxOutDev->mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY ); } } @@ -1096,7 +1107,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p { // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings ); - OutputDevice::SetSettings( *pSVData->maAppData.mpSettings ); + mpWindowImpl->mxOutDev->SetSettings( *pSVData->maAppData.mpSettings ); pSVData->maAppData.mbSettingsInit = true; } @@ -1104,7 +1115,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p // size directly, because we want resize all Controls to // the correct size before we display the window if ( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_APP) ) - mpWindowImpl->mpFrame->GetClientSize( mnOutWidth, mnOutHeight ); + mpWindowImpl->mpFrame->GetClientSize( mpWindowImpl->mxOutDev->mnOutWidth, mpWindowImpl->mxOutDev->mnOutHeight ); } else { @@ -1118,20 +1129,24 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p } if (!utl::ConfigManager::IsFuzzing()) - OutputDevice::SetSettings( pParent->GetSettings() ); + { + // we don't want to call the WindowOutputDevice override of this because + // it calls back into us. + mpWindowImpl->mxOutDev->OutputDevice::SetSettings( pParent->GetSettings() ); + } } } // setup the scale factor for HiDPI displays - mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); - mnDPIX = mpWindowImpl->mpFrameData->mnDPIX; - mnDPIY = mpWindowImpl->mpFrameData->mnDPIY; + mpWindowImpl->mxOutDev->mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); + mpWindowImpl->mxOutDev->mnDPIX = mpWindowImpl->mpFrameData->mnDPIX; + mpWindowImpl->mxOutDev->mnDPIY = mpWindowImpl->mpFrameData->mnDPIY; if (!utl::ConfigManager::IsFuzzing()) { - const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings(); - maFont = rStyleSettings.GetAppFont(); + const StyleSettings& rStyleSettings = mpWindowImpl->mxOutDev->mxSettings->GetStyleSettings(); + mpWindowImpl->mxOutDev->maFont = rStyleSettings.GetAppFont(); if ( nStyle & WB_3DLOOK ) { @@ -1146,10 +1161,10 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p } else { - maFont = GetDefaultFont( DefaultFontType::FIXED, LANGUAGE_ENGLISH_US, GetDefaultFontFlags::NONE ); + mpWindowImpl->mxOutDev->maFont = OutputDevice::GetDefaultFont( DefaultFontType::FIXED, LANGUAGE_ENGLISH_US, GetDefaultFontFlags::NONE ); } - ImplPointToLogic(*this, maFont); + ImplPointToLogic(*GetOutDev(), mpWindowImpl->mxOutDev->maFont); (void)ImplUpdatePos(); @@ -1214,7 +1229,7 @@ ImplWinData* Window::ImplGetWinData() const } -void Window::CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate ) +void WindowOutputDevice::CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate ) { if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0) return; @@ -1224,7 +1239,7 @@ void Window::CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate ) const tools::Rectangle aSrcRect(Point(aPosAry.mnSrcX, aPosAry.mnSrcY), Size(aPosAry.mnSrcWidth, aPosAry.mnSrcHeight)); - ImplMoveAllInvalidateRegions(aSrcRect, + mxOwnerWindow->ImplMoveAllInvalidateRegions(aSrcRect, aPosAry.mnDestX-aPosAry.mnSrcX, aPosAry.mnDestY-aPosAry.mnSrcY, false); @@ -1240,14 +1255,14 @@ void Window::CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate ) OutputDevice::CopyDeviceArea(aPosAry, bWindowInvalidate); } -const OutputDevice* Window::DrawOutDevDirectCheck(const OutputDevice& rSrcDev) const +const OutputDevice* WindowOutputDevice::DrawOutDevDirectCheck(const OutputDevice& rSrcDev) const { const OutputDevice* pSrcDevChecked; if ( this == &rSrcDev ) pSrcDevChecked = nullptr; else if (GetOutDevType() != rSrcDev.GetOutDevType()) pSrcDevChecked = &rSrcDev; - else if (this->mpWindowImpl->mpFrameWindow == static_cast<const vcl::Window&>(rSrcDev).mpWindowImpl->mpFrameWindow) + else if (mxOwnerWindow->mpWindowImpl->mpFrameWindow == static_cast<const vcl::WindowOutputDevice&>(rSrcDev).mxOwnerWindow->mpWindowImpl->mpFrameWindow) pSrcDevChecked = nullptr; else pSrcDevChecked = &rSrcDev; @@ -1255,7 +1270,7 @@ const OutputDevice* Window::DrawOutDevDirectCheck(const OutputDevice& rSrcDev) c return pSrcDevChecked; } -void Window::DrawOutDevDirectProcess( const OutputDevice& rSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) +void WindowOutputDevice::DrawOutDevDirectProcess( const OutputDevice& rSrcDev, SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) { if (pSrcGraphics) mpGraphics->CopyBits(rPosAry, *pSrcGraphics, *this, rSrcDev); @@ -1265,20 +1280,20 @@ void Window::DrawOutDevDirectProcess( const OutputDevice& rSrcDev, SalTwoRect& r SalGraphics* Window::ImplGetFrameGraphics() const { - if ( mpWindowImpl->mpFrameWindow->mpGraphics ) + if ( mpWindowImpl->mpFrameWindow->GetOutDev()->mpGraphics ) { - mpWindowImpl->mpFrameWindow->mbInitClipRegion = true; + mpWindowImpl->mpFrameWindow->GetOutDev()->mbInitClipRegion = true; } else { - OutputDevice* pFrameWinOutDev = mpWindowImpl->mpFrameWindow; + OutputDevice* pFrameWinOutDev = mpWindowImpl->mpFrameWindow->GetOutDev(); if ( ! pFrameWinOutDev->AcquireGraphics() ) { return nullptr; } } - mpWindowImpl->mpFrameWindow->mpGraphics->ResetClipRegion(); - return mpWindowImpl->mpFrameWindow->mpGraphics; + mpWindowImpl->mpFrameWindow->GetOutDev()->mpGraphics->ResetClipRegion(); + return mpWindowImpl->mpFrameWindow->GetOutDev()->mpGraphics; } void Window::ImplSetReallyVisible() @@ -1291,7 +1306,7 @@ void Window::ImplSetReallyVisible() bool bBecameReallyVisible = !mpWindowImpl->mbReallyVisible; - mbDevOutput = true; + GetOutDev()->mbDevOutput = true; mpWindowImpl->mbReallyVisible = true; mpWindowImpl->mbReallyShown = true; @@ -1326,19 +1341,19 @@ void Window::ImplInitResolutionSettings() // recalculate AppFont-resolution and DPI-resolution if (mpWindowImpl->mbFrame) { - mnDPIX = mpWindowImpl->mpFrameData->mnDPIX; - mnDPIY = mpWindowImpl->mpFrameData->mnDPIY; + GetOutDev()->mnDPIX = mpWindowImpl->mpFrameData->mnDPIX; + GetOutDev()->mnDPIY = mpWindowImpl->mpFrameData->mnDPIY; // setup the scale factor for HiDPI displays - mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); - const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings(); - SetPointFont(*this, rStyleSettings.GetAppFont()); + GetOutDev()->mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); + const StyleSettings& rStyleSettings = GetOutDev()->mxSettings->GetStyleSettings(); + SetPointFont(*GetOutDev(), rStyleSettings.GetAppFont()); } else if ( mpWindowImpl->mpParent ) { - mnDPIX = mpWindowImpl->mpParent->mnDPIX; - mnDPIY = mpWindowImpl->mpParent->mnDPIY; - mnDPIScalePercentage = mpWindowImpl->mpParent->mnDPIScalePercentage; + GetOutDev()->mnDPIX = mpWindowImpl->mpParent->GetOutDev()->mnDPIX; + GetOutDev()->mnDPIY = mpWindowImpl->mpParent->GetOutDev()->mnDPIY; + GetOutDev()->mnDPIScalePercentage = mpWindowImpl->mpParent->GetOutDev()->mnDPIScalePercentage; } // update the recalculated values for logical units @@ -1397,15 +1412,15 @@ bool Window::ImplUpdatePos() if ( ImplIsOverlapWindow() ) { - mnOutOffX = mpWindowImpl->mnX; - mnOutOffY = mpWindowImpl->mnY; + GetOutDev()->mnOutOffX = mpWindowImpl->mnX; + GetOutDev()->mnOutOffY = mpWindowImpl->mnY; } else { vcl::Window* pParent = ImplGetParent(); - mnOutOffX = mpWindowImpl->mnX + pParent->mnOutOffX; - mnOutOffY = mpWindowImpl->mnY + pParent->mnOutOffY; + GetOutDev()->mnOutOffX = mpWindowImpl->mnX + pParent->GetOutDev()->mnOutOffX; + GetOutDev()->mnOutOffY = mpWindowImpl->mnY + pParent->GetOutDev()->mnOutOffY; } VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild; @@ -1425,7 +1440,7 @@ bool Window::ImplUpdatePos() void Window::ImplUpdateSysObjPos() { if ( mpWindowImpl->mpSysObj ) - mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); + mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->mnOutOffX, GetOutDev()->mnOutOffY, GetOutDev()->mnOutWidth, GetOutDev()->mnOutHeight ); VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild; while ( pChild ) @@ -1441,10 +1456,10 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, bool bNewPos = false; bool bNewSize = false; bool bCopyBits = false; - tools::Long nOldOutOffX = mnOutOffX; - tools::Long nOldOutOffY = mnOutOffY; - tools::Long nOldOutWidth = mnOutWidth; - tools::Long nOldOutHeight = mnOutHeight; + tools::Long nOldOutOffX = GetOutDev()->mnOutOffX; + tools::Long nOldOutOffY = GetOutDev()->mnOutOffY; + tools::Long nOldOutWidth = GetOutDev()->mnOutWidth; + tools::Long nOldOutHeight = GetOutDev()->mnOutHeight; std::unique_ptr<vcl::Region> pOverlapRegion; std::unique_ptr<vcl::Region> pOldRegion; @@ -1454,9 +1469,9 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, Size( nOldOutWidth, nOldOutHeight ) ); pOldRegion.reset( new vcl::Region( aOldWinRect ) ); if ( mpWindowImpl->mbWinRegion ) - pOldRegion->Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + pOldRegion->Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); - if ( mnOutWidth && mnOutHeight && !mpWindowImpl->mbPaintTransparent && + if ( GetOutDev()->mnOutWidth && GetOutDev()->mnOutHeight && !mpWindowImpl->mbPaintTransparent && !mpWindowImpl->mbInitWinClipRegion && !mpWindowImpl->maWinClipRegion.IsEmpty() && !HasPaintEvent() ) bCopyBits = true; @@ -1474,9 +1489,9 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, if ( nWidth < 0 ) nWidth = 0; - if ( nWidth != mnOutWidth ) + if ( nWidth != GetOutDev()->mnOutWidth ) { - mnOutWidth = nWidth; + GetOutDev()->mnOutWidth = nWidth; bNewSize = true; bCopyBits = false; } @@ -1485,9 +1500,9 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, { if ( nHeight < 0 ) nHeight = 0; - if ( nHeight != mnOutHeight ) + if ( nHeight != GetOutDev()->mnOutHeight ) { - mnOutHeight = nHeight; + GetOutDev()->mnOutHeight = nHeight; bNewSize = true; bCopyBits = false; } @@ -1496,35 +1511,35 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, if ( nFlags & PosSizeFlags::X ) { tools::Long nOrgX = nX; - Point aPtDev( Point( nX+mnOutOffX, 0 ) ); + Point aPtDev( Point( nX+GetOutDev()->mnOutOffX, 0 ) ); OutputDevice *pOutDev = GetOutDev(); if( pOutDev->HasMirroredGraphics() ) { - aPtDev.setX( mpGraphics->mirror2( aPtDev.X(), *this ) ); + aPtDev.setX( GetOutDev()->mpGraphics->mirror2( aPtDev.X(), *GetOutDev() ) ); // #106948# always mirror our pos if our parent is not mirroring, even // if we are also not mirroring // RTL: check if parent is in different coordinates - if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() ) { - nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; + nX = mpWindowImpl->mpParent->GetOutDev()->mnOutWidth - GetOutDev()->mnOutWidth - nX; } /* #i99166# An LTR window in RTL UI that gets sized only would be expected to not moved its upper left point */ if( bnXRecycled ) { - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { aPtDev.setX( mpWindowImpl->mnAbsScreenX ); nOrgX = mpWindowImpl->maPos.X(); } } } - else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() ) { // mirrored window in LTR UI - nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; + nX = mpWindowImpl->mpParent->GetOutDev()->mnOutWidth - GetOutDev()->mnOutWidth - nX; } // check maPos as well, as it could have been changed for client windows (ImplCallMove()) @@ -1574,8 +1589,8 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, { mpWindowImpl->mpClientWindow->ImplPosSizeWindow( mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder, mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder, - mnOutWidth-mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder, - mnOutHeight-mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder, + GetOutDev()->mnOutWidth - mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder, + GetOutDev()->mnOutHeight - mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder, PosSizeFlags::X | PosSizeFlags::Y | PosSizeFlags::Width | PosSizeFlags::Height ); // If we have a client window, then this is the position @@ -1625,7 +1640,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, } // invalidate window content ? - if ( bNewPos || (mnOutWidth > nOldOutWidth) || (mnOutHeight > nOldOutHeight) ) + if ( bNewPos || (GetOutDev()->mnOutWidth > nOldOutWidth) || (GetOutDev()->mnOutHeight > nOldOutHeight) ) { if ( bNewPos ) { @@ -1637,11 +1652,11 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, { vcl::Region aRegion( GetOutputRectPixel() ); if ( mpWindowImpl->mbWinRegion ) - aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); ImplClipBoundaries( aRegion, false, true ); if ( !pOverlapRegion->IsEmpty() ) { - pOverlapRegion->Move( mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY ); + pOverlapRegion->Move( GetOutDev()->mnOutOffX - nOldOutOffX, GetOutDev()->mnOutOffY - nOldOutOffY ); aRegion.Exclude( *pOverlapRegion ); } if ( !aRegion.IsEmpty() ) @@ -1649,7 +1664,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, // adapt Paint areas ImplMoveAllInvalidateRegions( tools::Rectangle( Point( nOldOutOffX, nOldOutOffY ), Size( nOldOutWidth, nOldOutHeight ) ), - mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY, + GetOutDev()->mnOutOffX - nOldOutOffX, GetOutDev()->mnOutOffY - nOldOutOffY, true ); SalGraphics* pGraphics = ImplGetFrameGraphics(); if ( pGraphics ) @@ -1659,10 +1674,10 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, const bool bSelectClipRegion = pOutDev->SelectClipRegion( aRegion, pGraphics ); if ( bSelectClipRegion ) { - pGraphics->CopyArea( mnOutOffX, mnOutOffY, + pGraphics->CopyArea( GetOutDev()->mnOutOffX, GetOutDev()->mnOutOffY, nOldOutOffX, nOldOutOffY, nOldOutWidth, nOldOutHeight, - *this ); + *GetOutDev() ); } else bInvalidate = true; @@ -1688,7 +1703,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, vcl::Region aRegion( GetOutputRectPixel() ); aRegion.Exclude( *pOldRegion ); if ( mpWindowImpl->mbWinRegion ) - aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); + aRegion.Intersect( GetOutDev()->ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); ImplClipBoundaries( aRegion, false, true ); if ( !aRegion.IsEmpty() ) ImplInvalidateFrameRegion( &aRegion, InvalidateFlags::Children ); @@ -1697,7 +1712,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, // invalidate Parent or Overlaps if ( bNewPos || - (mnOutWidth < nOldOutWidth) || (mnOutHeight < nOldOutHeight) ) + (GetOutDev()->mnOutWidth < nOldOutWidth) || (GetOutDev()->mnOutHeight < nOldOutHeight) ) { vcl::Region aRegion( *pOldRegion ); if ( !mpWindowImpl->mbPaintTransparent ) @@ -1714,7 +1729,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, if ( bUpdateSysObjPos ) ImplUpdateSysObjPos(); if ( bNewSize && mpWindowImpl->mpSysObj ) - mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); + mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->mnOutOffX, GetOutDev()->mnOutOffY, GetOutDev()->mnOutWidth, GetOutDev()->mnOutHeight ); } void Window::ImplNewInputContext() @@ -1747,10 +1762,11 @@ void Window::ImplNewInputContext() if ( rFont.GetFontSize().Height() ) aSize.setHeight( 1 ); else - aSize.setHeight( (12*pFocusWin->mnDPIY)/72 ); + aSize.setHeight( (12*pFocusWin->GetOutDev()->mnDPIY)/72 ); } - pFontInstance = pFocusWin->mxFontCache->GetFontInstance( pFocusWin->mxFontCollection.get(), - rFont, aSize, static_cast<float>(aSize.Height()) ); + pFontInstance = pFocusWin->GetOutDev()->mxFontCache->GetFontInstance( + pFocusWin->GetOutDev()->mxFontCollection.get(), + rFont, aSize, static_cast<float>(aSize.Height()) ); if ( pFontInstance ) aNewContext.mpFont = pFontInstance; } @@ -2046,7 +2062,7 @@ tools::Long Window::CalcTitleWidth() const // border of external dialogs const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); vcl::Font aFont = GetFont(); - const_cast<vcl::Window*>(this)->SetPointFont(*const_cast<Window*>(this), rStyleSettings.GetTitleFont()); + const_cast<vcl::Window*>(this)->SetPointFont(const_cast<::OutputDevice&>(*GetOutDev()), rStyleSettings.GetTitleFont()); tools::Long nTitleWidth = GetTextWidth( GetText() ); const_cast<vcl::Window*>(this)->SetFont( aFont ); nTitleWidth += rStyleSettings.GetTitleHeight() * 3; @@ -2401,8 +2417,8 @@ Size Window::GetSizePixel() const return Size(0,0); } - return Size( mnOutWidth+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder, - mnOutHeight+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ); + return Size( GetOutDev()->mnOutWidth + mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder, + GetOutDev()->mnOutHeight + mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ); } void Window::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, @@ -2667,12 +2683,12 @@ void Window::setPosSizePixel( tools::Long nX, tools::Long nY, // Note: if we're positioning a frame, the coordinates are interpreted // as being the top-left corner of the window's client area and NOT // as the position of the border ! (due to limitations of several UNIX window managers) - tools::Long nOldWidth = pWindow->mnOutWidth; + tools::Long nOldWidth = pWindow->GetOutDev()->mnOutWidth; if ( !(nFlags & PosSizeFlags::Width) ) - nWidth = pWindow->mnOutWidth; + nWidth = pWindow->GetOutDev()->mnOutWidth; if ( !(nFlags & PosSizeFlags::Height) ) - nHeight = pWindow->mnOutHeight; + nHeight = pWindow->GetOutDev()->mnOutHeight; sal_uInt16 nSysFlags=0; VclPtr<vcl::Window> pParent = GetParent(); @@ -2687,9 +2703,9 @@ void Window::setPosSizePixel( tools::Long nX, tools::Long nY, nSysFlags |= SAL_FRAME_POSSIZE_X; if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) { - nX += pWinParent->mnOutOffX; + nX += pWinParent->GetOutDev()->mnOutOffX; } - if( pParent && pParent->ImplIsAntiparallel() ) + if( pParent && pParent->GetOutDev()->ImplIsAntiparallel() ) { tools::Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) ); const OutputDevice *pParentOutDev = pParent->GetOutDev(); @@ -2726,7 +2742,7 @@ void Window::setPosSizePixel( tools::Long nX, tools::Long nY, nSysFlags |= SAL_FRAME_POSSIZE_Y; if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) { - nY += pWinParent->mnOutOffY; + nY += pWinParent->GetOutDev()->mnOutOffY; } } @@ -2787,31 +2803,31 @@ tools::Rectangle Window::GetDesktopRectPixel() const Point Window::OutputToScreenPixel( const Point& rPos ) const { // relative to top level parent - return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY ); + return Point( rPos.X() + GetOutDev()->mnOutOffX, rPos.Y() + GetOutDev()->mnOutOffY ); } Point Window::ScreenToOutputPixel( const Point& rPos ) const { // relative to top level parent - return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY ); + return Point( rPos.X() - GetOutDev()->mnOutOffX, rPos.Y() - GetOutDev()->mnOutOffY ); } tools::Long Window::ImplGetUnmirroredOutOffX() { // revert mnOutOffX changes that were potentially made in ImplPosSizeWindow - tools::Long offx = mnOutOffX; + tools::Long offx = GetOutDev()->mnOutOffX; OutputDevice *pOutDev = GetOutDev(); if( pOutDev->HasMirroredGraphics() ) { - if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() ) { if ( !ImplIsOverlapWindow() ) - offx -= mpWindowImpl->mpParent->mnOutOffX; + offx -= mpWindowImpl->mpParent->GetOutDev()->mnOutOffX; - offx = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - offx; + offx = mpWindowImpl->mpParent->GetOutDev()->mnOutWidth - GetOutDev()->mnOutWidth - offx; if ( !ImplIsOverlapWindow() ) - offx += mpWindowImpl->mpParent->mnOutOffX; + offx += mpWindowImpl->mpParent->GetOutDev()->mnOutOffX; } } @@ -2823,14 +2839,14 @@ Point Window::OutputToNormalizedScreenPixel( const Point& rPos ) const { // relative to top level parent tools::Long offx = const_cast<vcl::Window*>(this)->ImplGetUnmirroredOutOffX(); - return Point( rPos.X()+offx, rPos.Y()+mnOutOffY ); + return Point( rPos.X()+offx, rPos.Y() + GetOutDev()->mnOutOffY ); } Point Window::NormalizedScreenToOutputPixel( const Point& rPos ) const { // relative to top level parent tools::Long offx = const_cast<vcl::Window*>(this)->ImplGetUnmirroredOutOffX(); - return Point( rPos.X()-offx, rPos.Y()-mnOutOffY ); + return Point( rPos.X()-offx, rPos.Y() - GetOutDev()->mnOutOffY ); } Point Window::OutputToAbsoluteScreenPixel( const Point& rPos ) const @@ -2942,10 +2958,10 @@ void Window::Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, ImplScroll( aRect, nHorzScroll, nVertScroll, nFlags ); } -void Window::Flush() +void WindowOutputDevice::Flush() { - if (mpWindowImpl) - mpWindowImpl->mpFrame->Flush( GetOutputRectPixel() ); + if (mxOwnerWindow->mpWindowImpl) + mxOwnerWindow->mpWindowImpl->mpFrame->Flush( GetOutputRectPixel() ); } void Window::SetUpdateMode( bool bUpdate ) @@ -3422,11 +3438,11 @@ Reference< XClipboard > Window::GetClipboard() void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const tools::Rectangle& rRect ) { - assert(mpOutDevData); - mpOutDevData->mpRecordLayout = pLayout; - mpOutDevData->maRecordRect = rRect; - Paint(*this, rRect); - mpOutDevData->mpRecordLayout = nullptr; + assert(GetOutDev()->mpOutDevData); + GetOutDev()->mpOutDevData->mpRecordLayout = pLayout; + GetOutDev()->mpOutDevData->maRecordRect = rRect; + Paint(*GetOutDev(), rRect); + GetOutDev()->mpOutDevData->mpRecordLayout = nullptr; } void Window::DrawSelectionBackground( const tools::Rectangle& rRect, @@ -3462,13 +3478,13 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, } tools::Rectangle aRect( rRect ); - Color oldFillCol = GetFillColor(); - Color oldLineCol = GetLineColor(); + Color oldFillCol = GetOutDev()->GetFillColor(); + Color oldLineCol = GetOutDev()->GetLineColor(); if( bDrawBorder ) - SetLineColor( bDark ? COL_WHITE : ( bBright ? COL_BLACK : aSelectionBorderCol ) ); + GetOutDev()->SetLineColor( bDark ? COL_WHITE : ( bBright ? COL_BLACK : aSelectionBorderCol ) ); else - SetLineColor(); + GetOutDev()->SetLineColor(); sal_uInt16 nPercent = 0; if( !highlight ) @@ -3487,7 +3503,7 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, else if ( bBright ) { aSelectionFillCol = COL_BLACK; - SetLineColor( COL_BLACK ); + GetOutDev()->SetLineColor( COL_BLACK ); nPercent = 0; } else @@ -3500,7 +3516,7 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, else if ( bBright ) { aSelectionFillCol = COL_BLACK; - SetLineColor( COL_BLACK ); + GetOutDev()->SetLineColor( COL_BLACK ); nPercent = 0; } else @@ -3513,7 +3529,7 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, else if ( bBright ) { aSelectionFillCol = COL_BLACK; - SetLineColor( COL_BLACK ); + GetOutDev()->SetLineColor( COL_BLACK ); if( highlight == 3 ) nPercent = 80; else @@ -3524,21 +3540,21 @@ void Window::DrawSelectionBackground( const tools::Rectangle& rRect, } } - SetFillColor( aSelectionFillCol ); + GetOutDev()->SetFillColor( aSelectionFillCol ); if( bDark ) { - DrawRect( aRect ); + GetOutDev()->DrawRect( aRect ); } else { tools::Polygon aPoly( aRect ); tools::PolyPolygon aPolyPoly( aPoly ); - DrawTransparent( aPolyPoly, nPercent ); + GetOutDev()->DrawTransparent( aPolyPoly, nPercent ); } - SetFillColor( oldFillCol ); - SetLineColor( oldLineCol ); + GetOutDev()->SetFillColor( oldFillCol ); + GetOutDev()->SetLineColor( oldLineCol ); } bool Window::IsScrollable() const @@ -3657,7 +3673,7 @@ void Window::EnableNativeWidget( bool bEnable ) // send datachanged event to allow for internal changes required for NWF // like clipmode, transparency, etc. - DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, mxSettings.get(), AllSettingsFlags::STYLE ); + DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, GetOutDev()->mxSettings.get(), AllSettingsFlags::STYLE ); CompatDataChanged( aDCEvt ); // sometimes the borderwindow is queried, so keep it in sync @@ -3679,7 +3695,7 @@ bool Window::IsNativeWidgetEnabled() const return ImplGetWinData()->mbEnableNativeWidget; } -Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas ) const +Reference< css::rendering::XCanvas > WindowOutputDevice::ImplGetCanvas( bool bSpriteCanvas ) const { Sequence< Any > aArg(5); @@ -3688,9 +3704,9 @@ Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas ) // common: first any is VCL pointer to window (for VCL canvas) aArg[ 0 ] <<= reinterpret_cast<sal_Int64>(this); aArg[ 1 ] <<= css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); - aArg[ 2 ] <<= mpWindowImpl->mbAlwaysOnTop; + aArg[ 2 ] <<= mxOwnerWindow->mpWindowImpl->mbAlwaysOnTop; aArg[ 3 ] <<= Reference< css::awt::XWindow >( - const_cast<vcl::Window*>(this)->GetComponentInterface(), + mxOwnerWindow->GetComponentInterface(), UNO_QUERY ); aArg[ 4 ] = GetSystemGfxDataAny(); @@ -3711,7 +3727,7 @@ Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas ) // implementation (not DX5 canvas, as it cannot cope with // surfaces spanning multiple displays). Note: canvas // (without sprite) stays the same) - const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mpWindowImpl->mpFrame )->mnDisplay; + const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mxOwnerWindow->mpWindowImpl->mpFrame )->mnDisplay; if( nDisplay >= Application::GetScreenCount() ) { xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext( @@ -3809,7 +3825,7 @@ bool Window::DeleteSurroundingText(const Selection& rSelection) return false; } -bool Window::UsePolyPolygonForComplexGradient() +bool WindowOutputDevice::UsePolyPolygonForComplexGradient() { return meRasterOp != RasterOp::OverPaint; } @@ -3909,13 +3925,35 @@ FactoryFunction Window::GetUITestFactory() const return WindowUIObject::create; } -css::awt::DeviceInfo Window::GetDeviceInfo() const +WindowOutputDevice::WindowOutputDevice(vcl::Window& rOwnerWindow) : + ::OutputDevice(OUTDEV_WINDOW), + mxOwnerWindow(&rOwnerWindow) { - css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(GetSizePixel()); - GetBorder(aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset); + assert(mxOwnerWindow); +} + +WindowOutputDevice::~WindowOutputDevice() +{ + disposeOnce(); +} + +void WindowOutputDevice::dispose() +{ + assert((!mxOwnerWindow || mxOwnerWindow->isDisposed()) && "This belongs to the associated window and must be disposed after it"); + ::OutputDevice::dispose(); + // need to do this after OutputDevice::dispose so that the call to WindowOutputDevice::ReleaseGraphics + // can release the graphics properly + mxOwnerWindow.clear(); +} + +css::awt::DeviceInfo WindowOutputDevice::GetDeviceInfo() const +{ + css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(mxOwnerWindow->GetSizePixel()); + mxOwnerWindow->GetBorder(aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset); return aInfo; } + } /* namespace vcl */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index f52478299a9b..19eb432a73ec 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -168,24 +168,23 @@ void Window::InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlag if ( nFlags & ShowTrackFlags::TrackWindow ) { - if ( !IsDeviceOutputNecessary() ) + if ( !GetOutDev()->IsDeviceOutputNecessary() ) return; // we need a graphics - if ( !mpGraphics ) + if ( !GetOutDev()->mpGraphics ) { if ( !pOutDev->AcquireGraphics() ) return; } - assert(mpGraphics); - if ( mbInitClipRegion ) - InitClipRegion(); + if ( GetOutDev()->mbInitClipRegion ) + GetOutDev()->InitClipRegion(); - if ( mbOutputClipped ) + if ( GetOutDev()->mbOutputClipped ) return; - pGraphics = mpGraphics; + pGraphics = GetOutDev()->mpGraphics; } else { @@ -201,18 +200,18 @@ void Window::InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlag ShowTrackFlags nStyle = nFlags & ShowTrackFlags::StyleMask; if ( nStyle == ShowTrackFlags::Object ) - pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::TrackFrame, *this ); + pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::TrackFrame, *GetOutDev() ); else if ( nStyle == ShowTrackFlags::Split ) - pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::N50, *this ); + pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::N50, *GetOutDev() ); else { tools::Long nBorder = 1; if ( nStyle == ShowTrackFlags::Big ) nBorder = 5; - pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SalInvert::N50, *this ); - pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SalInvert::N50, *this ); - pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *this ); - pGraphics->Invert( aRect.Right()-nBorder+1, aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *this ); + pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SalInvert::N50, *GetOutDev() ); + pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SalInvert::N50, *GetOutDev() ); + pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *GetOutDev() ); + pGraphics->Invert( aRect.Right()-nBorder+1, aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *GetOutDev() ); } } @@ -226,7 +225,7 @@ IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer, void ) // create Tracking-Event Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { // re-mirror frame pos at pChild const OutputDevice *pOutDev = GetOutDev(); @@ -288,7 +287,7 @@ void Window::EndTracking( TrackingEventFlags nFlags ) // call EndTracking if required { Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplIsAntiparallel() ) + if( GetOutDev()->ImplIsAntiparallel() ) { // re-mirror frame pos at pChild const OutputDevice *pOutDev = GetOutDev(); @@ -551,7 +550,7 @@ Size Window::CalcOutputSize( const Size& rWinSz ) const vcl::Font Window::GetDrawPixelFont(OutputDevice const * pDev) const { - vcl::Font aFont = GetPointFont(*const_cast<Window*>(this)); + vcl::Font aFont = GetPointFont(*GetOutDev()); Size aFontSize = aFont.GetFontSize(); MapMode aPtMapMode(MapUnit::MapPoint); aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode ); @@ -935,12 +934,12 @@ void Window::ImplSetMouseTransparent( bool bTransparent ) Point Window::ImplOutputToFrame( const Point& rPos ) { - return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY ); + return Point( rPos.X()+GetOutDev()->mnOutOffX, rPos.Y()+GetOutDev()->mnOutOffY ); } Point Window::ImplFrameToOutput( const Point& rPos ) { - return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY ); + return Point( rPos.X()-GetOutDev()->mnOutOffX, rPos.Y()-GetOutDev()->mnOutOffY ); } void Window::SetCompoundControl( bool bCompound ) diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index c06e8d0eb54b..6640cbbed3ce 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -32,27 +32,253 @@ void Window::ImplAdjustNWFSizes() pWin->ImplAdjustNWFSizes(); } -void Window::ImplClearFontData(bool bNewFontLists) +void WindowOutputDevice::ImplClearFontData(bool bNewFontLists) { OutputDevice::ImplClearFontData(bNewFontLists); - for (Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext) - pChild->ImplClearFontData(bNewFontLists); + for (Window* pChild = mxOwnerWindow->mpWindowImpl->mpFirstChild; pChild; + pChild = pChild->mpWindowImpl->mpNext) + pChild->GetOutDev()->ImplClearFontData(bNewFontLists); } -void Window::ImplRefreshFontData(bool bNewFontLists) +void WindowOutputDevice::ImplRefreshFontData(bool bNewFontLists) { OutputDevice::ImplRefreshFontData(bNewFontLists); - for (Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext) - pChild->ImplRefreshFontData(bNewFontLists); + for (Window* pChild = mxOwnerWindow->mpWindowImpl->mpFirstChild; pChild; + pChild = pChild->mpWindowImpl->mpNext) + pChild->GetOutDev()->ImplRefreshFontData(bNewFontLists); } -void Window::ImplInitMapModeObjects() +void WindowOutputDevice::ImplInitMapModeObjects() { OutputDevice::ImplInitMapModeObjects(); - if (mpWindowImpl->mpCursor) - mpWindowImpl->mpCursor->ImplNew(); + if (mxOwnerWindow->mpWindowImpl->mpCursor) + mxOwnerWindow->mpWindowImpl->mpCursor->ImplNew(); } +const Font& Window::GetFont() const { return GetOutDev()->GetFont(); } +void Window::SetFont(Font const& font) { return GetOutDev()->SetFont(font); } + +float Window::approximate_char_width() const { return GetOutDev()->approximate_char_width(); } + +const Wallpaper& Window::GetBackground() const { return GetOutDev()->GetBackground(); } +bool Window::IsBackground() const { return GetOutDev()->IsBackground(); } +tools::Long Window::GetTextHeight() const { return GetOutDev()->GetTextHeight(); } +tools::Long Window::GetTextWidth(const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen, + vcl::TextLayoutCache const* pCache, + SalLayoutGlyphs const* const pLayoutCache) const +{ + return GetOutDev()->GetTextWidth(rStr, nIndex, nLen, pCache, pLayoutCache); +} +float Window::approximate_digit_width() const { return GetOutDev()->approximate_digit_width(); } + +bool Window::IsNativeControlSupported(ControlType nType, ControlPart nPart) const +{ + return GetOutDev()->IsNativeControlSupported(nType, nPart); +} + +bool Window::GetNativeControlRegion(ControlType nType, ControlPart nPart, + const tools::Rectangle& rControlRegion, ControlState nState, + const ImplControlValue& aValue, + tools::Rectangle& rNativeBoundingRegion, + tools::Rectangle& rNativeContentRegion) const +{ + return GetOutDev()->GetNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, + rNativeBoundingRegion, rNativeContentRegion); +} + +Size Window::GetOutputSizePixel() const { return GetOutDev()->GetOutputSizePixel(); } + +tools::Rectangle Window::GetOutputRectPixel() const { return GetOutDev()->GetOutputRectPixel(); } + +void Window::SetTextLineColor() { GetOutDev()->SetTextLineColor(); } +void Window::SetTextLineColor(const Color& rColor) { GetOutDev()->SetTextLineColor(rColor); } +void Window::SetOverlineColor() { GetOutDev()->SetOverlineColor(); } +void Window::SetOverlineColor(const Color& rColor) { GetOutDev()->SetOverlineColor(rColor); } +void Window::SetTextFillColor() { GetOutDev()->SetTextFillColor(); } +void Window::SetTextFillColor(const Color& rColor) { GetOutDev()->SetTextFillColor(rColor); } +const MapMode& Window::GetMapMode() const { return GetOutDev()->GetMapMode(); } +void Window::SetBackground() { GetOutDev()->SetBackground(); } +void Window::SetBackground(const Wallpaper& rBackground) +{ + GetOutDev()->SetBackground(rBackground); +} +void Window::EnableMapMode(bool bEnable) { GetOutDev()->EnableMapMode(bEnable); } +bool Window::IsMapModeEnabled() const { return GetOutDev()->IsMapModeEnabled(); } + +void Window::SetTextColor(const Color& rColor) { GetOutDev()->SetTextColor(rColor); } +const Color& Window::GetTextColor() const { return GetOutDev()->GetTextColor(); } +const Color& Window::GetTextLineColor() const { return GetOutDev()->GetTextLineColor(); } + +bool Window::IsTextLineColor() const { return GetOutDev()->IsTextLineColor(); } + +Color Window::GetTextFillColor() const { return GetOutDev()->GetTextFillColor(); } + +bool Window::IsTextFillColor() const { return GetOutDev()->IsTextFillColor(); } + +const Color& Window::GetOverlineColor() const { return GetOutDev()->GetOverlineColor(); } +bool Window::IsOverlineColor() const { return GetOutDev()->IsOverlineColor(); } +void Window::SetTextAlign(TextAlign eAlign) { GetOutDev()->SetTextAlign(eAlign); } + +float Window::GetDPIScaleFactor() const { return GetOutDev()->GetDPIScaleFactor(); } +sal_Int32 Window::GetDPIScalePercentage() const { return GetOutDev()->GetDPIScalePercentage(); } +tools::Long Window::GetOutOffXPixel() const { return GetOutDev()->GetOutOffXPixel(); } +tools::Long Window::GetOutOffYPixel() const { return GetOutDev()->GetOutOffYPixel(); } +void Window::SetOutOffXPixel(tools::Long nOutOffX) +{ + return GetOutDev()->SetOutOffXPixel(nOutOffX); +} +void Window::SetOutOffYPixel(tools::Long nOutOffY) +{ + return GetOutDev()->SetOutOffXPixel(nOutOffY); +} +void Window::SetMapMode() { GetOutDev()->SetMapMode(); } +void Window::SetMapMode(const MapMode& rNewMapMode) { GetOutDev()->SetMapMode(rNewMapMode); } +bool Window::IsRTLEnabled() const { return GetOutDev()->IsRTLEnabled(); } +TextAlign Window::GetTextAlign() const { return GetOutDev()->GetTextAlign(); } +const AllSettings& Window::GetSettings() const { return GetOutDev()->GetSettings(); } + +Point Window::LogicToPixel(const Point& rLogicPt) const +{ + return GetOutDev()->LogicToPixel(rLogicPt); +} +Size Window::LogicToPixel(const Size& rLogicSize) const +{ + return GetOutDev()->LogicToPixel(rLogicSize); +} +tools::Rectangle Window::LogicToPixel(const tools::Rectangle& rLogicRect) const +{ + return GetOutDev()->LogicToPixel(rLogicRect); +} +tools::Polygon Window::LogicToPixel(const tools::Polygon& rLogicPoly) const +{ + return GetOutDev()->LogicToPixel(rLogicPoly); +} +tools::PolyPolygon Window::LogicToPixel(const tools::PolyPolygon& rLogicPoly) const +{ + return GetOutDev()->LogicToPixel(rLogicPoly); +} +basegfx::B2DPolyPolygon Window::LogicToPixel(const basegfx::B2DPolyPolygon& rLogicPolyPoly) const +{ + return GetOutDev()->LogicToPixel(rLogicPolyPoly); +} +vcl::Region Window::LogicToPixel(const vcl::Region& rLogicRegion) const +{ + return GetOutDev()->LogicToPixel(rLogicRegion); +} +Point Window::LogicToPixel(const Point& rLogicPt, const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicPt, rMapMode); +} +Size Window::LogicToPixel(const Size& rLogicSize, const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicSize, rMapMode); +} +tools::Rectangle Window::LogicToPixel(const tools::Rectangle& rLogicRect, + const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicRect, rMapMode); +} +tools::Polygon Window::LogicToPixel(const tools::Polygon& rLogicPoly, const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicPoly, rMapMode); +} +basegfx::B2DPolyPolygon Window::LogicToPixel(const basegfx::B2DPolyPolygon& rLogicPolyPoly, + const MapMode& rMapMode) const +{ + return GetOutDev()->LogicToPixel(rLogicPolyPoly, rMapMode); +} + +Point Window::PixelToLogic(const Point& rDevicePt) const +{ + return GetOutDev()->PixelToLogic(rDevicePt); +} +Size Window::PixelToLogic(const Size& rDeviceSize) const +{ + return GetOutDev()->PixelToLogic(rDeviceSize); +} +tools::Rectangle Window::PixelToLogic(const tools::Rectangle& rDeviceRect) const +{ + return GetOutDev()->PixelToLogic(rDeviceRect); +} +tools::Polygon Window::PixelToLogic(const tools::Polygon& rDevicePoly) const +{ + return GetOutDev()->PixelToLogic(rDevicePoly); +} +tools::PolyPolygon Window::PixelToLogic(const tools::PolyPolygon& rDevicePolyPoly) const +{ + return GetOutDev()->PixelToLogic(rDevicePolyPoly); +} +basegfx::B2DPolyPolygon Window::PixelToLogic(const basegfx::B2DPolyPolygon& rDevicePolyPoly) const +{ + return GetOutDev()->PixelToLogic(rDevicePolyPoly); +} +vcl::Region Window::PixelToLogic(const vcl::Region& rDeviceRegion) const +{ + return GetOutDev()->PixelToLogic(rDeviceRegion); +} +Point Window::PixelToLogic(const Point& rDevicePt, const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDevicePt, rMapMode); +} +Size Window::PixelToLogic(const Size& rDeviceSize, const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDeviceSize, rMapMode); +} +tools::Rectangle Window::PixelToLogic(const tools::Rectangle& rDeviceRect, + const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDeviceRect, rMapMode); +} +tools::Polygon Window::PixelToLogic(const tools::Polygon& rDevicePoly, + const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDevicePoly, rMapMode); +} +basegfx::B2DPolygon Window::PixelToLogic(const basegfx::B2DPolygon& rDevicePoly, + const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDevicePoly, rMapMode); +} +basegfx::B2DPolyPolygon Window::PixelToLogic(const basegfx::B2DPolyPolygon& rDevicePolyPoly, + const MapMode& rMapMode) const +{ + return GetOutDev()->PixelToLogic(rDevicePolyPoly, rMapMode); +} + +Point Window::LogicToLogic(const Point& rPtSource, const MapMode* pMapModeSource, + const MapMode* pMapModeDest) const +{ + return GetOutDev()->LogicToLogic(rPtSource, pMapModeSource, pMapModeDest); +} +Size Window::LogicToLogic(const Size& rSzSource, const MapMode* pMapModeSource, + const MapMode* pMapModeDest) const +{ + return GetOutDev()->LogicToLogic(rSzSource, pMapModeSource, pMapModeDest); +} +tools::Rectangle Window::LogicToLogic(const tools::Rectangle& rRectSource, + const MapMode* pMapModeSource, + const MapMode* pMapModeDest) const +{ + return GetOutDev()->LogicToLogic(rRectSource, pMapModeSource, pMapModeDest); +} + +tools::Rectangle Window::GetTextRect(const tools::Rectangle& rRect, const OUString& rStr, + DrawTextFlags nStyle, TextRectInfo* pInfo, + const vcl::ITextLayout* _pTextLayout) const +{ + return GetOutDev()->GetTextRect(rRect, rStr, nStyle, pInfo, _pTextLayout); +} + +void Window::SetSettings(const AllSettings& rSettings) { GetOutDev()->SetSettings(rSettings); } +void Window::SetSettings(const AllSettings& rSettings, bool bChild) +{ + static_cast<vcl::WindowOutputDevice*>(GetOutDev())->SetSettings(rSettings, bChild); +} + +Color Window::GetBackgroundColor() const { return GetOutDev()->GetBackgroundColor(); } + +void Window::EnableRTL(bool bEnable) { GetOutDev()->EnableRTL(bEnable); } + } /* namespace vcl */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 03c73072c5a5..3ab39d314f05 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -363,7 +363,7 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent // execute a few tests and catch the message or implement the status if ( pChild ) { - if( pChild->ImplIsAntiparallel() ) + if( pChild->GetOutDev()->ImplIsAntiparallel() ) { // re-mirror frame pos at pChild const OutputDevice *pChildWinOutDev = pChild->GetOutDev(); @@ -1033,7 +1033,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, // TipHelp via Keyboard (Shift-F2 or Ctrl-F1) // simulate mouseposition at center of window - Size aSize = pChild->GetOutputSize(); + Size aSize = pChild->GetOutDev()->GetOutputSize(); Point aPos( aSize.getWidth()/2, aSize.getHeight()/2 ); aPos = pChild->OutputToScreenPixel( aPos ); @@ -1258,7 +1258,7 @@ static void ImplHandleExtTextInputPos( vcl::Window* pWindow, else rRect = tools::Rectangle( Point( pChild->GetOutOffXPixel(), pChild->GetOutOffYPixel() ), Size() ); } - rInputWidth = pChild->ImplLogicWidthToDevicePixel( pChild->GetCursorExtTextInputWidth() ); + rInputWidth = pChild->GetOutDev()->ImplLogicWidthToDevicePixel( pChild->GetCursorExtTextInputWidth() ); if ( !rInputWidth ) rInputWidth = rRect.GetWidth(); } @@ -1633,7 +1633,7 @@ static void KillOwnPopups( vcl::Window const * pWindow ) void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long nNewHeight ) { - const bool bChanged = (nNewWidth != pWindow->GetOutputWidthPixel()) || (nNewHeight != pWindow->GetOutputHeightPixel()); + const bool bChanged = (nNewWidth != pWindow->GetOutDev()->GetOutputWidthPixel()) || (nNewHeight != pWindow->GetOutDev()->GetOutputHeightPixel()); if (bChanged && pWindow->GetStyle() & (WB_MOVEABLE|WB_SIZEABLE)) { KillOwnPopups( pWindow ); @@ -1648,8 +1648,8 @@ void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, tools::Long { if (bChanged) { - pWindow->mnOutWidth = nNewWidth; - pWindow->mnOutHeight = nNewHeight; + pWindow->GetOutDev()->mnOutWidth = nNewWidth; + pWindow->GetOutDev()->mnOutHeight = nNewHeight; pWindow->ImplGetWindowImpl()->mbWaitSystemResize = false; if ( pWindow->IsReallyVisible() ) pWindow->ImplSetClipFlag(); diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index beaa1d48dbd8..d7066f7a9b90 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -145,7 +145,7 @@ void WorkWindow::ShowFullScreenMode( bool bFullScreenMode, sal_Int32 nDisplayScr // Dispose of the canvas implementation, which might rely on // screen-specific system data. - ImplDisposeCanvas(); + GetOutDev()->ImplDisposeCanvas(); mpWindowImpl->mpFrameWindow->mpWindowImpl->mbWaitSystemResize = true; ImplGetFrame()->ShowFullScreen( bFullScreenMode, nDisplayScreen ); |