sw/source/core/doc/notxtfrm.cxx    |    2 +-
 sw/source/core/inc/cellfrm.hxx     |    3 ++-
 sw/source/core/inc/flyfrm.hxx      |    3 ++-
 sw/source/core/inc/frame.hxx       |    3 ++-
 sw/source/core/inc/layfrm.hxx      |    3 ++-
 sw/source/core/inc/notxtfrm.hxx    |    3 ++-
 sw/source/core/inc/rootfrm.hxx     |    3 ++-
 sw/source/core/inc/tabfrm.hxx      |    3 ++-
 sw/source/core/inc/txtfrm.hxx      |    3 ++-
 sw/source/core/inc/viewimp.hxx     |    1 +
 sw/source/core/layout/paintfrm.cxx |   21 ++++++++++++---------
 sw/source/core/layout/unusedf.cxx  |    2 +-
 sw/source/core/text/frmpaint.cxx   |    2 +-
 sw/source/core/view/vdraw.cxx      |    7 +++++++
 14 files changed, 39 insertions(+), 20 deletions(-)

New commits:
commit 3735d43955a000db8b6fff04a2214793be649c4b
Author:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
AuthorDate: Wed Jun 5 09:14:23 2024 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu Jun 6 11:12:11 2024 +0200

    tdf#161340 Revert partially 6cdf523f179f3e7ed94267502a5fe3d1247398cc
    
    so that hiding drawing shapes from Print Dialog still works
    with the 'Images and other graphic objects' option
    
    Change-Id: I3c6612f1074e31d1007523709858e2c8ab6de809
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168467
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
    Tested-by: Jenkins
    Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 5083ad7aded8..8afc1c60b280 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -214,7 +214,7 @@ static void lcl_ClearArea( const SwFrame &rFrame,
     }
 }
 
-void SwNoTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode) const
+void SwNoTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode, SwPrintData const*const) const
 {
     if ( getFrameArea().IsEmpty() )
         return;
diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx
index 3fad18e7fcec..0d1575a83695 100644
--- a/sw/source/core/inc/cellfrm.hxx
+++ b/sw/source/core/inc/cellfrm.hxx
@@ -42,7 +42,8 @@ public:
     SwCellFrame( const SwTableBox &, SwFrame*, bool bInsertContent );
 
     virtual bool GetModelPositionForViewPoint( SwPosition *, Point&, 
SwCursorMoveState* = nullptr, bool bTestBackground = false ) const override;
-    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL ) const override;
+    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL,
+                        SwPrintData const*const pPrintData = nullptr ) const 
override;
     virtual void CheckDirection( bool bVert ) override;
 
     // #i103961#
diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx
index a9db68182fd8..2a4091b7859a 100644
--- a/sw/source/core/inc/flyfrm.hxx
+++ b/sw/source/core/inc/flyfrm.hxx
@@ -170,7 +170,8 @@ protected:
 
 public:
     // #i26791#
-    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL ) const override;
+    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL,
+                        SwPrintData const*const pPrintData = nullptr ) const 
override;
     virtual Size ChgSize( const Size& aNewSize ) override;
     virtual bool GetModelPositionForViewPoint( SwPosition *, Point&,
                               SwCursorMoveState* = nullptr, bool 
bTestBackground = false ) const override;
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 13c196ad70cb..eea75e34a3c7 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -853,7 +853,8 @@ public:
                                  SwCursorMoveState* = nullptr, bool 
bTestBackground = false ) const;
     virtual bool    GetCharRect( SwRect &, const SwPosition&,
                                  SwCursorMoveState* = nullptr, bool 
bAllowFarAway = true ) const;
-    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode eMode = PAINT_ALL ) const;
+    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode eMode = PAINT_ALL,
+                        SwPrintData const*const pPrintData = nullptr ) const;
 
     // HACK: shortcut between frame and formatting
     // It's your own fault if you cast void* incorrectly! In any case check
diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx
index a73bf34477d2..d40fa7b5a341 100644
--- a/sw/source/core/inc/layfrm.hxx
+++ b/sw/source/core/inc/layfrm.hxx
@@ -96,7 +96,8 @@ public:
 
     SwLayoutFrame( SwFrameFormat*, SwFrame* );
 
-    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL ) const override;
+    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL,
+                        SwPrintData const*const pPrintData = nullptr ) const 
override;
     const SwFrame *Lower() const { return m_pLower; }
           SwFrame *Lower()       { return m_pLower; }
     bool ContainsDeleteForbiddenLayFrame() const;
diff --git a/sw/source/core/inc/notxtfrm.hxx b/sw/source/core/inc/notxtfrm.hxx
index dbd2d3cae1f6..12dc3691ef09 100644
--- a/sw/source/core/inc/notxtfrm.hxx
+++ b/sw/source/core/inc/notxtfrm.hxx
@@ -82,7 +82,8 @@ public:
     virtual bool LeftMargin(SwPaM *) const override;
     virtual bool RightMargin(SwPaM *, bool bAPI = false) const override;
 
-    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL ) const override;
+    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL,
+                        SwPrintData const*const pPrintData = nullptr ) const 
override;
     virtual bool GetCharRect( SwRect &, const SwPosition&,
                               SwCursorMoveState* = nullptr, bool bAllowFarAway 
= true ) const override;
     virtual bool GetModelPositionForViewPoint(SwPosition* pPos, Point& aPoint,
diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index 82b5743a5a6a..f2b53a82f302 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -240,7 +240,8 @@ public:
     SW_DLLPUBLIC virtual bool GetModelPositionForViewPoint( SwPosition *, 
Point&,
                                SwCursorMoveState* = nullptr, bool 
bTestBackground = false ) const override;
 
-    SW_DLLPUBLIC virtual void PaintSwFrame( vcl::RenderContext& 
rRenderContext, SwRect const&, PaintFrameMode mode = PAINT_ALL ) const override;
+    SW_DLLPUBLIC virtual void PaintSwFrame( vcl::RenderContext& 
rRenderContext, SwRect const&, PaintFrameMode mode = PAINT_ALL,
+                                     SwPrintData const*const pPrintData = 
nullptr ) const override;
     virtual SwTwips ShrinkFrame( SwTwips, bool bTst = false, bool bInfo = 
false ) override;
     virtual SwTwips GrowFrame  ( SwTwips, bool bTst = false, bool bInfo = 
false ) override;
 #ifdef DBG_UTIL
diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index f6520b7996d8..3051ba029840 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -144,7 +144,8 @@ public:
     inline       SwTabFrame *GetFollow();
     SwTabFrame* FindMaster( bool bFirstMaster = false ) const;
 
-    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL ) const override;
+    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL,
+                        SwPrintData const*const pPrintData = nullptr ) const 
override;
     virtual void CheckDirection( bool bVert ) override;
 
     virtual void Cut() override;
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 5905c60352a8..2ce060b5cf8a 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -419,7 +419,8 @@ public:
 
     void   PaintExtraData( const SwRect & rRect ) const; /// Page number etc.
     SwRect GetPaintSwRect();
