chart2/source/controller/inc/ChartWindow.hxx  |    4 ---
 chart2/source/controller/main/ChartWindow.cxx |   16 +-----------
 include/svtools/brwbox.hxx                    |    4 ---
 include/vcl/toolkit/treelistbox.hxx           |    4 ---
 include/vcl/window.hxx                        |    8 +++---
 svtools/source/brwbox/datwin.cxx              |   23 +++++++-----------
 sw/source/uibase/docvw/srcedtw.cxx            |    4 +--
 sw/source/uibase/inc/srcedtw.hxx              |    4 ---
 vcl/source/treelist/treelistbox.cxx           |   14 +----------
 vcl/source/window/decoview.cxx                |   33 +++++++-------------------
 vcl/source/window/window.cxx                  |    7 +----
 11 files changed, 35 insertions(+), 86 deletions(-)

New commits:
commit 39eaf879c07f730f3af25e5c9a4b66b064f4171c
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Jul 26 10:36:59 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Jul 26 19:09:28 2023 +0200

    no need to check IsMapModeEnabled here
    
    LogicToPixel already does this for us
    
    Change-Id: If208a9e57ab8f5f0b6a26d715aa8493523682977
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154932
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index e9000090086c..2067a9e4ca4f 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -867,13 +867,9 @@ void DecorationView::DrawHighlightFrame( const 
tools::Rectangle& rRect,
 
 tools::Rectangle DecorationView::DrawFrame( const tools::Rectangle& rRect, 
DrawFrameStyle nStyle, DrawFrameFlags nFlags )
 {
-    tools::Rectangle   aRect = rRect;
-    bool        bOldMap = mpOutDev->IsMapModeEnabled();
-    if ( bOldMap )
-    {
-        aRect = mpOutDev->LogicToPixel( aRect );
-        mpOutDev->EnableMapMode( false );
-    }
+    tools::Rectangle aRect = mpOutDev->LogicToPixel( rRect );
+    bool bOldMap = mpOutDev->IsMapModeEnabled();
+    mpOutDev->EnableMapMode( false );
 
     if ( !rRect.IsEmpty() )
     {
@@ -889,11 +885,8 @@ tools::Rectangle DecorationView::DrawFrame( const 
tools::Rectangle& rRect, DrawF
         }
     }
 
-    if ( bOldMap )
-    {
-        mpOutDev->EnableMapMode( bOldMap );
-        aRect = mpOutDev->PixelToLogic( aRect );
-    }
+    mpOutDev->EnableMapMode( bOldMap );
+    aRect = mpOutDev->PixelToLogic( aRect );
 
     return aRect;
 }
@@ -905,14 +898,9 @@ tools::Rectangle DecorationView::DrawButton( const 
tools::Rectangle& rRect, Draw
         return rRect;
     }
 
-    tools::Rectangle aRect = rRect;
+    tools::Rectangle aRect = mpOutDev->LogicToPixel( rRect );
     const bool bOldMap = mpOutDev->IsMapModeEnabled();
-
-    if ( bOldMap )
-    {
-        aRect = mpOutDev->LogicToPixel( aRect );
-        mpOutDev->EnableMapMode( false );
-    }
+    mpOutDev->EnableMapMode( false );
 
     const Color aOldLineColor = mpOutDev->GetLineColor();
     const Color aOldFillColor = mpOutDev->GetFillColor();
@@ -968,11 +956,8 @@ tools::Rectangle DecorationView::DrawButton( const 
tools::Rectangle& rRect, Draw
         aRect.AdjustBottom( -3 );
     }
 
-    if ( bOldMap )
-    {
-        mpOutDev->EnableMapMode( bOldMap );
-        aRect = mpOutDev->PixelToLogic( aRect );
-    }
+    mpOutDev->EnableMapMode( bOldMap );
+    aRect = mpOutDev->PixelToLogic( aRect );
 
     return aRect;
 }
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 6e5575b9013c..bcbc4e5458c8 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1388,8 +1388,7 @@ void Window::ImplPointToLogic(vcl::RenderContext const & 
rRenderContext, vcl::Fo
     aSize.AdjustHeight(72/2 );
     aSize.setHeight( aSize.Height() / 72 );
 
-    if (rRenderContext.IsMapModeEnabled())
-        aSize = rRenderContext.PixelToLogic(aSize);
+    aSize = rRenderContext.PixelToLogic(aSize);
 
     rFont.SetFontSize(aSize);
 }
