diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-03-18 17:43:13 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-03-25 11:11:53 +0100 |
commit | dda83832529fd8c7d02bdf14890faf84a3512112 (patch) | |
tree | 646112ff54839d6bb993ace539dcd2682c58698e /svx | |
parent | ad5a9d3414b9001b3508b9a5d0c8f7947a58250e (diff) |
tdf#134734 svx,sd: BackgroundFullSize
There is already a boolean SdPage::mbBackgroundFullSize, UNO property
and ODF import/export, but curiously no trace of it ever doing anything.
There is some mystery handling of SID_ATTR_PAGE_EXT2 there but in the
dialog that is only handled for SVX_PAGE_MODE_CENTER from Calc
for a completely different purpose.
Move mbBackgroundFullSize to base class SdrPage so that
ViewContactOfMasterPageDescriptor can access it to paint.
There's an oddity in the handling of the property where the dialog works
on the master page and not on the current slide, not sure why it was
implemented this way.
Change-Id: If6e1329e3f77e0a1a7226d5e51ceb221ea86c401
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112783
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'svx')
4 files changed, 37 insertions, 8 deletions
diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index ab26e2d2dd23..563022cd4f95 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -57,10 +57,15 @@ namespace sdr::contact rOwnerPage.GetLeftBorder(), rOwnerPage.GetUpperBorder(), rOwnerPage.GetWidth() - rOwnerPage.GetRightBorder(), rOwnerPage.GetHeight() - rOwnerPage.GetLowerBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::utils::createPolygonFromRect(aInnerRange)); + const basegfx::B2DRange aOuterRange( + 0, 0, rOwnerPage.GetWidth(), rOwnerPage.GetHeight()); + // ??? somehow only the master page's bit is used + bool const isFullSize(GetMasterPageDescriptor().GetUsedPage().IsBackgroundFullSize()); + const basegfx::B2DPolygon aFillPolygon( + basegfx::utils::createPolygonFromRect(isFullSize ? aOuterRange : aInnerRange)); const drawinglayer::primitive2d::Primitive2DReference xReference( drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), + basegfx::B2DPolyPolygon(aFillPolygon), aFill, drawinglayer::attribute::FillGradientAttribute())); diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 80d6ba00a180..19911ed53440 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -206,13 +206,17 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfMasterPage::createV if(!aFill.isDefault()) { // direct model data is the page size, get and use it + const basegfx::B2DRange aOuterRange( + 0, 0, rPage.GetWidth(), rPage.GetHeight()); const basegfx::B2DRange aInnerRange( rPage.GetLeftBorder(), rPage.GetUpperBorder(), rPage.GetWidth() - rPage.GetRightBorder(), rPage.GetHeight() - rPage.GetLowerBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::utils::createPolygonFromRect(aInnerRange)); + bool const isFullSize(rPage.IsBackgroundFullSize()); + const basegfx::B2DPolygon aFillPolygon( + basegfx::utils::createPolygonFromRect(isFullSize ? aOuterRange : aInnerRange)); const drawinglayer::primitive2d::Primitive2DReference xReference( drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), + basegfx::B2DPolyPolygon(aFillPolygon), aFill, drawinglayer::attribute::FillGradientAttribute())); diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index d27093eb80a5..0efa4c01750f 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -62,9 +62,14 @@ namespace sdr::contact // used range (retval) is fixed here, it's the MasterPage fill range const SdrPage& rOwnerPage = rDescriptor.GetOwnerPage(); - const basegfx::B2DRange aPageFillRange( + const basegfx::B2DRange aInnerRange( rOwnerPage.GetLeftBorder(), rOwnerPage.GetUpperBorder(), rOwnerPage.GetWidth() - rOwnerPage.GetRightBorder(), rOwnerPage.GetHeight() - rOwnerPage.GetLowerBorder()); + const basegfx::B2DRange aOuterRange( + 0, 0, rOwnerPage.GetWidth(), rOwnerPage.GetHeight()); + // ??? somehow only the master page's bit is used + bool const isFullSize(rDescriptor.GetUsedPage().IsBackgroundFullSize()); + basegfx::B2DRange const& rPageFillRange(isFullSize ? aOuterRange : aInnerRange); // Modify DisplayInfo for MasterPageContent collection; remember original layers and // set combined SdrLayerIDSet; set MasterPagePaint flag @@ -105,15 +110,15 @@ namespace sdr::contact const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); const basegfx::B2DRange aSubHierarchyRange(xMasterPageSequence.getB2DRange(rViewInformation2D)); - if(aPageFillRange.isInside(aSubHierarchyRange)) + if (rPageFillRange.isInside(aSubHierarchyRange)) { // completely inside, just render MasterPage content. Add to target xRetval.append(xMasterPageSequence); } - else if(aPageFillRange.overlaps(aSubHierarchyRange)) + else if (rPageFillRange.overlaps(aSubHierarchyRange)) { // overlapping, compute common area - basegfx::B2DRange aCommonArea(aPageFillRange); + basegfx::B2DRange aCommonArea(rPageFillRange); aCommonArea.intersect(aSubHierarchyRange); // need to create a clip primitive, add clipped list to target diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 91080e9be5ff..02a891f290ff 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1308,6 +1308,7 @@ void SdrPage::lateInit(const SdrPage& rSrcPage) mnBorderUpper = rSrcPage.mnBorderUpper; mnBorderRight = rSrcPage.mnBorderRight; mnBorderLower = rSrcPage.mnBorderLower; + mbBackgroundFullSize = rSrcPage.mbBackgroundFullSize; nPageNum = rSrcPage.nPageNum; if(rSrcPage.TRG_HasMasterPage()) @@ -1495,6 +1496,20 @@ sal_Int32 SdrPage::GetLowerBorder() const return mnBorderLower; } +void SdrPage::SetBackgroundFullSize(bool const bIn) +{ + if (bIn != mbBackgroundFullSize) + { + mbBackgroundFullSize = bIn; + SetChanged(); + } +} + +bool SdrPage::IsBackgroundFullSize() const +{ + return mbBackgroundFullSize; +} + // #i68775# React on PageNum changes (from Model in most cases) void SdrPage::SetPageNum(sal_uInt16 nNew) { |