-    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL ) const override;
+    virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect 
const&, PaintFrameMode mode = PAINT_ALL,
+                        SwPrintData const*const pPrintData = nullptr ) const 
override;
 
     /**
      * Layout oriented cursor travelling:
diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index fad62cbdc36a..1c30fe6b9ad9 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -176,6 +176,7 @@ public:
      * the draw view for painting layers "hell" and "heaven"
      */
     void   PaintLayer( const SdrLayerID _nLayerID,
+                       SwPrintData const*const pPrintData,
                        SwPageFrame const& rPageFrame,
                        const SwRect& _rRect,
                        const Color* _pPageBackgrdColor,
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 7bcd14b396f3..98679695df29 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3268,7 +3268,7 @@ namespace
  * 3. Paint the document content (text)
  * 4. Paint the draw layer that is above the document
 |*/
-void SwRootFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode) const
+void SwRootFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode, SwPrintData const*const pPrintData) const
 {
     OSL_ENSURE( Lower() && Lower()->IsPageFrame(), "Lower of root is no page." 
);
 
@@ -3479,6 +3479,7 @@ void SwRootFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect const&
                     gProp.pSLines->LockLines( true );
                     const IDocumentDrawModelAccess& rIDDMA = 
pSh->getIDocumentDrawModelAccess();
                     pSh->Imp()->PaintLayer( rIDDMA.GetHellId(),
+                                            pPrintData,
                                             *pPage, pPage->getFrameArea(),
                                             &aPageBackgrdColor,
                                             pPage->IsRightToLeft(),
@@ -3495,6 +3496,7 @@ void SwRootFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect const&
                     gProp.pSLines->LockLines( true );
                     const IDocumentDrawModelAccess& rIDDMA = 
pSh->getIDocumentDrawModelAccess();
                     pSh->Imp()->PaintLayer( rIDDMA.GetHeaderFooterHellId(),
+                                            pPrintData,
                                             *pPage, pPage->getFrameArea(),
                                             &aPageBackgrdColor,
                                             pPage->IsRightToLeft(),
@@ -3540,6 +3542,7 @@ void SwRootFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect const&
                 if ( pSh->Imp()->HasDrawView() )
                 {
                     pSh->Imp()->PaintLayer( 
pSh->GetDoc()->getIDocumentDrawModelAccess().GetHeavenId(),
+                                            pPrintData,
                                             *pPage, pPage->getFrameArea(),
                                             &aPageBackgrdColor,
                                             pPage->IsRightToLeft(),
@@ -3713,7 +3716,7 @@ SwShortCut::SwShortCut( const SwFrame& rFrame, const 
SwRect& rRect )
     }
 }
 
-void SwLayoutFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode ePaintFrameMode) const
+void SwLayoutFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode ePaintFrameMode, SwPrintData const*const) const
 {
     // #i16816# tagged pdf support
     Frame_Info aFrameInfo(*this, false);
@@ -4246,7 +4249,7 @@ bool SwFlyFrame::IsPaint( SdrObject *pObj, const 
SwViewShell *pSh )
     return bPaint;
 }
 
-void SwCellFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode) const
+void SwCellFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode, SwPrintData const*const) const
 {
     if ( GetLayoutRowSpan() >= 1 )
         SwLayoutFrame::PaintSwFrame( rRenderContext, rRect );
@@ -4285,7 +4288,7 @@ void SwFrame::SetDrawObjsAsDeleted( bool bDeleted )
     }
 }
 
-void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode) const
+void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode, SwPrintData const*const) const
 {
     //optimize thumbnail generation and store procedure to improve odt saving 
performance, #i120030#
     SwViewShell *pShell = getRootFrame()->GetCurrShell();
@@ -4662,7 +4665,7 @@ void SwTextFrame::PaintOutlineContentVisibilityButton() 
const
         UpdateOutlineContentVisibilityButton(pWrtSh);
 }
 