@@ -1397,9 +1396,7 @@ void Window::ImplPointToLogic(vcl::RenderContext const & 
rRenderContext, vcl::Fo
 void Window::ImplLogicToPoint(vcl::RenderContext const & rRenderContext, 
vcl::Font& rFont) const
 {
     Size aSize = rFont.GetFontSize();
-
-    if (rRenderContext.IsMapModeEnabled())
-        aSize = rRenderContext.LogicToPixel(aSize);
+    aSize = rRenderContext.LogicToPixel(aSize);
 
     if (aSize.Width())
     {
commit 7c70afbcc2a2aea243caf6ddac606c15a06fc5f9
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Jul 26 08:45:29 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Jul 26 19:09:18 2023 +0200

    improve override of Window::Invalidate(*)
    
    rather than having to override 3 different methods, have them override
    the ImplInvalidate, which is where the code ends up anywhere.
    This already exposes a couple of places that were not overriding all 3
    methods.
    
    Change-Id: If76abcf18325b7138ea451fbd0213cd6c7b4daa5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154930
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/controller/inc/ChartWindow.hxx 
b/chart2/source/controller/inc/ChartWindow.hxx
index 413acd968b22..918805cb3a8a 100644
--- a/chart2/source/controller/inc/ChartWindow.hxx
+++ b/chart2/source/controller/inc/ChartWindow.hxx
@@ -54,9 +54,7 @@ public:
     virtual void RequestHelp( const HelpEvent& rHEvt ) override;
 
     void ForceInvalidate();
-    virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) 
override;
-    virtual void Invalidate( const tools::Rectangle& rRect, InvalidateFlags 
nFlags = InvalidateFlags::NONE ) override;
-    virtual void Invalidate( const vcl::Region& rRegion, InvalidateFlags 
nFlags = InvalidateFlags::NONE ) override;
+    virtual void ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags 
nFlags ) override;
     /// Notify the LOK client about an invalidated area.
     virtual void LogicInvalidate( const tools::Rectangle* pRectangle ) 
override;
 
diff --git a/chart2/source/controller/main/ChartWindow.cxx 
b/chart2/source/controller/main/ChartWindow.cxx
index 00ea3b4d1e78..60ab7eb0ed2d 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -246,23 +246,11 @@ void ChartWindow::ForceInvalidate()
 {
     vcl::Window::Invalidate();
 }
-void ChartWindow::Invalidate( InvalidateFlags nFlags )
+void ChartWindow::ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags 
nFlags )
 {
     if( m_bInPaint ) // #i101928# superfluous paint calls while entering and 
editing charts"
         return;
-    vcl::Window::Invalidate( nFlags );
-}
-void ChartWindow::Invalidate( const tools::Rectangle& rRect, InvalidateFlags 
nFlags )
-{
-    if( m_bInPaint ) // #i101928# superfluous paint calls while entering and 
editing charts"
-        return;
-    vcl::Window::Invalidate( rRect, nFlags );
-}
-void ChartWindow::Invalidate( const vcl::Region& rRegion, InvalidateFlags 
nFlags )
-{
-    if( m_bInPaint ) // #i101928# superfluous paint calls while entering and 
editing charts"
-        return;
-    vcl::Window::Invalidate( rRegion, nFlags );
+    vcl::Window::ImplInvalidate( rRegion, nFlags );
 }
 
 void ChartWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index 2b813e192cb6..1d106d1ddaf1 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -208,11 +208,9 @@ public:
     void            LeaveUpdateLock();
     void            Update();
     void            DoOutstandingInvalidations();
-    void            Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE 
) override;
-    void            Invalidate( const tools::Rectangle& rRect, InvalidateFlags 
nFlags = InvalidateFlags::NONE ) override;
-    using Control::Invalidate;
 
 private:
+    virtual void    ImplInvalidate( const vcl::Region* pRegion, 
InvalidateFlags nFlags ) override;
     void            StartRowDividerDrag( const Point& _rStartPos );
     bool            ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent ) 
const;
 };
diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index 0fd864f9d104..da6785679ad5 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -637,9 +637,7 @@ public:
     void SetCurEntry( SvTreeListEntry* _pEntry );
     SvTreeListEntry* GetCurEntry() const;
 
-    using Window::Invalidate;
-    virtual void    Invalidate( InvalidateFlags nFlags = 
InvalidateFlags::NONE) override;
-    virtual void    Invalidate( const tools::Rectangle&, InvalidateFlags 
nFlags = InvalidateFlags::NONE ) override;
+    virtual void    ImplInvalidate( const vcl::Region* rRegion, 
InvalidateFlags nFlags ) override;
 
     void            SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 
nLastTab=0xffff);
 
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 4eb929804573..9db3125be3f5 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -577,7 +577,7 @@ protected:
 
     SAL_DLLPRIVATE vcl::Window*         ImplGetBorderWindow() const;
 
-    SAL_DLLPRIVATE void                 ImplInvalidate( const vcl::Region* 
rRegion, InvalidateFlags nFlags );
+    virtual void                        ImplInvalidate( const vcl::Region* 
pRegion, InvalidateFlags nFlags );
 
     virtual WindowHitTest               ImplHitTest( const Point& rFramePos );
 
@@ -955,9 +955,9 @@ public:
                                                 ScrollFlags nFlags = 
