diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2023-07-11 13:57:52 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2023-07-12 17:59:46 +0200 |
commit | 3996eed1870ced736d9f4a01550f5c9f0568edfa (patch) | |
tree | 2a21ebaffe083c3bfd45dae854fd35087802e624 | |
parent | 54a36dd93a97fb6f5d25e1dbdbe1ef95a7cbaf52 (diff) |
tdf#105362 better support for transparency in PNG & GIF export
The granularity to decide at the SdrView what to paint was not
fine enough, so I added code to get what we need: Do avoid
page decorations (including PageBackgrund aka 'wiese'), but
do include/process MasterPage content.
Change-Id: I49df05abc89b4bcebc973c37d30be0a0c72e59ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154301
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
-rw-r--r-- | chart2/source/controller/drawinglayer/DrawViewWrapper.cxx | 1 | ||||
-rw-r--r-- | include/svx/sdr/contact/displayinfo.hxx | 11 | ||||
-rw-r--r-- | include/svx/sdr/contact/objectcontact.hxx | 6 | ||||
-rw-r--r-- | include/svx/sdr/contact/objectcontactofpageview.hxx | 6 | ||||
-rw-r--r-- | include/svx/svdpntv.hxx | 35 | ||||
-rw-r--r-- | reportdesign/source/ui/report/SectionView.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/tools/PreviewRenderer.cxx | 8 | ||||
-rw-r--r-- | svx/source/dialog/graphctl.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/contact/displayinfo.cxx | 9 | ||||
-rw-r--r-- | svx/source/sdr/contact/objectcontact.cxx | 12 | ||||
-rw-r--r-- | svx/source/sdr/contact/objectcontactofpageview.cxx | 12 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrpage.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontactofpageobj.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/sdrpagewindow.cxx | 14 | ||||
-rw-r--r-- | svx/source/svdraw/svdpntv.cxx | 17 | ||||
-rw-r--r-- | svx/source/unodraw/UnoGraphicExporter.cxx | 7 |
18 files changed, 102 insertions, 53 deletions
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index 15cac92fc011..1cd90c06b7ad 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -81,7 +81,6 @@ DrawViewWrapper::DrawViewWrapper( { SetBufferedOutputAllowed(true); SetBufferedOverlayAllowed(true); - SetPagePaintingAllowed(true); // #i12587# support for shapes in chart SdrOutliner* pOutliner = getOutliner(); diff --git a/include/svx/sdr/contact/displayinfo.hxx b/include/svx/sdr/contact/displayinfo.hxx index 7075b04ccf6f..b2229042a914 100644 --- a/include/svx/sdr/contact/displayinfo.hxx +++ b/include/svx/sdr/contact/displayinfo.hxx @@ -46,13 +46,6 @@ namespace sdr::contact // painting when the control layer needs to be painted as last layer bool mbControlLayerProcessingActive : 1; - // Internal flag to decide if page stuff (background, border, MasterPage, grid, etc...) - // will be processed at all. This flag is user-defined and will not be changed from the - // processing mechanism. Default is true, thus set to false if PagePainting should be suppressed. - // For more granular switching page stuff painting on and off, use the according flags at the - // view (->Is*Visible()) - bool mbPageProcessingActive : 1; - // Internal flag to remember if EnteredGroupDrawMode is active. Default is true // since this mode starts activated and gets switched off when reaching // the current group level. Should only be changed by instances which do @@ -83,10 +76,6 @@ namespace sdr::contact void SetControlLayerProcessingActive(bool bDoPaint); bool GetControlLayerProcessingActive() const { return mbControlLayerProcessingActive; } - // Access to PageProcessingActive flag - void SetPageProcessingActive(bool bDoPaint); - bool GetPageProcessingActive() const { return mbPageProcessingActive; } - // Save the original DrawMode from outdev void ClearGhostedDrawMode(); void SetGhostedDrawMode(); diff --git a/include/svx/sdr/contact/objectcontact.hxx b/include/svx/sdr/contact/objectcontact.hxx index 40d631f3fae8..f38eb768c4ee 100644 --- a/include/svx/sdr/contact/objectcontact.hxx +++ b/include/svx/sdr/contact/objectcontact.hxx @@ -136,6 +136,12 @@ public: // print? Default is false virtual bool isOutputToPrinter() const; + // display page decoration? Default is true + virtual bool isPageDecorationActive() const; + + // display mster page content (ViewContactOfMasterPage)? Default is true + virtual bool isMasterPageActive() const; + // recording MetaFile? Default is false virtual bool isOutputToRecordingMetaFile() const; diff --git a/include/svx/sdr/contact/objectcontactofpageview.hxx b/include/svx/sdr/contact/objectcontactofpageview.hxx index 1512542dc395..bc99975f4347 100644 --- a/include/svx/sdr/contact/objectcontactofpageview.hxx +++ b/include/svx/sdr/contact/objectcontactofpageview.hxx @@ -87,6 +87,12 @@ namespace sdr::contact // print? Default is false virtual bool isOutputToPrinter() const override; + // display page decoration? Default is true + virtual bool isPageDecorationActive() const override; + + // display mster page content (ViewContactOfMasterPage)? Default is true + virtual bool isMasterPageActive() const override; + // recording MetaFile? Default is false virtual bool isOutputToRecordingMetaFile() const override; diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index f6be42ee1e9a..661c8e3b7406 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -177,8 +177,27 @@ protected: // directly painted to OutDev. Default is sal_False. bool mbBufferedOverlayAllowed : 1; - // Allow page painting at all? - bool mbPagePaintingAllowed : 1; + // Allow page decorations? Quick way to switch on/off all of page's decoration features, + // in addition to the more fine-granular other view settings (see *visible bools above). + // Default is true. + // This controls processing of the hierarchy elements: + // -ViewContactOfPageBackground: formally known as 'Wiese', the area behind the page + // -ViewContactOfPageShadow: page's shadow + // -ViewContactOfPageFill: the page's fill with PageColor/PaperColor + // (MasterPage content here, not affected by this flag) + // -ViewContactOfOuterPageBorder: the border around the page + // -ViewContactOfInnerPageBorder: The border inside the page, moved inside by PageBorder distances + // -ViewContactOfGrid: the page's grid visualisation (background) + // -ViewContactOfHelplines: the page's Helplines (background) + // (Page content here, not affected by this flag) + // -ViewContactOfGrid: the page's grid visualisation (foreground) + // -ViewContactOfHelplines: the page's Helplines (foreground) + // Note: background/foreground means that one is active, grid & helplines can be displayed in + // front of or behind obect visualisations/page content + bool mbPageDecorationAllowed : 1; + + // Allow MasterPage visualization, default is true + bool mbMasterPageVisualizationAllowed : 1; // Is this a preview renderer? bool mbPreviewRenderer : 1; @@ -191,7 +210,7 @@ protected: bool mbPaintTextEdit : 1; // if should paint currently edited text public: - // Interface for PagePaintingAllowed flag + // Interface for BufferedOoutputAllowed flag bool IsBufferedOutputAllowed() const; void SetBufferedOutputAllowed(bool bNew); @@ -199,9 +218,13 @@ public: bool IsBufferedOverlayAllowed() const; void SetBufferedOverlayAllowed(bool bNew); - // Allow page painting at all? - bool IsPagePaintingAllowed() const { return mbPagePaintingAllowed;} - void SetPagePaintingAllowed(bool bNew); + // Allow page decorations? See details above at mbPageDecorationAllowed declaration + bool IsPageDecorationAllowed() const { return mbPageDecorationAllowed;} + void SetPageDecorationAllowed(bool bNew); + + // Allow MasterPage visualization, default is true + bool IsMasterPageVisualizationAllowed() const { return mbMasterPageVisualizationAllowed;} + void SetMasterPageVisualizationAllowed(bool bNew); virtual rtl::Reference<sdr::overlay::OverlayManager> CreateOverlayManager(OutputDevice& rDevice) const; diff --git a/reportdesign/source/ui/report/SectionView.cxx b/reportdesign/source/ui/report/SectionView.cxx index f3da3021e265..e5c425ace570 100644 --- a/reportdesign/source/ui/report/SectionView.cxx +++ b/reportdesign/source/ui/report/SectionView.cxx @@ -39,7 +39,6 @@ OSectionView::OSectionView( ,m_pReportWindow( pEditor ) ,m_pSectionWindow(_pSectionWindow) { - // SetPagePaintingAllowed(false); SetBufferedOutputAllowed(true); SetBufferedOverlayAllowed(true); SetPageBorderVisible(false); diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index 367735504a17..d3fc73bf93cc 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -399,20 +399,12 @@ void PreviewRenderer::ProvideView (DrawDocShell* pDocShell) mpView.reset (new DrawView (pDocShell, mpPreviewDevice.get(), nullptr)); } mpView->SetPreviewRenderer(true); -#if 1 mpView->SetPageVisible(false); mpView->SetPageBorderVisible(); mpView->SetBordVisible(false); mpView->SetGridVisible(false); mpView->SetHlplVisible(false); mpView->SetGlueVisible(false); - -#else - // This works in the slide sorter but prevents the master page - // background being painted in the list of current master pages in the - // task manager. - mpView->SetPagePaintingAllowed(false); -#endif } Image PreviewRenderer::ScaleBitmap ( diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 56c1509fa776..cf127d670ab1 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -142,7 +142,8 @@ void GraphCtrl::InitSdrModel() pView->SetEditMode(); // #i72889# set needed flags - pView->SetPagePaintingAllowed(false); + pView->SetPageDecorationAllowed(false); + pView->SetMasterPageVisualizationAllowed(false); pView->SetBufferedOutputAllowed(true); pView->SetBufferedOverlayAllowed(true); diff --git a/svx/source/sdr/contact/displayinfo.cxx b/svx/source/sdr/contact/displayinfo.cxx index 405fb41a07f1..1c76b70afc55 100644 --- a/svx/source/sdr/contact/displayinfo.cxx +++ b/svx/source/sdr/contact/displayinfo.cxx @@ -25,7 +25,6 @@ namespace sdr::contact DisplayInfo::DisplayInfo() : maProcessLayers(true), // init layer info with all bits set to draw everything on default mbControlLayerProcessingActive(false), - mbPageProcessingActive(true), mbGhostedDrawModeActive(false), mbSubContentActive(false) { @@ -56,14 +55,6 @@ namespace sdr::contact } } - void DisplayInfo::SetPageProcessingActive(bool bDoProcess) - { - if(mbPageProcessingActive != bDoProcess) - { - mbPageProcessingActive = bDoProcess; - } - } - void DisplayInfo::ClearGhostedDrawMode() { mbGhostedDrawModeActive = false; diff --git a/svx/source/sdr/contact/objectcontact.cxx b/svx/source/sdr/contact/objectcontact.cxx index 4555068ccf01..b09966c5a01e 100644 --- a/svx/source/sdr/contact/objectcontact.cxx +++ b/svx/source/sdr/contact/objectcontact.cxx @@ -159,6 +159,18 @@ bool ObjectContact::isOutputToPrinter() const return false; } +// display page decoration? Default is true +bool ObjectContact::isPageDecorationActive() const +{ + return true; +} + +// display mster page content (ViewContactOfMasterPage)? Default is true +bool ObjectContact::isMasterPageActive() const +{ + return true; +} + // recording MetaFile? Default is false bool ObjectContact::isOutputToRecordingMetaFile() const { diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index e07cf01bb86c..1c698227a951 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -379,6 +379,18 @@ namespace sdr::contact return (OUTDEV_PRINTER == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType()); } + // display page decoration? Default is true + bool ObjectContactOfPageView::isPageDecorationActive() const + { + return GetPageWindow().GetPageView().GetView().IsPageDecorationAllowed(); + } + + // display mster page content (ViewContactOfMasterPage)? Default is true + bool ObjectContactOfPageView::isMasterPageActive() const + { + return GetPageWindow().GetPageView().GetView().IsMasterPageVisualizationAllowed(); + } + // recording MetaFile? bool ObjectContactOfPageView::isOutputToRecordingMetaFile() const { diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 0f04045815b5..83193c98be47 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -493,7 +493,7 @@ sal_uInt32 ViewContactOfSdrPage::GetObjectCount() const // or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines // (for front and back) which internally are visible or not depending on the current // front/back setting for those. - return 11; + return 10; } ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const @@ -522,7 +522,7 @@ ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const case 7: return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesBack); case 8: return const_cast<ViewContactOfPageHierarchy&>(maViewContactOfPageHierarchy); case 9: return const_cast<ViewContactOfGrid&>(maViewContactOfGridFront); - case 10: case 11: return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesFront); + case 10: return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesFront); default: assert(false);return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesFront); } } diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index f96ed115df81..baa039b1bb0f 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -46,7 +46,8 @@ namespace sdr::contact return false; } - if(!rDisplayInfo.GetPageProcessingActive()) + // display mster page content? + if (!GetObjectContact().isMasterPageActive()) { return false; } diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index d66d3852791f..9430ac55ba3e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -65,6 +65,8 @@ public: // forward access to SdrPageView of ViewObjectContactOfPageObj virtual bool isOutputToPrinter() const override; + virtual bool isPageDecorationActive() const override; + virtual bool isMasterPageActive() const override; virtual bool isOutputToRecordingMetaFile() const override; virtual bool isOutputToPDFFile() const override; virtual bool isExportTaggedPDF() const override; @@ -177,6 +179,8 @@ void PagePrimitiveExtractor::InvalidatePartOfView(const basegfx::B2DRange& rRang // forward access to SdrPageView to VOCOfPageObj bool PagePrimitiveExtractor::isOutputToPrinter() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPrinter(); } +bool PagePrimitiveExtractor::isPageDecorationActive() const { return mrViewObjectContactOfPageObj.GetObjectContact().isPageDecorationActive(); } +bool PagePrimitiveExtractor::isMasterPageActive() const { return mrViewObjectContactOfPageObj.GetObjectContact().isMasterPageActive(); } bool PagePrimitiveExtractor::isOutputToRecordingMetaFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToRecordingMetaFile(); } bool PagePrimitiveExtractor::isOutputToPDFFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPDFFile(); } bool PagePrimitiveExtractor::isExportTaggedPDF() const { return mrViewObjectContactOfPageObj.GetObjectContact().isExportTaggedPDF(); } diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx index fe9855f4cdd3..3cc27104c3c2 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx @@ -63,7 +63,7 @@ bool ViewObjectContactOfPageSubObject::isPrimitiveVisible(const DisplayInfo& rDi return false; } - if(!rDisplayInfo.GetPageProcessingActive()) + if(!GetObjectContact().isPageDecorationActive()) { return false; } diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index 123d1d2d03a6..e975b20ebb3f 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -350,9 +350,6 @@ void SdrPageWindow::RedrawAll( sdr::contact::ViewObjectContactRedirector* pRedir // Set region as redraw area aDisplayInfo.SetRedrawArea(rRegion); - // Draw/Impress - aDisplayInfo.SetPageProcessingActive(rView.IsPagePaintingAllowed()); // #i72889# - // paint page GetObjectContact().ProcessDisplay(aDisplayInfo); } @@ -411,8 +408,11 @@ void SdrPageWindow::RedrawLayer(const SdrLayerID* pId, aDisplayInfo.SetRedrawArea(rRegion); // Writer or calc, coming from original RedrawOneLayer. - // #i72889# no page painting for layer painting - aDisplayInfo.SetPageProcessingActive(false); + // #i72889# no page painting or MasterPage painting for layer painting + const bool bOldPageDecorationAllowed(GetPageView().GetView().IsPageDecorationAllowed()); + const bool bOldMasterPageVisualizationAllowed(GetPageView().GetView().IsMasterPageVisualizationAllowed()); + GetPageView().GetView().SetPageDecorationAllowed(false); + GetPageView().GetView().SetMasterPageVisualizationAllowed(false); if (pPageFrame) // Writer page frame for anchor based clipping { @@ -421,6 +421,10 @@ void SdrPageWindow::RedrawLayer(const SdrLayerID* pId, // paint page GetObjectContact().ProcessDisplay(aDisplayInfo); + + // reset temporarily changed flags + GetPageView().GetView().SetPageDecorationAllowed(bOldPageDecorationAllowed); + GetPageView().GetView().SetMasterPageVisualizationAllowed(bOldMasterPageVisualizationAllowed); } // reset redirector diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index ca4fee08b8b4..da468968ee81 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -158,7 +158,8 @@ SdrPaintView::SdrPaintView(SdrModel& rSdrModel, OutputDevice* pOut) , mbAnimationPause(false) , mbBufferedOutputAllowed(false) , mbBufferedOverlayAllowed(false) - , mbPagePaintingAllowed(true) + , mbPageDecorationAllowed(true) + , mbMasterPageVisualizationAllowed(true) , mbPreviewRenderer(false) , mbHideOle(false) , mbHideChart(false) @@ -1182,11 +1183,19 @@ void SdrPaintView::SetBufferedOverlayAllowed(bool bNew) } -void SdrPaintView::SetPagePaintingAllowed(bool bNew) +void SdrPaintView::SetPageDecorationAllowed(bool bNew) { - if(bNew != mbPagePaintingAllowed) + if(bNew != mbPageDecorationAllowed) { - mbPagePaintingAllowed = bNew; + mbPageDecorationAllowed = bNew; + } +} + +void SdrPaintView::SetMasterPageVisualizationAllowed(bool bNew) +{ + if(bNew != mbMasterPageVisualizationAllowed) + { + mbMasterPageVisualizationAllowed = bNew; } } diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 6698dd0e34a8..2e8a776aeb2c 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -719,9 +719,10 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr pView->SetPageVisible( false ); pView->ShowSdrPage( pPage ); - // tdf#96922 completely deactivate EditView PageVisualization, including - // PageBackground (formerly 'wiese'). - pView->SetPagePaintingAllowed(false); + // tdf#96922 deactivate EditView PageVisualization, including PageBackground + // (formerly 'wiese'). Do *not* switch off MasterPageVisualizationAllowed, we + // want MasterPage content if a whole SdrPage is exported + pView->SetPageDecorationAllowed(false); const Point aNewOrg( pPage->GetLeftBorder(), pPage->GetUpperBorder() ); aNewSize = Size( aSize.Width() - pPage->GetLeftBorder() - pPage->GetRightBorder(), |