-void SwTabFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode) const
+void SwTabFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode, SwPrintData const*const) const
 {
     const SwViewOption* pViewOption = gProp.pSGlobalShell->GetViewOptions();
     if (pViewOption->IsTable())
@@ -7868,11 +7871,11 @@ void SwFrame::Retouch( const SwPageFrame * pPage, const 
SwRect &rRect ) const
                 SwViewObjectContactRedirector aSwRedirector( *pSh );
                 // <--
 
-                pSh->Imp()->PaintLayer( rIDDMA.GetHellId(),
+                pSh->Imp()->PaintLayer( rIDDMA.GetHellId(), nullptr,
                                         *pPage, rRetouche, &aPageBackgrdColor,
                                         pPage->IsRightToLeft(),
                                         &aSwRedirector );
-                pSh->Imp()->PaintLayer( rIDDMA.GetHeavenId(),
+                pSh->Imp()->PaintLayer( rIDDMA.GetHeavenId(), nullptr,
                                         *pPage, rRetouche, &aPageBackgrdColor,
                                         pPage->IsRightToLeft(),
                                         &aSwRedirector );
@@ -8187,7 +8190,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap, 
const sal_uInt32 /*nMaxim
         // --> OD #i76669#
         SwViewObjectContactRedirector aSwRedirector( *pSh );
         // <--
-        pImp->PaintLayer( rIDDMA.GetHellId(),
+        pImp->PaintLayer( rIDDMA.GetHellId(), nullptr,
                           *pFlyPage, aOut, &aPageBackgrdColor,
                           pFlyPage->IsRightToLeft(),
                           &aSwRedirector );
@@ -8195,7 +8198,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap, 
const sal_uInt32 /*nMaxim
         if ( pFly->IsFlyInContentFrame() )
             pFly->PaintSwFrame( *pDev, aOut );
         gProp.pSLines->PaintLines( pDev, gProp );
-        pImp->PaintLayer( rIDDMA.GetHeavenId(),
+        pImp->PaintLayer( rIDDMA.GetHeavenId(), nullptr,
                           *pFlyPage, aOut, &aPageBackgrdColor,
                           pFlyPage->IsRightToLeft(),
                           &aSwRedirector );
diff --git a/sw/source/core/layout/unusedf.cxx 
b/sw/source/core/layout/unusedf.cxx
index d36498b18452..fbb80dbfef71 100644
--- a/sw/source/core/layout/unusedf.cxx
+++ b/sw/source/core/layout/unusedf.cxx
@@ -27,7 +27,7 @@ void SwFrame::Format( vcl::RenderContext* /*pRenderContext*/, 
const SwBorderAttr
     OSL_FAIL( "Format() of the base class called." );
 }
 
-void SwFrame::PaintSwFrame(vcl::RenderContext&, SwRect const&, PaintFrameMode) 
const
+void SwFrame::PaintSwFrame(vcl::RenderContext&, SwRect const&, PaintFrameMode, 
SwPrintData const*const) const
 {
     OSL_FAIL( "PaintSwFrame() of the base class called." );
 }
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 702f4f048e71..54aee83a48d9 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -642,7 +642,7 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool 
bCheck ) const
     return false;
 }
 
-void SwTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode) const
+void SwTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode, SwPrintData const*const) const
 {
     ResetRepaint();
 
diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx
index 16ee86a99335..d4529bb650d8 100644
--- a/sw/source/core/view/vdraw.cxx
+++ b/sw/source/core/view/vdraw.cxx
@@ -86,6 +86,7 @@ void SwViewShellImp::UnlockPaint()
 }
 
 void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
+                            SwPrintData const*const pPrintData,
                             SwPageFrame const& rPageFrame,
                             const SwRect& aPaintRect,
                             const Color* _pPageBackgrdColor,
@@ -135,6 +136,12 @@ void SwViewShellImp::PaintLayer( const SdrLayerID 
_nLayerID,
     }
 
     pOutDev->Push( vcl::PushFlags::LINECOLOR );
+    if (pPrintData)
+    {
+        // hide drawings but not form controls (form controls are handled 
elsewhere)
+        SdrView &rSdrView = GetPageView()->GetView();
+        rSdrView.setHideDraw( !pPrintData->IsPrintGraphic() );
+    }
     basegfx::B2IRectangle const pageFrame = 
vcl::unotools::b2IRectangleFromRectangle(rPageFrame.getFrameArea().SVRect());
     GetPageView()->DrawLayer(_nLayerID, pOutDev, pRedirector, 
aPaintRect.SVRect(), &pageFrame);
     pOutDev->Pop();

Reply via email to