ScrollFlags::NONE );
     void                                Scroll( tools::Long nHorzScroll, 
tools::Long nVertScroll,
                                                 const tools::Rectangle& rRect, 
ScrollFlags nFlags = ScrollFlags::NONE );
-    virtual void                        Invalidate( InvalidateFlags nFlags = 
InvalidateFlags::NONE );
-    virtual void                        Invalidate( const tools::Rectangle& 
rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
-    virtual void                        Invalidate( const vcl::Region& 
rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE );
+    void                                Invalidate( InvalidateFlags nFlags = 
InvalidateFlags::NONE );
+    void                                Invalidate( const tools::Rectangle& 
rRect, InvalidateFlags nFlags = InvalidateFlags::NONE );
+    void                                Invalidate( const vcl::Region& 
rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE );
     /**
      * Notification about some rectangle of the output device got 
invalidated.Used for the main
      * document window.
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index e3fd46bf1ecb..d0144a9d4f7c 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -628,28 +628,25 @@ void BrowserDataWin::SetUpdateMode( bool bMode )
 void BrowserDataWin::DoOutstandingInvalidations()
 {
     for (const auto& rRect : aInvalidRegion)
-        Control::Invalidate( rRect );
+    {
+        vcl::Region aRegion(rRect);
+        Control::ImplInvalidate( &aRegion, InvalidateFlags::NONE );
+    }
     aInvalidRegion.clear();
 }
 
-void BrowserDataWin::Invalidate( InvalidateFlags nFlags )
+void BrowserDataWin::ImplInvalidate( const vcl::Region* pRegion, 
InvalidateFlags nFlags )
 {
     if ( !GetUpdateMode() )
     {
         aInvalidRegion.clear();
-        aInvalidRegion.emplace_back( Point( 0, 0 ), GetOutputSizePixel() );
+        if (!pRegion)
+            aInvalidRegion.emplace_back( Point( 0, 0 ), GetOutputSizePixel() );
+        else
+            aInvalidRegion.emplace_back( pRegion->GetBoundRect() );
     }
     else
-        Window::Invalidate( nFlags );
-}
-
-
-void BrowserDataWin::Invalidate( const tools::Rectangle& rRect, 
InvalidateFlags nFlags )
-{
-    if ( !GetUpdateMode() )
-        aInvalidRegion.emplace_back( rRect );
-    else
-        Window::Invalidate( rRect, nFlags );
+        Window::ImplInvalidate( pRegion, nFlags );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/srcedtw.cxx 
b/sw/source/uibase/docvw/srcedtw.cxx
index 732553e2bbf4..75cfe7bbd256 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -737,10 +737,10 @@ void SwSrcEditWindow::Notify( SfxBroadcaster& /*rBC*/, 
const SfxHint& rHint )
     }
 }
 
-void SwSrcEditWindow::Invalidate(InvalidateFlags )
+void SwSrcEditWindow::ImplInvalidate(const vcl::Region* pRegion, 
InvalidateFlags nFlags)
 {
     m_pOutWin->Invalidate();
-    Window::Invalidate();
+    Window::ImplInvalidate(pRegion, nFlags);
 }
 
 void SwSrcEditWindow::Command( const CommandEvent& rCEvt )
diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx
index e0c728ff9031..7e717581915a 100644
--- a/sw/source/uibase/inc/srcedtw.hxx
+++ b/sw/source/uibase/inc/srcedtw.hxx
@@ -91,8 +91,6 @@ private:
 
     DECL_LINK( SyntaxTimerHdl, Timer *, void );
 
-    using Window::Invalidate;
-
     virtual void    Resize() override;
     virtual void    DataChanged( const DataChangedEvent& ) override;
     virtual void    GetFocus() override;
@@ -123,7 +121,7 @@ public:
 
     TextViewOutWin* GetOutWin() {return m_pOutWin;}
 
-    virtual void    Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE 
) override;
+    virtual void    ImplInvalidate( const vcl::Region* pRegion, 
InvalidateFlags nFlags ) override;
 
     void            ClearModifyFlag()
                         { m_pTextEngine->SetModified(false); }
diff --git a/vcl/source/treelist/treelistbox.cxx 
b/vcl/source/treelist/treelistbox.cxx
index e63eec4816e5..94d561ced049 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -3193,7 +3193,7 @@ void SvTreeListBox::NotifyScrolled()
     aScrolledHdl.Call( this );
 }
 
-void SvTreeListBox::Invalidate( InvalidateFlags nInvalidateFlags )
+void SvTreeListBox::ImplInvalidate( const vcl::Region* pRegion, 
InvalidateFlags nInvalidateFlags )
 {
     if (!pImpl)
         return;
@@ -3201,20 +3201,10 @@ void SvTreeListBox::Invalidate( InvalidateFlags 
nInvalidateFlags )
         // to make sure that the control doesn't show the wrong focus rectangle
         // after painting
         pImpl->RecalcFocusRect();
-    Control::Invalidate( nInvalidateFlags );
+    Control::ImplInvalidate( pRegion, nInvalidateFlags );
     pImpl->Invalidate();
 }
 
-void SvTreeListBox::Invalidate( const tools::Rectangle& rRect, InvalidateFlags 
nInvalidateFlags )
-{
-    if( nFocusWidth == -1 )
-        // to make sure that the control doesn't show the wrong focus rectangle
-        // after painting
-        pImpl->RecalcFocusRect();
-    Control::Invalidate( rRect, nInvalidateFlags );
-}
-
-
 void SvTreeListBox::SetHighlightRange( sal_uInt16 nStart, sal_uInt16 nEnd)
 {
 

Reply via email to