diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-12-04 21:33:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-05 08:40:52 +0100 |
commit | 8206a8ef2fbf2de9cca6fb360707fb9b50e6a92c (patch) | |
tree | a136ae666879ee64209ce269d6d57defe460ea39 /svx | |
parent | 422b407290fe082adea9067835521da8c067743d (diff) |
use visitor in ViewObjectContact::createPrimitive2DSequence
to reduce intermediate object creation
Change-Id: I03d34d15e88f82027f865868aca08503e38fd6ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126372
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
17 files changed, 72 insertions, 96 deletions
diff --git a/svx/inc/sdr/contact/viewobjectcontactofe3d.hxx b/svx/inc/sdr/contact/viewobjectcontactofe3d.hxx index 9c0e09e4c036..591ed6504155 100644 --- a/svx/inc/sdr/contact/viewobjectcontactofe3d.hxx +++ b/svx/inc/sdr/contact/viewobjectcontactofe3d.hxx @@ -33,7 +33,7 @@ namespace sdr::contact { // also override the 2d method to deliver a 2d object with embedded 3d and the 3d transformation which is able to // answer the get2DRange question accordingly - virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; public: ViewObjectContactOfE3d(ObjectContact& rObjectContact, ViewContact& rViewContact); diff --git a/svx/inc/sdr/contact/viewobjectcontactofe3dscene.hxx b/svx/inc/sdr/contact/viewobjectcontactofe3dscene.hxx index 27ddbd21842f..cc1b2e7c345e 100644 --- a/svx/inc/sdr/contact/viewobjectcontactofe3dscene.hxx +++ b/svx/inc/sdr/contact/viewobjectcontactofe3dscene.hxx @@ -28,7 +28,7 @@ namespace sdr::contact class ViewObjectContactOfE3dScene final : public ViewObjectContactOfSdrObj { // 2d primitive creator - virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; public: // basic constructor. diff --git a/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx b/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx index b2286568c93f..74e616a45bc1 100644 --- a/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx +++ b/svx/inc/sdr/contact/viewobjectcontactofgraphic.hxx @@ -29,7 +29,7 @@ namespace sdr::contact class ViewObjectContactOfGraphic final : public ViewObjectContactOfSdrObj { // This method is responsible for creating the graphical visualisation data - virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; public: ViewObjectContactOfGraphic(ObjectContact& rObjectContact, ViewContact& rViewContact); diff --git a/svx/inc/sdr/contact/viewobjectcontactofpageobj.hxx b/svx/inc/sdr/contact/viewobjectcontactofpageobj.hxx index 16e168c41235..b651e083ec3c 100644 --- a/svx/inc/sdr/contact/viewobjectcontactofpageobj.hxx +++ b/svx/inc/sdr/contact/viewobjectcontactofpageobj.hxx @@ -37,8 +37,9 @@ private: // This method is responsible for creating the graphical visualisation data which is // stored/cached in the local primitive. // This method will not handle included hierarchies and not check geometric visibility. - virtual drawinglayer::primitive2d::Primitive2DContainer - createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence( + const DisplayInfo& rDisplayInfo, + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; public: ViewObjectContactOfPageObj(ObjectContact& rObjectContact, ViewContact& rViewContact); diff --git a/svx/inc/sdr/contact/viewobjectcontactofsdrole2obj.hxx b/svx/inc/sdr/contact/viewobjectcontactofsdrole2obj.hxx index 8afd0c2cc76d..2279f9b45954 100644 --- a/svx/inc/sdr/contact/viewobjectcontactofsdrole2obj.hxx +++ b/svx/inc/sdr/contact/viewobjectcontactofsdrole2obj.hxx @@ -29,8 +29,9 @@ namespace sdr::contact class ViewObjectContactOfSdrOle2Obj final : public ViewObjectContactOfSdrObj { // This method is responsible for creating the graphical visualisation data - virtual drawinglayer::primitive2d::Primitive2DContainer - createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence( + const DisplayInfo& rDisplayInfo, + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; public: ViewObjectContactOfSdrOle2Obj(ObjectContact& rObjectContact, ViewContact& rViewContact); diff --git a/svx/inc/sdr/contact/viewobjectcontactofsdrpage.hxx b/svx/inc/sdr/contact/viewobjectcontactofsdrpage.hxx index 7e04604f7328..a6fa46d43072 100644 --- a/svx/inc/sdr/contact/viewobjectcontactofsdrpage.hxx +++ b/svx/inc/sdr/contact/viewobjectcontactofsdrpage.hxx @@ -45,7 +45,7 @@ namespace sdr::contact { class ViewObjectContactOfPageBackground final : public ViewObjectContactOfPageSubObject { - virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; public: ViewObjectContactOfPageBackground(ObjectContact& rObjectContact, ViewContact& rViewContact); @@ -73,7 +73,7 @@ namespace sdr::contact { class ViewObjectContactOfPageFill final : public ViewObjectContactOfPageSubObject { - virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; public: ViewObjectContactOfPageFill(ObjectContact& rObjectContact, ViewContact& rViewContact); @@ -135,7 +135,7 @@ namespace sdr::contact { class ViewObjectContactOfPageGrid final : public ViewObjectContactOfPageSubObject { - virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; public: ViewObjectContactOfPageGrid(ObjectContact& rObjectContact, ViewContact& rViewContact); @@ -149,7 +149,7 @@ namespace sdr::contact { class ViewObjectContactOfPageHelplines final : public ViewObjectContactOfPageSubObject { - virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; public: ViewObjectContactOfPageHelplines(ObjectContact& rObjectContact, ViewContact& rViewContact); diff --git a/svx/inc/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/sdr/contact/viewobjectcontactofunocontrol.hxx index 2c708ec733c7..d7dc8ffdda03 100644 --- a/svx/inc/sdr/contact/viewobjectcontactofunocontrol.hxx +++ b/svx/inc/sdr/contact/viewobjectcontactofunocontrol.hxx @@ -91,7 +91,7 @@ namespace sdr::contact { virtual ~ViewObjectContactOfUnoControl() override; // support for Primitive2D - virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const override; + virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; // visibility check virtual bool isPrimitiveVisible( const DisplayInfo& _rDisplayInfo ) const override; @@ -113,7 +113,7 @@ namespace sdr::contact { UnoControlPrintOrPreviewContact( const UnoControlPrintOrPreviewContact& ) = delete; UnoControlPrintOrPreviewContact& operator=( const UnoControlPrintOrPreviewContact& ) = delete; - virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const override; + virtual void createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override; }; diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index d6dae7b3d119..c72c34dfaccb 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -289,7 +289,7 @@ void ViewObjectContact::checkForPrimitive2DAnimations(const drawinglayer::primit } } -drawinglayer::primitive2d::Primitive2DContainer ViewObjectContact::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const +void ViewObjectContact::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { // get the view-independent Primitive from the viewContact drawinglayer::primitive2d::Primitive2DContainer xRetval; @@ -325,7 +325,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContact::createPrimiti } } - return xRetval; + rVisitor.visit(xRetval); } drawinglayer::primitive2d::Primitive2DContainer ViewObjectContact::getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const @@ -337,11 +337,11 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContact::getPrimitive2 if(pRedirector) { - xNewPrimitiveSequence = pRedirector->createRedirectedPrimitive2DSequence(*this, rDisplayInfo); + pRedirector->createRedirectedPrimitive2DSequence(*this, rDisplayInfo, xNewPrimitiveSequence); } else { - xNewPrimitiveSequence = createPrimitive2DSequence(rDisplayInfo); + createPrimitive2DSequence(rDisplayInfo, xNewPrimitiveSequence); } // check for animated stuff diff --git a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx index 1d6bbe061614..c6d41bdc9533 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx @@ -58,12 +58,12 @@ namespace sdr::contact return xRetval; } - drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfE3d::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const + void ViewObjectContactOfE3d::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { const ViewContactOfE3d& rViewContact = static_cast< const ViewContactOfE3d& >(GetViewContact()); // get 3d primitive vector, isPrimitiveVisible() is done in 3d creator - return rViewContact.impCreateWithGivenPrimitive3DContainer(getPrimitive3DContainer(rDisplayInfo)); + rVisitor.visit(rViewContact.impCreateWithGivenPrimitive3DContainer(getPrimitive3DContainer(rDisplayInfo))); } diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx index 52dd5c30fdab..86fc1cab13f2 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx @@ -59,7 +59,7 @@ namespace sdr::contact { } - drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfE3dScene::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const + void ViewObjectContactOfE3dScene::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { // handle ghosted, else the whole 3d group will be encapsulated to a ghosted primitive set (see below) const bool bHandleGhostedDisplay(GetObjectContact().DoVisualizeEnteredGroup() && !GetObjectContact().isOutputToPrinter() && rDisplayInfo.IsGhostedDrawModeActive()); @@ -118,7 +118,7 @@ namespace sdr::contact const_cast< DisplayInfo& >(rDisplayInfo).SetGhostedDrawMode(); } - return xRetval; + rVisitor.visit(xRetval); } void ViewObjectContactOfE3dScene::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx index 98ce62c8ee1d..601ec28df1cd 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx @@ -23,29 +23,24 @@ namespace sdr::contact { - drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfGraphic::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const + void ViewObjectContactOfGraphic::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { - // get return value by calling parent - drawinglayer::primitive2d::Primitive2DContainer xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); + // #i103255# suppress when graphic needs draft visualisation and output + // is for PDF export/Printer + const ViewContactOfGraphic& rVCOfGraphic = static_cast< const ViewContactOfGraphic& >(GetViewContact()); - if(!xRetval.empty()) + if(rVCOfGraphic.visualisationUsesDraft()) { - // #i103255# suppress when graphic needs draft visualisation and output - // is for PDF export/Printer - const ViewContactOfGraphic& rVCOfGraphic = static_cast< const ViewContactOfGraphic& >(GetViewContact()); + const ObjectContact& rObjectContact = GetObjectContact(); - if(rVCOfGraphic.visualisationUsesDraft()) + if(rObjectContact.isOutputToPDFFile() || rObjectContact.isOutputToPrinter()) { - const ObjectContact& rObjectContact = GetObjectContact(); - - if(rObjectContact.isOutputToPDFFile() || rObjectContact.isOutputToPrinter()) - { - xRetval = drawinglayer::primitive2d::Primitive2DContainer(); - } + return; } } - return xRetval; + // get return value by calling parent + ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo, rVisitor); } ViewObjectContactOfGraphic::ViewObjectContactOfGraphic(ObjectContact& rObjectContact, ViewContact& rViewContact) diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index d9e9909e8ff7..9c9ff3bf8c96 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -181,9 +181,8 @@ bool PagePrimitiveExtractor::isDrawModeHighContrast() const { return mrViewObjec SdrPageView* PagePrimitiveExtractor::TryToGetSdrPageView() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetSdrPageView(); } OutputDevice* PagePrimitiveExtractor::TryToGetOutputDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetOutputDevice(); } -drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageObj::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const +void ViewObjectContactOfPageObj::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { - drawinglayer::primitive2d::Primitive2DContainer xRetval; const SdrPageObj& rPageObject(static_cast< ViewContactOfPageObj& >(GetViewContact()).GetPageObj()); const SdrPage* pPage = rPageObject.GetReferencedPage(); const svtools::ColorConfig aColorConfig; @@ -263,7 +262,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageObj::crea const uno::Reference< drawing::XDrawPage > xDrawPage(GetXDrawPageForSdrPage(const_cast< SdrPage*>(pPage))); const drawinglayer::primitive2d::Primitive2DReference xPagePreview(new drawinglayer::primitive2d::PagePreviewPrimitive2D( xDrawPage, aPageObjectTransform, fPageWidth, fPageHeight, std::move(xPageContent))); - xRetval = drawinglayer::primitive2d::Primitive2DContainer { xPagePreview }; + rVisitor.visit(xPagePreview); } } else if(bCreateGrayFrame) @@ -273,7 +272,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageObj::crea const drawinglayer::primitive2d::Primitive2DReference xFrameHit( drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( aPageObjectTransform)); - xRetval = drawinglayer::primitive2d::Primitive2DContainer { xFrameHit }; + rVisitor.visit(xFrameHit); } // add a gray outline frame, except not when printing @@ -286,10 +285,8 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageObj::crea const drawinglayer::primitive2d::Primitive2DReference xGrayFrame( new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOwnOutline, aFrameColor.getBColor())); - xRetval.push_back(xGrayFrame); + rVisitor.visit(xGrayFrame); } - - return xRetval; } ViewObjectContactOfPageObj::ViewObjectContactOfPageObj(ObjectContact& rObjectContact, ViewContact& rViewContact) diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index d5a8fe4befc1..66d1a6fb4c7d 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -37,13 +37,12 @@ using namespace com::sun::star; namespace sdr::contact { -drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfSdrOle2Obj::createPrimitive2DSequence( - const DisplayInfo& /*rDisplayInfo*/) const +void ViewObjectContactOfSdrOle2Obj::createPrimitive2DSequence( + const DisplayInfo& /*rDisplayInfo*/, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { // override this method to do some things the old SdrOle2Obj::DoPaintObject did. // In the future, some of these may be solved different, but ATM try to stay compatible // with the old behaviour - drawinglayer::primitive2d::Primitive2DContainer xRetval; const SdrOle2Obj& rSdrOle2 = static_cast< ViewContactOfSdrOle2Obj& >(GetViewContact()).GetOle2Obj(); sal_Int32 nState(-1); @@ -99,7 +98,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfSdrOle2Obj::c // create OLE primitive stuff directly at VC with HC as parameter const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact()); - rVC.createPrimitive2DSequenceWithParameters(xRetval); + rVC.createPrimitive2DSequenceWithParameters(rVisitor); if(bIsOutplaceActive) { @@ -127,13 +126,11 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfSdrOle2Obj::c COL_BLACK.getBColor(), aFillHatch)); - xRetval.push_back(xReference); + rVisitor.visit(xReference); } } } - - return xRetval; } ViewObjectContactOfSdrOle2Obj::ViewObjectContactOfSdrOle2Obj(ObjectContact& rObjectContact, ViewContact& rViewContact) diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx index 8945277720ea..fe9855f4cdd3 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx @@ -112,13 +112,12 @@ bool ViewObjectContactOfPageBackground::isPrimitiveVisible(const DisplayInfo& rD return true; } -drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageBackground::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const +void ViewObjectContactOfPageBackground::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { // Initialize background. Dependent of IsPageVisible, use ApplicationBackgroundColor or ApplicationDocumentColor. Most // old renderers for export (html, pdf, gallery, ...) set the page to not visible (SetPageVisible(false)). They expect the // given OutputDevice to be initialized with the ApplicationDocumentColor then. const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); - drawinglayer::primitive2d::Primitive2DContainer xRetval; if(pPageView) { @@ -141,12 +140,9 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageBackgroun } // init background with InitColor - xRetval.resize(1); const basegfx::BColor aRGBColor(aInitColor.getBColor()); - xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor, (255 - aInitColor.GetAlpha()) / 255.0)); + rVisitor.visit(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor, (255 - aInitColor.GetAlpha()) / 255.0)); } - - return xRetval; } ViewObjectContactOfMasterPage::ViewObjectContactOfMasterPage(ObjectContact& rObjectContact, ViewContact& rViewContact) @@ -207,10 +203,9 @@ bool ViewObjectContactOfPageFill::isPrimitiveVisible(const DisplayInfo& rDisplay return true; } -drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageFill::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const +void ViewObjectContactOfPageFill::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); - drawinglayer::primitive2d::Primitive2DContainer xRetval; if(pPageView) { @@ -231,12 +226,9 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageFill::cre } // create and add primitive - xRetval.resize(1); const basegfx::BColor aRGBColor(aPageFillColor.getBColor()); - xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor)); + rVisitor.visit(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor)); } - - return xRetval; } ViewObjectContactOfPageShadow::ViewObjectContactOfPageShadow(ObjectContact& rObjectContact, ViewContact& rViewContact) @@ -423,10 +415,9 @@ bool ViewObjectContactOfPageGrid::isPrimitiveVisible(const DisplayInfo& rDisplay return true; } -drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageGrid::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const +void ViewObjectContactOfPageGrid::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); - drawinglayer::primitive2d::Primitive2DContainer xRetval; if(pPageView) { @@ -448,13 +439,10 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageGrid::cre const sal_uInt32 nSubdivisionsX(aFine.getWidth() ? aRaw.getWidth() / aFine.getWidth() : 0); const sal_uInt32 nSubdivisionsY(aFine.getHeight() ? aRaw.getHeight() / aFine.getHeight() : 0); - xRetval.resize(1); - xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::GridPrimitive2D( + rVisitor.visit(new drawinglayer::primitive2d::GridPrimitive2D( aGridMatrix, fWidthX, fWidthY, 10.0, 3.0, nSubdivisionsX, nSubdivisionsY, aRGBGridColor, drawinglayer::primitive2d::createDefaultCross_3x3(aRGBGridColor))); } - - return xRetval; } ViewObjectContactOfPageHelplines::ViewObjectContactOfPageHelplines(ObjectContact& rObjectContact, ViewContact& rViewContact) @@ -501,9 +489,8 @@ bool ViewObjectContactOfPageHelplines::isPrimitiveVisible(const DisplayInfo& rDi return true; } -drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageHelplines::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const +void ViewObjectContactOfPageHelplines::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { - drawinglayer::primitive2d::Primitive2DContainer xRetval; const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); if(pPageView) @@ -515,7 +502,6 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageHelplines { const basegfx::BColor aRGBColorA(1.0, 1.0, 1.0); const basegfx::BColor aRGBColorB(0.0, 0.0, 0.0); - xRetval.resize(nCount); for(sal_uInt32 a(0); a < nCount; a++) { @@ -527,21 +513,21 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageHelplines { default : // SdrHelpLineKind::Point { - xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D( + rVisitor.visit(new drawinglayer::primitive2d::HelplinePrimitive2D( aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HelplineStyle2D::Point, aRGBColorA, aRGBColorB, fDiscreteDashLength)); break; } case SdrHelpLineKind::Vertical : { - xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D( + rVisitor.visit(new drawinglayer::primitive2d::HelplinePrimitive2D( aPosition, basegfx::B2DVector(0.0, 1.0), drawinglayer::primitive2d::HelplineStyle2D::Line, aRGBColorA, aRGBColorB, fDiscreteDashLength)); break; } case SdrHelpLineKind::Horizontal : { - xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D( + rVisitor.visit(new drawinglayer::primitive2d::HelplinePrimitive2D( aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HelplineStyle2D::Line, aRGBColorA, aRGBColorB, fDiscreteDashLength)); break; @@ -550,8 +536,6 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageHelplines } } } - - return xRetval; } ViewObjectContactOfSdrPage::ViewObjectContactOfSdrPage(ObjectContact& rObjectContact, ViewContact& rViewContact) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 042d1f9516e3..4881954b2eb1 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1646,25 +1646,24 @@ namespace sdr::contact { } - drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfUnoControl::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const + void ViewObjectContactOfUnoControl::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { if ( m_pImpl->isDisposed() ) // our control already died. // TODO: Is it worth re-creating the control? Finally, this is a pathological situation, it means some instance // disposed the control though it doesn't own it. So, /me thinks we should not bother here. - return drawinglayer::primitive2d::Primitive2DContainer(); + return; if ( GetObjectContact().getViewInformation2D().getViewTransformation().isIdentity() ) // remove this when #i115754# is fixed - return drawinglayer::primitive2d::Primitive2DContainer(); + return; // ignore existing controls which are in alive mode and manually switched to "invisible" #i102090# const ControlHolder& rControl( m_pImpl->getExistentControl() ); if ( rControl.is() && !rControl.isDesignMode() && !rControl.isVisible() ) - return drawinglayer::primitive2d::Primitive2DContainer(); + return; - ::drawinglayer::primitive2d::Primitive2DReference xPrimitive( new LazyControlCreationPrimitive2D( m_pImpl ) ); - return ::drawinglayer::primitive2d::Primitive2DContainer { xPrimitive }; + rVisitor.visit( new LazyControlCreationPrimitive2D( m_pImpl ) ); } @@ -1761,11 +1760,11 @@ namespace sdr::contact { } - drawinglayer::primitive2d::Primitive2DContainer UnoControlPrintOrPreviewContact::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const + void UnoControlPrintOrPreviewContact::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor ) const { if ( !m_pImpl->isPrintableControl() ) - return drawinglayer::primitive2d::Primitive2DContainer(); - return ViewObjectContactOfUnoControl::createPrimitive2DSequence( rDisplayInfo ); + return; + ViewObjectContactOfUnoControl::createPrimitive2DSequence( rDisplayInfo, rVisitor ); } diff --git a/svx/source/sdr/contact/viewobjectcontactredirector.cxx b/svx/source/sdr/contact/viewobjectcontactredirector.cxx index fa3b52933f68..c49909327019 100644 --- a/svx/source/sdr/contact/viewobjectcontactredirector.cxx +++ b/svx/source/sdr/contact/viewobjectcontactredirector.cxx @@ -28,11 +28,11 @@ ViewObjectContactRedirector::ViewObjectContactRedirector() {} // The destructor. ViewObjectContactRedirector::~ViewObjectContactRedirector() {} -drawinglayer::primitive2d::Primitive2DContainer -ViewObjectContactRedirector::createRedirectedPrimitive2DSequence( - const sdr::contact::ViewObjectContact& rOriginal, const sdr::contact::DisplayInfo& rDisplayInfo) +void ViewObjectContactRedirector::createRedirectedPrimitive2DSequence( + const sdr::contact::ViewObjectContact& rOriginal, const sdr::contact::DisplayInfo& rDisplayInfo, + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) { - return rOriginal.createPrimitive2DSequence(rDisplayInfo); + return rOriginal.createPrimitive2DSequence(rDisplayInfo, rVisitor); } } diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 73d77cb54ea8..ed6978f106d1 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -276,9 +276,10 @@ class ImplExportCheckVisisbilityRedirector : public sdr::contact::ViewObjectCont public: explicit ImplExportCheckVisisbilityRedirector( SdrPage* pCurrentPage ); - virtual drawinglayer::primitive2d::Primitive2DContainer createRedirectedPrimitive2DSequence( + virtual void createRedirectedPrimitive2DSequence( const sdr::contact::ViewObjectContact& rOriginal, - const sdr::contact::DisplayInfo& rDisplayInfo) override; + const sdr::contact::DisplayInfo& rDisplayInfo, + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) override; private: SdrPage* mpCurrentPage; @@ -289,9 +290,10 @@ ImplExportCheckVisisbilityRedirector::ImplExportCheckVisisbilityRedirector( SdrP { } -drawinglayer::primitive2d::Primitive2DContainer ImplExportCheckVisisbilityRedirector::createRedirectedPrimitive2DSequence( +void ImplExportCheckVisisbilityRedirector::createRedirectedPrimitive2DSequence( const sdr::contact::ViewObjectContact& rOriginal, - const sdr::contact::DisplayInfo& rDisplayInfo) + const sdr::contact::DisplayInfo& rDisplayInfo, + drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) { SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject(); @@ -306,15 +308,15 @@ drawinglayer::primitive2d::Primitive2DContainer ImplExportCheckVisisbilityRedire if( (pPage == nullptr) || pPage->checkVisibility(rOriginal, rDisplayInfo, false) ) { - return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo); + return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo, rVisitor); } - return drawinglayer::primitive2d::Primitive2DContainer(); + return; } else { // not an object, maybe a page - return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo); + sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo, rVisitor); } } |