diff options
author | Oliver Specht <oliver.specht@cib.de> | 2024-08-15 14:17:05 +0200 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2024-12-02 07:36:20 +0100 |
commit | ef4452663d13d0d559356440e71e97a6c282b1ff (patch) | |
tree | c014328b0caeb13b242d0fa10783606c260e2bf3 | |
parent | 55e86edcb37a37123a69ce3e1eb9e20758415fb6 (diff) |
tdf#161341 show/hide controls/shapes/pictures in view/printHEADmaster
Controls/shapes and images/objects have a display option in tools/options/
Writer/View and in print dialog there is "Form controls" and
"Images and other graphic objects". With this change the options
will actually be applied again.
Change-Id: I52389a8519d863792a7cd126a95a389c90c05a5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171905
Tested-by: Jenkins
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
-rw-r--r-- | include/svx/fmview.hxx | 3 | ||||
-rw-r--r-- | include/svx/svdpntv.hxx | 9 | ||||
-rw-r--r-- | svx/source/form/fmview.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdpntv.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/inc/viewimp.hxx | 19 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 59 | ||||
-rw-r--r-- | sw/source/core/view/viewimp.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 3 |
8 files changed, 82 insertions, 56 deletions
diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx index e601047eff00..0dfc5628b810 100644 --- a/include/svx/fmview.hxx +++ b/include/svx/fmview.hxx @@ -140,7 +140,8 @@ public: void RemoveControlContainer(const css::uno::Reference< css::awt::XControlContainer >& xCC); virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut) override; - virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer) override; + virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer, + sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr) override; SVX_DLLPRIVATE const OutputDevice* GetActualOutDev() const {return mpActualOutDev;} SVX_DLLPRIVATE bool checkUnMarkAll(const css::uno::Reference< css::uno::XInterface >& _xSource); diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index 6e6f04b84078..af03e455914c 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -355,7 +355,8 @@ public: // This means: the SdrPaintWindow is no longer safe after this closing call. virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut); void DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr); - virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer); + virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer, + sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr); // Used for the other applications basctl/sc/sw which call DrawLayer at PageViews @@ -365,12 +366,14 @@ public: // Used when the region passed to BeginDrawLayers needs to be changed void UpdateDrawLayersRegion(const OutputDevice* pOut, const vcl::Region& rReg); - void EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer); + void EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer, + sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr); protected: // Used to paint the form layer after the PreRender device is flushed (painted) to the window. - void ImpFormLayerDrawing( SdrPaintWindow& rPaintWindow ); + void ImpFormLayerDrawing( SdrPaintWindow& rPaintWindow, + sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr ); static vcl::Region OptimizeDrawLayersRegion(const OutputDevice* pOut, const vcl::Region& rReg, bool bDisableIntersect); diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index a26895653833..3f878a3fed05 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -437,9 +437,10 @@ SdrPaintWindow* FmFormView::BeginCompleteRedraw(OutputDevice* pOut) } -void FmFormView::EndCompleteRedraw( SdrPaintWindow& rPaintWindow, bool bPaintFormLayer ) +void FmFormView::EndCompleteRedraw( SdrPaintWindow& rPaintWindow, bool bPaintFormLayer, + sdr::contact::ViewObjectContactRedirector* pRedirector ) { - E3dView::EndCompleteRedraw( rPaintWindow, bPaintFormLayer ); + E3dView::EndCompleteRedraw( rPaintWindow, bPaintFormLayer, pRedirector ); m_pImpl->resumeTabOrderUpdate(); } diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index de1e42a5e6cb..5cee983a0b73 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -615,7 +615,8 @@ void SdrPaintView::DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const vcl::Reg } } -void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer) +void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer, + sdr::contact::ViewObjectContactRedirector* pRedirector) { std::unique_ptr<SdrPaintWindow> pPaintWindow; if (comphelper::LibreOfficeKit::isActive() && rPaintWindow.getTemporaryTarget()) @@ -637,7 +638,7 @@ void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFo // In the LOK case control rendering is performed through LokControlHandler if(!comphelper::LibreOfficeKit::isActive() && bPaintFormLayer) { - ImpFormLayerDrawing(rPaintWindow); + ImpFormLayerDrawing(rPaintWindow, pRedirector); } // look for active TextEdit. As long as this cannot be painted to a VDev, @@ -706,10 +707,11 @@ SdrPaintWindow* SdrPaintView::BeginDrawLayers(OutputDevice* pOut, const vcl::Reg return pPaintWindow; } -void SdrPaintView::EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer) +void SdrPaintView::EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer, + sdr::contact::ViewObjectContactRedirector* pRedirector) { // #i74769# use EndCompleteRedraw() as common base - EndCompleteRedraw(rPaintWindow, bPaintFormLayer); + EndCompleteRedraw(rPaintWindow, bPaintFormLayer, pRedirector); if(mpPageView) { @@ -764,7 +766,8 @@ vcl::Region SdrPaintView::OptimizeDrawLayersRegion(const OutputDevice* pOut, con } -void SdrPaintView::ImpFormLayerDrawing( SdrPaintWindow& rPaintWindow ) +void SdrPaintView::ImpFormLayerDrawing( SdrPaintWindow& rPaintWindow, + sdr::contact::ViewObjectContactRedirector* pRedirector ) { if(!mpPageView) return; @@ -780,7 +783,8 @@ void SdrPaintView::ImpFormLayerDrawing( SdrPaintWindow& rPaintWindow ) // BUFFERED use GetTargetOutputDevice() now, it may be targeted to VDevs, too // need to set PreparedPageWindow to make DrawLayer use the correct ObjectContact mpPageView->setPreparedPageWindow(pKnownTarget); - mpPageView->DrawLayer(nControlLayerId, &rPaintWindow.GetTargetOutputDevice()); + mpPageView->DrawLayer(nControlLayerId, &rPaintWindow.GetTargetOutputDevice(), + pRedirector); mpPageView->setPreparedPageWindow(nullptr); } } diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index 1c30fe6b9ad9..b3bae4b0000a 100644 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -21,6 +21,7 @@ #include <tools/color.hxx> #include <svx/svdtypes.hxx> +#include <svx/sdr/contact/viewobjectcontactredirector.hxx> #include <swrect.hxx> #include <swregion.hxx> #include <memory> @@ -45,8 +46,24 @@ class SwPagePreviewLayout; struct PreviewPage; class SwTextFrame; // --> OD #i76669# -namespace sdr::contact { class ViewObjectContactRedirector; } +//namespace sdr::contact { class ViewObjectContactRedirector; } // <-- +class SwViewObjectContactRedirector : public sdr::contact::ViewObjectContactRedirector +{ + private: + const SwViewShell& mrViewShell; + + public: + explicit SwViewObjectContactRedirector( const SwViewShell& rSh ) + : mrViewShell( rSh ) + {}; + + virtual void createRedirectedPrimitive2DSequence( + const sdr::contact::ViewObjectContact& rOriginal, + const sdr::contact::DisplayInfo& rDisplayInfo, + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) override; +}; + class SwViewShellImp { diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 8e2b97e7c045..e8188f77f7f5 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -29,6 +29,7 @@ #include <editeng/shaditem.hxx> #include <svx/ctredlin.hxx> #include <svx/framelink.hxx> +#include <svx/svdouno.hxx> #include <drawdoc.hxx> #include <tgrditem.hxx> #include <calbck.hxx> @@ -73,7 +74,6 @@ #include <swfont.hxx> #include <svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx> -#include <svx/sdr/contact/viewobjectcontactredirector.hxx> #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/contact/viewcontact.hxx> #include <DocumentSettingManager.hxx> @@ -3181,47 +3181,6 @@ void SwTabFramePainter::Insert( SwLineEntry& rNew, bool bHori ) pLineSet->insert( rNew ); } -/** - * FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES END - * --> OD #i76669# - */ -namespace -{ - class SwViewObjectContactRedirector : public sdr::contact::ViewObjectContactRedirector - { - private: - const SwViewShell& mrViewShell; - - public: - explicit SwViewObjectContactRedirector( const SwViewShell& rSh ) - : mrViewShell( rSh ) - {}; - - virtual void createRedirectedPrimitive2DSequence( - const sdr::contact::ViewObjectContact& rOriginal, - const sdr::contact::DisplayInfo& rDisplayInfo, - drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) override - { - bool bPaint( true ); - - SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject(); - if ( pObj ) - { - bPaint = SwFlyFrame::IsPaint( pObj, &mrViewShell ); - } - - if ( !bPaint ) - { - return; - } - - sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence( - rOriginal, rDisplayInfo, rVisitor ); - } - }; - -} // end of anonymous namespace -// <-- /** * Paint once for every visible page which is touched by Rect @@ -4135,6 +4094,13 @@ bool SwFlyFrame::IsBackgroundTransparent() const return bBackgroundTransparent; }; +static void lcl_PaintReplacement( const SwRect &rRect, const SwViewShell &rSh ) +{ + const BitmapEx& rBmp = const_cast<SwViewShell&>(rSh).GetReplacementBitmap(false); + vcl::Font aFont(rSh.GetOut()->GetFont() ); + Graphic::DrawEx(*rSh.GetOut(), OUString(), aFont, rBmp, rRect.Pos(), rRect.SSize()); +} + bool SwFlyFrame::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) { SdrObjUserCall *pUserCall = GetUserCall(pObj); @@ -4142,6 +4108,15 @@ bool SwFlyFrame::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) if ( nullptr == pUserCall ) return true; + if ( pSh && ((!pSh->GetViewOptions()->IsDraw() + && (dynamic_cast<SdrUnoObj*>(pObj) || dynamic_cast<SdrAttrObj*>(pObj) || dynamic_cast<SwFlyDrawObj*>(pObj))) + || (!pSh->GetViewOptions()->IsGraphic() && dynamic_cast<SwVirtFlyDrawObj*>(pObj)) ) + ) + { + SwRect rBoundRect = GetBoundRectOfAnchoredObj( pObj ); + lcl_PaintReplacement( rBoundRect, *pSh ); + return false; + } assert(pObj); //Attribute dependent, don't paint for printer or Preview diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 5b87730500dc..73ddbac03b84 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -38,6 +38,8 @@ #include <drawdoc.hxx> #include <prevwpage.hxx> #include <sfx2/viewsh.hxx> +#include <svx/sdr/contact/viewobjectcontact.hxx> +#include <svx/sdr/contact/viewcontact.hxx> void SwViewShellImp::Init( const SwViewOption *pNewOpt ) { @@ -525,4 +527,26 @@ void SwViewShellImp::FireAccessibleEvents() } #endif // ENABLE_WASM_STRIP_ACCESSIBILITY +void SwViewObjectContactRedirector::createRedirectedPrimitive2DSequence( + const sdr::contact::ViewObjectContact& rOriginal, + const sdr::contact::DisplayInfo& rDisplayInfo, + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) +{ + bool bPaint( true ); + + SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject(); + if ( pObj ) + { + bPaint = SwFlyFrame::IsPaint( pObj, &mrViewShell ); + } + + if ( !bPaint ) + { + return; + } + + sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence( + rOriginal, rDisplayInfo, rVisitor ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 124a7d940e15..2cf0e92b8192 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -256,7 +256,8 @@ void SwViewShell::DLPostPaint2(bool bPaintFormLayer) } // #i74769# use SdrPaintWindow now direct - Imp()->GetDrawView()->EndDrawLayers(*mpTargetPaintWindow, bPaintFormLayer); + SwViewObjectContactRedirector aSwRedirector(*this); + Imp()->GetDrawView()->EndDrawLayers(*mpTargetPaintWindow, bPaintFormLayer, &aSwRedirector); mpTargetPaintWindow = nullptr; } } |