diff options
Diffstat (limited to 'svx')
24 files changed, 98 insertions, 94 deletions
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx index 5875601d45b9..c23cb16faeca 100644 --- a/svx/source/accessibility/AccessibleControlShape.cxx +++ b/svx/source/accessibility/AccessibleControlShape.cxx @@ -195,7 +195,7 @@ void AccessibleControlShape::Init() if ( pView && pViewWindow && pUnoObjectImpl ) { // get the context of the control - it will be our "inner" context - m_xUnoControl = pUnoObjectImpl->GetUnoControl( *pView, *pViewWindow ); + m_xUnoControl = pUnoObjectImpl->GetUnoControl( *pView, *pViewWindow->GetOutDev() ); if ( !m_xUnoControl.is() ) { @@ -207,7 +207,7 @@ void AccessibleControlShape::Init() // Okay, we will add as listener to the control container where we expect our control to appear. OSL_ENSURE( !m_bWaitingForControl, "AccessibleControlShape::Init: already waiting for the control!" ); - Reference< XContainer > xControlContainer = lcl_getControlContainer( pViewWindow, maShapeTreeInfo.GetSdrView() ); + Reference< XContainer > xControlContainer = lcl_getControlContainer( pViewWindow->GetOutDev(), maShapeTreeInfo.GetSdrView() ); OSL_ENSURE( xControlContainer.is(), "AccessibleControlShape::Init: unable to find my ControlContainer!" ); if ( xControlContainer.is() ) { @@ -632,7 +632,7 @@ void SAL_CALL AccessibleControlShape::disposing() if ( m_bWaitingForControl ) { OSL_FAIL( "AccessibleControlShape::disposing: this should never happen!" ); - Reference< XContainer > xContainer = lcl_getControlContainer( maShapeTreeInfo.GetWindow(), maShapeTreeInfo.GetSdrView() ); + Reference< XContainer > xContainer = lcl_getControlContainer( maShapeTreeInfo.GetWindow()->GetOutDev(), maShapeTreeInfo.GetSdrView() ); if ( xContainer.is() ) { m_bWaitingForControl = false; diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 8264e40f98bb..28cb6b7b768f 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -160,12 +160,12 @@ void AccessibleShape::Init() if( !hasOutlinerParaObject ) { // empty text -> use proxy edit source to delay creation of EditEngine - mpText.reset( new AccessibleTextHelper( std::make_unique<AccessibleEmptyEditSource >(*pSdrObject, *pView, *pWindow) ) ); + mpText.reset( new AccessibleTextHelper( std::make_unique<AccessibleEmptyEditSource >(*pSdrObject, *pView, *pWindow->GetOutDev()) ) ); } else { // non-empty text -> use full-fledged edit source right away - mpText.reset( new AccessibleTextHelper( std::make_unique<SvxTextEditSource >(*pSdrObject, nullptr, *pView, *pWindow) ) ); + mpText.reset( new AccessibleTextHelper( std::make_unique<SvxTextEditSource >(*pSdrObject, nullptr, *pView, *pWindow->GetOutDev()) ) ); } if( pWindow->HasFocus() ) mpText->SetFocus(); diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 660aebfd18e4..98484033820e 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -92,7 +92,7 @@ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext( } maTreeInfo.SetSdrView( mpView ); - maTreeInfo.SetWindow(&dynamic_cast<vcl::Window&>(mpControl->GetDrawingArea()->get_ref_device())); + maTreeInfo.SetWindow(mpControl->GetDrawingArea()->get_ref_device().GetOwnerWindow()); maTreeInfo.SetViewForwarder( this ); } diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 4b5f42e1eb10..e6b57aac5fb7 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -1511,7 +1511,7 @@ void SvxRuler::DrawLine_Impl(tools::Long& lTabPosition, int nNew, bool bHorizont */ if(bHorizontal) { - const tools::Long nHeight = pEditWin->GetOutputSize().Height(); + const tools::Long nHeight = pEditWin->GetOutDev()->GetOutputSize().Height(); Point aZero = pEditWin->GetMapMode().GetOrigin(); if(lTabPosition != -1) { @@ -1535,7 +1535,7 @@ void SvxRuler::DrawLine_Impl(tools::Long& lTabPosition, int nNew, bool bHorizont } else { - const tools::Long nWidth = pEditWin->GetOutputSize().Width(); + const tools::Long nWidth = pEditWin->GetOutDev()->GetOutputSize().Width(); Point aZero = pEditWin->GetMapMode().GetOrigin(); if(lTabPosition != -1) { diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 1946da09341c..212a06a30aca 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -445,7 +445,7 @@ void DbGridColumn::Paint(OutputDevice& rDev, const Reference< XNumberFormatter >& xFormatter) { bool bEnabled = ( rDev.GetOutDevType() != OUTDEV_WINDOW ) - || ( static_cast< vcl::Window& >( rDev ).IsEnabled() ); + || ( rDev.GetOwnerWindow()->IsEnabled() ); FmXDataCell* pDataCell = dynamic_cast<FmXDataCell*>( m_pCell.get() ); if (pDataCell) @@ -725,7 +725,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & rParent, const InitWindo else pWindow->SetControlFont(); - pWindow->SetZoomedPointFont(*pWindow, aFont); // FIXME RenderContext + pWindow->SetZoomedPointFont(*pWindow->GetOutDev(), aFont); // FIXME RenderContext } } @@ -769,7 +769,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & rParent, const InitWindo pWindow->SetBackground(aColor); pWindow->SetControlBackground(aColor); } - pWindow->SetFillColor(aColor); + pWindow->GetOutDev()->SetFillColor(aColor); } } } @@ -781,7 +781,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & rParent, const InitWindo m_pPainter->SetBackground(); else m_pPainter->SetBackground(rParent.GetBackground()); - m_pPainter->SetFillColor(rParent.GetFillColor()); + m_pPainter->GetOutDev()->SetFillColor(rParent.GetOutDev()->GetFillColor()); } if (m_pWindow) @@ -789,7 +789,7 @@ void DbCellControl::ImplInitWindow( vcl::Window const & rParent, const InitWindo if (isTransparent()) m_pWindow->SetBackground(rParent.GetBackground()); else - m_pWindow->SetFillColor(rParent.GetFillColor()); + m_pWindow->GetOutDev()->SetFillColor(rParent.GetOutDev()->GetFillColor()); } } } @@ -3489,7 +3489,7 @@ void FmXTextCell::PaintFieldToCell(OutputDevice& rDev, } DrawTextFlags nStyle = DrawTextFlags::Clip | DrawTextFlags::VCenter; - if ( ( rDev.GetOutDevType() == OUTDEV_WINDOW ) && !static_cast< vcl::Window& >( rDev ).IsEnabled() ) + if ( ( rDev.GetOutDevType() == OUTDEV_WINDOW ) && !rDev.GetOwnerWindow()->IsEnabled() ) nStyle |= DrawTextFlags::Disable; switch (m_pColumn->GetAlignment()) diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 1d1108a1a88d..b31c065d6826 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -877,12 +877,12 @@ void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat ) { GetDataWindow().SetBackground(GetControlBackground()); GetDataWindow().SetControlBackground(GetControlBackground()); - GetDataWindow().SetFillColor(GetControlBackground()); + GetDataWindow().GetOutDev()->SetFillColor(GetControlBackground()); } else { GetDataWindow().SetControlBackground(); - GetDataWindow().SetFillColor(GetFillColor()); + GetDataWindow().GetOutDev()->SetFillColor(GetOutDev()->GetFillColor()); } } @@ -1382,7 +1382,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, DbGridCo void DbGridControl::RemoveColumns() { - if ( IsEditing() ) + if ( !isDisposed() && IsEditing() ) DeactivateCell(); m_aColumns.clear(); diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 572b4d59d155..9bbe292ffe90 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -512,7 +512,7 @@ void FmFormShell::Execute(SfxRequest &rReq) if (m_pFormView) { const OutputDevice* pDevice = m_pFormView->GetActualOutDev(); - vcl::Window* pWindow = dynamic_cast< vcl::Window* >( const_cast< OutputDevice* >( pDevice ) ); + vcl::Window* pWindow = pDevice->GetOwnerWindow(); if ( pWindow ) pWindow->GrabFocus(); } @@ -1276,7 +1276,7 @@ void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrVi if ( bHasControlFocus ) { - vcl::Window* pWindow( dynamic_cast< vcl::Window* >( &i_rDevice ) ); + vcl::Window* pWindow = i_rDevice.GetOwnerWindow(); OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" ); if ( pWindow ) pWindow->GrabFocus(); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index f0162740f8c6..a83625b68479 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2827,7 +2827,7 @@ Reference< XControl> FmXFormShell::impl_getControl_Lock(const Reference<XControl const SdrView* pSdrView = m_pShell ? m_pShell->GetFormView() : nullptr; ENSURE_OR_THROW( pSdrView, "no current view" ); - xControl.set( i_rKnownFormObj.GetUnoControl( *pSdrView, *pContainerWindow ), UNO_SET_THROW ); + xControl.set( i_rKnownFormObj.GetUnoControl( *pSdrView, *pContainerWindow->GetOutDev() ), UNO_SET_THROW ); } } catch( const Exception& ) diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index a77ab010c070..46461728482a 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -252,7 +252,7 @@ void FmFormView::ChangeDesignMode(bool bDesign) { if ( GetActualOutDev() && GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW ) { - const vcl::Window* pWindow = static_cast< const vcl::Window* >( GetActualOutDev() ); + const vcl::Window* pWindow = GetActualOutDev()->GetOwnerWindow(); const_cast< vcl::Window* >( pWindow )->GrabFocus(); } @@ -470,7 +470,7 @@ bool FmFormView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) FmFormObj* pObj = getMarkedGrid(); if ( pObj ) { - Reference< awt::XWindow > xWindow( pObj->GetUnoControl( *this, *pWin ), UNO_QUERY ); + Reference< awt::XWindow > xWindow( pObj->GetUnoControl( *this, *pWin->GetOutDev() ), UNO_QUERY ); if ( xWindow.is() ) { pImpl->m_pMarkedGrid = pObj; @@ -509,7 +509,7 @@ bool FmFormView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) if (!pFormObject) continue; - Reference<awt::XControl> xControl = pFormObject->GetUnoControl(*this, *pWin); + Reference<awt::XControl> xControl = pFormObject->GetUnoControl(*this, *pWin->GetOutDev()); if (!xControl.is()) continue; const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 0a2440cbab1c..790b41ce25b5 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -152,7 +152,7 @@ FormViewPageWindowAdapter::FormViewPageWindowAdapter( const css::uno::Reference< : m_xControlContainer( _rWindow.GetControlContainer() ), m_xContext( _rContext ), m_pViewImpl( _pViewImpl ), - m_pWindow( dynamic_cast< vcl::Window* >( &_rWindow.GetPaintWindow().GetOutputDevice() ) ) + m_pWindow( _rWindow.GetPaintWindow().GetOutputDevice().GetOwnerWindow() ) { // create an XFormController for every form @@ -694,7 +694,7 @@ IMPL_LINK_NOARG(FmXFormView, OnActivate, void*, void) find_active_databaseform fad(pShImpl->getActiveController_Lock()); - vcl::Window* pWindow = const_cast<vcl::Window*>(static_cast<const vcl::Window*>(m_pView->GetActualOutDev())); + vcl::Window* pWindow = m_pView->GetActualOutDev()->GetOwnerWindow(); rtl::Reference< FormViewPageWindowAdapter > pAdapter = m_aPageWindowAdapters.empty() ? nullptr : m_aPageWindowAdapters[0]; for (const auto& rpPageWindowAdapter : m_aPageWindowAdapters) { @@ -861,7 +861,7 @@ namespace if ( xNormalizedForm.get() != xModelParent.get() ) continue; - pFormObject->GetUnoControl( _rView, _rWindow ); + pFormObject->GetUnoControl( _rView, *_rWindow.GetOutDev() ); } } catch (const Exception&) @@ -884,7 +884,7 @@ Reference< XFormController > FmXFormView::getFormController( const Reference< XF continue; } - if ( pAdapter->getWindow() != &_rDevice ) + if ( pAdapter->getWindow() != _rDevice.GetOwnerWindow() ) // wrong device continue; @@ -949,7 +949,8 @@ IMPL_LINK_NOARG(FmXFormView, OnAutoFocus, void*, void) // ensure that the control is visible // 80210 - 12/07/00 - FS - const vcl::Window* pCurrentWindow = m_pView ? dynamic_cast<const vcl::Window*>(m_pView->GetActualOutDev()) : nullptr; + const OutputDevice* pOut = m_pView ? m_pView->GetActualOutDev() : nullptr; + const vcl::Window* pCurrentWindow = pOut ? pOut->GetOwnerWindow() : nullptr; if ( pCurrentWindow ) { awt::Rectangle aRect = xControlWindow->getPosSize(); @@ -1012,7 +1013,8 @@ void FmXFormView::breakCreateFormObject() Reference<XWindow> FmXFormView::GetParentWindow() const { - const vcl::Window* pCurrentWindow = m_pView ? dynamic_cast<const vcl::Window*>(m_pView->GetActualOutDev()) : nullptr; + const OutputDevice* pOut = m_pView ? m_pView->GetActualOutDev() : nullptr; + const vcl::Window* pCurrentWindow = pOut ? pOut->GetOwnerWindow() : nullptr; return VCLUnoHelper::GetInterface(const_cast<vcl::Window*>(pCurrentWindow)); } diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 42947238be2d..29b43c597a39 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1964,7 +1964,7 @@ namespace svxform OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); if ( ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) && !aMarkRect.IsEmpty() ) { - pFormView->MakeVisible( aMarkRect, static_cast<vcl::Window&>(rOutDev) ); + pFormView->MakeVisible( aMarkRect, *rOutDev.GetOwnerWindow() ); } } // for ( sal_uInt32 i = 0; i < pFormView->PaintWindowCount(); ++i ) } @@ -2032,7 +2032,7 @@ namespace svxform OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); if ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) { - pFormView->MakeVisible( aMarkRect, static_cast<vcl::Window&>(rOutDev) ); + pFormView->MakeVisible( aMarkRect, *rOutDev.GetOwnerWindow() ); } } // for ( sal_uInt32 i = 0; i < pFormView->PaintWindowCount(); ++i ) } diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx index 16faa132a7a4..27768ff0777f 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx @@ -62,7 +62,7 @@ vcl::Window* ViewObjectContactOfSdrMediaObj::getWindow() const { if(OUTDEV_WINDOW == oPageOutputDev->GetOutDevType()) { - pRetval = static_cast< vcl::Window* >(&const_cast<OutputDevice&>(*oPageOutputDev)); + pRetval = oPageOutputDev->GetOwnerWindow(); } } diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index dd8ba8d97b96..681ce37ac7da 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -432,7 +432,7 @@ namespace sdr::contact { { if ( !m_rControlContainer.is() ) { - const vcl::Window* pWindow = dynamic_cast< const vcl::Window* >( &_rDevice ); + const vcl::Window* pWindow = _rDevice.GetOwnerWindow(); OSL_ENSURE( pWindow, "InvisibleControlViewAccess::getControlContainer: expected to be called for a window only!" ); if ( pWindow ) m_rControlContainer = VCLUnoHelper::CreateControlContainer( const_cast< vcl::Window* >( pWindow ) ); @@ -1053,7 +1053,7 @@ namespace sdr::contact { m_xContainer.set(_rPageView.getControlContainer( _rDevice ), css::uno::UNO_QUERY); DBG_ASSERT( ( m_xContainer.is() // either have a XControlContainer || ( ( !_rPageView.getControlContainer( _rDevice ).is() ) // or don't have any container, - && ( dynamic_cast< const vcl::Window* >( &_rDevice ) == nullptr ) // which is allowed for non-Window instances only + && ( _rDevice.GetOwnerWindow() == nullptr ) // which is allowed for non-Window instances only ) ), "ViewObjectContactOfUnoControl_Impl::impl_ensureControl_nothrow: no XContainer at the ControlContainer!" ); @@ -1600,8 +1600,8 @@ namespace sdr::contact { ControlHolder aControl; InvisibleControlViewAccess aSimulatePageView( _inout_ControlContainer ); - OSL_VERIFY( ViewObjectContactOfUnoControl_Impl::createControlForDevice( aSimulatePageView, _rWindow, _rUnoObject, - _rWindow.GetViewTransformation(), _rWindow.GetInverseViewTransformation(), aControl ) ); + OSL_VERIFY( ViewObjectContactOfUnoControl_Impl::createControlForDevice( aSimulatePageView, *_rWindow.GetOutDev(), _rUnoObject, + _rWindow.GetOutDev()->GetViewTransformation(), _rWindow.GetOutDev()->GetInverseViewTransformation(), aControl ) ); return aControl.getControl(); } diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index b3cdf0151792..edf2852c8eef 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -310,7 +310,7 @@ namespace sdr::overlay { tools::Rectangle aInvalidateRectangle(RangeToInvalidateRectangle(rRange)); // simply invalidate - static_cast<vcl::Window&>(getOutputDevice()).Invalidate(aInvalidateRectangle, InvalidateFlags::NoErase); + getOutputDevice().GetOwnerWindow()->Invalidate(aInvalidateRectangle, InvalidateFlags::NoErase); } } diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 3052246cbadb..71c8d6f73f47 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -146,13 +146,13 @@ namespace sdr::overlay // but always the exact redraw area if(OUTDEV_WINDOW == rSource.GetOutDevType()) { - vcl::Window& rWindow = static_cast<vcl::Window&>(rSource); + vcl::Window& rWindow = *rSource.GetOwnerWindow(); vcl::Region aPaintRegionPixel = rWindow.LogicToPixel(rWindow.GetPaintRegion()); aRegion.Intersect(aPaintRegionPixel); // #i72754# Make sure content is completely rendered, the window // will be used as source of a DrawOutDev soon - rWindow.Flush(); + rWindow.GetOutDev()->Flush(); } // also limit to buffer size @@ -210,7 +210,7 @@ namespace sdr::overlay // #i80730# switch off VCL cursor during overlay refresh if(bTargetIsWindow) { - vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); + vcl::Window& rWindow = *mrOutputDevice.GetOwnerWindow(); vcl::Cursor* pCursor = rWindow.GetCursor(); if(pCursor && pCursor->IsVisible()) @@ -318,7 +318,7 @@ namespace sdr::overlay // To get the update, the windows in question are updated manually here. if(bTargetIsWindow) { - vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); + vcl::Window& rWindow = *mrOutputDevice.GetOwnerWindow(); const tools::Rectangle aRegionRectanglePixel( maBufferRememberedRangePixel.getMinX(), @@ -331,7 +331,7 @@ namespace sdr::overlay // #i80730# restore visibility of VCL cursor if(bCursorWasEnabled) { - vcl::Window& rWindow = static_cast< vcl::Window& >(mrOutputDevice); + vcl::Window& rWindow = *mrOutputDevice.GetOwnerWindow(); vcl::Cursor* pCursor = rWindow.GetCursor(); if(pCursor) diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index 59c672b9ba7a..788d47ab79e5 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -71,8 +71,8 @@ uno::Reference<awt::XControlContainer> const & SdrPageWindow::GetControlContaine const SdrPaintWindow& rPaintWindow( GetOriginalPaintWindow() ? *GetOriginalPaintWindow() : GetPaintWindow() ); if ( rPaintWindow.OutputToWindow() && !rView.IsPrintPreview() ) { - vcl::Window& rWindow = dynamic_cast< vcl::Window& >( rPaintWindow.GetOutputDevice() ); - const_cast< SdrPageWindow* >( this )->mpImpl->mxControlContainer = VCLUnoHelper::CreateControlContainer( &rWindow ); + vcl::Window* pWindow = rPaintWindow.GetOutputDevice().GetOwnerWindow(); + const_cast< SdrPageWindow* >( this )->mpImpl->mxControlContainer = VCLUnoHelper::CreateControlContainer( pWindow ); // #100394# xC->setVisible triggers window->Show() and this has // problems when the view is not completely constructed which may diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index c0a46d49d0b6..c3dcee32b4f7 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -195,9 +195,9 @@ rtl::Reference<sdr::overlay::OverlayManager> SdrPaintView::CreateOverlayManager( // is it a window? if (OUTDEV_WINDOW == rOutputDevice.GetOutDevType()) { - vcl::Window& rWindow = dynamic_cast<vcl::Window&>(rOutputDevice); + vcl::Window* pWindow = rOutputDevice.GetOwnerWindow(); // decide which OverlayManager to use - if (IsBufferedOverlayAllowed() && !rWindow.SupportsDoubleBuffering()) + if (IsBufferedOverlayAllowed() && !pWindow->SupportsDoubleBuffering()) { // buffered OverlayManager, buffers its background and refreshes from there // for pure overlay changes (no system redraw). The 3rd parameter specifies @@ -222,7 +222,7 @@ rtl::Reference<sdr::overlay::OverlayManager> SdrPaintView::CreateOverlayManager( // updates. if (!comphelper::LibreOfficeKit::isActive()) { - rWindow.Invalidate(); + pWindow->Invalidate(); } InitOverlayManager(xOverlayManager); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index bb56488428db..a8da538afbb4 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -146,8 +146,8 @@ SdrPageView* SdrObjEditView::ShowSdrPage(SdrPage* pPage) // Call GetSfxViewShell() to make sure ImpMakeOutlinerView() // registers the view shell of this draw view, and not the view // shell of pView. - OutlinerView* pOutlinerView = pView->ImpMakeOutlinerView( - static_cast<vcl::Window*>(pOutDev), nullptr, GetSfxViewShell()); + OutlinerView* pOutlinerView + = pView->ImpMakeOutlinerView(pOutDev->GetOwnerWindow(), nullptr, GetSfxViewShell()); pOutlinerView->HideCursor(); pView->GetTextEditOutliner()->InsertView(pOutlinerView); } @@ -181,7 +181,7 @@ void lcl_RemoveTextEditOutlinerViews(SdrObjEditView const* pThis, SdrPageView co for (size_t nView = 0; nView < pOutliner->GetViewCount(); ++nView) { OutlinerView* pOutlinerView = pOutliner->GetView(nView); - if (pOutlinerView->GetWindow() != pOutputDevice) + if (pOutlinerView->GetWindow()->GetOutDev() != pOutputDevice) continue; pOutliner->RemoveView(pOutlinerView); @@ -364,7 +364,7 @@ void SdrObjEditView::ModelHasChanged() aTmpRect.AdjustRight(aMore.Width()); aTmpRect.AdjustTop(-(aMore.Height())); aTmpRect.AdjustBottom(aMore.Height()); - InvalidateOneWin(*pWin, aTmpRect); + InvalidateOneWin(*pWin->GetOutDev(), aTmpRect); } if (bAnchorChg) pOLV->SetAnchorMode(eNewAnchor); @@ -658,7 +658,7 @@ void SdrObjEditView::EditViewSelectionChange() } } -OutputDevice& SdrObjEditView::EditViewOutputDevice() const { return *pTextEditWin; } +OutputDevice& SdrObjEditView::EditViewOutputDevice() const { return *pTextEditWin->GetOutDev(); } Point SdrObjEditView::EditViewPointerPosPixel() const { return pTextEditWin->GetPointerPosPixel(); } @@ -724,9 +724,9 @@ void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) // compare against that; that's how double-buffering can // still find the matching OutlinerView. OutputDevice* pOutputDevice = rPaintWindow.GetWindow() - ? rPaintWindow.GetWindow() + ? rPaintWindow.GetWindow()->GetOutDev() : &rPaintWindow.GetOutputDevice(); - if (pOLV->GetWindow() == pOutputDevice + if (pOLV->GetWindow()->GetOutDev() == pOutputDevice || comphelper::LibreOfficeKit::isActive()) { ImpPaintOutlinerView(*pOLV, aCheckRect, @@ -1102,7 +1102,7 @@ bool SdrObjEditView::SdrBeginTextEdit(SdrObject* pObj_, SdrPageView* pPV, vcl::W if (OUTDEV_WINDOW == pPaintWindow->GetOutputDevice().GetOutDevType()) { - pWin = static_cast<vcl::Window*>(&pPaintWindow->GetOutputDevice()); + pWin = pPaintWindow->GetOutputDevice().GetOwnerWindow(); } } @@ -1290,10 +1290,10 @@ bool SdrObjEditView::SdrBeginTextEdit(SdrObject* pObj_, SdrPageView* pPV, vcl::W SdrPaintWindow* pPaintWindow = GetPaintWindow(i); OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); - if (&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType()) + if (&rOutDev != pWin->GetOutDev() && OUTDEV_WINDOW == rOutDev.GetOutDevType()) { OutlinerView* pOutlView - = ImpMakeOutlinerView(static_cast<vcl::Window*>(&rOutDev), nullptr); + = ImpMakeOutlinerView(rOutDev.GetOwnerWindow(), nullptr); pTextEditOutliner->InsertView(pOutlView, static_cast<sal_uInt16>(i)); } } @@ -1315,12 +1315,13 @@ bool SdrObjEditView::SdrBeginTextEdit(SdrObject* pObj_, SdrPageView* pPV, vcl::W SdrPaintWindow* pPaintWindow = pView->GetPaintWindow(nViewPaintWindow); OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); - if (&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType()) + if (&rOutDev != pWin->GetOutDev() + && OUTDEV_WINDOW == rOutDev.GetOutDevType()) { - OutlinerView* pOutlView = ImpMakeOutlinerView( - static_cast<vcl::Window*>(&rOutDev), nullptr); + OutlinerView* pOutlView + = ImpMakeOutlinerView(rOutDev.GetOwnerWindow(), nullptr); pOutlView->HideCursor(); - static_cast<vcl::Window*>(&rOutDev)->SetCursor(nullptr); + rOutDev.GetOwnerWindow()->SetCursor(nullptr); pTextEditOutliner->InsertView(pOutlView); } } @@ -1630,9 +1631,9 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) aRect.AdjustRight(nMorePix); aRect.AdjustBottom(nMorePix); aRect = pWin->PixelToLogic(aRect); - InvalidateOneWin(*pWin, aRect); - pWin->SetFillColor(); - pWin->SetLineColor(COL_BLACK); + InvalidateOneWin(*pWin->GetOutDev(), aRect); + pWin->GetOutDev()->SetFillColor(); + pWin->GetOutDev()->SetLineColor(COL_BLACK); } // and now the Outliner itself if (!bTextEditDontDelete) @@ -1862,9 +1863,9 @@ bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin rMEvt.GetModifier()); if (pTextEditOutlinerView->MouseButtonDown(aMEvt)) { - if (pWin != nullptr && pWin != pTextEditWin + if (pWin != nullptr && pWin != pTextEditWin->GetOutDev() && pWin->GetOutDevType() == OUTDEV_WINDOW) - SetTextEditWin(static_cast<vcl::Window*>(pWin)); + SetTextEditWin(pWin->GetOwnerWindow()); ImpMakeTextCursorAreaVisible(); return true; } @@ -2325,7 +2326,7 @@ void SdrObjEditView::AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pW if (mxTextEditObj.is() && !bTextEditOnlyOneView && pNewWin->GetOutDevType() == OUTDEV_WINDOW) { - OutlinerView* pOutlView = ImpMakeOutlinerView(static_cast<vcl::Window*>(pNewWin), nullptr); + OutlinerView* pOutlView = ImpMakeOutlinerView(pNewWin->GetOwnerWindow(), nullptr); pTextEditOutliner->InsertView(pOutlView); } } @@ -2340,7 +2341,7 @@ void SdrObjEditView::DeleteWindowFromPaintView(OutputDevice* pOldWin) { i--; OutlinerView* pOLV = pTextEditOutliner->GetView(i); - if (pOLV && pOLV->GetWindow() == static_cast<vcl::Window*>(pOldWin)) + if (pOLV && pOLV->GetWindow() == pOldWin->GetOwnerWindow()) { pTextEditOutliner->RemoveView(i); } @@ -2383,7 +2384,7 @@ void SdrObjEditView::ImpMacroUp(const Point& rUpPos) aHitRec.nTol = nMacroTol; aHitRec.pVisiLayer = &pMacroPV->GetVisibleLayers(); aHitRec.pPageView = pMacroPV; - pMacroObj->PaintMacro(*pMacroWin, tools::Rectangle(), aHitRec); + pMacroObj->PaintMacro(*pMacroWin->GetOutDev(), tools::Rectangle(), aHitRec); bMacroDown = false; } } @@ -2397,7 +2398,7 @@ void SdrObjEditView::ImpMacroDown(const Point& rDownPos) aHitRec.nTol = nMacroTol; aHitRec.pVisiLayer = &pMacroPV->GetVisibleLayers(); aHitRec.pPageView = pMacroPV; - pMacroObj->PaintMacro(*pMacroWin, tools::Rectangle(), aHitRec); + pMacroObj->PaintMacro(*pMacroWin->GetOutDev(), tools::Rectangle(), aHitRec); bMacroDown = true; } } diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index a7f5ba78c4a3..eef111ce4103 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -242,7 +242,8 @@ void SdrMarkView::ModelHasChanged() sal_uInt32 nTotalPaintWindows = this->PaintWindowCount(); if (nTotalPaintWindows == 1) { - const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice()); + const OutputDevice* pOut = this->GetFirstOutputDevice(); + const vcl::Window* pWin = pOut ? pOut->GetOwnerWindow() : nullptr; if (pWin && pWin->IsChart()) { const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj(); @@ -758,7 +759,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S sal_uInt32 nTotalPaintWindows = this->PaintWindowCount(); if (nTotalPaintWindows == 1) { - const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice()); + const OutputDevice* pOut = this->GetFirstOutputDevice(); + const vcl::Window* pWin = pOut ? pOut->GetOwnerWindow() : nullptr; if (pWin && pWin->IsChart()) { bIsChart = true; @@ -930,7 +932,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S const basegfx::B2DPolygon aPolygon = aPolyPolygon.getB2DPolygon(0); if (sal_uInt32 nPolySize = aPolygon.count()) { - const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice()); + const OutputDevice* pOut = this->GetFirstOutputDevice(); + const vcl::Window* pWin = pOut ? pOut->GetOwnerWindow() : nullptr; const vcl::Window* pViewShellWindow = pViewShell->GetEditWindowForActiveOLEObj(); if (pWin && pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin)) { diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 9074036a3edc..d67108df38de 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -502,7 +502,7 @@ void SdrPaintView::CompleteRedraw(OutputDevice* pOut, const vcl::Region& rReg, s if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType()) { - vcl::Window* pWindow = static_cast<vcl::Window*>(pOut); + vcl::Window* pWindow = pOut->GetOwnerWindow(); if(pWindow->IsInPaint()) { @@ -737,7 +737,7 @@ vcl::Region SdrPaintView::OptimizeDrawLayersRegion(OutputDevice* pOut, const vcl // would be set. if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType() && !bDisableIntersect) { - vcl::Window* pWindow = static_cast<vcl::Window*>(pOut); + vcl::Window* pWindow = pOut->GetOwnerWindow(); if(pWindow->IsInPaint()) { @@ -803,7 +803,7 @@ void SdrPaintView::GlueInvalidate() const const SdrObject* pObj=pOL->GetObj(nObjNum); const SdrGluePointList* pGPL=pObj->GetGluePointList(); if (pGPL!=nullptr && pGPL->GetCount()!=0) { - pGPL->Invalidate(static_cast<vcl::Window&>(rOutDev), pObj); + pGPL->Invalidate(*rOutDev.GetOwnerWindow(), pObj); } } } @@ -854,16 +854,14 @@ void SdrPaintView::InvalidateAllWin(const tools::Rectangle& rRect) void SdrPaintView::InvalidateOneWin(OutputDevice& rDevice) { - vcl::Window& rWin(static_cast<vcl::Window&>(rDevice)); // do not erase background, that causes flicker (!) - rWin.Invalidate(InvalidateFlags::NoErase); + rDevice.GetOwnerWindow()->Invalidate(InvalidateFlags::NoErase); } void SdrPaintView::InvalidateOneWin(OutputDevice& rDevice, const tools::Rectangle& rRect) { - vcl::Window& rWin(static_cast<vcl::Window&>(rDevice)); // do not erase background, that causes flicker (!) - rWin.Invalidate(rRect, InvalidateFlags::NoErase); + rDevice.GetOwnerWindow()->Invalidate(rRect, InvalidateFlags::NoErase); } void SdrPaintView::LeaveOneGroup() @@ -1012,7 +1010,7 @@ void SdrPaintView::MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin) } MapMode aMap(rWin.GetMapMode()); - Size aActualSize(rWin.GetOutputSize()); + Size aActualSize(rWin.GetOutDev()->GetOutputSize()); if( aActualSize.IsEmpty() ) return; @@ -1033,7 +1031,7 @@ void SdrPaintView::MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin) aMap.SetScaleX(aXFact); aMap.SetScaleY(aYFact); rWin.SetMapMode(aMap); - aActualSize=rWin.GetOutputSize(); + aActualSize=rWin.GetOutDev()->GetOutputSize(); } Point aOrg(aMap.GetOrigin()); tools::Long dx=0,dy=0; @@ -1054,7 +1052,7 @@ void SdrPaintView::MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin) } } else { rWin.SetMapMode(aMap); - InvalidateOneWin(rWin); + InvalidateOneWin(*rWin.GetOutDev()); } } diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index dbb4c405bb10..a2e6861556ad 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -163,7 +163,7 @@ SdrView::~SdrView() bool SdrView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) { - SetActualWin(pWin); + SetActualWin(pWin->GetOutDev()); bool bRet = SdrCreateView::KeyInput(rKEvt,pWin); if (!bRet && !IsExtendedKeyInputDispatcherEnabled()) { bRet = true; @@ -190,7 +190,7 @@ bool SdrView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) if (bRet && pWin!=nullptr) { pWin->SetPointer(GetPreferredPointer( pWin->PixelToLogic(pWin->ScreenToOutputPixel( pWin->GetPointerPosPixel() ) ), - pWin, + pWin->GetOutDev(), rKEvt.GetKeyCode().GetModifier())); } } @@ -240,7 +240,7 @@ bool SdrView::MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) bool SdrView::Command(const CommandEvent& rCEvt, vcl::Window* pWin) { - SetActualWin(pWin); + SetActualWin(pWin->GetOutDev()); bool bRet = SdrCreateView::Command(rCEvt,pWin); return bRet; } @@ -811,7 +811,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) if (eHit==SdrHitKind::TextEdit) { bool bRet2(mpActualOutDev && OUTDEV_WINDOW == mpActualOutDev->GetOutDevType() && - SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, static_cast<vcl::Window*>(mpActualOutDev.get()))); + SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, mpActualOutDev->GetOwnerWindow())); if(bRet2) { @@ -897,7 +897,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) } else bRet=BegCreateObj(aLogicPos); } break; case SdrEventKind::BeginMacroObj: { - BegMacroObj(aLogicPos,mnHitTolLog,rVEvt.pObj,rVEvt.pPV,static_cast<vcl::Window*>(mpActualOutDev.get())); + BegMacroObj(aLogicPos,mnHitTolLog,rVEvt.pObj,rVEvt.pPV,mpActualOutDev->GetOwnerWindow()); bRet=false; } break; case SdrEventKind::BeginTextEdit: { @@ -907,7 +907,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) } bRet = mpActualOutDev && OUTDEV_WINDOW == mpActualOutDev->GetOutDevType()&& - SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, static_cast<vcl::Window*>(mpActualOutDev.get())); + SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, mpActualOutDev->GetOwnerWindow()); if(bRet) { @@ -920,14 +920,14 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) default: break; } // switch if (bRet && mpActualOutDev && mpActualOutDev->GetOutDevType()==OUTDEV_WINDOW) { - vcl::Window* pWin=static_cast<vcl::Window*>(mpActualOutDev.get()); + vcl::Window* pWin=mpActualOutDev->GetOwnerWindow(); // left mouse button pressed? bool bLeftDown=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseDown; // left mouse button released? bool bLeftUp=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseUp; // left mouse button pressed or held? bool bLeftDown1=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && !rVEvt.bMouseUp; - pWin->SetPointer(GetPreferredPointer(rVEvt.aLogicPos,pWin, + pWin->SetPointer(GetPreferredPointer(rVEvt.aLogicPos,pWin->GetOutDev(), rVEvt.nMouseCode & (KEY_SHIFT|KEY_MOD1|KEY_MOD2),bLeftDown1)); bool bAction=IsAction(); if (bLeftDown && bAction) diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index 0ba064368878..53304962303a 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -79,7 +79,7 @@ void AccessibleCell::Init() { // non-empty text -> use full-fledged edit source right away - mpText.reset( new AccessibleTextHelper( std::make_unique<SvxTextEditSource>(mxCell->GetObject(), mxCell.get(), *pView, *pWindow) ) ); + mpText.reset( new AccessibleTextHelper( std::make_unique<SvxTextEditSource>(mxCell->GetObject(), mxCell.get(), *pView, *pWindow->GetOutDev()) ) ); if( mxCell.is() && mxCell->IsActiveCell() ) mpText->SetFocus(); mpText->SetEventSource(this); diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index cab8570871dc..0f8faaa0fc6d 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -277,7 +277,7 @@ bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window* if (OutputDevice* pOutputDevice = mrView.GetFirstOutputDevice()) { if (pOutputDevice->GetOutDevType() == OUTDEV_WINDOW) - pWindow = static_cast<vcl::Window*>(pOutputDevice); + pWindow = pOutputDevice->GetOwnerWindow(); } } diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index bb6a8fa95016..cc36596a90e8 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -106,7 +106,7 @@ namespace svx VclPtr<VirtualDevice> VclToolboxButtonColorUpdater::CreateVirtualDevice() const { - auto xRet = VclPtr<VirtualDevice>::Create(*mpTbx, + auto xRet = VclPtr<VirtualDevice>::Create(*mpTbx->GetOutDev(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); xRet->SetBackground(mpTbx->GetControlBackground()); return xRet; |