diff options
Diffstat (limited to 'svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx')
-rw-r--r-- | svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx | 65 |
1 files changed, 26 insertions, 39 deletions
diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index e0c1e46c4e69..ba260e79bba9 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -38,12 +38,14 @@ #include <svx/svdview.hxx> #include <svx/sdr/contact/viewcontactofsdrpage.hxx> #include <svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <svx/svdpage.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -59,33 +61,30 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; - const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject(); - if(pBackgroundCandidate) - { - // build primitive from pBackgroundCandidate's attributes - const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); - - if(pFill) - { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); - const basegfx::B2DRange aInnerRange( - rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), - rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + // build primitive from page fill attributes + const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes)); - delete pFill; - } + if(!aFill.isDefault()) + { + // direct model data is the page size, get and use it + const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); + const basegfx::B2DRange aInnerRange( + rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), + rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), + rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } return xRetval; @@ -105,23 +104,11 @@ namespace sdr sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const { - sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount()); - - if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nRetval--; - } - - return nRetval; + return GetMasterPageDescriptor().GetUsedPage().GetObjCount(); } ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const { - if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nIndex++; - } - return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact(); } |